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

Classpath scanning on inner classes fails against JDK 11 bytecode level [SPR-17096] #21633

Closed
spring-projects-issues opened this issue Jul 26, 2018 · 4 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jul 26, 2018

Kedar Joshi opened SPR-17096 and commented

After upgrading to Spring 5.1 RC1 my application started failing with following exception - 

Caused by: java.lang.UnsupportedOperationException
 at org.springframework.asm.ClassVisitor.visitNestHostExperimental(ClassVisitor.java:156) ~[spring-core-5.1.0.RC1.jar:5.1.0.RC1]
 at org.springframework.asm.ClassReader.accept(ClassReader.java:541) ~[spring-core-5.1.0.RC1.jar:5.1.0.RC1]
 at org.springframework.asm.ClassReader.accept(ClassReader.java:391) ~[spring-core-5.1.0.RC1.jar:5.1.0.RC1]
 at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:65) ~[spring-core-5.1.0.RC1.jar:5.1.0.RC1]
 at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103) ~[spring-core-5.1.0.RC1.jar:5.1.0.RC1]
 at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:123) ~[spring-core-5.1.0.RC1.jar:5.1.0.RC1]
  

Turned out, this is happening when spring tries to process classes which have inner class themselves. e.g.  in.workingtheory.Application class has an inner class FailureGeneration. Application will not start unless I remove this inner class altogether or remove class in.workingtheory.Application from class path scanning.

This is only reproducible on JDK 11 and Spring 5.1 RC1 but works fine on JDK 10.

Sample project for reproducing this issue is attached.

+Environment+

Oracle JDK 11 Build 23 (64 Bit)
Spring framework 5.1 RC1


Affects: 5.1 RC1

Attachments:

Issue Links:

Referenced from: commits e82efbc

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

I assume this only happens when compiling with the default target (i.e. JDK 11 bytecode)? Does it work when compiling with -target 1.8 or even -target 10 and deploying to JDK 11?

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

This seems to be a consequence of our ASM 6.2 upgrade which only has experimental support for the JDK 11 bytecode level and doesn't activate it by default. We can get around it by declaring our visitors as ASM7_EXPERIMENTAL (which we'll probably do for Spring Framework 5.1 RC2) but ideally we'd get a proper ASM 7 upgrade in time for 5.1's general availability.

@spring-projects-issues
Copy link
Collaborator Author

Kedar Joshi commented

Yes, you are right. This happens with JDK 11 bytecode only. Work fine on JDK 11 with bytecode level 1.8, 9 and 10.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

I've switched our SpringAsmInfo.ASM_VERSION to ASM7_EXPERIMENTAL for the time being. This should hopefully allow for parsing all currently known JDK 11 bytecode variants.

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) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants