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:

  • Reproducer: https://github.com/spring-projects/spring-data-examples/blob/master/jpa/example/src/test/java/example/springdata/jpa/custom/UserRepositoryCustomizationTests.java
  • CI job: https://travis-ci.org/spring-projects/spring-data-examples/jobs/586895698
  • full-trace.txt

Comment From: sbrannen

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?

Comment From: mp911de

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

Comment From: sbrannen

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.

Comment From: mp911de

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

Comment From: sbrannen

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?

Comment From: jhoeller

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?

Comment From: philwebb

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.

Comment From: sbrannen

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.

Comment From: jhoeller

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.

Comment From: mp911de

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.