Skip to content

SynthesizedAnnotation must be public [SPR-13057] #17649

Closed

Description

@spring-projects-issues

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

Activity

  1. spring-projects-issues commented on May 22, 2015

    @spring-projects-issues
    CollaboratorAuthor

    Stéphane Nicoll commented

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

  2. spring-projects-issues commented on May 22, 2015

    @spring-projects-issues
    CollaboratorAuthor

    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!

  3. spring-projects-issues commented on May 22, 2015

    @spring-projects-issues
    CollaboratorAuthor

    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

  4. spring-projects-issues commented on May 22, 2015

    @spring-projects-issues
    CollaboratorAuthor

    Sam Brannen commented

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

  5. spring-projects-issues commented on May 22, 2015

    @spring-projects-issues
    CollaboratorAuthor

    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

  6. spring-projects-issues commented on May 22, 2015

    @spring-projects-issues
    CollaboratorAuthor

    Sam Brannen commented

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

  7. added
    type: bug
    in: core
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: coretype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions