From f2510bf1d1a5b234862a419eee5d65ba4eb84daf Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Tue, 30 Jan 2024 18:04:55 +0100 Subject: [PATCH 01/51] Add support for CtReceiverParameter in spoon model. Added the implementation of receiver parameters in the spoon model including tests for the feature and necessary enhancements in supporting classes. Refactored existing code to account for the inclusion of receiver parameters. Notable changes include declaring a new interface CtReceiverParameter, adding necessary methods in the CtExecutable interface and its implementation. --- src/main/java/spoon/metamodel/Metamodel.java | 29 +-- .../reflect/declaration/CtExecutable.java | 6 + .../spoon/reflect/declaration/CtMethod.java | 1 - .../declaration/CtReceiverParameter.java | 24 +++ .../spoon/reflect/factory/CoreFactory.java | 17 +- .../reflect/factory/ExecutableFactory.java | 6 + .../reflect/meta/impl/ModelRoleHandlers.java | 8 +- src/main/java/spoon/reflect/path/CtRole.java | 13 +- .../reflect/visitor/CtAbstractVisitor.java | 5 + .../reflect/visitor/CtBiScannerDefault.java | 19 +- .../reflect/visitor/CtInheritanceScanner.java | 11 ++ .../java/spoon/reflect/visitor/CtScanner.java | 31 ++- .../java/spoon/reflect/visitor/CtVisitor.java | 19 +- .../visitor/DefaultJavaPrettyPrinter.java | 11 ++ .../reflect/visitor/ElementPrinterHelper.java | 1 + .../spoon/support/DefaultCoreFactory.java | 16 +- .../support/compiler/jdt/JDTTreeBuilder.java | 13 +- .../compiler/jdt/JDTTreeBuilderHelper.java | 20 +- .../support/compiler/jdt/ParentExiter.java | 5 + .../support/reflect/code/CtLambdaImpl.java | 12 ++ .../reflect/declaration/CtExecutableImpl.java | 17 +- .../reflect/declaration/CtMethodImpl.java | 3 + .../declaration/CtReceiverParameterImpl.java | 185 ++++++++++++++++++ .../support/visitor/clone/CloneBuilder.java | 13 +- .../support/visitor/clone/CloneVisitor.java | 13 +- .../visitor/replace/ReplacementVisitor.java | 11 +- .../ReceiverParameterTest.java | 28 +++ .../receiver/SimpleReceiverParameter.java | 8 + 28 files changed, 466 insertions(+), 79 deletions(-) create mode 100644 src/main/java/spoon/reflect/declaration/CtReceiverParameter.java create mode 100644 src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java create mode 100644 src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java create mode 100644 src/test/resources/receiver/SimpleReceiverParameter.java diff --git a/src/main/java/spoon/metamodel/Metamodel.java b/src/main/java/spoon/metamodel/Metamodel.java index 4688cffbbab..673390cd69d 100644 --- a/src/main/java/spoon/metamodel/Metamodel.java +++ b/src/main/java/spoon/metamodel/Metamodel.java @@ -7,20 +7,7 @@ */ package spoon.metamodel; -import java.io.File; -import java.lang.annotation.Annotation; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - import org.jspecify.annotations.Nullable; - import spoon.Launcher; import spoon.SpoonException; import spoon.reflect.annotations.PropertyGetter; @@ -33,6 +20,7 @@ import spoon.reflect.declaration.CtModuleDirective; import spoon.reflect.declaration.CtPackageExport; import spoon.reflect.declaration.CtProvidedService; +import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtRecord; import spoon.reflect.declaration.CtRecordComponent; import spoon.reflect.declaration.CtType; @@ -42,11 +30,23 @@ import spoon.reflect.reference.CtTypeReference; import spoon.reflect.visitor.filter.AllTypeMembersFunction; import spoon.reflect.visitor.filter.TypeFilter; -import spoon.support.adaption.TypeAdaptor; import spoon.support.DefaultCoreFactory; import spoon.support.StandardEnvironment; +import spoon.support.adaption.TypeAdaptor; import spoon.support.compiler.FileSystemFolder; +import java.io.File; +import java.lang.annotation.Annotation; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + /** * Represents the Spoon metamodel (incl. at runtime) */ @@ -195,6 +195,7 @@ public static Set> getAllMetamodelInterfaces() { result.add(factory.Type().get(CtModuleDirective.class)); result.add(factory.Type().get(CtRecordComponent.class)); result.add(factory.Type().get(CtRecord.class)); + result.add(factory.Type().get(CtReceiverParameter.class)); return result; } diff --git a/src/main/java/spoon/reflect/declaration/CtExecutable.java b/src/main/java/spoon/reflect/declaration/CtExecutable.java index 61550a6dbad..91070e5604d 100644 --- a/src/main/java/spoon/reflect/declaration/CtExecutable.java +++ b/src/main/java/spoon/reflect/declaration/CtExecutable.java @@ -7,6 +7,7 @@ */ package spoon.reflect.declaration; +import org.jspecify.annotations.Nullable; import spoon.reflect.annotations.PropertyGetter; import spoon.reflect.annotations.PropertySetter; import spoon.reflect.code.CtBlock; @@ -140,4 +141,9 @@ public interface CtExecutable extends CtNamedElement, CtTypedElement, CtBo @Override CtExecutable clone(); + + CtExecutable setReceiverParameter(CtReceiverParameter receiverParameter); + + @Nullable + CtReceiverParameter getReceiverParameter(); } diff --git a/src/main/java/spoon/reflect/declaration/CtMethod.java b/src/main/java/spoon/reflect/declaration/CtMethod.java index bf3453d2892..26c0c7fb6c5 100644 --- a/src/main/java/spoon/reflect/declaration/CtMethod.java +++ b/src/main/java/spoon/reflect/declaration/CtMethod.java @@ -61,5 +61,4 @@ public interface CtMethod extends CtExecutable, CtFormalTypeDeclarer, CtSh * If you want to rename the new method, use {@link Refactoring#changeMethodName(CtMethod, String)} (and not {@link #setSimpleName(String)}, which does not update the references) */ CtMethod copyMethod(); - } diff --git a/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java b/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java new file mode 100644 index 00000000000..81db85ab85d --- /dev/null +++ b/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java @@ -0,0 +1,24 @@ +package spoon.reflect.declaration; + + +import spoon.reflect.code.CtExpression; +import spoon.support.UnsettableProperty; +import spoon.support.reflect.CtExtendedModifier; + +import java.util.Set; + +public interface CtReceiverParameter extends CtVariable, CtShadowable { + + @Override + @UnsettableProperty + > C setDefaultExpression(CtExpression assignedExpression); + + @Override + @UnsettableProperty + C setExtendedModifiers(Set extendedModifiers); + + + @Override + @UnsettableProperty + T setSimpleName(String simpleName); +} diff --git a/src/main/java/spoon/reflect/factory/CoreFactory.java b/src/main/java/spoon/reflect/factory/CoreFactory.java index 9f7751f0761..beac3e3f7db 100644 --- a/src/main/java/spoon/reflect/factory/CoreFactory.java +++ b/src/main/java/spoon/reflect/factory/CoreFactory.java @@ -7,8 +7,6 @@ */ package spoon.reflect.factory; -import java.lang.annotation.Annotation; - import spoon.reflect.code.CtAnnotationFieldAccess; import spoon.reflect.code.CtArrayRead; import spoon.reflect.code.CtArrayWrite; @@ -78,27 +76,28 @@ import spoon.reflect.declaration.CtEnum; import spoon.reflect.declaration.CtEnumValue; import spoon.reflect.declaration.CtField; +import spoon.reflect.declaration.CtImport; import spoon.reflect.declaration.CtInterface; import spoon.reflect.declaration.CtMethod; import spoon.reflect.declaration.CtModule; +import spoon.reflect.declaration.CtModuleRequirement; +import spoon.reflect.declaration.CtPackage; +import spoon.reflect.declaration.CtPackageDeclaration; import spoon.reflect.declaration.CtPackageExport; +import spoon.reflect.declaration.CtParameter; import spoon.reflect.declaration.CtProvidedService; +import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtRecord; import spoon.reflect.declaration.CtRecordComponent; -import spoon.reflect.declaration.CtPackage; -import spoon.reflect.declaration.CtPackageDeclaration; -import spoon.reflect.declaration.CtParameter; import spoon.reflect.declaration.CtTypeParameter; import spoon.reflect.declaration.CtUsedService; import spoon.reflect.reference.CtArrayTypeReference; import spoon.reflect.reference.CtCatchVariableReference; import spoon.reflect.reference.CtExecutableReference; import spoon.reflect.reference.CtFieldReference; -import spoon.reflect.declaration.CtImport; import spoon.reflect.reference.CtIntersectionTypeReference; import spoon.reflect.reference.CtLocalVariableReference; import spoon.reflect.reference.CtModuleReference; -import spoon.reflect.declaration.CtModuleRequirement; import spoon.reflect.reference.CtPackageReference; import spoon.reflect.reference.CtParameterReference; import spoon.reflect.reference.CtTypeMemberWildcardImportReference; @@ -107,6 +106,8 @@ import spoon.reflect.reference.CtUnboundVariableReference; import spoon.reflect.reference.CtWildcardReference; +import java.lang.annotation.Annotation; + /** * This interface defines the core creation methods for the meta-model (to be * implemented so that Spoon can manipulate other meta-model implementations). @@ -653,4 +654,6 @@ BodyHolderSourcePosition createBodyHolderSourcePosition( * {@return a record pattern} */ CtRecordPattern createRecordPattern(); + + CtReceiverParameter createReceiverParameter(); } diff --git a/src/main/java/spoon/reflect/factory/ExecutableFactory.java b/src/main/java/spoon/reflect/factory/ExecutableFactory.java index 2a34e916b1b..afea952f60a 100644 --- a/src/main/java/spoon/reflect/factory/ExecutableFactory.java +++ b/src/main/java/spoon/reflect/factory/ExecutableFactory.java @@ -15,6 +15,7 @@ import spoon.reflect.declaration.CtExecutable; import spoon.reflect.declaration.CtMethod; import spoon.reflect.declaration.CtParameter; +import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtType; import spoon.reflect.declaration.ModifierKind; import spoon.reflect.reference.CtArrayTypeReference; @@ -243,4 +244,9 @@ public CtExecutableReference createReference(String signature) { return executableRef; } + public CtReceiverParameter createReceiverParameter(CtTypeReference type) { + CtReceiverParameter receiverParameter = factory.Core().createReceiverParameter(); + receiverParameter.setType(type); + return receiverParameter; + } } diff --git a/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java b/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java index 0a8b23212f0..9ce21f79591 100644 --- a/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java +++ b/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java @@ -1,9 +1,9 @@ -/* +/** * SPDX-License-Identifier: (MIT OR CECILL-C) * - * Copyright (C) 2006-2023 INRIA and contributors + * Copyright (C) 2006-2019 INRIA and contributors * - * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. + * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) of the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. */ package spoon.reflect.meta.impl; import java.lang.annotation.Annotation; @@ -2607,4 +2607,4 @@ public void setValue(T element, U value) { castTarget(element).setAccessedType(castValue(value)); } } -} +} \ No newline at end of file diff --git a/src/main/java/spoon/reflect/path/CtRole.java b/src/main/java/spoon/reflect/path/CtRole.java index e3b151d6617..37110c22c3a 100644 --- a/src/main/java/spoon/reflect/path/CtRole.java +++ b/src/main/java/spoon/reflect/path/CtRole.java @@ -7,11 +7,6 @@ */ package spoon.reflect.path; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.function.Predicate; - import spoon.SpoonException; import spoon.reflect.declaration.CtAnonymousExecutable; import spoon.reflect.declaration.CtConstructor; @@ -25,6 +20,11 @@ import spoon.reflect.declaration.CtUsedService; import spoon.support.Internal; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.function.Predicate; + /** * Identifies the roles of attributes of spoon model. */ @@ -122,7 +122,8 @@ public enum CtRole { RECORD_COMPONENT, COMPACT_CONSTRUCTOR, PERMITTED_TYPE, - PATTERN; + PATTERN, + RECEIVER_PARAMETER; private final CtRole superRole; private final List subRoles; diff --git a/src/main/java/spoon/reflect/visitor/CtAbstractVisitor.java b/src/main/java/spoon/reflect/visitor/CtAbstractVisitor.java index 3837628b15f..fa6b9840a37 100644 --- a/src/main/java/spoon/reflect/visitor/CtAbstractVisitor.java +++ b/src/main/java/spoon/reflect/visitor/CtAbstractVisitor.java @@ -76,6 +76,7 @@ import spoon.reflect.declaration.CtModule; import spoon.reflect.declaration.CtPackageExport; import spoon.reflect.declaration.CtProvidedService; +import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtRecord; import spoon.reflect.declaration.CtRecordComponent; import spoon.reflect.declaration.CtModuleRequirement; @@ -559,6 +560,10 @@ public void visitCtRecordComponent(CtRecordComponent recordComponent) { @Override public void visitCtCasePattern(CtCasePattern casePattern) { + } + @Override + public void visitCtReceiverParameter(CtReceiverParameter providedService) { + } @Override diff --git a/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java b/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java index ff32f221322..57494d2dcc1 100644 --- a/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java +++ b/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java @@ -1,9 +1,18 @@ -/* - * SPDX-License-Identifier: (MIT OR CECILL-C) +/** + * Copyright (C) 2006-2018 INRIA and contributors + * Spoon - http://spoon.gforge.inria.fr/ + * + * This software is governed by the CeCILL-C License under French law and + * abiding by the rules of distribution of free software. You can use, modify + * and/or redistribute the software under the terms of the CeCILL-C license as + * circulated by CEA, CNRS and INRIA at http://www.cecill.info. * - * Copyright (C) 2006-2023 INRIA and contributors + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL-C License for more details. * - * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package spoon.reflect.visitor; /** @@ -1107,4 +1116,4 @@ public void visitCtRecordPattern(spoon.reflect.code.CtRecordPattern recordPatter biScan(spoon.reflect.path.CtRole.COMMENT, recordPattern.getComments(), other.getComments()); exit(recordPattern); } -} +} \ No newline at end of file diff --git a/src/main/java/spoon/reflect/visitor/CtInheritanceScanner.java b/src/main/java/spoon/reflect/visitor/CtInheritanceScanner.java index 7461597a89e..0e952630ece 100644 --- a/src/main/java/spoon/reflect/visitor/CtInheritanceScanner.java +++ b/src/main/java/spoon/reflect/visitor/CtInheritanceScanner.java @@ -97,6 +97,7 @@ import spoon.reflect.declaration.CtModuleDirective; import spoon.reflect.declaration.CtPackageExport; import spoon.reflect.declaration.CtProvidedService; +import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtRecord; import spoon.reflect.declaration.CtRecordComponent; import spoon.reflect.declaration.CtModuleRequirement; @@ -1123,5 +1124,15 @@ public void visitCtRecordPattern(CtRecordPattern pattern) { scanCtVisitable(pattern); } + @Override + public void visitCtReceiverParameter(CtReceiverParameter e) { + scanCtNamedElement(e); + scanCtVariable(e); + scanCtModifiable(e); + scanCtTypedElement(e); + scanCtElement(e); + scanCtVisitable(e); + scanCtShadowable(e); + } } diff --git a/src/main/java/spoon/reflect/visitor/CtScanner.java b/src/main/java/spoon/reflect/visitor/CtScanner.java index a92d2526d04..1d3ef839905 100644 --- a/src/main/java/spoon/reflect/visitor/CtScanner.java +++ b/src/main/java/spoon/reflect/visitor/CtScanner.java @@ -8,10 +8,6 @@ package spoon.reflect.visitor; -import java.lang.annotation.Annotation; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Map; import spoon.reflect.code.CtAnnotationFieldAccess; import spoon.reflect.code.CtArrayRead; import spoon.reflect.code.CtArrayWrite; @@ -78,17 +74,19 @@ import spoon.reflect.declaration.CtEnum; import spoon.reflect.declaration.CtEnumValue; import spoon.reflect.declaration.CtField; +import spoon.reflect.declaration.CtImport; import spoon.reflect.declaration.CtInterface; import spoon.reflect.declaration.CtMethod; import spoon.reflect.declaration.CtModule; -import spoon.reflect.declaration.CtPackageExport; -import spoon.reflect.declaration.CtProvidedService; -import spoon.reflect.declaration.CtRecord; -import spoon.reflect.declaration.CtRecordComponent; import spoon.reflect.declaration.CtModuleRequirement; import spoon.reflect.declaration.CtPackage; import spoon.reflect.declaration.CtPackageDeclaration; +import spoon.reflect.declaration.CtPackageExport; import spoon.reflect.declaration.CtParameter; +import spoon.reflect.declaration.CtProvidedService; +import spoon.reflect.declaration.CtReceiverParameter; +import spoon.reflect.declaration.CtRecord; +import spoon.reflect.declaration.CtRecordComponent; import spoon.reflect.declaration.CtTypeParameter; import spoon.reflect.declaration.CtUsedService; import spoon.reflect.path.CtRole; @@ -96,17 +94,21 @@ import spoon.reflect.reference.CtCatchVariableReference; import spoon.reflect.reference.CtExecutableReference; import spoon.reflect.reference.CtFieldReference; -import spoon.reflect.declaration.CtImport; import spoon.reflect.reference.CtIntersectionTypeReference; import spoon.reflect.reference.CtLocalVariableReference; import spoon.reflect.reference.CtModuleReference; import spoon.reflect.reference.CtPackageReference; import spoon.reflect.reference.CtParameterReference; +import spoon.reflect.reference.CtTypeMemberWildcardImportReference; import spoon.reflect.reference.CtTypeParameterReference; import spoon.reflect.reference.CtTypeReference; import spoon.reflect.reference.CtUnboundVariableReference; import spoon.reflect.reference.CtWildcardReference; -import spoon.reflect.reference.CtTypeMemberWildcardImportReference; + +import java.lang.annotation.Annotation; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; /** * This visitor implements a deep-search scan on the model. @@ -1080,6 +1082,15 @@ public void visitCtRecordComponent(CtRecordComponent recordType) { exit(recordType); } + @Override + public void visitCtReceiverParameter(CtReceiverParameter receiverParameter) { + enter(receiverParameter); + scan(CtRole.ANNOTATION, receiverParameter.getAnnotations()); + scan(CtRole.TYPE, receiverParameter.getType()); + scan(CtRole.COMMENT, receiverParameter.getComments()); + exit(receiverParameter); + } + @Override public void visitCtCasePattern(CtCasePattern casePattern) { enter(casePattern); diff --git a/src/main/java/spoon/reflect/visitor/CtVisitor.java b/src/main/java/spoon/reflect/visitor/CtVisitor.java index 60cb7ae10c5..09108ebabc1 100644 --- a/src/main/java/spoon/reflect/visitor/CtVisitor.java +++ b/src/main/java/spoon/reflect/visitor/CtVisitor.java @@ -71,34 +71,35 @@ import spoon.reflect.declaration.CtEnum; import spoon.reflect.declaration.CtEnumValue; import spoon.reflect.declaration.CtField; +import spoon.reflect.declaration.CtImport; import spoon.reflect.declaration.CtInterface; import spoon.reflect.declaration.CtMethod; import spoon.reflect.declaration.CtModule; -import spoon.reflect.declaration.CtPackageExport; -import spoon.reflect.declaration.CtProvidedService; -import spoon.reflect.declaration.CtRecord; -import spoon.reflect.declaration.CtRecordComponent; import spoon.reflect.declaration.CtModuleRequirement; import spoon.reflect.declaration.CtPackage; import spoon.reflect.declaration.CtPackageDeclaration; +import spoon.reflect.declaration.CtPackageExport; import spoon.reflect.declaration.CtParameter; +import spoon.reflect.declaration.CtProvidedService; +import spoon.reflect.declaration.CtReceiverParameter; +import spoon.reflect.declaration.CtRecord; +import spoon.reflect.declaration.CtRecordComponent; import spoon.reflect.declaration.CtTypeParameter; import spoon.reflect.declaration.CtUsedService; import spoon.reflect.reference.CtArrayTypeReference; import spoon.reflect.reference.CtCatchVariableReference; import spoon.reflect.reference.CtExecutableReference; import spoon.reflect.reference.CtFieldReference; -import spoon.reflect.declaration.CtImport; import spoon.reflect.reference.CtIntersectionTypeReference; import spoon.reflect.reference.CtLocalVariableReference; import spoon.reflect.reference.CtModuleReference; import spoon.reflect.reference.CtPackageReference; import spoon.reflect.reference.CtParameterReference; +import spoon.reflect.reference.CtTypeMemberWildcardImportReference; import spoon.reflect.reference.CtTypeParameterReference; import spoon.reflect.reference.CtTypeReference; import spoon.reflect.reference.CtUnboundVariableReference; import spoon.reflect.reference.CtWildcardReference; -import spoon.reflect.reference.CtTypeMemberWildcardImportReference; import java.lang.annotation.Annotation; @@ -570,4 +571,10 @@ void visitCtOperatorAssignment( * @param recordPattern the record pattern to visit. */ void visitCtRecordPattern(CtRecordPattern recordPattern); + + /** + * Visits a receiver parameter. + * @param receiverParameter the receiver parameter to visit. + */ + void visitCtReceiverParameter(CtReceiverParameter receiverParameter); } diff --git a/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java b/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java index 995569c8d3d..3d10ee96c63 100644 --- a/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java +++ b/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java @@ -100,6 +100,7 @@ import spoon.reflect.declaration.CtPackageExport; import spoon.reflect.declaration.CtParameter; import spoon.reflect.declaration.CtProvidedService; +import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtRecord; import spoon.reflect.declaration.CtRecordComponent; import spoon.reflect.declaration.CtType; @@ -2359,4 +2360,14 @@ public void visitCtRecordPattern(CtRecordPattern recordPattern) { elementPrinterHelper.printList(recordPattern.getPatternList(), null, false, "(", false, false, ",", true, false, ")", this::scan); } + + @Override + public void visitCtReceiverParameter(CtReceiverParameter receiverParameter) { + elementPrinterHelper.writeComment(receiverParameter); + elementPrinterHelper.writeAnnotations(receiverParameter); + elementPrinterHelper.writeModifiers(receiverParameter); + scan(receiverParameter.getType()); + // after an implicit type, there is no space because we dont print anything + printer.writeIdentifier(receiverParameter.getSimpleName()); + } } diff --git a/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java b/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java index a7ea652182d..04836a64787 100644 --- a/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java +++ b/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java @@ -147,6 +147,7 @@ public void writeImplementsClause(CtType type) { } public void writeExecutableParameters(CtExecutable executable) { + //TODO: printing printList(executable.getParameters(), null, false, "(", false, false, ",", true, false, ")", p -> prettyPrinter.scan(p)); diff --git a/src/main/java/spoon/support/DefaultCoreFactory.java b/src/main/java/spoon/support/DefaultCoreFactory.java index 9337e431cbb..26b9eaf2362 100644 --- a/src/main/java/spoon/support/DefaultCoreFactory.java +++ b/src/main/java/spoon/support/DefaultCoreFactory.java @@ -8,9 +8,6 @@ package spoon.support; -import java.lang.annotation.Annotation; -import java.util.HashSet; -import java.util.Set; import spoon.experimental.CtUnresolvedImport; import spoon.reflect.code.CtAnnotationFieldAccess; import spoon.reflect.code.CtArrayRead; @@ -91,6 +88,7 @@ import spoon.reflect.declaration.CtPackageExport; import spoon.reflect.declaration.CtParameter; import spoon.reflect.declaration.CtProvidedService; +import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtRecord; import spoon.reflect.declaration.CtRecordComponent; import spoon.reflect.declaration.CtTypeParameter; @@ -191,6 +189,7 @@ import spoon.support.reflect.declaration.CtPackageImpl; import spoon.support.reflect.declaration.CtParameterImpl; import spoon.support.reflect.declaration.CtProvidedServiceImpl; +import spoon.support.reflect.declaration.CtReceiverParameterImpl; import spoon.support.reflect.declaration.CtRecordComponentImpl; import spoon.support.reflect.declaration.CtRecordImpl; import spoon.support.reflect.declaration.CtTypeParameterImpl; @@ -212,6 +211,10 @@ import spoon.support.reflect.reference.CtWildcardReferenceImpl; import spoon.support.visitor.equals.CloneHelper; +import java.lang.annotation.Annotation; +import java.util.HashSet; +import java.util.Set; + /** * This class implements a default core factory for Spoon's meta-model. This * implementation is done with regular Java classes (POJOs). @@ -1217,4 +1220,11 @@ public CtRecordPattern createRecordPattern() { recordPattern.setFactory(getMainFactory()); return recordPattern; } + + @Override + public CtReceiverParameter createReceiverParameter() { + CtReceiverParameter receiverParameter = new CtReceiverParameterImpl(); + receiverParameter.setFactory(getMainFactory()); + return receiverParameter; + } } diff --git a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java index 2d191835670..5fd3d84d825 100644 --- a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java +++ b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java @@ -117,11 +117,13 @@ import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; import org.eclipse.jdt.internal.compiler.lookup.MethodScope; import org.eclipse.jdt.internal.compiler.lookup.ModuleBinding; +import org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding; import org.eclipse.jdt.internal.compiler.lookup.ProblemBinding; import org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding; import org.eclipse.jdt.internal.compiler.lookup.Scope; import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; import spoon.SpoonException; import spoon.reflect.code.BinaryOperatorKind; @@ -161,6 +163,7 @@ import spoon.reflect.declaration.CtPackage; import spoon.reflect.declaration.CtPackageDeclaration; import spoon.reflect.declaration.CtParameter; +import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtType; import spoon.reflect.declaration.CtTypeParameter; import spoon.reflect.declaration.ModifierKind; @@ -174,6 +177,7 @@ import spoon.support.reflect.reference.CtArrayTypeReferenceImpl; import java.lang.invoke.MethodHandles; +import java.util.Set; import static spoon.support.compiler.jdt.JDTTreeBuilderQuery.getBinaryOperatorKind; import static spoon.support.compiler.jdt.JDTTreeBuilderQuery.getModifiers; @@ -958,6 +962,13 @@ public boolean visit(Argument argument, BlockScope scope) { return true; } boolean isVar = argument.type != null && argument.type.isTypeNameVar(scope); + boolean isReceiver = CharOperation.charToString(argument.name).equals("this"); + // we can also use an instanceof Receiver here + if (isReceiver) { + CtReceiverParameter receiverParameter = helper.createReceiverParameter(argument); + context.enter(receiverParameter, argument); + return true; + } CtParameter p = helper.createParameter(argument); if (isVar) { p.setInferred(true); @@ -1141,7 +1152,7 @@ public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) { context.enter(getFactory().Core().createBlock(), methodDeclaration); context.exit(methodDeclaration); } - + //TODO: remove this code // We consider the receiver as a standard argument (i.e. as a parameter) Receiver receiver = methodDeclaration.receiver; if (receiver != null) { diff --git a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilderHelper.java b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilderHelper.java index 99d53b12929..bd3d1a411cc 100644 --- a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilderHelper.java +++ b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilderHelper.java @@ -7,7 +7,6 @@ */ package spoon.support.compiler.jdt; -import java.util.Arrays; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; import org.eclipse.jdt.internal.compiler.ast.Argument; @@ -58,6 +57,7 @@ import spoon.reflect.declaration.CtPackageExport; import spoon.reflect.declaration.CtParameter; import spoon.reflect.declaration.CtProvidedService; +import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtSealable; import spoon.reflect.declaration.CtType; import spoon.reflect.declaration.CtUsedService; @@ -76,6 +76,7 @@ import spoon.support.reflect.CtExtendedModifier; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -753,6 +754,23 @@ CtParameter createParameter(Argument argument) { return p; } + /** + * Creates a receiver parameter for a method or constructor. + * + * @param argument the argument containing information about the parameter + * @return the created CtReceiverParameter object + */ + CtReceiverParameter createReceiverParameter(Argument argument) { + CtReceiverParameter p = jdtTreeBuilder.getFactory().Core().createReceiverParameter(); + p.setSimpleName("this"); + p.setExtendedModifiers(getModifiers(argument.modifiers, false, ModifierTarget.PARAMETER)); + if (argument.binding != null && argument.binding.type != null && argument.type == null) { + p.setType(jdtTreeBuilder.getReferencesBuilder().getTypeReference(argument.binding.type)); + p.getType().setImplicit(argument.type == null); + } + return p; + } + /** * Creates an executable reference expression. * diff --git a/src/main/java/spoon/support/compiler/jdt/ParentExiter.java b/src/main/java/spoon/support/compiler/jdt/ParentExiter.java index 7bec0d6512a..bf7dbcc0e00 100644 --- a/src/main/java/spoon/support/compiler/jdt/ParentExiter.java +++ b/src/main/java/spoon/support/compiler/jdt/ParentExiter.java @@ -97,6 +97,7 @@ import spoon.reflect.declaration.CtMethod; import spoon.reflect.declaration.CtPackage; import spoon.reflect.declaration.CtParameter; +import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtRecord; import spoon.reflect.declaration.CtRecordComponent; import spoon.reflect.declaration.CtType; @@ -207,6 +208,10 @@ public void scanCtExecutable(CtExecutable e) { } else if (child instanceof CtBlock && !(e instanceof CtMethod || e instanceof CtConstructor)) { e.setBody((CtBlock) child); return; + } else if(child instanceof CtReceiverParameter) { + if(e instanceof CtMethod) { + ((CtMethod) e).setReceiverParameter((CtReceiverParameter) child); + } } super.scanCtExecutable(e); } diff --git a/src/main/java/spoon/support/reflect/code/CtLambdaImpl.java b/src/main/java/spoon/support/reflect/code/CtLambdaImpl.java index d88da66226a..dea209ad086 100644 --- a/src/main/java/spoon/support/reflect/code/CtLambdaImpl.java +++ b/src/main/java/spoon/support/reflect/code/CtLambdaImpl.java @@ -7,6 +7,7 @@ */ package spoon.support.reflect.code; +import org.jspecify.annotations.Nullable; import spoon.LovecraftException; import spoon.SpoonException; import spoon.reflect.annotations.MetamodelPropertyField; @@ -21,6 +22,7 @@ import spoon.reflect.declaration.CtMethod; import spoon.reflect.declaration.CtNamedElement; import spoon.reflect.declaration.CtParameter; +import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtType; import spoon.reflect.declaration.CtExecutable; import spoon.reflect.declaration.CtTypedElement; @@ -286,6 +288,16 @@ public CtLambda clone() { return (CtLambda) super.clone(); } + @Override + public CtExecutable setReceiverParameter(CtReceiverParameter receiverParameter) { + return this; + } + + @Override + public @Nullable CtReceiverParameter getReceiverParameter() { + return null; + } + @Override public C setType(CtTypeReference type) { if (type != null) { diff --git a/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java b/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java index 578dca12d96..ec77d48e129 100644 --- a/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java +++ b/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java @@ -7,13 +7,16 @@ */ package spoon.support.reflect.declaration; +import org.jspecify.annotations.Nullable; import spoon.reflect.annotations.MetamodelPropertyField; import spoon.reflect.code.CtBlock; import spoon.reflect.code.CtBodyHolder; import spoon.reflect.code.CtStatement; import spoon.reflect.declaration.CtExecutable; import spoon.reflect.declaration.CtParameter; +import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtType; +import spoon.reflect.path.CtRole; import spoon.reflect.reference.CtExecutableReference; import spoon.reflect.reference.CtTypeReference; import spoon.support.util.QualifiedNameBasedSortedSet; @@ -46,7 +49,8 @@ public abstract class CtExecutableImpl extends CtNamedElementImpl implements @MetamodelPropertyField(role = THROWN) Set> thrownTypes = emptySet(); - + @MetamodelPropertyField(role = CtRole.RECEIVER_PARAMETER) + private CtReceiverParameter receiverParameter; public CtExecutableImpl() { } @@ -192,4 +196,15 @@ public CtExecutableReference getReference() { public CtExecutable clone() { return (CtExecutable) super.clone(); } + + public CtExecutable setReceiverParameter(CtReceiverParameter receiverParameter) { + getFactory().getEnvironment().getModelChangeListener().onObjectUpdate(this, CtRole.RECEIVER_PARAMETER, receiverParameter, this.receiverParameter); + this.receiverParameter = receiverParameter; + return this; + } + + @Nullable + public CtReceiverParameter getReceiverParameter() { + return receiverParameter; + } } diff --git a/src/main/java/spoon/support/reflect/declaration/CtMethodImpl.java b/src/main/java/spoon/support/reflect/declaration/CtMethodImpl.java index 13f99a84af3..8cf8ff78ba6 100644 --- a/src/main/java/spoon/support/reflect/declaration/CtMethodImpl.java +++ b/src/main/java/spoon/support/reflect/declaration/CtMethodImpl.java @@ -13,6 +13,7 @@ import spoon.reflect.declaration.CtFormalTypeDeclarer; import spoon.reflect.declaration.CtMethod; import spoon.reflect.declaration.CtModifiable; +import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtShadowable; import spoon.reflect.declaration.CtTypeParameter; import spoon.reflect.declaration.CtTypedElement; @@ -51,6 +52,7 @@ public class CtMethodImpl extends CtExecutableImpl implements CtMethod @MetamodelPropertyField(role = CtRole.MODIFIER) private CtModifierHandler modifierHandler = new CtModifierHandler(this); + public CtMethodImpl() { } @@ -297,4 +299,5 @@ public boolean isStrictfp() { public CtMethod copyMethod() { return Refactoring.copyMethod(this); } + } diff --git a/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java b/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java new file mode 100644 index 00000000000..12f1652219a --- /dev/null +++ b/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java @@ -0,0 +1,185 @@ +package spoon.support.reflect.declaration; + +import spoon.reflect.annotations.MetamodelPropertyField; +import spoon.reflect.code.CtExpression; +import spoon.reflect.declaration.CtModifiable; +import spoon.reflect.declaration.CtReceiverParameter; +import spoon.reflect.declaration.CtShadowable; +import spoon.reflect.declaration.CtTypedElement; +import spoon.reflect.declaration.CtVariable; +import spoon.reflect.declaration.ModifierKind; +import spoon.reflect.path.CtRole; +import spoon.reflect.reference.CtTypeReference; +import spoon.reflect.reference.CtVariableReference; +import spoon.reflect.visitor.CtVisitor; +import spoon.support.reflect.CtExtendedModifier; +import spoon.support.reflect.CtModifierHandler; + +import java.util.Set; + +public class CtReceiverParameterImpl extends CtNamedElementImpl implements CtReceiverParameter { + + @MetamodelPropertyField(role = CtRole.TYPE) + private CtTypeReference type; + @MetamodelPropertyField(role = CtRole.MODIFIER) + private final CtModifierHandler modifierHandler = new CtModifierHandler(this); + @MetamodelPropertyField(role = CtRole.IS_SHADOW) + boolean isShadow; + @Override + public Set getModifiers() { + return modifierHandler.getModifiers(); + } + + @Override + public boolean hasModifier(ModifierKind modifier) { + return modifierHandler.hasModifier(modifier); + } + + @Override + public C setModifiers(Set modifiers) { + modifierHandler.setModifiers(modifiers); + return (C) this; + } + + @Override + public C addModifier(ModifierKind modifier) { + modifierHandler.addModifier(modifier); + return (C) this; + } + + @Override + public C removeModifier(ModifierKind modifier) { + modifierHandler.removeModifier(modifier); + return (C) this; + } + + @Override + public C setVisibility(ModifierKind visibility) { + // CtReceiverParameter has no visibility + return (C) this; + } + + @Override + public ModifierKind getVisibility() { + return null; + } + + @Override + public Set getExtendedModifiers() { + return null; + } + + @Override + public boolean isPublic() { + return false; + } + + @Override + public boolean isFinal() { + return modifierHandler.isFinal(); + } + + @Override + public boolean isStatic() { + return false; + } + + @Override + public boolean isProtected() { + return false; + } + + @Override + public boolean isPrivate() { + return false; + } + + @Override + public boolean isAbstract() { + return false; + } + + @Override + public boolean isTransient() { + return false; + } + + @Override + public boolean isVolatile() { + return false; + } + + @Override + public boolean isSynchronized() { + return false; + } + + @Override + public boolean isNative() { + return false; + } + + @Override + public boolean isStrictfp() { + return false; + } + + @Override + public CtExpression getDefaultExpression() { + return null; + } + + @Override + public > C setDefaultExpression(CtExpression assignedExpression) { + return (C) this; + } + + @Override + public boolean isPartOfJointDeclaration() { + return false; + } + + @Override + public T setExtendedModifiers(Set extendedModifiers) { + this.modifierHandler.setExtendedModifiers(extendedModifiers); + return (T) this; + } + + public boolean isShadow() { + return isShadow; + } + + + @Override + public C setShadow(boolean isShadow) { + getFactory().getEnvironment().getModelChangeListener().onObjectUpdate(this, CtRole.IS_SHADOW, isShadow, this.isShadow); + this.isShadow = isShadow; + return (C) this; + } + @Override + public CtTypeReference getType() { + return type; + } + + @Override + public C setType(CtTypeReference type) { + if (type != null) { + type.setParent(this); + } + getFactory().getEnvironment().getModelChangeListener().onObjectUpdate(this, CtRole.TYPE, type, this.type); + this.type = type; + return (C) this; + } + + @Override + public void accept(CtVisitor visitor) { + //TODO: implement + } + + @Override + public CtVariableReference getReference() { + + //TODO: implement + return null; + } +} diff --git a/src/main/java/spoon/support/visitor/clone/CloneBuilder.java b/src/main/java/spoon/support/visitor/clone/CloneBuilder.java index 39fdd412621..6bd842661af 100644 --- a/src/main/java/spoon/support/visitor/clone/CloneBuilder.java +++ b/src/main/java/spoon/support/visitor/clone/CloneBuilder.java @@ -1,9 +1,8 @@ -/* - * SPDX-License-Identifier: (MIT OR CECILL-C) - * - * Copyright (C) 2006-2023 INRIA and contributors - * - * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. +/* SPDX-License-Identifier: (MIT OR CECILL-C) + +Copyright (C) 2006-2023 INRIA and contributors + +Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. */ package spoon.support.visitor.clone; /** @@ -314,4 +313,4 @@ public void visitCtRecordComponent(spoon.reflect.declaration.CtRecordComponent r ((spoon.reflect.declaration.CtRecordComponent) (other)).setShadow(recordComponent.isShadow()); super.visitCtRecordComponent(recordComponent); } -} +} \ No newline at end of file diff --git a/src/main/java/spoon/support/visitor/clone/CloneVisitor.java b/src/main/java/spoon/support/visitor/clone/CloneVisitor.java index 4b32cd0e916..02296f68ea8 100644 --- a/src/main/java/spoon/support/visitor/clone/CloneVisitor.java +++ b/src/main/java/spoon/support/visitor/clone/CloneVisitor.java @@ -1,9 +1,8 @@ -/* - * SPDX-License-Identifier: (MIT OR CECILL-C) - * - * Copyright (C) 2006-2023 INRIA and contributors - * - * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. +/* SPDX-License-Identifier: (MIT OR CECILL-C) + +Copyright (C) 2006-2023 INRIA and contributors + +Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. */ package spoon.support.visitor.clone; /** @@ -1174,4 +1173,4 @@ public void visitCtRecordPattern(spoon.reflect.code.CtRecordPattern recordPatter this.cloneHelper.tailor(recordPattern, aCtRecordPattern); this.other = aCtRecordPattern; } -} +} \ No newline at end of file diff --git a/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java b/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java index 198073f567f..456f7a907be 100644 --- a/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java +++ b/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java @@ -1,9 +1,8 @@ -/* - * SPDX-License-Identifier: (MIT OR CECILL-C) - * - * Copyright (C) 2006-2023 INRIA and contributors - * - * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. +/* SPDX-License-Identifier: (MIT OR CECILL-C) + +Copyright (C) 2006-2019 INRIA and contributors + +Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) of the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. */ package spoon.support.visitor.replace; /** diff --git a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java new file mode 100644 index 00000000000..597c6a4578c --- /dev/null +++ b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java @@ -0,0 +1,28 @@ +package spoon.test.receiverparameter; + +import spoon.reflect.CtModel; +import spoon.reflect.declaration.CtReceiverParameter; +import spoon.reflect.declaration.CtType; +import spoon.reflect.visitor.filter.TypeFilter; +import spoon.testing.utils.ModelTest; + +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class ReceiverParameterTest { + + @ModelTest( + value = "src/test/resources/receiver/SimpleReceiverParameter.java" + ) + void simpleParameter(CtModel model) { + CtType targetType = model.getAllTypes().iterator().next(); + targetType.getMethods().forEach(System.out::println); + List receiverParams = targetType.getElements(new TypeFilter<>(CtReceiverParameter.class)); + assertEquals(1, receiverParams.size()); + CtReceiverParameter next1 = receiverParams.iterator().next(); + assertEquals("this", next1.getSimpleName()); + assertEquals("spoon.test.receiverparameter.SimpleReceiverParameter", next1.getType().getQualifiedName()); + System.out.println(targetType); + } +} diff --git a/src/test/resources/receiver/SimpleReceiverParameter.java b/src/test/resources/receiver/SimpleReceiverParameter.java new file mode 100644 index 00000000000..45ffa593d7b --- /dev/null +++ b/src/test/resources/receiver/SimpleReceiverParameter.java @@ -0,0 +1,8 @@ +package receiver + +class SimpleReceiverParameter { + + public void foo(SimpleReceiverParameter this, int x) { + System.out.println(x) + } +} \ No newline at end of file From 1064eec689b005844e9a1deb93ec0be05ae8f5f9 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Sat, 17 Feb 2024 20:03:57 +0100 Subject: [PATCH 02/51] Update copyright headers in multiple files The copyright headers are updated to include both MIT and Cecill-C licenses in several source files. The copyright year is also updated to extend through 2023. This initiative is part of ensuring the legal statements in our source code files are accurate and up-to-date. --- .../declaration/CtReceiverParameter.java | 7 +++++++ .../reflect/meta/impl/ModelRoleHandlers.java | 6 +++--- .../reflect/visitor/CtBiScannerDefault.java | 17 ++++------------- .../declaration/CtReceiverParameterImpl.java | 7 +++++++ .../support/visitor/clone/CloneBuilder.java | 7 +++++++ .../support/visitor/clone/CloneVisitor.java | 7 +++++++ .../visitor/replace/ReplacementVisitor.java | 7 +++++++ 7 files changed, 42 insertions(+), 16 deletions(-) diff --git a/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java b/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java index 81db85ab85d..666cec18244 100644 --- a/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java +++ b/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java @@ -1,3 +1,10 @@ +/* + * SPDX-License-Identifier: (MIT OR CECILL-C) + * + * Copyright (C) 2006-2023 INRIA and contributors + * + * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. + */ package spoon.reflect.declaration; diff --git a/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java b/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java index 9ce21f79591..61d9e7ae1c0 100644 --- a/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java +++ b/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java @@ -1,9 +1,9 @@ -/** +/* * SPDX-License-Identifier: (MIT OR CECILL-C) * - * Copyright (C) 2006-2019 INRIA and contributors + * Copyright (C) 2006-2023 INRIA and contributors * - * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) of the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. + * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. */ package spoon.reflect.meta.impl; import java.lang.annotation.Annotation; diff --git a/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java b/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java index 57494d2dcc1..8e75dbf1d2f 100644 --- a/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java +++ b/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java @@ -1,18 +1,9 @@ -/** - * Copyright (C) 2006-2018 INRIA and contributors - * Spoon - http://spoon.gforge.inria.fr/ - * - * This software is governed by the CeCILL-C License under French law and - * abiding by the rules of distribution of free software. You can use, modify - * and/or redistribute the software under the terms of the CeCILL-C license as - * circulated by CEA, CNRS and INRIA at http://www.cecill.info. +/* + * SPDX-License-Identifier: (MIT OR CECILL-C) * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL-C License for more details. + * Copyright (C) 2006-2023 INRIA and contributors * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL-C license and that you accept its terms. + * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. */ package spoon.reflect.visitor; /** diff --git a/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java b/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java index 12f1652219a..f76d33e4543 100644 --- a/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java +++ b/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java @@ -1,3 +1,10 @@ +/* + * SPDX-License-Identifier: (MIT OR CECILL-C) + * + * Copyright (C) 2006-2023 INRIA and contributors + * + * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. + */ package spoon.support.reflect.declaration; import spoon.reflect.annotations.MetamodelPropertyField; diff --git a/src/main/java/spoon/support/visitor/clone/CloneBuilder.java b/src/main/java/spoon/support/visitor/clone/CloneBuilder.java index 6bd842661af..851ed8c79de 100644 --- a/src/main/java/spoon/support/visitor/clone/CloneBuilder.java +++ b/src/main/java/spoon/support/visitor/clone/CloneBuilder.java @@ -1,3 +1,10 @@ +/* + * SPDX-License-Identifier: (MIT OR CECILL-C) + * + * Copyright (C) 2006-2023 INRIA and contributors + * + * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. + */ /* SPDX-License-Identifier: (MIT OR CECILL-C) Copyright (C) 2006-2023 INRIA and contributors diff --git a/src/main/java/spoon/support/visitor/clone/CloneVisitor.java b/src/main/java/spoon/support/visitor/clone/CloneVisitor.java index 02296f68ea8..d79ddbee06f 100644 --- a/src/main/java/spoon/support/visitor/clone/CloneVisitor.java +++ b/src/main/java/spoon/support/visitor/clone/CloneVisitor.java @@ -1,3 +1,10 @@ +/* + * SPDX-License-Identifier: (MIT OR CECILL-C) + * + * Copyright (C) 2006-2023 INRIA and contributors + * + * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. + */ /* SPDX-License-Identifier: (MIT OR CECILL-C) Copyright (C) 2006-2023 INRIA and contributors diff --git a/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java b/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java index 456f7a907be..2932f08cf81 100644 --- a/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java +++ b/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java @@ -1,3 +1,10 @@ +/* + * SPDX-License-Identifier: (MIT OR CECILL-C) + * + * Copyright (C) 2006-2023 INRIA and contributors + * + * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. + */ /* SPDX-License-Identifier: (MIT OR CECILL-C) Copyright (C) 2006-2019 INRIA and contributors From abd67a53620c05aa3390604de6dfbc3f7cdb25e6 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Sun, 10 Mar 2024 15:04:53 +0100 Subject: [PATCH 03/51] Add receiver parameter visitation methods The commit introduces visitation methods specifically for receiver parameters in CloneVisitor, CloneBuilder, ReplacementVisitor, and CtBiScannerDefault classes. This facilitates the copying, replacing and bi-directional scanning of receiver parameters, enhancing functionality and code adaptability. --- .../spoon/reflect/visitor/CtBiScannerDefault.java | 12 +++++++++++- .../spoon/support/visitor/clone/CloneBuilder.java | 7 +++++++ .../spoon/support/visitor/clone/CloneVisitor.java | 12 ++++++++++++ .../support/visitor/replace/ReplacementVisitor.java | 8 ++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java b/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java index 8e75dbf1d2f..99520a2e078 100644 --- a/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java +++ b/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java @@ -1080,6 +1080,17 @@ public void visitCtRecordComponent(spoon.reflect.declaration.CtRecordComponent r exit(recordType); } + // autogenerated by CtBiScannerGenerator + @java.lang.Override + public void visitCtReceiverParameter(spoon.reflect.declaration.CtReceiverParameter receiverParameter) { + spoon.reflect.declaration.CtReceiverParameter other = ((spoon.reflect.declaration.CtReceiverParameter) (this.stack.peek())); + enter(receiverParameter); + biScan(spoon.reflect.path.CtRole.ANNOTATION, receiverParameter.getAnnotations(), other.getAnnotations()); + biScan(spoon.reflect.path.CtRole.TYPE, receiverParameter.getType(), other.getType()); + biScan(spoon.reflect.path.CtRole.COMMENT, receiverParameter.getComments(), other.getComments()); + exit(receiverParameter); + } + // autogenerated by CtBiScannerGenerator @java.lang.Override public void visitCtCasePattern(spoon.reflect.code.CtCasePattern casePattern) { @@ -1090,7 +1101,6 @@ public void visitCtCasePattern(spoon.reflect.code.CtCasePattern casePattern) { biScan(spoon.reflect.path.CtRole.PATTERN, casePattern.getPattern(), other.getPattern()); biScan(spoon.reflect.path.CtRole.CONDITION, casePattern.getGuard(), other.getGuard()); biScan(spoon.reflect.path.CtRole.TYPE, casePattern.getType(), other.getType()); - biScan(spoon.reflect.path.CtRole.COMMENT, casePattern.getComments(), other.getComments()); exit(casePattern); } diff --git a/src/main/java/spoon/support/visitor/clone/CloneBuilder.java b/src/main/java/spoon/support/visitor/clone/CloneBuilder.java index 851ed8c79de..6eac1e5589c 100644 --- a/src/main/java/spoon/support/visitor/clone/CloneBuilder.java +++ b/src/main/java/spoon/support/visitor/clone/CloneBuilder.java @@ -320,4 +320,11 @@ public void visitCtRecordComponent(spoon.reflect.declaration.CtRecordComponent r ((spoon.reflect.declaration.CtRecordComponent) (other)).setShadow(recordComponent.isShadow()); super.visitCtRecordComponent(recordComponent); } + + // auto-generated, see spoon.generating.CloneVisitorGenerator + @java.lang.Override + public void visitCtReceiverParameter(spoon.reflect.declaration.CtReceiverParameter e) { + ((spoon.reflect.declaration.CtReceiverParameter) (other)).setShadow(e.isShadow()); + super.visitCtReceiverParameter(e); + } } \ No newline at end of file diff --git a/src/main/java/spoon/support/visitor/clone/CloneVisitor.java b/src/main/java/spoon/support/visitor/clone/CloneVisitor.java index d79ddbee06f..049037edc05 100644 --- a/src/main/java/spoon/support/visitor/clone/CloneVisitor.java +++ b/src/main/java/spoon/support/visitor/clone/CloneVisitor.java @@ -1152,6 +1152,18 @@ public void visitCtRecordComponent(spoon.reflect.declaration.CtRecordComponent r this.other = aCtRecordComponent; } + // auto-generated, see spoon.generating.CloneVisitorGenerator + @java.lang.Override + public void visitCtReceiverParameter(spoon.reflect.declaration.CtReceiverParameter receiverParameter) { + spoon.reflect.declaration.CtReceiverParameter aCtReceiverParameter = receiverParameter.getFactory().Core().createReceiverParameter(); + this.builder.copy(receiverParameter, aCtReceiverParameter); + aCtReceiverParameter.setAnnotations(this.cloneHelper.clone(receiverParameter.getAnnotations())); + aCtReceiverParameter.setType(this.cloneHelper.clone(receiverParameter.getType())); + aCtReceiverParameter.setComments(this.cloneHelper.clone(receiverParameter.getComments())); + this.cloneHelper.tailor(receiverParameter, aCtReceiverParameter); + this.other = aCtReceiverParameter; + } + // auto-generated, see spoon.generating.CloneVisitorGenerator @java.lang.Override public void visitCtCasePattern(spoon.reflect.code.CtCasePattern casePattern) { diff --git a/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java b/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java index 2932f08cf81..56144eb09c7 100644 --- a/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java +++ b/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java @@ -2377,6 +2377,14 @@ public void visitCtRecordComponent(spoon.reflect.declaration.CtRecordComponent r replaceInListIfExist(recordType.getComments(), new spoon.support.visitor.replace.ReplacementVisitor.CtElementCommentsReplaceListener(recordType)); } + // auto-generated, see spoon.generating.ReplacementVisitorGenerator + @java.lang.Override + public void visitCtReceiverParameter(spoon.reflect.declaration.CtReceiverParameter receiverParameter) { + replaceInListIfExist(receiverParameter.getAnnotations(), new spoon.support.visitor.replace.ReplacementVisitor.CtElementAnnotationsReplaceListener(receiverParameter)); + replaceElementIfExist(receiverParameter.getType(), new spoon.support.visitor.replace.ReplacementVisitor.CtTypedElementTypeReplaceListener(receiverParameter)); + replaceInListIfExist(receiverParameter.getComments(), new spoon.support.visitor.replace.ReplacementVisitor.CtElementCommentsReplaceListener(receiverParameter)); + } + // auto-generated, see spoon.generating.ReplacementVisitorGenerator @java.lang.Override public void visitCtCasePattern(spoon.reflect.code.CtCasePattern casePattern) { From 3cdeccf06154847f65df09e406eb660586a4c7bb Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Sun, 10 Mar 2024 15:37:22 +0100 Subject: [PATCH 04/51] Update flake.lock file The lastModified and narHash values have been changed in the flake.lock file. Also, the revision ID in the nixpkgs node has been updated. --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index c48d8a7cf32..5879aa404db 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1707268954, - "narHash": "sha256-2en1kvde3cJVc3ZnTy8QeD2oKcseLFjYPLKhIGDanQ0=", + "lastModified": 1709961763, + "narHash": "sha256-6H95HGJHhEZtyYA3rIQpvamMKAGoa8Yh2rFV29QnuGw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f8e2ebd66d097614d51a56a755450d4ae1632df1", + "rev": "3030f185ba6a4bf4f18b87f345f104e6a6961f34", "type": "github" }, "original": { From 54dd707ae817d3ed52b4a04bc037863b9b5b17b3 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Sun, 10 Mar 2024 17:06:31 +0100 Subject: [PATCH 05/51] Implement CtReceiverParameter methods and add to DefaultCoreFactory Implemented various methods such as 'setDefaultExpression', 'accept', 'getReference', and 'clone' for the CtReceiverParameter class in CtReceiverParameterImpl.java. The '@UnsettableProperty' annotation was added and 'visitCtReceiverParameter' was implemented. Moreover, created an instance of the CtReceiverParameter class through the 'createReceiverParameter' method in DefaultCoreFactory.java. --- src/main/java/spoon/support/DefaultCoreFactory.java | 3 +++ .../reflect/declaration/CtReceiverParameterImpl.java | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/spoon/support/DefaultCoreFactory.java b/src/main/java/spoon/support/DefaultCoreFactory.java index 26b9eaf2362..9107b174528 100644 --- a/src/main/java/spoon/support/DefaultCoreFactory.java +++ b/src/main/java/spoon/support/DefaultCoreFactory.java @@ -1123,6 +1123,9 @@ public CtElement create(Class klass) { if (klass.equals(spoon.reflect.code.CtRecordPattern.class)) { return createRecordPattern(); } + if(klass.equals(spoon.reflect.declaration.CtReceiverParameter.class)) { + return createReceiverParameter(); + } throw new IllegalArgumentException("not instantiable by CoreFactory(): " + klass); } diff --git a/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java b/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java index f76d33e4543..8af568b228c 100644 --- a/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java +++ b/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java @@ -19,6 +19,7 @@ import spoon.reflect.reference.CtTypeReference; import spoon.reflect.reference.CtVariableReference; import spoon.reflect.visitor.CtVisitor; +import spoon.support.UnsettableProperty; import spoon.support.reflect.CtExtendedModifier; import spoon.support.reflect.CtModifierHandler; @@ -32,6 +33,7 @@ public class CtReceiverParameterImpl extends CtNamedElementImpl implements CtRec private final CtModifierHandler modifierHandler = new CtModifierHandler(this); @MetamodelPropertyField(role = CtRole.IS_SHADOW) boolean isShadow; + @Override public Set getModifiers() { return modifierHandler.getModifiers(); @@ -137,6 +139,7 @@ public CtExpression getDefaultExpression() { } @Override + @UnsettableProperty public > C setDefaultExpression(CtExpression assignedExpression) { return (C) this; } @@ -180,13 +183,17 @@ public C setType(CtTypeReference type) { @Override public void accept(CtVisitor visitor) { - //TODO: implement + visitor.visitCtReceiverParameter(this); } @Override public CtVariableReference getReference() { - //TODO: implement return null; } + + @Override + public CtReceiverParameter clone() { + return (CtReceiverParameter) super.clone(); + } } From 15a041b9c6550b435511fb2630afed1645b53bf9 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Sun, 10 Mar 2024 17:22:14 +0100 Subject: [PATCH 06/51] lets try to not have a CtNamedElement --- .../declaration/CtReceiverParameter.java | 18 +-- .../reflect/visitor/CtInheritanceScanner.java | 3 - .../visitor/DefaultJavaPrettyPrinter.java | 4 +- .../compiler/jdt/JDTTreeBuilderHelper.java | 2 - .../declaration/CtReceiverParameterImpl.java | 141 +----------------- .../visitor/replace/ReplacementVisitor.java | 23 ++- .../ReceiverParameterTest.java | 1 - 7 files changed, 21 insertions(+), 171 deletions(-) diff --git a/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java b/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java index 666cec18244..2f0b0f77adb 100644 --- a/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java +++ b/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java @@ -8,24 +8,14 @@ package spoon.reflect.declaration; -import spoon.reflect.code.CtExpression; -import spoon.support.UnsettableProperty; -import spoon.support.reflect.CtExtendedModifier; +import spoon.reflect.reference.CtTypeReference; -import java.util.Set; - -public interface CtReceiverParameter extends CtVariable, CtShadowable { +public interface CtReceiverParameter extends CtTypedElement, CtShadowable, CtElement { @Override - @UnsettableProperty - > C setDefaultExpression(CtExpression assignedExpression); + CtTypeReference getType(); @Override - @UnsettableProperty - C setExtendedModifiers(Set extendedModifiers); - + CtReceiverParameter clone(); - @Override - @UnsettableProperty - T setSimpleName(String simpleName); } diff --git a/src/main/java/spoon/reflect/visitor/CtInheritanceScanner.java b/src/main/java/spoon/reflect/visitor/CtInheritanceScanner.java index 0e952630ece..764aa0e3697 100644 --- a/src/main/java/spoon/reflect/visitor/CtInheritanceScanner.java +++ b/src/main/java/spoon/reflect/visitor/CtInheritanceScanner.java @@ -1126,9 +1126,6 @@ public void visitCtRecordPattern(CtRecordPattern pattern) { @Override public void visitCtReceiverParameter(CtReceiverParameter e) { - scanCtNamedElement(e); - scanCtVariable(e); - scanCtModifiable(e); scanCtTypedElement(e); scanCtElement(e); scanCtVisitable(e); diff --git a/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java b/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java index 3d10ee96c63..3cd8d22ba86 100644 --- a/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java +++ b/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java @@ -2365,9 +2365,7 @@ public void visitCtRecordPattern(CtRecordPattern recordPattern) { public void visitCtReceiverParameter(CtReceiverParameter receiverParameter) { elementPrinterHelper.writeComment(receiverParameter); elementPrinterHelper.writeAnnotations(receiverParameter); - elementPrinterHelper.writeModifiers(receiverParameter); - scan(receiverParameter.getType()); // after an implicit type, there is no space because we dont print anything - printer.writeIdentifier(receiverParameter.getSimpleName()); + printer.writeIdentifier("this"); } } diff --git a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilderHelper.java b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilderHelper.java index bd3d1a411cc..bd9f52999be 100644 --- a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilderHelper.java +++ b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilderHelper.java @@ -762,8 +762,6 @@ CtParameter createParameter(Argument argument) { */ CtReceiverParameter createReceiverParameter(Argument argument) { CtReceiverParameter p = jdtTreeBuilder.getFactory().Core().createReceiverParameter(); - p.setSimpleName("this"); - p.setExtendedModifiers(getModifiers(argument.modifiers, false, ModifierTarget.PARAMETER)); if (argument.binding != null && argument.binding.type != null && argument.type == null) { p.setType(jdtTreeBuilder.getReferencesBuilder().getTypeReference(argument.binding.type)); p.getType().setImplicit(argument.type == null); diff --git a/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java b/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java index 8af568b228c..1fb27d055e2 100644 --- a/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java +++ b/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java @@ -8,153 +8,20 @@ package spoon.support.reflect.declaration; import spoon.reflect.annotations.MetamodelPropertyField; -import spoon.reflect.code.CtExpression; -import spoon.reflect.declaration.CtModifiable; import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtShadowable; import spoon.reflect.declaration.CtTypedElement; -import spoon.reflect.declaration.CtVariable; -import spoon.reflect.declaration.ModifierKind; import spoon.reflect.path.CtRole; import spoon.reflect.reference.CtTypeReference; -import spoon.reflect.reference.CtVariableReference; import spoon.reflect.visitor.CtVisitor; -import spoon.support.UnsettableProperty; -import spoon.support.reflect.CtExtendedModifier; -import spoon.support.reflect.CtModifierHandler; -import java.util.Set; - -public class CtReceiverParameterImpl extends CtNamedElementImpl implements CtReceiverParameter { +public class CtReceiverParameterImpl extends CtElementImpl implements CtReceiverParameter { @MetamodelPropertyField(role = CtRole.TYPE) private CtTypeReference type; - @MetamodelPropertyField(role = CtRole.MODIFIER) - private final CtModifierHandler modifierHandler = new CtModifierHandler(this); @MetamodelPropertyField(role = CtRole.IS_SHADOW) boolean isShadow; - @Override - public Set getModifiers() { - return modifierHandler.getModifiers(); - } - - @Override - public boolean hasModifier(ModifierKind modifier) { - return modifierHandler.hasModifier(modifier); - } - - @Override - public C setModifiers(Set modifiers) { - modifierHandler.setModifiers(modifiers); - return (C) this; - } - - @Override - public C addModifier(ModifierKind modifier) { - modifierHandler.addModifier(modifier); - return (C) this; - } - - @Override - public C removeModifier(ModifierKind modifier) { - modifierHandler.removeModifier(modifier); - return (C) this; - } - - @Override - public C setVisibility(ModifierKind visibility) { - // CtReceiverParameter has no visibility - return (C) this; - } - - @Override - public ModifierKind getVisibility() { - return null; - } - - @Override - public Set getExtendedModifiers() { - return null; - } - - @Override - public boolean isPublic() { - return false; - } - - @Override - public boolean isFinal() { - return modifierHandler.isFinal(); - } - - @Override - public boolean isStatic() { - return false; - } - - @Override - public boolean isProtected() { - return false; - } - - @Override - public boolean isPrivate() { - return false; - } - - @Override - public boolean isAbstract() { - return false; - } - - @Override - public boolean isTransient() { - return false; - } - - @Override - public boolean isVolatile() { - return false; - } - - @Override - public boolean isSynchronized() { - return false; - } - - @Override - public boolean isNative() { - return false; - } - - @Override - public boolean isStrictfp() { - return false; - } - - @Override - public CtExpression getDefaultExpression() { - return null; - } - - @Override - @UnsettableProperty - public > C setDefaultExpression(CtExpression assignedExpression) { - return (C) this; - } - - @Override - public boolean isPartOfJointDeclaration() { - return false; - } - - @Override - public T setExtendedModifiers(Set extendedModifiers) { - this.modifierHandler.setExtendedModifiers(extendedModifiers); - return (T) this; - } - public boolean isShadow() { return isShadow; } @@ -186,12 +53,6 @@ public void accept(CtVisitor visitor) { visitor.visitCtReceiverParameter(this); } - @Override - public CtVariableReference getReference() { - //TODO: implement - return null; - } - @Override public CtReceiverParameter clone() { return (CtReceiverParameter) super.clone(); diff --git a/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java b/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java index 56144eb09c7..ce7d34e8702 100644 --- a/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java +++ b/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java @@ -1,10 +1,3 @@ -/* - * SPDX-License-Identifier: (MIT OR CECILL-C) - * - * Copyright (C) 2006-2023 INRIA and contributors - * - * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. - */ /* SPDX-License-Identifier: (MIT OR CECILL-C) Copyright (C) 2006-2019 INRIA and contributors @@ -74,6 +67,20 @@ public void set(spoon.reflect.code.CtPattern replace) { } } + // auto-generated, see spoon.generating.ReplacementVisitorGenerator + static class CtReceiverParameterTypeReplaceListener implements spoon.support.visitor.replace.ReplaceListener { + private final spoon.reflect.declaration.CtTypedElement element; + + CtReceiverParameterTypeReplaceListener(spoon.reflect.declaration.CtTypedElement element) { + this.element = element; + } + + @java.lang.Override + public void set(spoon.reflect.reference.CtTypeReference replace) { + this.element.setType(replace); + } + } + // auto-generated, see spoon.generating.ReplacementVisitorGenerator static class CtRecordRecordComponentsReplaceListener implements spoon.support.visitor.replace.ReplaceSetListener { private final spoon.reflect.declaration.CtRecord element; @@ -2381,7 +2388,7 @@ public void visitCtRecordComponent(spoon.reflect.declaration.CtRecordComponent r @java.lang.Override public void visitCtReceiverParameter(spoon.reflect.declaration.CtReceiverParameter receiverParameter) { replaceInListIfExist(receiverParameter.getAnnotations(), new spoon.support.visitor.replace.ReplacementVisitor.CtElementAnnotationsReplaceListener(receiverParameter)); - replaceElementIfExist(receiverParameter.getType(), new spoon.support.visitor.replace.ReplacementVisitor.CtTypedElementTypeReplaceListener(receiverParameter)); + replaceElementIfExist(receiverParameter.getType(), new spoon.support.visitor.replace.ReplacementVisitor.CtReceiverParameterTypeReplaceListener(receiverParameter)); replaceInListIfExist(receiverParameter.getComments(), new spoon.support.visitor.replace.ReplacementVisitor.CtElementCommentsReplaceListener(receiverParameter)); } diff --git a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java index 597c6a4578c..4eded9c7f40 100644 --- a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java +++ b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java @@ -21,7 +21,6 @@ void simpleParameter(CtModel model) { List receiverParams = targetType.getElements(new TypeFilter<>(CtReceiverParameter.class)); assertEquals(1, receiverParams.size()); CtReceiverParameter next1 = receiverParams.iterator().next(); - assertEquals("this", next1.getSimpleName()); assertEquals("spoon.test.receiverparameter.SimpleReceiverParameter", next1.getType().getQualifiedName()); System.out.println(targetType); } From ac008043798e5b512c674363c48425e676ebeb52 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Sun, 10 Mar 2024 21:24:51 +0100 Subject: [PATCH 07/51] Refactor ReceiverParameter setting and scanning This commit refactors the process of setting ReceiverParameter in the JDTTreeBuilderHelper. It removes redundant condition checks while setting the type of the argument. The commit also introduces the scanning of ReceiverParameter in the CtConstructor and CtScanner classes. Additionally, unnecessary assertion and createReceiverParameter method in the ExecutableFactory class have been removed to further refine the code. --- src/main/java/spoon/reflect/factory/ExecutableFactory.java | 7 ------- src/main/java/spoon/reflect/visitor/CtScanner.java | 2 ++ .../spoon/support/compiler/jdt/JDTTreeBuilderHelper.java | 5 ++--- .../support/reflect/declaration/CtExecutableImpl.java | 4 ++++ .../test/receiverparameter/ReceiverParameterTest.java | 3 +-- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/main/java/spoon/reflect/factory/ExecutableFactory.java b/src/main/java/spoon/reflect/factory/ExecutableFactory.java index afea952f60a..b0fdf74bc56 100644 --- a/src/main/java/spoon/reflect/factory/ExecutableFactory.java +++ b/src/main/java/spoon/reflect/factory/ExecutableFactory.java @@ -15,7 +15,6 @@ import spoon.reflect.declaration.CtExecutable; import spoon.reflect.declaration.CtMethod; import spoon.reflect.declaration.CtParameter; -import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtType; import spoon.reflect.declaration.ModifierKind; import spoon.reflect.reference.CtArrayTypeReference; @@ -243,10 +242,4 @@ public CtExecutableReference createReference(String signature) { executableRef.setParameters(params); return executableRef; } - - public CtReceiverParameter createReceiverParameter(CtTypeReference type) { - CtReceiverParameter receiverParameter = factory.Core().createReceiverParameter(); - receiverParameter.setType(type); - return receiverParameter; - } } diff --git a/src/main/java/spoon/reflect/visitor/CtScanner.java b/src/main/java/spoon/reflect/visitor/CtScanner.java index 1d3ef839905..be5546334ee 100644 --- a/src/main/java/spoon/reflect/visitor/CtScanner.java +++ b/src/main/java/spoon/reflect/visitor/CtScanner.java @@ -388,6 +388,7 @@ public void visitCtConditional(final CtConditional conditional) { public void visitCtConstructor(final CtConstructor c) { enter(c); scan(CtRole.ANNOTATION, c.getAnnotations()); + scan(CtRole.RECEIVER_PARAMETER, c.getReceiverParameter()); scan(CtRole.PARAMETER, c.getParameters()); scan(CtRole.THROWN, c.getThrownTypes()); scan(CtRole.TYPE_PARAMETER, c.getFormalCtTypeParameters()); @@ -588,6 +589,7 @@ public void visitCtMethod(final CtMethod m) { scan(CtRole.ANNOTATION, m.getAnnotations()); scan(CtRole.TYPE_PARAMETER, m.getFormalCtTypeParameters()); scan(CtRole.TYPE, m.getType()); + scan(CtRole.RECEIVER_PARAMETER, m.getReceiverParameter()); scan(CtRole.PARAMETER, m.getParameters()); scan(CtRole.THROWN, m.getThrownTypes()); scan(CtRole.BODY, m.getBody()); diff --git a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilderHelper.java b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilderHelper.java index bd9f52999be..3a8b3ccb4d7 100644 --- a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilderHelper.java +++ b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilderHelper.java @@ -762,9 +762,8 @@ CtParameter createParameter(Argument argument) { */ CtReceiverParameter createReceiverParameter(Argument argument) { CtReceiverParameter p = jdtTreeBuilder.getFactory().Core().createReceiverParameter(); - if (argument.binding != null && argument.binding.type != null && argument.type == null) { - p.setType(jdtTreeBuilder.getReferencesBuilder().getTypeReference(argument.binding.type)); - p.getType().setImplicit(argument.type == null); + if (argument.type != null) { + p.setType(jdtTreeBuilder.getReferencesBuilder().getTypeReference(argument.type)); } return p; } diff --git a/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java b/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java index ec77d48e129..8be6fd039b3 100644 --- a/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java +++ b/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java @@ -198,7 +198,11 @@ public CtExecutable clone() { } public CtExecutable setReceiverParameter(CtReceiverParameter receiverParameter) { + if(receiverParameter == null) { + return this; + } getFactory().getEnvironment().getModelChangeListener().onObjectUpdate(this, CtRole.RECEIVER_PARAMETER, receiverParameter, this.receiverParameter); + receiverParameter.setParent(this); this.receiverParameter = receiverParameter; return this; } diff --git a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java index 4eded9c7f40..b0c868a89a2 100644 --- a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java +++ b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java @@ -21,7 +21,6 @@ void simpleParameter(CtModel model) { List receiverParams = targetType.getElements(new TypeFilter<>(CtReceiverParameter.class)); assertEquals(1, receiverParams.size()); CtReceiverParameter next1 = receiverParams.iterator().next(); - assertEquals("spoon.test.receiverparameter.SimpleReceiverParameter", next1.getType().getQualifiedName()); - System.out.println(targetType); + assertEquals("receiver.SimpleReceiverParameter", next1.getType().getQualifiedName()); } } From 1c6dce8343cb35ed385a1c9d1af8ee014c97b27d Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Sun, 10 Mar 2024 22:32:49 +0100 Subject: [PATCH 08/51] Update ReceiverParameter handling and tests Improved ReceiverParameter handling with updates in setting and scanning procedures. Refinements made include removal of unnecessary condition checks when setting argument types and the enhancement of ReceiverParameter scanning operations within CtConstructor and CtScanner classes. Redundant assertion and the createReceiverParameter method from the ExecutableFactory class have been removed. New tests were also added for the enhanced features. --- .../reflect/meta/impl/ModelRoleHandlers.java | 6 +++--- .../reflect/visitor/CtBiScannerDefault.java | 19 ++++++++++++++---- .../visitor/DefaultJavaPrettyPrinter.java | 20 ++++++++++++++++++- .../reflect/visitor/ElementPrinterHelper.java | 10 +++++++--- .../support/compiler/jdt/JDTTreeBuilder.java | 19 ++++++++---------- .../compiler/jdt/JDTTreeBuilderHelper.java | 3 ++- .../support/visitor/clone/CloneBuilder.java | 7 ------- .../support/visitor/clone/CloneVisitor.java | 9 ++------- .../visitor/replace/ReplacementVisitor.java | 16 +++++++++++++++ .../ReceiverParameterTest.java | 18 ++++++++++++++++- .../resources/receiver/InnerClassCtor.java | 8 ++++++++ .../receiver/SimpleReceiverParameter.java | 2 +- 12 files changed, 98 insertions(+), 39 deletions(-) create mode 100644 src/test/resources/receiver/InnerClassCtor.java diff --git a/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java b/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java index 61d9e7ae1c0..9ce21f79591 100644 --- a/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java +++ b/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java @@ -1,9 +1,9 @@ -/* +/** * SPDX-License-Identifier: (MIT OR CECILL-C) * - * Copyright (C) 2006-2023 INRIA and contributors + * Copyright (C) 2006-2019 INRIA and contributors * - * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. + * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) of the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. */ package spoon.reflect.meta.impl; import java.lang.annotation.Annotation; diff --git a/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java b/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java index 99520a2e078..1370d12f554 100644 --- a/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java +++ b/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java @@ -1,9 +1,18 @@ -/* - * SPDX-License-Identifier: (MIT OR CECILL-C) +/** + * Copyright (C) 2006-2018 INRIA and contributors + * Spoon - http://spoon.gforge.inria.fr/ + * + * This software is governed by the CeCILL-C License under French law and + * abiding by the rules of distribution of free software. You can use, modify + * and/or redistribute the software under the terms of the CeCILL-C license as + * circulated by CEA, CNRS and INRIA at http://www.cecill.info. * - * Copyright (C) 2006-2023 INRIA and contributors + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL-C License for more details. * - * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL-C license and that you accept its terms. */ package spoon.reflect.visitor; /** @@ -242,6 +251,7 @@ public void visitCtConstructor(final spoon.reflect.declaration.CtConstructor spoon.reflect.declaration.CtConstructor other = ((spoon.reflect.declaration.CtConstructor) (this.stack.peek())); enter(c); biScan(spoon.reflect.path.CtRole.ANNOTATION, c.getAnnotations(), other.getAnnotations()); + biScan(spoon.reflect.path.CtRole.RECEIVER_PARAMETER, c.getReceiverParameter(), other.getReceiverParameter()); biScan(spoon.reflect.path.CtRole.PARAMETER, c.getParameters(), other.getParameters()); biScan(spoon.reflect.path.CtRole.THROWN, c.getThrownTypes(), other.getThrownTypes()); biScan(spoon.reflect.path.CtRole.TYPE_PARAMETER, c.getFormalCtTypeParameters(), other.getFormalCtTypeParameters()); @@ -484,6 +494,7 @@ public void visitCtMethod(final spoon.reflect.declaration.CtMethod m) { biScan(spoon.reflect.path.CtRole.ANNOTATION, m.getAnnotations(), other.getAnnotations()); biScan(spoon.reflect.path.CtRole.TYPE_PARAMETER, m.getFormalCtTypeParameters(), other.getFormalCtTypeParameters()); biScan(spoon.reflect.path.CtRole.TYPE, m.getType(), other.getType()); + biScan(spoon.reflect.path.CtRole.RECEIVER_PARAMETER, m.getReceiverParameter(), other.getReceiverParameter()); biScan(spoon.reflect.path.CtRole.PARAMETER, m.getParameters(), other.getParameters()); biScan(spoon.reflect.path.CtRole.THROWN, m.getThrownTypes(), other.getThrownTypes()); biScan(spoon.reflect.path.CtRole.BODY, m.getBody(), other.getBody()); diff --git a/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java b/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java index 3cd8d22ba86..5e3b7683481 100644 --- a/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java +++ b/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java @@ -2365,7 +2365,25 @@ public void visitCtRecordPattern(CtRecordPattern recordPattern) { public void visitCtReceiverParameter(CtReceiverParameter receiverParameter) { elementPrinterHelper.writeComment(receiverParameter); elementPrinterHelper.writeAnnotations(receiverParameter); + + printer.writeIdentifier(receiverParameter.getType().getSimpleName()); + printer.writeSpace(); + boolean isInnerClass = receiverParameter.getType().getTopLevelType().equals(receiverParameter.getParent(CtType.class)); + boolean isConstructor = receiverParameter.getParent() instanceof CtConstructor; // after an implicit type, there is no space because we dont print anything - printer.writeIdentifier("this"); + if (isConstructor && isInnerClass) { + // inside a ctor of an inner class, the identifier is $SimpleName.this + printer.writeSeparator(receiverParameter.getType().getSimpleName() + ".this"); + } else { + printer.writeSeparator("this"); + } + } + + class Foo { + class Bar { + public Bar(Foo Foo.this) { + + } + } } } diff --git a/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java b/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java index 04836a64787..60fa0ac373f 100644 --- a/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java +++ b/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java @@ -147,10 +147,14 @@ public void writeImplementsClause(CtType type) { } public void writeExecutableParameters(CtExecutable executable) { - //TODO: printing - printList(executable.getParameters(), null, + List parameters = new ArrayList<>(); + if(executable.getReceiverParameter()!= null) { + parameters.add(executable.getReceiverParameter()); + } + parameters.addAll(executable.getParameters()); + printList(parameters, null, false, "(", false, false, ",", true, false, ")", - p -> prettyPrinter.scan(p)); + prettyPrinter::scan); } /** writes the thrown exception with a ListPrinter */ diff --git a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java index 5fd3d84d825..934c3539b08 100644 --- a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java +++ b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java @@ -7,15 +7,6 @@ */ package spoon.support.compiler.jdt; -import java.util.Set; - -import org.eclipse.jdt.internal.compiler.ast.Expression; -import org.eclipse.jdt.internal.compiler.ast.FakeDefaultLiteral; -import org.eclipse.jdt.internal.compiler.ast.GuardedPattern; -import org.eclipse.jdt.internal.compiler.ast.RecordPattern; -import org.eclipse.jdt.internal.compiler.ast.TypePattern; -import org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding; -import org.slf4j.Logger; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.ast.AND_AND_Expression; @@ -48,13 +39,16 @@ import org.eclipse.jdt.internal.compiler.ast.DoubleLiteral; import org.eclipse.jdt.internal.compiler.ast.EqualExpression; import org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall; +import org.eclipse.jdt.internal.compiler.ast.Expression; import org.eclipse.jdt.internal.compiler.ast.ExtendedStringLiteral; +import org.eclipse.jdt.internal.compiler.ast.FakeDefaultLiteral; import org.eclipse.jdt.internal.compiler.ast.FalseLiteral; import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; import org.eclipse.jdt.internal.compiler.ast.FieldReference; import org.eclipse.jdt.internal.compiler.ast.FloatLiteral; import org.eclipse.jdt.internal.compiler.ast.ForStatement; import org.eclipse.jdt.internal.compiler.ast.ForeachStatement; +import org.eclipse.jdt.internal.compiler.ast.GuardedPattern; import org.eclipse.jdt.internal.compiler.ast.IfStatement; import org.eclipse.jdt.internal.compiler.ast.ImportReference; import org.eclipse.jdt.internal.compiler.ast.Initializer; @@ -86,6 +80,7 @@ import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; import org.eclipse.jdt.internal.compiler.ast.Receiver; import org.eclipse.jdt.internal.compiler.ast.RecordComponent; +import org.eclipse.jdt.internal.compiler.ast.RecordPattern; import org.eclipse.jdt.internal.compiler.ast.ReferenceExpression; import org.eclipse.jdt.internal.compiler.ast.ReturnStatement; import org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation; @@ -104,6 +99,7 @@ import org.eclipse.jdt.internal.compiler.ast.TryStatement; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.ast.TypeParameter; +import org.eclipse.jdt.internal.compiler.ast.TypePattern; import org.eclipse.jdt.internal.compiler.ast.TypeReference; import org.eclipse.jdt.internal.compiler.ast.UnaryExpression; import org.eclipse.jdt.internal.compiler.ast.UnionTypeReference; @@ -963,9 +959,10 @@ public boolean visit(Argument argument, BlockScope scope) { } boolean isVar = argument.type != null && argument.type.isTypeNameVar(scope); boolean isReceiver = CharOperation.charToString(argument.name).equals("this"); + ; // we can also use an instanceof Receiver here - if (isReceiver) { - CtReceiverParameter receiverParameter = helper.createReceiverParameter(argument); + if (argument instanceof Receiver receiver) { + CtReceiverParameter receiverParameter = helper.createReceiverParameter(receiver); context.enter(receiverParameter, argument); return true; } diff --git a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilderHelper.java b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilderHelper.java index 3a8b3ccb4d7..2b30362a270 100644 --- a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilderHelper.java +++ b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilderHelper.java @@ -20,6 +20,7 @@ import org.eclipse.jdt.internal.compiler.ast.ProvidesStatement; import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; +import org.eclipse.jdt.internal.compiler.ast.Receiver; import org.eclipse.jdt.internal.compiler.ast.ReferenceExpression; import org.eclipse.jdt.internal.compiler.ast.RequiresStatement; import org.eclipse.jdt.internal.compiler.ast.SingleNameReference; @@ -760,7 +761,7 @@ CtParameter createParameter(Argument argument) { * @param argument the argument containing information about the parameter * @return the created CtReceiverParameter object */ - CtReceiverParameter createReceiverParameter(Argument argument) { + CtReceiverParameter createReceiverParameter(Receiver argument) { CtReceiverParameter p = jdtTreeBuilder.getFactory().Core().createReceiverParameter(); if (argument.type != null) { p.setType(jdtTreeBuilder.getReferencesBuilder().getTypeReference(argument.type)); diff --git a/src/main/java/spoon/support/visitor/clone/CloneBuilder.java b/src/main/java/spoon/support/visitor/clone/CloneBuilder.java index 6eac1e5589c..a1b2d260f64 100644 --- a/src/main/java/spoon/support/visitor/clone/CloneBuilder.java +++ b/src/main/java/spoon/support/visitor/clone/CloneBuilder.java @@ -1,10 +1,3 @@ -/* - * SPDX-License-Identifier: (MIT OR CECILL-C) - * - * Copyright (C) 2006-2023 INRIA and contributors - * - * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. - */ /* SPDX-License-Identifier: (MIT OR CECILL-C) Copyright (C) 2006-2023 INRIA and contributors diff --git a/src/main/java/spoon/support/visitor/clone/CloneVisitor.java b/src/main/java/spoon/support/visitor/clone/CloneVisitor.java index 049037edc05..23ae13a86d9 100644 --- a/src/main/java/spoon/support/visitor/clone/CloneVisitor.java +++ b/src/main/java/spoon/support/visitor/clone/CloneVisitor.java @@ -1,10 +1,3 @@ -/* - * SPDX-License-Identifier: (MIT OR CECILL-C) - * - * Copyright (C) 2006-2023 INRIA and contributors - * - * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. - */ /* SPDX-License-Identifier: (MIT OR CECILL-C) Copyright (C) 2006-2023 INRIA and contributors @@ -242,6 +235,7 @@ public void visitCtConstructor(final spoon.reflect.declaration.CtConstructor spoon.reflect.declaration.CtConstructor aCtConstructor = c.getFactory().Core().createConstructor(); this.builder.copy(c, aCtConstructor); aCtConstructor.setAnnotations(this.cloneHelper.clone(c.getAnnotations())); + aCtConstructor.setReceiverParameter(this.cloneHelper.clone(c.getReceiverParameter())); aCtConstructor.setParameters(this.cloneHelper.clone(c.getParameters())); aCtConstructor.setThrownTypes(this.cloneHelper.clone(c.getThrownTypes())); aCtConstructor.setFormalCtTypeParameters(this.cloneHelper.clone(c.getFormalCtTypeParameters())); @@ -505,6 +499,7 @@ public void visitCtMethod(final spoon.reflect.declaration.CtMethod m) { aCtMethod.setAnnotations(this.cloneHelper.clone(m.getAnnotations())); aCtMethod.setFormalCtTypeParameters(this.cloneHelper.clone(m.getFormalCtTypeParameters())); aCtMethod.setType(this.cloneHelper.clone(m.getType())); + aCtMethod.setReceiverParameter(this.cloneHelper.clone(m.getReceiverParameter())); aCtMethod.setParameters(this.cloneHelper.clone(m.getParameters())); aCtMethod.setThrownTypes(this.cloneHelper.clone(m.getThrownTypes())); aCtMethod.setBody(this.cloneHelper.clone(m.getBody())); diff --git a/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java b/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java index ce7d34e8702..1d5c7f6da8f 100644 --- a/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java +++ b/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java @@ -1019,6 +1019,20 @@ public void set(java.util.List replace) { } } + // auto-generated, see spoon.generating.ReplacementVisitorGenerator + static class CtExecutableReceiverParameterReplaceListener implements spoon.support.visitor.replace.ReplaceListener { + private final spoon.reflect.declaration.CtExecutable element; + + CtExecutableReceiverParameterReplaceListener(spoon.reflect.declaration.CtExecutable element) { + this.element = element; + } + + @java.lang.Override + public void set(spoon.reflect.declaration.CtReceiverParameter replace) { + this.element.setReceiverParameter(replace); + } + } + // auto-generated, see spoon.generating.ReplacementVisitorGenerator static class CtConditionalElseExpressionReplaceListener implements spoon.support.visitor.replace.ReplaceListener { private final spoon.reflect.code.CtConditional element; @@ -1724,6 +1738,7 @@ public void visitCtConditional(final spoon.reflect.code.CtConditional con @java.lang.Override public void visitCtConstructor(final spoon.reflect.declaration.CtConstructor c) { replaceInListIfExist(c.getAnnotations(), new spoon.support.visitor.replace.ReplacementVisitor.CtElementAnnotationsReplaceListener(c)); + replaceElementIfExist(c.getReceiverParameter(), new spoon.support.visitor.replace.ReplacementVisitor.CtExecutableReceiverParameterReplaceListener(c)); replaceInListIfExist(c.getParameters(), new spoon.support.visitor.replace.ReplacementVisitor.CtExecutableParametersReplaceListener(c)); replaceInSetIfExist(c.getThrownTypes(), new spoon.support.visitor.replace.ReplacementVisitor.CtExecutableThrownTypesReplaceListener(c)); replaceInListIfExist(c.getFormalCtTypeParameters(), new spoon.support.visitor.replace.ReplacementVisitor.CtFormalTypeDeclarerFormalCtTypeParametersReplaceListener(c)); @@ -1922,6 +1937,7 @@ public void visitCtMethod(final spoon.reflect.declaration.CtMethod m) { replaceInListIfExist(m.getAnnotations(), new spoon.support.visitor.replace.ReplacementVisitor.CtElementAnnotationsReplaceListener(m)); replaceInListIfExist(m.getFormalCtTypeParameters(), new spoon.support.visitor.replace.ReplacementVisitor.CtFormalTypeDeclarerFormalCtTypeParametersReplaceListener(m)); replaceElementIfExist(m.getType(), new spoon.support.visitor.replace.ReplacementVisitor.CtTypedElementTypeReplaceListener(m)); + replaceElementIfExist(m.getReceiverParameter(), new spoon.support.visitor.replace.ReplacementVisitor.CtExecutableReceiverParameterReplaceListener(m)); replaceInListIfExist(m.getParameters(), new spoon.support.visitor.replace.ReplacementVisitor.CtExecutableParametersReplaceListener(m)); replaceInSetIfExist(m.getThrownTypes(), new spoon.support.visitor.replace.ReplacementVisitor.CtExecutableThrownTypesReplaceListener(m)); replaceElementIfExist(m.getBody(), new spoon.support.visitor.replace.ReplacementVisitor.CtExecutableBodyReplaceListener(m)); diff --git a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java index b0c868a89a2..08b3cb36b27 100644 --- a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java +++ b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java @@ -1,6 +1,7 @@ package spoon.test.receiverparameter; import spoon.reflect.CtModel; +import spoon.reflect.declaration.CtMethod; import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtType; import spoon.reflect.visitor.filter.TypeFilter; @@ -17,10 +18,25 @@ public class ReceiverParameterTest { ) void simpleParameter(CtModel model) { CtType targetType = model.getAllTypes().iterator().next(); - targetType.getMethods().forEach(System.out::println); List receiverParams = targetType.getElements(new TypeFilter<>(CtReceiverParameter.class)); assertEquals(1, receiverParams.size()); CtReceiverParameter next1 = receiverParams.iterator().next(); assertEquals("receiver.SimpleReceiverParameter", next1.getType().getQualifiedName()); + // TODO: toString + } + + + @ModelTest( + value = "src/test/resources/receiver/InnerClassCtor.java" + ) + void innerClassCtor(CtModel model) { + CtType targetType = model.getAllTypes().iterator().next(); + List receiverParams = targetType.getElements(new TypeFilter<>(CtReceiverParameter.class)); + assertEquals(1, receiverParams.size()); + CtReceiverParameter next1 = receiverParams.iterator().next(); + assertEquals("receiver.SimpleReceiverParameter", next1.getType().getQualifiedName()); + CtMethod ctMethod = targetType.getMethods().stream().filter(v -> v.getReceiverParameter() != null).findFirst().get(); + System.out.println(ctMethod.toString()); + //TODO fix name } } diff --git a/src/test/resources/receiver/InnerClassCtor.java b/src/test/resources/receiver/InnerClassCtor.java new file mode 100644 index 00000000000..e3d99c3051b --- /dev/null +++ b/src/test/resources/receiver/InnerClassCtor.java @@ -0,0 +1,8 @@ +package receiver; +public class Outer { + class Inner { + public Bar(Outer Outer.this) { + + } + } +} \ No newline at end of file diff --git a/src/test/resources/receiver/SimpleReceiverParameter.java b/src/test/resources/receiver/SimpleReceiverParameter.java index 45ffa593d7b..01ebfa15f59 100644 --- a/src/test/resources/receiver/SimpleReceiverParameter.java +++ b/src/test/resources/receiver/SimpleReceiverParameter.java @@ -1,4 +1,4 @@ -package receiver +package receiver; class SimpleReceiverParameter { From 9b1c37cfc3f803219fc2ea237959b0994c5926c8 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 25 Mar 2024 21:29:05 +0100 Subject: [PATCH 09/51] Add CtCasePattern, CtReceiverParameter and CtRecordPattern assert classes This update adds new assert classes, specifically CtCasePattern, CtReceiverParameter, and CtRecordPattern. This allows for more explicit testing and assertions when working with these specific elements. Modifications are also made to improve ReceiverParameter handling in scanning procedures. Moreover, unnecessary checks are removed in setting argument types in the CtConstructor class. New tests are provided to verify the functionality of these changes. --- .../reflect/declaration/CtExecutable.java | 3 +++ .../support/compiler/jdt/JDTTreeBuilder.java | 9 ++++---- .../support/compiler/jdt/ParentExiter.java | 6 ++--- .../reflect/declaration/CtMethodImpl.java | 1 - .../ReceiverParameterTest.java | 18 ++++++++------- .../assertions/CtCaseAssertInterface.java | 5 ++++ .../assertions/CtCasePatternAssert.java | 23 +++++++++++++++++++ .../CtCasePatternAssertInterface.java | 12 ++++++++++ .../CtExecutableAssertInterface.java | 4 ++++ .../assertions/CtReceiverParameterAssert.java | 23 +++++++++++++++++++ .../CtReceiverParameterAssertInterface.java | 4 ++++ .../assertions/CtRecordPatternAssert.java | 23 +++++++++++++++++++ .../CtRecordPatternAssertInterface.java | 20 ++++++++++++++++ .../testing/assertions/SpoonAssertions.java | 15 ++++++++++++ .../resources/receiver/InnerClassCtor.java | 2 +- 15 files changed, 149 insertions(+), 19 deletions(-) create mode 100644 src/test/java/spoon/testing/assertions/CtCasePatternAssert.java create mode 100644 src/test/java/spoon/testing/assertions/CtCasePatternAssertInterface.java create mode 100644 src/test/java/spoon/testing/assertions/CtReceiverParameterAssert.java create mode 100644 src/test/java/spoon/testing/assertions/CtReceiverParameterAssertInterface.java create mode 100644 src/test/java/spoon/testing/assertions/CtRecordPatternAssert.java create mode 100644 src/test/java/spoon/testing/assertions/CtRecordPatternAssertInterface.java diff --git a/src/main/java/spoon/reflect/declaration/CtExecutable.java b/src/main/java/spoon/reflect/declaration/CtExecutable.java index 91070e5604d..bfb9f593814 100644 --- a/src/main/java/spoon/reflect/declaration/CtExecutable.java +++ b/src/main/java/spoon/reflect/declaration/CtExecutable.java @@ -12,6 +12,7 @@ import spoon.reflect.annotations.PropertySetter; import spoon.reflect.code.CtBlock; import spoon.reflect.code.CtBodyHolder; +import spoon.reflect.path.CtRole; import spoon.reflect.reference.CtExecutableReference; import spoon.reflect.reference.CtTypeReference; import spoon.support.DerivedProperty; @@ -142,8 +143,10 @@ public interface CtExecutable extends CtNamedElement, CtTypedElement, CtBo @Override CtExecutable clone(); + @PropertySetter(role = CtRole.RECEIVER_PARAMETER) CtExecutable setReceiverParameter(CtReceiverParameter receiverParameter); + @PropertyGetter(role = CtRole.RECEIVER_PARAMETER) @Nullable CtReceiverParameter getReceiverParameter(); } diff --git a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java index 934c3539b08..ee92c073604 100644 --- a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java +++ b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java @@ -958,8 +958,6 @@ public boolean visit(Argument argument, BlockScope scope) { return true; } boolean isVar = argument.type != null && argument.type.isTypeNameVar(scope); - boolean isReceiver = CharOperation.charToString(argument.name).equals("this"); - ; // we can also use an instanceof Receiver here if (argument instanceof Receiver receiver) { CtReceiverParameter receiverParameter = helper.createReceiverParameter(receiver); @@ -1149,8 +1147,6 @@ public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) { context.enter(getFactory().Core().createBlock(), methodDeclaration); context.exit(methodDeclaration); } - //TODO: remove this code - // We consider the receiver as a standard argument (i.e. as a parameter) Receiver receiver = methodDeclaration.receiver; if (receiver != null) { receiver.traverse(this, methodDeclaration.scope); @@ -1184,7 +1180,10 @@ public boolean visit(ConstructorDeclaration constructorDeclaration, ClassScope s // Create block context.enter(factory.Core().createBlock(), constructorDeclaration); context.exit(constructorDeclaration); - + Receiver receiver = constructorDeclaration.receiver; + if (receiver != null) { + receiver.traverse(this, constructorDeclaration.scope); + } return true; } diff --git a/src/main/java/spoon/support/compiler/jdt/ParentExiter.java b/src/main/java/spoon/support/compiler/jdt/ParentExiter.java index bf7dbcc0e00..6b763ae9c49 100644 --- a/src/main/java/spoon/support/compiler/jdt/ParentExiter.java +++ b/src/main/java/spoon/support/compiler/jdt/ParentExiter.java @@ -208,10 +208,8 @@ public void scanCtExecutable(CtExecutable e) { } else if (child instanceof CtBlock && !(e instanceof CtMethod || e instanceof CtConstructor)) { e.setBody((CtBlock) child); return; - } else if(child instanceof CtReceiverParameter) { - if(e instanceof CtMethod) { - ((CtMethod) e).setReceiverParameter((CtReceiverParameter) child); - } + } else if(child instanceof CtReceiverParameter) { + e.setReceiverParameter((CtReceiverParameter) child); } super.scanCtExecutable(e); } diff --git a/src/main/java/spoon/support/reflect/declaration/CtMethodImpl.java b/src/main/java/spoon/support/reflect/declaration/CtMethodImpl.java index 8cf8ff78ba6..7b8b62a64ea 100644 --- a/src/main/java/spoon/support/reflect/declaration/CtMethodImpl.java +++ b/src/main/java/spoon/support/reflect/declaration/CtMethodImpl.java @@ -13,7 +13,6 @@ import spoon.reflect.declaration.CtFormalTypeDeclarer; import spoon.reflect.declaration.CtMethod; import spoon.reflect.declaration.CtModifiable; -import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtShadowable; import spoon.reflect.declaration.CtTypeParameter; import spoon.reflect.declaration.CtTypedElement; diff --git a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java index 08b3cb36b27..1812c21ceb3 100644 --- a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java +++ b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java @@ -1,10 +1,12 @@ package spoon.test.receiverparameter; import spoon.reflect.CtModel; -import spoon.reflect.declaration.CtMethod; +import spoon.reflect.declaration.CtConstructor; import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtType; +import spoon.reflect.declaration.CtTypeInformation; import spoon.reflect.visitor.filter.TypeFilter; +import spoon.testing.assertions.SpoonAssertions; import spoon.testing.utils.ModelTest; import java.util.List; @@ -20,9 +22,9 @@ void simpleParameter(CtModel model) { CtType targetType = model.getAllTypes().iterator().next(); List receiverParams = targetType.getElements(new TypeFilter<>(CtReceiverParameter.class)); assertEquals(1, receiverParams.size()); - CtReceiverParameter next1 = receiverParams.iterator().next(); - assertEquals("receiver.SimpleReceiverParameter", next1.getType().getQualifiedName()); - // TODO: toString + CtReceiverParameter receiverParam = receiverParams.iterator().next(); + assertEquals("receiver.SimpleReceiverParameter", receiverParam.getType().getQualifiedName()); + SpoonAssertions.assertThat(receiverParam.getType()).extracting(CtTypeInformation::getQualifiedName).isEqualTo("receiver.SimpleReceiverParameter"); } @@ -34,9 +36,9 @@ void innerClassCtor(CtModel model) { List receiverParams = targetType.getElements(new TypeFilter<>(CtReceiverParameter.class)); assertEquals(1, receiverParams.size()); CtReceiverParameter next1 = receiverParams.iterator().next(); - assertEquals("receiver.SimpleReceiverParameter", next1.getType().getQualifiedName()); - CtMethod ctMethod = targetType.getMethods().stream().filter(v -> v.getReceiverParameter() != null).findFirst().get(); - System.out.println(ctMethod.toString()); - //TODO fix name + assertEquals("receiver.Outer", next1.getType().getQualifiedName()); + CtConstructor ctConstructor = targetType.getElements(new TypeFilter<>(CtConstructor.class)).stream().filter(v -> v.getReceiverParameter() != null).findFirst().get(); + SpoonAssertions.assertThat(ctConstructor).isNotNull(); + SpoonAssertions.assertThat(ctConstructor.getReceiverParameter()).isNotNull(); } } diff --git a/src/test/java/spoon/testing/assertions/CtCaseAssertInterface.java b/src/test/java/spoon/testing/assertions/CtCaseAssertInterface.java index ba06835603b..fffc4794555 100644 --- a/src/test/java/spoon/testing/assertions/CtCaseAssertInterface.java +++ b/src/test/java/spoon/testing/assertions/CtCaseAssertInterface.java @@ -1,4 +1,5 @@ package spoon.testing.assertions; +import org.assertj.core.api.AbstractBooleanAssert; import org.assertj.core.api.AbstractObjectAssert; import org.assertj.core.api.Assertions; import org.assertj.core.api.ListAssert; @@ -14,4 +15,8 @@ default ListAssert> getCaseExpressions() { default ObjectAssert getCaseKind() { return Assertions.assertThatObject(actual().getCaseKind()); } + + default AbstractBooleanAssert getIncludesDefault() { + return Assertions.assertThat(actual().getIncludesDefault()); + } } diff --git a/src/test/java/spoon/testing/assertions/CtCasePatternAssert.java b/src/test/java/spoon/testing/assertions/CtCasePatternAssert.java new file mode 100644 index 00000000000..e5bd2691577 --- /dev/null +++ b/src/test/java/spoon/testing/assertions/CtCasePatternAssert.java @@ -0,0 +1,23 @@ +package spoon.testing.assertions; +import org.assertj.core.api.AbstractObjectAssert; +import spoon.reflect.code.CtCasePattern; +public class CtCasePatternAssert extends AbstractObjectAssert implements CtCasePatternAssertInterface { + CtCasePatternAssert(CtCasePattern actual) { + super(actual, CtCasePatternAssert.class); + } + + @Override + public CtCasePatternAssert self() { + return this; + } + + @Override + public CtCasePattern actual() { + return this.actual; + } + + @Override + public void failWithMessage(String errorMessage, Object... arguments) { + super.failWithMessage(errorMessage, arguments); + } +} diff --git a/src/test/java/spoon/testing/assertions/CtCasePatternAssertInterface.java b/src/test/java/spoon/testing/assertions/CtCasePatternAssertInterface.java new file mode 100644 index 00000000000..09bfae2c5e1 --- /dev/null +++ b/src/test/java/spoon/testing/assertions/CtCasePatternAssertInterface.java @@ -0,0 +1,12 @@ +package spoon.testing.assertions; +import org.assertj.core.api.AbstractObjectAssert; +import spoon.reflect.code.CtCasePattern; +interface CtCasePatternAssertInterface, W extends CtCasePattern> extends SpoonAssert , CtExpressionAssertInterface { + default CtExpressionAssertInterface getGuard() { + return SpoonAssertions.assertThat(actual().getGuard()); + } + + default CtPatternAssertInterface getPattern() { + return SpoonAssertions.assertThat(actual().getPattern()); + } +} diff --git a/src/test/java/spoon/testing/assertions/CtExecutableAssertInterface.java b/src/test/java/spoon/testing/assertions/CtExecutableAssertInterface.java index dc1e8f9484f..62f297bece6 100644 --- a/src/test/java/spoon/testing/assertions/CtExecutableAssertInterface.java +++ b/src/test/java/spoon/testing/assertions/CtExecutableAssertInterface.java @@ -16,6 +16,10 @@ default ListAssert> getParameters() { return Assertions.assertThat(actual().getParameters()); } + default CtReceiverParameterAssertInterface getReceiverParameter() { + return SpoonAssertions.assertThat(actual().getReceiverParameter()); + } + default AbstractCollectionAssert>, CtTypeReference, ?> getThrownTypes() { return Assertions.assertThat(actual().getThrownTypes()); } diff --git a/src/test/java/spoon/testing/assertions/CtReceiverParameterAssert.java b/src/test/java/spoon/testing/assertions/CtReceiverParameterAssert.java new file mode 100644 index 00000000000..95bc375020d --- /dev/null +++ b/src/test/java/spoon/testing/assertions/CtReceiverParameterAssert.java @@ -0,0 +1,23 @@ +package spoon.testing.assertions; +import org.assertj.core.api.AbstractObjectAssert; +import spoon.reflect.declaration.CtReceiverParameter; +public class CtReceiverParameterAssert extends AbstractObjectAssert implements CtReceiverParameterAssertInterface { + CtReceiverParameterAssert(CtReceiverParameter actual) { + super(actual, CtReceiverParameterAssert.class); + } + + @Override + public CtReceiverParameterAssert self() { + return this; + } + + @Override + public CtReceiverParameter actual() { + return this.actual; + } + + @Override + public void failWithMessage(String errorMessage, Object... arguments) { + super.failWithMessage(errorMessage, arguments); + } +} diff --git a/src/test/java/spoon/testing/assertions/CtReceiverParameterAssertInterface.java b/src/test/java/spoon/testing/assertions/CtReceiverParameterAssertInterface.java new file mode 100644 index 00000000000..2c3e5c90e56 --- /dev/null +++ b/src/test/java/spoon/testing/assertions/CtReceiverParameterAssertInterface.java @@ -0,0 +1,4 @@ +package spoon.testing.assertions; +import org.assertj.core.api.AbstractObjectAssert; +import spoon.reflect.declaration.CtReceiverParameter; +interface CtReceiverParameterAssertInterface, W extends CtReceiverParameter> extends CtElementAssertInterface , SpoonAssert , CtTypedElementAssertInterface , CtShadowableAssertInterface {} diff --git a/src/test/java/spoon/testing/assertions/CtRecordPatternAssert.java b/src/test/java/spoon/testing/assertions/CtRecordPatternAssert.java new file mode 100644 index 00000000000..026da7a017a --- /dev/null +++ b/src/test/java/spoon/testing/assertions/CtRecordPatternAssert.java @@ -0,0 +1,23 @@ +package spoon.testing.assertions; +import org.assertj.core.api.AbstractObjectAssert; +import spoon.reflect.code.CtRecordPattern; +public class CtRecordPatternAssert extends AbstractObjectAssert implements CtRecordPatternAssertInterface { + CtRecordPatternAssert(CtRecordPattern actual) { + super(actual, CtRecordPatternAssert.class); + } + + @Override + public CtRecordPatternAssert self() { + return this; + } + + @Override + public CtRecordPattern actual() { + return this.actual; + } + + @Override + public void failWithMessage(String errorMessage, Object... arguments) { + super.failWithMessage(errorMessage, arguments); + } +} diff --git a/src/test/java/spoon/testing/assertions/CtRecordPatternAssertInterface.java b/src/test/java/spoon/testing/assertions/CtRecordPatternAssertInterface.java new file mode 100644 index 00000000000..83edcf29857 --- /dev/null +++ b/src/test/java/spoon/testing/assertions/CtRecordPatternAssertInterface.java @@ -0,0 +1,20 @@ +package spoon.testing.assertions; +import org.assertj.core.api.AbstractObjectAssert; +import org.assertj.core.api.Assertions; +import org.assertj.core.api.ListAssert; +import spoon.reflect.code.CtPattern; +import spoon.reflect.code.CtRecordPattern; +import spoon.reflect.reference.CtTypeReference; +interface CtRecordPatternAssertInterface, W extends CtRecordPattern> extends SpoonAssert , CtExpressionAssertInterface , CtPatternAssertInterface { + default ListAssert getPatternList() { + return Assertions.assertThat(actual().getPatternList()); + } + + default CtTypeReferenceAssertInterface getRecordType() { + return SpoonAssertions.assertThat(actual().getRecordType()); + } + + default ListAssert> getTypeCasts() { + return Assertions.assertThat(actual().getTypeCasts()); + } +} diff --git a/src/test/java/spoon/testing/assertions/SpoonAssertions.java b/src/test/java/spoon/testing/assertions/SpoonAssertions.java index 172c479478f..23e96fabf42 100644 --- a/src/test/java/spoon/testing/assertions/SpoonAssertions.java +++ b/src/test/java/spoon/testing/assertions/SpoonAssertions.java @@ -9,6 +9,7 @@ import spoon.reflect.code.CtBlock; import spoon.reflect.code.CtBreak; import spoon.reflect.code.CtCase; +import spoon.reflect.code.CtCasePattern; import spoon.reflect.code.CtCatch; import spoon.reflect.code.CtCatchVariable; import spoon.reflect.code.CtCodeElement; @@ -37,6 +38,7 @@ import spoon.reflect.code.CtNewArray; import spoon.reflect.code.CtNewClass; import spoon.reflect.code.CtOperatorAssignment; +import spoon.reflect.code.CtRecordPattern; import spoon.reflect.code.CtReturn; import spoon.reflect.code.CtStatement; import spoon.reflect.code.CtStatementList; @@ -81,6 +83,7 @@ import spoon.reflect.declaration.CtPackageExport; import spoon.reflect.declaration.CtParameter; import spoon.reflect.declaration.CtProvidedService; +import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtRecord; import spoon.reflect.declaration.CtRecordComponent; import spoon.reflect.declaration.CtType; @@ -155,6 +158,10 @@ public static CtBinaryOperatorAssert assertThat(CtBinaryOperator ctBinaryOper return new CtBinaryOperatorAssert(ctBinaryOperator); } + public static CtRecordPatternAssert assertThat(CtRecordPattern ctRecordPattern) { + return new CtRecordPatternAssert(ctRecordPattern); + } + public static CtForEachAssert assertThat(CtForEach ctForEach) { return new CtForEachAssert(ctForEach); } @@ -247,6 +254,10 @@ public static CtAnnotationFieldAccessAssert assertThat(CtAnnotationFieldAccess ctAnnotationMethod) { return new CtAnnotationMethodAssert(ctAnnotationMethod); } @@ -491,6 +502,10 @@ public static CtEnumAssert assertThat(CtEnum ctEnum) { return new CtEnumAssert(ctEnum); } + public static CtCasePatternAssert assertThat(CtCasePattern ctCasePattern) { + return new CtCasePatternAssert(ctCasePattern); + } + public static CtTypeMemberWildcardImportReferenceAssert assertThat(CtTypeMemberWildcardImportReference ctTypeMemberWildcardImportReference) { return new CtTypeMemberWildcardImportReferenceAssert(ctTypeMemberWildcardImportReference); } diff --git a/src/test/resources/receiver/InnerClassCtor.java b/src/test/resources/receiver/InnerClassCtor.java index e3d99c3051b..e47f9ac7009 100644 --- a/src/test/resources/receiver/InnerClassCtor.java +++ b/src/test/resources/receiver/InnerClassCtor.java @@ -1,7 +1,7 @@ package receiver; public class Outer { class Inner { - public Bar(Outer Outer.this) { + public Inner(Outer Outer.this) { } } From 9759ed2cd83c6270b8b8aed628960452b77c0219 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 25 Mar 2024 21:30:56 +0100 Subject: [PATCH 10/51] Improve ReceiverParameter handling in tests This commit involves adding comments to clarify the contracts in ReceiverParameterTest.java for improved readability and understanding. It ensures that receiver parameters are correctly parsed and accessed from the model and constructors of inner classes can have receiver parameters with their outer class type. --- .../spoon/test/receiverparameter/ReceiverParameterTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java index 1812c21ceb3..bb700715eb7 100644 --- a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java +++ b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java @@ -19,6 +19,7 @@ public class ReceiverParameterTest { value = "src/test/resources/receiver/SimpleReceiverParameter.java" ) void simpleParameter(CtModel model) { + // contract: receiver parameter is correctly parsed and can be accessed from the model CtType targetType = model.getAllTypes().iterator().next(); List receiverParams = targetType.getElements(new TypeFilter<>(CtReceiverParameter.class)); assertEquals(1, receiverParams.size()); @@ -32,6 +33,7 @@ void simpleParameter(CtModel model) { value = "src/test/resources/receiver/InnerClassCtor.java" ) void innerClassCtor(CtModel model) { + // contract: constructor of inner class can have receiver parameter with their outer class type CtType targetType = model.getAllTypes().iterator().next(); List receiverParams = targetType.getElements(new TypeFilter<>(CtReceiverParameter.class)); assertEquals(1, receiverParams.size()); From 168b08ec035bfd6f7c2e4112b41977cefaee93d0 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 25 Mar 2024 21:45:01 +0100 Subject: [PATCH 11/51] Refactor and clean-up the Spoon library classes The changes in this commit adjust package code formatting and remove unnecessary test classes. Moreover, it refines the ReceiverParameter implementation for better shadow management and handling in related classes. The adjustments improve readability and ensure correct parameter parsing and handling in the Spoon library. --- .../spoon/reflect/factory/CoreFactory.java | 2 +- .../reflect/meta/impl/ModelRoleHandlers.java | 6 +- .../reflect/visitor/CtBiScannerDefault.java | 2 +- .../visitor/DefaultJavaPrettyPrinter.java | 8 -- .../reflect/visitor/ElementPrinterHelper.java | 2 +- .../spoon/support/DefaultCoreFactory.java | 2 +- .../declaration/CtReceiverParameterImpl.java | 80 +++++++++---------- .../support/visitor/clone/CloneBuilder.java | 2 +- .../support/visitor/clone/CloneVisitor.java | 2 +- 9 files changed, 50 insertions(+), 56 deletions(-) diff --git a/src/main/java/spoon/reflect/factory/CoreFactory.java b/src/main/java/spoon/reflect/factory/CoreFactory.java index beac3e3f7db..513adb7511f 100644 --- a/src/main/java/spoon/reflect/factory/CoreFactory.java +++ b/src/main/java/spoon/reflect/factory/CoreFactory.java @@ -655,5 +655,5 @@ BodyHolderSourcePosition createBodyHolderSourcePosition( */ CtRecordPattern createRecordPattern(); - CtReceiverParameter createReceiverParameter(); + CtReceiverParameter createReceiverParameter(); } diff --git a/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java b/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java index 9ce21f79591..b0a916efbbb 100644 --- a/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java +++ b/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java @@ -6,7 +6,7 @@ * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) of the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. */ package spoon.reflect.meta.impl; -import java.lang.annotation.Annotation; + import spoon.reflect.code.BinaryOperatorKind; import spoon.reflect.code.CaseKind; import spoon.reflect.code.CtAbstractInvocation; @@ -113,6 +113,8 @@ import spoon.reflect.reference.CtVariableReference; import spoon.reflect.reference.CtWildcardReference; import spoon.support.reflect.CtExtendedModifier; + +import java.lang.annotation.Annotation; /** * Contains implementations of {@link RoleHandler}s for all {@link CtRole}s of all model elements */ @@ -2607,4 +2609,4 @@ public void setValue(T element, U value) { castTarget(element).setAccessedType(castValue(value)); } } -} \ No newline at end of file +} diff --git a/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java b/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java index 1370d12f554..939d96e10c4 100644 --- a/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java +++ b/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java @@ -1128,4 +1128,4 @@ public void visitCtRecordPattern(spoon.reflect.code.CtRecordPattern recordPatter biScan(spoon.reflect.path.CtRole.COMMENT, recordPattern.getComments(), other.getComments()); exit(recordPattern); } -} \ No newline at end of file +} diff --git a/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java b/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java index 5e3b7683481..9a1cd488720 100644 --- a/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java +++ b/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java @@ -2378,12 +2378,4 @@ public void visitCtReceiverParameter(CtReceiverParameter receiverParameter) { printer.writeSeparator("this"); } } - - class Foo { - class Bar { - public Bar(Foo Foo.this) { - - } - } - } } diff --git a/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java b/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java index 60fa0ac373f..8e97a631ee6 100644 --- a/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java +++ b/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java @@ -148,7 +148,7 @@ public void writeImplementsClause(CtType type) { public void writeExecutableParameters(CtExecutable executable) { List parameters = new ArrayList<>(); - if(executable.getReceiverParameter()!= null) { + if (executable.getReceiverParameter() != null) { parameters.add(executable.getReceiverParameter()); } parameters.addAll(executable.getParameters()); diff --git a/src/main/java/spoon/support/DefaultCoreFactory.java b/src/main/java/spoon/support/DefaultCoreFactory.java index 9107b174528..f0486a13b26 100644 --- a/src/main/java/spoon/support/DefaultCoreFactory.java +++ b/src/main/java/spoon/support/DefaultCoreFactory.java @@ -1123,7 +1123,7 @@ public CtElement create(Class klass) { if (klass.equals(spoon.reflect.code.CtRecordPattern.class)) { return createRecordPattern(); } - if(klass.equals(spoon.reflect.declaration.CtReceiverParameter.class)) { + if (klass.equals(spoon.reflect.declaration.CtReceiverParameter.class)) { return createReceiverParameter(); } throw new IllegalArgumentException("not instantiable by CoreFactory(): " + klass); diff --git a/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java b/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java index 1fb27d055e2..867263ce65a 100644 --- a/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java +++ b/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java @@ -17,44 +17,44 @@ public class CtReceiverParameterImpl extends CtElementImpl implements CtReceiverParameter { - @MetamodelPropertyField(role = CtRole.TYPE) - private CtTypeReference type; - @MetamodelPropertyField(role = CtRole.IS_SHADOW) - boolean isShadow; - - public boolean isShadow() { - return isShadow; - } - - - @Override - public C setShadow(boolean isShadow) { - getFactory().getEnvironment().getModelChangeListener().onObjectUpdate(this, CtRole.IS_SHADOW, isShadow, this.isShadow); - this.isShadow = isShadow; - return (C) this; - } - @Override - public CtTypeReference getType() { - return type; - } - - @Override - public C setType(CtTypeReference type) { - if (type != null) { - type.setParent(this); - } - getFactory().getEnvironment().getModelChangeListener().onObjectUpdate(this, CtRole.TYPE, type, this.type); - this.type = type; - return (C) this; - } - - @Override - public void accept(CtVisitor visitor) { - visitor.visitCtReceiverParameter(this); - } - - @Override - public CtReceiverParameter clone() { - return (CtReceiverParameter) super.clone(); - } + @MetamodelPropertyField(role = CtRole.TYPE) + private CtTypeReference type; + @MetamodelPropertyField(role = CtRole.IS_SHADOW) + boolean isShadow; + + public boolean isShadow() { + return isShadow; + } + + + @Override + public C setShadow(boolean isShadow) { + getFactory().getEnvironment().getModelChangeListener().onObjectUpdate(this, CtRole.IS_SHADOW, isShadow, this.isShadow); + this.isShadow = isShadow; + return (C) this; + } + @Override + public CtTypeReference getType() { + return type; + } + + @Override + public C setType(CtTypeReference type) { + if (type != null) { + type.setParent(this); + } + getFactory().getEnvironment().getModelChangeListener().onObjectUpdate(this, CtRole.TYPE, type, this.type); + this.type = type; + return (C) this; + } + + @Override + public void accept(CtVisitor visitor) { + visitor.visitCtReceiverParameter(this); + } + + @Override + public CtReceiverParameter clone() { + return (CtReceiverParameter) super.clone(); + } } diff --git a/src/main/java/spoon/support/visitor/clone/CloneBuilder.java b/src/main/java/spoon/support/visitor/clone/CloneBuilder.java index a1b2d260f64..e5b1d0afb04 100644 --- a/src/main/java/spoon/support/visitor/clone/CloneBuilder.java +++ b/src/main/java/spoon/support/visitor/clone/CloneBuilder.java @@ -320,4 +320,4 @@ public void visitCtReceiverParameter(spoon.reflect.declaration.CtReceiverParamet ((spoon.reflect.declaration.CtReceiverParameter) (other)).setShadow(e.isShadow()); super.visitCtReceiverParameter(e); } -} \ No newline at end of file +} diff --git a/src/main/java/spoon/support/visitor/clone/CloneVisitor.java b/src/main/java/spoon/support/visitor/clone/CloneVisitor.java index 23ae13a86d9..142ffe64423 100644 --- a/src/main/java/spoon/support/visitor/clone/CloneVisitor.java +++ b/src/main/java/spoon/support/visitor/clone/CloneVisitor.java @@ -1187,4 +1187,4 @@ public void visitCtRecordPattern(spoon.reflect.code.CtRecordPattern recordPatter this.cloneHelper.tailor(recordPattern, aCtRecordPattern); this.other = aCtRecordPattern; } -} \ No newline at end of file +} From ac899ce0a5713566fa17d888b108036413337833 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 25 Mar 2024 21:56:33 +0100 Subject: [PATCH 12/51] Add ReceiverParameter to CtExecutable and documentation This commit includes updates to relevant classes of the Spoon library to accept and handle ReceiverParameter. Enhanced classes include CtLambda, CtAnnotationMethod, and CtAnonymousExecutable. Documentation for the use of CtReceiverParameter was also added. These additions will facilitate receiver parameter handling within the Spoon library. --- doc/code_elements.md | 13 ++++++++++++ .../java/spoon/reflect/code/CtLambda.java | 9 +++++++++ .../declaration/CtAnnotationMethod.java | 7 +++++++ .../declaration/CtAnonymousExecutable.java | 9 +++++++++ .../reflect/meta/impl/ModelRoleHandlers.java | 20 ++++++++++++++++++- .../support/reflect/code/CtLambdaImpl.java | 2 ++ 6 files changed, 59 insertions(+), 1 deletion(-) diff --git a/doc/code_elements.md b/doc/code_elements.md index 35833fb1d57..a4f8335f203 100644 --- a/doc/code_elements.md +++ b/doc/code_elements.md @@ -571,3 +571,16 @@ int x = switch(i) { // <-- switch expression } ``` + +### CtReceiverParameter +[(javadoc)](http://spoon.gforge.inria.fr/mvnsites/spoon-core/apidocs/spoon/reflect/declaration/CtReceiverParameter.html) + +```java + + // here is the receiver parameter of a method Foo + class Foo { + void bar(Foo this) { + } + } + +``` \ No newline at end of file diff --git a/src/main/java/spoon/reflect/code/CtLambda.java b/src/main/java/spoon/reflect/code/CtLambda.java index 8dc57de15a5..f20e6d20aa7 100644 --- a/src/main/java/spoon/reflect/code/CtLambda.java +++ b/src/main/java/spoon/reflect/code/CtLambda.java @@ -7,8 +7,10 @@ */ package spoon.reflect.code; +import org.jspecify.annotations.Nullable; import spoon.reflect.declaration.CtExecutable; import spoon.reflect.declaration.CtMethod; +import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.reference.CtTypeReference; import spoon.support.DerivedProperty; import spoon.reflect.annotations.PropertyGetter; @@ -77,4 +79,11 @@ public interface CtLambda extends CtExpression, CtExecutable { @Override @UnsettableProperty > T1 setThrownTypes(Set> thrownTypes); + + @UnsettableProperty + CtExecutable setReceiverParameter(CtReceiverParameter receiverParameter); + + @UnsettableProperty + @Nullable + CtReceiverParameter getReceiverParameter(); } diff --git a/src/main/java/spoon/reflect/declaration/CtAnnotationMethod.java b/src/main/java/spoon/reflect/declaration/CtAnnotationMethod.java index 14d46ee015f..4f6760d4ed3 100644 --- a/src/main/java/spoon/reflect/declaration/CtAnnotationMethod.java +++ b/src/main/java/spoon/reflect/declaration/CtAnnotationMethod.java @@ -7,6 +7,7 @@ */ package spoon.reflect.declaration; +import org.jspecify.annotations.Nullable; import spoon.reflect.code.CtBodyHolder; import spoon.reflect.code.CtExpression; import spoon.reflect.code.CtStatement; @@ -54,4 +55,10 @@ public interface CtAnnotationMethod extends CtMethod { @Override @UnsettableProperty > T1 setParameters(List> parameters); + @UnsettableProperty + CtExecutable setReceiverParameter(CtReceiverParameter receiverParameter); + + @UnsettableProperty + @Nullable + CtReceiverParameter getReceiverParameter(); } diff --git a/src/main/java/spoon/reflect/declaration/CtAnonymousExecutable.java b/src/main/java/spoon/reflect/declaration/CtAnonymousExecutable.java index 8cea3e9d789..7de160ec7b7 100644 --- a/src/main/java/spoon/reflect/declaration/CtAnonymousExecutable.java +++ b/src/main/java/spoon/reflect/declaration/CtAnonymousExecutable.java @@ -7,6 +7,7 @@ */ package spoon.reflect.declaration; +import org.jspecify.annotations.Nullable; import spoon.reflect.reference.CtTypeReference; import spoon.support.UnsettableProperty; @@ -50,4 +51,12 @@ public interface CtAnonymousExecutable extends CtExecutable, CtTypeMember @UnsettableProperty > T addThrownType(CtTypeReference throwType); + + @UnsettableProperty + CtExecutable setReceiverParameter(CtReceiverParameter receiverParameter); + + @UnsettableProperty + @Nullable + CtReceiverParameter getReceiverParameter(); + } diff --git a/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java b/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java index b0a916efbbb..86660f492a1 100644 --- a/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java +++ b/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java @@ -86,6 +86,7 @@ import spoon.reflect.declaration.CtPackageExport; import spoon.reflect.declaration.CtParameter; import spoon.reflect.declaration.CtProvidedService; +import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtRecord; import spoon.reflect.declaration.CtRecordComponent; import spoon.reflect.declaration.CtSealable; @@ -122,7 +123,7 @@ class ModelRoleHandlers { private ModelRoleHandlers() { } - 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 CtWildcardReference_BOUNDING_TYPE_RoleHandler(), new CtAbstractSwitch_CASE_RoleHandler(), new CtCase_CASE_KIND_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 CtConstructor_COMPACT_CONSTRUCTOR_RoleHandler(), new CtAssert_CONDITION_RoleHandler(), new CtCasePattern_CONDITION_RoleHandler(), new CtConditional_CONDITION_RoleHandler(), new CtIf_CONDITION_RoleHandler(), new CtClass_CONSTRUCTOR_RoleHandler(), new CtPackage_CONTAINED_TYPE_RoleHandler(), new CtCompilationUnit_DECLARED_IMPORT_RoleHandler(), new CtCompilationUnit_DECLARED_MODULE_RoleHandler(), new CtCompilationUnit_DECLARED_MODULE_REF_RoleHandler(), new CtCompilationUnit_DECLARED_TYPE_RoleHandler(), new CtCompilationUnit_DECLARED_TYPE_REF_RoleHandler(), new CtExecutableReference_DECLARING_TYPE_RoleHandler(), new CtFieldReference_DECLARING_TYPE_RoleHandler(), new CtTypeReference_DECLARING_TYPE_RoleHandler(), new CtAnnotationMethod_DEFAULT_EXPRESSION_RoleHandler(), new CtCase_DEFAULT_EXPRESSION_RoleHandler(), new CtVariable_DEFAULT_EXPRESSION_RoleHandler(), new CtNewArray_DIMENSION_RoleHandler(), new CtJavaDocTag_DOCUMENTATION_TYPE_RoleHandler(), new CtJavaDocTag_DOCUMENTATION_TYPE_REALNAME_RoleHandler(), new CtConditional_ELSE_RoleHandler(), new CtIf_ELSE_RoleHandler(), new CtModifiable_EMODIFIER_RoleHandler(), new CtAbstractInvocation_EXECUTABLE_REF_RoleHandler(), new CtExecutableReferenceExpression_EXECUTABLE_REF_RoleHandler(), new CtModule_EXPORTED_PACKAGE_RoleHandler(), new CtAbstractSwitch_EXPRESSION_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 CtSynchronized_EXPRESSION_RoleHandler(), new CtThrow_EXPRESSION_RoleHandler(), new CtUnaryOperator_EXPRESSION_RoleHandler(), new CtWhile_EXPRESSION_RoleHandler(), new CtYieldStatement_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 CtProvidedService_IMPLEMENTATION_TYPE_RoleHandler(), new CtImport_IMPORT_REFERENCE_RoleHandler(), new CtType_INTERFACE_RoleHandler(), new CtTypeInformation_INTERFACE_RoleHandler(), new CtMethod_IS_DEFAULT_RoleHandler(), new CtFieldReference_IS_FINAL_RoleHandler(), new CtElement_IS_IMPLICIT_RoleHandler(), new CtLocalVariable_IS_INFERRED_RoleHandler(), new CtParameter_IS_INFERRED_RoleHandler(), new CtShadowable_IS_SHADOW_RoleHandler(), new CtExecutableReference_IS_STATIC_RoleHandler(), new CtFieldReference_IS_STATIC_RoleHandler(), new CtWildcardReference_IS_UPPER_RoleHandler(), new CtParameter_IS_VARARGS_RoleHandler(), new CtJavaDocTag_JAVADOC_TAG_VALUE_RoleHandler(), new CtStatement_LABEL_RoleHandler(), new CtBinaryOperator_LEFT_OPERAND_RoleHandler(), new CtLiteral_LITERAL_BASE_RoleHandler(), new CtType_METHOD_RoleHandler(), new CtModifiable_MODIFIER_RoleHandler(), new CtModule_MODIFIER_RoleHandler(), new CtModuleRequirement_MODIFIER_RoleHandler(), new CtTypeInformation_MODIFIER_RoleHandler(), new CtModule_MODULE_DIRECTIVE_RoleHandler(), new CtModuleRequirement_MODULE_REF_RoleHandler(), new CtPackageExport_MODULE_REF_RoleHandler(), new CtMultiTypedElement_MULTI_TYPE_RoleHandler(), new CtNamedElement_NAME_RoleHandler(), new CtReference_NAME_RoleHandler(), new CtNewClass_NESTED_TYPE_RoleHandler(), new CtType_NESTED_TYPE_RoleHandler(), new CtModule_OPENED_PACKAGE_RoleHandler(), new CtPackageExport_OPENED_PACKAGE_RoleHandler(), new CtBinaryOperator_OPERATOR_KIND_RoleHandler(), new CtOperatorAssignment_OPERATOR_KIND_RoleHandler(), new CtUnaryOperator_OPERATOR_KIND_RoleHandler(), new CtCompilationUnit_PACKAGE_DECLARATION_RoleHandler(), new CtPackageDeclaration_PACKAGE_REF_RoleHandler(), new CtPackageExport_PACKAGE_REF_RoleHandler(), new CtTypeReference_PACKAGE_REF_RoleHandler(), new CtCatch_PARAMETER_RoleHandler(), new CtExecutable_PARAMETER_RoleHandler(), new CtCasePattern_PATTERN_RoleHandler(), new CtRecordPattern_PATTERN_RoleHandler(), new CtSealable_PERMITTED_TYPE_RoleHandler(), new CtElement_POSITION_RoleHandler(), new CtModule_PROVIDED_SERVICE_RoleHandler(), new CtRecord_RECORD_COMPONENT_RoleHandler(), new CtModule_REQUIRED_MODULE_RoleHandler(), new CtBinaryOperator_RIGHT_OPERAND_RoleHandler(), new CtModule_SERVICE_TYPE_RoleHandler(), new CtProvidedService_SERVICE_TYPE_RoleHandler(), new CtUsedService_SERVICE_TYPE_RoleHandler(), new CtCodeSnippet_SNIPPET_RoleHandler(), new CtStatementList_STATEMENT_RoleHandler(), new CtModule_SUB_PACKAGE_RoleHandler(), new CtPackage_SUB_PACKAGE_RoleHandler(), new CtType_SUPER_TYPE_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 CtTypedElement_TYPE_RoleHandler(), new CtVariableReference_TYPE_RoleHandler(), new CtActualTypeContainer_TYPE_ARGUMENT_RoleHandler(), new CtType_TYPE_MEMBER_RoleHandler(), new CtFormalTypeDeclarer_TYPE_PARAMETER_RoleHandler(), new CtRecordPattern_TYPE_REF_RoleHandler(), new CtTypeMemberWildcardImportReference_TYPE_REF_RoleHandler(), new CtAnnotation_VALUE_RoleHandler(), new CtEnum_VALUE_RoleHandler(), new CtLiteral_VALUE_RoleHandler(), new CtTextBlock_VALUE_RoleHandler(), new CtTypePattern_VARIABLE_RoleHandler(), new CtVariableAccess_VARIABLE_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 CtWildcardReference_BOUNDING_TYPE_RoleHandler(), new CtAbstractSwitch_CASE_RoleHandler(), new CtCase_CASE_KIND_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 CtConstructor_COMPACT_CONSTRUCTOR_RoleHandler(), new CtAssert_CONDITION_RoleHandler(), new CtCasePattern_CONDITION_RoleHandler(), new CtConditional_CONDITION_RoleHandler(), new CtIf_CONDITION_RoleHandler(), new CtClass_CONSTRUCTOR_RoleHandler(), new CtPackage_CONTAINED_TYPE_RoleHandler(), new CtCompilationUnit_DECLARED_IMPORT_RoleHandler(), new CtCompilationUnit_DECLARED_MODULE_RoleHandler(), new CtCompilationUnit_DECLARED_MODULE_REF_RoleHandler(), new CtCompilationUnit_DECLARED_TYPE_RoleHandler(), new CtCompilationUnit_DECLARED_TYPE_REF_RoleHandler(), new CtExecutableReference_DECLARING_TYPE_RoleHandler(), new CtFieldReference_DECLARING_TYPE_RoleHandler(), new CtTypeReference_DECLARING_TYPE_RoleHandler(), new CtAnnotationMethod_DEFAULT_EXPRESSION_RoleHandler(), new CtCase_DEFAULT_EXPRESSION_RoleHandler(), new CtVariable_DEFAULT_EXPRESSION_RoleHandler(), new CtNewArray_DIMENSION_RoleHandler(), new CtJavaDocTag_DOCUMENTATION_TYPE_RoleHandler(), new CtJavaDocTag_DOCUMENTATION_TYPE_REALNAME_RoleHandler(), new CtConditional_ELSE_RoleHandler(), new CtIf_ELSE_RoleHandler(), new CtModifiable_EMODIFIER_RoleHandler(), new CtAbstractInvocation_EXECUTABLE_REF_RoleHandler(), new CtExecutableReferenceExpression_EXECUTABLE_REF_RoleHandler(), new CtModule_EXPORTED_PACKAGE_RoleHandler(), new CtAbstractSwitch_EXPRESSION_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 CtSynchronized_EXPRESSION_RoleHandler(), new CtThrow_EXPRESSION_RoleHandler(), new CtUnaryOperator_EXPRESSION_RoleHandler(), new CtWhile_EXPRESSION_RoleHandler(), new CtYieldStatement_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 CtProvidedService_IMPLEMENTATION_TYPE_RoleHandler(), new CtImport_IMPORT_REFERENCE_RoleHandler(), new CtType_INTERFACE_RoleHandler(), new CtTypeInformation_INTERFACE_RoleHandler(), new CtMethod_IS_DEFAULT_RoleHandler(), new CtFieldReference_IS_FINAL_RoleHandler(), new CtElement_IS_IMPLICIT_RoleHandler(), new CtLocalVariable_IS_INFERRED_RoleHandler(), new CtParameter_IS_INFERRED_RoleHandler(), new CtShadowable_IS_SHADOW_RoleHandler(), new CtExecutableReference_IS_STATIC_RoleHandler(), new CtFieldReference_IS_STATIC_RoleHandler(), new CtWildcardReference_IS_UPPER_RoleHandler(), new CtParameter_IS_VARARGS_RoleHandler(), new CtJavaDocTag_JAVADOC_TAG_VALUE_RoleHandler(), new CtStatement_LABEL_RoleHandler(), new CtBinaryOperator_LEFT_OPERAND_RoleHandler(), new CtLiteral_LITERAL_BASE_RoleHandler(), new CtType_METHOD_RoleHandler(), new CtModifiable_MODIFIER_RoleHandler(), new CtModule_MODIFIER_RoleHandler(), new CtModuleRequirement_MODIFIER_RoleHandler(), new CtTypeInformation_MODIFIER_RoleHandler(), new CtModule_MODULE_DIRECTIVE_RoleHandler(), new CtModuleRequirement_MODULE_REF_RoleHandler(), new CtPackageExport_MODULE_REF_RoleHandler(), new CtMultiTypedElement_MULTI_TYPE_RoleHandler(), new CtNamedElement_NAME_RoleHandler(), new CtReference_NAME_RoleHandler(), new CtNewClass_NESTED_TYPE_RoleHandler(), new CtType_NESTED_TYPE_RoleHandler(), new CtModule_OPENED_PACKAGE_RoleHandler(), new CtPackageExport_OPENED_PACKAGE_RoleHandler(), new CtBinaryOperator_OPERATOR_KIND_RoleHandler(), new CtOperatorAssignment_OPERATOR_KIND_RoleHandler(), new CtUnaryOperator_OPERATOR_KIND_RoleHandler(), new CtCompilationUnit_PACKAGE_DECLARATION_RoleHandler(), new CtPackageDeclaration_PACKAGE_REF_RoleHandler(), new CtPackageExport_PACKAGE_REF_RoleHandler(), new CtTypeReference_PACKAGE_REF_RoleHandler(), new CtCatch_PARAMETER_RoleHandler(), new CtExecutable_PARAMETER_RoleHandler(), new CtCasePattern_PATTERN_RoleHandler(), new CtRecordPattern_PATTERN_RoleHandler(), new CtSealable_PERMITTED_TYPE_RoleHandler(), new CtElement_POSITION_RoleHandler(), new CtModule_PROVIDED_SERVICE_RoleHandler(), new CtExecutable_RECEIVER_PARAMETER_RoleHandler(), new CtRecord_RECORD_COMPONENT_RoleHandler(), new CtModule_REQUIRED_MODULE_RoleHandler(), new CtBinaryOperator_RIGHT_OPERAND_RoleHandler(), new CtModule_SERVICE_TYPE_RoleHandler(), new CtProvidedService_SERVICE_TYPE_RoleHandler(), new CtUsedService_SERVICE_TYPE_RoleHandler(), new CtCodeSnippet_SNIPPET_RoleHandler(), new CtStatementList_STATEMENT_RoleHandler(), new CtModule_SUB_PACKAGE_RoleHandler(), new CtPackage_SUB_PACKAGE_RoleHandler(), new CtType_SUPER_TYPE_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 CtTypedElement_TYPE_RoleHandler(), new CtVariableReference_TYPE_RoleHandler(), new CtActualTypeContainer_TYPE_ARGUMENT_RoleHandler(), new CtType_TYPE_MEMBER_RoleHandler(), new CtFormalTypeDeclarer_TYPE_PARAMETER_RoleHandler(), new CtRecordPattern_TYPE_REF_RoleHandler(), new CtTypeMemberWildcardImportReference_TYPE_REF_RoleHandler(), new CtAnnotation_VALUE_RoleHandler(), new CtEnum_VALUE_RoleHandler(), new CtLiteral_VALUE_RoleHandler(), new CtTextBlock_VALUE_RoleHandler(), new CtTypePattern_VARIABLE_RoleHandler(), new CtVariableAccess_VARIABLE_RoleHandler() }; static class CtVariableAccess_VARIABLE_RoleHandler extends SingleHandler> { private CtVariableAccess_VARIABLE_RoleHandler() { @@ -680,6 +681,23 @@ public void setValue(T element, U value) { } } + static class CtExecutable_RECEIVER_PARAMETER_RoleHandler extends SingleHandler { + private CtExecutable_RECEIVER_PARAMETER_RoleHandler() { + super(CtRole.RECEIVER_PARAMETER, CtExecutable.class, CtReceiverParameter.class); + } + + @SuppressWarnings("unchecked") + @Override + public U getValue(T element) { + return ((U) (Object) (castTarget(element).getReceiverParameter())); + } + + @Override + public void setValue(T element, U value) { + castTarget(element).setReceiverParameter(castValue(value)); + } + } + static class CtModule_PROVIDED_SERVICE_RoleHandler extends ListHandler { private CtModule_PROVIDED_SERVICE_RoleHandler() { super(CtRole.PROVIDED_SERVICE, CtModule.class, CtProvidedService.class); diff --git a/src/main/java/spoon/support/reflect/code/CtLambdaImpl.java b/src/main/java/spoon/support/reflect/code/CtLambdaImpl.java index dea209ad086..da71b252a58 100644 --- a/src/main/java/spoon/support/reflect/code/CtLambdaImpl.java +++ b/src/main/java/spoon/support/reflect/code/CtLambdaImpl.java @@ -289,11 +289,13 @@ public CtLambda clone() { } @Override + @UnsettableProperty public CtExecutable setReceiverParameter(CtReceiverParameter receiverParameter) { return this; } @Override + @UnsettableProperty public @Nullable CtReceiverParameter getReceiverParameter() { return null; } From ec62d96f816c666bf5879fe9337b16c3fde9af02 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 25 Mar 2024 22:13:41 +0100 Subject: [PATCH 13/51] Update handling of CtReceiverParameter and implement code refactoring This commit focuses on enhancing CtReceiverParameter handling in the ParentExiter.java and CtExecutableImpl.java files. It includes syntax clean-ups around conditional statements for improved code readability and adherence to coding standards. --- .../support/compiler/jdt/ParentExiter.java | 2 +- .../reflect/declaration/CtExecutableImpl.java | 2 +- .../spoon/reflect/visitor/CtScannerTest.java | 28 ++++---- .../spoon/test/annotation/AnnotationTest.java | 64 ++++--------------- 4 files changed, 29 insertions(+), 67 deletions(-) diff --git a/src/main/java/spoon/support/compiler/jdt/ParentExiter.java b/src/main/java/spoon/support/compiler/jdt/ParentExiter.java index 6b763ae9c49..94a15ac65f7 100644 --- a/src/main/java/spoon/support/compiler/jdt/ParentExiter.java +++ b/src/main/java/spoon/support/compiler/jdt/ParentExiter.java @@ -208,7 +208,7 @@ public void scanCtExecutable(CtExecutable e) { } else if (child instanceof CtBlock && !(e instanceof CtMethod || e instanceof CtConstructor)) { e.setBody((CtBlock) child); return; - } else if(child instanceof CtReceiverParameter) { + } else if (child instanceof CtReceiverParameter) { e.setReceiverParameter((CtReceiverParameter) child); } super.scanCtExecutable(e); diff --git a/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java b/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java index 8be6fd039b3..a6e6e825642 100644 --- a/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java +++ b/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java @@ -198,7 +198,7 @@ public CtExecutable clone() { } public CtExecutable setReceiverParameter(CtReceiverParameter receiverParameter) { - if(receiverParameter == null) { + if (receiverParameter == null) { return this; } getFactory().getEnvironment().getModelChangeListener().onObjectUpdate(this, CtRole.RECEIVER_PARAMETER, receiverParameter, this.receiverParameter); diff --git a/src/test/java/spoon/reflect/visitor/CtScannerTest.java b/src/test/java/spoon/reflect/visitor/CtScannerTest.java index b5188c82c92..2bded36f9da 100644 --- a/src/test/java/spoon/reflect/visitor/CtScannerTest.java +++ b/src/test/java/spoon/reflect/visitor/CtScannerTest.java @@ -17,19 +17,6 @@ package spoon.reflect.visitor; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Comparator; -import java.util.Deque; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - import org.junit.jupiter.api.Test; import spoon.Launcher; import spoon.metamodel.ConceptKind; @@ -53,6 +40,19 @@ import spoon.reflect.visitor.filter.TypeFilter; import spoon.reflect.visitor.processors.CheckScannerTestProcessor; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Comparator; +import java.util.Deque; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -370,7 +370,7 @@ public void scan(CtElement o) { } }.scan(c); // contract: the CtDequeScanner has the context information of the parents - assertEquals(45, l.size()); // we visited the whole tree + assertEquals(47, l.size()); // we visited the whole tree assertEquals(0, l.get(0)); assertEquals(1, l.get(1)); // visiting a child assertEquals(2, l.get(3)); // visiting a grand child diff --git a/src/test/java/spoon/test/annotation/AnnotationTest.java b/src/test/java/spoon/test/annotation/AnnotationTest.java index 334fa92baab..e4c383edcd9 100644 --- a/src/test/java/spoon/test/annotation/AnnotationTest.java +++ b/src/test/java/spoon/test/annotation/AnnotationTest.java @@ -17,19 +17,6 @@ package spoon.test.annotation; -import java.io.File; -import java.io.IOException; -import java.lang.annotation.Annotation; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import java.lang.reflect.Method; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Set; - import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.Test; import spoon.Launcher; @@ -104,8 +91,20 @@ import spoon.test.annotation.testclasses.spring.AliasFor; import spoon.test.annotation.testclasses.typeandfield.SimpleClass; -import static org.hamcrest.MatcherAssert.assertThat; +import java.io.File; +import java.io.IOException; +import java.lang.annotation.Annotation; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; +import java.lang.reflect.Method; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -1130,43 +1129,6 @@ public void testSpoonSpoonResult() { assertEquals("spoon.test.annotation.testclasses.PortRange", annotation.getAnnotationType().getQualifiedName(), "Annotation should be @spoon.test.annotation.testclasses.PortRange"); } - @Test - public void testGetAnnotationFromParameter() { - // contract: Java 8 receiver parameters are handled - Launcher spoon = new Launcher(); - spoon.addInputResource("src/test/resources/noclasspath/Initializer.java"); - String output = "target/spooned-" + this.getClass().getSimpleName() + "-firstspoon/"; - spoon.setSourceOutputDirectory(output); - spoon.getEnvironment().setNoClasspath(true); - Factory factory = spoon.getFactory(); - spoon.buildModel(); - - List methods = factory.getModel().getElements(new NamedElementFilter<>(CtMethod.class, "setField")); - assertThat(methods.size(), is(1)); - - CtMethod methodSet = methods.get(0); - assertThat(methodSet.getSimpleName(), is("setField")); - - List parameters = methodSet.getParameters(); - - assertThat(parameters.size(), is(1)); - - CtParameter thisParameter = parameters.get(0); - assertThat(thisParameter.getSimpleName(), is("this")); - - - CtTypeReference thisParamType = thisParameter.getType(); - assertThat(thisParamType.getSimpleName(), is("Initializer")); - - List> annotations = thisParameter.getType().getAnnotations(); - assertThat(annotations.size(), is(2)); - - CtAnnotation unknownInit = annotations.get(0); - CtAnnotation raw = annotations.get(1); - - assertThat(unknownInit.getAnnotationType().getSimpleName(), is("UnknownInitialization")); - assertThat(raw.getAnnotationType().getSimpleName(), is("Raw")); - } @Test public void annotationAddValue() { From f85b7d94acc772ff7a8218a25e59b00da9b29770 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 25 Mar 2024 23:08:35 +0100 Subject: [PATCH 14/51] doc --- doc/code_elements.md | 13 ------------- .../reflect/declaration/CtReceiverParameter.java | 12 +++++++++++- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/doc/code_elements.md b/doc/code_elements.md index a4f8335f203..35833fb1d57 100644 --- a/doc/code_elements.md +++ b/doc/code_elements.md @@ -571,16 +571,3 @@ int x = switch(i) { // <-- switch expression } ``` - -### CtReceiverParameter -[(javadoc)](http://spoon.gforge.inria.fr/mvnsites/spoon-core/apidocs/spoon/reflect/declaration/CtReceiverParameter.html) - -```java - - // here is the receiver parameter of a method Foo - class Foo { - void bar(Foo this) { - } - } - -``` \ No newline at end of file diff --git a/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java b/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java index 2f0b0f77adb..f36c7d10544 100644 --- a/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java +++ b/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java @@ -9,7 +9,17 @@ import spoon.reflect.reference.CtTypeReference; - +/** + * This element represents a class declaration. + * + *
+ * // Foo this is a receiver parameter
+ * class Foo {
+ *   void bar(Foo this) {
+ *   }
+ * }
+ * 
+ */ public interface CtReceiverParameter extends CtTypedElement, CtShadowable, CtElement { @Override From 2a3c05236f21cd43a3b4afd1bac1674bf697b581 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 25 Mar 2024 23:10:03 +0100 Subject: [PATCH 15/51] doc --- src/main/java/spoon/reflect/factory/CoreFactory.java | 4 ++++ .../java/spoon/reflect/visitor/ElementPrinterHelper.java | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/main/java/spoon/reflect/factory/CoreFactory.java b/src/main/java/spoon/reflect/factory/CoreFactory.java index 513adb7511f..600fab85dbc 100644 --- a/src/main/java/spoon/reflect/factory/CoreFactory.java +++ b/src/main/java/spoon/reflect/factory/CoreFactory.java @@ -655,5 +655,9 @@ BodyHolderSourcePosition createBodyHolderSourcePosition( */ CtRecordPattern createRecordPattern(); + /** + * Creates a receiver parameter. + * @return the created receiver parameter. + */ CtReceiverParameter createReceiverParameter(); } diff --git a/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java b/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java index 8e97a631ee6..39c038b9241 100644 --- a/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java +++ b/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java @@ -146,6 +146,11 @@ public void writeImplementsClause(CtType type) { } } + /** + * Writes the executable parameters of the given executable. This includes the receiver parameter if it is present. + * For example, for a method `void foo(int a, int b)`, this method will write `(int a, int b)`. + * @param executable The executable to write the parameters for. This can be a method, constructor, or lambda. + */ public void writeExecutableParameters(CtExecutable executable) { List parameters = new ArrayList<>(); if (executable.getReceiverParameter() != null) { From eedbdc9a99869c2f878f86316b42a12f7b72312f Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 25 Mar 2024 23:21:06 +0100 Subject: [PATCH 16/51] maybe I am too stupid to read --- .../support/reflect/declaration/CtExecutableImpl.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java b/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java index a6e6e825642..7d1707587f2 100644 --- a/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java +++ b/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java @@ -198,12 +198,11 @@ public CtExecutable clone() { } public CtExecutable setReceiverParameter(CtReceiverParameter receiverParameter) { - if (receiverParameter == null) { - return this; + if (receiverParameter != null) { + receiverParameter.setParent(this); } - getFactory().getEnvironment().getModelChangeListener().onObjectUpdate(this, CtRole.RECEIVER_PARAMETER, receiverParameter, this.receiverParameter); - receiverParameter.setParent(this); this.receiverParameter = receiverParameter; + getFactory().getEnvironment().getModelChangeListener().onObjectUpdate(this, CtRole.RECEIVER_PARAMETER, receiverParameter, this.receiverParameter); return this; } From 25a2324db816f2b9ddf3caebe6b7e44422ffbd10 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 25 Mar 2024 23:32:29 +0100 Subject: [PATCH 17/51] meta meta meta --- src/test/java/spoon/test/api/Metamodel.java | 380 ++++++++++---------- 1 file changed, 198 insertions(+), 182 deletions(-) diff --git a/src/test/java/spoon/test/api/Metamodel.java b/src/test/java/spoon/test/api/Metamodel.java index e20b027d710..49e4b2a2ef1 100644 --- a/src/test/java/spoon/test/api/Metamodel.java +++ b/src/test/java/spoon/test/api/Metamodel.java @@ -16,6 +16,7 @@ */ package spoon.test.api; +import spoon.metamodel.MetamodelConcept; import spoon.reflect.code.CtForEach; import spoon.reflect.declaration.CtClass; import spoon.reflect.declaration.CtElement; @@ -259,9 +260,9 @@ private static void initTypes(List types) { .field(CtRole.COMMENT, false, false) .field(CtRole.CAST, false, false) - )); + )); - types.add(new Type("CtProvidedService", spoon.reflect.declaration.CtProvidedService.class, spoon.support.reflect.declaration.CtProvidedServiceImpl.class, fm -> fm + types.add(new Type("CtProvidedService", spoon.reflect.declaration.CtProvidedService.class, spoon.support.reflect.declaration.CtProvidedServiceImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.COMMENT, false, false) @@ -269,9 +270,9 @@ private static void initTypes(List types) { .field(CtRole.IMPLEMENTATION_TYPE, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtParameter", spoon.reflect.declaration.CtParameter.class, spoon.support.reflect.declaration.CtParameterImpl.class, fm -> fm + types.add(new Type("CtParameter", spoon.reflect.declaration.CtParameter.class, spoon.support.reflect.declaration.CtParameterImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -285,9 +286,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtWhile", spoon.reflect.code.CtWhile.class, spoon.support.reflect.code.CtWhileImpl.class, fm -> fm + types.add(new Type("CtWhile", spoon.reflect.code.CtWhile.class, spoon.support.reflect.code.CtWhileImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -296,9 +297,9 @@ private static void initTypes(List types) { .field(CtRole.BODY, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtTypeReference", spoon.reflect.reference.CtTypeReference.class, spoon.support.reflect.reference.CtTypeReferenceImpl.class, fm -> fm + types.add(new Type("CtTypeReference", spoon.reflect.reference.CtTypeReference.class, spoon.support.reflect.reference.CtTypeReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -312,9 +313,9 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.COMMENT, true, true) - )); + )); - types.add(new Type("CtCatchVariableReference", spoon.reflect.reference.CtCatchVariableReference.class, spoon.support.reflect.reference.CtCatchVariableReferenceImpl.class, fm -> fm + types.add(new Type("CtCatchVariableReference", spoon.reflect.reference.CtCatchVariableReference.class, spoon.support.reflect.reference.CtCatchVariableReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT, true, true) @@ -322,9 +323,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtContinue", spoon.reflect.code.CtContinue.class, spoon.support.reflect.code.CtContinueImpl.class, fm -> fm + types.add(new Type("CtContinue", spoon.reflect.code.CtContinue.class, spoon.support.reflect.code.CtContinueImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.TARGET_LABEL, false, false) @@ -332,9 +333,9 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtInterface", spoon.reflect.declaration.CtInterface.class, spoon.support.reflect.declaration.CtInterfaceImpl.class, fm -> fm + types.add(new Type("CtInterface", spoon.reflect.declaration.CtInterface.class, spoon.support.reflect.declaration.CtInterfaceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -353,9 +354,9 @@ private static void initTypes(List types) { .field(CtRole.PERMITTED_TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtAssignment", spoon.reflect.code.CtAssignment.class, spoon.support.reflect.code.CtAssignmentImpl.class, fm -> fm + types.add(new Type("CtAssignment", spoon.reflect.code.CtAssignment.class, spoon.support.reflect.code.CtAssignmentImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -366,9 +367,9 @@ private static void initTypes(List types) { .field(CtRole.ASSIGNMENT, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtBinaryOperator", spoon.reflect.code.CtBinaryOperator.class, spoon.support.reflect.code.CtBinaryOperatorImpl.class, fm -> fm + types.add(new Type("CtBinaryOperator", spoon.reflect.code.CtBinaryOperator.class, spoon.support.reflect.code.CtBinaryOperatorImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.OPERATOR_KIND, false, false) .field(CtRole.POSITION, false, false) @@ -379,9 +380,9 @@ private static void initTypes(List types) { .field(CtRole.RIGHT_OPERAND, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtEnumValue", spoon.reflect.declaration.CtEnumValue.class, spoon.support.reflect.declaration.CtEnumValueImpl.class, fm -> fm + types.add(new Type("CtEnumValue", spoon.reflect.declaration.CtEnumValue.class, spoon.support.reflect.declaration.CtEnumValueImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -394,9 +395,9 @@ private static void initTypes(List types) { .field(CtRole.DEFAULT_EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtRecordPattern", spoon.reflect.code.CtRecordPattern.class, spoon.support.reflect.code.CtRecordPatternImpl.class, fm -> fm + types.add(new Type("CtRecordPattern", spoon.reflect.code.CtRecordPattern.class, spoon.support.reflect.code.CtRecordPatternImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.CAST, true, true) .field(CtRole.POSITION, false, false) @@ -406,9 +407,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtModuleRequirement", spoon.reflect.declaration.CtModuleRequirement.class, spoon.support.reflect.declaration.CtModuleRequirementImpl.class, fm -> fm + types.add(new Type("CtModuleRequirement", spoon.reflect.declaration.CtModuleRequirement.class, spoon.support.reflect.declaration.CtModuleRequirementImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.MODIFIER, false, false) .field(CtRole.POSITION, false, false) @@ -416,9 +417,9 @@ private static void initTypes(List types) { .field(CtRole.MODULE_REF, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtForEach", spoon.reflect.code.CtForEach.class, spoon.support.reflect.code.CtForEachImpl.class, fm -> fm + types.add(new Type("CtForEach", spoon.reflect.code.CtForEach.class, spoon.support.reflect.code.CtForEachImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -428,9 +429,9 @@ private static void initTypes(List types) { .field(CtRole.BODY, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtConstructor", spoon.reflect.declaration.CtConstructor.class, spoon.support.reflect.declaration.CtConstructorImpl.class, fm -> fm + types.add(new Type("CtConstructor", spoon.reflect.declaration.CtConstructor.class, spoon.support.reflect.declaration.CtConstructorImpl.class, fm -> fm .field(CtRole.NAME, true, true) .field(CtRole.TYPE, true, true) .field(CtRole.IS_SHADOW, false, false) @@ -440,15 +441,16 @@ private static void initTypes(List types) { .field(CtRole.POSITION, false, false) .field(CtRole.COMPACT_CONSTRUCTOR, false, false) .field(CtRole.ANNOTATION, false, false) + .field(CtRole.RECEIVER_PARAMETER, false, false) .field(CtRole.PARAMETER, false, false) .field(CtRole.THROWN, false, false) .field(CtRole.TYPE_PARAMETER, false, false) .field(CtRole.BODY, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtSuperAccess", spoon.reflect.code.CtSuperAccess.class, spoon.support.reflect.code.CtSuperAccessImpl.class, fm -> fm + types.add(new Type("CtSuperAccess", spoon.reflect.code.CtSuperAccess.class, spoon.support.reflect.code.CtSuperAccessImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -458,18 +460,18 @@ private static void initTypes(List types) { .field(CtRole.TARGET, false, false) .field(CtRole.VARIABLE, false, false) - )); + )); - types.add(new Type("CtPackageDeclaration", spoon.reflect.declaration.CtPackageDeclaration.class, spoon.support.reflect.declaration.CtPackageDeclarationImpl.class, fm -> fm + types.add(new Type("CtPackageDeclaration", spoon.reflect.declaration.CtPackageDeclaration.class, spoon.support.reflect.declaration.CtPackageDeclarationImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.COMMENT, false, false) .field(CtRole.ANNOTATION, false, false) .field(CtRole.PACKAGE_REF, false, false) - )); + )); - types.add(new Type("CtAnonymousExecutable", spoon.reflect.declaration.CtAnonymousExecutable.class, spoon.support.reflect.declaration.CtAnonymousExecutableImpl.class, fm -> fm + types.add(new Type("CtAnonymousExecutable", spoon.reflect.declaration.CtAnonymousExecutable.class, spoon.support.reflect.declaration.CtAnonymousExecutableImpl.class, fm -> fm .field(CtRole.NAME, true, true) .field(CtRole.TYPE, true, true) .field(CtRole.IS_IMPLICIT, false, false) @@ -478,13 +480,14 @@ private static void initTypes(List types) { .field(CtRole.MODIFIER, false, false) .field(CtRole.EMODIFIER, true, true) .field(CtRole.POSITION, false, false) + .field(CtRole.RECEIVER_PARAMETER, true, true) .field(CtRole.ANNOTATION, false, false) .field(CtRole.BODY, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtComment", spoon.reflect.code.CtComment.class, spoon.support.reflect.code.CtCommentImpl.class, fm -> fm + types.add(new Type("CtComment", spoon.reflect.code.CtComment.class, spoon.support.reflect.code.CtCommentImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.COMMENT_CONTENT, false, false) @@ -493,9 +496,9 @@ private static void initTypes(List types) { .field(CtRole.COMMENT, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtWildcardReference", spoon.reflect.reference.CtWildcardReference.class, spoon.support.reflect.reference.CtWildcardReferenceImpl.class, fm -> fm + types.add(new Type("CtWildcardReference", spoon.reflect.reference.CtWildcardReference.class, spoon.support.reflect.reference.CtWildcardReferenceImpl.class, fm -> fm .field(CtRole.NAME, true, true) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_UPPER, false, false) @@ -511,9 +514,9 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.BOUNDING_TYPE, false, false) - )); + )); - types.add(new Type("CtThisAccess", spoon.reflect.code.CtThisAccess.class, spoon.support.reflect.code.CtThisAccessImpl.class, fm -> fm + types.add(new Type("CtThisAccess", spoon.reflect.code.CtThisAccess.class, spoon.support.reflect.code.CtThisAccessImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.COMMENT, false, false) @@ -522,9 +525,9 @@ private static void initTypes(List types) { .field(CtRole.CAST, false, false) .field(CtRole.TARGET, false, false) - )); + )); - types.add(new Type("CtRecordComponent", spoon.reflect.declaration.CtRecordComponent.class, spoon.support.reflect.declaration.CtRecordComponentImpl.class, fm -> fm + types.add(new Type("CtRecordComponent", spoon.reflect.declaration.CtRecordComponent.class, spoon.support.reflect.declaration.CtRecordComponentImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -533,9 +536,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtArrayWrite", spoon.reflect.code.CtArrayWrite.class, spoon.support.reflect.code.CtArrayWriteImpl.class, fm -> fm + types.add(new Type("CtArrayWrite", spoon.reflect.code.CtArrayWrite.class, spoon.support.reflect.code.CtArrayWriteImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) @@ -545,18 +548,18 @@ private static void initTypes(List types) { .field(CtRole.EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtPackageReference", spoon.reflect.reference.CtPackageReference.class, spoon.support.reflect.reference.CtPackageReferenceImpl.class, fm -> fm + types.add(new Type("CtPackageReference", spoon.reflect.reference.CtPackageReference.class, spoon.support.reflect.reference.CtPackageReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT, true, true) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtJavaDoc", spoon.reflect.code.CtJavaDoc.class, spoon.support.reflect.code.CtJavaDocImpl.class, fm -> fm + types.add(new Type("CtJavaDoc", spoon.reflect.code.CtJavaDoc.class, spoon.support.reflect.code.CtJavaDocImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.COMMENT_CONTENT, false, false) @@ -566,9 +569,9 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.COMMENT_TAG, false, false) - )); + )); - types.add(new Type("CtArrayRead", spoon.reflect.code.CtArrayRead.class, spoon.support.reflect.code.CtArrayReadImpl.class, fm -> fm + types.add(new Type("CtArrayRead", spoon.reflect.code.CtArrayRead.class, spoon.support.reflect.code.CtArrayReadImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) @@ -578,18 +581,18 @@ private static void initTypes(List types) { .field(CtRole.EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtStatementList", spoon.reflect.code.CtStatementList.class, spoon.support.reflect.code.CtStatementListImpl.class, fm -> fm + types.add(new Type("CtStatementList", spoon.reflect.code.CtStatementList.class, spoon.support.reflect.code.CtStatementListImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) .field(CtRole.STATEMENT, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtVariableWrite", spoon.reflect.code.CtVariableWrite.class, spoon.support.reflect.code.CtVariableWriteImpl.class, fm -> fm + types.add(new Type("CtVariableWrite", spoon.reflect.code.CtVariableWrite.class, spoon.support.reflect.code.CtVariableWriteImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -598,9 +601,9 @@ private static void initTypes(List types) { .field(CtRole.VARIABLE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtCompilationUnit", spoon.reflect.declaration.CtCompilationUnit.class, spoon.support.reflect.declaration.CtCompilationUnitImpl.class, fm -> fm + types.add(new Type("CtCompilationUnit", spoon.reflect.declaration.CtCompilationUnit.class, spoon.support.reflect.declaration.CtCompilationUnitImpl.class, fm -> fm .field(CtRole.DECLARED_TYPE, true, true) .field(CtRole.DECLARED_MODULE, true, true) .field(CtRole.IS_IMPLICIT, false, false) @@ -612,9 +615,9 @@ private static void initTypes(List types) { .field(CtRole.DECLARED_MODULE_REF, false, false) .field(CtRole.DECLARED_TYPE_REF, false, false) - )); + )); - types.add(new Type("CtParameterReference", spoon.reflect.reference.CtParameterReference.class, spoon.support.reflect.reference.CtParameterReferenceImpl.class, fm -> fm + types.add(new Type("CtParameterReference", spoon.reflect.reference.CtParameterReference.class, spoon.support.reflect.reference.CtParameterReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT, true, true) @@ -622,9 +625,19 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtOperatorAssignment", spoon.reflect.code.CtOperatorAssignment.class, spoon.support.reflect.code.CtOperatorAssignmentImpl.class, fm -> fm + types.add(new Type("CtReceiverParameter", spoon.reflect.declaration.CtReceiverParameter.class, spoon.support.reflect.declaration.CtReceiverParameterImpl.class, fm -> fm + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtOperatorAssignment", spoon.reflect.code.CtOperatorAssignment.class, spoon.support.reflect.code.CtOperatorAssignmentImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.OPERATOR_KIND, false, false) @@ -636,9 +649,9 @@ private static void initTypes(List types) { .field(CtRole.ASSIGNMENT, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtAnnotationFieldAccess", spoon.reflect.code.CtAnnotationFieldAccess.class, spoon.support.reflect.code.CtAnnotationFieldAccessImpl.class, fm -> fm + types.add(new Type("CtAnnotationFieldAccess", spoon.reflect.code.CtAnnotationFieldAccess.class, spoon.support.reflect.code.CtAnnotationFieldAccessImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -648,9 +661,9 @@ private static void initTypes(List types) { .field(CtRole.TARGET, false, false) .field(CtRole.VARIABLE, false, false) - )); + )); - types.add(new Type("CtUnboundVariableReference", spoon.reflect.reference.CtUnboundVariableReference.class, spoon.support.reflect.reference.CtUnboundVariableReferenceImpl.class, fm -> fm + types.add(new Type("CtUnboundVariableReference", spoon.reflect.reference.CtUnboundVariableReference.class, spoon.support.reflect.reference.CtUnboundVariableReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT, true, true) @@ -658,9 +671,9 @@ private static void initTypes(List types) { .field(CtRole.POSITION, false, false) .field(CtRole.TYPE, false, false) - )); + )); - types.add(new Type("CtAnnotationMethod", spoon.reflect.declaration.CtAnnotationMethod.class, spoon.support.reflect.declaration.CtAnnotationMethodImpl.class, fm -> fm + types.add(new Type("CtAnnotationMethod", spoon.reflect.declaration.CtAnnotationMethod.class, spoon.support.reflect.declaration.CtAnnotationMethodImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.BODY, true, true) .field(CtRole.IS_SHADOW, false, false) @@ -672,14 +685,15 @@ private static void initTypes(List types) { .field(CtRole.EMODIFIER, true, true) .field(CtRole.TYPE_PARAMETER, true, true) .field(CtRole.POSITION, false, false) + .field(CtRole.RECEIVER_PARAMETER, true, true) .field(CtRole.ANNOTATION, false, false) .field(CtRole.TYPE, false, false) .field(CtRole.DEFAULT_EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtClass", spoon.reflect.declaration.CtClass.class, spoon.support.reflect.declaration.CtClassImpl.class, fm -> fm + types.add(new Type("CtClass", spoon.reflect.declaration.CtClass.class, spoon.support.reflect.declaration.CtClassImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -700,9 +714,9 @@ private static void initTypes(List types) { .field(CtRole.PERMITTED_TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtBlock", spoon.reflect.code.CtBlock.class, spoon.support.reflect.code.CtBlockImpl.class, fm -> fm + types.add(new Type("CtBlock", spoon.reflect.code.CtBlock.class, spoon.support.reflect.code.CtBlockImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -710,9 +724,9 @@ private static void initTypes(List types) { .field(CtRole.STATEMENT, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtPackage", spoon.reflect.declaration.CtPackage.class, spoon.support.reflect.declaration.CtPackageImpl.class, fm -> fm + types.add(new Type("CtPackage", spoon.reflect.declaration.CtPackage.class, spoon.support.reflect.declaration.CtPackageImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -722,9 +736,9 @@ private static void initTypes(List types) { .field(CtRole.CONTAINED_TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtTryWithResource", spoon.reflect.code.CtTryWithResource.class, spoon.support.reflect.code.CtTryWithResourceImpl.class, fm -> fm + types.add(new Type("CtTryWithResource", spoon.reflect.code.CtTryWithResource.class, spoon.support.reflect.code.CtTryWithResourceImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -735,9 +749,9 @@ private static void initTypes(List types) { .field(CtRole.FINALIZER, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtAssert", spoon.reflect.code.CtAssert.class, spoon.support.reflect.code.CtAssertImpl.class, fm -> fm + types.add(new Type("CtAssert", spoon.reflect.code.CtAssert.class, spoon.support.reflect.code.CtAssertImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -746,9 +760,9 @@ private static void initTypes(List types) { .field(CtRole.EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtSwitch", spoon.reflect.code.CtSwitch.class, spoon.support.reflect.code.CtSwitchImpl.class, fm -> fm + types.add(new Type("CtSwitch", spoon.reflect.code.CtSwitch.class, spoon.support.reflect.code.CtSwitchImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -757,9 +771,9 @@ private static void initTypes(List types) { .field(CtRole.CASE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtTry", spoon.reflect.code.CtTry.class, spoon.support.reflect.code.CtTryImpl.class, fm -> fm + types.add(new Type("CtTry", spoon.reflect.code.CtTry.class, spoon.support.reflect.code.CtTryImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -769,9 +783,9 @@ private static void initTypes(List types) { .field(CtRole.FINALIZER, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtYieldStatement", spoon.reflect.code.CtYieldStatement.class, spoon.support.reflect.code.CtYieldStatementImpl.class, fm -> fm + types.add(new Type("CtYieldStatement", spoon.reflect.code.CtYieldStatement.class, spoon.support.reflect.code.CtYieldStatementImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -779,9 +793,9 @@ private static void initTypes(List types) { .field(CtRole.EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtSynchronized", spoon.reflect.code.CtSynchronized.class, spoon.support.reflect.code.CtSynchronizedImpl.class, fm -> fm + types.add(new Type("CtSynchronized", spoon.reflect.code.CtSynchronized.class, spoon.support.reflect.code.CtSynchronizedImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -790,9 +804,9 @@ private static void initTypes(List types) { .field(CtRole.BODY, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtTypeParameterReference", spoon.reflect.reference.CtTypeParameterReference.class, spoon.support.reflect.reference.CtTypeParameterReferenceImpl.class, fm -> fm + types.add(new Type("CtTypeParameterReference", spoon.reflect.reference.CtTypeParameterReference.class, spoon.support.reflect.reference.CtTypeParameterReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -806,18 +820,18 @@ private static void initTypes(List types) { .field(CtRole.DECLARING_TYPE, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtImport", spoon.reflect.declaration.CtImport.class, spoon.support.reflect.declaration.CtImportImpl.class, fm -> fm + types.add(new Type("CtImport", spoon.reflect.declaration.CtImport.class, spoon.support.reflect.declaration.CtImportImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.IMPORT_REFERENCE, false, false) .field(CtRole.ANNOTATION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtInvocation", spoon.reflect.code.CtInvocation.class, spoon.support.reflect.code.CtInvocationImpl.class, fm -> fm + types.add(new Type("CtInvocation", spoon.reflect.code.CtInvocation.class, spoon.support.reflect.code.CtInvocationImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) @@ -830,9 +844,9 @@ private static void initTypes(List types) { .field(CtRole.ARGUMENT, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtCodeSnippetExpression", spoon.reflect.code.CtCodeSnippetExpression.class, spoon.support.reflect.code.CtCodeSnippetExpressionImpl.class, fm -> fm + types.add(new Type("CtCodeSnippetExpression", spoon.reflect.code.CtCodeSnippetExpression.class, spoon.support.reflect.code.CtCodeSnippetExpressionImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.SNIPPET, false, false) @@ -841,9 +855,9 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.CAST, false, false) - )); + )); - types.add(new Type("CtFieldWrite", spoon.reflect.code.CtFieldWrite.class, spoon.support.reflect.code.CtFieldWriteImpl.class, fm -> fm + types.add(new Type("CtFieldWrite", spoon.reflect.code.CtFieldWrite.class, spoon.support.reflect.code.CtFieldWriteImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -853,9 +867,9 @@ private static void initTypes(List types) { .field(CtRole.VARIABLE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtUnaryOperator", spoon.reflect.code.CtUnaryOperator.class, spoon.support.reflect.code.CtUnaryOperatorImpl.class, fm -> fm + types.add(new Type("CtUnaryOperator", spoon.reflect.code.CtUnaryOperator.class, spoon.support.reflect.code.CtUnaryOperatorImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.OPERATOR_KIND, false, false) @@ -866,9 +880,9 @@ private static void initTypes(List types) { .field(CtRole.EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtExecutableReference", spoon.reflect.reference.CtExecutableReference.class, spoon.support.reflect.reference.CtExecutableReferenceImpl.class, fm -> fm + types.add(new Type("CtExecutableReference", spoon.reflect.reference.CtExecutableReference.class, spoon.support.reflect.reference.CtExecutableReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_STATIC, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -880,9 +894,9 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.COMMENT, true, true) - )); + )); - types.add(new Type("CtFor", spoon.reflect.code.CtFor.class, spoon.support.reflect.code.CtForImpl.class, fm -> fm + types.add(new Type("CtFor", spoon.reflect.code.CtFor.class, spoon.support.reflect.code.CtForImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -893,9 +907,9 @@ private static void initTypes(List types) { .field(CtRole.BODY, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtVariableRead", spoon.reflect.code.CtVariableRead.class, spoon.support.reflect.code.CtVariableReadImpl.class, fm -> fm + types.add(new Type("CtVariableRead", spoon.reflect.code.CtVariableRead.class, spoon.support.reflect.code.CtVariableReadImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -904,9 +918,9 @@ private static void initTypes(List types) { .field(CtRole.VARIABLE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtTypeParameter", spoon.reflect.declaration.CtTypeParameter.class, spoon.support.reflect.declaration.CtTypeParameterImpl.class, fm -> fm + types.add(new Type("CtTypeParameter", spoon.reflect.declaration.CtTypeParameter.class, spoon.support.reflect.declaration.CtTypeParameterImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -923,9 +937,9 @@ private static void initTypes(List types) { .field(CtRole.SUPER_TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtLocalVariable", spoon.reflect.code.CtLocalVariable.class, spoon.support.reflect.code.CtLocalVariableImpl.class, fm -> fm + types.add(new Type("CtLocalVariable", spoon.reflect.code.CtLocalVariable.class, spoon.support.reflect.code.CtLocalVariableImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) @@ -939,9 +953,9 @@ private static void initTypes(List types) { .field(CtRole.DEFAULT_EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtIf", spoon.reflect.code.CtIf.class, spoon.support.reflect.code.CtIfImpl.class, fm -> fm + types.add(new Type("CtIf", spoon.reflect.code.CtIf.class, spoon.support.reflect.code.CtIfImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -951,9 +965,9 @@ private static void initTypes(List types) { .field(CtRole.ELSE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtRecord", spoon.reflect.declaration.CtRecord.class, spoon.support.reflect.declaration.CtRecordImpl.class, fm -> fm + types.add(new Type("CtRecord", spoon.reflect.declaration.CtRecord.class, spoon.support.reflect.declaration.CtRecordImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -975,9 +989,9 @@ private static void initTypes(List types) { .field(CtRole.RECORD_COMPONENT, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtModule", spoon.reflect.declaration.CtModule.class, spoon.support.reflect.declaration.CtModuleImpl.class, fm -> fm + types.add(new Type("CtModule", spoon.reflect.declaration.CtModule.class, spoon.support.reflect.declaration.CtModuleImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.MODIFIER, false, false) @@ -992,9 +1006,9 @@ private static void initTypes(List types) { .field(CtRole.MODULE_DIRECTIVE, false, false) .field(CtRole.SUB_PACKAGE, false, false) - )); + )); - types.add(new Type("CtSwitchExpression", spoon.reflect.code.CtSwitchExpression.class, spoon.support.reflect.code.CtSwitchExpressionImpl.class, fm -> fm + types.add(new Type("CtSwitchExpression", spoon.reflect.code.CtSwitchExpression.class, spoon.support.reflect.code.CtSwitchExpressionImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) @@ -1004,9 +1018,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.CAST, false, false) - )); + )); - types.add(new Type("CtPackageExport", spoon.reflect.declaration.CtPackageExport.class, spoon.support.reflect.declaration.CtPackageExportImpl.class, fm -> fm + types.add(new Type("CtPackageExport", spoon.reflect.declaration.CtPackageExport.class, spoon.support.reflect.declaration.CtPackageExportImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.OPENED_PACKAGE, false, false) @@ -1015,9 +1029,9 @@ private static void initTypes(List types) { .field(CtRole.MODULE_REF, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtConstructorCall", spoon.reflect.code.CtConstructorCall.class, spoon.support.reflect.code.CtConstructorCallImpl.class, fm -> fm + types.add(new Type("CtConstructorCall", spoon.reflect.code.CtConstructorCall.class, spoon.support.reflect.code.CtConstructorCallImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) @@ -1030,9 +1044,9 @@ private static void initTypes(List types) { .field(CtRole.ARGUMENT, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtCase", spoon.reflect.code.CtCase.class, spoon.support.reflect.code.CtCaseImpl.class, fm -> fm + types.add(new Type("CtCase", spoon.reflect.code.CtCase.class, spoon.support.reflect.code.CtCaseImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.DEFAULT_EXPRESSION, false, false) .field(CtRole.LABEL, false, false) @@ -1043,18 +1057,18 @@ private static void initTypes(List types) { .field(CtRole.STATEMENT, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtModuleReference", spoon.reflect.reference.CtModuleReference.class, spoon.support.reflect.reference.CtModuleReferenceImpl.class, fm -> fm + types.add(new Type("CtModuleReference", spoon.reflect.reference.CtModuleReference.class, spoon.support.reflect.reference.CtModuleReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT, true, true) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtCatch", spoon.reflect.code.CtCatch.class, spoon.support.reflect.code.CtCatchImpl.class, fm -> fm + types.add(new Type("CtCatch", spoon.reflect.code.CtCatch.class, spoon.support.reflect.code.CtCatchImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) @@ -1062,9 +1076,9 @@ private static void initTypes(List types) { .field(CtRole.BODY, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtArrayTypeReference", spoon.reflect.reference.CtArrayTypeReference.class, spoon.support.reflect.reference.CtArrayTypeReferenceImpl.class, fm -> fm + types.add(new Type("CtArrayTypeReference", spoon.reflect.reference.CtArrayTypeReference.class, spoon.support.reflect.reference.CtArrayTypeReferenceImpl.class, fm -> fm .field(CtRole.NAME, true, true) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -1079,9 +1093,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE_ARGUMENT, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtMethod", spoon.reflect.declaration.CtMethod.class, spoon.support.reflect.declaration.CtMethodImpl.class, fm -> fm + types.add(new Type("CtMethod", spoon.reflect.declaration.CtMethod.class, spoon.support.reflect.declaration.CtMethodImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -1092,18 +1106,20 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.TYPE_PARAMETER, false, false) .field(CtRole.TYPE, false, false) + .field(CtRole.RECEIVER_PARAMETER, false, false) .field(CtRole.PARAMETER, false, false) .field(CtRole.THROWN, false, false) .field(CtRole.BODY, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtLambda", spoon.reflect.code.CtLambda.class, spoon.support.reflect.code.CtLambdaImpl.class, fm -> fm + types.add(new Type("CtLambda", spoon.reflect.code.CtLambda.class, spoon.support.reflect.code.CtLambdaImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.THROWN, true, true) .field(CtRole.POSITION, false, false) + .field(CtRole.RECEIVER_PARAMETER, true, true) .field(CtRole.ANNOTATION, false, false) .field(CtRole.TYPE, false, false) .field(CtRole.CAST, false, false) @@ -1112,9 +1128,9 @@ private static void initTypes(List types) { .field(CtRole.EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtTypePattern", spoon.reflect.code.CtTypePattern.class, spoon.support.reflect.code.CtTypePatternImpl.class, fm -> fm + types.add(new Type("CtTypePattern", spoon.reflect.code.CtTypePattern.class, spoon.support.reflect.code.CtTypePatternImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.CAST, true, true) .field(CtRole.POSITION, false, false) @@ -1123,9 +1139,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtNewArray", spoon.reflect.code.CtNewArray.class, spoon.support.reflect.code.CtNewArrayImpl.class, fm -> fm + types.add(new Type("CtNewArray", spoon.reflect.code.CtNewArray.class, spoon.support.reflect.code.CtNewArrayImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) @@ -1135,9 +1151,9 @@ private static void initTypes(List types) { .field(CtRole.DIMENSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtIntersectionTypeReference", spoon.reflect.reference.CtIntersectionTypeReference.class, spoon.support.reflect.reference.CtIntersectionTypeReferenceImpl.class, fm -> fm + types.add(new Type("CtIntersectionTypeReference", spoon.reflect.reference.CtIntersectionTypeReference.class, spoon.support.reflect.reference.CtIntersectionTypeReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -1152,18 +1168,18 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.BOUND, false, false) - )); + )); - types.add(new Type("CtUsedService", spoon.reflect.declaration.CtUsedService.class, spoon.support.reflect.declaration.CtUsedServiceImpl.class, fm -> fm + types.add(new Type("CtUsedService", spoon.reflect.declaration.CtUsedService.class, spoon.support.reflect.declaration.CtUsedServiceImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.COMMENT, false, false) .field(CtRole.SERVICE_TYPE, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtTextBlock", spoon.reflect.code.CtTextBlock.class, spoon.support.reflect.code.CtTextBlockImpl.class, fm -> fm + types.add(new Type("CtTextBlock", spoon.reflect.code.CtTextBlock.class, spoon.support.reflect.code.CtTextBlockImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.VALUE, false, false) .field(CtRole.POSITION, false, false) @@ -1173,9 +1189,9 @@ private static void initTypes(List types) { .field(CtRole.CAST, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtThrow", spoon.reflect.code.CtThrow.class, spoon.support.reflect.code.CtThrowImpl.class, fm -> fm + types.add(new Type("CtThrow", spoon.reflect.code.CtThrow.class, spoon.support.reflect.code.CtThrowImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -1183,9 +1199,9 @@ private static void initTypes(List types) { .field(CtRole.EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtLiteral", spoon.reflect.code.CtLiteral.class, spoon.support.reflect.code.CtLiteralImpl.class, fm -> fm + types.add(new Type("CtLiteral", spoon.reflect.code.CtLiteral.class, spoon.support.reflect.code.CtLiteralImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.VALUE, false, false) .field(CtRole.POSITION, false, false) @@ -1195,9 +1211,9 @@ private static void initTypes(List types) { .field(CtRole.CAST, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtReturn", spoon.reflect.code.CtReturn.class, spoon.support.reflect.code.CtReturnImpl.class, fm -> fm + types.add(new Type("CtReturn", spoon.reflect.code.CtReturn.class, spoon.support.reflect.code.CtReturnImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -1205,9 +1221,9 @@ private static void initTypes(List types) { .field(CtRole.EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtField", spoon.reflect.declaration.CtField.class, spoon.support.reflect.declaration.CtFieldImpl.class, fm -> fm + types.add(new Type("CtField", spoon.reflect.declaration.CtField.class, spoon.support.reflect.declaration.CtFieldImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -1220,9 +1236,9 @@ private static void initTypes(List types) { .field(CtRole.DEFAULT_EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtJavaDocTag", spoon.reflect.code.CtJavaDocTag.class, spoon.support.reflect.code.CtJavaDocTagImpl.class, fm -> fm + types.add(new Type("CtJavaDocTag", spoon.reflect.code.CtJavaDocTag.class, spoon.support.reflect.code.CtJavaDocTagImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT_CONTENT, false, false) .field(CtRole.DOCUMENTATION_TYPE, false, false) @@ -1232,9 +1248,9 @@ private static void initTypes(List types) { .field(CtRole.COMMENT, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtTypeAccess", spoon.reflect.code.CtTypeAccess.class, spoon.support.reflect.code.CtTypeAccessImpl.class, fm -> fm + types.add(new Type("CtTypeAccess", spoon.reflect.code.CtTypeAccess.class, spoon.support.reflect.code.CtTypeAccessImpl.class, fm -> fm .field(CtRole.TYPE, true, true) .field(CtRole.IS_IMPLICIT, true, false) .field(CtRole.POSITION, false, false) @@ -1243,9 +1259,9 @@ private static void initTypes(List types) { .field(CtRole.ACCESSED_TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtCodeSnippetStatement", spoon.reflect.code.CtCodeSnippetStatement.class, spoon.support.reflect.code.CtCodeSnippetStatementImpl.class, fm -> fm + types.add(new Type("CtCodeSnippetStatement", spoon.reflect.code.CtCodeSnippetStatement.class, spoon.support.reflect.code.CtCodeSnippetStatementImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -1253,9 +1269,9 @@ private static void initTypes(List types) { .field(CtRole.COMMENT, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtDo", spoon.reflect.code.CtDo.class, spoon.support.reflect.code.CtDoImpl.class, fm -> fm + types.add(new Type("CtDo", spoon.reflect.code.CtDo.class, spoon.support.reflect.code.CtDoImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -1264,9 +1280,9 @@ private static void initTypes(List types) { .field(CtRole.BODY, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtTypeMemberWildcardImportReference", spoon.reflect.reference.CtTypeMemberWildcardImportReference.class, spoon.support.reflect.reference.CtTypeMemberWildcardImportReferenceImpl.class, fm -> fm + types.add(new Type("CtTypeMemberWildcardImportReference", spoon.reflect.reference.CtTypeMemberWildcardImportReference.class, spoon.support.reflect.reference.CtTypeMemberWildcardImportReferenceImpl.class, fm -> fm .field(CtRole.NAME, true, true) .field(CtRole.IS_IMPLICIT, true, true) .field(CtRole.COMMENT, true, true) @@ -1274,9 +1290,9 @@ private static void initTypes(List types) { .field(CtRole.POSITION, false, false) .field(CtRole.TYPE_REF, false, false) - )); + )); - types.add(new Type("CtAnnotation", spoon.reflect.declaration.CtAnnotation.class, spoon.support.reflect.declaration.CtAnnotationImpl.class, fm -> fm + types.add(new Type("CtAnnotation", spoon.reflect.declaration.CtAnnotation.class, spoon.support.reflect.declaration.CtAnnotationImpl.class, fm -> fm .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.CAST, true, true) @@ -1287,9 +1303,9 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.VALUE, false, false) - )); + )); - types.add(new Type("CtFieldRead", spoon.reflect.code.CtFieldRead.class, spoon.support.reflect.code.CtFieldReadImpl.class, fm -> fm + types.add(new Type("CtFieldRead", spoon.reflect.code.CtFieldRead.class, spoon.support.reflect.code.CtFieldReadImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -1299,9 +1315,9 @@ private static void initTypes(List types) { .field(CtRole.VARIABLE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtBreak", spoon.reflect.code.CtBreak.class, spoon.support.reflect.code.CtBreakImpl.class, fm -> fm + types.add(new Type("CtBreak", spoon.reflect.code.CtBreak.class, spoon.support.reflect.code.CtBreakImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.TARGET_LABEL, false, false) @@ -1309,9 +1325,9 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtFieldReference", spoon.reflect.reference.CtFieldReference.class, spoon.support.reflect.reference.CtFieldReferenceImpl.class, fm -> fm + types.add(new Type("CtFieldReference", spoon.reflect.reference.CtFieldReference.class, spoon.support.reflect.reference.CtFieldReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_FINAL, false, false) .field(CtRole.IS_STATIC, false, false) @@ -1322,9 +1338,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtEnum", spoon.reflect.declaration.CtEnum.class, spoon.support.reflect.declaration.CtEnumImpl.class, fm -> fm + types.add(new Type("CtEnum", spoon.reflect.declaration.CtEnum.class, spoon.support.reflect.declaration.CtEnumImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -1346,21 +1362,21 @@ private static void initTypes(List types) { .field(CtRole.VALUE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtCasePattern", spoon.reflect.code.CtCasePattern.class, spoon.support.reflect.code.CtCasePatternImpl.class, fm -> fm + types.add(new Type("CtCasePattern", spoon.reflect.code.CtCasePattern.class, spoon.support.reflect.code.CtCasePatternImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.CAST, false, false) .field(CtRole.POSITION, false, false) + .field(CtRole.CAST, false, false) .field(CtRole.ANNOTATION, false, false) .field(CtRole.PATTERN, false, false) .field(CtRole.CONDITION, false, false) .field(CtRole.TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtNewClass", spoon.reflect.code.CtNewClass.class, spoon.support.reflect.code.CtNewClassImpl.class, fm -> fm + types.add(new Type("CtNewClass", spoon.reflect.code.CtNewClass.class, spoon.support.reflect.code.CtNewClassImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) @@ -1374,9 +1390,9 @@ private static void initTypes(List types) { .field(CtRole.NESTED_TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtLocalVariableReference", spoon.reflect.reference.CtLocalVariableReference.class, spoon.support.reflect.reference.CtLocalVariableReferenceImpl.class, fm -> fm + types.add(new Type("CtLocalVariableReference", spoon.reflect.reference.CtLocalVariableReference.class, spoon.support.reflect.reference.CtLocalVariableReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT, true, true) @@ -1384,9 +1400,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtAnnotationType", spoon.reflect.declaration.CtAnnotationType.class, spoon.support.reflect.declaration.CtAnnotationTypeImpl.class, fm -> fm + types.add(new Type("CtAnnotationType", spoon.reflect.declaration.CtAnnotationType.class, spoon.support.reflect.declaration.CtAnnotationTypeImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -1403,9 +1419,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE_MEMBER, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtCatchVariable", spoon.reflect.code.CtCatchVariable.class, spoon.support.reflect.code.CtCatchVariableImpl.class, fm -> fm + types.add(new Type("CtCatchVariable", spoon.reflect.code.CtCatchVariable.class, spoon.support.reflect.code.CtCatchVariableImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.TYPE, true, true) .field(CtRole.IS_IMPLICIT, false, false) @@ -1417,9 +1433,9 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.MULTI_TYPE, false, false) - )); + )); - types.add(new Type("CtExecutableReferenceExpression", spoon.reflect.code.CtExecutableReferenceExpression.class, spoon.support.reflect.code.CtExecutableReferenceExpressionImpl.class, fm -> fm + types.add(new Type("CtExecutableReferenceExpression", spoon.reflect.code.CtExecutableReferenceExpression.class, spoon.support.reflect.code.CtExecutableReferenceExpressionImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.COMMENT, false, false) @@ -1429,6 +1445,6 @@ private static void initTypes(List types) { .field(CtRole.EXECUTABLE_REF, false, false) .field(CtRole.TARGET, false, false) - )); + )); } } From 445af0b105691ce281e5e86c58e0998f5857a827 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Tue, 26 Mar 2024 19:50:03 +0100 Subject: [PATCH 18/51] Update expected counts in CtScannerTest This commit adjusts the expected values for the number of elements, entry points, and exit points in the CtScannerTest. This change ensures the test accurately reflects the current state of the source code, thus maintaining the precision of the test results. --- src/test/java/spoon/reflect/visitor/CtScannerTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/spoon/reflect/visitor/CtScannerTest.java b/src/test/java/spoon/reflect/visitor/CtScannerTest.java index 2bded36f9da..04bc429633e 100644 --- a/src/test/java/spoon/reflect/visitor/CtScannerTest.java +++ b/src/test/java/spoon/reflect/visitor/CtScannerTest.java @@ -271,7 +271,7 @@ public void exit(CtElement o) { // this is a coarse-grain check to see if the scanner changes // no more exec ref in paramref // also takes into account the comments - assertEquals(3667, counter.nElement + countOfCommentsInCompilationUnits); + assertEquals(3704, counter.nElement + countOfCommentsInCompilationUnits); assertEquals(2449, counter.nEnter + countOfCommentsInCompilationUnits); assertEquals(2449, counter.nExit + countOfCommentsInCompilationUnits); From 6fc0a88f108cd61122edd77d7c6bc06b5b54073e Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Tue, 26 Mar 2024 20:09:44 +0100 Subject: [PATCH 19/51] Normalize indentation in CtReceiverParameter.java The commit fixes the formatting inconsistency in the CtReceiverParameter.java file. The modified lines include the declarations for getType() and clone() methods, where indentation has been changed to conform to project's coding style. --- .../spoon/reflect/declaration/CtReceiverParameter.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java b/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java index f36c7d10544..b5a7af72d24 100644 --- a/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java +++ b/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java @@ -22,10 +22,10 @@ */ public interface CtReceiverParameter extends CtTypedElement, CtShadowable, CtElement { - @Override - CtTypeReference getType(); + @Override + CtTypeReference getType(); - @Override - CtReceiverParameter clone(); + @Override + CtReceiverParameter clone(); } From ad7c08ac6dadc4a7a8816ccb8df885c0c973f90c Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Tue, 26 Mar 2024 20:20:32 +0100 Subject: [PATCH 20/51] up --- src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java | 2 +- .../support/reflect/declaration/CtReceiverParameterImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java b/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java index 39c038b9241..007ae06807e 100644 --- a/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java +++ b/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java @@ -159,7 +159,7 @@ public void writeExecutableParameters(CtExecutable executable) { parameters.addAll(executable.getParameters()); printList(parameters, null, false, "(", false, false, ",", true, false, ")", - prettyPrinter::scan); + prettyPrinter::scan); } /** writes the thrown exception with a ListPrinter */ diff --git a/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java b/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java index 867263ce65a..738f166ec07 100644 --- a/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java +++ b/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java @@ -50,7 +50,7 @@ public C setType(CtTypeReference type) { @Override public void accept(CtVisitor visitor) { - visitor.visitCtReceiverParameter(this); + visitor.visitCtReceiverParameter(this); } @Override From 5e0e8722956e24bd8fa437a5f05a852f1321d6da Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Tue, 26 Mar 2024 20:25:41 +0100 Subject: [PATCH 21/51] up --- .../reflect/meta/impl/ModelRoleHandlers.java | 6 +++--- .../reflect/visitor/CtBiScannerDefault.java | 17 ++++------------- .../support/visitor/clone/CloneBuilder.java | 7 +++++++ .../support/visitor/clone/CloneVisitor.java | 7 +++++++ .../visitor/replace/ReplacementVisitor.java | 7 +++++++ 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java b/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java index 86660f492a1..a248f3d5eb3 100644 --- a/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java +++ b/src/main/java/spoon/reflect/meta/impl/ModelRoleHandlers.java @@ -1,9 +1,9 @@ -/** +/* * SPDX-License-Identifier: (MIT OR CECILL-C) * - * Copyright (C) 2006-2019 INRIA and contributors + * Copyright (C) 2006-2023 INRIA and contributors * - * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) of the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. + * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. */ package spoon.reflect.meta.impl; diff --git a/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java b/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java index 939d96e10c4..c5f4745f3da 100644 --- a/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java +++ b/src/main/java/spoon/reflect/visitor/CtBiScannerDefault.java @@ -1,18 +1,9 @@ -/** - * Copyright (C) 2006-2018 INRIA and contributors - * Spoon - http://spoon.gforge.inria.fr/ - * - * This software is governed by the CeCILL-C License under French law and - * abiding by the rules of distribution of free software. You can use, modify - * and/or redistribute the software under the terms of the CeCILL-C license as - * circulated by CEA, CNRS and INRIA at http://www.cecill.info. +/* + * SPDX-License-Identifier: (MIT OR CECILL-C) * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL-C License for more details. + * Copyright (C) 2006-2023 INRIA and contributors * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL-C license and that you accept its terms. + * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. */ package spoon.reflect.visitor; /** diff --git a/src/main/java/spoon/support/visitor/clone/CloneBuilder.java b/src/main/java/spoon/support/visitor/clone/CloneBuilder.java index e5b1d0afb04..87a93040fb4 100644 --- a/src/main/java/spoon/support/visitor/clone/CloneBuilder.java +++ b/src/main/java/spoon/support/visitor/clone/CloneBuilder.java @@ -1,3 +1,10 @@ +/* + * SPDX-License-Identifier: (MIT OR CECILL-C) + * + * Copyright (C) 2006-2023 INRIA and contributors + * + * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. + */ /* SPDX-License-Identifier: (MIT OR CECILL-C) Copyright (C) 2006-2023 INRIA and contributors diff --git a/src/main/java/spoon/support/visitor/clone/CloneVisitor.java b/src/main/java/spoon/support/visitor/clone/CloneVisitor.java index 142ffe64423..d11bbb6bba1 100644 --- a/src/main/java/spoon/support/visitor/clone/CloneVisitor.java +++ b/src/main/java/spoon/support/visitor/clone/CloneVisitor.java @@ -1,3 +1,10 @@ +/* + * SPDX-License-Identifier: (MIT OR CECILL-C) + * + * Copyright (C) 2006-2023 INRIA and contributors + * + * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. + */ /* SPDX-License-Identifier: (MIT OR CECILL-C) Copyright (C) 2006-2023 INRIA and contributors diff --git a/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java b/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java index 1d5c7f6da8f..5e8966ffc75 100644 --- a/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java +++ b/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java @@ -1,3 +1,10 @@ +/* + * SPDX-License-Identifier: (MIT OR CECILL-C) + * + * Copyright (C) 2006-2023 INRIA and contributors + * + * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. + */ /* SPDX-License-Identifier: (MIT OR CECILL-C) Copyright (C) 2006-2019 INRIA and contributors From 2e567384ff5e0ec68b5262226d1586ed746610a6 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Thu, 28 Mar 2024 18:31:03 +0100 Subject: [PATCH 22/51] imports --- src/main/java/spoon/metamodel/Metamodel.java | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/spoon/metamodel/Metamodel.java b/src/main/java/spoon/metamodel/Metamodel.java index 673390cd69d..66d3fba2230 100644 --- a/src/main/java/spoon/metamodel/Metamodel.java +++ b/src/main/java/spoon/metamodel/Metamodel.java @@ -7,6 +7,18 @@ */ package spoon.metamodel; +import java.io.File; +import java.lang.annotation.Annotation; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + import org.jspecify.annotations.Nullable; import spoon.Launcher; import spoon.SpoonException; @@ -35,18 +47,6 @@ import spoon.support.adaption.TypeAdaptor; import spoon.support.compiler.FileSystemFolder; -import java.io.File; -import java.lang.annotation.Annotation; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - /** * Represents the Spoon metamodel (incl. at runtime) */ From b6b55de3781a92100da735ce8eb913c139abda03 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Thu, 28 Mar 2024 18:46:42 +0100 Subject: [PATCH 23/51] Reorganize import statements across multiple files Import statements have been restructured and organizing across multiple files to enhance readability and maintainability. Redundancy was reduced with wildcard usage when importing multiple classes from the same package. Some changes to variable visibility were also made for better encapsulation. --- src/main/java/spoon/metamodel/Metamodel.java | 1 + .../spoon/reflect/declaration/CtMethod.java | 4 +- .../spoon/reflect/factory/CoreFactory.java | 4 +- .../reflect/factory/ExecutableFactory.java | 3 +- src/main/java/spoon/reflect/path/CtRole.java | 10 ++--- .../java/spoon/reflect/visitor/CtScanner.java | 10 ++--- .../java/spoon/reflect/visitor/CtVisitor.java | 4 +- .../spoon/support/DefaultCoreFactory.java | 8 ++-- .../support/compiler/jdt/JDTTreeBuilder.java | 11 ++---- .../reflect/declaration/CtMethodImpl.java | 14 +++---- .../declaration/CtReceiverParameterImpl.java | 4 +- .../spoon/reflect/visitor/CtScannerTest.java | 33 +++++++--------- .../spoon/test/annotation/AnnotationTest.java | 39 +++++++------------ 13 files changed, 64 insertions(+), 81 deletions(-) diff --git a/src/main/java/spoon/metamodel/Metamodel.java b/src/main/java/spoon/metamodel/Metamodel.java index 66d3fba2230..57f84aaa231 100644 --- a/src/main/java/spoon/metamodel/Metamodel.java +++ b/src/main/java/spoon/metamodel/Metamodel.java @@ -20,6 +20,7 @@ import java.util.Set; import org.jspecify.annotations.Nullable; + import spoon.Launcher; import spoon.SpoonException; import spoon.reflect.annotations.PropertyGetter; diff --git a/src/main/java/spoon/reflect/declaration/CtMethod.java b/src/main/java/spoon/reflect/declaration/CtMethod.java index 26c0c7fb6c5..29c0eec53eb 100644 --- a/src/main/java/spoon/reflect/declaration/CtMethod.java +++ b/src/main/java/spoon/reflect/declaration/CtMethod.java @@ -7,12 +7,11 @@ */ package spoon.reflect.declaration; +import java.util.Collection; import spoon.refactoring.Refactoring; import spoon.reflect.annotations.PropertyGetter; import spoon.reflect.annotations.PropertySetter; -import java.util.Collection; - import static spoon.reflect.path.CtRole.IS_DEFAULT; @@ -61,4 +60,5 @@ public interface CtMethod extends CtExecutable, CtFormalTypeDeclarer, CtSh * If you want to rename the new method, use {@link Refactoring#changeMethodName(CtMethod, String)} (and not {@link #setSimpleName(String)}, which does not update the references) */ CtMethod copyMethod(); + } diff --git a/src/main/java/spoon/reflect/factory/CoreFactory.java b/src/main/java/spoon/reflect/factory/CoreFactory.java index 600fab85dbc..19f27026089 100644 --- a/src/main/java/spoon/reflect/factory/CoreFactory.java +++ b/src/main/java/spoon/reflect/factory/CoreFactory.java @@ -7,6 +7,8 @@ */ package spoon.reflect.factory; +import java.lang.annotation.Annotation; + import spoon.reflect.code.CtAnnotationFieldAccess; import spoon.reflect.code.CtArrayRead; import spoon.reflect.code.CtArrayWrite; @@ -106,8 +108,6 @@ import spoon.reflect.reference.CtUnboundVariableReference; import spoon.reflect.reference.CtWildcardReference; -import java.lang.annotation.Annotation; - /** * This interface defines the core creation methods for the meta-model (to be * implemented so that Spoon can manipulate other meta-model implementations). diff --git a/src/main/java/spoon/reflect/factory/ExecutableFactory.java b/src/main/java/spoon/reflect/factory/ExecutableFactory.java index b0fdf74bc56..1a245198696 100644 --- a/src/main/java/spoon/reflect/factory/ExecutableFactory.java +++ b/src/main/java/spoon/reflect/factory/ExecutableFactory.java @@ -133,7 +133,7 @@ private CtTypeReference getMethodParameterType(CtTypeReference paramType) } } if (paramType == null) { - return factory.Type().objectType(); + paramType = factory.Type().OBJECT; } return paramType.clone(); } @@ -242,4 +242,5 @@ public CtExecutableReference createReference(String signature) { executableRef.setParameters(params); return executableRef; } + } diff --git a/src/main/java/spoon/reflect/path/CtRole.java b/src/main/java/spoon/reflect/path/CtRole.java index 37110c22c3a..eaf76ac785e 100644 --- a/src/main/java/spoon/reflect/path/CtRole.java +++ b/src/main/java/spoon/reflect/path/CtRole.java @@ -7,6 +7,11 @@ */ package spoon.reflect.path; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.function.Predicate; + import spoon.SpoonException; import spoon.reflect.declaration.CtAnonymousExecutable; import spoon.reflect.declaration.CtConstructor; @@ -20,11 +25,6 @@ import spoon.reflect.declaration.CtUsedService; import spoon.support.Internal; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.function.Predicate; - /** * Identifies the roles of attributes of spoon model. */ diff --git a/src/main/java/spoon/reflect/visitor/CtScanner.java b/src/main/java/spoon/reflect/visitor/CtScanner.java index be5546334ee..4637485f1ae 100644 --- a/src/main/java/spoon/reflect/visitor/CtScanner.java +++ b/src/main/java/spoon/reflect/visitor/CtScanner.java @@ -8,6 +8,11 @@ package spoon.reflect.visitor; +import java.lang.annotation.Annotation; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; + import spoon.reflect.code.CtAnnotationFieldAccess; import spoon.reflect.code.CtArrayRead; import spoon.reflect.code.CtArrayWrite; @@ -105,11 +110,6 @@ import spoon.reflect.reference.CtUnboundVariableReference; import spoon.reflect.reference.CtWildcardReference; -import java.lang.annotation.Annotation; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Map; - /** * This visitor implements a deep-search scan on the model. * diff --git a/src/main/java/spoon/reflect/visitor/CtVisitor.java b/src/main/java/spoon/reflect/visitor/CtVisitor.java index 09108ebabc1..74c5a376e58 100644 --- a/src/main/java/spoon/reflect/visitor/CtVisitor.java +++ b/src/main/java/spoon/reflect/visitor/CtVisitor.java @@ -7,6 +7,8 @@ */ package spoon.reflect.visitor; +import java.lang.annotation.Annotation; + import spoon.reflect.code.CtAnnotationFieldAccess; import spoon.reflect.code.CtArrayRead; import spoon.reflect.code.CtArrayWrite; @@ -101,8 +103,6 @@ import spoon.reflect.reference.CtUnboundVariableReference; import spoon.reflect.reference.CtWildcardReference; -import java.lang.annotation.Annotation; - /** * This interface defines the visitor for the Spoon metamodel, as defined in * {@link spoon.reflect.declaration}, {@link spoon.reflect.code}, and diff --git a/src/main/java/spoon/support/DefaultCoreFactory.java b/src/main/java/spoon/support/DefaultCoreFactory.java index f0486a13b26..ec468d1915b 100644 --- a/src/main/java/spoon/support/DefaultCoreFactory.java +++ b/src/main/java/spoon/support/DefaultCoreFactory.java @@ -8,6 +8,10 @@ package spoon.support; +import java.lang.annotation.Annotation; +import java.util.HashSet; +import java.util.Set; + import spoon.experimental.CtUnresolvedImport; import spoon.reflect.code.CtAnnotationFieldAccess; import spoon.reflect.code.CtArrayRead; @@ -211,10 +215,6 @@ import spoon.support.reflect.reference.CtWildcardReferenceImpl; import spoon.support.visitor.equals.CloneHelper; -import java.lang.annotation.Annotation; -import java.util.HashSet; -import java.util.Set; - /** * This class implements a default core factory for Spoon's meta-model. This * implementation is done with regular Java classes (POJOs). diff --git a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java index ee92c073604..2cbd92657c7 100644 --- a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java +++ b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java @@ -7,6 +7,9 @@ */ package spoon.support.compiler.jdt; +import java.lang.invoke.MethodHandles; +import java.util.Set; + import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.ast.AND_AND_Expression; @@ -172,13 +175,7 @@ import spoon.support.reflect.CtExtendedModifier; import spoon.support.reflect.reference.CtArrayTypeReferenceImpl; -import java.lang.invoke.MethodHandles; -import java.util.Set; - -import static spoon.support.compiler.jdt.JDTTreeBuilderQuery.getBinaryOperatorKind; -import static spoon.support.compiler.jdt.JDTTreeBuilderQuery.getModifiers; -import static spoon.support.compiler.jdt.JDTTreeBuilderQuery.getUnaryOperator; -import static spoon.support.compiler.jdt.JDTTreeBuilderQuery.isLhsAssignment; +import static spoon.support.compiler.jdt.JDTTreeBuilderQuery.*; /** * A visitor for iterating through the parse tree. diff --git a/src/main/java/spoon/support/reflect/declaration/CtMethodImpl.java b/src/main/java/spoon/support/reflect/declaration/CtMethodImpl.java index 7b8b62a64ea..d81ed485695 100644 --- a/src/main/java/spoon/support/reflect/declaration/CtMethodImpl.java +++ b/src/main/java/spoon/support/reflect/declaration/CtMethodImpl.java @@ -7,6 +7,12 @@ */ package spoon.support.reflect.declaration; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + import spoon.refactoring.Refactoring; import spoon.reflect.ModelElementContainerDefaultCapacities; import spoon.reflect.annotations.MetamodelPropertyField; @@ -25,12 +31,6 @@ import spoon.support.reflect.CtExtendedModifier; import spoon.support.reflect.CtModifierHandler; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - /** * The implementation for {@link spoon.reflect.declaration.CtMethod}. * @@ -51,7 +51,6 @@ public class CtMethodImpl extends CtExecutableImpl implements CtMethod @MetamodelPropertyField(role = CtRole.MODIFIER) private CtModifierHandler modifierHandler = new CtModifierHandler(this); - public CtMethodImpl() { } @@ -298,5 +297,4 @@ public boolean isStrictfp() { public CtMethod copyMethod() { return Refactoring.copyMethod(this); } - } diff --git a/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java b/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java index 738f166ec07..6eda457da4b 100644 --- a/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java +++ b/src/main/java/spoon/support/reflect/declaration/CtReceiverParameterImpl.java @@ -20,13 +20,13 @@ public class CtReceiverParameterImpl extends CtElementImpl implements CtReceiver @MetamodelPropertyField(role = CtRole.TYPE) private CtTypeReference type; @MetamodelPropertyField(role = CtRole.IS_SHADOW) - boolean isShadow; + private boolean isShadow; + @Override public boolean isShadow() { return isShadow; } - @Override public C setShadow(boolean isShadow) { getFactory().getEnvironment().getModelChangeListener().onObjectUpdate(this, CtRole.IS_SHADOW, isShadow, this.isShadow); diff --git a/src/test/java/spoon/reflect/visitor/CtScannerTest.java b/src/test/java/spoon/reflect/visitor/CtScannerTest.java index 04bc429633e..4f063eefd8d 100644 --- a/src/test/java/spoon/reflect/visitor/CtScannerTest.java +++ b/src/test/java/spoon/reflect/visitor/CtScannerTest.java @@ -17,6 +17,19 @@ package spoon.reflect.visitor; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Comparator; +import java.util.Deque; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + import org.junit.jupiter.api.Test; import spoon.Launcher; import spoon.metamodel.ConceptKind; @@ -40,25 +53,7 @@ import spoon.reflect.visitor.filter.TypeFilter; import spoon.reflect.visitor.processors.CheckScannerTestProcessor; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Comparator; -import java.util.Deque; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; +import static org.junit.jupiter.api.Assertions.*; public class CtScannerTest { diff --git a/src/test/java/spoon/test/annotation/AnnotationTest.java b/src/test/java/spoon/test/annotation/AnnotationTest.java index e4c383edcd9..5f980c2c95a 100644 --- a/src/test/java/spoon/test/annotation/AnnotationTest.java +++ b/src/test/java/spoon/test/annotation/AnnotationTest.java @@ -17,6 +17,19 @@ package spoon.test.annotation; +import java.io.File; +import java.io.IOException; +import java.lang.annotation.Annotation; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; +import java.lang.reflect.Method; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Set; + import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.Test; import spoon.Launcher; @@ -91,32 +104,10 @@ import spoon.test.annotation.testclasses.spring.AliasFor; import spoon.test.annotation.testclasses.typeandfield.SimpleClass; -import java.io.File; -import java.io.IOException; -import java.lang.annotation.Annotation; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import java.lang.reflect.Method; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Set; - import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; -import static spoon.testing.utils.ModelUtils.buildClass; -import static spoon.testing.utils.ModelUtils.canBeBuilt; -import static spoon.testing.utils.ModelUtils.createFactory; +import static org.junit.jupiter.api.Assertions.*; +import static spoon.testing.utils.ModelUtils.*; public class AnnotationTest { From b41e419d2e788b4bce8eb30360fcaa67b148cb85 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Thu, 28 Mar 2024 18:49:43 +0100 Subject: [PATCH 24/51] up --- .../spoon/reflect/factory/ExecutableFactory.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/spoon/reflect/factory/ExecutableFactory.java b/src/main/java/spoon/reflect/factory/ExecutableFactory.java index 1a245198696..1dabf56aa56 100644 --- a/src/main/java/spoon/reflect/factory/ExecutableFactory.java +++ b/src/main/java/spoon/reflect/factory/ExecutableFactory.java @@ -7,6 +7,11 @@ */ package spoon.reflect.factory; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.StringTokenizer; + import spoon.reflect.code.CtBlock; import spoon.reflect.code.CtLambda; import spoon.reflect.declaration.CtAnonymousExecutable; @@ -23,11 +28,6 @@ import spoon.reflect.reference.CtTypeParameterReference; import spoon.reflect.reference.CtTypeReference; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.StringTokenizer; - import static spoon.reflect.ModelElementContainerDefaultCapacities.PARAMETERS_CONTAINER_DEFAULT_CAPACITY; /** @@ -133,7 +133,7 @@ private CtTypeReference getMethodParameterType(CtTypeReference paramType) } } if (paramType == null) { - paramType = factory.Type().OBJECT; + paramType = factory.Type().objectType(); } return paramType.clone(); } From d383721c6e876713427a6f085a6360af6264adb3 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Thu, 28 Mar 2024 18:50:00 +0100 Subject: [PATCH 25/51] up --- src/main/java/spoon/reflect/factory/ExecutableFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/spoon/reflect/factory/ExecutableFactory.java b/src/main/java/spoon/reflect/factory/ExecutableFactory.java index 1dabf56aa56..c0bd23791db 100644 --- a/src/main/java/spoon/reflect/factory/ExecutableFactory.java +++ b/src/main/java/spoon/reflect/factory/ExecutableFactory.java @@ -133,7 +133,7 @@ private CtTypeReference getMethodParameterType(CtTypeReference paramType) } } if (paramType == null) { - paramType = factory.Type().objectType(); + return factory.Type().objectType(); } return paramType.clone(); } From db9f45b1cf2fd0c243596eef19179e415f6c0a28 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Thu, 28 Mar 2024 18:55:31 +0100 Subject: [PATCH 26/51] up --- .../support/compiler/jdt/ParentExiter.java | 17 ++++++++--------- .../support/visitor/clone/CloneBuilder.java | 6 ------ .../support/visitor/clone/CloneVisitor.java | 6 ------ .../visitor/replace/ReplacementVisitor.java | 6 ------ .../spoon/test/annotation/AnnotationTest.java | 13 +++++++++++-- 5 files changed, 19 insertions(+), 29 deletions(-) diff --git a/src/main/java/spoon/support/compiler/jdt/ParentExiter.java b/src/main/java/spoon/support/compiler/jdt/ParentExiter.java index 94a15ac65f7..1fdfe1b6f5f 100644 --- a/src/main/java/spoon/support/compiler/jdt/ParentExiter.java +++ b/src/main/java/spoon/support/compiler/jdt/ParentExiter.java @@ -7,6 +7,12 @@ */ package spoon.support.compiler.jdt; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration; import org.eclipse.jdt.internal.compiler.ast.AllocationExpression; @@ -30,7 +36,6 @@ import org.eclipse.jdt.internal.compiler.ast.UnionTypeReference; import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; import org.jspecify.annotations.Nullable; - import spoon.SpoonException; import spoon.reflect.code.BinaryOperatorKind; import spoon.reflect.code.CaseKind; @@ -114,12 +119,6 @@ import spoon.reflect.visitor.CtScanner; import spoon.reflect.visitor.filter.TypeFilter; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import static spoon.reflect.code.BinaryOperatorKind.INSTANCEOF; @SuppressWarnings("unchecked") @@ -208,8 +207,8 @@ public void scanCtExecutable(CtExecutable e) { } else if (child instanceof CtBlock && !(e instanceof CtMethod || e instanceof CtConstructor)) { e.setBody((CtBlock) child); return; - } else if (child instanceof CtReceiverParameter) { - e.setReceiverParameter((CtReceiverParameter) child); + } else if (child instanceof CtReceiverParameter ctReceiverParameter) { + e.setReceiverParameter(ctReceiverParameter); } super.scanCtExecutable(e); } diff --git a/src/main/java/spoon/support/visitor/clone/CloneBuilder.java b/src/main/java/spoon/support/visitor/clone/CloneBuilder.java index 87a93040fb4..1860501113b 100644 --- a/src/main/java/spoon/support/visitor/clone/CloneBuilder.java +++ b/src/main/java/spoon/support/visitor/clone/CloneBuilder.java @@ -5,12 +5,6 @@ * * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. */ -/* SPDX-License-Identifier: (MIT OR CECILL-C) - -Copyright (C) 2006-2023 INRIA and contributors - -Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. - */ package spoon.support.visitor.clone; /** * Used to set all data in the cloned element. diff --git a/src/main/java/spoon/support/visitor/clone/CloneVisitor.java b/src/main/java/spoon/support/visitor/clone/CloneVisitor.java index d11bbb6bba1..ad616be8226 100644 --- a/src/main/java/spoon/support/visitor/clone/CloneVisitor.java +++ b/src/main/java/spoon/support/visitor/clone/CloneVisitor.java @@ -5,12 +5,6 @@ * * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. */ -/* SPDX-License-Identifier: (MIT OR CECILL-C) - -Copyright (C) 2006-2023 INRIA and contributors - -Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. - */ package spoon.support.visitor.clone; /** * Used to clone a given element. diff --git a/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java b/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java index 5e8966ffc75..130fb14af6b 100644 --- a/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java +++ b/src/main/java/spoon/support/visitor/replace/ReplacementVisitor.java @@ -5,12 +5,6 @@ * * Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. */ -/* SPDX-License-Identifier: (MIT OR CECILL-C) - -Copyright (C) 2006-2019 INRIA and contributors - -Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) of the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon. - */ package spoon.support.visitor.replace; /** * Used to replace an element by another one. diff --git a/src/test/java/spoon/test/annotation/AnnotationTest.java b/src/test/java/spoon/test/annotation/AnnotationTest.java index 5f980c2c95a..1e98d128442 100644 --- a/src/test/java/spoon/test/annotation/AnnotationTest.java +++ b/src/test/java/spoon/test/annotation/AnnotationTest.java @@ -106,8 +106,17 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.jupiter.api.Assertions.*; -import static spoon.testing.utils.ModelUtils.*; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import static spoon.testing.utils.ModelUtils.buildClass; +import static spoon.testing.utils.ModelUtils.canBeBuilt; +import static spoon.testing.utils.ModelUtils.createFactory; public class AnnotationTest { From d86eb000509482e96c6cf6f4dcd5246a8f1267d0 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Thu, 28 Mar 2024 19:04:35 +0100 Subject: [PATCH 27/51] up --- .../visitor/DefaultJavaPrettyPrinter.java | 22 +++++++++---------- .../ReceiverParameterTest.java | 12 ++++++---- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java b/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java index 9a1cd488720..768b1728e9d 100644 --- a/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java +++ b/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java @@ -7,6 +7,15 @@ */ package spoon.reflect.visitor; +import java.lang.annotation.Annotation; +import java.lang.invoke.MethodHandles; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import spoon.SpoonException; @@ -127,15 +136,6 @@ import spoon.support.reflect.reference.CtArrayTypeReferenceImpl; import spoon.support.util.ModelList; -import java.lang.annotation.Annotation; -import java.lang.invoke.MethodHandles; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - import static spoon.reflect.visitor.ElementPrinterHelper.PrintTypeArguments.ALSO_PRINT_DIAMOND_OPERATOR; import static spoon.reflect.visitor.ElementPrinterHelper.PrintTypeArguments.ONLY_PRINT_EXPLICIT_TYPES; @@ -2368,9 +2368,9 @@ public void visitCtReceiverParameter(CtReceiverParameter receiverParameter) { printer.writeIdentifier(receiverParameter.getType().getSimpleName()); printer.writeSpace(); - boolean isInnerClass = receiverParameter.getType().getTopLevelType().equals(receiverParameter.getParent(CtType.class)); + // if the receiver parameter is in an inner class, we need to print the outer class name + boolean isInnerClass = !receiverParameter.getType().getTopLevelType().getQualifiedName().equals(receiverParameter.getParent(CtType.class).getQualifiedName()); boolean isConstructor = receiverParameter.getParent() instanceof CtConstructor; - // after an implicit type, there is no space because we dont print anything if (isConstructor && isInnerClass) { // inside a ctor of an inner class, the identifier is $SimpleName.this printer.writeSeparator(receiverParameter.getType().getSimpleName() + ".this"); diff --git a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java index bb700715eb7..e51f5f362b9 100644 --- a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java +++ b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java @@ -1,7 +1,10 @@ package spoon.test.receiverparameter; +import java.util.List; + import spoon.reflect.CtModel; import spoon.reflect.declaration.CtConstructor; +import spoon.reflect.declaration.CtElement; import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtType; import spoon.reflect.declaration.CtTypeInformation; @@ -9,8 +12,6 @@ import spoon.testing.assertions.SpoonAssertions; import spoon.testing.utils.ModelTest; -import java.util.List; - import static org.junit.jupiter.api.Assertions.assertEquals; public class ReceiverParameterTest { @@ -24,8 +25,9 @@ void simpleParameter(CtModel model) { List receiverParams = targetType.getElements(new TypeFilter<>(CtReceiverParameter.class)); assertEquals(1, receiverParams.size()); CtReceiverParameter receiverParam = receiverParams.iterator().next(); - assertEquals("receiver.SimpleReceiverParameter", receiverParam.getType().getQualifiedName()); SpoonAssertions.assertThat(receiverParam.getType()).extracting(CtTypeInformation::getQualifiedName).isEqualTo("receiver.SimpleReceiverParameter"); + SpoonAssertions.assertThat(receiverParam).extracting(CtElement::toString).isEqualTo("SimpleReceiverParameter this"); + } @@ -38,9 +40,11 @@ void innerClassCtor(CtModel model) { List receiverParams = targetType.getElements(new TypeFilter<>(CtReceiverParameter.class)); assertEquals(1, receiverParams.size()); CtReceiverParameter next1 = receiverParams.iterator().next(); - assertEquals("receiver.Outer", next1.getType().getQualifiedName()); + SpoonAssertions.assertThat(next1.getType()).extracting(CtTypeInformation::getQualifiedName).isEqualTo("receiver.Outer"); CtConstructor ctConstructor = targetType.getElements(new TypeFilter<>(CtConstructor.class)).stream().filter(v -> v.getReceiverParameter() != null).findFirst().get(); SpoonAssertions.assertThat(ctConstructor).isNotNull(); SpoonAssertions.assertThat(ctConstructor.getReceiverParameter()).isNotNull(); + SpoonAssertions.assertThat(ctConstructor.getReceiverParameter().getType()).isNotNull(); + SpoonAssertions.assertThat(ctConstructor.getReceiverParameter()).extracting(CtElement::toString).isEqualTo("Outer Outer.this"); } } From 725e1682f0ebe69c214cc675c4d36554594a7cbc Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Thu, 28 Mar 2024 19:09:36 +0100 Subject: [PATCH 28/51] up --- src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java index 2cbd92657c7..b75eacb8e78 100644 --- a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java +++ b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java @@ -175,7 +175,10 @@ import spoon.support.reflect.CtExtendedModifier; import spoon.support.reflect.reference.CtArrayTypeReferenceImpl; -import static spoon.support.compiler.jdt.JDTTreeBuilderQuery.*; +import static spoon.support.compiler.jdt.JDTTreeBuilderQuery.getBinaryOperatorKind; +import static spoon.support.compiler.jdt.JDTTreeBuilderQuery.getModifiers; +import static spoon.support.compiler.jdt.JDTTreeBuilderQuery.getUnaryOperator; +import static spoon.support.compiler.jdt.JDTTreeBuilderQuery.isLhsAssignment; /** * A visitor for iterating through the parse tree. From 2ce454400c70ce73e3699ff5c372f498f4bb3df0 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Fri, 29 Mar 2024 16:37:55 +0100 Subject: [PATCH 29/51] up --- spoon-smpl/src/main/java/spoon/smpl/Substitutor.java | 6 ++++++ .../src/main/java/spoon/smpl/pattern/PatternBuilder.java | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/spoon-smpl/src/main/java/spoon/smpl/Substitutor.java b/spoon-smpl/src/main/java/spoon/smpl/Substitutor.java index c402737c3a5..62eb8b0036a 100644 --- a/spoon-smpl/src/main/java/spoon/smpl/Substitutor.java +++ b/spoon-smpl/src/main/java/spoon/smpl/Substitutor.java @@ -99,6 +99,7 @@ import spoon.reflect.declaration.CtPackageExport; import spoon.reflect.declaration.CtParameter; import spoon.reflect.declaration.CtProvidedService; +import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtRecord; import spoon.reflect.declaration.CtRecordComponent; import spoon.reflect.declaration.CtTypeParameter; @@ -710,4 +711,9 @@ public void visitCtCasePattern(CtCasePattern casePattern) { public void visitCtRecordPattern(CtRecordPattern recordPattern) { throw new NotImplementedException("Not implemented"); } + + @Override + public void visitCtReceiverParameter(CtReceiverParameter receiverParameter) { + throw new NotImplementedException("Not implemented"); + } } diff --git a/spoon-smpl/src/main/java/spoon/smpl/pattern/PatternBuilder.java b/spoon-smpl/src/main/java/spoon/smpl/pattern/PatternBuilder.java index bd0c9423477..75b47bdf18c 100644 --- a/spoon-smpl/src/main/java/spoon/smpl/pattern/PatternBuilder.java +++ b/spoon-smpl/src/main/java/spoon/smpl/pattern/PatternBuilder.java @@ -96,6 +96,7 @@ import spoon.reflect.declaration.CtPackageExport; import spoon.reflect.declaration.CtParameter; import spoon.reflect.declaration.CtProvidedService; +import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtRecord; import spoon.reflect.declaration.CtRecordComponent; import spoon.reflect.declaration.CtTypeParameter; @@ -851,6 +852,10 @@ public void visitCtRecordPattern(CtRecordPattern recordPattern) { throw new NotImplementedException("Not implemented"); } + @Override + public void visitCtReceiverParameter(CtReceiverParameter receiverParameter) { + throw new NotImplementedException("Not implemented"); + } /** * Parameter identifiers. From 994d8f58a1e01c438c910e0a8cb4e7f1142f74ff Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Fri, 29 Mar 2024 16:56:12 +0100 Subject: [PATCH 30/51] Update CtMethod.java --- src/main/java/spoon/reflect/declaration/CtMethod.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/spoon/reflect/declaration/CtMethod.java b/src/main/java/spoon/reflect/declaration/CtMethod.java index 29c0eec53eb..bf3453d2892 100644 --- a/src/main/java/spoon/reflect/declaration/CtMethod.java +++ b/src/main/java/spoon/reflect/declaration/CtMethod.java @@ -7,11 +7,12 @@ */ package spoon.reflect.declaration; -import java.util.Collection; import spoon.refactoring.Refactoring; import spoon.reflect.annotations.PropertyGetter; import spoon.reflect.annotations.PropertySetter; +import java.util.Collection; + import static spoon.reflect.path.CtRole.IS_DEFAULT; From e6e4b7ed64592414424c96b224180e78a484245c Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Fri, 29 Mar 2024 16:57:03 +0100 Subject: [PATCH 31/51] Update ExecutableFactory.java --- .../java/spoon/reflect/factory/ExecutableFactory.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/spoon/reflect/factory/ExecutableFactory.java b/src/main/java/spoon/reflect/factory/ExecutableFactory.java index c0bd23791db..23db7d1be74 100644 --- a/src/main/java/spoon/reflect/factory/ExecutableFactory.java +++ b/src/main/java/spoon/reflect/factory/ExecutableFactory.java @@ -7,11 +7,6 @@ */ package spoon.reflect.factory; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.StringTokenizer; - import spoon.reflect.code.CtBlock; import spoon.reflect.code.CtLambda; import spoon.reflect.declaration.CtAnonymousExecutable; @@ -28,6 +23,12 @@ import spoon.reflect.reference.CtTypeParameterReference; import spoon.reflect.reference.CtTypeReference; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.StringTokenizer; + import static spoon.reflect.ModelElementContainerDefaultCapacities.PARAMETERS_CONTAINER_DEFAULT_CAPACITY; /** From b1a85745ee0c96236db11f798cd8c28a23c52449 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Fri, 29 Mar 2024 16:58:02 +0100 Subject: [PATCH 32/51] Update DefaultJavaPrettyPrinter.java --- .../visitor/DefaultJavaPrettyPrinter.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java b/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java index 768b1728e9d..57389c94573 100644 --- a/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java +++ b/src/main/java/spoon/reflect/visitor/DefaultJavaPrettyPrinter.java @@ -7,15 +7,6 @@ */ package spoon.reflect.visitor; -import java.lang.annotation.Annotation; -import java.lang.invoke.MethodHandles; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import spoon.SpoonException; @@ -136,6 +127,15 @@ import spoon.support.reflect.reference.CtArrayTypeReferenceImpl; import spoon.support.util.ModelList; +import java.lang.annotation.Annotation; +import java.lang.invoke.MethodHandles; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + import static spoon.reflect.visitor.ElementPrinterHelper.PrintTypeArguments.ALSO_PRINT_DIAMOND_OPERATOR; import static spoon.reflect.visitor.ElementPrinterHelper.PrintTypeArguments.ONLY_PRINT_EXPLICIT_TYPES; From cfd2f69a239fee59e24d6ebfb2e2b7e588b20066 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Fri, 29 Mar 2024 16:59:18 +0100 Subject: [PATCH 33/51] Update ParentExiter.java --- .../spoon/support/compiler/jdt/ParentExiter.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/spoon/support/compiler/jdt/ParentExiter.java b/src/main/java/spoon/support/compiler/jdt/ParentExiter.java index 1fdfe1b6f5f..f82b8258d64 100644 --- a/src/main/java/spoon/support/compiler/jdt/ParentExiter.java +++ b/src/main/java/spoon/support/compiler/jdt/ParentExiter.java @@ -7,12 +7,6 @@ */ package spoon.support.compiler.jdt; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration; import org.eclipse.jdt.internal.compiler.ast.AllocationExpression; @@ -119,6 +113,12 @@ import spoon.reflect.visitor.CtScanner; import spoon.reflect.visitor.filter.TypeFilter; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import static spoon.reflect.code.BinaryOperatorKind.INSTANCEOF; @SuppressWarnings("unchecked") From a7900af02c6e672becc76e434b2f003ae8f4e53f Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Fri, 29 Mar 2024 16:59:54 +0100 Subject: [PATCH 34/51] Update CtMethodImpl.java --- .../support/reflect/declaration/CtMethodImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/spoon/support/reflect/declaration/CtMethodImpl.java b/src/main/java/spoon/support/reflect/declaration/CtMethodImpl.java index d81ed485695..13f99a84af3 100644 --- a/src/main/java/spoon/support/reflect/declaration/CtMethodImpl.java +++ b/src/main/java/spoon/support/reflect/declaration/CtMethodImpl.java @@ -7,12 +7,6 @@ */ package spoon.support.reflect.declaration; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - import spoon.refactoring.Refactoring; import spoon.reflect.ModelElementContainerDefaultCapacities; import spoon.reflect.annotations.MetamodelPropertyField; @@ -31,6 +25,12 @@ import spoon.support.reflect.CtExtendedModifier; import spoon.support.reflect.CtModifierHandler; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + /** * The implementation for {@link spoon.reflect.declaration.CtMethod}. * From f8f4b5218b01181585e83822da4558c31f184b3a Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Fri, 29 Mar 2024 17:00:13 +0100 Subject: [PATCH 35/51] Update ExecutableFactory.java --- src/main/java/spoon/reflect/factory/ExecutableFactory.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/spoon/reflect/factory/ExecutableFactory.java b/src/main/java/spoon/reflect/factory/ExecutableFactory.java index 23db7d1be74..2a34e916b1b 100644 --- a/src/main/java/spoon/reflect/factory/ExecutableFactory.java +++ b/src/main/java/spoon/reflect/factory/ExecutableFactory.java @@ -23,7 +23,6 @@ import spoon.reflect.reference.CtTypeParameterReference; import spoon.reflect.reference.CtTypeReference; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; From fcb14f75db92ccecde8b1ed3eaa5ec631c56b656 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Fri, 29 Mar 2024 17:03:18 +0100 Subject: [PATCH 36/51] date import statements and optimize argument naming Reorganized import statements in "CtAbstractVisitor.java", resulting in a more logical and readable structure. Also, renamed a method argument in "CtAbstractVisitor.java" for better readability and maintainability. Furthermore, the redundant comment in "JDTTreeBuilder.java" was removed, and the import statements in "CtScannerTest.java" was updated to import individual methods instead of using a wildcard import. --- .../reflect/visitor/CtAbstractVisitor.java | 18 +++++++++--------- .../support/compiler/jdt/JDTTreeBuilder.java | 1 - .../spoon/reflect/visitor/CtScannerTest.java | 7 ++++++- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/main/java/spoon/reflect/visitor/CtAbstractVisitor.java b/src/main/java/spoon/reflect/visitor/CtAbstractVisitor.java index fa6b9840a37..de90a697751 100644 --- a/src/main/java/spoon/reflect/visitor/CtAbstractVisitor.java +++ b/src/main/java/spoon/reflect/visitor/CtAbstractVisitor.java @@ -7,6 +7,8 @@ */ package spoon.reflect.visitor; +import java.lang.annotation.Annotation; + import spoon.reflect.code.CtAnnotationFieldAccess; import spoon.reflect.code.CtArrayRead; import spoon.reflect.code.CtArrayWrite; @@ -71,37 +73,35 @@ import spoon.reflect.declaration.CtEnum; import spoon.reflect.declaration.CtEnumValue; import spoon.reflect.declaration.CtField; +import spoon.reflect.declaration.CtImport; import spoon.reflect.declaration.CtInterface; import spoon.reflect.declaration.CtMethod; import spoon.reflect.declaration.CtModule; +import spoon.reflect.declaration.CtModuleRequirement; +import spoon.reflect.declaration.CtPackage; +import spoon.reflect.declaration.CtPackageDeclaration; import spoon.reflect.declaration.CtPackageExport; +import spoon.reflect.declaration.CtParameter; import spoon.reflect.declaration.CtProvidedService; import spoon.reflect.declaration.CtReceiverParameter; import spoon.reflect.declaration.CtRecord; import spoon.reflect.declaration.CtRecordComponent; -import spoon.reflect.declaration.CtModuleRequirement; -import spoon.reflect.declaration.CtPackage; -import spoon.reflect.declaration.CtPackageDeclaration; -import spoon.reflect.declaration.CtParameter; import spoon.reflect.declaration.CtTypeParameter; import spoon.reflect.declaration.CtUsedService; import spoon.reflect.reference.CtArrayTypeReference; import spoon.reflect.reference.CtCatchVariableReference; import spoon.reflect.reference.CtExecutableReference; import spoon.reflect.reference.CtFieldReference; -import spoon.reflect.declaration.CtImport; import spoon.reflect.reference.CtIntersectionTypeReference; import spoon.reflect.reference.CtLocalVariableReference; import spoon.reflect.reference.CtModuleReference; import spoon.reflect.reference.CtPackageReference; import spoon.reflect.reference.CtParameterReference; +import spoon.reflect.reference.CtTypeMemberWildcardImportReference; import spoon.reflect.reference.CtTypeParameterReference; import spoon.reflect.reference.CtTypeReference; import spoon.reflect.reference.CtUnboundVariableReference; import spoon.reflect.reference.CtWildcardReference; -import spoon.reflect.reference.CtTypeMemberWildcardImportReference; - -import java.lang.annotation.Annotation; /** Provides an empty implementation of CtVisitor. * See {@link CtScanner} for a much more powerful implementation of CtVisitor. @@ -562,7 +562,7 @@ public void visitCtCasePattern(CtCasePattern casePattern) { } @Override - public void visitCtReceiverParameter(CtReceiverParameter providedService) { + public void visitCtReceiverParameter(CtReceiverParameter receiverParameter) { } diff --git a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java index b75eacb8e78..da6441b8d9f 100644 --- a/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java +++ b/src/main/java/spoon/support/compiler/jdt/JDTTreeBuilder.java @@ -958,7 +958,6 @@ public boolean visit(Argument argument, BlockScope scope) { return true; } boolean isVar = argument.type != null && argument.type.isTypeNameVar(scope); - // we can also use an instanceof Receiver here if (argument instanceof Receiver receiver) { CtReceiverParameter receiverParameter = helper.createReceiverParameter(receiver); context.enter(receiverParameter, argument); diff --git a/src/test/java/spoon/reflect/visitor/CtScannerTest.java b/src/test/java/spoon/reflect/visitor/CtScannerTest.java index 4f063eefd8d..d05767f6465 100644 --- a/src/test/java/spoon/reflect/visitor/CtScannerTest.java +++ b/src/test/java/spoon/reflect/visitor/CtScannerTest.java @@ -53,7 +53,12 @@ import spoon.reflect.visitor.filter.TypeFilter; import spoon.reflect.visitor.processors.CheckScannerTestProcessor; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; public class CtScannerTest { From 6fdde3915cb72e2fa016224c94d7130b5202a369 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 1 Apr 2024 18:46:33 +0200 Subject: [PATCH 37/51] Add inner class handling in receiver parameter test Introduced a new test, `innerClassInnerClass`, in `ReceiverParameterTest.java` to verify if the constructor of an inner class, which is another inner class, can have a receiver parameter with their outer class type. Also added a new file 'Outer.java' with nested inner classes for the test case scenario. --- .../receiverparameter/ReceiverParameterTest.java | 14 ++++++++++++++ src/test/resources/receiver/Outer.java | 10 ++++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/test/resources/receiver/Outer.java diff --git a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java index e51f5f362b9..11d2aebdb46 100644 --- a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java +++ b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java @@ -47,4 +47,18 @@ void innerClassCtor(CtModel model) { SpoonAssertions.assertThat(ctConstructor.getReceiverParameter().getType()).isNotNull(); SpoonAssertions.assertThat(ctConstructor.getReceiverParameter()).extracting(CtElement::toString).isEqualTo("Outer Outer.this"); } + + @ModelTest( + value = "src/test/resources/receiver/Outer.java") + void innerClassInnerClass(CtModel model) { + // contract: constructor of inner class which is an innerclass can have receiver parameter with their outer class type + CtType targetType = model.getAllTypes().iterator().next(); + List receiverParams = targetType.getElements(new TypeFilter<>(CtReceiverParameter.class)); + assertEquals(1, receiverParams.size()); + CtConstructor ctConstructor = targetType.getElements(new TypeFilter<>(CtConstructor.class)).stream().filter(v -> v.getReceiverParameter() != null).findFirst().get(); + SpoonAssertions.assertThat(ctConstructor).isNotNull(); + SpoonAssertions.assertThat(ctConstructor.getReceiverParameter()).isNotNull(); + SpoonAssertions.assertThat(ctConstructor.getReceiverParameter().getType()).isNotNull(); + SpoonAssertions.assertThat(ctConstructor.getReceiverParameter()).extracting(CtElement::toString).isEqualTo("Middle Middle.this"); + } } diff --git a/src/test/resources/receiver/Outer.java b/src/test/resources/receiver/Outer.java new file mode 100644 index 00000000000..455724531e7 --- /dev/null +++ b/src/test/resources/receiver/Outer.java @@ -0,0 +1,10 @@ +package receiver; +public class Outer { + class Middle { + class Inner { + public Inner(Middle Middle.this) { + + } + } + } +} \ No newline at end of file From ece93405a56a41c7fa5361f7a8c1c7b1f84bd1cb Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 1 Apr 2024 19:11:43 +0200 Subject: [PATCH 38/51] Reorganize import statements in Metamodel.java Rearranged the order of import statements in Metamodel.java to improve readability and organization. No changes were made to the actual functionality of the code. --- src/test/java/spoon/test/api/Metamodel.java | 2412 +++++++++---------- 1 file changed, 1206 insertions(+), 1206 deletions(-) diff --git a/src/test/java/spoon/test/api/Metamodel.java b/src/test/java/spoon/test/api/Metamodel.java index 49e4b2a2ef1..f74078b5d45 100644 --- a/src/test/java/spoon/test/api/Metamodel.java +++ b/src/test/java/spoon/test/api/Metamodel.java @@ -16,6 +16,15 @@ */ package spoon.test.api; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; + import spoon.metamodel.MetamodelConcept; import spoon.reflect.code.CtForEach; import spoon.reflect.declaration.CtClass; @@ -28,15 +37,6 @@ import spoon.reflect.visitor.CtScanner; import spoon.support.reflect.code.CtForEachImpl; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Consumer; - /** * This class enables to reason on the Spoon metamodel directly */ @@ -249,1202 +249,1202 @@ private static void initTypes(List types) { * body of this method was generated by /spoon-core/src/test/java/spoon/generating/MetamodelGenerator.java * Run the method main and copy the System output here */ - types.add(new Type("CtConditional", spoon.reflect.code.CtConditional.class, spoon.support.reflect.code.CtConditionalImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CONDITION, false, false) - .field(CtRole.THEN, false, false) - .field(CtRole.ELSE, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.CAST, false, false) - - )); - - types.add(new Type("CtProvidedService", spoon.reflect.declaration.CtProvidedService.class, spoon.support.reflect.declaration.CtProvidedServiceImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.SERVICE_TYPE, false, false) - .field(CtRole.IMPLEMENTATION_TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) - - )); - - types.add(new Type("CtParameter", spoon.reflect.declaration.CtParameter.class, spoon.support.reflect.declaration.CtParameterImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.IS_VARARGS, false, false) - .field(CtRole.DEFAULT_EXPRESSION, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.IS_INFERRED, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtWhile", spoon.reflect.code.CtWhile.class, spoon.support.reflect.code.CtWhileImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtTypeReference", spoon.reflect.reference.CtTypeReference.class, spoon.support.reflect.reference.CtTypeReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, true, true) - .field(CtRole.INTERFACE, true, true) - .field(CtRole.SUPER_TYPE, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.PACKAGE_REF, false, false) - .field(CtRole.DECLARING_TYPE, false, false) - .field(CtRole.TYPE_ARGUMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.COMMENT, true, true) - - )); - - types.add(new Type("CtCatchVariableReference", spoon.reflect.reference.CtCatchVariableReference.class, spoon.support.reflect.reference.CtCatchVariableReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.COMMENT, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) - - )); - - types.add(new Type("CtContinue", spoon.reflect.code.CtContinue.class, spoon.support.reflect.code.CtContinueImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.TARGET_LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtInterface", spoon.reflect.declaration.CtInterface.class, spoon.support.reflect.declaration.CtInterfaceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.SUPER_TYPE, true, true) - .field(CtRole.NESTED_TYPE, true, false) - .field(CtRole.METHOD, true, false) - .field(CtRole.FIELD, true, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.INTERFACE, false, false) - .field(CtRole.TYPE_PARAMETER, false, false) - .field(CtRole.TYPE_MEMBER, false, false) - .field(CtRole.PERMITTED_TYPE, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtAssignment", spoon.reflect.code.CtAssignment.class, spoon.support.reflect.code.CtAssignmentImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.ASSIGNED, false, false) - .field(CtRole.ASSIGNMENT, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtBinaryOperator", spoon.reflect.code.CtBinaryOperator.class, spoon.support.reflect.code.CtBinaryOperatorImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.OPERATOR_KIND, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.LEFT_OPERAND, false, false) - .field(CtRole.RIGHT_OPERAND, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtEnumValue", spoon.reflect.declaration.CtEnumValue.class, spoon.support.reflect.declaration.CtEnumValueImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.ASSIGNMENT, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.DEFAULT_EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtRecordPattern", spoon.reflect.code.CtRecordPattern.class, spoon.support.reflect.code.CtRecordPatternImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.CAST, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.TYPE_REF, false, false) - .field(CtRole.PATTERN, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtModuleRequirement", spoon.reflect.declaration.CtModuleRequirement.class, spoon.support.reflect.declaration.CtModuleRequirementImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.MODULE_REF, false, false) - .field(CtRole.ANNOTATION, false, false) - - )); - - types.add(new Type("CtForEach", spoon.reflect.code.CtForEach.class, spoon.support.reflect.code.CtForEachImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.FOREACH_VARIABLE, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtConstructor", spoon.reflect.declaration.CtConstructor.class, spoon.support.reflect.declaration.CtConstructorImpl.class, fm -> fm - .field(CtRole.NAME, true, true) - .field(CtRole.TYPE, true, true) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMPACT_CONSTRUCTOR, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.RECEIVER_PARAMETER, false, false) - .field(CtRole.PARAMETER, false, false) - .field(CtRole.THROWN, false, false) - .field(CtRole.TYPE_PARAMETER, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtSuperAccess", spoon.reflect.code.CtSuperAccess.class, spoon.support.reflect.code.CtSuperAccessImpl.class, fm -> fm - .field(CtRole.TYPE, true, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.TARGET, false, false) - .field(CtRole.VARIABLE, false, false) - - )); - - types.add(new Type("CtPackageDeclaration", spoon.reflect.declaration.CtPackageDeclaration.class, spoon.support.reflect.declaration.CtPackageDeclarationImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.PACKAGE_REF, false, false) - - )); - - types.add(new Type("CtAnonymousExecutable", spoon.reflect.declaration.CtAnonymousExecutable.class, spoon.support.reflect.declaration.CtAnonymousExecutableImpl.class, fm -> fm - .field(CtRole.NAME, true, true) - .field(CtRole.TYPE, true, true) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.PARAMETER, true, true) - .field(CtRole.THROWN, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.RECEIVER_PARAMETER, true, true) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtComment", spoon.reflect.code.CtComment.class, spoon.support.reflect.code.CtCommentImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.COMMENT_CONTENT, false, false) - .field(CtRole.COMMENT_TYPE, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - - )); - - types.add(new Type("CtWildcardReference", spoon.reflect.reference.CtWildcardReference.class, spoon.support.reflect.reference.CtWildcardReferenceImpl.class, fm -> fm - .field(CtRole.NAME, true, true) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_UPPER, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, true, true) - .field(CtRole.COMMENT, true, true) - .field(CtRole.INTERFACE, true, true) - .field(CtRole.SUPER_TYPE, true, true) - .field(CtRole.TYPE_ARGUMENT, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.PACKAGE_REF, false, false) - .field(CtRole.DECLARING_TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.BOUNDING_TYPE, false, false) - - )); - - types.add(new Type("CtThisAccess", spoon.reflect.code.CtThisAccess.class, spoon.support.reflect.code.CtThisAccessImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.TARGET, false, false) - - )); - - types.add(new Type("CtRecordComponent", spoon.reflect.declaration.CtRecordComponent.class, spoon.support.reflect.declaration.CtRecordComponentImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtArrayWrite", spoon.reflect.code.CtArrayWrite.class, spoon.support.reflect.code.CtArrayWriteImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.TARGET, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtPackageReference", spoon.reflect.reference.CtPackageReference.class, spoon.support.reflect.reference.CtPackageReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.COMMENT, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - - )); - - types.add(new Type("CtJavaDoc", spoon.reflect.code.CtJavaDoc.class, spoon.support.reflect.code.CtJavaDocImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.COMMENT_CONTENT, false, false) - .field(CtRole.COMMENT_TYPE, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.COMMENT_TAG, false, false) - - )); - - types.add(new Type("CtArrayRead", spoon.reflect.code.CtArrayRead.class, spoon.support.reflect.code.CtArrayReadImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.TARGET, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtStatementList", spoon.reflect.code.CtStatementList.class, spoon.support.reflect.code.CtStatementListImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.STATEMENT, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtVariableWrite", spoon.reflect.code.CtVariableWrite.class, spoon.support.reflect.code.CtVariableWriteImpl.class, fm -> fm - .field(CtRole.TYPE, true, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.VARIABLE, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtCompilationUnit", spoon.reflect.declaration.CtCompilationUnit.class, spoon.support.reflect.declaration.CtCompilationUnitImpl.class, fm -> fm - .field(CtRole.DECLARED_TYPE, true, true) - .field(CtRole.DECLARED_MODULE, true, true) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, true, true) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.PACKAGE_DECLARATION, false, false) - .field(CtRole.DECLARED_IMPORT, false, false) - .field(CtRole.DECLARED_MODULE_REF, false, false) - .field(CtRole.DECLARED_TYPE_REF, false, false) - - )); - - types.add(new Type("CtParameterReference", spoon.reflect.reference.CtParameterReference.class, spoon.support.reflect.reference.CtParameterReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.COMMENT, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) - - )); - - types.add(new Type("CtReceiverParameter", spoon.reflect.declaration.CtReceiverParameter.class, spoon.support.reflect.declaration.CtReceiverParameterImpl.class, fm -> fm - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtOperatorAssignment", spoon.reflect.code.CtOperatorAssignment.class, spoon.support.reflect.code.CtOperatorAssignmentImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.OPERATOR_KIND, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.ASSIGNED, false, false) - .field(CtRole.ASSIGNMENT, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtAnnotationFieldAccess", spoon.reflect.code.CtAnnotationFieldAccess.class, spoon.support.reflect.code.CtAnnotationFieldAccessImpl.class, fm -> fm - .field(CtRole.TYPE, true, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.TARGET, false, false) - .field(CtRole.VARIABLE, false, false) - - )); - - types.add(new Type("CtUnboundVariableReference", spoon.reflect.reference.CtUnboundVariableReference.class, spoon.support.reflect.reference.CtUnboundVariableReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.COMMENT, true, true) - .field(CtRole.ANNOTATION, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.TYPE, false, false) - - )); - - types.add(new Type("CtAnnotationMethod", spoon.reflect.declaration.CtAnnotationMethod.class, spoon.support.reflect.declaration.CtAnnotationMethodImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.BODY, true, true) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.IS_DEFAULT, false, false) - .field(CtRole.PARAMETER, true, true) - .field(CtRole.THROWN, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.TYPE_PARAMETER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.RECEIVER_PARAMETER, true, true) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.DEFAULT_EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtClass", spoon.reflect.declaration.CtClass.class, spoon.support.reflect.declaration.CtClassImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.NESTED_TYPE, true, false) - .field(CtRole.CONSTRUCTOR, true, false) - .field(CtRole.METHOD, true, false) - .field(CtRole.ANNONYMOUS_EXECUTABLE, true, false) - .field(CtRole.FIELD, true, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.SUPER_TYPE, false, false) - .field(CtRole.INTERFACE, false, false) - .field(CtRole.TYPE_PARAMETER, false, false) - .field(CtRole.TYPE_MEMBER, false, false) - .field(CtRole.PERMITTED_TYPE, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtBlock", spoon.reflect.code.CtBlock.class, spoon.support.reflect.code.CtBlockImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.STATEMENT, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtPackage", spoon.reflect.declaration.CtPackage.class, spoon.support.reflect.declaration.CtPackageImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.SUB_PACKAGE, false, false) - .field(CtRole.CONTAINED_TYPE, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtTryWithResource", spoon.reflect.code.CtTryWithResource.class, spoon.support.reflect.code.CtTryWithResourceImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TRY_RESOURCE, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.CATCH, false, false) - .field(CtRole.FINALIZER, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtAssert", spoon.reflect.code.CtAssert.class, spoon.support.reflect.code.CtAssertImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CONDITION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtSwitch", spoon.reflect.code.CtSwitch.class, spoon.support.reflect.code.CtSwitchImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.CASE, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtTry", spoon.reflect.code.CtTry.class, spoon.support.reflect.code.CtTryImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.CATCH, false, false) - .field(CtRole.FINALIZER, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtYieldStatement", spoon.reflect.code.CtYieldStatement.class, spoon.support.reflect.code.CtYieldStatementImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtSynchronized", spoon.reflect.code.CtSynchronized.class, spoon.support.reflect.code.CtSynchronizedImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtTypeParameterReference", spoon.reflect.reference.CtTypeParameterReference.class, spoon.support.reflect.reference.CtTypeParameterReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, true, true) - .field(CtRole.COMMENT, true, true) - .field(CtRole.INTERFACE, true, true) - .field(CtRole.SUPER_TYPE, true, true) - .field(CtRole.TYPE_ARGUMENT, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.PACKAGE_REF, false, false) - .field(CtRole.DECLARING_TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) - - )); - - types.add(new Type("CtImport", spoon.reflect.declaration.CtImport.class, spoon.support.reflect.declaration.CtImportImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.IMPORT_REFERENCE, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtInvocation", spoon.reflect.code.CtInvocation.class, spoon.support.reflect.code.CtInvocationImpl.class, fm -> fm - .field(CtRole.TYPE, true, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.TYPE_ARGUMENT, true, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.TARGET, false, false) - .field(CtRole.EXECUTABLE_REF, false, false) - .field(CtRole.ARGUMENT, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtCodeSnippetExpression", spoon.reflect.code.CtCodeSnippetExpression.class, spoon.support.reflect.code.CtCodeSnippetExpressionImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.SNIPPET, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - - )); - - types.add(new Type("CtFieldWrite", spoon.reflect.code.CtFieldWrite.class, spoon.support.reflect.code.CtFieldWriteImpl.class, fm -> fm - .field(CtRole.TYPE, true, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.TARGET, false, false) - .field(CtRole.VARIABLE, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtUnaryOperator", spoon.reflect.code.CtUnaryOperator.class, spoon.support.reflect.code.CtUnaryOperatorImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.OPERATOR_KIND, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtExecutableReference", spoon.reflect.reference.CtExecutableReference.class, spoon.support.reflect.reference.CtExecutableReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_STATIC, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.DECLARING_TYPE, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.ARGUMENT_TYPE, false, false) - .field(CtRole.TYPE_ARGUMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.COMMENT, true, true) - - )); - - types.add(new Type("CtFor", spoon.reflect.code.CtFor.class, spoon.support.reflect.code.CtForImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.FOR_INIT, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.FOR_UPDATE, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtVariableRead", spoon.reflect.code.CtVariableRead.class, spoon.support.reflect.code.CtVariableReadImpl.class, fm -> fm - .field(CtRole.TYPE, true, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.VARIABLE, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtTypeParameter", spoon.reflect.declaration.CtTypeParameter.class, spoon.support.reflect.declaration.CtTypeParameterImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, true, true) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.INTERFACE, true, true) - .field(CtRole.TYPE_MEMBER, true, true) - .field(CtRole.NESTED_TYPE, true, true) - .field(CtRole.METHOD, true, true) - .field(CtRole.FIELD, true, true) - .field(CtRole.TYPE_PARAMETER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.SUPER_TYPE, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtLocalVariable", spoon.reflect.code.CtLocalVariable.class, spoon.support.reflect.code.CtLocalVariableImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.ASSIGNMENT, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.IS_INFERRED, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.DEFAULT_EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtIf", spoon.reflect.code.CtIf.class, spoon.support.reflect.code.CtIfImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CONDITION, false, false) - .field(CtRole.THEN, false, false) - .field(CtRole.ELSE, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtRecord", spoon.reflect.declaration.CtRecord.class, spoon.support.reflect.declaration.CtRecordImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.SUPER_TYPE, true, true) - .field(CtRole.NESTED_TYPE, true, false) - .field(CtRole.CONSTRUCTOR, true, false) - .field(CtRole.METHOD, true, false) - .field(CtRole.ANNONYMOUS_EXECUTABLE, true, false) - .field(CtRole.FIELD, true, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.PERMITTED_TYPE, true, true) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.INTERFACE, false, false) - .field(CtRole.TYPE_MEMBER, false, false) - .field(CtRole.TYPE_PARAMETER, false, false) - .field(CtRole.RECORD_COMPONENT, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtModule", spoon.reflect.declaration.CtModule.class, spoon.support.reflect.declaration.CtModuleImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.REQUIRED_MODULE, true, false) - .field(CtRole.EXPORTED_PACKAGE, true, false) - .field(CtRole.OPENED_PACKAGE, true, false) - .field(CtRole.SERVICE_TYPE, true, false) - .field(CtRole.PROVIDED_SERVICE, true, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.MODULE_DIRECTIVE, false, false) - .field(CtRole.SUB_PACKAGE, false, false) - - )); - - types.add(new Type("CtSwitchExpression", spoon.reflect.code.CtSwitchExpression.class, spoon.support.reflect.code.CtSwitchExpressionImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.CASE, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - - )); - - types.add(new Type("CtPackageExport", spoon.reflect.declaration.CtPackageExport.class, spoon.support.reflect.declaration.CtPackageExportImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.OPENED_PACKAGE, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.PACKAGE_REF, false, false) - .field(CtRole.MODULE_REF, false, false) - .field(CtRole.ANNOTATION, false, false) - - )); - - types.add(new Type("CtConstructorCall", spoon.reflect.code.CtConstructorCall.class, spoon.support.reflect.code.CtConstructorCallImpl.class, fm -> fm - .field(CtRole.TYPE, true, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.TYPE_ARGUMENT, true, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.EXECUTABLE_REF, false, false) - .field(CtRole.TARGET, false, false) - .field(CtRole.ARGUMENT, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtCase", spoon.reflect.code.CtCase.class, spoon.support.reflect.code.CtCaseImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.DEFAULT_EXPRESSION, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.CASE_KIND, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.STATEMENT, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtModuleReference", spoon.reflect.reference.CtModuleReference.class, spoon.support.reflect.reference.CtModuleReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.COMMENT, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - - )); - - types.add(new Type("CtCatch", spoon.reflect.code.CtCatch.class, spoon.support.reflect.code.CtCatchImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.PARAMETER, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtArrayTypeReference", spoon.reflect.reference.CtArrayTypeReference.class, spoon.support.reflect.reference.CtArrayTypeReferenceImpl.class, fm -> fm - .field(CtRole.NAME, true, true) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, true, true) - .field(CtRole.COMMENT, true, true) - .field(CtRole.INTERFACE, true, true) - .field(CtRole.SUPER_TYPE, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.PACKAGE_REF, false, false) - .field(CtRole.DECLARING_TYPE, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.TYPE_ARGUMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - - )); - - types.add(new Type("CtMethod", spoon.reflect.declaration.CtMethod.class, spoon.support.reflect.declaration.CtMethodImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.IS_DEFAULT, false, false) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE_PARAMETER, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.RECEIVER_PARAMETER, false, false) - .field(CtRole.PARAMETER, false, false) - .field(CtRole.THROWN, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtLambda", spoon.reflect.code.CtLambda.class, spoon.support.reflect.code.CtLambdaImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.THROWN, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.RECEIVER_PARAMETER, true, true) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.PARAMETER, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtTypePattern", spoon.reflect.code.CtTypePattern.class, spoon.support.reflect.code.CtTypePatternImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.CAST, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.VARIABLE, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtNewArray", spoon.reflect.code.CtNewArray.class, spoon.support.reflect.code.CtNewArrayImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.DIMENSION, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtIntersectionTypeReference", spoon.reflect.reference.CtIntersectionTypeReference.class, spoon.support.reflect.reference.CtIntersectionTypeReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, true, true) - .field(CtRole.COMMENT, true, true) - .field(CtRole.INTERFACE, true, true) - .field(CtRole.SUPER_TYPE, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.PACKAGE_REF, false, false) - .field(CtRole.DECLARING_TYPE, false, false) - .field(CtRole.TYPE_ARGUMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.BOUND, false, false) - - )); - - types.add(new Type("CtUsedService", spoon.reflect.declaration.CtUsedService.class, spoon.support.reflect.declaration.CtUsedServiceImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.SERVICE_TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) - - )); - - types.add(new Type("CtTextBlock", spoon.reflect.code.CtTextBlock.class, spoon.support.reflect.code.CtTextBlockImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.VALUE, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.LITERAL_BASE, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtThrow", spoon.reflect.code.CtThrow.class, spoon.support.reflect.code.CtThrowImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtLiteral", spoon.reflect.code.CtLiteral.class, spoon.support.reflect.code.CtLiteralImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.VALUE, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.LITERAL_BASE, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtReturn", spoon.reflect.code.CtReturn.class, spoon.support.reflect.code.CtReturnImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtField", spoon.reflect.declaration.CtField.class, spoon.support.reflect.declaration.CtFieldImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.ASSIGNMENT, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.DEFAULT_EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtJavaDocTag", spoon.reflect.code.CtJavaDocTag.class, spoon.support.reflect.code.CtJavaDocTagImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.COMMENT_CONTENT, false, false) - .field(CtRole.DOCUMENTATION_TYPE, false, false) - .field(CtRole.DOCUMENTATION_TYPE_REALNAME, false, false) - .field(CtRole.JAVADOC_TAG_VALUE, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - - )); - - types.add(new Type("CtTypeAccess", spoon.reflect.code.CtTypeAccess.class, spoon.support.reflect.code.CtTypeAccessImpl.class, fm -> fm - .field(CtRole.TYPE, true, true) - .field(CtRole.IS_IMPLICIT, true, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.ACCESSED_TYPE, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtCodeSnippetStatement", spoon.reflect.code.CtCodeSnippetStatement.class, spoon.support.reflect.code.CtCodeSnippetStatementImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.SNIPPET, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - - )); - - types.add(new Type("CtDo", spoon.reflect.code.CtDo.class, spoon.support.reflect.code.CtDoImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtTypeMemberWildcardImportReference", spoon.reflect.reference.CtTypeMemberWildcardImportReference.class, spoon.support.reflect.reference.CtTypeMemberWildcardImportReferenceImpl.class, fm -> fm - .field(CtRole.NAME, true, true) - .field(CtRole.IS_IMPLICIT, true, true) - .field(CtRole.COMMENT, true, true) - .field(CtRole.ANNOTATION, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.TYPE_REF, false, false) - - )); - - types.add(new Type("CtAnnotation", spoon.reflect.declaration.CtAnnotation.class, spoon.support.reflect.declaration.CtAnnotationImpl.class, fm -> fm - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.CAST, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION_TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.VALUE, false, false) - - )); - - types.add(new Type("CtFieldRead", spoon.reflect.code.CtFieldRead.class, spoon.support.reflect.code.CtFieldReadImpl.class, fm -> fm - .field(CtRole.TYPE, true, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.TARGET, false, false) - .field(CtRole.VARIABLE, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtBreak", spoon.reflect.code.CtBreak.class, spoon.support.reflect.code.CtBreakImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.TARGET_LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtFieldReference", spoon.reflect.reference.CtFieldReference.class, spoon.support.reflect.reference.CtFieldReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_FINAL, false, false) - .field(CtRole.IS_STATIC, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.COMMENT, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.DECLARING_TYPE, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) - - )); - - types.add(new Type("CtEnum", spoon.reflect.declaration.CtEnum.class, spoon.support.reflect.declaration.CtEnumImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.SUPER_TYPE, true, true) - .field(CtRole.NESTED_TYPE, true, false) - .field(CtRole.CONSTRUCTOR, true, false) - .field(CtRole.METHOD, true, false) - .field(CtRole.ANNONYMOUS_EXECUTABLE, true, false) - .field(CtRole.FIELD, true, false) - .field(CtRole.TYPE_PARAMETER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.PERMITTED_TYPE, true, true) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.INTERFACE, false, false) - .field(CtRole.TYPE_MEMBER, false, false) - .field(CtRole.VALUE, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtCasePattern", spoon.reflect.code.CtCasePattern.class, spoon.support.reflect.code.CtCasePatternImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.PATTERN, false, false) - .field(CtRole.CONDITION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtNewClass", spoon.reflect.code.CtNewClass.class, spoon.support.reflect.code.CtNewClassImpl.class, fm -> fm - .field(CtRole.TYPE, true, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.TYPE_ARGUMENT, true, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.EXECUTABLE_REF, false, false) - .field(CtRole.TARGET, false, false) - .field(CtRole.ARGUMENT, false, false) - .field(CtRole.NESTED_TYPE, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtLocalVariableReference", spoon.reflect.reference.CtLocalVariableReference.class, spoon.support.reflect.reference.CtLocalVariableReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.COMMENT, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) - - )); - - types.add(new Type("CtAnnotationType", spoon.reflect.declaration.CtAnnotationType.class, spoon.support.reflect.declaration.CtAnnotationTypeImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.INTERFACE, true, true) - .field(CtRole.SUPER_TYPE, true, true) - .field(CtRole.NESTED_TYPE, true, false) - .field(CtRole.METHOD, true, false) - .field(CtRole.FIELD, true, false) - .field(CtRole.TYPE_PARAMETER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE_MEMBER, false, false) - .field(CtRole.COMMENT, false, false) - - )); - - types.add(new Type("CtCatchVariable", spoon.reflect.code.CtCatchVariable.class, spoon.support.reflect.code.CtCatchVariableImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.TYPE, true, true) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.DEFAULT_EXPRESSION, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.MULTI_TYPE, false, false) - - )); - - types.add(new Type("CtExecutableReferenceExpression", spoon.reflect.code.CtExecutableReferenceExpression.class, spoon.support.reflect.code.CtExecutableReferenceExpressionImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.EXECUTABLE_REF, false, false) - .field(CtRole.TARGET, false, false) - - )); + types.add(new Type("CtConditional", spoon.reflect.code.CtConditional.class, spoon.support.reflect.code.CtConditionalImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CONDITION, false, false) + .field(CtRole.THEN, false, false) + .field(CtRole.ELSE, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.CAST, false, false) + + )); + + types.add(new Type("CtProvidedService", spoon.reflect.declaration.CtProvidedService.class, spoon.support.reflect.declaration.CtProvidedServiceImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.SERVICE_TYPE, false, false) + .field(CtRole.IMPLEMENTATION_TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) + + )); + + types.add(new Type("CtParameter", spoon.reflect.declaration.CtParameter.class, spoon.support.reflect.declaration.CtParameterImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.IS_VARARGS, false, false) + .field(CtRole.DEFAULT_EXPRESSION, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.IS_INFERRED, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtWhile", spoon.reflect.code.CtWhile.class, spoon.support.reflect.code.CtWhileImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtTypeReference", spoon.reflect.reference.CtTypeReference.class, spoon.support.reflect.reference.CtTypeReferenceImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, true, true) + .field(CtRole.INTERFACE, true, true) + .field(CtRole.SUPER_TYPE, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.PACKAGE_REF, false, false) + .field(CtRole.DECLARING_TYPE, false, false) + .field(CtRole.TYPE_ARGUMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.COMMENT, true, true) + + )); + + types.add(new Type("CtCatchVariableReference", spoon.reflect.reference.CtCatchVariableReference.class, spoon.support.reflect.reference.CtCatchVariableReferenceImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.COMMENT, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) + + )); + + types.add(new Type("CtContinue", spoon.reflect.code.CtContinue.class, spoon.support.reflect.code.CtContinueImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.TARGET_LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtInterface", spoon.reflect.declaration.CtInterface.class, spoon.support.reflect.declaration.CtInterfaceImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.SUPER_TYPE, true, true) + .field(CtRole.NESTED_TYPE, true, false) + .field(CtRole.METHOD, true, false) + .field(CtRole.FIELD, true, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.INTERFACE, false, false) + .field(CtRole.TYPE_PARAMETER, false, false) + .field(CtRole.TYPE_MEMBER, false, false) + .field(CtRole.PERMITTED_TYPE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtAssignment", spoon.reflect.code.CtAssignment.class, spoon.support.reflect.code.CtAssignmentImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.ASSIGNED, false, false) + .field(CtRole.ASSIGNMENT, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtBinaryOperator", spoon.reflect.code.CtBinaryOperator.class, spoon.support.reflect.code.CtBinaryOperatorImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.OPERATOR_KIND, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.LEFT_OPERAND, false, false) + .field(CtRole.RIGHT_OPERAND, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtEnumValue", spoon.reflect.declaration.CtEnumValue.class, spoon.support.reflect.declaration.CtEnumValueImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.ASSIGNMENT, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.DEFAULT_EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtRecordPattern", spoon.reflect.code.CtRecordPattern.class, spoon.support.reflect.code.CtRecordPatternImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.CAST, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.TYPE_REF, false, false) + .field(CtRole.PATTERN, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtModuleRequirement", spoon.reflect.declaration.CtModuleRequirement.class, spoon.support.reflect.declaration.CtModuleRequirementImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.MODULE_REF, false, false) + .field(CtRole.ANNOTATION, false, false) + + )); + + types.add(new Type("CtForEach", spoon.reflect.code.CtForEach.class, spoon.support.reflect.code.CtForEachImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.FOREACH_VARIABLE, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtConstructor", spoon.reflect.declaration.CtConstructor.class, spoon.support.reflect.declaration.CtConstructorImpl.class, fm -> fm + .field(CtRole.NAME, true, true) + .field(CtRole.TYPE, true, true) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMPACT_CONSTRUCTOR, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.RECEIVER_PARAMETER, false, false) + .field(CtRole.PARAMETER, false, false) + .field(CtRole.THROWN, false, false) + .field(CtRole.TYPE_PARAMETER, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtSuperAccess", spoon.reflect.code.CtSuperAccess.class, spoon.support.reflect.code.CtSuperAccessImpl.class, fm -> fm + .field(CtRole.TYPE, true, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.TARGET, false, false) + .field(CtRole.VARIABLE, false, false) + + )); + + types.add(new Type("CtPackageDeclaration", spoon.reflect.declaration.CtPackageDeclaration.class, spoon.support.reflect.declaration.CtPackageDeclarationImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.PACKAGE_REF, false, false) + + )); + + types.add(new Type("CtAnonymousExecutable", spoon.reflect.declaration.CtAnonymousExecutable.class, spoon.support.reflect.declaration.CtAnonymousExecutableImpl.class, fm -> fm + .field(CtRole.NAME, true, true) + .field(CtRole.TYPE, true, true) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.PARAMETER, true, true) + .field(CtRole.THROWN, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.RECEIVER_PARAMETER, true, true) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtComment", spoon.reflect.code.CtComment.class, spoon.support.reflect.code.CtCommentImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.COMMENT_CONTENT, false, false) + .field(CtRole.COMMENT_TYPE, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + + )); + + types.add(new Type("CtWildcardReference", spoon.reflect.reference.CtWildcardReference.class, spoon.support.reflect.reference.CtWildcardReferenceImpl.class, fm -> fm + .field(CtRole.NAME, true, true) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_UPPER, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, true, true) + .field(CtRole.COMMENT, true, true) + .field(CtRole.INTERFACE, true, true) + .field(CtRole.SUPER_TYPE, true, true) + .field(CtRole.TYPE_ARGUMENT, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.PACKAGE_REF, false, false) + .field(CtRole.DECLARING_TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.BOUNDING_TYPE, false, false) + + )); + + types.add(new Type("CtThisAccess", spoon.reflect.code.CtThisAccess.class, spoon.support.reflect.code.CtThisAccessImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.TARGET, false, false) + + )); + + types.add(new Type("CtRecordComponent", spoon.reflect.declaration.CtRecordComponent.class, spoon.support.reflect.declaration.CtRecordComponentImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtArrayWrite", spoon.reflect.code.CtArrayWrite.class, spoon.support.reflect.code.CtArrayWriteImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.TARGET, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtPackageReference", spoon.reflect.reference.CtPackageReference.class, spoon.support.reflect.reference.CtPackageReferenceImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.COMMENT, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + + )); + + types.add(new Type("CtJavaDoc", spoon.reflect.code.CtJavaDoc.class, spoon.support.reflect.code.CtJavaDocImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.COMMENT_CONTENT, false, false) + .field(CtRole.COMMENT_TYPE, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.COMMENT_TAG, false, false) + + )); + + types.add(new Type("CtArrayRead", spoon.reflect.code.CtArrayRead.class, spoon.support.reflect.code.CtArrayReadImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.TARGET, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtStatementList", spoon.reflect.code.CtStatementList.class, spoon.support.reflect.code.CtStatementListImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.STATEMENT, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtVariableWrite", spoon.reflect.code.CtVariableWrite.class, spoon.support.reflect.code.CtVariableWriteImpl.class, fm -> fm + .field(CtRole.TYPE, true, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.VARIABLE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtCompilationUnit", spoon.reflect.declaration.CtCompilationUnit.class, spoon.support.reflect.declaration.CtCompilationUnitImpl.class, fm -> fm + .field(CtRole.DECLARED_TYPE, true, true) + .field(CtRole.DECLARED_MODULE, true, true) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, true, true) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.PACKAGE_DECLARATION, false, false) + .field(CtRole.DECLARED_IMPORT, false, false) + .field(CtRole.DECLARED_MODULE_REF, false, false) + .field(CtRole.DECLARED_TYPE_REF, false, false) + + )); + + types.add(new Type("CtParameterReference", spoon.reflect.reference.CtParameterReference.class, spoon.support.reflect.reference.CtParameterReferenceImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.COMMENT, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) + + )); + + types.add(new Type("CtReceiverParameter", spoon.reflect.declaration.CtReceiverParameter.class, spoon.support.reflect.declaration.CtReceiverParameterImpl.class, fm -> fm + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtOperatorAssignment", spoon.reflect.code.CtOperatorAssignment.class, spoon.support.reflect.code.CtOperatorAssignmentImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.OPERATOR_KIND, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.ASSIGNED, false, false) + .field(CtRole.ASSIGNMENT, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtAnnotationFieldAccess", spoon.reflect.code.CtAnnotationFieldAccess.class, spoon.support.reflect.code.CtAnnotationFieldAccessImpl.class, fm -> fm + .field(CtRole.TYPE, true, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.TARGET, false, false) + .field(CtRole.VARIABLE, false, false) + + )); + + types.add(new Type("CtUnboundVariableReference", spoon.reflect.reference.CtUnboundVariableReference.class, spoon.support.reflect.reference.CtUnboundVariableReferenceImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.COMMENT, true, true) + .field(CtRole.ANNOTATION, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.TYPE, false, false) + + )); + + types.add(new Type("CtAnnotationMethod", spoon.reflect.declaration.CtAnnotationMethod.class, spoon.support.reflect.declaration.CtAnnotationMethodImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.BODY, true, true) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.IS_DEFAULT, false, false) + .field(CtRole.PARAMETER, true, true) + .field(CtRole.THROWN, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.TYPE_PARAMETER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.RECEIVER_PARAMETER, true, true) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.DEFAULT_EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtClass", spoon.reflect.declaration.CtClass.class, spoon.support.reflect.declaration.CtClassImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.NESTED_TYPE, true, false) + .field(CtRole.CONSTRUCTOR, true, false) + .field(CtRole.METHOD, true, false) + .field(CtRole.ANNONYMOUS_EXECUTABLE, true, false) + .field(CtRole.FIELD, true, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.SUPER_TYPE, false, false) + .field(CtRole.INTERFACE, false, false) + .field(CtRole.TYPE_PARAMETER, false, false) + .field(CtRole.TYPE_MEMBER, false, false) + .field(CtRole.PERMITTED_TYPE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtBlock", spoon.reflect.code.CtBlock.class, spoon.support.reflect.code.CtBlockImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.STATEMENT, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtPackage", spoon.reflect.declaration.CtPackage.class, spoon.support.reflect.declaration.CtPackageImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.SUB_PACKAGE, false, false) + .field(CtRole.CONTAINED_TYPE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtTryWithResource", spoon.reflect.code.CtTryWithResource.class, spoon.support.reflect.code.CtTryWithResourceImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TRY_RESOURCE, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.CATCH, false, false) + .field(CtRole.FINALIZER, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtAssert", spoon.reflect.code.CtAssert.class, spoon.support.reflect.code.CtAssertImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CONDITION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtSwitch", spoon.reflect.code.CtSwitch.class, spoon.support.reflect.code.CtSwitchImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.CASE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtTry", spoon.reflect.code.CtTry.class, spoon.support.reflect.code.CtTryImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.CATCH, false, false) + .field(CtRole.FINALIZER, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtYieldStatement", spoon.reflect.code.CtYieldStatement.class, spoon.support.reflect.code.CtYieldStatementImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtSynchronized", spoon.reflect.code.CtSynchronized.class, spoon.support.reflect.code.CtSynchronizedImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtTypeParameterReference", spoon.reflect.reference.CtTypeParameterReference.class, spoon.support.reflect.reference.CtTypeParameterReferenceImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, true, true) + .field(CtRole.COMMENT, true, true) + .field(CtRole.INTERFACE, true, true) + .field(CtRole.SUPER_TYPE, true, true) + .field(CtRole.TYPE_ARGUMENT, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.PACKAGE_REF, false, false) + .field(CtRole.DECLARING_TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) + + )); + + types.add(new Type("CtImport", spoon.reflect.declaration.CtImport.class, spoon.support.reflect.declaration.CtImportImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.IMPORT_REFERENCE, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtInvocation", spoon.reflect.code.CtInvocation.class, spoon.support.reflect.code.CtInvocationImpl.class, fm -> fm + .field(CtRole.TYPE, true, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.TYPE_ARGUMENT, true, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.TARGET, false, false) + .field(CtRole.EXECUTABLE_REF, false, false) + .field(CtRole.ARGUMENT, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtCodeSnippetExpression", spoon.reflect.code.CtCodeSnippetExpression.class, spoon.support.reflect.code.CtCodeSnippetExpressionImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.SNIPPET, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + + )); + + types.add(new Type("CtFieldWrite", spoon.reflect.code.CtFieldWrite.class, spoon.support.reflect.code.CtFieldWriteImpl.class, fm -> fm + .field(CtRole.TYPE, true, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.TARGET, false, false) + .field(CtRole.VARIABLE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtUnaryOperator", spoon.reflect.code.CtUnaryOperator.class, spoon.support.reflect.code.CtUnaryOperatorImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.OPERATOR_KIND, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtExecutableReference", spoon.reflect.reference.CtExecutableReference.class, spoon.support.reflect.reference.CtExecutableReferenceImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_STATIC, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.DECLARING_TYPE, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.ARGUMENT_TYPE, false, false) + .field(CtRole.TYPE_ARGUMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.COMMENT, true, true) + + )); + + types.add(new Type("CtFor", spoon.reflect.code.CtFor.class, spoon.support.reflect.code.CtForImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.FOR_INIT, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.FOR_UPDATE, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtVariableRead", spoon.reflect.code.CtVariableRead.class, spoon.support.reflect.code.CtVariableReadImpl.class, fm -> fm + .field(CtRole.TYPE, true, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.VARIABLE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtTypeParameter", spoon.reflect.declaration.CtTypeParameter.class, spoon.support.reflect.declaration.CtTypeParameterImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, true, true) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.INTERFACE, true, true) + .field(CtRole.TYPE_MEMBER, true, true) + .field(CtRole.NESTED_TYPE, true, true) + .field(CtRole.METHOD, true, true) + .field(CtRole.FIELD, true, true) + .field(CtRole.TYPE_PARAMETER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.SUPER_TYPE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtLocalVariable", spoon.reflect.code.CtLocalVariable.class, spoon.support.reflect.code.CtLocalVariableImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.ASSIGNMENT, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.IS_INFERRED, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.DEFAULT_EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtIf", spoon.reflect.code.CtIf.class, spoon.support.reflect.code.CtIfImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CONDITION, false, false) + .field(CtRole.THEN, false, false) + .field(CtRole.ELSE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtRecord", spoon.reflect.declaration.CtRecord.class, spoon.support.reflect.declaration.CtRecordImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.SUPER_TYPE, true, true) + .field(CtRole.NESTED_TYPE, true, false) + .field(CtRole.CONSTRUCTOR, true, false) + .field(CtRole.METHOD, true, false) + .field(CtRole.ANNONYMOUS_EXECUTABLE, true, false) + .field(CtRole.FIELD, true, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.PERMITTED_TYPE, true, true) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.INTERFACE, false, false) + .field(CtRole.TYPE_MEMBER, false, false) + .field(CtRole.TYPE_PARAMETER, false, false) + .field(CtRole.RECORD_COMPONENT, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtModule", spoon.reflect.declaration.CtModule.class, spoon.support.reflect.declaration.CtModuleImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.REQUIRED_MODULE, true, false) + .field(CtRole.EXPORTED_PACKAGE, true, false) + .field(CtRole.OPENED_PACKAGE, true, false) + .field(CtRole.SERVICE_TYPE, true, false) + .field(CtRole.PROVIDED_SERVICE, true, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.MODULE_DIRECTIVE, false, false) + .field(CtRole.SUB_PACKAGE, false, false) + + )); + + types.add(new Type("CtSwitchExpression", spoon.reflect.code.CtSwitchExpression.class, spoon.support.reflect.code.CtSwitchExpressionImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.CASE, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + + )); + + types.add(new Type("CtPackageExport", spoon.reflect.declaration.CtPackageExport.class, spoon.support.reflect.declaration.CtPackageExportImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.OPENED_PACKAGE, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.PACKAGE_REF, false, false) + .field(CtRole.MODULE_REF, false, false) + .field(CtRole.ANNOTATION, false, false) + + )); + + types.add(new Type("CtConstructorCall", spoon.reflect.code.CtConstructorCall.class, spoon.support.reflect.code.CtConstructorCallImpl.class, fm -> fm + .field(CtRole.TYPE, true, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.TYPE_ARGUMENT, true, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.EXECUTABLE_REF, false, false) + .field(CtRole.TARGET, false, false) + .field(CtRole.ARGUMENT, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtCase", spoon.reflect.code.CtCase.class, spoon.support.reflect.code.CtCaseImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.DEFAULT_EXPRESSION, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.CASE_KIND, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.STATEMENT, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtModuleReference", spoon.reflect.reference.CtModuleReference.class, spoon.support.reflect.reference.CtModuleReferenceImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.COMMENT, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + + )); + + types.add(new Type("CtCatch", spoon.reflect.code.CtCatch.class, spoon.support.reflect.code.CtCatchImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.PARAMETER, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtArrayTypeReference", spoon.reflect.reference.CtArrayTypeReference.class, spoon.support.reflect.reference.CtArrayTypeReferenceImpl.class, fm -> fm + .field(CtRole.NAME, true, true) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, true, true) + .field(CtRole.COMMENT, true, true) + .field(CtRole.INTERFACE, true, true) + .field(CtRole.SUPER_TYPE, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.PACKAGE_REF, false, false) + .field(CtRole.DECLARING_TYPE, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.TYPE_ARGUMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + + )); + + types.add(new Type("CtMethod", spoon.reflect.declaration.CtMethod.class, spoon.support.reflect.declaration.CtMethodImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.IS_DEFAULT, false, false) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE_PARAMETER, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.RECEIVER_PARAMETER, false, false) + .field(CtRole.PARAMETER, false, false) + .field(CtRole.THROWN, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtLambda", spoon.reflect.code.CtLambda.class, spoon.support.reflect.code.CtLambdaImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.THROWN, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.RECEIVER_PARAMETER, true, true) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.PARAMETER, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtTypePattern", spoon.reflect.code.CtTypePattern.class, spoon.support.reflect.code.CtTypePatternImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.CAST, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.VARIABLE, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtNewArray", spoon.reflect.code.CtNewArray.class, spoon.support.reflect.code.CtNewArrayImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.DIMENSION, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtIntersectionTypeReference", spoon.reflect.reference.CtIntersectionTypeReference.class, spoon.support.reflect.reference.CtIntersectionTypeReferenceImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, true, true) + .field(CtRole.COMMENT, true, true) + .field(CtRole.INTERFACE, true, true) + .field(CtRole.SUPER_TYPE, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.PACKAGE_REF, false, false) + .field(CtRole.DECLARING_TYPE, false, false) + .field(CtRole.TYPE_ARGUMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.BOUND, false, false) + + )); + + types.add(new Type("CtUsedService", spoon.reflect.declaration.CtUsedService.class, spoon.support.reflect.declaration.CtUsedServiceImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.SERVICE_TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) + + )); + + types.add(new Type("CtTextBlock", spoon.reflect.code.CtTextBlock.class, spoon.support.reflect.code.CtTextBlockImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.VALUE, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.LITERAL_BASE, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtThrow", spoon.reflect.code.CtThrow.class, spoon.support.reflect.code.CtThrowImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtLiteral", spoon.reflect.code.CtLiteral.class, spoon.support.reflect.code.CtLiteralImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.VALUE, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.LITERAL_BASE, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtReturn", spoon.reflect.code.CtReturn.class, spoon.support.reflect.code.CtReturnImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtField", spoon.reflect.declaration.CtField.class, spoon.support.reflect.declaration.CtFieldImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.ASSIGNMENT, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.DEFAULT_EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtJavaDocTag", spoon.reflect.code.CtJavaDocTag.class, spoon.support.reflect.code.CtJavaDocTagImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.COMMENT_CONTENT, false, false) + .field(CtRole.DOCUMENTATION_TYPE, false, false) + .field(CtRole.DOCUMENTATION_TYPE_REALNAME, false, false) + .field(CtRole.JAVADOC_TAG_VALUE, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + + )); + + types.add(new Type("CtTypeAccess", spoon.reflect.code.CtTypeAccess.class, spoon.support.reflect.code.CtTypeAccessImpl.class, fm -> fm + .field(CtRole.TYPE, true, true) + .field(CtRole.IS_IMPLICIT, true, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.ACCESSED_TYPE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtCodeSnippetStatement", spoon.reflect.code.CtCodeSnippetStatement.class, spoon.support.reflect.code.CtCodeSnippetStatementImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.SNIPPET, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + + )); + + types.add(new Type("CtDo", spoon.reflect.code.CtDo.class, spoon.support.reflect.code.CtDoImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtTypeMemberWildcardImportReference", spoon.reflect.reference.CtTypeMemberWildcardImportReference.class, spoon.support.reflect.reference.CtTypeMemberWildcardImportReferenceImpl.class, fm -> fm + .field(CtRole.NAME, true, true) + .field(CtRole.IS_IMPLICIT, true, true) + .field(CtRole.COMMENT, true, true) + .field(CtRole.ANNOTATION, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.TYPE_REF, false, false) + + )); + + types.add(new Type("CtAnnotation", spoon.reflect.declaration.CtAnnotation.class, spoon.support.reflect.declaration.CtAnnotationImpl.class, fm -> fm + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.CAST, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION_TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.VALUE, false, false) + + )); + + types.add(new Type("CtFieldRead", spoon.reflect.code.CtFieldRead.class, spoon.support.reflect.code.CtFieldReadImpl.class, fm -> fm + .field(CtRole.TYPE, true, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.TARGET, false, false) + .field(CtRole.VARIABLE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtBreak", spoon.reflect.code.CtBreak.class, spoon.support.reflect.code.CtBreakImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.TARGET_LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtFieldReference", spoon.reflect.reference.CtFieldReference.class, spoon.support.reflect.reference.CtFieldReferenceImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_FINAL, false, false) + .field(CtRole.IS_STATIC, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.COMMENT, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.DECLARING_TYPE, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) + + )); + + types.add(new Type("CtEnum", spoon.reflect.declaration.CtEnum.class, spoon.support.reflect.declaration.CtEnumImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.SUPER_TYPE, true, true) + .field(CtRole.NESTED_TYPE, true, false) + .field(CtRole.CONSTRUCTOR, true, false) + .field(CtRole.METHOD, true, false) + .field(CtRole.ANNONYMOUS_EXECUTABLE, true, false) + .field(CtRole.FIELD, true, false) + .field(CtRole.TYPE_PARAMETER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.PERMITTED_TYPE, true, true) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.INTERFACE, false, false) + .field(CtRole.TYPE_MEMBER, false, false) + .field(CtRole.VALUE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtCasePattern", spoon.reflect.code.CtCasePattern.class, spoon.support.reflect.code.CtCasePatternImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.PATTERN, false, false) + .field(CtRole.CONDITION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtNewClass", spoon.reflect.code.CtNewClass.class, spoon.support.reflect.code.CtNewClassImpl.class, fm -> fm + .field(CtRole.TYPE, true, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.TYPE_ARGUMENT, true, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.EXECUTABLE_REF, false, false) + .field(CtRole.TARGET, false, false) + .field(CtRole.ARGUMENT, false, false) + .field(CtRole.NESTED_TYPE, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtLocalVariableReference", spoon.reflect.reference.CtLocalVariableReference.class, spoon.support.reflect.reference.CtLocalVariableReferenceImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.COMMENT, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) + + )); + + types.add(new Type("CtAnnotationType", spoon.reflect.declaration.CtAnnotationType.class, spoon.support.reflect.declaration.CtAnnotationTypeImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.INTERFACE, true, true) + .field(CtRole.SUPER_TYPE, true, true) + .field(CtRole.NESTED_TYPE, true, false) + .field(CtRole.METHOD, true, false) + .field(CtRole.FIELD, true, false) + .field(CtRole.TYPE_PARAMETER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE_MEMBER, false, false) + .field(CtRole.COMMENT, false, false) + + )); + + types.add(new Type("CtCatchVariable", spoon.reflect.code.CtCatchVariable.class, spoon.support.reflect.code.CtCatchVariableImpl.class, fm -> fm + .field(CtRole.NAME, false, false) + .field(CtRole.TYPE, true, true) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.DEFAULT_EXPRESSION, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.MULTI_TYPE, false, false) + + )); + + types.add(new Type("CtExecutableReferenceExpression", spoon.reflect.code.CtExecutableReferenceExpression.class, spoon.support.reflect.code.CtExecutableReferenceExpressionImpl.class, fm -> fm + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.EXECUTABLE_REF, false, false) + .field(CtRole.TARGET, false, false) + + )); } } From 59aaa76949a78e6d6a40d884f06bd10157e28e57 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 1 Apr 2024 19:19:35 +0200 Subject: [PATCH 39/51] Reorganize import statements in Metamodel.java Rearranged the order of import statements in Metamodel.java to improve readability and organization. No changes were made to the actual functionality of the code. --- src/test/java/spoon/test/api/Metamodel.java | 1937 ++++++++++--------- 1 file changed, 969 insertions(+), 968 deletions(-) diff --git a/src/test/java/spoon/test/api/Metamodel.java b/src/test/java/spoon/test/api/Metamodel.java index f74078b5d45..b73b7a79c4f 100644 --- a/src/test/java/spoon/test/api/Metamodel.java +++ b/src/test/java/spoon/test/api/Metamodel.java @@ -16,14 +16,6 @@ */ package spoon.test.api; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Consumer; import spoon.metamodel.MetamodelConcept; import spoon.reflect.code.CtForEach; @@ -37,6 +29,15 @@ import spoon.reflect.visitor.CtScanner; import spoon.support.reflect.code.CtForEachImpl; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; + /** * This class enables to reason on the Spoon metamodel directly */ @@ -250,1201 +251,1201 @@ private static void initTypes(List types) { * Run the method main and copy the System output here */ types.add(new Type("CtConditional", spoon.reflect.code.CtConditional.class, spoon.support.reflect.code.CtConditionalImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CONDITION, false, false) - .field(CtRole.THEN, false, false) - .field(CtRole.ELSE, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.CAST, false, false) - - )); + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CONDITION, false, false) + .field(CtRole.THEN, false, false) + .field(CtRole.ELSE, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.CAST, false, false) + + )); types.add(new Type("CtProvidedService", spoon.reflect.declaration.CtProvidedService.class, spoon.support.reflect.declaration.CtProvidedServiceImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.SERVICE_TYPE, false, false) - .field(CtRole.IMPLEMENTATION_TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.SERVICE_TYPE, false, false) + .field(CtRole.IMPLEMENTATION_TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) - )); + )); types.add(new Type("CtParameter", spoon.reflect.declaration.CtParameter.class, spoon.support.reflect.declaration.CtParameterImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.IS_VARARGS, false, false) - .field(CtRole.DEFAULT_EXPRESSION, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.IS_INFERRED, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.IS_VARARGS, false, false) + .field(CtRole.DEFAULT_EXPRESSION, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.IS_INFERRED, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtWhile", spoon.reflect.code.CtWhile.class, spoon.support.reflect.code.CtWhileImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtTypeReference", spoon.reflect.reference.CtTypeReference.class, spoon.support.reflect.reference.CtTypeReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, true, true) - .field(CtRole.INTERFACE, true, true) - .field(CtRole.SUPER_TYPE, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.PACKAGE_REF, false, false) - .field(CtRole.DECLARING_TYPE, false, false) - .field(CtRole.TYPE_ARGUMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.COMMENT, true, true) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, true, true) + .field(CtRole.INTERFACE, true, true) + .field(CtRole.SUPER_TYPE, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.PACKAGE_REF, false, false) + .field(CtRole.DECLARING_TYPE, false, false) + .field(CtRole.TYPE_ARGUMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.COMMENT, true, true) + + )); types.add(new Type("CtCatchVariableReference", spoon.reflect.reference.CtCatchVariableReference.class, spoon.support.reflect.reference.CtCatchVariableReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.COMMENT, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) + .field(CtRole.NAME, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.COMMENT, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) - )); + )); types.add(new Type("CtContinue", spoon.reflect.code.CtContinue.class, spoon.support.reflect.code.CtContinueImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.TARGET_LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.TARGET_LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtInterface", spoon.reflect.declaration.CtInterface.class, spoon.support.reflect.declaration.CtInterfaceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.SUPER_TYPE, true, true) - .field(CtRole.NESTED_TYPE, true, false) - .field(CtRole.METHOD, true, false) - .field(CtRole.FIELD, true, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.INTERFACE, false, false) - .field(CtRole.TYPE_PARAMETER, false, false) - .field(CtRole.TYPE_MEMBER, false, false) - .field(CtRole.PERMITTED_TYPE, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.SUPER_TYPE, true, true) + .field(CtRole.NESTED_TYPE, true, false) + .field(CtRole.METHOD, true, false) + .field(CtRole.FIELD, true, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.INTERFACE, false, false) + .field(CtRole.TYPE_PARAMETER, false, false) + .field(CtRole.TYPE_MEMBER, false, false) + .field(CtRole.PERMITTED_TYPE, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtAssignment", spoon.reflect.code.CtAssignment.class, spoon.support.reflect.code.CtAssignmentImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.ASSIGNED, false, false) - .field(CtRole.ASSIGNMENT, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.ASSIGNED, false, false) + .field(CtRole.ASSIGNMENT, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtBinaryOperator", spoon.reflect.code.CtBinaryOperator.class, spoon.support.reflect.code.CtBinaryOperatorImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.OPERATOR_KIND, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.LEFT_OPERAND, false, false) - .field(CtRole.RIGHT_OPERAND, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.OPERATOR_KIND, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.LEFT_OPERAND, false, false) + .field(CtRole.RIGHT_OPERAND, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtEnumValue", spoon.reflect.declaration.CtEnumValue.class, spoon.support.reflect.declaration.CtEnumValueImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.ASSIGNMENT, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.DEFAULT_EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.ASSIGNMENT, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.DEFAULT_EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtRecordPattern", spoon.reflect.code.CtRecordPattern.class, spoon.support.reflect.code.CtRecordPatternImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.CAST, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.TYPE_REF, false, false) - .field(CtRole.PATTERN, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.CAST, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.TYPE_REF, false, false) + .field(CtRole.PATTERN, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtModuleRequirement", spoon.reflect.declaration.CtModuleRequirement.class, spoon.support.reflect.declaration.CtModuleRequirementImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.MODULE_REF, false, false) - .field(CtRole.ANNOTATION, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.MODULE_REF, false, false) + .field(CtRole.ANNOTATION, false, false) - )); + )); types.add(new Type("CtForEach", spoon.reflect.code.CtForEach.class, spoon.support.reflect.code.CtForEachImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.FOREACH_VARIABLE, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.FOREACH_VARIABLE, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtConstructor", spoon.reflect.declaration.CtConstructor.class, spoon.support.reflect.declaration.CtConstructorImpl.class, fm -> fm - .field(CtRole.NAME, true, true) - .field(CtRole.TYPE, true, true) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMPACT_CONSTRUCTOR, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.RECEIVER_PARAMETER, false, false) - .field(CtRole.PARAMETER, false, false) - .field(CtRole.THROWN, false, false) - .field(CtRole.TYPE_PARAMETER, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.NAME, true, true) + .field(CtRole.TYPE, true, true) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMPACT_CONSTRUCTOR, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.RECEIVER_PARAMETER, false, false) + .field(CtRole.PARAMETER, false, false) + .field(CtRole.THROWN, false, false) + .field(CtRole.TYPE_PARAMETER, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtSuperAccess", spoon.reflect.code.CtSuperAccess.class, spoon.support.reflect.code.CtSuperAccessImpl.class, fm -> fm - .field(CtRole.TYPE, true, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.TARGET, false, false) - .field(CtRole.VARIABLE, false, false) + .field(CtRole.TYPE, true, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.TARGET, false, false) + .field(CtRole.VARIABLE, false, false) - )); + )); types.add(new Type("CtPackageDeclaration", spoon.reflect.declaration.CtPackageDeclaration.class, spoon.support.reflect.declaration.CtPackageDeclarationImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.PACKAGE_REF, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.PACKAGE_REF, false, false) - )); + )); types.add(new Type("CtAnonymousExecutable", spoon.reflect.declaration.CtAnonymousExecutable.class, spoon.support.reflect.declaration.CtAnonymousExecutableImpl.class, fm -> fm - .field(CtRole.NAME, true, true) - .field(CtRole.TYPE, true, true) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.PARAMETER, true, true) - .field(CtRole.THROWN, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.RECEIVER_PARAMETER, true, true) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.NAME, true, true) + .field(CtRole.TYPE, true, true) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.PARAMETER, true, true) + .field(CtRole.THROWN, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.RECEIVER_PARAMETER, true, true) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtComment", spoon.reflect.code.CtComment.class, spoon.support.reflect.code.CtCommentImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.COMMENT_CONTENT, false, false) - .field(CtRole.COMMENT_TYPE, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.COMMENT_CONTENT, false, false) + .field(CtRole.COMMENT_TYPE, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) - )); + )); types.add(new Type("CtWildcardReference", spoon.reflect.reference.CtWildcardReference.class, spoon.support.reflect.reference.CtWildcardReferenceImpl.class, fm -> fm - .field(CtRole.NAME, true, true) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_UPPER, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, true, true) - .field(CtRole.COMMENT, true, true) - .field(CtRole.INTERFACE, true, true) - .field(CtRole.SUPER_TYPE, true, true) - .field(CtRole.TYPE_ARGUMENT, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.PACKAGE_REF, false, false) - .field(CtRole.DECLARING_TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.BOUNDING_TYPE, false, false) - - )); + .field(CtRole.NAME, true, true) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_UPPER, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, true, true) + .field(CtRole.COMMENT, true, true) + .field(CtRole.INTERFACE, true, true) + .field(CtRole.SUPER_TYPE, true, true) + .field(CtRole.TYPE_ARGUMENT, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.PACKAGE_REF, false, false) + .field(CtRole.DECLARING_TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.BOUNDING_TYPE, false, false) + + )); types.add(new Type("CtThisAccess", spoon.reflect.code.CtThisAccess.class, spoon.support.reflect.code.CtThisAccessImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.TARGET, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.TARGET, false, false) - )); + )); types.add(new Type("CtRecordComponent", spoon.reflect.declaration.CtRecordComponent.class, spoon.support.reflect.declaration.CtRecordComponentImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtArrayWrite", spoon.reflect.code.CtArrayWrite.class, spoon.support.reflect.code.CtArrayWriteImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.TARGET, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.TARGET, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtPackageReference", spoon.reflect.reference.CtPackageReference.class, spoon.support.reflect.reference.CtPackageReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.COMMENT, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) + .field(CtRole.NAME, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.COMMENT, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) - )); + )); types.add(new Type("CtJavaDoc", spoon.reflect.code.CtJavaDoc.class, spoon.support.reflect.code.CtJavaDocImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.COMMENT_CONTENT, false, false) - .field(CtRole.COMMENT_TYPE, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.COMMENT_TAG, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.COMMENT_CONTENT, false, false) + .field(CtRole.COMMENT_TYPE, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.COMMENT_TAG, false, false) - )); + )); types.add(new Type("CtArrayRead", spoon.reflect.code.CtArrayRead.class, spoon.support.reflect.code.CtArrayReadImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.TARGET, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.TARGET, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtStatementList", spoon.reflect.code.CtStatementList.class, spoon.support.reflect.code.CtStatementListImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.STATEMENT, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.STATEMENT, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtVariableWrite", spoon.reflect.code.CtVariableWrite.class, spoon.support.reflect.code.CtVariableWriteImpl.class, fm -> fm - .field(CtRole.TYPE, true, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.VARIABLE, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.TYPE, true, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.VARIABLE, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtCompilationUnit", spoon.reflect.declaration.CtCompilationUnit.class, spoon.support.reflect.declaration.CtCompilationUnitImpl.class, fm -> fm - .field(CtRole.DECLARED_TYPE, true, true) - .field(CtRole.DECLARED_MODULE, true, true) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, true, true) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.PACKAGE_DECLARATION, false, false) - .field(CtRole.DECLARED_IMPORT, false, false) - .field(CtRole.DECLARED_MODULE_REF, false, false) - .field(CtRole.DECLARED_TYPE_REF, false, false) - - )); + .field(CtRole.DECLARED_TYPE, true, true) + .field(CtRole.DECLARED_MODULE, true, true) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, true, true) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.PACKAGE_DECLARATION, false, false) + .field(CtRole.DECLARED_IMPORT, false, false) + .field(CtRole.DECLARED_MODULE_REF, false, false) + .field(CtRole.DECLARED_TYPE_REF, false, false) + + )); types.add(new Type("CtParameterReference", spoon.reflect.reference.CtParameterReference.class, spoon.support.reflect.reference.CtParameterReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.COMMENT, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) + .field(CtRole.NAME, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.COMMENT, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) - )); + )); types.add(new Type("CtReceiverParameter", spoon.reflect.declaration.CtReceiverParameter.class, spoon.support.reflect.declaration.CtReceiverParameterImpl.class, fm -> fm - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtOperatorAssignment", spoon.reflect.code.CtOperatorAssignment.class, spoon.support.reflect.code.CtOperatorAssignmentImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.OPERATOR_KIND, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.ASSIGNED, false, false) - .field(CtRole.ASSIGNMENT, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.OPERATOR_KIND, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.ASSIGNED, false, false) + .field(CtRole.ASSIGNMENT, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtAnnotationFieldAccess", spoon.reflect.code.CtAnnotationFieldAccess.class, spoon.support.reflect.code.CtAnnotationFieldAccessImpl.class, fm -> fm - .field(CtRole.TYPE, true, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.TARGET, false, false) - .field(CtRole.VARIABLE, false, false) + .field(CtRole.TYPE, true, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.TARGET, false, false) + .field(CtRole.VARIABLE, false, false) - )); + )); types.add(new Type("CtUnboundVariableReference", spoon.reflect.reference.CtUnboundVariableReference.class, spoon.support.reflect.reference.CtUnboundVariableReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.COMMENT, true, true) - .field(CtRole.ANNOTATION, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.TYPE, false, false) + .field(CtRole.NAME, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.COMMENT, true, true) + .field(CtRole.ANNOTATION, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.TYPE, false, false) - )); + )); types.add(new Type("CtAnnotationMethod", spoon.reflect.declaration.CtAnnotationMethod.class, spoon.support.reflect.declaration.CtAnnotationMethodImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.BODY, true, true) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.IS_DEFAULT, false, false) - .field(CtRole.PARAMETER, true, true) - .field(CtRole.THROWN, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.TYPE_PARAMETER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.RECEIVER_PARAMETER, true, true) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.DEFAULT_EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.BODY, true, true) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.IS_DEFAULT, false, false) + .field(CtRole.PARAMETER, true, true) + .field(CtRole.THROWN, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.TYPE_PARAMETER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.RECEIVER_PARAMETER, true, true) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.DEFAULT_EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtClass", spoon.reflect.declaration.CtClass.class, spoon.support.reflect.declaration.CtClassImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.NESTED_TYPE, true, false) - .field(CtRole.CONSTRUCTOR, true, false) - .field(CtRole.METHOD, true, false) - .field(CtRole.ANNONYMOUS_EXECUTABLE, true, false) - .field(CtRole.FIELD, true, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.SUPER_TYPE, false, false) - .field(CtRole.INTERFACE, false, false) - .field(CtRole.TYPE_PARAMETER, false, false) - .field(CtRole.TYPE_MEMBER, false, false) - .field(CtRole.PERMITTED_TYPE, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.NESTED_TYPE, true, false) + .field(CtRole.CONSTRUCTOR, true, false) + .field(CtRole.METHOD, true, false) + .field(CtRole.ANNONYMOUS_EXECUTABLE, true, false) + .field(CtRole.FIELD, true, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.SUPER_TYPE, false, false) + .field(CtRole.INTERFACE, false, false) + .field(CtRole.TYPE_PARAMETER, false, false) + .field(CtRole.TYPE_MEMBER, false, false) + .field(CtRole.PERMITTED_TYPE, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtBlock", spoon.reflect.code.CtBlock.class, spoon.support.reflect.code.CtBlockImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.STATEMENT, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.STATEMENT, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtPackage", spoon.reflect.declaration.CtPackage.class, spoon.support.reflect.declaration.CtPackageImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.SUB_PACKAGE, false, false) - .field(CtRole.CONTAINED_TYPE, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.SUB_PACKAGE, false, false) + .field(CtRole.CONTAINED_TYPE, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtTryWithResource", spoon.reflect.code.CtTryWithResource.class, spoon.support.reflect.code.CtTryWithResourceImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TRY_RESOURCE, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.CATCH, false, false) - .field(CtRole.FINALIZER, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TRY_RESOURCE, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.CATCH, false, false) + .field(CtRole.FINALIZER, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtAssert", spoon.reflect.code.CtAssert.class, spoon.support.reflect.code.CtAssertImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CONDITION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CONDITION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtSwitch", spoon.reflect.code.CtSwitch.class, spoon.support.reflect.code.CtSwitchImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.CASE, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.CASE, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtTry", spoon.reflect.code.CtTry.class, spoon.support.reflect.code.CtTryImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.CATCH, false, false) - .field(CtRole.FINALIZER, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.CATCH, false, false) + .field(CtRole.FINALIZER, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtYieldStatement", spoon.reflect.code.CtYieldStatement.class, spoon.support.reflect.code.CtYieldStatementImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtSynchronized", spoon.reflect.code.CtSynchronized.class, spoon.support.reflect.code.CtSynchronizedImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtTypeParameterReference", spoon.reflect.reference.CtTypeParameterReference.class, spoon.support.reflect.reference.CtTypeParameterReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, true, true) - .field(CtRole.COMMENT, true, true) - .field(CtRole.INTERFACE, true, true) - .field(CtRole.SUPER_TYPE, true, true) - .field(CtRole.TYPE_ARGUMENT, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.PACKAGE_REF, false, false) - .field(CtRole.DECLARING_TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, true, true) + .field(CtRole.COMMENT, true, true) + .field(CtRole.INTERFACE, true, true) + .field(CtRole.SUPER_TYPE, true, true) + .field(CtRole.TYPE_ARGUMENT, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.PACKAGE_REF, false, false) + .field(CtRole.DECLARING_TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) + + )); types.add(new Type("CtImport", spoon.reflect.declaration.CtImport.class, spoon.support.reflect.declaration.CtImportImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.IMPORT_REFERENCE, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.IMPORT_REFERENCE, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtInvocation", spoon.reflect.code.CtInvocation.class, spoon.support.reflect.code.CtInvocationImpl.class, fm -> fm - .field(CtRole.TYPE, true, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.TYPE_ARGUMENT, true, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.TARGET, false, false) - .field(CtRole.EXECUTABLE_REF, false, false) - .field(CtRole.ARGUMENT, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.TYPE, true, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.TYPE_ARGUMENT, true, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.TARGET, false, false) + .field(CtRole.EXECUTABLE_REF, false, false) + .field(CtRole.ARGUMENT, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtCodeSnippetExpression", spoon.reflect.code.CtCodeSnippetExpression.class, spoon.support.reflect.code.CtCodeSnippetExpressionImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.SNIPPET, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.SNIPPET, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) - )); + )); types.add(new Type("CtFieldWrite", spoon.reflect.code.CtFieldWrite.class, spoon.support.reflect.code.CtFieldWriteImpl.class, fm -> fm - .field(CtRole.TYPE, true, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.TARGET, false, false) - .field(CtRole.VARIABLE, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.TYPE, true, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.TARGET, false, false) + .field(CtRole.VARIABLE, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtUnaryOperator", spoon.reflect.code.CtUnaryOperator.class, spoon.support.reflect.code.CtUnaryOperatorImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.OPERATOR_KIND, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.OPERATOR_KIND, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtExecutableReference", spoon.reflect.reference.CtExecutableReference.class, spoon.support.reflect.reference.CtExecutableReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_STATIC, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.DECLARING_TYPE, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.ARGUMENT_TYPE, false, false) - .field(CtRole.TYPE_ARGUMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.COMMENT, true, true) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.IS_STATIC, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.DECLARING_TYPE, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.ARGUMENT_TYPE, false, false) + .field(CtRole.TYPE_ARGUMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.COMMENT, true, true) + + )); types.add(new Type("CtFor", spoon.reflect.code.CtFor.class, spoon.support.reflect.code.CtForImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.FOR_INIT, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.FOR_UPDATE, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.FOR_INIT, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.FOR_UPDATE, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtVariableRead", spoon.reflect.code.CtVariableRead.class, spoon.support.reflect.code.CtVariableReadImpl.class, fm -> fm - .field(CtRole.TYPE, true, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.VARIABLE, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.TYPE, true, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.VARIABLE, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtTypeParameter", spoon.reflect.declaration.CtTypeParameter.class, spoon.support.reflect.declaration.CtTypeParameterImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, true, true) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.INTERFACE, true, true) - .field(CtRole.TYPE_MEMBER, true, true) - .field(CtRole.NESTED_TYPE, true, true) - .field(CtRole.METHOD, true, true) - .field(CtRole.FIELD, true, true) - .field(CtRole.TYPE_PARAMETER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.SUPER_TYPE, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, true, true) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.INTERFACE, true, true) + .field(CtRole.TYPE_MEMBER, true, true) + .field(CtRole.NESTED_TYPE, true, true) + .field(CtRole.METHOD, true, true) + .field(CtRole.FIELD, true, true) + .field(CtRole.TYPE_PARAMETER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.SUPER_TYPE, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtLocalVariable", spoon.reflect.code.CtLocalVariable.class, spoon.support.reflect.code.CtLocalVariableImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.ASSIGNMENT, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.IS_INFERRED, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.DEFAULT_EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.ASSIGNMENT, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.IS_INFERRED, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.DEFAULT_EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtIf", spoon.reflect.code.CtIf.class, spoon.support.reflect.code.CtIfImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CONDITION, false, false) - .field(CtRole.THEN, false, false) - .field(CtRole.ELSE, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CONDITION, false, false) + .field(CtRole.THEN, false, false) + .field(CtRole.ELSE, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtRecord", spoon.reflect.declaration.CtRecord.class, spoon.support.reflect.declaration.CtRecordImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.SUPER_TYPE, true, true) - .field(CtRole.NESTED_TYPE, true, false) - .field(CtRole.CONSTRUCTOR, true, false) - .field(CtRole.METHOD, true, false) - .field(CtRole.ANNONYMOUS_EXECUTABLE, true, false) - .field(CtRole.FIELD, true, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.PERMITTED_TYPE, true, true) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.INTERFACE, false, false) - .field(CtRole.TYPE_MEMBER, false, false) - .field(CtRole.TYPE_PARAMETER, false, false) - .field(CtRole.RECORD_COMPONENT, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.SUPER_TYPE, true, true) + .field(CtRole.NESTED_TYPE, true, false) + .field(CtRole.CONSTRUCTOR, true, false) + .field(CtRole.METHOD, true, false) + .field(CtRole.ANNONYMOUS_EXECUTABLE, true, false) + .field(CtRole.FIELD, true, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.PERMITTED_TYPE, true, true) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.INTERFACE, false, false) + .field(CtRole.TYPE_MEMBER, false, false) + .field(CtRole.TYPE_PARAMETER, false, false) + .field(CtRole.RECORD_COMPONENT, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtModule", spoon.reflect.declaration.CtModule.class, spoon.support.reflect.declaration.CtModuleImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.REQUIRED_MODULE, true, false) - .field(CtRole.EXPORTED_PACKAGE, true, false) - .field(CtRole.OPENED_PACKAGE, true, false) - .field(CtRole.SERVICE_TYPE, true, false) - .field(CtRole.PROVIDED_SERVICE, true, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.MODULE_DIRECTIVE, false, false) - .field(CtRole.SUB_PACKAGE, false, false) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.REQUIRED_MODULE, true, false) + .field(CtRole.EXPORTED_PACKAGE, true, false) + .field(CtRole.OPENED_PACKAGE, true, false) + .field(CtRole.SERVICE_TYPE, true, false) + .field(CtRole.PROVIDED_SERVICE, true, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.MODULE_DIRECTIVE, false, false) + .field(CtRole.SUB_PACKAGE, false, false) + + )); types.add(new Type("CtSwitchExpression", spoon.reflect.code.CtSwitchExpression.class, spoon.support.reflect.code.CtSwitchExpressionImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.CASE, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.CASE, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) - )); + )); types.add(new Type("CtPackageExport", spoon.reflect.declaration.CtPackageExport.class, spoon.support.reflect.declaration.CtPackageExportImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.OPENED_PACKAGE, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.PACKAGE_REF, false, false) - .field(CtRole.MODULE_REF, false, false) - .field(CtRole.ANNOTATION, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.OPENED_PACKAGE, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.PACKAGE_REF, false, false) + .field(CtRole.MODULE_REF, false, false) + .field(CtRole.ANNOTATION, false, false) - )); + )); types.add(new Type("CtConstructorCall", spoon.reflect.code.CtConstructorCall.class, spoon.support.reflect.code.CtConstructorCallImpl.class, fm -> fm - .field(CtRole.TYPE, true, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.TYPE_ARGUMENT, true, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.EXECUTABLE_REF, false, false) - .field(CtRole.TARGET, false, false) - .field(CtRole.ARGUMENT, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.TYPE, true, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.TYPE_ARGUMENT, true, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.EXECUTABLE_REF, false, false) + .field(CtRole.TARGET, false, false) + .field(CtRole.ARGUMENT, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtCase", spoon.reflect.code.CtCase.class, spoon.support.reflect.code.CtCaseImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.DEFAULT_EXPRESSION, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.CASE_KIND, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.STATEMENT, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.DEFAULT_EXPRESSION, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.CASE_KIND, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.STATEMENT, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtModuleReference", spoon.reflect.reference.CtModuleReference.class, spoon.support.reflect.reference.CtModuleReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.COMMENT, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) + .field(CtRole.NAME, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.COMMENT, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) - )); + )); types.add(new Type("CtCatch", spoon.reflect.code.CtCatch.class, spoon.support.reflect.code.CtCatchImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.PARAMETER, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.PARAMETER, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtArrayTypeReference", spoon.reflect.reference.CtArrayTypeReference.class, spoon.support.reflect.reference.CtArrayTypeReferenceImpl.class, fm -> fm - .field(CtRole.NAME, true, true) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, true, true) - .field(CtRole.COMMENT, true, true) - .field(CtRole.INTERFACE, true, true) - .field(CtRole.SUPER_TYPE, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.PACKAGE_REF, false, false) - .field(CtRole.DECLARING_TYPE, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.TYPE_ARGUMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - - )); + .field(CtRole.NAME, true, true) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, true, true) + .field(CtRole.COMMENT, true, true) + .field(CtRole.INTERFACE, true, true) + .field(CtRole.SUPER_TYPE, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.PACKAGE_REF, false, false) + .field(CtRole.DECLARING_TYPE, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.TYPE_ARGUMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + + )); types.add(new Type("CtMethod", spoon.reflect.declaration.CtMethod.class, spoon.support.reflect.declaration.CtMethodImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.IS_DEFAULT, false, false) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE_PARAMETER, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.RECEIVER_PARAMETER, false, false) - .field(CtRole.PARAMETER, false, false) - .field(CtRole.THROWN, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.IS_DEFAULT, false, false) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE_PARAMETER, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.RECEIVER_PARAMETER, false, false) + .field(CtRole.PARAMETER, false, false) + .field(CtRole.THROWN, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtLambda", spoon.reflect.code.CtLambda.class, spoon.support.reflect.code.CtLambdaImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.THROWN, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.RECEIVER_PARAMETER, true, true) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.PARAMETER, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.THROWN, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.RECEIVER_PARAMETER, true, true) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.PARAMETER, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtTypePattern", spoon.reflect.code.CtTypePattern.class, spoon.support.reflect.code.CtTypePatternImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.CAST, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.VARIABLE, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.CAST, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.VARIABLE, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtNewArray", spoon.reflect.code.CtNewArray.class, spoon.support.reflect.code.CtNewArrayImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.DIMENSION, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.DIMENSION, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtIntersectionTypeReference", spoon.reflect.reference.CtIntersectionTypeReference.class, spoon.support.reflect.reference.CtIntersectionTypeReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, true, true) - .field(CtRole.COMMENT, true, true) - .field(CtRole.INTERFACE, true, true) - .field(CtRole.SUPER_TYPE, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.PACKAGE_REF, false, false) - .field(CtRole.DECLARING_TYPE, false, false) - .field(CtRole.TYPE_ARGUMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.BOUND, false, false) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, true, true) + .field(CtRole.COMMENT, true, true) + .field(CtRole.INTERFACE, true, true) + .field(CtRole.SUPER_TYPE, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.PACKAGE_REF, false, false) + .field(CtRole.DECLARING_TYPE, false, false) + .field(CtRole.TYPE_ARGUMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.BOUND, false, false) + + )); types.add(new Type("CtUsedService", spoon.reflect.declaration.CtUsedService.class, spoon.support.reflect.declaration.CtUsedServiceImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.SERVICE_TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.SERVICE_TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) - )); + )); types.add(new Type("CtTextBlock", spoon.reflect.code.CtTextBlock.class, spoon.support.reflect.code.CtTextBlockImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.VALUE, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.LITERAL_BASE, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.VALUE, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.LITERAL_BASE, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtThrow", spoon.reflect.code.CtThrow.class, spoon.support.reflect.code.CtThrowImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtLiteral", spoon.reflect.code.CtLiteral.class, spoon.support.reflect.code.CtLiteralImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.VALUE, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.LITERAL_BASE, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.VALUE, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.LITERAL_BASE, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtReturn", spoon.reflect.code.CtReturn.class, spoon.support.reflect.code.CtReturnImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtField", spoon.reflect.declaration.CtField.class, spoon.support.reflect.declaration.CtFieldImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.ASSIGNMENT, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.DEFAULT_EXPRESSION, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.ASSIGNMENT, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.DEFAULT_EXPRESSION, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtJavaDocTag", spoon.reflect.code.CtJavaDocTag.class, spoon.support.reflect.code.CtJavaDocTagImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.COMMENT_CONTENT, false, false) - .field(CtRole.DOCUMENTATION_TYPE, false, false) - .field(CtRole.DOCUMENTATION_TYPE_REALNAME, false, false) - .field(CtRole.JAVADOC_TAG_VALUE, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.COMMENT_CONTENT, false, false) + .field(CtRole.DOCUMENTATION_TYPE, false, false) + .field(CtRole.DOCUMENTATION_TYPE_REALNAME, false, false) + .field(CtRole.JAVADOC_TAG_VALUE, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) - )); + )); types.add(new Type("CtTypeAccess", spoon.reflect.code.CtTypeAccess.class, spoon.support.reflect.code.CtTypeAccessImpl.class, fm -> fm - .field(CtRole.TYPE, true, true) - .field(CtRole.IS_IMPLICIT, true, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.ACCESSED_TYPE, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.TYPE, true, true) + .field(CtRole.IS_IMPLICIT, true, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.ACCESSED_TYPE, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtCodeSnippetStatement", spoon.reflect.code.CtCodeSnippetStatement.class, spoon.support.reflect.code.CtCodeSnippetStatementImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.SNIPPET, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.SNIPPET, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) - )); + )); types.add(new Type("CtDo", spoon.reflect.code.CtDo.class, spoon.support.reflect.code.CtDoImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.EXPRESSION, false, false) - .field(CtRole.BODY, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.EXPRESSION, false, false) + .field(CtRole.BODY, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtTypeMemberWildcardImportReference", spoon.reflect.reference.CtTypeMemberWildcardImportReference.class, spoon.support.reflect.reference.CtTypeMemberWildcardImportReferenceImpl.class, fm -> fm - .field(CtRole.NAME, true, true) - .field(CtRole.IS_IMPLICIT, true, true) - .field(CtRole.COMMENT, true, true) - .field(CtRole.ANNOTATION, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.TYPE_REF, false, false) + .field(CtRole.NAME, true, true) + .field(CtRole.IS_IMPLICIT, true, true) + .field(CtRole.COMMENT, true, true) + .field(CtRole.ANNOTATION, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.TYPE_REF, false, false) - )); + )); types.add(new Type("CtAnnotation", spoon.reflect.declaration.CtAnnotation.class, spoon.support.reflect.declaration.CtAnnotationImpl.class, fm -> fm - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.CAST, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION_TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.VALUE, false, false) - - )); + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.CAST, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION_TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.VALUE, false, false) + + )); types.add(new Type("CtFieldRead", spoon.reflect.code.CtFieldRead.class, spoon.support.reflect.code.CtFieldReadImpl.class, fm -> fm - .field(CtRole.TYPE, true, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.TARGET, false, false) - .field(CtRole.VARIABLE, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.TYPE, true, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.TARGET, false, false) + .field(CtRole.VARIABLE, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtBreak", spoon.reflect.code.CtBreak.class, spoon.support.reflect.code.CtBreakImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.TARGET_LABEL, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.TARGET_LABEL, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtFieldReference", spoon.reflect.reference.CtFieldReference.class, spoon.support.reflect.reference.CtFieldReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_FINAL, false, false) - .field(CtRole.IS_STATIC, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.COMMENT, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.DECLARING_TYPE, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.IS_FINAL, false, false) + .field(CtRole.IS_STATIC, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.COMMENT, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.DECLARING_TYPE, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) + + )); types.add(new Type("CtEnum", spoon.reflect.declaration.CtEnum.class, spoon.support.reflect.declaration.CtEnumImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.SUPER_TYPE, true, true) - .field(CtRole.NESTED_TYPE, true, false) - .field(CtRole.CONSTRUCTOR, true, false) - .field(CtRole.METHOD, true, false) - .field(CtRole.ANNONYMOUS_EXECUTABLE, true, false) - .field(CtRole.FIELD, true, false) - .field(CtRole.TYPE_PARAMETER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.PERMITTED_TYPE, true, true) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.INTERFACE, false, false) - .field(CtRole.TYPE_MEMBER, false, false) - .field(CtRole.VALUE, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.SUPER_TYPE, true, true) + .field(CtRole.NESTED_TYPE, true, false) + .field(CtRole.CONSTRUCTOR, true, false) + .field(CtRole.METHOD, true, false) + .field(CtRole.ANNONYMOUS_EXECUTABLE, true, false) + .field(CtRole.FIELD, true, false) + .field(CtRole.TYPE_PARAMETER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.PERMITTED_TYPE, true, true) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.INTERFACE, false, false) + .field(CtRole.TYPE_MEMBER, false, false) + .field(CtRole.VALUE, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtCasePattern", spoon.reflect.code.CtCasePattern.class, spoon.support.reflect.code.CtCasePatternImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.PATTERN, false, false) - .field(CtRole.CONDITION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.COMMENT, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.PATTERN, false, false) + .field(CtRole.CONDITION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.COMMENT, false, false) - )); + )); types.add(new Type("CtNewClass", spoon.reflect.code.CtNewClass.class, spoon.support.reflect.code.CtNewClassImpl.class, fm -> fm - .field(CtRole.TYPE, true, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.LABEL, false, false) - .field(CtRole.TYPE_ARGUMENT, true, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.EXECUTABLE_REF, false, false) - .field(CtRole.TARGET, false, false) - .field(CtRole.ARGUMENT, false, false) - .field(CtRole.NESTED_TYPE, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.TYPE, true, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.LABEL, false, false) + .field(CtRole.TYPE_ARGUMENT, true, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.EXECUTABLE_REF, false, false) + .field(CtRole.TARGET, false, false) + .field(CtRole.ARGUMENT, false, false) + .field(CtRole.NESTED_TYPE, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtLocalVariableReference", spoon.reflect.reference.CtLocalVariableReference.class, spoon.support.reflect.reference.CtLocalVariableReferenceImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.COMMENT, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.ANNOTATION, false, false) + .field(CtRole.NAME, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.COMMENT, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.ANNOTATION, false, false) - )); + )); types.add(new Type("CtAnnotationType", spoon.reflect.declaration.CtAnnotationType.class, spoon.support.reflect.declaration.CtAnnotationTypeImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.IS_SHADOW, false, false) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.INTERFACE, true, true) - .field(CtRole.SUPER_TYPE, true, true) - .field(CtRole.NESTED_TYPE, true, false) - .field(CtRole.METHOD, true, false) - .field(CtRole.FIELD, true, false) - .field(CtRole.TYPE_PARAMETER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE_MEMBER, false, false) - .field(CtRole.COMMENT, false, false) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.IS_SHADOW, false, false) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.INTERFACE, true, true) + .field(CtRole.SUPER_TYPE, true, true) + .field(CtRole.NESTED_TYPE, true, false) + .field(CtRole.METHOD, true, false) + .field(CtRole.FIELD, true, false) + .field(CtRole.TYPE_PARAMETER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE_MEMBER, false, false) + .field(CtRole.COMMENT, false, false) + + )); types.add(new Type("CtCatchVariable", spoon.reflect.code.CtCatchVariable.class, spoon.support.reflect.code.CtCatchVariableImpl.class, fm -> fm - .field(CtRole.NAME, false, false) - .field(CtRole.TYPE, true, true) - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.DEFAULT_EXPRESSION, true, true) - .field(CtRole.MODIFIER, false, false) - .field(CtRole.EMODIFIER, true, true) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.MULTI_TYPE, false, false) - - )); + .field(CtRole.NAME, false, false) + .field(CtRole.TYPE, true, true) + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.DEFAULT_EXPRESSION, true, true) + .field(CtRole.MODIFIER, false, false) + .field(CtRole.EMODIFIER, true, true) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.MULTI_TYPE, false, false) + + )); types.add(new Type("CtExecutableReferenceExpression", spoon.reflect.code.CtExecutableReferenceExpression.class, spoon.support.reflect.code.CtExecutableReferenceExpressionImpl.class, fm -> fm - .field(CtRole.IS_IMPLICIT, false, false) - .field(CtRole.POSITION, false, false) - .field(CtRole.COMMENT, false, false) - .field(CtRole.ANNOTATION, false, false) - .field(CtRole.TYPE, false, false) - .field(CtRole.CAST, false, false) - .field(CtRole.EXECUTABLE_REF, false, false) - .field(CtRole.TARGET, false, false) - - )); + .field(CtRole.IS_IMPLICIT, false, false) + .field(CtRole.POSITION, false, false) + .field(CtRole.COMMENT, false, false) + .field(CtRole.ANNOTATION, false, false) + .field(CtRole.TYPE, false, false) + .field(CtRole.CAST, false, false) + .field(CtRole.EXECUTABLE_REF, false, false) + .field(CtRole.TARGET, false, false) + + )); } } From f771d56cb79a2ef88c7a1e2b76e724bc5bf77c99 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 1 Apr 2024 19:26:28 +0200 Subject: [PATCH 40/51] Reorganize import statements in Metamodel.java Rearranged the order of import statements in Metamodel.java to improve readability and organization. No changes were made to the actual functionality of the code. --- src/test/java/spoon/test/api/Metamodel.java | 368 ++++++++++---------- 1 file changed, 184 insertions(+), 184 deletions(-) diff --git a/src/test/java/spoon/test/api/Metamodel.java b/src/test/java/spoon/test/api/Metamodel.java index b73b7a79c4f..318400f3f9b 100644 --- a/src/test/java/spoon/test/api/Metamodel.java +++ b/src/test/java/spoon/test/api/Metamodel.java @@ -250,7 +250,7 @@ private static void initTypes(List types) { * body of this method was generated by /spoon-core/src/test/java/spoon/generating/MetamodelGenerator.java * Run the method main and copy the System output here */ - types.add(new Type("CtConditional", spoon.reflect.code.CtConditional.class, spoon.support.reflect.code.CtConditionalImpl.class, fm -> fm + types.add(new Type("CtConditional", spoon.reflect.code.CtConditional.class, spoon.support.reflect.code.CtConditionalImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.TYPE, false, false) @@ -261,9 +261,9 @@ private static void initTypes(List types) { .field(CtRole.COMMENT, false, false) .field(CtRole.CAST, false, false) - )); + )); - types.add(new Type("CtProvidedService", spoon.reflect.declaration.CtProvidedService.class, spoon.support.reflect.declaration.CtProvidedServiceImpl.class, fm -> fm + types.add(new Type("CtProvidedService", spoon.reflect.declaration.CtProvidedService.class, spoon.support.reflect.declaration.CtProvidedServiceImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.COMMENT, false, false) @@ -271,9 +271,9 @@ private static void initTypes(List types) { .field(CtRole.IMPLEMENTATION_TYPE, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtParameter", spoon.reflect.declaration.CtParameter.class, spoon.support.reflect.declaration.CtParameterImpl.class, fm -> fm + types.add(new Type("CtParameter", spoon.reflect.declaration.CtParameter.class, spoon.support.reflect.declaration.CtParameterImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -287,9 +287,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtWhile", spoon.reflect.code.CtWhile.class, spoon.support.reflect.code.CtWhileImpl.class, fm -> fm + types.add(new Type("CtWhile", spoon.reflect.code.CtWhile.class, spoon.support.reflect.code.CtWhileImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -298,9 +298,9 @@ private static void initTypes(List types) { .field(CtRole.BODY, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtTypeReference", spoon.reflect.reference.CtTypeReference.class, spoon.support.reflect.reference.CtTypeReferenceImpl.class, fm -> fm + types.add(new Type("CtTypeReference", spoon.reflect.reference.CtTypeReference.class, spoon.support.reflect.reference.CtTypeReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -314,9 +314,9 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.COMMENT, true, true) - )); + )); - types.add(new Type("CtCatchVariableReference", spoon.reflect.reference.CtCatchVariableReference.class, spoon.support.reflect.reference.CtCatchVariableReferenceImpl.class, fm -> fm + types.add(new Type("CtCatchVariableReference", spoon.reflect.reference.CtCatchVariableReference.class, spoon.support.reflect.reference.CtCatchVariableReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT, true, true) @@ -324,9 +324,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtContinue", spoon.reflect.code.CtContinue.class, spoon.support.reflect.code.CtContinueImpl.class, fm -> fm + types.add(new Type("CtContinue", spoon.reflect.code.CtContinue.class, spoon.support.reflect.code.CtContinueImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.TARGET_LABEL, false, false) @@ -334,9 +334,9 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtInterface", spoon.reflect.declaration.CtInterface.class, spoon.support.reflect.declaration.CtInterfaceImpl.class, fm -> fm + types.add(new Type("CtInterface", spoon.reflect.declaration.CtInterface.class, spoon.support.reflect.declaration.CtInterfaceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -355,9 +355,9 @@ private static void initTypes(List types) { .field(CtRole.PERMITTED_TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtAssignment", spoon.reflect.code.CtAssignment.class, spoon.support.reflect.code.CtAssignmentImpl.class, fm -> fm + types.add(new Type("CtAssignment", spoon.reflect.code.CtAssignment.class, spoon.support.reflect.code.CtAssignmentImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -368,9 +368,9 @@ private static void initTypes(List types) { .field(CtRole.ASSIGNMENT, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtBinaryOperator", spoon.reflect.code.CtBinaryOperator.class, spoon.support.reflect.code.CtBinaryOperatorImpl.class, fm -> fm + types.add(new Type("CtBinaryOperator", spoon.reflect.code.CtBinaryOperator.class, spoon.support.reflect.code.CtBinaryOperatorImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.OPERATOR_KIND, false, false) .field(CtRole.POSITION, false, false) @@ -381,9 +381,9 @@ private static void initTypes(List types) { .field(CtRole.RIGHT_OPERAND, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtEnumValue", spoon.reflect.declaration.CtEnumValue.class, spoon.support.reflect.declaration.CtEnumValueImpl.class, fm -> fm + types.add(new Type("CtEnumValue", spoon.reflect.declaration.CtEnumValue.class, spoon.support.reflect.declaration.CtEnumValueImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -396,9 +396,9 @@ private static void initTypes(List types) { .field(CtRole.DEFAULT_EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtRecordPattern", spoon.reflect.code.CtRecordPattern.class, spoon.support.reflect.code.CtRecordPatternImpl.class, fm -> fm + types.add(new Type("CtRecordPattern", spoon.reflect.code.CtRecordPattern.class, spoon.support.reflect.code.CtRecordPatternImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.CAST, true, true) .field(CtRole.POSITION, false, false) @@ -408,9 +408,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtModuleRequirement", spoon.reflect.declaration.CtModuleRequirement.class, spoon.support.reflect.declaration.CtModuleRequirementImpl.class, fm -> fm + types.add(new Type("CtModuleRequirement", spoon.reflect.declaration.CtModuleRequirement.class, spoon.support.reflect.declaration.CtModuleRequirementImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.MODIFIER, false, false) .field(CtRole.POSITION, false, false) @@ -418,9 +418,9 @@ private static void initTypes(List types) { .field(CtRole.MODULE_REF, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtForEach", spoon.reflect.code.CtForEach.class, spoon.support.reflect.code.CtForEachImpl.class, fm -> fm + types.add(new Type("CtForEach", spoon.reflect.code.CtForEach.class, spoon.support.reflect.code.CtForEachImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -430,9 +430,9 @@ private static void initTypes(List types) { .field(CtRole.BODY, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtConstructor", spoon.reflect.declaration.CtConstructor.class, spoon.support.reflect.declaration.CtConstructorImpl.class, fm -> fm + types.add(new Type("CtConstructor", spoon.reflect.declaration.CtConstructor.class, spoon.support.reflect.declaration.CtConstructorImpl.class, fm -> fm .field(CtRole.NAME, true, true) .field(CtRole.TYPE, true, true) .field(CtRole.IS_SHADOW, false, false) @@ -449,9 +449,9 @@ private static void initTypes(List types) { .field(CtRole.BODY, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtSuperAccess", spoon.reflect.code.CtSuperAccess.class, spoon.support.reflect.code.CtSuperAccessImpl.class, fm -> fm + types.add(new Type("CtSuperAccess", spoon.reflect.code.CtSuperAccess.class, spoon.support.reflect.code.CtSuperAccessImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -461,18 +461,18 @@ private static void initTypes(List types) { .field(CtRole.TARGET, false, false) .field(CtRole.VARIABLE, false, false) - )); + )); - types.add(new Type("CtPackageDeclaration", spoon.reflect.declaration.CtPackageDeclaration.class, spoon.support.reflect.declaration.CtPackageDeclarationImpl.class, fm -> fm + types.add(new Type("CtPackageDeclaration", spoon.reflect.declaration.CtPackageDeclaration.class, spoon.support.reflect.declaration.CtPackageDeclarationImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.COMMENT, false, false) .field(CtRole.ANNOTATION, false, false) .field(CtRole.PACKAGE_REF, false, false) - )); + )); - types.add(new Type("CtAnonymousExecutable", spoon.reflect.declaration.CtAnonymousExecutable.class, spoon.support.reflect.declaration.CtAnonymousExecutableImpl.class, fm -> fm + types.add(new Type("CtAnonymousExecutable", spoon.reflect.declaration.CtAnonymousExecutable.class, spoon.support.reflect.declaration.CtAnonymousExecutableImpl.class, fm -> fm .field(CtRole.NAME, true, true) .field(CtRole.TYPE, true, true) .field(CtRole.IS_IMPLICIT, false, false) @@ -486,9 +486,9 @@ private static void initTypes(List types) { .field(CtRole.BODY, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtComment", spoon.reflect.code.CtComment.class, spoon.support.reflect.code.CtCommentImpl.class, fm -> fm + types.add(new Type("CtComment", spoon.reflect.code.CtComment.class, spoon.support.reflect.code.CtCommentImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.COMMENT_CONTENT, false, false) @@ -497,9 +497,9 @@ private static void initTypes(List types) { .field(CtRole.COMMENT, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtWildcardReference", spoon.reflect.reference.CtWildcardReference.class, spoon.support.reflect.reference.CtWildcardReferenceImpl.class, fm -> fm + types.add(new Type("CtWildcardReference", spoon.reflect.reference.CtWildcardReference.class, spoon.support.reflect.reference.CtWildcardReferenceImpl.class, fm -> fm .field(CtRole.NAME, true, true) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_UPPER, false, false) @@ -515,9 +515,9 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.BOUNDING_TYPE, false, false) - )); + )); - types.add(new Type("CtThisAccess", spoon.reflect.code.CtThisAccess.class, spoon.support.reflect.code.CtThisAccessImpl.class, fm -> fm + types.add(new Type("CtThisAccess", spoon.reflect.code.CtThisAccess.class, spoon.support.reflect.code.CtThisAccessImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.COMMENT, false, false) @@ -526,9 +526,9 @@ private static void initTypes(List types) { .field(CtRole.CAST, false, false) .field(CtRole.TARGET, false, false) - )); + )); - types.add(new Type("CtRecordComponent", spoon.reflect.declaration.CtRecordComponent.class, spoon.support.reflect.declaration.CtRecordComponentImpl.class, fm -> fm + types.add(new Type("CtRecordComponent", spoon.reflect.declaration.CtRecordComponent.class, spoon.support.reflect.declaration.CtRecordComponentImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -537,9 +537,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtArrayWrite", spoon.reflect.code.CtArrayWrite.class, spoon.support.reflect.code.CtArrayWriteImpl.class, fm -> fm + types.add(new Type("CtArrayWrite", spoon.reflect.code.CtArrayWrite.class, spoon.support.reflect.code.CtArrayWriteImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) @@ -549,18 +549,18 @@ private static void initTypes(List types) { .field(CtRole.EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtPackageReference", spoon.reflect.reference.CtPackageReference.class, spoon.support.reflect.reference.CtPackageReferenceImpl.class, fm -> fm + types.add(new Type("CtPackageReference", spoon.reflect.reference.CtPackageReference.class, spoon.support.reflect.reference.CtPackageReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT, true, true) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtJavaDoc", spoon.reflect.code.CtJavaDoc.class, spoon.support.reflect.code.CtJavaDocImpl.class, fm -> fm + types.add(new Type("CtJavaDoc", spoon.reflect.code.CtJavaDoc.class, spoon.support.reflect.code.CtJavaDocImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.COMMENT_CONTENT, false, false) @@ -570,9 +570,9 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.COMMENT_TAG, false, false) - )); + )); - types.add(new Type("CtArrayRead", spoon.reflect.code.CtArrayRead.class, spoon.support.reflect.code.CtArrayReadImpl.class, fm -> fm + types.add(new Type("CtArrayRead", spoon.reflect.code.CtArrayRead.class, spoon.support.reflect.code.CtArrayReadImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) @@ -582,18 +582,18 @@ private static void initTypes(List types) { .field(CtRole.EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtStatementList", spoon.reflect.code.CtStatementList.class, spoon.support.reflect.code.CtStatementListImpl.class, fm -> fm + types.add(new Type("CtStatementList", spoon.reflect.code.CtStatementList.class, spoon.support.reflect.code.CtStatementListImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) .field(CtRole.STATEMENT, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtVariableWrite", spoon.reflect.code.CtVariableWrite.class, spoon.support.reflect.code.CtVariableWriteImpl.class, fm -> fm + types.add(new Type("CtVariableWrite", spoon.reflect.code.CtVariableWrite.class, spoon.support.reflect.code.CtVariableWriteImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -602,9 +602,9 @@ private static void initTypes(List types) { .field(CtRole.VARIABLE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtCompilationUnit", spoon.reflect.declaration.CtCompilationUnit.class, spoon.support.reflect.declaration.CtCompilationUnitImpl.class, fm -> fm + types.add(new Type("CtCompilationUnit", spoon.reflect.declaration.CtCompilationUnit.class, spoon.support.reflect.declaration.CtCompilationUnitImpl.class, fm -> fm .field(CtRole.DECLARED_TYPE, true, true) .field(CtRole.DECLARED_MODULE, true, true) .field(CtRole.IS_IMPLICIT, false, false) @@ -616,9 +616,9 @@ private static void initTypes(List types) { .field(CtRole.DECLARED_MODULE_REF, false, false) .field(CtRole.DECLARED_TYPE_REF, false, false) - )); + )); - types.add(new Type("CtParameterReference", spoon.reflect.reference.CtParameterReference.class, spoon.support.reflect.reference.CtParameterReferenceImpl.class, fm -> fm + types.add(new Type("CtParameterReference", spoon.reflect.reference.CtParameterReference.class, spoon.support.reflect.reference.CtParameterReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT, true, true) @@ -626,9 +626,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtReceiverParameter", spoon.reflect.declaration.CtReceiverParameter.class, spoon.support.reflect.declaration.CtReceiverParameterImpl.class, fm -> fm + types.add(new Type("CtReceiverParameter", spoon.reflect.declaration.CtReceiverParameter.class, spoon.support.reflect.declaration.CtReceiverParameterImpl.class, fm -> fm .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -636,9 +636,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtOperatorAssignment", spoon.reflect.code.CtOperatorAssignment.class, spoon.support.reflect.code.CtOperatorAssignmentImpl.class, fm -> fm + types.add(new Type("CtOperatorAssignment", spoon.reflect.code.CtOperatorAssignment.class, spoon.support.reflect.code.CtOperatorAssignmentImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.OPERATOR_KIND, false, false) @@ -650,9 +650,9 @@ private static void initTypes(List types) { .field(CtRole.ASSIGNMENT, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtAnnotationFieldAccess", spoon.reflect.code.CtAnnotationFieldAccess.class, spoon.support.reflect.code.CtAnnotationFieldAccessImpl.class, fm -> fm + types.add(new Type("CtAnnotationFieldAccess", spoon.reflect.code.CtAnnotationFieldAccess.class, spoon.support.reflect.code.CtAnnotationFieldAccessImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -662,9 +662,9 @@ private static void initTypes(List types) { .field(CtRole.TARGET, false, false) .field(CtRole.VARIABLE, false, false) - )); + )); - types.add(new Type("CtUnboundVariableReference", spoon.reflect.reference.CtUnboundVariableReference.class, spoon.support.reflect.reference.CtUnboundVariableReferenceImpl.class, fm -> fm + types.add(new Type("CtUnboundVariableReference", spoon.reflect.reference.CtUnboundVariableReference.class, spoon.support.reflect.reference.CtUnboundVariableReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT, true, true) @@ -672,9 +672,9 @@ private static void initTypes(List types) { .field(CtRole.POSITION, false, false) .field(CtRole.TYPE, false, false) - )); + )); - types.add(new Type("CtAnnotationMethod", spoon.reflect.declaration.CtAnnotationMethod.class, spoon.support.reflect.declaration.CtAnnotationMethodImpl.class, fm -> fm + types.add(new Type("CtAnnotationMethod", spoon.reflect.declaration.CtAnnotationMethod.class, spoon.support.reflect.declaration.CtAnnotationMethodImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.BODY, true, true) .field(CtRole.IS_SHADOW, false, false) @@ -692,9 +692,9 @@ private static void initTypes(List types) { .field(CtRole.DEFAULT_EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtClass", spoon.reflect.declaration.CtClass.class, spoon.support.reflect.declaration.CtClassImpl.class, fm -> fm + types.add(new Type("CtClass", spoon.reflect.declaration.CtClass.class, spoon.support.reflect.declaration.CtClassImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -715,9 +715,9 @@ private static void initTypes(List types) { .field(CtRole.PERMITTED_TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtBlock", spoon.reflect.code.CtBlock.class, spoon.support.reflect.code.CtBlockImpl.class, fm -> fm + types.add(new Type("CtBlock", spoon.reflect.code.CtBlock.class, spoon.support.reflect.code.CtBlockImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -725,9 +725,9 @@ private static void initTypes(List types) { .field(CtRole.STATEMENT, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtPackage", spoon.reflect.declaration.CtPackage.class, spoon.support.reflect.declaration.CtPackageImpl.class, fm -> fm + types.add(new Type("CtPackage", spoon.reflect.declaration.CtPackage.class, spoon.support.reflect.declaration.CtPackageImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -737,9 +737,9 @@ private static void initTypes(List types) { .field(CtRole.CONTAINED_TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtTryWithResource", spoon.reflect.code.CtTryWithResource.class, spoon.support.reflect.code.CtTryWithResourceImpl.class, fm -> fm + types.add(new Type("CtTryWithResource", spoon.reflect.code.CtTryWithResource.class, spoon.support.reflect.code.CtTryWithResourceImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -750,9 +750,9 @@ private static void initTypes(List types) { .field(CtRole.FINALIZER, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtAssert", spoon.reflect.code.CtAssert.class, spoon.support.reflect.code.CtAssertImpl.class, fm -> fm + types.add(new Type("CtAssert", spoon.reflect.code.CtAssert.class, spoon.support.reflect.code.CtAssertImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -761,9 +761,9 @@ private static void initTypes(List types) { .field(CtRole.EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtSwitch", spoon.reflect.code.CtSwitch.class, spoon.support.reflect.code.CtSwitchImpl.class, fm -> fm + types.add(new Type("CtSwitch", spoon.reflect.code.CtSwitch.class, spoon.support.reflect.code.CtSwitchImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -772,9 +772,9 @@ private static void initTypes(List types) { .field(CtRole.CASE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtTry", spoon.reflect.code.CtTry.class, spoon.support.reflect.code.CtTryImpl.class, fm -> fm + types.add(new Type("CtTry", spoon.reflect.code.CtTry.class, spoon.support.reflect.code.CtTryImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -784,9 +784,9 @@ private static void initTypes(List types) { .field(CtRole.FINALIZER, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtYieldStatement", spoon.reflect.code.CtYieldStatement.class, spoon.support.reflect.code.CtYieldStatementImpl.class, fm -> fm + types.add(new Type("CtYieldStatement", spoon.reflect.code.CtYieldStatement.class, spoon.support.reflect.code.CtYieldStatementImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -794,9 +794,9 @@ private static void initTypes(List types) { .field(CtRole.EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtSynchronized", spoon.reflect.code.CtSynchronized.class, spoon.support.reflect.code.CtSynchronizedImpl.class, fm -> fm + types.add(new Type("CtSynchronized", spoon.reflect.code.CtSynchronized.class, spoon.support.reflect.code.CtSynchronizedImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -805,9 +805,9 @@ private static void initTypes(List types) { .field(CtRole.BODY, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtTypeParameterReference", spoon.reflect.reference.CtTypeParameterReference.class, spoon.support.reflect.reference.CtTypeParameterReferenceImpl.class, fm -> fm + types.add(new Type("CtTypeParameterReference", spoon.reflect.reference.CtTypeParameterReference.class, spoon.support.reflect.reference.CtTypeParameterReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -821,18 +821,18 @@ private static void initTypes(List types) { .field(CtRole.DECLARING_TYPE, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtImport", spoon.reflect.declaration.CtImport.class, spoon.support.reflect.declaration.CtImportImpl.class, fm -> fm + types.add(new Type("CtImport", spoon.reflect.declaration.CtImport.class, spoon.support.reflect.declaration.CtImportImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.IMPORT_REFERENCE, false, false) .field(CtRole.ANNOTATION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtInvocation", spoon.reflect.code.CtInvocation.class, spoon.support.reflect.code.CtInvocationImpl.class, fm -> fm + types.add(new Type("CtInvocation", spoon.reflect.code.CtInvocation.class, spoon.support.reflect.code.CtInvocationImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) @@ -845,9 +845,9 @@ private static void initTypes(List types) { .field(CtRole.ARGUMENT, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtCodeSnippetExpression", spoon.reflect.code.CtCodeSnippetExpression.class, spoon.support.reflect.code.CtCodeSnippetExpressionImpl.class, fm -> fm + types.add(new Type("CtCodeSnippetExpression", spoon.reflect.code.CtCodeSnippetExpression.class, spoon.support.reflect.code.CtCodeSnippetExpressionImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.SNIPPET, false, false) @@ -856,9 +856,9 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.CAST, false, false) - )); + )); - types.add(new Type("CtFieldWrite", spoon.reflect.code.CtFieldWrite.class, spoon.support.reflect.code.CtFieldWriteImpl.class, fm -> fm + types.add(new Type("CtFieldWrite", spoon.reflect.code.CtFieldWrite.class, spoon.support.reflect.code.CtFieldWriteImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -868,9 +868,9 @@ private static void initTypes(List types) { .field(CtRole.VARIABLE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtUnaryOperator", spoon.reflect.code.CtUnaryOperator.class, spoon.support.reflect.code.CtUnaryOperatorImpl.class, fm -> fm + types.add(new Type("CtUnaryOperator", spoon.reflect.code.CtUnaryOperator.class, spoon.support.reflect.code.CtUnaryOperatorImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.OPERATOR_KIND, false, false) @@ -881,9 +881,9 @@ private static void initTypes(List types) { .field(CtRole.EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtExecutableReference", spoon.reflect.reference.CtExecutableReference.class, spoon.support.reflect.reference.CtExecutableReferenceImpl.class, fm -> fm + types.add(new Type("CtExecutableReference", spoon.reflect.reference.CtExecutableReference.class, spoon.support.reflect.reference.CtExecutableReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_STATIC, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -895,9 +895,9 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.COMMENT, true, true) - )); + )); - types.add(new Type("CtFor", spoon.reflect.code.CtFor.class, spoon.support.reflect.code.CtForImpl.class, fm -> fm + types.add(new Type("CtFor", spoon.reflect.code.CtFor.class, spoon.support.reflect.code.CtForImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -908,9 +908,9 @@ private static void initTypes(List types) { .field(CtRole.BODY, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtVariableRead", spoon.reflect.code.CtVariableRead.class, spoon.support.reflect.code.CtVariableReadImpl.class, fm -> fm + types.add(new Type("CtVariableRead", spoon.reflect.code.CtVariableRead.class, spoon.support.reflect.code.CtVariableReadImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -919,9 +919,9 @@ private static void initTypes(List types) { .field(CtRole.VARIABLE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtTypeParameter", spoon.reflect.declaration.CtTypeParameter.class, spoon.support.reflect.declaration.CtTypeParameterImpl.class, fm -> fm + types.add(new Type("CtTypeParameter", spoon.reflect.declaration.CtTypeParameter.class, spoon.support.reflect.declaration.CtTypeParameterImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -938,9 +938,9 @@ private static void initTypes(List types) { .field(CtRole.SUPER_TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtLocalVariable", spoon.reflect.code.CtLocalVariable.class, spoon.support.reflect.code.CtLocalVariableImpl.class, fm -> fm + types.add(new Type("CtLocalVariable", spoon.reflect.code.CtLocalVariable.class, spoon.support.reflect.code.CtLocalVariableImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) @@ -954,9 +954,9 @@ private static void initTypes(List types) { .field(CtRole.DEFAULT_EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtIf", spoon.reflect.code.CtIf.class, spoon.support.reflect.code.CtIfImpl.class, fm -> fm + types.add(new Type("CtIf", spoon.reflect.code.CtIf.class, spoon.support.reflect.code.CtIfImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -966,9 +966,9 @@ private static void initTypes(List types) { .field(CtRole.ELSE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtRecord", spoon.reflect.declaration.CtRecord.class, spoon.support.reflect.declaration.CtRecordImpl.class, fm -> fm + types.add(new Type("CtRecord", spoon.reflect.declaration.CtRecord.class, spoon.support.reflect.declaration.CtRecordImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -990,9 +990,9 @@ private static void initTypes(List types) { .field(CtRole.RECORD_COMPONENT, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtModule", spoon.reflect.declaration.CtModule.class, spoon.support.reflect.declaration.CtModuleImpl.class, fm -> fm + types.add(new Type("CtModule", spoon.reflect.declaration.CtModule.class, spoon.support.reflect.declaration.CtModuleImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.MODIFIER, false, false) @@ -1007,9 +1007,9 @@ private static void initTypes(List types) { .field(CtRole.MODULE_DIRECTIVE, false, false) .field(CtRole.SUB_PACKAGE, false, false) - )); + )); - types.add(new Type("CtSwitchExpression", spoon.reflect.code.CtSwitchExpression.class, spoon.support.reflect.code.CtSwitchExpressionImpl.class, fm -> fm + types.add(new Type("CtSwitchExpression", spoon.reflect.code.CtSwitchExpression.class, spoon.support.reflect.code.CtSwitchExpressionImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) @@ -1019,9 +1019,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.CAST, false, false) - )); + )); - types.add(new Type("CtPackageExport", spoon.reflect.declaration.CtPackageExport.class, spoon.support.reflect.declaration.CtPackageExportImpl.class, fm -> fm + types.add(new Type("CtPackageExport", spoon.reflect.declaration.CtPackageExport.class, spoon.support.reflect.declaration.CtPackageExportImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.OPENED_PACKAGE, false, false) @@ -1030,9 +1030,9 @@ private static void initTypes(List types) { .field(CtRole.MODULE_REF, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtConstructorCall", spoon.reflect.code.CtConstructorCall.class, spoon.support.reflect.code.CtConstructorCallImpl.class, fm -> fm + types.add(new Type("CtConstructorCall", spoon.reflect.code.CtConstructorCall.class, spoon.support.reflect.code.CtConstructorCallImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) @@ -1045,9 +1045,9 @@ private static void initTypes(List types) { .field(CtRole.ARGUMENT, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtCase", spoon.reflect.code.CtCase.class, spoon.support.reflect.code.CtCaseImpl.class, fm -> fm + types.add(new Type("CtCase", spoon.reflect.code.CtCase.class, spoon.support.reflect.code.CtCaseImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.DEFAULT_EXPRESSION, false, false) .field(CtRole.LABEL, false, false) @@ -1058,18 +1058,18 @@ private static void initTypes(List types) { .field(CtRole.STATEMENT, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtModuleReference", spoon.reflect.reference.CtModuleReference.class, spoon.support.reflect.reference.CtModuleReferenceImpl.class, fm -> fm + types.add(new Type("CtModuleReference", spoon.reflect.reference.CtModuleReference.class, spoon.support.reflect.reference.CtModuleReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT, true, true) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtCatch", spoon.reflect.code.CtCatch.class, spoon.support.reflect.code.CtCatchImpl.class, fm -> fm + types.add(new Type("CtCatch", spoon.reflect.code.CtCatch.class, spoon.support.reflect.code.CtCatchImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) @@ -1077,9 +1077,9 @@ private static void initTypes(List types) { .field(CtRole.BODY, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtArrayTypeReference", spoon.reflect.reference.CtArrayTypeReference.class, spoon.support.reflect.reference.CtArrayTypeReferenceImpl.class, fm -> fm + types.add(new Type("CtArrayTypeReference", spoon.reflect.reference.CtArrayTypeReference.class, spoon.support.reflect.reference.CtArrayTypeReferenceImpl.class, fm -> fm .field(CtRole.NAME, true, true) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -1094,9 +1094,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE_ARGUMENT, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtMethod", spoon.reflect.declaration.CtMethod.class, spoon.support.reflect.declaration.CtMethodImpl.class, fm -> fm + types.add(new Type("CtMethod", spoon.reflect.declaration.CtMethod.class, spoon.support.reflect.declaration.CtMethodImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -1113,9 +1113,9 @@ private static void initTypes(List types) { .field(CtRole.BODY, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtLambda", spoon.reflect.code.CtLambda.class, spoon.support.reflect.code.CtLambdaImpl.class, fm -> fm + types.add(new Type("CtLambda", spoon.reflect.code.CtLambda.class, spoon.support.reflect.code.CtLambdaImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.THROWN, true, true) @@ -1129,9 +1129,9 @@ private static void initTypes(List types) { .field(CtRole.EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtTypePattern", spoon.reflect.code.CtTypePattern.class, spoon.support.reflect.code.CtTypePatternImpl.class, fm -> fm + types.add(new Type("CtTypePattern", spoon.reflect.code.CtTypePattern.class, spoon.support.reflect.code.CtTypePatternImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.CAST, true, true) .field(CtRole.POSITION, false, false) @@ -1140,9 +1140,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtNewArray", spoon.reflect.code.CtNewArray.class, spoon.support.reflect.code.CtNewArrayImpl.class, fm -> fm + types.add(new Type("CtNewArray", spoon.reflect.code.CtNewArray.class, spoon.support.reflect.code.CtNewArrayImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) @@ -1152,9 +1152,9 @@ private static void initTypes(List types) { .field(CtRole.DIMENSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtIntersectionTypeReference", spoon.reflect.reference.CtIntersectionTypeReference.class, spoon.support.reflect.reference.CtIntersectionTypeReferenceImpl.class, fm -> fm + types.add(new Type("CtIntersectionTypeReference", spoon.reflect.reference.CtIntersectionTypeReference.class, spoon.support.reflect.reference.CtIntersectionTypeReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -1169,18 +1169,18 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.BOUND, false, false) - )); + )); - types.add(new Type("CtUsedService", spoon.reflect.declaration.CtUsedService.class, spoon.support.reflect.declaration.CtUsedServiceImpl.class, fm -> fm + types.add(new Type("CtUsedService", spoon.reflect.declaration.CtUsedService.class, spoon.support.reflect.declaration.CtUsedServiceImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.COMMENT, false, false) .field(CtRole.SERVICE_TYPE, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtTextBlock", spoon.reflect.code.CtTextBlock.class, spoon.support.reflect.code.CtTextBlockImpl.class, fm -> fm + types.add(new Type("CtTextBlock", spoon.reflect.code.CtTextBlock.class, spoon.support.reflect.code.CtTextBlockImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.VALUE, false, false) .field(CtRole.POSITION, false, false) @@ -1190,9 +1190,9 @@ private static void initTypes(List types) { .field(CtRole.CAST, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtThrow", spoon.reflect.code.CtThrow.class, spoon.support.reflect.code.CtThrowImpl.class, fm -> fm + types.add(new Type("CtThrow", spoon.reflect.code.CtThrow.class, spoon.support.reflect.code.CtThrowImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -1200,9 +1200,9 @@ private static void initTypes(List types) { .field(CtRole.EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtLiteral", spoon.reflect.code.CtLiteral.class, spoon.support.reflect.code.CtLiteralImpl.class, fm -> fm + types.add(new Type("CtLiteral", spoon.reflect.code.CtLiteral.class, spoon.support.reflect.code.CtLiteralImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.VALUE, false, false) .field(CtRole.POSITION, false, false) @@ -1212,9 +1212,9 @@ private static void initTypes(List types) { .field(CtRole.CAST, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtReturn", spoon.reflect.code.CtReturn.class, spoon.support.reflect.code.CtReturnImpl.class, fm -> fm + types.add(new Type("CtReturn", spoon.reflect.code.CtReturn.class, spoon.support.reflect.code.CtReturnImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -1222,9 +1222,9 @@ private static void initTypes(List types) { .field(CtRole.EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtField", spoon.reflect.declaration.CtField.class, spoon.support.reflect.declaration.CtFieldImpl.class, fm -> fm + types.add(new Type("CtField", spoon.reflect.declaration.CtField.class, spoon.support.reflect.declaration.CtFieldImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -1237,9 +1237,9 @@ private static void initTypes(List types) { .field(CtRole.DEFAULT_EXPRESSION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtJavaDocTag", spoon.reflect.code.CtJavaDocTag.class, spoon.support.reflect.code.CtJavaDocTagImpl.class, fm -> fm + types.add(new Type("CtJavaDocTag", spoon.reflect.code.CtJavaDocTag.class, spoon.support.reflect.code.CtJavaDocTagImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT_CONTENT, false, false) .field(CtRole.DOCUMENTATION_TYPE, false, false) @@ -1249,9 +1249,9 @@ private static void initTypes(List types) { .field(CtRole.COMMENT, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtTypeAccess", spoon.reflect.code.CtTypeAccess.class, spoon.support.reflect.code.CtTypeAccessImpl.class, fm -> fm + types.add(new Type("CtTypeAccess", spoon.reflect.code.CtTypeAccess.class, spoon.support.reflect.code.CtTypeAccessImpl.class, fm -> fm .field(CtRole.TYPE, true, true) .field(CtRole.IS_IMPLICIT, true, false) .field(CtRole.POSITION, false, false) @@ -1260,9 +1260,9 @@ private static void initTypes(List types) { .field(CtRole.ACCESSED_TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtCodeSnippetStatement", spoon.reflect.code.CtCodeSnippetStatement.class, spoon.support.reflect.code.CtCodeSnippetStatementImpl.class, fm -> fm + types.add(new Type("CtCodeSnippetStatement", spoon.reflect.code.CtCodeSnippetStatement.class, spoon.support.reflect.code.CtCodeSnippetStatementImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -1270,9 +1270,9 @@ private static void initTypes(List types) { .field(CtRole.COMMENT, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtDo", spoon.reflect.code.CtDo.class, spoon.support.reflect.code.CtDoImpl.class, fm -> fm + types.add(new Type("CtDo", spoon.reflect.code.CtDo.class, spoon.support.reflect.code.CtDoImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -1281,9 +1281,9 @@ private static void initTypes(List types) { .field(CtRole.BODY, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtTypeMemberWildcardImportReference", spoon.reflect.reference.CtTypeMemberWildcardImportReference.class, spoon.support.reflect.reference.CtTypeMemberWildcardImportReferenceImpl.class, fm -> fm + types.add(new Type("CtTypeMemberWildcardImportReference", spoon.reflect.reference.CtTypeMemberWildcardImportReference.class, spoon.support.reflect.reference.CtTypeMemberWildcardImportReferenceImpl.class, fm -> fm .field(CtRole.NAME, true, true) .field(CtRole.IS_IMPLICIT, true, true) .field(CtRole.COMMENT, true, true) @@ -1291,9 +1291,9 @@ private static void initTypes(List types) { .field(CtRole.POSITION, false, false) .field(CtRole.TYPE_REF, false, false) - )); + )); - types.add(new Type("CtAnnotation", spoon.reflect.declaration.CtAnnotation.class, spoon.support.reflect.declaration.CtAnnotationImpl.class, fm -> fm + types.add(new Type("CtAnnotation", spoon.reflect.declaration.CtAnnotation.class, spoon.support.reflect.declaration.CtAnnotationImpl.class, fm -> fm .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.CAST, true, true) @@ -1304,9 +1304,9 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.VALUE, false, false) - )); + )); - types.add(new Type("CtFieldRead", spoon.reflect.code.CtFieldRead.class, spoon.support.reflect.code.CtFieldReadImpl.class, fm -> fm + types.add(new Type("CtFieldRead", spoon.reflect.code.CtFieldRead.class, spoon.support.reflect.code.CtFieldReadImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -1316,9 +1316,9 @@ private static void initTypes(List types) { .field(CtRole.VARIABLE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtBreak", spoon.reflect.code.CtBreak.class, spoon.support.reflect.code.CtBreakImpl.class, fm -> fm + types.add(new Type("CtBreak", spoon.reflect.code.CtBreak.class, spoon.support.reflect.code.CtBreakImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.TARGET_LABEL, false, false) @@ -1326,9 +1326,9 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtFieldReference", spoon.reflect.reference.CtFieldReference.class, spoon.support.reflect.reference.CtFieldReferenceImpl.class, fm -> fm + types.add(new Type("CtFieldReference", spoon.reflect.reference.CtFieldReference.class, spoon.support.reflect.reference.CtFieldReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_FINAL, false, false) .field(CtRole.IS_STATIC, false, false) @@ -1339,9 +1339,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtEnum", spoon.reflect.declaration.CtEnum.class, spoon.support.reflect.declaration.CtEnumImpl.class, fm -> fm + types.add(new Type("CtEnum", spoon.reflect.declaration.CtEnum.class, spoon.support.reflect.declaration.CtEnumImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -1363,9 +1363,9 @@ private static void initTypes(List types) { .field(CtRole.VALUE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtCasePattern", spoon.reflect.code.CtCasePattern.class, spoon.support.reflect.code.CtCasePatternImpl.class, fm -> fm + types.add(new Type("CtCasePattern", spoon.reflect.code.CtCasePattern.class, spoon.support.reflect.code.CtCasePatternImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.CAST, false, false) @@ -1375,9 +1375,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtNewClass", spoon.reflect.code.CtNewClass.class, spoon.support.reflect.code.CtNewClassImpl.class, fm -> fm + types.add(new Type("CtNewClass", spoon.reflect.code.CtNewClass.class, spoon.support.reflect.code.CtNewClassImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) @@ -1391,9 +1391,9 @@ private static void initTypes(List types) { .field(CtRole.NESTED_TYPE, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtLocalVariableReference", spoon.reflect.reference.CtLocalVariableReference.class, spoon.support.reflect.reference.CtLocalVariableReferenceImpl.class, fm -> fm + types.add(new Type("CtLocalVariableReference", spoon.reflect.reference.CtLocalVariableReference.class, spoon.support.reflect.reference.CtLocalVariableReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT, true, true) @@ -1401,9 +1401,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE, false, false) .field(CtRole.ANNOTATION, false, false) - )); + )); - types.add(new Type("CtAnnotationType", spoon.reflect.declaration.CtAnnotationType.class, spoon.support.reflect.declaration.CtAnnotationTypeImpl.class, fm -> fm + types.add(new Type("CtAnnotationType", spoon.reflect.declaration.CtAnnotationType.class, spoon.support.reflect.declaration.CtAnnotationTypeImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -1420,9 +1420,9 @@ private static void initTypes(List types) { .field(CtRole.TYPE_MEMBER, false, false) .field(CtRole.COMMENT, false, false) - )); + )); - types.add(new Type("CtCatchVariable", spoon.reflect.code.CtCatchVariable.class, spoon.support.reflect.code.CtCatchVariableImpl.class, fm -> fm + types.add(new Type("CtCatchVariable", spoon.reflect.code.CtCatchVariable.class, spoon.support.reflect.code.CtCatchVariableImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.TYPE, true, true) .field(CtRole.IS_IMPLICIT, false, false) @@ -1434,9 +1434,9 @@ private static void initTypes(List types) { .field(CtRole.ANNOTATION, false, false) .field(CtRole.MULTI_TYPE, false, false) - )); + )); - types.add(new Type("CtExecutableReferenceExpression", spoon.reflect.code.CtExecutableReferenceExpression.class, spoon.support.reflect.code.CtExecutableReferenceExpressionImpl.class, fm -> fm + types.add(new Type("CtExecutableReferenceExpression", spoon.reflect.code.CtExecutableReferenceExpression.class, spoon.support.reflect.code.CtExecutableReferenceExpressionImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.COMMENT, false, false) @@ -1446,6 +1446,6 @@ private static void initTypes(List types) { .field(CtRole.EXECUTABLE_REF, false, false) .field(CtRole.TARGET, false, false) - )); + )); } } From 861fab56b72170b797416c4e9c744af78602684c Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 1 Apr 2024 19:29:10 +0200 Subject: [PATCH 41/51] up --- src/test/java/spoon/test/api/Metamodel.java | 184 ++++++++++---------- src/test/resources/receiver/Outer.java | 2 +- 2 files changed, 93 insertions(+), 93 deletions(-) diff --git a/src/test/java/spoon/test/api/Metamodel.java b/src/test/java/spoon/test/api/Metamodel.java index 318400f3f9b..3779efb7bf8 100644 --- a/src/test/java/spoon/test/api/Metamodel.java +++ b/src/test/java/spoon/test/api/Metamodel.java @@ -250,7 +250,7 @@ private static void initTypes(List types) { * body of this method was generated by /spoon-core/src/test/java/spoon/generating/MetamodelGenerator.java * Run the method main and copy the System output here */ - types.add(new Type("CtConditional", spoon.reflect.code.CtConditional.class, spoon.support.reflect.code.CtConditionalImpl.class, fm -> fm + types.add(new Type("CtConditional", spoon.reflect.code.CtConditional.class, spoon.support.reflect.code.CtConditionalImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.TYPE, false, false) @@ -263,7 +263,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtProvidedService", spoon.reflect.declaration.CtProvidedService.class, spoon.support.reflect.declaration.CtProvidedServiceImpl.class, fm -> fm + types.add(new Type("CtProvidedService", spoon.reflect.declaration.CtProvidedService.class, spoon.support.reflect.declaration.CtProvidedServiceImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.COMMENT, false, false) @@ -273,7 +273,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtParameter", spoon.reflect.declaration.CtParameter.class, spoon.support.reflect.declaration.CtParameterImpl.class, fm -> fm + types.add(new Type("CtParameter", spoon.reflect.declaration.CtParameter.class, spoon.support.reflect.declaration.CtParameterImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -289,7 +289,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtWhile", spoon.reflect.code.CtWhile.class, spoon.support.reflect.code.CtWhileImpl.class, fm -> fm + types.add(new Type("CtWhile", spoon.reflect.code.CtWhile.class, spoon.support.reflect.code.CtWhileImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -300,7 +300,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtTypeReference", spoon.reflect.reference.CtTypeReference.class, spoon.support.reflect.reference.CtTypeReferenceImpl.class, fm -> fm + types.add(new Type("CtTypeReference", spoon.reflect.reference.CtTypeReference.class, spoon.support.reflect.reference.CtTypeReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -316,7 +316,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtCatchVariableReference", spoon.reflect.reference.CtCatchVariableReference.class, spoon.support.reflect.reference.CtCatchVariableReferenceImpl.class, fm -> fm + types.add(new Type("CtCatchVariableReference", spoon.reflect.reference.CtCatchVariableReference.class, spoon.support.reflect.reference.CtCatchVariableReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT, true, true) @@ -326,7 +326,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtContinue", spoon.reflect.code.CtContinue.class, spoon.support.reflect.code.CtContinueImpl.class, fm -> fm + types.add(new Type("CtContinue", spoon.reflect.code.CtContinue.class, spoon.support.reflect.code.CtContinueImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.TARGET_LABEL, false, false) @@ -336,7 +336,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtInterface", spoon.reflect.declaration.CtInterface.class, spoon.support.reflect.declaration.CtInterfaceImpl.class, fm -> fm + types.add(new Type("CtInterface", spoon.reflect.declaration.CtInterface.class, spoon.support.reflect.declaration.CtInterfaceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -357,7 +357,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtAssignment", spoon.reflect.code.CtAssignment.class, spoon.support.reflect.code.CtAssignmentImpl.class, fm -> fm + types.add(new Type("CtAssignment", spoon.reflect.code.CtAssignment.class, spoon.support.reflect.code.CtAssignmentImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -370,7 +370,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtBinaryOperator", spoon.reflect.code.CtBinaryOperator.class, spoon.support.reflect.code.CtBinaryOperatorImpl.class, fm -> fm + types.add(new Type("CtBinaryOperator", spoon.reflect.code.CtBinaryOperator.class, spoon.support.reflect.code.CtBinaryOperatorImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.OPERATOR_KIND, false, false) .field(CtRole.POSITION, false, false) @@ -383,7 +383,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtEnumValue", spoon.reflect.declaration.CtEnumValue.class, spoon.support.reflect.declaration.CtEnumValueImpl.class, fm -> fm + types.add(new Type("CtEnumValue", spoon.reflect.declaration.CtEnumValue.class, spoon.support.reflect.declaration.CtEnumValueImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -398,7 +398,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtRecordPattern", spoon.reflect.code.CtRecordPattern.class, spoon.support.reflect.code.CtRecordPatternImpl.class, fm -> fm + types.add(new Type("CtRecordPattern", spoon.reflect.code.CtRecordPattern.class, spoon.support.reflect.code.CtRecordPatternImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.CAST, true, true) .field(CtRole.POSITION, false, false) @@ -410,7 +410,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtModuleRequirement", spoon.reflect.declaration.CtModuleRequirement.class, spoon.support.reflect.declaration.CtModuleRequirementImpl.class, fm -> fm + types.add(new Type("CtModuleRequirement", spoon.reflect.declaration.CtModuleRequirement.class, spoon.support.reflect.declaration.CtModuleRequirementImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.MODIFIER, false, false) .field(CtRole.POSITION, false, false) @@ -420,7 +420,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtForEach", spoon.reflect.code.CtForEach.class, spoon.support.reflect.code.CtForEachImpl.class, fm -> fm + types.add(new Type("CtForEach", spoon.reflect.code.CtForEach.class, spoon.support.reflect.code.CtForEachImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -432,7 +432,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtConstructor", spoon.reflect.declaration.CtConstructor.class, spoon.support.reflect.declaration.CtConstructorImpl.class, fm -> fm + types.add(new Type("CtConstructor", spoon.reflect.declaration.CtConstructor.class, spoon.support.reflect.declaration.CtConstructorImpl.class, fm -> fm .field(CtRole.NAME, true, true) .field(CtRole.TYPE, true, true) .field(CtRole.IS_SHADOW, false, false) @@ -451,7 +451,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtSuperAccess", spoon.reflect.code.CtSuperAccess.class, spoon.support.reflect.code.CtSuperAccessImpl.class, fm -> fm + types.add(new Type("CtSuperAccess", spoon.reflect.code.CtSuperAccess.class, spoon.support.reflect.code.CtSuperAccessImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -463,7 +463,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtPackageDeclaration", spoon.reflect.declaration.CtPackageDeclaration.class, spoon.support.reflect.declaration.CtPackageDeclarationImpl.class, fm -> fm + types.add(new Type("CtPackageDeclaration", spoon.reflect.declaration.CtPackageDeclaration.class, spoon.support.reflect.declaration.CtPackageDeclarationImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.COMMENT, false, false) @@ -472,7 +472,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtAnonymousExecutable", spoon.reflect.declaration.CtAnonymousExecutable.class, spoon.support.reflect.declaration.CtAnonymousExecutableImpl.class, fm -> fm + types.add(new Type("CtAnonymousExecutable", spoon.reflect.declaration.CtAnonymousExecutable.class, spoon.support.reflect.declaration.CtAnonymousExecutableImpl.class, fm -> fm .field(CtRole.NAME, true, true) .field(CtRole.TYPE, true, true) .field(CtRole.IS_IMPLICIT, false, false) @@ -488,7 +488,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtComment", spoon.reflect.code.CtComment.class, spoon.support.reflect.code.CtCommentImpl.class, fm -> fm + types.add(new Type("CtComment", spoon.reflect.code.CtComment.class, spoon.support.reflect.code.CtCommentImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.COMMENT_CONTENT, false, false) @@ -499,7 +499,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtWildcardReference", spoon.reflect.reference.CtWildcardReference.class, spoon.support.reflect.reference.CtWildcardReferenceImpl.class, fm -> fm + types.add(new Type("CtWildcardReference", spoon.reflect.reference.CtWildcardReference.class, spoon.support.reflect.reference.CtWildcardReferenceImpl.class, fm -> fm .field(CtRole.NAME, true, true) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_UPPER, false, false) @@ -517,7 +517,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtThisAccess", spoon.reflect.code.CtThisAccess.class, spoon.support.reflect.code.CtThisAccessImpl.class, fm -> fm + types.add(new Type("CtThisAccess", spoon.reflect.code.CtThisAccess.class, spoon.support.reflect.code.CtThisAccessImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.COMMENT, false, false) @@ -528,7 +528,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtRecordComponent", spoon.reflect.declaration.CtRecordComponent.class, spoon.support.reflect.declaration.CtRecordComponentImpl.class, fm -> fm + types.add(new Type("CtRecordComponent", spoon.reflect.declaration.CtRecordComponent.class, spoon.support.reflect.declaration.CtRecordComponentImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -539,7 +539,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtArrayWrite", spoon.reflect.code.CtArrayWrite.class, spoon.support.reflect.code.CtArrayWriteImpl.class, fm -> fm + types.add(new Type("CtArrayWrite", spoon.reflect.code.CtArrayWrite.class, spoon.support.reflect.code.CtArrayWriteImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) @@ -551,7 +551,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtPackageReference", spoon.reflect.reference.CtPackageReference.class, spoon.support.reflect.reference.CtPackageReferenceImpl.class, fm -> fm + types.add(new Type("CtPackageReference", spoon.reflect.reference.CtPackageReference.class, spoon.support.reflect.reference.CtPackageReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT, true, true) @@ -560,7 +560,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtJavaDoc", spoon.reflect.code.CtJavaDoc.class, spoon.support.reflect.code.CtJavaDocImpl.class, fm -> fm + types.add(new Type("CtJavaDoc", spoon.reflect.code.CtJavaDoc.class, spoon.support.reflect.code.CtJavaDocImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.COMMENT_CONTENT, false, false) @@ -572,7 +572,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtArrayRead", spoon.reflect.code.CtArrayRead.class, spoon.support.reflect.code.CtArrayReadImpl.class, fm -> fm + types.add(new Type("CtArrayRead", spoon.reflect.code.CtArrayRead.class, spoon.support.reflect.code.CtArrayReadImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) @@ -584,7 +584,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtStatementList", spoon.reflect.code.CtStatementList.class, spoon.support.reflect.code.CtStatementListImpl.class, fm -> fm + types.add(new Type("CtStatementList", spoon.reflect.code.CtStatementList.class, spoon.support.reflect.code.CtStatementListImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) @@ -593,7 +593,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtVariableWrite", spoon.reflect.code.CtVariableWrite.class, spoon.support.reflect.code.CtVariableWriteImpl.class, fm -> fm + types.add(new Type("CtVariableWrite", spoon.reflect.code.CtVariableWrite.class, spoon.support.reflect.code.CtVariableWriteImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -604,7 +604,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtCompilationUnit", spoon.reflect.declaration.CtCompilationUnit.class, spoon.support.reflect.declaration.CtCompilationUnitImpl.class, fm -> fm + types.add(new Type("CtCompilationUnit", spoon.reflect.declaration.CtCompilationUnit.class, spoon.support.reflect.declaration.CtCompilationUnitImpl.class, fm -> fm .field(CtRole.DECLARED_TYPE, true, true) .field(CtRole.DECLARED_MODULE, true, true) .field(CtRole.IS_IMPLICIT, false, false) @@ -618,7 +618,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtParameterReference", spoon.reflect.reference.CtParameterReference.class, spoon.support.reflect.reference.CtParameterReferenceImpl.class, fm -> fm + types.add(new Type("CtParameterReference", spoon.reflect.reference.CtParameterReference.class, spoon.support.reflect.reference.CtParameterReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT, true, true) @@ -628,7 +628,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtReceiverParameter", spoon.reflect.declaration.CtReceiverParameter.class, spoon.support.reflect.declaration.CtReceiverParameterImpl.class, fm -> fm + types.add(new Type("CtReceiverParameter", spoon.reflect.declaration.CtReceiverParameter.class, spoon.support.reflect.declaration.CtReceiverParameterImpl.class, fm -> fm .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -638,7 +638,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtOperatorAssignment", spoon.reflect.code.CtOperatorAssignment.class, spoon.support.reflect.code.CtOperatorAssignmentImpl.class, fm -> fm + types.add(new Type("CtOperatorAssignment", spoon.reflect.code.CtOperatorAssignment.class, spoon.support.reflect.code.CtOperatorAssignmentImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.OPERATOR_KIND, false, false) @@ -652,7 +652,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtAnnotationFieldAccess", spoon.reflect.code.CtAnnotationFieldAccess.class, spoon.support.reflect.code.CtAnnotationFieldAccessImpl.class, fm -> fm + types.add(new Type("CtAnnotationFieldAccess", spoon.reflect.code.CtAnnotationFieldAccess.class, spoon.support.reflect.code.CtAnnotationFieldAccessImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -664,7 +664,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtUnboundVariableReference", spoon.reflect.reference.CtUnboundVariableReference.class, spoon.support.reflect.reference.CtUnboundVariableReferenceImpl.class, fm -> fm + types.add(new Type("CtUnboundVariableReference", spoon.reflect.reference.CtUnboundVariableReference.class, spoon.support.reflect.reference.CtUnboundVariableReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT, true, true) @@ -674,7 +674,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtAnnotationMethod", spoon.reflect.declaration.CtAnnotationMethod.class, spoon.support.reflect.declaration.CtAnnotationMethodImpl.class, fm -> fm + types.add(new Type("CtAnnotationMethod", spoon.reflect.declaration.CtAnnotationMethod.class, spoon.support.reflect.declaration.CtAnnotationMethodImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.BODY, true, true) .field(CtRole.IS_SHADOW, false, false) @@ -694,7 +694,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtClass", spoon.reflect.declaration.CtClass.class, spoon.support.reflect.declaration.CtClassImpl.class, fm -> fm + types.add(new Type("CtClass", spoon.reflect.declaration.CtClass.class, spoon.support.reflect.declaration.CtClassImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -717,7 +717,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtBlock", spoon.reflect.code.CtBlock.class, spoon.support.reflect.code.CtBlockImpl.class, fm -> fm + types.add(new Type("CtBlock", spoon.reflect.code.CtBlock.class, spoon.support.reflect.code.CtBlockImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -727,7 +727,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtPackage", spoon.reflect.declaration.CtPackage.class, spoon.support.reflect.declaration.CtPackageImpl.class, fm -> fm + types.add(new Type("CtPackage", spoon.reflect.declaration.CtPackage.class, spoon.support.reflect.declaration.CtPackageImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -739,7 +739,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtTryWithResource", spoon.reflect.code.CtTryWithResource.class, spoon.support.reflect.code.CtTryWithResourceImpl.class, fm -> fm + types.add(new Type("CtTryWithResource", spoon.reflect.code.CtTryWithResource.class, spoon.support.reflect.code.CtTryWithResourceImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -752,7 +752,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtAssert", spoon.reflect.code.CtAssert.class, spoon.support.reflect.code.CtAssertImpl.class, fm -> fm + types.add(new Type("CtAssert", spoon.reflect.code.CtAssert.class, spoon.support.reflect.code.CtAssertImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -763,7 +763,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtSwitch", spoon.reflect.code.CtSwitch.class, spoon.support.reflect.code.CtSwitchImpl.class, fm -> fm + types.add(new Type("CtSwitch", spoon.reflect.code.CtSwitch.class, spoon.support.reflect.code.CtSwitchImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -774,7 +774,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtTry", spoon.reflect.code.CtTry.class, spoon.support.reflect.code.CtTryImpl.class, fm -> fm + types.add(new Type("CtTry", spoon.reflect.code.CtTry.class, spoon.support.reflect.code.CtTryImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -786,7 +786,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtYieldStatement", spoon.reflect.code.CtYieldStatement.class, spoon.support.reflect.code.CtYieldStatementImpl.class, fm -> fm + types.add(new Type("CtYieldStatement", spoon.reflect.code.CtYieldStatement.class, spoon.support.reflect.code.CtYieldStatementImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -796,7 +796,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtSynchronized", spoon.reflect.code.CtSynchronized.class, spoon.support.reflect.code.CtSynchronizedImpl.class, fm -> fm + types.add(new Type("CtSynchronized", spoon.reflect.code.CtSynchronized.class, spoon.support.reflect.code.CtSynchronizedImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -807,7 +807,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtTypeParameterReference", spoon.reflect.reference.CtTypeParameterReference.class, spoon.support.reflect.reference.CtTypeParameterReferenceImpl.class, fm -> fm + types.add(new Type("CtTypeParameterReference", spoon.reflect.reference.CtTypeParameterReference.class, spoon.support.reflect.reference.CtTypeParameterReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -823,7 +823,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtImport", spoon.reflect.declaration.CtImport.class, spoon.support.reflect.declaration.CtImportImpl.class, fm -> fm + types.add(new Type("CtImport", spoon.reflect.declaration.CtImport.class, spoon.support.reflect.declaration.CtImportImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.IMPORT_REFERENCE, false, false) @@ -832,7 +832,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtInvocation", spoon.reflect.code.CtInvocation.class, spoon.support.reflect.code.CtInvocationImpl.class, fm -> fm + types.add(new Type("CtInvocation", spoon.reflect.code.CtInvocation.class, spoon.support.reflect.code.CtInvocationImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) @@ -847,7 +847,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtCodeSnippetExpression", spoon.reflect.code.CtCodeSnippetExpression.class, spoon.support.reflect.code.CtCodeSnippetExpressionImpl.class, fm -> fm + types.add(new Type("CtCodeSnippetExpression", spoon.reflect.code.CtCodeSnippetExpression.class, spoon.support.reflect.code.CtCodeSnippetExpressionImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.SNIPPET, false, false) @@ -858,7 +858,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtFieldWrite", spoon.reflect.code.CtFieldWrite.class, spoon.support.reflect.code.CtFieldWriteImpl.class, fm -> fm + types.add(new Type("CtFieldWrite", spoon.reflect.code.CtFieldWrite.class, spoon.support.reflect.code.CtFieldWriteImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -870,7 +870,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtUnaryOperator", spoon.reflect.code.CtUnaryOperator.class, spoon.support.reflect.code.CtUnaryOperatorImpl.class, fm -> fm + types.add(new Type("CtUnaryOperator", spoon.reflect.code.CtUnaryOperator.class, spoon.support.reflect.code.CtUnaryOperatorImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.OPERATOR_KIND, false, false) @@ -883,7 +883,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtExecutableReference", spoon.reflect.reference.CtExecutableReference.class, spoon.support.reflect.reference.CtExecutableReferenceImpl.class, fm -> fm + types.add(new Type("CtExecutableReference", spoon.reflect.reference.CtExecutableReference.class, spoon.support.reflect.reference.CtExecutableReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_STATIC, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -897,7 +897,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtFor", spoon.reflect.code.CtFor.class, spoon.support.reflect.code.CtForImpl.class, fm -> fm + types.add(new Type("CtFor", spoon.reflect.code.CtFor.class, spoon.support.reflect.code.CtForImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -910,7 +910,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtVariableRead", spoon.reflect.code.CtVariableRead.class, spoon.support.reflect.code.CtVariableReadImpl.class, fm -> fm + types.add(new Type("CtVariableRead", spoon.reflect.code.CtVariableRead.class, spoon.support.reflect.code.CtVariableReadImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -921,7 +921,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtTypeParameter", spoon.reflect.declaration.CtTypeParameter.class, spoon.support.reflect.declaration.CtTypeParameterImpl.class, fm -> fm + types.add(new Type("CtTypeParameter", spoon.reflect.declaration.CtTypeParameter.class, spoon.support.reflect.declaration.CtTypeParameterImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -940,7 +940,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtLocalVariable", spoon.reflect.code.CtLocalVariable.class, spoon.support.reflect.code.CtLocalVariableImpl.class, fm -> fm + types.add(new Type("CtLocalVariable", spoon.reflect.code.CtLocalVariable.class, spoon.support.reflect.code.CtLocalVariableImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) @@ -956,7 +956,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtIf", spoon.reflect.code.CtIf.class, spoon.support.reflect.code.CtIfImpl.class, fm -> fm + types.add(new Type("CtIf", spoon.reflect.code.CtIf.class, spoon.support.reflect.code.CtIfImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -968,7 +968,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtRecord", spoon.reflect.declaration.CtRecord.class, spoon.support.reflect.declaration.CtRecordImpl.class, fm -> fm + types.add(new Type("CtRecord", spoon.reflect.declaration.CtRecord.class, spoon.support.reflect.declaration.CtRecordImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -992,7 +992,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtModule", spoon.reflect.declaration.CtModule.class, spoon.support.reflect.declaration.CtModuleImpl.class, fm -> fm + types.add(new Type("CtModule", spoon.reflect.declaration.CtModule.class, spoon.support.reflect.declaration.CtModuleImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.MODIFIER, false, false) @@ -1009,7 +1009,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtSwitchExpression", spoon.reflect.code.CtSwitchExpression.class, spoon.support.reflect.code.CtSwitchExpressionImpl.class, fm -> fm + types.add(new Type("CtSwitchExpression", spoon.reflect.code.CtSwitchExpression.class, spoon.support.reflect.code.CtSwitchExpressionImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) @@ -1021,7 +1021,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtPackageExport", spoon.reflect.declaration.CtPackageExport.class, spoon.support.reflect.declaration.CtPackageExportImpl.class, fm -> fm + types.add(new Type("CtPackageExport", spoon.reflect.declaration.CtPackageExport.class, spoon.support.reflect.declaration.CtPackageExportImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.OPENED_PACKAGE, false, false) @@ -1032,7 +1032,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtConstructorCall", spoon.reflect.code.CtConstructorCall.class, spoon.support.reflect.code.CtConstructorCallImpl.class, fm -> fm + types.add(new Type("CtConstructorCall", spoon.reflect.code.CtConstructorCall.class, spoon.support.reflect.code.CtConstructorCallImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) @@ -1047,7 +1047,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtCase", spoon.reflect.code.CtCase.class, spoon.support.reflect.code.CtCaseImpl.class, fm -> fm + types.add(new Type("CtCase", spoon.reflect.code.CtCase.class, spoon.support.reflect.code.CtCaseImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.DEFAULT_EXPRESSION, false, false) .field(CtRole.LABEL, false, false) @@ -1060,7 +1060,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtModuleReference", spoon.reflect.reference.CtModuleReference.class, spoon.support.reflect.reference.CtModuleReferenceImpl.class, fm -> fm + types.add(new Type("CtModuleReference", spoon.reflect.reference.CtModuleReference.class, spoon.support.reflect.reference.CtModuleReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT, true, true) @@ -1069,7 +1069,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtCatch", spoon.reflect.code.CtCatch.class, spoon.support.reflect.code.CtCatchImpl.class, fm -> fm + types.add(new Type("CtCatch", spoon.reflect.code.CtCatch.class, spoon.support.reflect.code.CtCatchImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) @@ -1079,7 +1079,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtArrayTypeReference", spoon.reflect.reference.CtArrayTypeReference.class, spoon.support.reflect.reference.CtArrayTypeReferenceImpl.class, fm -> fm + types.add(new Type("CtArrayTypeReference", spoon.reflect.reference.CtArrayTypeReference.class, spoon.support.reflect.reference.CtArrayTypeReferenceImpl.class, fm -> fm .field(CtRole.NAME, true, true) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -1096,7 +1096,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtMethod", spoon.reflect.declaration.CtMethod.class, spoon.support.reflect.declaration.CtMethodImpl.class, fm -> fm + types.add(new Type("CtMethod", spoon.reflect.declaration.CtMethod.class, spoon.support.reflect.declaration.CtMethodImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -1115,7 +1115,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtLambda", spoon.reflect.code.CtLambda.class, spoon.support.reflect.code.CtLambdaImpl.class, fm -> fm + types.add(new Type("CtLambda", spoon.reflect.code.CtLambda.class, spoon.support.reflect.code.CtLambdaImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.THROWN, true, true) @@ -1131,7 +1131,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtTypePattern", spoon.reflect.code.CtTypePattern.class, spoon.support.reflect.code.CtTypePatternImpl.class, fm -> fm + types.add(new Type("CtTypePattern", spoon.reflect.code.CtTypePattern.class, spoon.support.reflect.code.CtTypePatternImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.CAST, true, true) .field(CtRole.POSITION, false, false) @@ -1142,7 +1142,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtNewArray", spoon.reflect.code.CtNewArray.class, spoon.support.reflect.code.CtNewArrayImpl.class, fm -> fm + types.add(new Type("CtNewArray", spoon.reflect.code.CtNewArray.class, spoon.support.reflect.code.CtNewArrayImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.ANNOTATION, false, false) @@ -1154,7 +1154,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtIntersectionTypeReference", spoon.reflect.reference.CtIntersectionTypeReference.class, spoon.support.reflect.reference.CtIntersectionTypeReferenceImpl.class, fm -> fm + types.add(new Type("CtIntersectionTypeReference", spoon.reflect.reference.CtIntersectionTypeReference.class, spoon.support.reflect.reference.CtIntersectionTypeReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -1171,7 +1171,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtUsedService", spoon.reflect.declaration.CtUsedService.class, spoon.support.reflect.declaration.CtUsedServiceImpl.class, fm -> fm + types.add(new Type("CtUsedService", spoon.reflect.declaration.CtUsedService.class, spoon.support.reflect.declaration.CtUsedServiceImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.COMMENT, false, false) @@ -1180,7 +1180,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtTextBlock", spoon.reflect.code.CtTextBlock.class, spoon.support.reflect.code.CtTextBlockImpl.class, fm -> fm + types.add(new Type("CtTextBlock", spoon.reflect.code.CtTextBlock.class, spoon.support.reflect.code.CtTextBlockImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.VALUE, false, false) .field(CtRole.POSITION, false, false) @@ -1192,7 +1192,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtThrow", spoon.reflect.code.CtThrow.class, spoon.support.reflect.code.CtThrowImpl.class, fm -> fm + types.add(new Type("CtThrow", spoon.reflect.code.CtThrow.class, spoon.support.reflect.code.CtThrowImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -1202,7 +1202,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtLiteral", spoon.reflect.code.CtLiteral.class, spoon.support.reflect.code.CtLiteralImpl.class, fm -> fm + types.add(new Type("CtLiteral", spoon.reflect.code.CtLiteral.class, spoon.support.reflect.code.CtLiteralImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.VALUE, false, false) .field(CtRole.POSITION, false, false) @@ -1214,7 +1214,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtReturn", spoon.reflect.code.CtReturn.class, spoon.support.reflect.code.CtReturnImpl.class, fm -> fm + types.add(new Type("CtReturn", spoon.reflect.code.CtReturn.class, spoon.support.reflect.code.CtReturnImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -1224,7 +1224,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtField", spoon.reflect.declaration.CtField.class, spoon.support.reflect.declaration.CtFieldImpl.class, fm -> fm + types.add(new Type("CtField", spoon.reflect.declaration.CtField.class, spoon.support.reflect.declaration.CtFieldImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -1239,7 +1239,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtJavaDocTag", spoon.reflect.code.CtJavaDocTag.class, spoon.support.reflect.code.CtJavaDocTagImpl.class, fm -> fm + types.add(new Type("CtJavaDocTag", spoon.reflect.code.CtJavaDocTag.class, spoon.support.reflect.code.CtJavaDocTagImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT_CONTENT, false, false) .field(CtRole.DOCUMENTATION_TYPE, false, false) @@ -1251,7 +1251,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtTypeAccess", spoon.reflect.code.CtTypeAccess.class, spoon.support.reflect.code.CtTypeAccessImpl.class, fm -> fm + types.add(new Type("CtTypeAccess", spoon.reflect.code.CtTypeAccess.class, spoon.support.reflect.code.CtTypeAccessImpl.class, fm -> fm .field(CtRole.TYPE, true, true) .field(CtRole.IS_IMPLICIT, true, false) .field(CtRole.POSITION, false, false) @@ -1262,7 +1262,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtCodeSnippetStatement", spoon.reflect.code.CtCodeSnippetStatement.class, spoon.support.reflect.code.CtCodeSnippetStatementImpl.class, fm -> fm + types.add(new Type("CtCodeSnippetStatement", spoon.reflect.code.CtCodeSnippetStatement.class, spoon.support.reflect.code.CtCodeSnippetStatementImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -1272,7 +1272,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtDo", spoon.reflect.code.CtDo.class, spoon.support.reflect.code.CtDoImpl.class, fm -> fm + types.add(new Type("CtDo", spoon.reflect.code.CtDo.class, spoon.support.reflect.code.CtDoImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.POSITION, false, false) @@ -1283,7 +1283,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtTypeMemberWildcardImportReference", spoon.reflect.reference.CtTypeMemberWildcardImportReference.class, spoon.support.reflect.reference.CtTypeMemberWildcardImportReferenceImpl.class, fm -> fm + types.add(new Type("CtTypeMemberWildcardImportReference", spoon.reflect.reference.CtTypeMemberWildcardImportReference.class, spoon.support.reflect.reference.CtTypeMemberWildcardImportReferenceImpl.class, fm -> fm .field(CtRole.NAME, true, true) .field(CtRole.IS_IMPLICIT, true, true) .field(CtRole.COMMENT, true, true) @@ -1293,7 +1293,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtAnnotation", spoon.reflect.declaration.CtAnnotation.class, spoon.support.reflect.declaration.CtAnnotationImpl.class, fm -> fm + types.add(new Type("CtAnnotation", spoon.reflect.declaration.CtAnnotation.class, spoon.support.reflect.declaration.CtAnnotationImpl.class, fm -> fm .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.CAST, true, true) @@ -1306,7 +1306,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtFieldRead", spoon.reflect.code.CtFieldRead.class, spoon.support.reflect.code.CtFieldReadImpl.class, fm -> fm + types.add(new Type("CtFieldRead", spoon.reflect.code.CtFieldRead.class, spoon.support.reflect.code.CtFieldReadImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) @@ -1318,7 +1318,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtBreak", spoon.reflect.code.CtBreak.class, spoon.support.reflect.code.CtBreakImpl.class, fm -> fm + types.add(new Type("CtBreak", spoon.reflect.code.CtBreak.class, spoon.support.reflect.code.CtBreakImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) .field(CtRole.TARGET_LABEL, false, false) @@ -1328,7 +1328,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtFieldReference", spoon.reflect.reference.CtFieldReference.class, spoon.support.reflect.reference.CtFieldReferenceImpl.class, fm -> fm + types.add(new Type("CtFieldReference", spoon.reflect.reference.CtFieldReference.class, spoon.support.reflect.reference.CtFieldReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_FINAL, false, false) .field(CtRole.IS_STATIC, false, false) @@ -1341,7 +1341,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtEnum", spoon.reflect.declaration.CtEnum.class, spoon.support.reflect.declaration.CtEnumImpl.class, fm -> fm + types.add(new Type("CtEnum", spoon.reflect.declaration.CtEnum.class, spoon.support.reflect.declaration.CtEnumImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -1365,7 +1365,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtCasePattern", spoon.reflect.code.CtCasePattern.class, spoon.support.reflect.code.CtCasePatternImpl.class, fm -> fm + types.add(new Type("CtCasePattern", spoon.reflect.code.CtCasePattern.class, spoon.support.reflect.code.CtCasePatternImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.CAST, false, false) @@ -1377,7 +1377,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtNewClass", spoon.reflect.code.CtNewClass.class, spoon.support.reflect.code.CtNewClassImpl.class, fm -> fm + types.add(new Type("CtNewClass", spoon.reflect.code.CtNewClass.class, spoon.support.reflect.code.CtNewClassImpl.class, fm -> fm .field(CtRole.TYPE, true, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.LABEL, false, false) @@ -1393,7 +1393,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtLocalVariableReference", spoon.reflect.reference.CtLocalVariableReference.class, spoon.support.reflect.reference.CtLocalVariableReferenceImpl.class, fm -> fm + types.add(new Type("CtLocalVariableReference", spoon.reflect.reference.CtLocalVariableReference.class, spoon.support.reflect.reference.CtLocalVariableReferenceImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.COMMENT, true, true) @@ -1403,7 +1403,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtAnnotationType", spoon.reflect.declaration.CtAnnotationType.class, spoon.support.reflect.declaration.CtAnnotationTypeImpl.class, fm -> fm + types.add(new Type("CtAnnotationType", spoon.reflect.declaration.CtAnnotationType.class, spoon.support.reflect.declaration.CtAnnotationTypeImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.IS_SHADOW, false, false) .field(CtRole.IS_IMPLICIT, false, false) @@ -1422,7 +1422,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtCatchVariable", spoon.reflect.code.CtCatchVariable.class, spoon.support.reflect.code.CtCatchVariableImpl.class, fm -> fm + types.add(new Type("CtCatchVariable", spoon.reflect.code.CtCatchVariable.class, spoon.support.reflect.code.CtCatchVariableImpl.class, fm -> fm .field(CtRole.NAME, false, false) .field(CtRole.TYPE, true, true) .field(CtRole.IS_IMPLICIT, false, false) @@ -1436,7 +1436,7 @@ private static void initTypes(List types) { )); - types.add(new Type("CtExecutableReferenceExpression", spoon.reflect.code.CtExecutableReferenceExpression.class, spoon.support.reflect.code.CtExecutableReferenceExpressionImpl.class, fm -> fm + types.add(new Type("CtExecutableReferenceExpression", spoon.reflect.code.CtExecutableReferenceExpression.class, spoon.support.reflect.code.CtExecutableReferenceExpressionImpl.class, fm -> fm .field(CtRole.IS_IMPLICIT, false, false) .field(CtRole.POSITION, false, false) .field(CtRole.COMMENT, false, false) diff --git a/src/test/resources/receiver/Outer.java b/src/test/resources/receiver/Outer.java index 455724531e7..36da3cbb61f 100644 --- a/src/test/resources/receiver/Outer.java +++ b/src/test/resources/receiver/Outer.java @@ -7,4 +7,4 @@ public Inner(Middle Middle.this) { } } } -} \ No newline at end of file +} From 71ea27bbec7707bdc897c8acac5373355b0c2da3 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 1 Apr 2024 19:34:29 +0200 Subject: [PATCH 42/51] Update src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java Co-authored-by: I-Al-Istannen --- src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java b/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java index 007ae06807e..6348b86d05d 100644 --- a/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java +++ b/src/main/java/spoon/reflect/visitor/ElementPrinterHelper.java @@ -159,7 +159,7 @@ public void writeExecutableParameters(CtExecutable executable) { parameters.addAll(executable.getParameters()); printList(parameters, null, false, "(", false, false, ",", true, false, ")", - prettyPrinter::scan); + prettyPrinter::scan); } /** writes the thrown exception with a ListPrinter */ From 3e4112b06f878cf5449185118aaf929e5a101b31 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 1 Apr 2024 19:35:06 +0200 Subject: [PATCH 43/51] Update src/main/java/spoon/reflect/declaration/CtReceiverParameter.java Co-authored-by: I-Al-Istannen --- .../java/spoon/reflect/declaration/CtReceiverParameter.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java b/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java index b5a7af72d24..176c192ba05 100644 --- a/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java +++ b/src/main/java/spoon/reflect/declaration/CtReceiverParameter.java @@ -12,12 +12,12 @@ /** * This element represents a class declaration. * - *
- * // Foo this is a receiver parameter
+ * 
{@code
  * class Foo {
+ *   // this is a receiver parameter
  *   void bar(Foo this) {
  *   }
- * }
+ * }}
  * 
*/ public interface CtReceiverParameter extends CtTypedElement, CtShadowable, CtElement { From e8edd5d2a9c8cbfa5ebad5138f67d3aef8b7e60e Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 1 Apr 2024 19:36:18 +0200 Subject: [PATCH 44/51] Update SimpleReceiverParameter.java --- src/test/resources/receiver/SimpleReceiverParameter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources/receiver/SimpleReceiverParameter.java b/src/test/resources/receiver/SimpleReceiverParameter.java index 01ebfa15f59..2c8fe95f8fc 100644 --- a/src/test/resources/receiver/SimpleReceiverParameter.java +++ b/src/test/resources/receiver/SimpleReceiverParameter.java @@ -5,4 +5,4 @@ class SimpleReceiverParameter { public void foo(SimpleReceiverParameter this, int x) { System.out.println(x) } -} \ No newline at end of file +} From 7334c5e3389d051802b49827f31f80e3b959eace Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 1 Apr 2024 19:37:29 +0200 Subject: [PATCH 45/51] Update InnerClassCtor.java --- src/test/resources/receiver/InnerClassCtor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources/receiver/InnerClassCtor.java b/src/test/resources/receiver/InnerClassCtor.java index e47f9ac7009..2d9d4b36310 100644 --- a/src/test/resources/receiver/InnerClassCtor.java +++ b/src/test/resources/receiver/InnerClassCtor.java @@ -5,4 +5,4 @@ public Inner(Outer Outer.this) { } } -} \ No newline at end of file +} From 2abac1f77d11e8180a7296f637ff87082c56a73b Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 1 Apr 2024 19:37:46 +0200 Subject: [PATCH 46/51] Update src/main/java/spoon/support/compiler/jdt/ParentExiter.java Co-authored-by: I-Al-Istannen --- src/main/java/spoon/support/compiler/jdt/ParentExiter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/spoon/support/compiler/jdt/ParentExiter.java b/src/main/java/spoon/support/compiler/jdt/ParentExiter.java index f82b8258d64..f972f4898ca 100644 --- a/src/main/java/spoon/support/compiler/jdt/ParentExiter.java +++ b/src/main/java/spoon/support/compiler/jdt/ParentExiter.java @@ -208,7 +208,7 @@ public void scanCtExecutable(CtExecutable e) { e.setBody((CtBlock) child); return; } else if (child instanceof CtReceiverParameter ctReceiverParameter) { - e.setReceiverParameter(ctReceiverParameter); + e.setReceiverParameter(ctReceiverParameter); } super.scanCtExecutable(e); } From f2848be9efedbe687ec25693b4df685a6297cae5 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 1 Apr 2024 19:38:02 +0200 Subject: [PATCH 47/51] Update src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java Co-authored-by: I-Al-Istannen --- .../spoon/test/receiverparameter/ReceiverParameterTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java index 11d2aebdb46..5e9030fa2b9 100644 --- a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java +++ b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java @@ -48,8 +48,7 @@ void innerClassCtor(CtModel model) { SpoonAssertions.assertThat(ctConstructor.getReceiverParameter()).extracting(CtElement::toString).isEqualTo("Outer Outer.this"); } - @ModelTest( - value = "src/test/resources/receiver/Outer.java") + @ModelTest("src/test/resources/receiver/Outer.java") void innerClassInnerClass(CtModel model) { // contract: constructor of inner class which is an innerclass can have receiver parameter with their outer class type CtType targetType = model.getAllTypes().iterator().next(); From 184c2db22f794c7e4dc2395c1b6ed7411136fea2 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 1 Apr 2024 19:38:19 +0200 Subject: [PATCH 48/51] Update src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java Co-authored-by: I-Al-Istannen --- .../spoon/test/receiverparameter/ReceiverParameterTest.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java index 5e9030fa2b9..4de66ce787c 100644 --- a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java +++ b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java @@ -16,9 +16,7 @@ public class ReceiverParameterTest { - @ModelTest( - value = "src/test/resources/receiver/SimpleReceiverParameter.java" - ) + @ModelTest("src/test/resources/receiver/SimpleReceiverParameter.java") void simpleParameter(CtModel model) { // contract: receiver parameter is correctly parsed and can be accessed from the model CtType targetType = model.getAllTypes().iterator().next(); From 42d54830bb53faf184db2989f63553b424ce4130 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 1 Apr 2024 19:39:48 +0200 Subject: [PATCH 49/51] Update src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java Co-authored-by: I-Al-Istannen --- .../java/spoon/support/reflect/declaration/CtExecutableImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java b/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java index 7d1707587f2..570a0e1a430 100644 --- a/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java +++ b/src/main/java/spoon/support/reflect/declaration/CtExecutableImpl.java @@ -51,6 +51,7 @@ public abstract class CtExecutableImpl extends CtNamedElementImpl implements Set> thrownTypes = emptySet(); @MetamodelPropertyField(role = CtRole.RECEIVER_PARAMETER) private CtReceiverParameter receiverParameter; + public CtExecutableImpl() { } From 6f7d663538b1b404ddc78cc0c16b60f8823a40e3 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Mon, 1 Apr 2024 19:42:05 +0200 Subject: [PATCH 50/51] to tabs --- .../ReceiverParameterTest.java | 84 +++++++++---------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java index 4de66ce787c..168f082b400 100644 --- a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java +++ b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java @@ -16,46 +16,46 @@ public class ReceiverParameterTest { - @ModelTest("src/test/resources/receiver/SimpleReceiverParameter.java") - void simpleParameter(CtModel model) { - // contract: receiver parameter is correctly parsed and can be accessed from the model - CtType targetType = model.getAllTypes().iterator().next(); - List receiverParams = targetType.getElements(new TypeFilter<>(CtReceiverParameter.class)); - assertEquals(1, receiverParams.size()); - CtReceiverParameter receiverParam = receiverParams.iterator().next(); - SpoonAssertions.assertThat(receiverParam.getType()).extracting(CtTypeInformation::getQualifiedName).isEqualTo("receiver.SimpleReceiverParameter"); - SpoonAssertions.assertThat(receiverParam).extracting(CtElement::toString).isEqualTo("SimpleReceiverParameter this"); - - } - - - @ModelTest( - value = "src/test/resources/receiver/InnerClassCtor.java" - ) - void innerClassCtor(CtModel model) { - // contract: constructor of inner class can have receiver parameter with their outer class type - CtType targetType = model.getAllTypes().iterator().next(); - List receiverParams = targetType.getElements(new TypeFilter<>(CtReceiverParameter.class)); - assertEquals(1, receiverParams.size()); - CtReceiverParameter next1 = receiverParams.iterator().next(); - SpoonAssertions.assertThat(next1.getType()).extracting(CtTypeInformation::getQualifiedName).isEqualTo("receiver.Outer"); - CtConstructor ctConstructor = targetType.getElements(new TypeFilter<>(CtConstructor.class)).stream().filter(v -> v.getReceiverParameter() != null).findFirst().get(); - SpoonAssertions.assertThat(ctConstructor).isNotNull(); - SpoonAssertions.assertThat(ctConstructor.getReceiverParameter()).isNotNull(); - SpoonAssertions.assertThat(ctConstructor.getReceiverParameter().getType()).isNotNull(); - SpoonAssertions.assertThat(ctConstructor.getReceiverParameter()).extracting(CtElement::toString).isEqualTo("Outer Outer.this"); - } - - @ModelTest("src/test/resources/receiver/Outer.java") - void innerClassInnerClass(CtModel model) { - // contract: constructor of inner class which is an innerclass can have receiver parameter with their outer class type - CtType targetType = model.getAllTypes().iterator().next(); - List receiverParams = targetType.getElements(new TypeFilter<>(CtReceiverParameter.class)); - assertEquals(1, receiverParams.size()); - CtConstructor ctConstructor = targetType.getElements(new TypeFilter<>(CtConstructor.class)).stream().filter(v -> v.getReceiverParameter() != null).findFirst().get(); - SpoonAssertions.assertThat(ctConstructor).isNotNull(); - SpoonAssertions.assertThat(ctConstructor.getReceiverParameter()).isNotNull(); - SpoonAssertions.assertThat(ctConstructor.getReceiverParameter().getType()).isNotNull(); - SpoonAssertions.assertThat(ctConstructor.getReceiverParameter()).extracting(CtElement::toString).isEqualTo("Middle Middle.this"); - } + @ModelTest("src/test/resources/receiver/SimpleReceiverParameter.java") + void simpleParameter(CtModel model) { + // contract: receiver parameter is correctly parsed and can be accessed from the model + CtType targetType = model.getAllTypes().iterator().next(); + List receiverParams = targetType.getElements(new TypeFilter<>(CtReceiverParameter.class)); + assertEquals(1, receiverParams.size()); + CtReceiverParameter receiverParam = receiverParams.iterator().next(); + SpoonAssertions.assertThat(receiverParam.getType()).extracting(CtTypeInformation::getQualifiedName).isEqualTo("receiver.SimpleReceiverParameter"); + SpoonAssertions.assertThat(receiverParam).extracting(CtElement::toString).isEqualTo("SimpleReceiverParameter this"); + + } + + + @ModelTest( + value = "src/test/resources/receiver/InnerClassCtor.java" + ) + void innerClassCtor(CtModel model) { + // contract: constructor of inner class can have receiver parameter with their outer class type + CtType targetType = model.getAllTypes().iterator().next(); + List receiverParams = targetType.getElements(new TypeFilter<>(CtReceiverParameter.class)); + assertEquals(1, receiverParams.size()); + CtReceiverParameter next1 = receiverParams.iterator().next(); + SpoonAssertions.assertThat(next1.getType()).extracting(CtTypeInformation::getQualifiedName).isEqualTo("receiver.Outer"); + CtConstructor ctConstructor = targetType.getElements(new TypeFilter<>(CtConstructor.class)).stream().filter(v -> v.getReceiverParameter() != null).findFirst().get(); + SpoonAssertions.assertThat(ctConstructor).isNotNull(); + SpoonAssertions.assertThat(ctConstructor.getReceiverParameter()).isNotNull(); + SpoonAssertions.assertThat(ctConstructor.getReceiverParameter().getType()).isNotNull(); + SpoonAssertions.assertThat(ctConstructor.getReceiverParameter()).extracting(CtElement::toString).isEqualTo("Outer Outer.this"); + } + + @ModelTest("src/test/resources/receiver/Outer.java") + void innerClassInnerClass(CtModel model) { + // contract: constructor of inner class which is an innerclass can have receiver parameter with their outer class type + CtType targetType = model.getAllTypes().iterator().next(); + List receiverParams = targetType.getElements(new TypeFilter<>(CtReceiverParameter.class)); + assertEquals(1, receiverParams.size()); + CtConstructor ctConstructor = targetType.getElements(new TypeFilter<>(CtConstructor.class)).stream().filter(v -> v.getReceiverParameter() != null).findFirst().get(); + SpoonAssertions.assertThat(ctConstructor).isNotNull(); + SpoonAssertions.assertThat(ctConstructor.getReceiverParameter()).isNotNull(); + SpoonAssertions.assertThat(ctConstructor.getReceiverParameter().getType()).isNotNull(); + SpoonAssertions.assertThat(ctConstructor.getReceiverParameter()).extracting(CtElement::toString).isEqualTo("Middle Middle.this"); + } } From 01431267620048e05fbdbd9f280829059795c4d6 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Tue, 2 Apr 2024 20:09:17 +0200 Subject: [PATCH 51/51] Update src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java Co-authored-by: I-Al-Istannen --- .../spoon/test/receiverparameter/ReceiverParameterTest.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java index 168f082b400..b9b767ce0b2 100644 --- a/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java +++ b/src/test/java/spoon/test/receiverparameter/ReceiverParameterTest.java @@ -29,9 +29,7 @@ void simpleParameter(CtModel model) { } - @ModelTest( - value = "src/test/resources/receiver/InnerClassCtor.java" - ) + @ModelTest("src/test/resources/receiver/InnerClassCtor.java") void innerClassCtor(CtModel model) { // contract: constructor of inner class can have receiver parameter with their outer class type CtType targetType = model.getAllTypes().iterator().next();