diff --git a/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java b/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java index e6a35bd6100..ee2a80f0c7e 100644 --- a/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java +++ b/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java @@ -111,756 +111,637 @@ * Contains implementations of {@link RoleHandler}s for all {@link CtRole}s of all model elements */ class ModelRoleHandlers { - static final RoleHandler[] roleHandlers = new RoleHandler[]{ new CtNamedElement_NAME_RoleHandler(), new CtReference_NAME_RoleHandler(), new CtArrayTypeReference_TYPE_RoleHandler(), new CtExecutableReference_TYPE_RoleHandler(), new CtMultiTypedElement_TYPE_RoleHandler(), new CtTypedElement_TYPE_RoleHandler(), new CtVariableReference_TYPE_RoleHandler(), new CtExecutableReference_DECLARING_TYPE_RoleHandler(), new CtFieldReference_DECLARING_TYPE_RoleHandler(), new CtTypeReference_DECLARING_TYPE_RoleHandler(), new CtPackage_CONTAINED_TYPE_RoleHandler(), new CtBodyHolder_BODY_RoleHandler(), new CtSynchronized_BODY_RoleHandler(), new CtShadowable_IS_SHADOW_RoleHandler(), new CtIntersectionTypeReference_BOUND_RoleHandler(), new CtTypeParameterReference_BOUNDING_TYPE_RoleHandler(), new CtFieldReference_IS_FINAL_RoleHandler(), new CtExecutableReference_IS_STATIC_RoleHandler(), new CtFieldReference_IS_STATIC_RoleHandler(), new CtTypeParameterReference_IS_UPPER_RoleHandler(), new CtElement_IS_IMPLICIT_RoleHandler(), new CtMethod_IS_DEFAULT_RoleHandler(), new CtParameter_IS_VARARGS_RoleHandler(), new CtAnnotationMethod_DEFAULT_EXPRESSION_RoleHandler(), new CtVariable_DEFAULT_EXPRESSION_RoleHandler(), new CtConditional_THEN_RoleHandler(), new CtIf_THEN_RoleHandler(), new CtConditional_ELSE_RoleHandler(), new CtIf_ELSE_RoleHandler(), new CtTypeReference_PACKAGE_REF_RoleHandler(), new CtPackage_SUB_PACKAGE_RoleHandler(), new CtAssert_CONDITION_RoleHandler(), new CtConditional_CONDITION_RoleHandler(), new CtIf_CONDITION_RoleHandler(), new CtBinaryOperator_RIGHT_OPERAND_RoleHandler(), new CtBinaryOperator_LEFT_OPERAND_RoleHandler(), new CtStatement_LABEL_RoleHandler(), new CtSwitch_CASE_RoleHandler(), new CtBinaryOperator_OPERATOR_KIND_RoleHandler(), new CtOperatorAssignment_OPERATOR_KIND_RoleHandler(), new CtUnaryOperator_OPERATOR_KIND_RoleHandler(), new CtCatch_PARAMETER_RoleHandler(), new CtExecutable_PARAMETER_RoleHandler(), new CtExecutableReference_ARGUMENT_TYPE_RoleHandler(), new CtArrayAccess_EXPRESSION_RoleHandler(), new CtAssert_EXPRESSION_RoleHandler(), new CtCase_EXPRESSION_RoleHandler(), new CtDo_EXPRESSION_RoleHandler(), new CtFor_EXPRESSION_RoleHandler(), new CtForEach_EXPRESSION_RoleHandler(), new CtLambda_EXPRESSION_RoleHandler(), new CtNewArray_EXPRESSION_RoleHandler(), new CtReturn_EXPRESSION_RoleHandler(), new CtSwitch_EXPRESSION_RoleHandler(), new CtSynchronized_EXPRESSION_RoleHandler(), new CtThrow_EXPRESSION_RoleHandler(), new CtUnaryOperator_EXPRESSION_RoleHandler(), new CtWhile_EXPRESSION_RoleHandler(), new CtTargetedExpression_TARGET_RoleHandler(), new CtVariableAccess_VARIABLE_RoleHandler(), new CtTry_FINALIZER_RoleHandler(), new CtExecutable_THROWN_RoleHandler(), new CtRHSReceiver_ASSIGNMENT_RoleHandler(), new CtAssignment_ASSIGNED_RoleHandler(), new CtModifiable_MODIFIER_RoleHandler(), new CtTypeInformation_MODIFIER_RoleHandler(), new CtElement_COMMENT_RoleHandler(), new CtAnnotation_ANNOTATION_TYPE_RoleHandler(), new CtTypeInformation_INTERFACE_RoleHandler(), new CtElement_ANNOTATION_RoleHandler(), new CtStatementList_STATEMENT_RoleHandler(), new CtAbstractInvocation_ARGUMENT_RoleHandler(), new CtTypeInformation_SUPER_TYPE_RoleHandler(), new CtNewClass_NESTED_TYPE_RoleHandler(), new CtType_NESTED_TYPE_RoleHandler(), new CtClass_CONSTRUCTOR_RoleHandler(), new CtAbstractInvocation_EXECUTABLE_REF_RoleHandler(), new CtExecutableReferenceExpression_EXECUTABLE_REF_RoleHandler(), new CtParameterReference_EXECUTABLE_REF_RoleHandler(), new CtType_METHOD_RoleHandler(), new CtClass_ANNONYMOUS_EXECUTABLE_RoleHandler(), new CtType_FIELD_RoleHandler(), new CtType_TYPE_MEMBER_RoleHandler(), new CtExpression_CAST_RoleHandler(), new CtAnnotation_VALUE_RoleHandler(), new CtEnum_VALUE_RoleHandler(), new CtLiteral_VALUE_RoleHandler(), new CtFor_FOR_UPDATE_RoleHandler(), new CtFor_FOR_INIT_RoleHandler(), new CtForEach_FOREACH_VARIABLE_RoleHandler(), new CtTryWithResource_TRY_RESOURCE_RoleHandler(), new CtNewArray_DIMENSION_RoleHandler(), new CtTry_CATCH_RoleHandler(), new CtLabelledFlowBreak_TARGET_LABEL_RoleHandler(), new CtFormalTypeDeclarer_TYPE_PARAMETER_RoleHandler(), new CtActualTypeContainer_TYPE_ARGUMENT_RoleHandler(), new CtJavaDoc_COMMENT_TAG_RoleHandler(), new CtComment_COMMENT_CONTENT_RoleHandler(), new CtJavaDocTag_COMMENT_CONTENT_RoleHandler(), new CtComment_COMMENT_TYPE_RoleHandler(), new CtJavaDocTag_DOCUMENTATION_TYPE_RoleHandler(), new CtJavaDocTag_JAVADOC_TAG_VALUE_RoleHandler(), new CtElement_POSITION_RoleHandler(), new CtCodeSnippet_SNIPPET_RoleHandler(), new CtTypeAccess_ACCESSED_TYPE_RoleHandler() }; + static final RoleHandler[] roleHandlers = new RoleHandler[]{ new CtTypeAccess_ACCESSED_TYPE_RoleHandler(), new CtClass_ANNONYMOUS_EXECUTABLE_RoleHandler(), new CtElement_ANNOTATION_RoleHandler(), new CtAnnotation_ANNOTATION_TYPE_RoleHandler(), new CtAbstractInvocation_ARGUMENT_RoleHandler(), new CtExecutableReference_ARGUMENT_TYPE_RoleHandler(), new CtAssignment_ASSIGNED_RoleHandler(), new CtRHSReceiver_ASSIGNMENT_RoleHandler(), new CtBodyHolder_BODY_RoleHandler(), new CtSynchronized_BODY_RoleHandler(), new CtIntersectionTypeReference_BOUND_RoleHandler(), new CtTypeParameterReference_BOUNDING_TYPE_RoleHandler(), new CtSwitch_CASE_RoleHandler(), new CtExpression_CAST_RoleHandler(), new CtTry_CATCH_RoleHandler(), new CtElement_COMMENT_RoleHandler(), new CtComment_COMMENT_CONTENT_RoleHandler(), new CtJavaDocTag_COMMENT_CONTENT_RoleHandler(), new CtJavaDoc_COMMENT_TAG_RoleHandler(), new CtComment_COMMENT_TYPE_RoleHandler(), new CtAssert_CONDITION_RoleHandler(), new CtConditional_CONDITION_RoleHandler(), new CtIf_CONDITION_RoleHandler(), new CtClass_CONSTRUCTOR_RoleHandler(), new CtPackage_CONTAINED_TYPE_RoleHandler(), new CtExecutableReference_DECLARING_TYPE_RoleHandler(), new CtFieldReference_DECLARING_TYPE_RoleHandler(), new CtTypeReference_DECLARING_TYPE_RoleHandler(), new CtAnnotationMethod_DEFAULT_EXPRESSION_RoleHandler(), new CtVariable_DEFAULT_EXPRESSION_RoleHandler(), new CtNewArray_DIMENSION_RoleHandler(), new CtJavaDocTag_DOCUMENTATION_TYPE_RoleHandler(), new CtConditional_ELSE_RoleHandler(), new CtIf_ELSE_RoleHandler(), new CtAbstractInvocation_EXECUTABLE_REF_RoleHandler(), new CtExecutableReferenceExpression_EXECUTABLE_REF_RoleHandler(), new CtParameterReference_EXECUTABLE_REF_RoleHandler(), new CtArrayAccess_EXPRESSION_RoleHandler(), new CtAssert_EXPRESSION_RoleHandler(), new CtCase_EXPRESSION_RoleHandler(), new CtDo_EXPRESSION_RoleHandler(), new CtFor_EXPRESSION_RoleHandler(), new CtForEach_EXPRESSION_RoleHandler(), new CtLambda_EXPRESSION_RoleHandler(), new CtNewArray_EXPRESSION_RoleHandler(), new CtReturn_EXPRESSION_RoleHandler(), new CtSwitch_EXPRESSION_RoleHandler(), new CtSynchronized_EXPRESSION_RoleHandler(), new CtThrow_EXPRESSION_RoleHandler(), new CtUnaryOperator_EXPRESSION_RoleHandler(), new CtWhile_EXPRESSION_RoleHandler(), new CtType_FIELD_RoleHandler(), new CtTry_FINALIZER_RoleHandler(), new CtForEach_FOREACH_VARIABLE_RoleHandler(), new CtFor_FOR_INIT_RoleHandler(), new CtFor_FOR_UPDATE_RoleHandler(), new CtTypeInformation_INTERFACE_RoleHandler(), new CtMethod_IS_DEFAULT_RoleHandler(), new CtFieldReference_IS_FINAL_RoleHandler(), new CtElement_IS_IMPLICIT_RoleHandler(), new CtShadowable_IS_SHADOW_RoleHandler(), new CtExecutableReference_IS_STATIC_RoleHandler(), new CtFieldReference_IS_STATIC_RoleHandler(), new CtTypeParameterReference_IS_UPPER_RoleHandler(), new CtParameter_IS_VARARGS_RoleHandler(), new CtJavaDocTag_JAVADOC_TAG_VALUE_RoleHandler(), new CtStatement_LABEL_RoleHandler(), new CtBinaryOperator_LEFT_OPERAND_RoleHandler(), new CtType_METHOD_RoleHandler(), new CtModifiable_MODIFIER_RoleHandler(), new CtTypeInformation_MODIFIER_RoleHandler(), new CtNamedElement_NAME_RoleHandler(), new CtReference_NAME_RoleHandler(), new CtNewClass_NESTED_TYPE_RoleHandler(), new CtType_NESTED_TYPE_RoleHandler(), new CtBinaryOperator_OPERATOR_KIND_RoleHandler(), new CtOperatorAssignment_OPERATOR_KIND_RoleHandler(), new CtUnaryOperator_OPERATOR_KIND_RoleHandler(), new CtTypeReference_PACKAGE_REF_RoleHandler(), new CtCatch_PARAMETER_RoleHandler(), new CtExecutable_PARAMETER_RoleHandler(), new CtElement_POSITION_RoleHandler(), new CtBinaryOperator_RIGHT_OPERAND_RoleHandler(), new CtCodeSnippet_SNIPPET_RoleHandler(), new CtStatementList_STATEMENT_RoleHandler(), new CtPackage_SUB_PACKAGE_RoleHandler(), new CtTypeInformation_SUPER_TYPE_RoleHandler(), new CtTargetedExpression_TARGET_RoleHandler(), new CtLabelledFlowBreak_TARGET_LABEL_RoleHandler(), new CtConditional_THEN_RoleHandler(), new CtIf_THEN_RoleHandler(), new CtExecutable_THROWN_RoleHandler(), new CtTryWithResource_TRY_RESOURCE_RoleHandler(), new CtArrayTypeReference_TYPE_RoleHandler(), new CtExecutableReference_TYPE_RoleHandler(), new CtMultiTypedElement_TYPE_RoleHandler(), new CtTypedElement_TYPE_RoleHandler(), new CtVariableReference_TYPE_RoleHandler(), new CtActualTypeContainer_TYPE_ARGUMENT_RoleHandler(), new CtType_TYPE_MEMBER_RoleHandler(), new CtFormalTypeDeclarer_TYPE_PARAMETER_RoleHandler(), new CtAnnotation_VALUE_RoleHandler(), new CtEnum_VALUE_RoleHandler(), new CtLiteral_VALUE_RoleHandler(), new CtVariableAccess_VARIABLE_RoleHandler() }; private ModelRoleHandlers() { } - static class CtNamedElement_NAME_RoleHandler extends SingleHandler { - private CtNamedElement_NAME_RoleHandler() { - super(CtRole.NAME, CtNamedElement.class, String.class); + static class CtTypeAccess_ACCESSED_TYPE_RoleHandler extends SingleHandler> { + private CtTypeAccess_ACCESSED_TYPE_RoleHandler() { + super(CtRole.ACCESSED_TYPE, CtTypeAccess.class, CtTypeReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getSimpleName()))); + return ((U) ((Object) (castTarget(element).getAccessedType()))); } @Override public void setValue(T element, U value) { - castTarget(element).setSimpleName(castValue(value)); + castTarget(element).setAccessedType(castValue(value)); } } - static class CtReference_NAME_RoleHandler extends SingleHandler { - private CtReference_NAME_RoleHandler() { - super(CtRole.NAME, CtReference.class, String.class); + static class CtClass_ANNONYMOUS_EXECUTABLE_RoleHandler extends ListHandler { + private CtClass_ANNONYMOUS_EXECUTABLE_RoleHandler() { + super(CtRole.ANNONYMOUS_EXECUTABLE, CtClass.class, CtAnonymousExecutable.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getSimpleName()))); + return ((U) ((Object) (castTarget(element).getAnonymousExecutables()))); } @Override public void setValue(T element, U value) { - castTarget(element).setSimpleName(castValue(value)); + castTarget(element).setAnonymousExecutables(castValue(value)); } } - static class CtArrayTypeReference_TYPE_RoleHandler extends SingleHandler> { - private CtArrayTypeReference_TYPE_RoleHandler() { - super(CtRole.TYPE, CtArrayTypeReference.class, CtTypeReference.class); + static class CtElement_ANNOTATION_RoleHandler extends ListHandler> { + private CtElement_ANNOTATION_RoleHandler() { + super(CtRole.ANNOTATION, CtElement.class, CtAnnotation.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getComponentType()))); + return ((U) ((Object) (castTarget(element).getAnnotations()))); } @Override public void setValue(T element, U value) { - castTarget(element).setComponentType(castValue(value)); + castTarget(element).setAnnotations(castValue(value)); } } - static class CtExecutableReference_TYPE_RoleHandler extends SingleHandler> { - private CtExecutableReference_TYPE_RoleHandler() { - super(CtRole.TYPE, CtExecutableReference.class, CtTypeReference.class); + static class CtAnnotation_ANNOTATION_TYPE_RoleHandler extends SingleHandler> { + private CtAnnotation_ANNOTATION_TYPE_RoleHandler() { + super(CtRole.ANNOTATION_TYPE, CtAnnotation.class, CtTypeReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getType()))); + return ((U) ((Object) (castTarget(element).getAnnotationType()))); } @Override public void setValue(T element, U value) { - castTarget(element).setType(castValue(value)); + castTarget(element).setAnnotationType(castValue(value)); } } - static class CtMultiTypedElement_TYPE_RoleHandler extends ListHandler> { - private CtMultiTypedElement_TYPE_RoleHandler() { - super(CtRole.TYPE, CtMultiTypedElement.class, CtTypeReference.class); + static class CtAbstractInvocation_ARGUMENT_RoleHandler extends ListHandler> { + private CtAbstractInvocation_ARGUMENT_RoleHandler() { + super(CtRole.ARGUMENT, CtAbstractInvocation.class, CtExpression.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getMultiTypes()))); + return ((U) ((Object) (castTarget(element).getArguments()))); } @Override public void setValue(T element, U value) { - castTarget(element).setMultiTypes(castValue(value)); + castTarget(element).setArguments(castValue(value)); } } - static class CtTypedElement_TYPE_RoleHandler extends SingleHandler> { - private CtTypedElement_TYPE_RoleHandler() { - super(CtRole.TYPE, CtTypedElement.class, CtTypeReference.class); + static class CtExecutableReference_ARGUMENT_TYPE_RoleHandler extends ListHandler> { + private CtExecutableReference_ARGUMENT_TYPE_RoleHandler() { + super(CtRole.ARGUMENT_TYPE, CtExecutableReference.class, CtTypeReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getType()))); + return ((U) ((Object) (castTarget(element).getParameters()))); } @Override public void setValue(T element, U value) { - castTarget(element).setType(castValue(value)); + castTarget(element).setParameters(castValue(value)); } } - static class CtVariableReference_TYPE_RoleHandler extends SingleHandler> { - private CtVariableReference_TYPE_RoleHandler() { - super(CtRole.TYPE, CtVariableReference.class, CtTypeReference.class); + static class CtAssignment_ASSIGNED_RoleHandler extends SingleHandler> { + private CtAssignment_ASSIGNED_RoleHandler() { + super(CtRole.ASSIGNED, CtAssignment.class, CtExpression.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getType()))); + return ((U) ((Object) (castTarget(element).getAssigned()))); } @Override public void setValue(T element, U value) { - castTarget(element).setType(castValue(value)); + castTarget(element).setAssigned(castValue(value)); } } - static class CtExecutableReference_DECLARING_TYPE_RoleHandler extends SingleHandler> { - private CtExecutableReference_DECLARING_TYPE_RoleHandler() { - super(CtRole.DECLARING_TYPE, CtExecutableReference.class, CtTypeReference.class); + static class CtRHSReceiver_ASSIGNMENT_RoleHandler extends SingleHandler> { + private CtRHSReceiver_ASSIGNMENT_RoleHandler() { + super(CtRole.ASSIGNMENT, CtRHSReceiver.class, CtExpression.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getDeclaringType()))); + return ((U) ((Object) (castTarget(element).getAssignment()))); } @Override public void setValue(T element, U value) { - castTarget(element).setDeclaringType(castValue(value)); + castTarget(element).setAssignment(castValue(value)); } } - static class CtFieldReference_DECLARING_TYPE_RoleHandler extends SingleHandler> { - private CtFieldReference_DECLARING_TYPE_RoleHandler() { - super(CtRole.DECLARING_TYPE, CtFieldReference.class, CtTypeReference.class); + static class CtBodyHolder_BODY_RoleHandler extends SingleHandler { + private CtBodyHolder_BODY_RoleHandler() { + super(CtRole.BODY, CtBodyHolder.class, CtStatement.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getDeclaringType()))); + return ((U) ((Object) (castTarget(element).getBody()))); } @Override public void setValue(T element, U value) { - castTarget(element).setDeclaringType(castValue(value)); + castTarget(element).setBody(castValue(value)); } } - static class CtTypeReference_DECLARING_TYPE_RoleHandler extends SingleHandler> { - private CtTypeReference_DECLARING_TYPE_RoleHandler() { - super(CtRole.DECLARING_TYPE, CtTypeReference.class, CtTypeReference.class); + static class CtSynchronized_BODY_RoleHandler extends SingleHandler> { + private CtSynchronized_BODY_RoleHandler() { + super(CtRole.BODY, CtSynchronized.class, CtBlock.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getDeclaringType()))); + return ((U) ((Object) (castTarget(element).getBlock()))); } @Override public void setValue(T element, U value) { - castTarget(element).setDeclaringType(castValue(value)); + castTarget(element).setBlock(castValue(value)); } } - static class CtPackage_CONTAINED_TYPE_RoleHandler extends SetHandler> { - private CtPackage_CONTAINED_TYPE_RoleHandler() { - super(CtRole.CONTAINED_TYPE, CtPackage.class, CtType.class); + static class CtIntersectionTypeReference_BOUND_RoleHandler extends ListHandler> { + private CtIntersectionTypeReference_BOUND_RoleHandler() { + super(CtRole.BOUND, CtIntersectionTypeReference.class, CtTypeReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getTypes()))); + return ((U) ((Object) (castTarget(element).getBounds()))); } @Override public void setValue(T element, U value) { - castTarget(element).setTypes(castValue(value)); + castTarget(element).setBounds(castValue(value)); } } - static class CtBodyHolder_BODY_RoleHandler extends SingleHandler { - private CtBodyHolder_BODY_RoleHandler() { - super(CtRole.BODY, CtBodyHolder.class, CtStatement.class); + static class CtTypeParameterReference_BOUNDING_TYPE_RoleHandler extends SingleHandler> { + private CtTypeParameterReference_BOUNDING_TYPE_RoleHandler() { + super(CtRole.BOUNDING_TYPE, CtTypeParameterReference.class, CtTypeReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getBody()))); + return ((U) ((Object) (castTarget(element).getBoundingType()))); } @Override public void setValue(T element, U value) { - castTarget(element).setBody(castValue(value)); + castTarget(element).setBoundingType(castValue(value)); } } - static class CtSynchronized_BODY_RoleHandler extends SingleHandler> { - private CtSynchronized_BODY_RoleHandler() { - super(CtRole.BODY, CtSynchronized.class, CtBlock.class); + static class CtSwitch_CASE_RoleHandler extends ListHandler> { + private CtSwitch_CASE_RoleHandler() { + super(CtRole.CASE, CtSwitch.class, CtCase.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getBlock()))); + return ((U) ((Object) (castTarget(element).getCases()))); } @Override public void setValue(T element, U value) { - castTarget(element).setBlock(castValue(value)); + castTarget(element).setCases(castValue(value)); } } - static class CtShadowable_IS_SHADOW_RoleHandler extends SingleHandler { - private CtShadowable_IS_SHADOW_RoleHandler() { - super(CtRole.IS_SHADOW, CtShadowable.class, Boolean.class); + static class CtExpression_CAST_RoleHandler extends ListHandler> { + private CtExpression_CAST_RoleHandler() { + super(CtRole.CAST, CtExpression.class, CtTypeReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).isShadow()))); + return ((U) ((Object) (castTarget(element).getTypeCasts()))); } @Override public void setValue(T element, U value) { - castTarget(element).setShadow(castValue(value)); + castTarget(element).setTypeCasts(castValue(value)); } } - static class CtIntersectionTypeReference_BOUND_RoleHandler extends ListHandler> { - private CtIntersectionTypeReference_BOUND_RoleHandler() { - super(CtRole.BOUND, CtIntersectionTypeReference.class, CtTypeReference.class); + static class CtTry_CATCH_RoleHandler extends ListHandler { + private CtTry_CATCH_RoleHandler() { + super(CtRole.CATCH, CtTry.class, CtCatch.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getBounds()))); + return ((U) ((Object) (castTarget(element).getCatchers()))); } @Override public void setValue(T element, U value) { - castTarget(element).setBounds(castValue(value)); + castTarget(element).setCatchers(castValue(value)); } } - static class CtTypeParameterReference_BOUNDING_TYPE_RoleHandler extends SingleHandler> { - private CtTypeParameterReference_BOUNDING_TYPE_RoleHandler() { - super(CtRole.BOUNDING_TYPE, CtTypeParameterReference.class, CtTypeReference.class); + static class CtElement_COMMENT_RoleHandler extends ListHandler { + private CtElement_COMMENT_RoleHandler() { + super(CtRole.COMMENT, CtElement.class, CtComment.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getBoundingType()))); + return ((U) ((Object) (castTarget(element).getComments()))); } @Override public void setValue(T element, U value) { - castTarget(element).setBoundingType(castValue(value)); + castTarget(element).setComments(castValue(value)); } } - static class CtFieldReference_IS_FINAL_RoleHandler extends SingleHandler { - private CtFieldReference_IS_FINAL_RoleHandler() { - super(CtRole.IS_FINAL, CtFieldReference.class, Boolean.class); + static class CtComment_COMMENT_CONTENT_RoleHandler extends SingleHandler { + private CtComment_COMMENT_CONTENT_RoleHandler() { + super(CtRole.COMMENT_CONTENT, CtComment.class, String.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).isFinal()))); + return ((U) ((Object) (castTarget(element).getContent()))); } @Override public void setValue(T element, U value) { - castTarget(element).setFinal(castValue(value)); + castTarget(element).setContent(castValue(value)); } } - static class CtExecutableReference_IS_STATIC_RoleHandler extends SingleHandler { - private CtExecutableReference_IS_STATIC_RoleHandler() { - super(CtRole.IS_STATIC, CtExecutableReference.class, Boolean.class); + static class CtJavaDocTag_COMMENT_CONTENT_RoleHandler extends SingleHandler { + private CtJavaDocTag_COMMENT_CONTENT_RoleHandler() { + super(CtRole.COMMENT_CONTENT, CtJavaDocTag.class, String.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).isStatic()))); + return ((U) ((Object) (castTarget(element).getContent()))); } @Override public void setValue(T element, U value) { - castTarget(element).setStatic(castValue(value)); + castTarget(element).setContent(castValue(value)); } } - static class CtFieldReference_IS_STATIC_RoleHandler extends SingleHandler { - private CtFieldReference_IS_STATIC_RoleHandler() { - super(CtRole.IS_STATIC, CtFieldReference.class, Boolean.class); + static class CtJavaDoc_COMMENT_TAG_RoleHandler extends ListHandler { + private CtJavaDoc_COMMENT_TAG_RoleHandler() { + super(CtRole.COMMENT_TAG, CtJavaDoc.class, CtJavaDocTag.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).isStatic()))); + return ((U) ((Object) (castTarget(element).getTags()))); } @Override public void setValue(T element, U value) { - castTarget(element).setStatic(castValue(value)); + castTarget(element).setTags(castValue(value)); } } - static class CtTypeParameterReference_IS_UPPER_RoleHandler extends SingleHandler { - private CtTypeParameterReference_IS_UPPER_RoleHandler() { - super(CtRole.IS_UPPER, CtTypeParameterReference.class, Boolean.class); + static class CtComment_COMMENT_TYPE_RoleHandler extends SingleHandler { + private CtComment_COMMENT_TYPE_RoleHandler() { + super(CtRole.COMMENT_TYPE, CtComment.class, CtComment.CommentType.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).isUpper()))); + return ((U) ((Object) (castTarget(element).getCommentType()))); } @Override public void setValue(T element, U value) { - castTarget(element).setUpper(castValue(value)); + castTarget(element).setCommentType(castValue(value)); } } - static class CtElement_IS_IMPLICIT_RoleHandler extends SingleHandler { - private CtElement_IS_IMPLICIT_RoleHandler() { - super(CtRole.IS_IMPLICIT, CtElement.class, Boolean.class); + static class CtAssert_CONDITION_RoleHandler extends SingleHandler> { + private CtAssert_CONDITION_RoleHandler() { + super(CtRole.CONDITION, CtAssert.class, CtExpression.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).isImplicit()))); + return ((U) ((Object) (castTarget(element).getAssertExpression()))); } @Override public void setValue(T element, U value) { - castTarget(element).setImplicit(castValue(value)); + castTarget(element).setAssertExpression(castValue(value)); } } - static class CtMethod_IS_DEFAULT_RoleHandler extends SingleHandler { - private CtMethod_IS_DEFAULT_RoleHandler() { - super(CtRole.IS_DEFAULT, CtMethod.class, Boolean.class); + static class CtConditional_CONDITION_RoleHandler extends SingleHandler> { + private CtConditional_CONDITION_RoleHandler() { + super(CtRole.CONDITION, CtConditional.class, CtExpression.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).isDefaultMethod()))); + return ((U) ((Object) (castTarget(element).getCondition()))); } @Override public void setValue(T element, U value) { - castTarget(element).setDefaultMethod(castValue(value)); + castTarget(element).setCondition(castValue(value)); } } - static class CtParameter_IS_VARARGS_RoleHandler extends SingleHandler { - private CtParameter_IS_VARARGS_RoleHandler() { - super(CtRole.IS_VARARGS, CtParameter.class, Boolean.class); + static class CtIf_CONDITION_RoleHandler extends SingleHandler> { + private CtIf_CONDITION_RoleHandler() { + super(CtRole.CONDITION, CtIf.class, CtExpression.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).isVarArgs()))); + return ((U) ((Object) (castTarget(element).getCondition()))); } @Override public void setValue(T element, U value) { - castTarget(element).setVarArgs(castValue(value)); + castTarget(element).setCondition(castValue(value)); } } - static class CtAnnotationMethod_DEFAULT_EXPRESSION_RoleHandler extends SingleHandler> { - private CtAnnotationMethod_DEFAULT_EXPRESSION_RoleHandler() { - super(CtRole.DEFAULT_EXPRESSION, CtAnnotationMethod.class, CtExpression.class); + static class CtClass_CONSTRUCTOR_RoleHandler extends SetHandler> { + private CtClass_CONSTRUCTOR_RoleHandler() { + super(CtRole.CONSTRUCTOR, CtClass.class, CtConstructor.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getDefaultExpression()))); + return ((U) ((Object) (castTarget(element).getConstructors()))); } @Override public void setValue(T element, U value) { - castTarget(element).setDefaultExpression(castValue(value)); + castTarget(element).setConstructors(castValue(value)); } } - static class CtVariable_DEFAULT_EXPRESSION_RoleHandler extends SingleHandler> { - private CtVariable_DEFAULT_EXPRESSION_RoleHandler() { - super(CtRole.DEFAULT_EXPRESSION, CtVariable.class, CtExpression.class); + static class CtPackage_CONTAINED_TYPE_RoleHandler extends SetHandler> { + private CtPackage_CONTAINED_TYPE_RoleHandler() { + super(CtRole.CONTAINED_TYPE, CtPackage.class, CtType.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getDefaultExpression()))); + return ((U) ((Object) (castTarget(element).getTypes()))); } @Override public void setValue(T element, U value) { - castTarget(element).setDefaultExpression(castValue(value)); + castTarget(element).setTypes(castValue(value)); } } - static class CtConditional_THEN_RoleHandler extends SingleHandler> { - private CtConditional_THEN_RoleHandler() { - super(CtRole.THEN, CtConditional.class, CtExpression.class); + static class CtExecutableReference_DECLARING_TYPE_RoleHandler extends SingleHandler> { + private CtExecutableReference_DECLARING_TYPE_RoleHandler() { + super(CtRole.DECLARING_TYPE, CtExecutableReference.class, CtTypeReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getThenExpression()))); - } - - @Override - public void setValue(T element, U value) { - castTarget(element).setThenExpression(castValue(value)); - } - } - - static class CtIf_THEN_RoleHandler extends SingleHandler { - private CtIf_THEN_RoleHandler() { - super(CtRole.THEN, CtIf.class, CtStatement.class); - } - - @SuppressWarnings("unchecked") - @Override - public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getThenStatement()))); - } - - @Override - public void setValue(T element, U value) { - castTarget(element).setThenStatement(castValue(value)); - } - } - - static class CtConditional_ELSE_RoleHandler extends SingleHandler> { - private CtConditional_ELSE_RoleHandler() { - super(CtRole.ELSE, CtConditional.class, CtExpression.class); - } - - @SuppressWarnings("unchecked") - @Override - public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getElseExpression()))); - } - - @Override - public void setValue(T element, U value) { - castTarget(element).setElseExpression(castValue(value)); - } - } - - static class CtIf_ELSE_RoleHandler extends SingleHandler { - private CtIf_ELSE_RoleHandler() { - super(CtRole.ELSE, CtIf.class, CtStatement.class); - } - - @SuppressWarnings("unchecked") - @Override - public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getElseStatement()))); - } - - @Override - public void setValue(T element, U value) { - castTarget(element).setElseStatement(castValue(value)); - } - } - - static class CtTypeReference_PACKAGE_REF_RoleHandler extends SingleHandler { - private CtTypeReference_PACKAGE_REF_RoleHandler() { - super(CtRole.PACKAGE_REF, CtTypeReference.class, CtPackageReference.class); - } - - @SuppressWarnings("unchecked") - @Override - public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getPackage()))); - } - - @Override - public void setValue(T element, U value) { - castTarget(element).setPackage(castValue(value)); - } - } - - static class CtPackage_SUB_PACKAGE_RoleHandler extends SetHandler { - private CtPackage_SUB_PACKAGE_RoleHandler() { - super(CtRole.SUB_PACKAGE, CtPackage.class, CtPackage.class); - } - - @SuppressWarnings("unchecked") - @Override - public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getPackages()))); - } - - @Override - public void setValue(T element, U value) { - castTarget(element).setPackages(castValue(value)); - } - } - - static class CtAssert_CONDITION_RoleHandler extends SingleHandler> { - private CtAssert_CONDITION_RoleHandler() { - super(CtRole.CONDITION, CtAssert.class, CtExpression.class); - } - - @SuppressWarnings("unchecked") - @Override - public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getAssertExpression()))); - } - - @Override - public void setValue(T element, U value) { - castTarget(element).setAssertExpression(castValue(value)); - } - } - - static class CtConditional_CONDITION_RoleHandler extends SingleHandler> { - private CtConditional_CONDITION_RoleHandler() { - super(CtRole.CONDITION, CtConditional.class, CtExpression.class); - } - - @SuppressWarnings("unchecked") - @Override - public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getCondition()))); + return ((U) ((Object) (castTarget(element).getDeclaringType()))); } @Override public void setValue(T element, U value) { - castTarget(element).setCondition(castValue(value)); + castTarget(element).setDeclaringType(castValue(value)); } } - static class CtIf_CONDITION_RoleHandler extends SingleHandler> { - private CtIf_CONDITION_RoleHandler() { - super(CtRole.CONDITION, CtIf.class, CtExpression.class); + static class CtFieldReference_DECLARING_TYPE_RoleHandler extends SingleHandler> { + private CtFieldReference_DECLARING_TYPE_RoleHandler() { + super(CtRole.DECLARING_TYPE, CtFieldReference.class, CtTypeReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getCondition()))); + return ((U) ((Object) (castTarget(element).getDeclaringType()))); } @Override public void setValue(T element, U value) { - castTarget(element).setCondition(castValue(value)); + castTarget(element).setDeclaringType(castValue(value)); } } - static class CtBinaryOperator_RIGHT_OPERAND_RoleHandler extends SingleHandler> { - private CtBinaryOperator_RIGHT_OPERAND_RoleHandler() { - super(CtRole.RIGHT_OPERAND, CtBinaryOperator.class, CtExpression.class); + static class CtTypeReference_DECLARING_TYPE_RoleHandler extends SingleHandler> { + private CtTypeReference_DECLARING_TYPE_RoleHandler() { + super(CtRole.DECLARING_TYPE, CtTypeReference.class, CtTypeReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getRightHandOperand()))); + return ((U) ((Object) (castTarget(element).getDeclaringType()))); } @Override public void setValue(T element, U value) { - castTarget(element).setRightHandOperand(castValue(value)); + castTarget(element).setDeclaringType(castValue(value)); } } - static class CtBinaryOperator_LEFT_OPERAND_RoleHandler extends SingleHandler> { - private CtBinaryOperator_LEFT_OPERAND_RoleHandler() { - super(CtRole.LEFT_OPERAND, CtBinaryOperator.class, CtExpression.class); + static class CtAnnotationMethod_DEFAULT_EXPRESSION_RoleHandler extends SingleHandler> { + private CtAnnotationMethod_DEFAULT_EXPRESSION_RoleHandler() { + super(CtRole.DEFAULT_EXPRESSION, CtAnnotationMethod.class, CtExpression.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getLeftHandOperand()))); + return ((U) ((Object) (castTarget(element).getDefaultExpression()))); } @Override public void setValue(T element, U value) { - castTarget(element).setLeftHandOperand(castValue(value)); + castTarget(element).setDefaultExpression(castValue(value)); } } - static class CtStatement_LABEL_RoleHandler extends SingleHandler { - private CtStatement_LABEL_RoleHandler() { - super(CtRole.LABEL, CtStatement.class, String.class); + static class CtVariable_DEFAULT_EXPRESSION_RoleHandler extends SingleHandler> { + private CtVariable_DEFAULT_EXPRESSION_RoleHandler() { + super(CtRole.DEFAULT_EXPRESSION, CtVariable.class, CtExpression.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getLabel()))); + return ((U) ((Object) (castTarget(element).getDefaultExpression()))); } @Override public void setValue(T element, U value) { - castTarget(element).setLabel(castValue(value)); + castTarget(element).setDefaultExpression(castValue(value)); } } - static class CtSwitch_CASE_RoleHandler extends ListHandler> { - private CtSwitch_CASE_RoleHandler() { - super(CtRole.CASE, CtSwitch.class, CtCase.class); + static class CtNewArray_DIMENSION_RoleHandler extends ListHandler> { + private CtNewArray_DIMENSION_RoleHandler() { + super(CtRole.DIMENSION, CtNewArray.class, CtExpression.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getCases()))); + return ((U) ((Object) (castTarget(element).getDimensionExpressions()))); } @Override public void setValue(T element, U value) { - castTarget(element).setCases(castValue(value)); + castTarget(element).setDimensionExpressions(castValue(value)); } } - static class CtBinaryOperator_OPERATOR_KIND_RoleHandler extends SingleHandler { - private CtBinaryOperator_OPERATOR_KIND_RoleHandler() { - super(CtRole.OPERATOR_KIND, CtBinaryOperator.class, BinaryOperatorKind.class); + static class CtJavaDocTag_DOCUMENTATION_TYPE_RoleHandler extends SingleHandler { + private CtJavaDocTag_DOCUMENTATION_TYPE_RoleHandler() { + super(CtRole.DOCUMENTATION_TYPE, CtJavaDocTag.class, CtJavaDocTag.TagType.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getKind()))); + return ((U) ((Object) (castTarget(element).getType()))); } @Override public void setValue(T element, U value) { - castTarget(element).setKind(castValue(value)); + castTarget(element).setType(castValue(value)); } } - static class CtOperatorAssignment_OPERATOR_KIND_RoleHandler extends SingleHandler { - private CtOperatorAssignment_OPERATOR_KIND_RoleHandler() { - super(CtRole.OPERATOR_KIND, CtOperatorAssignment.class, BinaryOperatorKind.class); + static class CtConditional_ELSE_RoleHandler extends SingleHandler> { + private CtConditional_ELSE_RoleHandler() { + super(CtRole.ELSE, CtConditional.class, CtExpression.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getKind()))); + return ((U) ((Object) (castTarget(element).getElseExpression()))); } @Override public void setValue(T element, U value) { - castTarget(element).setKind(castValue(value)); + castTarget(element).setElseExpression(castValue(value)); } } - static class CtUnaryOperator_OPERATOR_KIND_RoleHandler extends SingleHandler { - private CtUnaryOperator_OPERATOR_KIND_RoleHandler() { - super(CtRole.OPERATOR_KIND, CtUnaryOperator.class, UnaryOperatorKind.class); + static class CtIf_ELSE_RoleHandler extends SingleHandler { + private CtIf_ELSE_RoleHandler() { + super(CtRole.ELSE, CtIf.class, CtStatement.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getKind()))); + return ((U) ((Object) (castTarget(element).getElseStatement()))); } @Override public void setValue(T element, U value) { - castTarget(element).setKind(castValue(value)); + castTarget(element).setElseStatement(castValue(value)); } } - static class CtCatch_PARAMETER_RoleHandler extends SingleHandler> { - private CtCatch_PARAMETER_RoleHandler() { - super(CtRole.PARAMETER, CtCatch.class, CtCatchVariable.class); + static class CtAbstractInvocation_EXECUTABLE_REF_RoleHandler extends SingleHandler> { + private CtAbstractInvocation_EXECUTABLE_REF_RoleHandler() { + super(CtRole.EXECUTABLE_REF, CtAbstractInvocation.class, CtExecutableReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getParameter()))); + return ((U) ((Object) (castTarget(element).getExecutable()))); } @Override public void setValue(T element, U value) { - castTarget(element).setParameter(castValue(value)); + castTarget(element).setExecutable(castValue(value)); } } - static class CtExecutable_PARAMETER_RoleHandler extends ListHandler> { - private CtExecutable_PARAMETER_RoleHandler() { - super(CtRole.PARAMETER, CtExecutable.class, CtParameter.class); + static class CtExecutableReferenceExpression_EXECUTABLE_REF_RoleHandler extends SingleHandler> { + private CtExecutableReferenceExpression_EXECUTABLE_REF_RoleHandler() { + super(CtRole.EXECUTABLE_REF, CtExecutableReferenceExpression.class, CtExecutableReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getParameters()))); + return ((U) ((Object) (castTarget(element).getExecutable()))); } @Override public void setValue(T element, U value) { - castTarget(element).setParameters(castValue(value)); + castTarget(element).setExecutable(castValue(value)); } } - static class CtExecutableReference_ARGUMENT_TYPE_RoleHandler extends ListHandler> { - private CtExecutableReference_ARGUMENT_TYPE_RoleHandler() { - super(CtRole.ARGUMENT_TYPE, CtExecutableReference.class, CtTypeReference.class); + static class CtParameterReference_EXECUTABLE_REF_RoleHandler extends SingleHandler> { + private CtParameterReference_EXECUTABLE_REF_RoleHandler() { + super(CtRole.EXECUTABLE_REF, CtParameterReference.class, CtExecutableReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getParameters()))); + return ((U) ((Object) (castTarget(element).getDeclaringExecutable()))); } @Override public void setValue(T element, U value) { - castTarget(element).setParameters(castValue(value)); + castTarget(element).setDeclaringExecutable(castValue(value)); } } @@ -1102,243 +983,367 @@ public void setValue(T element, U value) { } } - static class CtTargetedExpression_TARGET_RoleHandler extends SingleHandler> { - private CtTargetedExpression_TARGET_RoleHandler() { - super(CtRole.TARGET, CtTargetedExpression.class, CtExpression.class); + static class CtType_FIELD_RoleHandler extends ListHandler> { + private CtType_FIELD_RoleHandler() { + super(CtRole.FIELD, CtType.class, CtField.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getTarget()))); + return ((U) ((Object) (castTarget(element).getFields()))); } @Override public void setValue(T element, U value) { - castTarget(element).setTarget(castValue(value)); + castTarget(element).setFields(castValue(value)); } } - static class CtVariableAccess_VARIABLE_RoleHandler extends SingleHandler> { - private CtVariableAccess_VARIABLE_RoleHandler() { - super(CtRole.VARIABLE, CtVariableAccess.class, CtVariableReference.class); + static class CtTry_FINALIZER_RoleHandler extends SingleHandler> { + private CtTry_FINALIZER_RoleHandler() { + super(CtRole.FINALIZER, CtTry.class, CtBlock.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getVariable()))); + return ((U) ((Object) (castTarget(element).getFinalizer()))); } @Override public void setValue(T element, U value) { - castTarget(element).setVariable(castValue(value)); + castTarget(element).setFinalizer(castValue(value)); } } - static class CtTry_FINALIZER_RoleHandler extends SingleHandler> { - private CtTry_FINALIZER_RoleHandler() { - super(CtRole.FINALIZER, CtTry.class, CtBlock.class); + static class CtForEach_FOREACH_VARIABLE_RoleHandler extends SingleHandler> { + private CtForEach_FOREACH_VARIABLE_RoleHandler() { + super(CtRole.FOREACH_VARIABLE, CtForEach.class, CtLocalVariable.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getFinalizer()))); + return ((U) ((Object) (castTarget(element).getVariable()))); } @Override public void setValue(T element, U value) { - castTarget(element).setFinalizer(castValue(value)); + castTarget(element).setVariable(castValue(value)); } } - static class CtExecutable_THROWN_RoleHandler extends SetHandler> { - private CtExecutable_THROWN_RoleHandler() { - super(CtRole.THROWN, CtExecutable.class, CtTypeReference.class); + static class CtFor_FOR_INIT_RoleHandler extends ListHandler { + private CtFor_FOR_INIT_RoleHandler() { + super(CtRole.FOR_INIT, CtFor.class, CtStatement.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getThrownTypes()))); + return ((U) ((Object) (castTarget(element).getForInit()))); } @Override public void setValue(T element, U value) { - castTarget(element).setThrownTypes(castValue(value)); + castTarget(element).setForInit(castValue(value)); } } - static class CtRHSReceiver_ASSIGNMENT_RoleHandler extends SingleHandler> { - private CtRHSReceiver_ASSIGNMENT_RoleHandler() { - super(CtRole.ASSIGNMENT, CtRHSReceiver.class, CtExpression.class); + static class CtFor_FOR_UPDATE_RoleHandler extends ListHandler { + private CtFor_FOR_UPDATE_RoleHandler() { + super(CtRole.FOR_UPDATE, CtFor.class, CtStatement.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getAssignment()))); + return ((U) ((Object) (castTarget(element).getForUpdate()))); } @Override public void setValue(T element, U value) { - castTarget(element).setAssignment(castValue(value)); + castTarget(element).setForUpdate(castValue(value)); } } - static class CtAssignment_ASSIGNED_RoleHandler extends SingleHandler> { - private CtAssignment_ASSIGNED_RoleHandler() { - super(CtRole.ASSIGNED, CtAssignment.class, CtExpression.class); + static class CtTypeInformation_INTERFACE_RoleHandler extends SetHandler> { + private CtTypeInformation_INTERFACE_RoleHandler() { + super(CtRole.INTERFACE, CtTypeInformation.class, CtTypeReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getAssigned()))); + return ((U) ((Object) (castTarget(element).getSuperInterfaces()))); + } + } + + static class CtMethod_IS_DEFAULT_RoleHandler extends SingleHandler { + private CtMethod_IS_DEFAULT_RoleHandler() { + super(CtRole.IS_DEFAULT, CtMethod.class, Boolean.class); + } + + @SuppressWarnings("unchecked") + @Override + public U getValue(T element) { + return ((U) ((Object) (castTarget(element).isDefaultMethod()))); } @Override public void setValue(T element, U value) { - castTarget(element).setAssigned(castValue(value)); + castTarget(element).setDefaultMethod(castValue(value)); } } - static class CtModifiable_MODIFIER_RoleHandler extends SetHandler { - private CtModifiable_MODIFIER_RoleHandler() { - super(CtRole.MODIFIER, CtModifiable.class, ModifierKind.class); + static class CtFieldReference_IS_FINAL_RoleHandler extends SingleHandler { + private CtFieldReference_IS_FINAL_RoleHandler() { + super(CtRole.IS_FINAL, CtFieldReference.class, Boolean.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getModifiers()))); + return ((U) ((Object) (castTarget(element).isFinal()))); } @Override public void setValue(T element, U value) { - castTarget(element).setModifiers(castValue(value)); + castTarget(element).setFinal(castValue(value)); } } - static class CtTypeInformation_MODIFIER_RoleHandler extends SetHandler { - private CtTypeInformation_MODIFIER_RoleHandler() { - super(CtRole.MODIFIER, CtTypeInformation.class, ModifierKind.class); + static class CtElement_IS_IMPLICIT_RoleHandler extends SingleHandler { + private CtElement_IS_IMPLICIT_RoleHandler() { + super(CtRole.IS_IMPLICIT, CtElement.class, Boolean.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getModifiers()))); + return ((U) ((Object) (castTarget(element).isImplicit()))); + } + + @Override + public void setValue(T element, U value) { + castTarget(element).setImplicit(castValue(value)); } } - static class CtElement_COMMENT_RoleHandler extends ListHandler { - private CtElement_COMMENT_RoleHandler() { - super(CtRole.COMMENT, CtElement.class, CtComment.class); + static class CtShadowable_IS_SHADOW_RoleHandler extends SingleHandler { + private CtShadowable_IS_SHADOW_RoleHandler() { + super(CtRole.IS_SHADOW, CtShadowable.class, Boolean.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getComments()))); + return ((U) ((Object) (castTarget(element).isShadow()))); } @Override public void setValue(T element, U value) { - castTarget(element).setComments(castValue(value)); + castTarget(element).setShadow(castValue(value)); } } - static class CtAnnotation_ANNOTATION_TYPE_RoleHandler extends SingleHandler> { - private CtAnnotation_ANNOTATION_TYPE_RoleHandler() { - super(CtRole.ANNOTATION_TYPE, CtAnnotation.class, CtTypeReference.class); + static class CtExecutableReference_IS_STATIC_RoleHandler extends SingleHandler { + private CtExecutableReference_IS_STATIC_RoleHandler() { + super(CtRole.IS_STATIC, CtExecutableReference.class, Boolean.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getAnnotationType()))); + return ((U) ((Object) (castTarget(element).isStatic()))); } @Override public void setValue(T element, U value) { - castTarget(element).setAnnotationType(castValue(value)); + castTarget(element).setStatic(castValue(value)); } } - static class CtTypeInformation_INTERFACE_RoleHandler extends SetHandler> { - private CtTypeInformation_INTERFACE_RoleHandler() { - super(CtRole.INTERFACE, CtTypeInformation.class, CtTypeReference.class); + static class CtFieldReference_IS_STATIC_RoleHandler extends SingleHandler { + private CtFieldReference_IS_STATIC_RoleHandler() { + super(CtRole.IS_STATIC, CtFieldReference.class, Boolean.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getSuperInterfaces()))); + return ((U) ((Object) (castTarget(element).isStatic()))); + } + + @Override + public void setValue(T element, U value) { + castTarget(element).setStatic(castValue(value)); } } - static class CtElement_ANNOTATION_RoleHandler extends ListHandler> { - private CtElement_ANNOTATION_RoleHandler() { - super(CtRole.ANNOTATION, CtElement.class, CtAnnotation.class); + static class CtTypeParameterReference_IS_UPPER_RoleHandler extends SingleHandler { + private CtTypeParameterReference_IS_UPPER_RoleHandler() { + super(CtRole.IS_UPPER, CtTypeParameterReference.class, Boolean.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getAnnotations()))); + return ((U) ((Object) (castTarget(element).isUpper()))); } @Override public void setValue(T element, U value) { - castTarget(element).setAnnotations(castValue(value)); + castTarget(element).setUpper(castValue(value)); } } - static class CtStatementList_STATEMENT_RoleHandler extends ListHandler { - private CtStatementList_STATEMENT_RoleHandler() { - super(CtRole.STATEMENT, CtStatementList.class, CtStatement.class); + static class CtParameter_IS_VARARGS_RoleHandler extends SingleHandler { + private CtParameter_IS_VARARGS_RoleHandler() { + super(CtRole.IS_VARARGS, CtParameter.class, Boolean.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getStatements()))); + return ((U) ((Object) (castTarget(element).isVarArgs()))); } @Override public void setValue(T element, U value) { - castTarget(element).setStatements(castValue(value)); + castTarget(element).setVarArgs(castValue(value)); } } - static class CtAbstractInvocation_ARGUMENT_RoleHandler extends ListHandler> { - private CtAbstractInvocation_ARGUMENT_RoleHandler() { - super(CtRole.ARGUMENT, CtAbstractInvocation.class, CtExpression.class); + static class CtJavaDocTag_JAVADOC_TAG_VALUE_RoleHandler extends SingleHandler { + private CtJavaDocTag_JAVADOC_TAG_VALUE_RoleHandler() { + super(CtRole.JAVADOC_TAG_VALUE, CtJavaDocTag.class, String.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getArguments()))); + return ((U) ((Object) (castTarget(element).getParam()))); } @Override public void setValue(T element, U value) { - castTarget(element).setArguments(castValue(value)); + castTarget(element).setParam(castValue(value)); } } - static class CtTypeInformation_SUPER_TYPE_RoleHandler extends SingleHandler> { - private CtTypeInformation_SUPER_TYPE_RoleHandler() { - super(CtRole.SUPER_TYPE, CtTypeInformation.class, CtTypeReference.class); + static class CtStatement_LABEL_RoleHandler extends SingleHandler { + private CtStatement_LABEL_RoleHandler() { + super(CtRole.LABEL, CtStatement.class, String.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getSuperclass()))); + return ((U) ((Object) (castTarget(element).getLabel()))); + } + + @Override + public void setValue(T element, U value) { + castTarget(element).setLabel(castValue(value)); + } + } + + static class CtBinaryOperator_LEFT_OPERAND_RoleHandler extends SingleHandler> { + private CtBinaryOperator_LEFT_OPERAND_RoleHandler() { + super(CtRole.LEFT_OPERAND, CtBinaryOperator.class, CtExpression.class); + } + + @SuppressWarnings("unchecked") + @Override + public U getValue(T element) { + return ((U) ((Object) (castTarget(element).getLeftHandOperand()))); + } + + @Override + public void setValue(T element, U value) { + castTarget(element).setLeftHandOperand(castValue(value)); + } + } + + static class CtType_METHOD_RoleHandler extends SetHandler> { + private CtType_METHOD_RoleHandler() { + super(CtRole.METHOD, CtType.class, CtMethod.class); + } + + @SuppressWarnings("unchecked") + @Override + public U getValue(T element) { + return ((U) ((Object) (castTarget(element).getMethods()))); + } + + @Override + public void setValue(T element, U value) { + castTarget(element).setMethods(castValue(value)); + } + } + + static class CtModifiable_MODIFIER_RoleHandler extends SetHandler { + private CtModifiable_MODIFIER_RoleHandler() { + super(CtRole.MODIFIER, CtModifiable.class, ModifierKind.class); + } + + @SuppressWarnings("unchecked") + @Override + public U getValue(T element) { + return ((U) ((Object) (castTarget(element).getModifiers()))); + } + + @Override + public void setValue(T element, U value) { + castTarget(element).setModifiers(castValue(value)); + } + } + + static class CtTypeInformation_MODIFIER_RoleHandler extends SetHandler { + private CtTypeInformation_MODIFIER_RoleHandler() { + super(CtRole.MODIFIER, CtTypeInformation.class, ModifierKind.class); + } + + @SuppressWarnings("unchecked") + @Override + public U getValue(T element) { + return ((U) ((Object) (castTarget(element).getModifiers()))); + } + } + + static class CtNamedElement_NAME_RoleHandler extends SingleHandler { + private CtNamedElement_NAME_RoleHandler() { + super(CtRole.NAME, CtNamedElement.class, String.class); + } + + @SuppressWarnings("unchecked") + @Override + public U getValue(T element) { + return ((U) ((Object) (castTarget(element).getSimpleName()))); + } + + @Override + public void setValue(T element, U value) { + castTarget(element).setSimpleName(castValue(value)); + } + } + + static class CtReference_NAME_RoleHandler extends SingleHandler { + private CtReference_NAME_RoleHandler() { + super(CtRole.NAME, CtReference.class, String.class); + } + + @SuppressWarnings("unchecked") + @Override + public U getValue(T element) { + return ((U) ((Object) (castTarget(element).getSimpleName()))); + } + + @Override + public void setValue(T element, U value) { + castTarget(element).setSimpleName(castValue(value)); } } @@ -1376,485 +1381,480 @@ public void setValue(T element, U value) { } } - static class CtClass_CONSTRUCTOR_RoleHandler extends SetHandler> { - private CtClass_CONSTRUCTOR_RoleHandler() { - super(CtRole.CONSTRUCTOR, CtClass.class, CtConstructor.class); + static class CtBinaryOperator_OPERATOR_KIND_RoleHandler extends SingleHandler { + private CtBinaryOperator_OPERATOR_KIND_RoleHandler() { + super(CtRole.OPERATOR_KIND, CtBinaryOperator.class, BinaryOperatorKind.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getConstructors()))); + return ((U) ((Object) (castTarget(element).getKind()))); } @Override public void setValue(T element, U value) { - castTarget(element).setConstructors(castValue(value)); + castTarget(element).setKind(castValue(value)); } } - static class CtAbstractInvocation_EXECUTABLE_REF_RoleHandler extends SingleHandler> { - private CtAbstractInvocation_EXECUTABLE_REF_RoleHandler() { - super(CtRole.EXECUTABLE_REF, CtAbstractInvocation.class, CtExecutableReference.class); + static class CtOperatorAssignment_OPERATOR_KIND_RoleHandler extends SingleHandler { + private CtOperatorAssignment_OPERATOR_KIND_RoleHandler() { + super(CtRole.OPERATOR_KIND, CtOperatorAssignment.class, BinaryOperatorKind.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getExecutable()))); + return ((U) ((Object) (castTarget(element).getKind()))); } @Override public void setValue(T element, U value) { - castTarget(element).setExecutable(castValue(value)); + castTarget(element).setKind(castValue(value)); } } - static class CtExecutableReferenceExpression_EXECUTABLE_REF_RoleHandler extends SingleHandler> { - private CtExecutableReferenceExpression_EXECUTABLE_REF_RoleHandler() { - super(CtRole.EXECUTABLE_REF, CtExecutableReferenceExpression.class, CtExecutableReference.class); + static class CtUnaryOperator_OPERATOR_KIND_RoleHandler extends SingleHandler { + private CtUnaryOperator_OPERATOR_KIND_RoleHandler() { + super(CtRole.OPERATOR_KIND, CtUnaryOperator.class, UnaryOperatorKind.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getExecutable()))); + return ((U) ((Object) (castTarget(element).getKind()))); } @Override public void setValue(T element, U value) { - castTarget(element).setExecutable(castValue(value)); + castTarget(element).setKind(castValue(value)); } } - static class CtParameterReference_EXECUTABLE_REF_RoleHandler extends SingleHandler> { - private CtParameterReference_EXECUTABLE_REF_RoleHandler() { - super(CtRole.EXECUTABLE_REF, CtParameterReference.class, CtExecutableReference.class); + static class CtTypeReference_PACKAGE_REF_RoleHandler extends SingleHandler { + private CtTypeReference_PACKAGE_REF_RoleHandler() { + super(CtRole.PACKAGE_REF, CtTypeReference.class, CtPackageReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getDeclaringExecutable()))); + return ((U) ((Object) (castTarget(element).getPackage()))); } @Override public void setValue(T element, U value) { - castTarget(element).setDeclaringExecutable(castValue(value)); + castTarget(element).setPackage(castValue(value)); } } - static class CtType_METHOD_RoleHandler extends SetHandler> { - private CtType_METHOD_RoleHandler() { - super(CtRole.METHOD, CtType.class, CtMethod.class); + static class CtCatch_PARAMETER_RoleHandler extends SingleHandler> { + private CtCatch_PARAMETER_RoleHandler() { + super(CtRole.PARAMETER, CtCatch.class, CtCatchVariable.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getMethods()))); + return ((U) ((Object) (castTarget(element).getParameter()))); } @Override public void setValue(T element, U value) { - castTarget(element).setMethods(castValue(value)); + castTarget(element).setParameter(castValue(value)); } } - static class CtClass_ANNONYMOUS_EXECUTABLE_RoleHandler extends ListHandler { - private CtClass_ANNONYMOUS_EXECUTABLE_RoleHandler() { - super(CtRole.ANNONYMOUS_EXECUTABLE, CtClass.class, CtAnonymousExecutable.class); + static class CtExecutable_PARAMETER_RoleHandler extends ListHandler> { + private CtExecutable_PARAMETER_RoleHandler() { + super(CtRole.PARAMETER, CtExecutable.class, CtParameter.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getAnonymousExecutables()))); + return ((U) ((Object) (castTarget(element).getParameters()))); } @Override public void setValue(T element, U value) { - castTarget(element).setAnonymousExecutables(castValue(value)); + castTarget(element).setParameters(castValue(value)); } } - static class CtType_FIELD_RoleHandler extends ListHandler> { - private CtType_FIELD_RoleHandler() { - super(CtRole.FIELD, CtType.class, CtField.class); + static class CtElement_POSITION_RoleHandler extends SingleHandler { + private CtElement_POSITION_RoleHandler() { + super(CtRole.POSITION, CtElement.class, SourcePosition.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getFields()))); + return ((U) ((Object) (castTarget(element).getPosition()))); } @Override public void setValue(T element, U value) { - castTarget(element).setFields(castValue(value)); + castTarget(element).setPosition(castValue(value)); } } - static class CtType_TYPE_MEMBER_RoleHandler extends ListHandler { - private CtType_TYPE_MEMBER_RoleHandler() { - super(CtRole.TYPE_MEMBER, CtType.class, CtTypeMember.class); + static class CtBinaryOperator_RIGHT_OPERAND_RoleHandler extends SingleHandler> { + private CtBinaryOperator_RIGHT_OPERAND_RoleHandler() { + super(CtRole.RIGHT_OPERAND, CtBinaryOperator.class, CtExpression.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getTypeMembers()))); + return ((U) ((Object) (castTarget(element).getRightHandOperand()))); } @Override public void setValue(T element, U value) { - castTarget(element).setTypeMembers(castValue(value)); + castTarget(element).setRightHandOperand(castValue(value)); } } - static class CtExpression_CAST_RoleHandler extends ListHandler> { - private CtExpression_CAST_RoleHandler() { - super(CtRole.CAST, CtExpression.class, CtTypeReference.class); + static class CtCodeSnippet_SNIPPET_RoleHandler extends SingleHandler { + private CtCodeSnippet_SNIPPET_RoleHandler() { + super(CtRole.SNIPPET, CtCodeSnippet.class, String.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getTypeCasts()))); + return ((U) ((Object) (castTarget(element).getValue()))); } @Override public void setValue(T element, U value) { - castTarget(element).setTypeCasts(castValue(value)); + castTarget(element).setValue(castValue(value)); } } - static class CtAnnotation_VALUE_RoleHandler extends MapHandler { - private CtAnnotation_VALUE_RoleHandler() { - super(CtRole.VALUE, CtAnnotation.class, CtExpression.class); + static class CtStatementList_STATEMENT_RoleHandler extends ListHandler { + private CtStatementList_STATEMENT_RoleHandler() { + super(CtRole.STATEMENT, CtStatementList.class, CtStatement.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getValues()))); + return ((U) ((Object) (castTarget(element).getStatements()))); } @Override public void setValue(T element, U value) { - castTarget(element).setValues(castValue(value)); + castTarget(element).setStatements(castValue(value)); } } - static class CtEnum_VALUE_RoleHandler extends ListHandler> { - private CtEnum_VALUE_RoleHandler() { - super(CtRole.VALUE, CtEnum.class, CtEnumValue.class); + static class CtPackage_SUB_PACKAGE_RoleHandler extends SetHandler { + private CtPackage_SUB_PACKAGE_RoleHandler() { + super(CtRole.SUB_PACKAGE, CtPackage.class, CtPackage.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getEnumValues()))); + return ((U) ((Object) (castTarget(element).getPackages()))); } @Override public void setValue(T element, U value) { - castTarget(element).setEnumValues(castValue(value)); + castTarget(element).setPackages(castValue(value)); } } - static class CtLiteral_VALUE_RoleHandler extends SingleHandler { - private CtLiteral_VALUE_RoleHandler() { - super(CtRole.VALUE, CtLiteral.class, Object.class); + static class CtTypeInformation_SUPER_TYPE_RoleHandler extends SingleHandler> { + private CtTypeInformation_SUPER_TYPE_RoleHandler() { + super(CtRole.SUPER_TYPE, CtTypeInformation.class, CtTypeReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getValue()))); - } - - @Override - public void setValue(T element, U value) { - castTarget(element).setValue(castValue(value)); + return ((U) ((Object) (castTarget(element).getSuperclass()))); } } - static class CtFor_FOR_UPDATE_RoleHandler extends ListHandler { - private CtFor_FOR_UPDATE_RoleHandler() { - super(CtRole.FOR_UPDATE, CtFor.class, CtStatement.class); + static class CtTargetedExpression_TARGET_RoleHandler extends SingleHandler> { + private CtTargetedExpression_TARGET_RoleHandler() { + super(CtRole.TARGET, CtTargetedExpression.class, CtExpression.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getForUpdate()))); + return ((U) ((Object) (castTarget(element).getTarget()))); } @Override public void setValue(T element, U value) { - castTarget(element).setForUpdate(castValue(value)); + castTarget(element).setTarget(castValue(value)); } } - static class CtFor_FOR_INIT_RoleHandler extends ListHandler { - private CtFor_FOR_INIT_RoleHandler() { - super(CtRole.FOR_INIT, CtFor.class, CtStatement.class); + static class CtLabelledFlowBreak_TARGET_LABEL_RoleHandler extends SingleHandler { + private CtLabelledFlowBreak_TARGET_LABEL_RoleHandler() { + super(CtRole.TARGET_LABEL, CtLabelledFlowBreak.class, String.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getForInit()))); + return ((U) ((Object) (castTarget(element).getTargetLabel()))); } @Override public void setValue(T element, U value) { - castTarget(element).setForInit(castValue(value)); + castTarget(element).setTargetLabel(castValue(value)); } } - static class CtForEach_FOREACH_VARIABLE_RoleHandler extends SingleHandler> { - private CtForEach_FOREACH_VARIABLE_RoleHandler() { - super(CtRole.FOREACH_VARIABLE, CtForEach.class, CtLocalVariable.class); + static class CtConditional_THEN_RoleHandler extends SingleHandler> { + private CtConditional_THEN_RoleHandler() { + super(CtRole.THEN, CtConditional.class, CtExpression.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getVariable()))); + return ((U) ((Object) (castTarget(element).getThenExpression()))); } @Override public void setValue(T element, U value) { - castTarget(element).setVariable(castValue(value)); + castTarget(element).setThenExpression(castValue(value)); } } - static class CtTryWithResource_TRY_RESOURCE_RoleHandler extends ListHandler> { - private CtTryWithResource_TRY_RESOURCE_RoleHandler() { - super(CtRole.TRY_RESOURCE, CtTryWithResource.class, CtLocalVariable.class); + static class CtIf_THEN_RoleHandler extends SingleHandler { + private CtIf_THEN_RoleHandler() { + super(CtRole.THEN, CtIf.class, CtStatement.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getResources()))); + return ((U) ((Object) (castTarget(element).getThenStatement()))); } @Override public void setValue(T element, U value) { - castTarget(element).setResources(castValue(value)); + castTarget(element).setThenStatement(castValue(value)); } } - static class CtNewArray_DIMENSION_RoleHandler extends ListHandler> { - private CtNewArray_DIMENSION_RoleHandler() { - super(CtRole.DIMENSION, CtNewArray.class, CtExpression.class); + static class CtExecutable_THROWN_RoleHandler extends SetHandler> { + private CtExecutable_THROWN_RoleHandler() { + super(CtRole.THROWN, CtExecutable.class, CtTypeReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getDimensionExpressions()))); + return ((U) ((Object) (castTarget(element).getThrownTypes()))); } @Override public void setValue(T element, U value) { - castTarget(element).setDimensionExpressions(castValue(value)); + castTarget(element).setThrownTypes(castValue(value)); } } - static class CtTry_CATCH_RoleHandler extends ListHandler { - private CtTry_CATCH_RoleHandler() { - super(CtRole.CATCH, CtTry.class, CtCatch.class); + static class CtTryWithResource_TRY_RESOURCE_RoleHandler extends ListHandler> { + private CtTryWithResource_TRY_RESOURCE_RoleHandler() { + super(CtRole.TRY_RESOURCE, CtTryWithResource.class, CtLocalVariable.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getCatchers()))); + return ((U) ((Object) (castTarget(element).getResources()))); } @Override public void setValue(T element, U value) { - castTarget(element).setCatchers(castValue(value)); + castTarget(element).setResources(castValue(value)); } } - static class CtLabelledFlowBreak_TARGET_LABEL_RoleHandler extends SingleHandler { - private CtLabelledFlowBreak_TARGET_LABEL_RoleHandler() { - super(CtRole.TARGET_LABEL, CtLabelledFlowBreak.class, String.class); + static class CtArrayTypeReference_TYPE_RoleHandler extends SingleHandler> { + private CtArrayTypeReference_TYPE_RoleHandler() { + super(CtRole.TYPE, CtArrayTypeReference.class, CtTypeReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getTargetLabel()))); + return ((U) ((Object) (castTarget(element).getComponentType()))); } @Override public void setValue(T element, U value) { - castTarget(element).setTargetLabel(castValue(value)); + castTarget(element).setComponentType(castValue(value)); } } - static class CtFormalTypeDeclarer_TYPE_PARAMETER_RoleHandler extends ListHandler { - private CtFormalTypeDeclarer_TYPE_PARAMETER_RoleHandler() { - super(CtRole.TYPE_PARAMETER, CtFormalTypeDeclarer.class, CtTypeParameter.class); + static class CtExecutableReference_TYPE_RoleHandler extends SingleHandler> { + private CtExecutableReference_TYPE_RoleHandler() { + super(CtRole.TYPE, CtExecutableReference.class, CtTypeReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getFormalCtTypeParameters()))); + return ((U) ((Object) (castTarget(element).getType()))); } @Override public void setValue(T element, U value) { - castTarget(element).setFormalCtTypeParameters(castValue(value)); + castTarget(element).setType(castValue(value)); } } - static class CtActualTypeContainer_TYPE_ARGUMENT_RoleHandler extends ListHandler> { - private CtActualTypeContainer_TYPE_ARGUMENT_RoleHandler() { - super(CtRole.TYPE_ARGUMENT, CtActualTypeContainer.class, CtTypeReference.class); + static class CtMultiTypedElement_TYPE_RoleHandler extends ListHandler> { + private CtMultiTypedElement_TYPE_RoleHandler() { + super(CtRole.TYPE, CtMultiTypedElement.class, CtTypeReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getActualTypeArguments()))); + return ((U) ((Object) (castTarget(element).getMultiTypes()))); } @Override public void setValue(T element, U value) { - castTarget(element).setActualTypeArguments(castValue(value)); + castTarget(element).setMultiTypes(castValue(value)); } } - static class CtJavaDoc_COMMENT_TAG_RoleHandler extends ListHandler { - private CtJavaDoc_COMMENT_TAG_RoleHandler() { - super(CtRole.COMMENT_TAG, CtJavaDoc.class, CtJavaDocTag.class); + static class CtTypedElement_TYPE_RoleHandler extends SingleHandler> { + private CtTypedElement_TYPE_RoleHandler() { + super(CtRole.TYPE, CtTypedElement.class, CtTypeReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getTags()))); + return ((U) ((Object) (castTarget(element).getType()))); } @Override public void setValue(T element, U value) { - castTarget(element).setTags(castValue(value)); + castTarget(element).setType(castValue(value)); } } - static class CtComment_COMMENT_CONTENT_RoleHandler extends SingleHandler { - private CtComment_COMMENT_CONTENT_RoleHandler() { - super(CtRole.COMMENT_CONTENT, CtComment.class, String.class); + static class CtVariableReference_TYPE_RoleHandler extends SingleHandler> { + private CtVariableReference_TYPE_RoleHandler() { + super(CtRole.TYPE, CtVariableReference.class, CtTypeReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getContent()))); + return ((U) ((Object) (castTarget(element).getType()))); } @Override public void setValue(T element, U value) { - castTarget(element).setContent(castValue(value)); + castTarget(element).setType(castValue(value)); } } - static class CtJavaDocTag_COMMENT_CONTENT_RoleHandler extends SingleHandler { - private CtJavaDocTag_COMMENT_CONTENT_RoleHandler() { - super(CtRole.COMMENT_CONTENT, CtJavaDocTag.class, String.class); + static class CtActualTypeContainer_TYPE_ARGUMENT_RoleHandler extends ListHandler> { + private CtActualTypeContainer_TYPE_ARGUMENT_RoleHandler() { + super(CtRole.TYPE_ARGUMENT, CtActualTypeContainer.class, CtTypeReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getContent()))); + return ((U) ((Object) (castTarget(element).getActualTypeArguments()))); } @Override public void setValue(T element, U value) { - castTarget(element).setContent(castValue(value)); + castTarget(element).setActualTypeArguments(castValue(value)); } } - static class CtComment_COMMENT_TYPE_RoleHandler extends SingleHandler { - private CtComment_COMMENT_TYPE_RoleHandler() { - super(CtRole.COMMENT_TYPE, CtComment.class, CtComment.CommentType.class); + static class CtType_TYPE_MEMBER_RoleHandler extends ListHandler { + private CtType_TYPE_MEMBER_RoleHandler() { + super(CtRole.TYPE_MEMBER, CtType.class, CtTypeMember.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getCommentType()))); + return ((U) ((Object) (castTarget(element).getTypeMembers()))); } @Override public void setValue(T element, U value) { - castTarget(element).setCommentType(castValue(value)); + castTarget(element).setTypeMembers(castValue(value)); } } - static class CtJavaDocTag_DOCUMENTATION_TYPE_RoleHandler extends SingleHandler { - private CtJavaDocTag_DOCUMENTATION_TYPE_RoleHandler() { - super(CtRole.DOCUMENTATION_TYPE, CtJavaDocTag.class, CtJavaDocTag.TagType.class); + static class CtFormalTypeDeclarer_TYPE_PARAMETER_RoleHandler extends ListHandler { + private CtFormalTypeDeclarer_TYPE_PARAMETER_RoleHandler() { + super(CtRole.TYPE_PARAMETER, CtFormalTypeDeclarer.class, CtTypeParameter.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getType()))); + return ((U) ((Object) (castTarget(element).getFormalCtTypeParameters()))); } @Override public void setValue(T element, U value) { - castTarget(element).setType(castValue(value)); + castTarget(element).setFormalCtTypeParameters(castValue(value)); } } - static class CtJavaDocTag_JAVADOC_TAG_VALUE_RoleHandler extends SingleHandler { - private CtJavaDocTag_JAVADOC_TAG_VALUE_RoleHandler() { - super(CtRole.JAVADOC_TAG_VALUE, CtJavaDocTag.class, String.class); + static class CtAnnotation_VALUE_RoleHandler extends MapHandler { + private CtAnnotation_VALUE_RoleHandler() { + super(CtRole.VALUE, CtAnnotation.class, CtExpression.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getParam()))); + return ((U) ((Object) (castTarget(element).getValues()))); } @Override public void setValue(T element, U value) { - castTarget(element).setParam(castValue(value)); + castTarget(element).setValues(castValue(value)); } } - static class CtElement_POSITION_RoleHandler extends SingleHandler { - private CtElement_POSITION_RoleHandler() { - super(CtRole.POSITION, CtElement.class, SourcePosition.class); + static class CtEnum_VALUE_RoleHandler extends ListHandler> { + private CtEnum_VALUE_RoleHandler() { + super(CtRole.VALUE, CtEnum.class, CtEnumValue.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getPosition()))); + return ((U) ((Object) (castTarget(element).getEnumValues()))); } @Override public void setValue(T element, U value) { - castTarget(element).setPosition(castValue(value)); + castTarget(element).setEnumValues(castValue(value)); } } - static class CtCodeSnippet_SNIPPET_RoleHandler extends SingleHandler { - private CtCodeSnippet_SNIPPET_RoleHandler() { - super(CtRole.SNIPPET, CtCodeSnippet.class, String.class); + static class CtLiteral_VALUE_RoleHandler extends SingleHandler { + private CtLiteral_VALUE_RoleHandler() { + super(CtRole.VALUE, CtLiteral.class, Object.class); } @SuppressWarnings("unchecked") @@ -1869,20 +1869,20 @@ public void setValue(T element, U value) { } } - static class CtTypeAccess_ACCESSED_TYPE_RoleHandler extends SingleHandler> { - private CtTypeAccess_ACCESSED_TYPE_RoleHandler() { - super(CtRole.ACCESSED_TYPE, CtTypeAccess.class, CtTypeReference.class); + static class CtVariableAccess_VARIABLE_RoleHandler extends SingleHandler> { + private CtVariableAccess_VARIABLE_RoleHandler() { + super(CtRole.VARIABLE, CtVariableAccess.class, CtVariableReference.class); } @SuppressWarnings("unchecked") @Override public U getValue(T element) { - return ((U) ((Object) (castTarget(element).getAccessedType()))); + return ((U) ((Object) (castTarget(element).getVariable()))); } @Override public void setValue(T element, U value) { - castTarget(element).setAccessedType(castValue(value)); + castTarget(element).setVariable(castValue(value)); } } } diff --git a/src/main/java/spoon/reflect/path/CtRole.java b/src/main/java/spoon/reflect/path/CtRole.java index db2c977e9ad..ba6e86a80d7 100644 --- a/src/main/java/spoon/reflect/path/CtRole.java +++ b/src/main/java/spoon/reflect/path/CtRole.java @@ -16,6 +16,10 @@ */ package spoon.reflect.path; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + /** * Identifies the roles of attributes of spoon model. */ @@ -62,13 +66,13 @@ public enum CtRole { STATEMENT, ARGUMENT, SUPER_TYPE, - NESTED_TYPE, - CONSTRUCTOR, - EXECUTABLE_REF, - METHOD, - ANNONYMOUS_EXECUTABLE, - FIELD, TYPE_MEMBER, + NESTED_TYPE(TYPE_MEMBER), + CONSTRUCTOR(TYPE_MEMBER), + METHOD(TYPE_MEMBER), + ANNONYMOUS_EXECUTABLE(TYPE_MEMBER), + FIELD(TYPE_MEMBER), + EXECUTABLE_REF, CAST, VALUE, FOR_UPDATE, @@ -89,6 +93,29 @@ public enum CtRole { SNIPPET, ACCESSED_TYPE; + private final CtRole superRole; + private final List subRoles; + private List initSubRoles; + + CtRole() { + this(null); + } + CtRole(CtRole superRole) { + this.superRole = superRole; + this.initSubRoles = new ArrayList<>(0); + this.subRoles = Collections.unmodifiableList(this.initSubRoles); + if (superRole != null) { + superRole.initSubRoles.add(this); + } + } + + static { + //after all are initialized, avoid further modification + for (CtRole role : CtRole.values()) { + role.initSubRoles = null; + } + } + /** * Get the {@link CtRole} associated to the field name * @param name @@ -127,4 +154,21 @@ public String getCamelCaseName() { public String toString() { return getCamelCaseName(); } + + /** + * @return the CtRole which is the real holder of this virtual CtRole or null if there is no super role. + * For example {@link #TYPE_MEMBER} is super role of {@link #CONSTRUCTOR}, {@link #FIELD}, {@link #METHOD}, {@link #NESTED_TYPE} + */ + public CtRole getSuperRole() { + return superRole; + } + + /** + * @return sub roles of this super role or empty array if there is no sub role. + * For example {@link #TYPE_MEMBER} is super role of {@link #CONSTRUCTOR}, {@link #FIELD}, {@link #METHOD}, {@link #NESTED_TYPE} + * + */ + public List getSubRoles() { + return subRoles; + } } diff --git a/src/test/java/spoon/generating/RoleHandlersGenerator.java b/src/test/java/spoon/generating/RoleHandlersGenerator.java index 01e04730453..c6702e7cf48 100644 --- a/src/test/java/spoon/generating/RoleHandlersGenerator.java +++ b/src/test/java/spoon/generating/RoleHandlersGenerator.java @@ -65,7 +65,7 @@ public void process() { }); superFields.sort((a, b) -> { - int d = a.getRole().ordinal() - b.getRole().ordinal(); + int d = a.getRole().name().compareTo(b.getRole().name()); if (d != 0) { return d; } diff --git a/src/test/java/spoon/test/role/TestCtRole.java b/src/test/java/spoon/test/role/TestCtRole.java index 3f9e7dd71b7..f2b5791c6a6 100644 --- a/src/test/java/spoon/test/role/TestCtRole.java +++ b/src/test/java/spoon/test/role/TestCtRole.java @@ -5,6 +5,9 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; public class TestCtRole { @Test @@ -26,7 +29,30 @@ public void testGetCtRoleByName() { for (CtRole role : CtRole.values()) { assertEquals(role, CtRole.fromName(role.name().replaceAll("_", "").toLowerCase())); } + } + @Test + public void testCtRoleGetSubRolesNotNull() { + // contract: CtRole#getSubRoles() never returns null + for (CtRole role : CtRole.values()) { + assertNotNull(role.getSubRoles()); + } + } + + @Test + public void testCtRoleSubRoleMatchesWithSuperRole() { + // contract: CtRole#getSubRoles() and CtRole#getSuperRole() are empty or links to each other + int countOfSubRoles = 0; + for (CtRole role : CtRole.values()) { + for (CtRole subRole : role.getSubRoles()) { + countOfSubRoles++; + assertSame(role, subRole.getSuperRole()); + } + if (role.getSuperRole() != null) { + assertTrue(role.getSuperRole().getSubRoles().contains(role)); + } + } + assertTrue(countOfSubRoles > 0); } }