Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnnotationConfigurationException during @AliasFor processing on Java 14 #23678

Closed
mp911de opened this issue Sep 23, 2019 · 10 comments
Closed

AnnotationConfigurationException during @AliasFor processing on Java 14 #23678

mp911de opened this issue Sep 23, 2019 · 10 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: invalid An issue that we don't feel is valid

Comments

@mp911de
Copy link
Member

mp911de commented Sep 23, 2019

Java version: 14-ea+15-621

Trying to evaluate ConditionalOnMissingFilterBean by running a Spring Boot application using JPA fails on Java 14 with the following exception:

Stack trace:

org.springframework.core.annotation.AnnotationConfigurationException: @AliasFor declaration on attribute 'value' in annotation [org.springframework.boot.autoconfigure.web.servlet.ConditionalOnMissingFilterBean] declares an alias for attribute 'value' in annotation [org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean] which is not meta-present.
	at org.springframework.core.annotation.AnnotationTypeMapping.validateAllAliasesClaimed(AnnotationTypeMapping.java:335)
	at org.springframework.core.annotation.AnnotationTypeMapping.afterAllMappingsSet(AnnotationTypeMapping.java:322)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1510)
	at org.springframework.core.annotation.AnnotationTypeMappings.<init>(AnnotationTypeMappings.java:62)
	at org.springframework.core.annotation.AnnotationTypeMappings.<init>(AnnotationTypeMappings.java:46)
	at org.springframework.core.annotation.AnnotationTypeMappings$Cache.createMappings(AnnotationTypeMappings.java:217)
	at java.base/java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:330)
	at org.springframework.core.annotation.AnnotationTypeMappings$Cache.get(AnnotationTypeMappings.java:213)
	at org.springframework.core.annotation.AnnotationTypeMappings.forAnnotationType(AnnotationTypeMappings.java:181)
	at org.springframework.core.annotation.AnnotationTypeMappings.forAnnotationType(AnnotationTypeMappings.java:168)
	at org.springframework.core.annotation.TypeMappedAnnotation.of(TypeMappedAnnotation.java:632)
	at org.springframework.core.annotation.MergedAnnotation.of(MergedAnnotation.java:593)
	at org.springframework.core.type.classreading.MergedAnnotationReadingVisitor.visitEnd(MergedAnnotationReadingVisitor.java:96)
	at org.springframework.asm.ClassReader.readElementValues(ClassReader.java:2775)
	at org.springframework.asm.ClassReader.accept(ClassReader.java:572)
	at org.springframework.asm.ClassReader.accept(ClassReader.java:400)
	at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:50)
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103)
	at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:86)
	at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:73)
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:81)
	at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:686)
	at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getMemberClasses(ConfigurationClassParser.java:977)
	at org.springframework.context.annotation.ConfigurationClassParser.processMemberClasses(ConfigurationClassParser.java:347)
	at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:266)
	at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245)
	at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:587)
	... 46 common frames omitted

Links:

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 23, 2019
@sbrannen
Copy link
Member

Java version: 14-ea+15-621

Trying to evaluate ConditionalOnMissingFilterBean by running a Spring Boot application using JPA fails on Java 14 with the following exception:

Just to be clear, are you saying this works fine on all JDKs prior to 14?

@mp911de
Copy link
Member Author

mp911de commented Sep 23, 2019

Yes. It also worked on 14-ea+12-409. I assume a change between JDK builds 12 and 15 broke something.

@sbrannen
Copy link
Member

sbrannen commented Sep 23, 2019

Then that definitely looks like a bug in the JDK: @ConditionalOnMissingFilterBean is clearly meta-annotated with @ConditionalOnMissingBean.

Since we don't have any build plans executing against JDK 14 early access builds, I guess we'll just have to wait this one out for the time being, assuming the bug will be fixed in an upcoming JDK 14-ea build.

If you notice that it gets fixed, please let us know.

@mp911de
Copy link
Member Author

mp911de commented Sep 23, 2019

Thanks for looking into this one. I'll let you know when we notice our Java 14 builds are back to green.

@sbrannen
Copy link
Member

Based on the stacktrace, the bug might actually be in ASM instead of the JDK. For example, it could be that the version of ASM in use does not support changes in the bytecode generated by JDK 14-ea.

@philwebb, what are your thoughts on the matter? Shall we try to pin this down to either ASM or JDK 14-ea?

@jhoeller
Copy link
Contributor

jhoeller commented Sep 23, 2019

FWIW, there are no recent code-level changes on ASM master (https://gitlab.ow2.org/asm/asm/commits/master)... not sure whether they have yet to catch up with some recent JDK 14 bytecode change there, or whether it is some JDK policy change that our own reader code has to take into account?

@philwebb
Copy link
Member

I don't have JDK 14 installed yet I'm afraid. I think this will need some debugging. I assume that Spring Boot hasn't been recompiled, so it's unlikely that ASM wouldn't be able to read the bytecode. There's also no evidence yet that it's a Java bug.

@sbrannen
Copy link
Member

I assume that Spring Boot hasn't been recompiled, so it's unlikely that ASM wouldn't be able to read the bytecode.

That's very valid observation, and you're right: we'll simply have to debug it.

yrodiere added a commit to yrodiere/hibernate-search that referenced this issue Oct 22, 2019
yrodiere added a commit to yrodiere/hibernate-search that referenced this issue Oct 24, 2019
yrodiere added a commit to yrodiere/hibernate-search that referenced this issue Oct 24, 2019
yrodiere added a commit to yrodiere/hibernate-search that referenced this issue Oct 24, 2019
yrodiere added a commit to yrodiere/hibernate-search that referenced this issue Oct 24, 2019
yrodiere added a commit to yrodiere/hibernate-search that referenced this issue Oct 24, 2019
yrodiere added a commit to yrodiere/hibernate-search that referenced this issue Oct 25, 2019
yrodiere added a commit to yrodiere/hibernate-search that referenced this issue Oct 25, 2019
yrodiere added a commit to hibernate/hibernate-search that referenced this issue Oct 25, 2019
@jhoeller jhoeller self-assigned this Jan 27, 2020
@jhoeller jhoeller added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) and removed for: team-attention status: waiting-for-triage An issue we've not yet triaged or decided on labels Jan 27, 2020
@jhoeller jhoeller added this to the 5.2.4 milestone Jan 27, 2020
@jhoeller jhoeller added type: regression A bug that is also a regression and removed type: bug A general bug labels Jan 27, 2020
@jhoeller
Copy link
Contributor

jhoeller commented Feb 5, 2020

Our current tests on JDK 14 build 34 (release candidate level) do not reveal any such annotation configuration issues. Can this still be reproduced in a Spring Boot application? Would be good to sort this out for good in the Spring Framework 5.2.4 timeframe.

@mp911de
Copy link
Member Author

mp911de commented Feb 6, 2020

I was no longer able to reproduce the issue with the most recent build 14-ea+34-1452 with Spring Framework 5.2.3 and Spring Boot 2.2.3. We can close this one.

@mp911de mp911de closed this as completed Feb 6, 2020
@jhoeller jhoeller removed this from the 5.2.4 milestone Feb 6, 2020
@sbrannen sbrannen added status: invalid An issue that we don't feel is valid and removed type: regression A bug that is also a regression labels Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

5 participants