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

SynthesizedAnnotation must be public [SPR-13057] #17649

Closed
spring-projects-issues opened this issue May 22, 2015 · 6 comments
Closed

SynthesizedAnnotation must be public [SPR-13057] #17649

spring-projects-issues opened this issue May 22, 2015 · 6 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 May 22, 2015

Stéphane Nicoll opened SPR-13057 and commented

Status Quo

How do you go about using Spring Boot 1.3.0.BUILD-SNAPSHOT?

I've set it in my Maven POM, but I'm getting strange errors when trying to run it.

Caused by: java.lang.IllegalAccessError: class org.springframework.core.annotation.$Proxy62 cannot access its superinterface org.springframework.core.annotation.SynthesizedAnnotation

Analysis

The SynthesizedAnnotation must be public so that non-public annotations from different packages can be proxied.


Issue Links:

Referenced from: commits e7ea925, 39b2fbb

@spring-projects-issues
Copy link
Collaborator Author

Stéphane Nicoll commented

this broke Spring Boot's build. Looking at it now.

@spring-projects-issues
Copy link
Collaborator Author

Stéphane Nicoll commented

Sam, I tried to write a unit test by moving the annotations to the subpackage package but couldn't reproduce. I confirm that Boot's build is restored if that interface is made public.

I am assigning that back to you to write the proper test for this issue. Thanks!

@spring-projects-issues
Copy link
Collaborator Author

Sam Brannen commented

Hi Stéphane Nicoll,

Thanks for investigating this and pushing the fix so quickly!

I'm fine with SynthesizedAnnotation being public. I was perhaps a bit overly (unnecessarily) cautious in not doing so in the first place. Besides, SpringProxy is also public. So it's probably a requirement that I simply overlooked.

Cheers,

Sam

@spring-projects-issues
Copy link
Collaborator Author

Sam Brannen commented

As for writing a proper test for this scenario, I'll see what I can cook up. ;)

@spring-projects-issues
Copy link
Collaborator Author

Sam Brannen commented

It turns out that it is in fact a requirement that I overlooked.

Straight from the Javadoc for java.lang.reflect.Proxy.getProxyClass().

All non-public interfaces must be in the same package; otherwise, it would not be possible for the proxy class to implement all of the interfaces, regardless of what package it is defined in.

Plus, I was able to produce a fully reflection-based test that reproduces the issue (although with a slightly different stack trace). Commit coming soon.

- Sam

@spring-projects-issues
Copy link
Collaborator Author

Sam Brannen commented

Added test that verifies the requirement that SynthesizedAnnotation be public in commit: e7ea925

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