eclipse-jdt / eclipse-jdt/eclipse.jdt.core

Annotation processor does not find nested class in incremental build

Open
#843 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

The spring-boot configuration processor fails to find a nested class via `javax.lang.model.util.Elements.getTypeElement(CharSequence)` during an incremental build. It does work fine during a full build.

The stacktrace looks like this:
```
Caused by: org.eclipse.jdt.internal.compiler.problem.AbortCompilation:
at org.eclipse.jdt.internal.core.builder.NameEnvironment.findClass(NameEnvironment.java:521)
at org.eclipse.jdt.internal.core.builder.NameEnvironment.findType(NameEnvironment.java:591)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.lambda$0(LookupEnvironment.java:240)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForTypeFromModules(LookupEnvironment.java:375)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:239)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getType(LookupEnvironment.java:1735)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getType(LookupEnvironment.java:1704)
at org.eclipse.jdt.internal.compiler.apt.model.ElementsImpl9.getTypeElement(ElementsImpl9.java:81)
at org.eclipse.jdt.internal.compiler.apt.model.ElementsImpl9.getTypeElement(ElementsImpl9.java:53)
at org.springframework.boot.configurationprocessor.TypeUtils.process(TypeUtils.java:237)
at org.springframework.boot.configurationprocessor.TypeUtils.createTypeDescriptor(TypeUtils.java:228)
at org.springframework.boot.configurationprocessor.TypeUtils.getType(TypeUtils.java:137)
at org.springframework.boot.configurationprocessor.PropertyDescriptor.resolveType(PropertyDescriptor.java:155)
at org.springframework.boot.configurationprocessor.PropertyDescriptor.resolveItemMetadataProperty(PropertyDescriptor.java:136)
at org.springframework.boot.configurationprocessor.PropertyDescriptor.resolveItemMetadata(PropertyDescriptor.java:130)
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.lambda$processTypeElement$0(ConfigurationMetadataAnnotationProcessor.java:261)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:260)
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.lambda$processTypeElement$0(ConfigurationMetadataAnnotationProcessor.java:266)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:260)
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processAnnotatedTypeElement(ConfigurationMetadataAnnotationProcessor.java:231)
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processElement(ConfigurationMetadataAnnotationProcessor.java:216)
... 28 more
```

See [this issue](https://github.com/spring-projects/spring-boot/issues/34612) for details and a reproducer and [this comment](https://github.com/spring-projects/spring-boot/issues/34612#issuecomment-1470782439) in particular.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.