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-issuemaster opened this issue May 22, 2015 · 6 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

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:

  • #16137 Introduce unified support for declaring and looking up annotation attribute aliases
  • #16138 Introduce support for explicit annotation attribute overrides

Referenced from: commits e7ea925, 39b2fbb

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented May 22, 2015

Stéphane Nicoll commented

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

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented May 22, 2015

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-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented May 22, 2015

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-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented May 22, 2015

Sam Brannen commented

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

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented May 22, 2015

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-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented May 22, 2015

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
You can’t perform that action at this time.