Skip to content

Commit 8c7d58f

Browse files
author
Christian Wimmer
committed
Rename Extracter to Extractor
1 parent c9b8648 commit 8c7d58f

File tree

9 files changed

+38
-38
lines changed

9 files changed

+38
-38
lines changed

sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/AnnotationAccess.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
import java.lang.reflect.AnnotatedElement;
4545
import java.util.Arrays;
4646

47-
import org.graalvm.nativeimage.impl.AnnotationExtracter;
47+
import org.graalvm.nativeimage.impl.AnnotationExtractor;
4848

4949
/**
5050
* This class provides methods to query annotation information on {@link AnnotatedElement}s while
@@ -79,7 +79,7 @@ public final class AnnotationAccess {
7979
*/
8080
public static boolean isAnnotationPresent(AnnotatedElement element, Class<? extends Annotation> annotationClass) {
8181
if (ImageInfo.inImageBuildtimeCode()) {
82-
return ImageSingletons.lookup(AnnotationExtracter.class).hasAnnotation(element, annotationClass);
82+
return ImageSingletons.lookup(AnnotationExtractor.class).hasAnnotation(element, annotationClass);
8383
} else {
8484
return element.isAnnotationPresent(annotationClass);
8585
}
@@ -93,7 +93,7 @@ public static boolean isAnnotationPresent(AnnotatedElement element, Class<? exte
9393
@SuppressWarnings("unchecked")
9494
public static <T extends Annotation> T getAnnotation(AnnotatedElement element, Class<T> annotationType) {
9595
if (ImageInfo.inImageBuildtimeCode()) {
96-
return ImageSingletons.lookup(AnnotationExtracter.class).extractAnnotation(element, annotationType, false);
96+
return ImageSingletons.lookup(AnnotationExtractor.class).extractAnnotation(element, annotationType, false);
9797
} else {
9898
return element.getAnnotation(annotationType);
9999
}
@@ -107,7 +107,7 @@ public static <T extends Annotation> T getAnnotation(AnnotatedElement element, C
107107
@SuppressWarnings("unchecked")
108108
public static Class<? extends Annotation>[] getAnnotationTypes(AnnotatedElement element) {
109109
if (ImageInfo.inImageBuildtimeCode()) {
110-
return ImageSingletons.lookup(AnnotationExtracter.class).getAnnotationTypes(element);
110+
return ImageSingletons.lookup(AnnotationExtractor.class).getAnnotationTypes(element);
111111
} else {
112112
return Arrays.stream(element.getAnnotations()).map(Annotation::annotationType).toArray(Class[]::new);
113113
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
import org.graalvm.nativeimage.Platforms;
4848

4949
@Platforms(Platform.HOSTED_ONLY.class)
50-
public interface AnnotationExtracter {
50+
public interface AnnotationExtractor {
5151
boolean hasAnnotation(AnnotatedElement element, Class<? extends Annotation> annotationType);
5252

5353
<T extends Annotation> T extractAnnotation(AnnotatedElement element, Class<T> annotationType, boolean declaredOnly);

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ImageClassLoader.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private void findSystemElements(Class<?> systemClass) {
142142

143143
private boolean isInPlatform(AnnotatedElement element) {
144144
try {
145-
Platforms platformAnnotation = classLoaderSupport.annotationExtracter.extractAnnotation(element, Platforms.class, false);
145+
Platforms platformAnnotation = classLoaderSupport.annotationExtractor.extractAnnotation(element, Platforms.class, false);
146146
return NativeImageGenerator.includedIn(platform, platformAnnotation);
147147
} catch (Throwable t) {
148148
handleClassLoadingError(t);
@@ -175,7 +175,7 @@ void handleClass(Class<?> clazz) {
175175
do {
176176
Platforms platformsAnnotation;
177177
try {
178-
platformsAnnotation = classLoaderSupport.annotationExtracter.extractAnnotation(cur, Platforms.class, false);
178+
platformsAnnotation = classLoaderSupport.annotationExtractor.extractAnnotation(cur, Platforms.class, false);
179179
} catch (Throwable t) {
180180
handleClassLoadingError(t);
181181
return;
@@ -373,7 +373,7 @@ public List<Class<?>> findAnnotatedClasses(Class<? extends Annotation> annotatio
373373

374374
private void addAnnotatedClasses(EconomicSet<Class<?>> classes, Class<? extends Annotation> annotationClass, ArrayList<Class<?>> result) {
375375
for (Class<?> systemClass : classes) {
376-
if (classLoaderSupport.annotationExtracter.hasAnnotation(systemClass, annotationClass)) {
376+
if (classLoaderSupport.annotationExtractor.hasAnnotation(systemClass, annotationClass)) {
377377
result.add(systemClass);
378378
}
379379
}
@@ -382,7 +382,7 @@ private void addAnnotatedClasses(EconomicSet<Class<?>> classes, Class<? extends
382382
public List<Method> findAnnotatedMethods(Class<? extends Annotation> annotationClass) {
383383
ArrayList<Method> result = new ArrayList<>();
384384
for (Method method : systemMethods) {
385-
if (classLoaderSupport.annotationExtracter.hasAnnotation(method, annotationClass)) {
385+
if (classLoaderSupport.annotationExtractor.hasAnnotation(method, annotationClass)) {
386386
result.add(method);
387387
}
388388
}
@@ -394,7 +394,7 @@ public List<Method> findAnnotatedMethods(Class<? extends Annotation>[] annotatio
394394
for (Method method : systemMethods) {
395395
boolean match = true;
396396
for (Class<? extends Annotation> annotationClass : annotationClasses) {
397-
if (!classLoaderSupport.annotationExtracter.hasAnnotation(method, annotationClass)) {
397+
if (!classLoaderSupport.annotationExtractor.hasAnnotation(method, annotationClass)) {
398398
match = false;
399399
break;
400400
}
@@ -409,7 +409,7 @@ public List<Method> findAnnotatedMethods(Class<? extends Annotation>[] annotatio
409409
public List<Field> findAnnotatedFields(Class<? extends Annotation> annotationClass) {
410410
ArrayList<Field> result = new ArrayList<>();
411411
for (Field field : systemFields) {
412-
if (classLoaderSupport.annotationExtracter.hasAnnotation(field, annotationClass)) {
412+
if (classLoaderSupport.annotationExtractor.hasAnnotation(field, annotationClass)) {
413413
result.add(field);
414414
}
415415
}
@@ -431,13 +431,13 @@ public List<Class<? extends Annotation>> allAnnotations() {
431431
public <T extends Annotation> List<T> findAnnotations(Class<T> annotationClass) {
432432
List<T> result = new ArrayList<>();
433433
for (Class<?> clazz : findAnnotatedClasses(annotationClass, false)) {
434-
result.add(classLoaderSupport.annotationExtracter.extractAnnotation(clazz, annotationClass, false));
434+
result.add(classLoaderSupport.annotationExtractor.extractAnnotation(clazz, annotationClass, false));
435435
}
436436
for (Method method : findAnnotatedMethods(annotationClass)) {
437-
result.add(classLoaderSupport.annotationExtracter.extractAnnotation(method, annotationClass, false));
437+
result.add(classLoaderSupport.annotationExtractor.extractAnnotation(method, annotationClass, false));
438438
}
439439
for (Field field : findAnnotatedFields(annotationClass)) {
440-
result.add(classLoaderSupport.annotationExtracter.extractAnnotation(field, annotationClass, false));
440+
result.add(classLoaderSupport.annotationExtractor.extractAnnotation(field, annotationClass, false));
441441
}
442442
return result;
443443
}

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageClassLoaderSupport.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
import org.graalvm.collections.Pair;
7777
import org.graalvm.compiler.options.OptionKey;
7878
import org.graalvm.compiler.options.OptionValues;
79-
import org.graalvm.nativeimage.impl.AnnotationExtracter;
79+
import org.graalvm.nativeimage.impl.AnnotationExtractor;
8080

8181
import com.oracle.svm.core.SubstrateOptions;
8282
import com.oracle.svm.core.option.LocatableMultiOptionValue;
@@ -86,7 +86,7 @@
8686
import com.oracle.svm.core.util.InterruptImageBuilding;
8787
import com.oracle.svm.core.util.UserError;
8888
import com.oracle.svm.core.util.VMError;
89-
import com.oracle.svm.hosted.annotation.SubstrateAnnotationExtracter;
89+
import com.oracle.svm.hosted.annotation.SubstrateAnnotationExtractor;
9090
import com.oracle.svm.hosted.option.HostedOptionParser;
9191
import com.oracle.svm.util.ModuleSupport;
9292
import com.oracle.svm.util.ReflectionUtil;
@@ -111,7 +111,7 @@ public class NativeImageClassLoaderSupport {
111111
public final ModuleLayer moduleLayerForImageBuild;
112112
public final ModuleFinder modulepathModuleFinder;
113113

114-
public final AnnotationExtracter annotationExtracter;
114+
public final AnnotationExtractor annotationExtractor;
115115

116116
static final class ClassPathClassLoader extends URLClassLoader {
117117
ClassPathClassLoader(URL[] urls, ClassLoader parent) {
@@ -163,7 +163,7 @@ protected NativeImageClassLoaderSupport(ClassLoader defaultSystemClassLoader, St
163163

164164
modulepathModuleFinder = ModuleFinder.of(modulepath().toArray(Path[]::new));
165165

166-
annotationExtracter = new SubstrateAnnotationExtracter();
166+
annotationExtractor = new SubstrateAnnotationExtractor();
167167
}
168168

169169
List<Path> classpath() {

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGenerator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
import org.graalvm.nativeimage.c.struct.RawStructure;
126126
import org.graalvm.nativeimage.hosted.Feature;
127127
import org.graalvm.nativeimage.hosted.Feature.OnAnalysisExitAccess;
128-
import org.graalvm.nativeimage.impl.AnnotationExtracter;
128+
import org.graalvm.nativeimage.impl.AnnotationExtractor;
129129
import org.graalvm.nativeimage.impl.CConstantValueSupport;
130130
import org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport;
131131
import org.graalvm.nativeimage.impl.SizeOfSupport;
@@ -524,7 +524,7 @@ public void run(Map<Method, CEntryPointData> entryPoints,
524524
ImageSingletons.add(ProgressReporter.class, reporter);
525525
ImageSingletons.add(TimerCollection.class, timerCollection);
526526
ImageSingletons.add(ImageBuildStatistics.TimerCollectionPrinter.class, timerCollection);
527-
ImageSingletons.add(AnnotationExtracter.class, loader.classLoaderSupport.annotationExtracter);
527+
ImageSingletons.add(AnnotationExtractor.class, loader.classLoaderSupport.annotationExtractor);
528528
ImageSingletons.add(BuildArtifacts.class, (type, artifact) -> buildArtifacts.computeIfAbsent(type, t -> new ArrayList<>()).add(artifact));
529529
ImageSingletons.add(HostedOptionValues.class, new HostedOptionValues(optionProvider.getHostedValues()));
530530
ImageSingletons.add(RuntimeOptionValues.class, new RuntimeOptionValues(optionProvider.getRuntimeValues(), allOptionNames));
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
import org.graalvm.compiler.debug.GraalError;
4444
import org.graalvm.nativeimage.AnnotationAccess;
45-
import org.graalvm.nativeimage.impl.AnnotationExtracter;
45+
import org.graalvm.nativeimage.impl.AnnotationExtractor;
4646

4747
import com.oracle.svm.hosted.annotation.AnnotationMetadata.AnnotationExtractionError;
4848
import com.oracle.svm.util.AnnotationWrapper;
@@ -63,20 +63,20 @@
6363
* through the JDK's {@link AnnotationParser} initializes the class of every annotation on the
6464
* queried element.
6565
*
66-
* When queried, the extracter looks for the root of the provided element, which can be a
66+
* When queried, the extractor looks for the root of the provided element, which can be a
6767
* {@link Field}, {@link Method}, {@link Constructor} or {@link Class} object, as well as a record
6868
* component on JDK 17. It then looks into the byte arrays representing annotations in the root
6969
* object and outputs wrapper classes containing all the information necessary to reconstruct the
7070
* annotation on demand in an {@link AnnotationValue} or {@link TypeAnnotationValue} object or any
7171
* subclass of {@link AnnotationMemberValue}. The actual annotation can then be created using the
7272
* {@link AnnotationMemberValue#get(Class)} method.
7373
*
74-
* The {@link SubstrateAnnotationExtracter} is tightly coupled with {@link AnnotationAccess}, which
74+
* The {@link SubstrateAnnotationExtractor} is tightly coupled with {@link AnnotationAccess}, which
7575
* provides implementations of {@link AnnotatedElement#isAnnotationPresent(Class)} and
7676
* {@link AnnotatedElement#getAnnotation(Class)}. {@link AnnotatedElement#getAnnotations()} should
7777
* in principle not be used during Native Image generation.
7878
*/
79-
public class SubstrateAnnotationExtracter implements AnnotationExtracter {
79+
public class SubstrateAnnotationExtractor implements AnnotationExtractor {
8080
private final Map<Class<?>, AnnotationValue[]> annotationCache = new ConcurrentHashMap<>();
8181
private final Map<AnnotatedElement, AnnotationValue[]> declaredAnnotationCache = new ConcurrentHashMap<>();
8282
private final Map<Executable, AnnotationValue[][]> parameterAnnotationCache = new ConcurrentHashMap<>();

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/reflect/ReflectionDataBuilder.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
import com.oracle.svm.hosted.annotation.AnnotationMemberValue;
7878
import com.oracle.svm.hosted.annotation.AnnotationSubstitutionType;
7979
import com.oracle.svm.hosted.annotation.AnnotationValue;
80-
import com.oracle.svm.hosted.annotation.SubstrateAnnotationExtracter;
80+
import com.oracle.svm.hosted.annotation.SubstrateAnnotationExtractor;
8181
import com.oracle.svm.hosted.annotation.TypeAnnotationValue;
8282
import com.oracle.svm.hosted.substitute.SubstitutionReflectivityFilter;
8383
import com.oracle.svm.util.ReflectionUtil;
@@ -121,10 +121,10 @@ public class ReflectionDataBuilder extends ConditionalConfigurationRegistry impl
121121
private final Map<AnalysisMethod, AnnotationValue[][]> filteredParameterAnnotations = new ConcurrentHashMap<>();
122122
private final Map<AnnotatedElement, TypeAnnotationValue[]> filteredTypeAnnotations = new ConcurrentHashMap<>();
123123

124-
private final SubstrateAnnotationExtracter annotationExtracter;
124+
private final SubstrateAnnotationExtractor annotationExtractor;
125125

126-
ReflectionDataBuilder(SubstrateAnnotationExtracter annotationExtracter) {
127-
this.annotationExtracter = annotationExtracter;
126+
ReflectionDataBuilder(SubstrateAnnotationExtractor annotationExtractor) {
127+
this.annotationExtractor = annotationExtractor;
128128
}
129129

130130
@Override
@@ -596,7 +596,7 @@ private void registerTypesForAnnotations(DuringAnalysisAccessImpl access, Annota
596596
if (annotatedElement != null) {
597597
filteredAnnotations.computeIfAbsent(annotatedElement, element -> {
598598
List<AnnotationValue> includedAnnotations = new ArrayList<>();
599-
for (AnnotationValue annotation : annotationExtracter.getDeclaredAnnotationData(element)) {
599+
for (AnnotationValue annotation : annotationExtractor.getDeclaredAnnotationData(element)) {
600600
if (includeAnnotation(access, annotation)) {
601601
includedAnnotations.add(annotation);
602602
registerTypes(access, annotation.getTypes());
@@ -610,7 +610,7 @@ private void registerTypesForAnnotations(DuringAnalysisAccessImpl access, Annota
610610
private void registerTypesForParameterAnnotations(DuringAnalysisAccessImpl access, AnalysisMethod executable) {
611611
if (executable != null) {
612612
filteredParameterAnnotations.computeIfAbsent(executable, element -> {
613-
AnnotationValue[][] parameterAnnotations = annotationExtracter.getParameterAnnotationData(element);
613+
AnnotationValue[][] parameterAnnotations = annotationExtractor.getParameterAnnotationData(element);
614614
AnnotationValue[][] includedParameterAnnotations = new AnnotationValue[parameterAnnotations.length][];
615615
for (int i = 0; i < includedParameterAnnotations.length; ++i) {
616616
AnnotationValue[] annotations = parameterAnnotations[i];
@@ -632,7 +632,7 @@ private void registerTypesForTypeAnnotations(DuringAnalysisAccessImpl access, An
632632
if (annotatedElement != null) {
633633
filteredTypeAnnotations.computeIfAbsent(annotatedElement, element -> {
634634
List<TypeAnnotationValue> includedTypeAnnotations = new ArrayList<>();
635-
for (TypeAnnotationValue typeAnnotation : annotationExtracter.getTypeAnnotationData(element)) {
635+
for (TypeAnnotationValue typeAnnotation : annotationExtractor.getTypeAnnotationData(element)) {
636636
if (includeAnnotation(access, typeAnnotation.getAnnotationData())) {
637637
includedTypeAnnotations.add(typeAnnotation);
638638
registerTypes(access, typeAnnotation.getAnnotationData().getTypes());
@@ -644,7 +644,7 @@ private void registerTypesForTypeAnnotations(DuringAnalysisAccessImpl access, An
644644
}
645645

646646
private void registerTypesForAnnotationDefault(DuringAnalysisAccessImpl access, AnalysisMethod method) {
647-
AnnotationMemberValue annotationDefault = annotationExtracter.getAnnotationDefaultData(method);
647+
AnnotationMemberValue annotationDefault = annotationExtractor.getAnnotationDefaultData(method);
648648
if (annotationDefault != null) {
649649
registerTypes(access, annotationDefault.getTypes());
650650
}
@@ -902,7 +902,7 @@ public TypeAnnotationValue[] getTypeAnnotationData(AnnotatedElement element) {
902902
}
903903

904904
public AnnotationMemberValue getAnnotationDefaultData(AnnotatedElement element) {
905-
return annotationExtracter.getAnnotationDefaultData(element);
905+
return annotationExtractor.getAnnotationDefaultData(element);
906906
}
907907

908908
@Override

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/reflect/ReflectionFeature.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
import org.graalvm.nativeimage.ImageSingletons;
4444
import org.graalvm.nativeimage.c.function.CFunctionPointer;
4545
import org.graalvm.nativeimage.hosted.RuntimeReflection;
46-
import org.graalvm.nativeimage.impl.AnnotationExtracter;
46+
import org.graalvm.nativeimage.impl.AnnotationExtractor;
4747
import org.graalvm.nativeimage.impl.RuntimeReflectionSupport;
4848

4949
import com.oracle.graal.pointsto.meta.AnalysisMethod;
@@ -74,7 +74,7 @@
7474
import com.oracle.svm.hosted.FeatureImpl.DuringSetupAccessImpl;
7575
import com.oracle.svm.hosted.ImageClassLoader;
7676
import com.oracle.svm.hosted.analysis.Inflation;
77-
import com.oracle.svm.hosted.annotation.SubstrateAnnotationExtracter;
77+
import com.oracle.svm.hosted.annotation.SubstrateAnnotationExtractor;
7878
import com.oracle.svm.hosted.code.FactoryMethodSupport;
7979
import com.oracle.svm.hosted.config.ConfigurationParserUtils;
8080
import com.oracle.svm.hosted.meta.HostedField;
@@ -249,7 +249,7 @@ public void afterRegistration(AfterRegistrationAccess access) {
249249

250250
ImageSingletons.add(ReflectionSubstitutionSupport.class, this);
251251

252-
reflectionData = new ReflectionDataBuilder((SubstrateAnnotationExtracter) ImageSingletons.lookup(AnnotationExtracter.class));
252+
reflectionData = new ReflectionDataBuilder((SubstrateAnnotationExtractor) ImageSingletons.lookup(AnnotationExtractor.class));
253253
ImageSingletons.add(RuntimeReflectionSupport.class, reflectionData);
254254
ImageSingletons.add(ReflectionHostedSupport.class, reflectionData);
255255
}

substratevm/src/com.oracle.svm.util/src/com/oracle/svm/util/AnnotationWrapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import org.graalvm.nativeimage.AnnotationAccess;
3535
import org.graalvm.nativeimage.ImageInfo;
3636
import org.graalvm.nativeimage.ImageSingletons;
37-
import org.graalvm.nativeimage.impl.AnnotationExtracter;
37+
import org.graalvm.nativeimage.impl.AnnotationExtractor;
3838

3939
// Checkstyle: allow direct annotation access
4040

@@ -171,7 +171,7 @@ private static <T extends Annotation> T getAnnotation(AnnotationWrapper element,
171171

172172
private static <T extends Annotation> T getRootAnnotation(AnnotatedElement annotationRoot, Class<T> annotationClass, boolean declaredOnly) {
173173
if (ImageInfo.inImageBuildtimeCode()) {
174-
return ImageSingletons.lookup(AnnotationExtracter.class).extractAnnotation(annotationRoot, annotationClass, declaredOnly);
174+
return ImageSingletons.lookup(AnnotationExtractor.class).extractAnnotation(annotationRoot, annotationClass, declaredOnly);
175175
} else {
176176
if (declaredOnly) {
177177
return annotationRoot.getDeclaredAnnotation(annotationClass);

0 commit comments

Comments
 (0)