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

Improve diagnostics when OrderUtils.getPriority encounters an ArrayStoreException during annotation introspection [SPR-12357] #16962

Closed
spring-projects-issues opened this issue Oct 21, 2014 · 5 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Oct 21, 2014

Andy Wilkinson opened SPR-12357 and commented

I noticed this while testing the fix for #16930. I was running an app on Tomcat 8 (where javax.annotation.Priority is available).

OrderUtils.getPriority calls Class.getAnnotations() directly so it doesn't benefit from the recent improvements to AnnotationUtils' diagnostics. Could OrderUtils.getPriority be updated to use AnnotationUtils in a similar fashion to OrderUtils.getOrder?


Affects: 4.1.1

Issue Links:

Referenced from: commits 2b6f841

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

We're detecting @Priority through the regular AnnotationUtils.findAnnotation method now. This has the side benefit of it being detected on a composed annotation as well (even if that's not the intended usage model of that standard annotation, it doesn't hurt for it to work along the lines of our own @Order).

Juergen

@spring-projects-issues
Copy link
Collaborator Author

zyro commented

hi, could it be that this change caused a regression in terms of broken jdk 6 compatibility?

i am seeing

java.lang.UnsupportedClassVersionError: javax/annotation/Priority : Unsupported major.minor version 51.0
...
at org.springframework.util.ClassUtils.forName(ClassUtils.java:249)
at org.springframework.core.annotation.OrderUtils.<clinit>(OrderUtils.java:41)
...

and the code looks like only a ClassNotFoundException is expected/caught, but not that java.lang.UnsupportedClassVersionError?

was testing locally with oracle jdk 1.6.0_45 x64

thanks, zyro

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Hmm, this means that you do have the javax.annotation.Priority class on your classpath though... Is this intentional? From a Spring perspective, this is an optional dependency which should only ever be present on JDK 7+ to begin with...

That said, we should be more defensive there and catch any kind of error. Could you please create a separate JIRA issue for it?

Juergen

@spring-projects-issues
Copy link
Collaborator Author

zyro commented

hi i just saw that the offending javax.annotation.Priority class ships with tomcat-embed-core-8.x which clearly states that it requires jdk7+. no good idea to try run a jdk6 app on it anyway ;) - ill file the separate jira but for my part, consider it as low prio.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Dec 1, 2014

zyro commented

here you go: #17095 thanks, zyro

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: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants