Community
Participate
Working Groups
BETA_JAVA8: // --------- import java.lang.annotation.ElementType; import java.lang.annotation.Target; import java.io.Serializable; public class X extends @Marker Object implements @Marker Serializable { int x = (@Marker int) 0; } @Target(ElementType.TYPE_USE) @interface Marker { } // ------------------------ Searching for references to Marker brings up only one result - the one inside the cast. The other two are missing.
Created attachment 227378 [details] Work-In-Progress Patch
Created attachment 227670 [details] Proposed Patch
Created attachment 227671 [details] Proposed Patch corrected patch (comments removed)
Fix looks good. I made a few changes: (1) JCP disclaimer is missing in both files - fixed. (2) I moved the fix to down below - this eliminates the need for various null checks (3) We should always extract array length computation outside of the for loop's condition as it is invariant. (4) Since the for loop's index variable's scope is limited to the for loop, we can reuse the same variable i as the index in the second loop - i as the index variable is lot less distracting, the moment we see j, it conjures up the notion of a nested loop which is not the case here. (5) When fixing a method, it helps to just eyeball the neighborhood of the change - We are missing reporting of annotations on type variables of a class. I'll raise a separate bug for that. Fix and tests released here: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=4005c370e6cbaf5fe897eaa7c9410e92ff25148d Thanks Manoj.
(In reply to comment #4) > (5) When fixing a method, it helps to just eyeball the neighborhood of the > change - We are missing reporting of annotations on type variables of a > class. > I'll raise a separate bug for that. This is already there: https://bugs.eclipse.org/bugs/show_bug.cgi?id=400919