Community
Participate
Working Groups
The latest spec for JSR308 requires annotations on qualified types to be placed before the type name. i.e In a qualified type, the type annotations appear before the simple name, not before the package names. For example, a programmer writes package1.package2. @Annotation SimpleName rather than @Annotation package1.package2.SimpleName. We should reject misplaced annotations with a clear (if needed new) message.
Created attachment 223585 [details] Fix with updated tests Patch alters some of the code released as part of fix to bug 390882. I treat this case same as the one where annotations are used on sub packages in a qualified type. I am doing this simply because the fix is simple. All Java 8 tests pass. Let me know if you would prefer a specific error message, something like this: "Annotations on a qualified type must be placed before the type name and not the package names."
The attached patch seems to reject java.lang.@Marker Integer ? Please add a positive test for the new syntax (which could be overall negative test due to some other error introduced.) Also a test for acceptance of annotations at a nested type as well as outer type would be good.
(In reply to comment #2) > The attached patch seems to reject java.lang.@Marker Integer ? > Please add a positive test for the new syntax (which could be > overall negative test due to some other error introduced.) Also > a test for acceptance of annotations at a nested type as well > as outer type would be good. Otherwise patch looks good.
Created attachment 224040 [details] Updated patch There was a silly error in the previous patch, which I have corrected in this. Stephan, I had to make some adjustments to some tests in NullTypeAnnotationTest. In short, I am using the simple name for java.lang.Object and java.util.List instead of the fully qualified name. Are you fine with this? If so, I will release this patch.
Released the fix via commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=a8944173670c6319cce2438add6b3e87f478a46c Stephan, please let me know if you think about the test changes I mentioned in comment #4.
I have been asking Stephan for his comments without Copying him on this bug! :(
(In reply to comment #6) > I have been asking Stephan for his comments without Copying him on this bug! > :( The changes per se are good. I'll re-introduce some syntactic variance via bug 396258.