Community
Participate
Working Groups
import java.lang.annotation.Annotation; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.reflect.Method; public class X extends Super { public static void main(String[] args) { try { Method m = X.class.getMethod("setFoo", String.class); Annotation a = m.getAnnotation(Anno.class); System.out.println("Annotation was " + (a == null ? "not " : "") + "found"); } catch (Exception e) { e.printStackTrace(); } } } class Super { @Anno public void setFoo(String foo) {} } @Retention(RetentionPolicy.RUNTIME) @interface Anno {} MethodVerifyTest#208 On running the above, javac finds ("Annotation was found") the annotation while eclipse jdt does not. The behaviour was "Annotation not found" in 1.7 in javac as well. Looks like it was a bug that got fixed in javac. b126 in 1.7 mode also finds the annotations. - [May have to move out of 1.8 as well after analysis.]
javac has started carrying over annotations to the bridge. This is an interesting behavior change, we will take a look at it in 4.4 time frame.
Sasi, please take a look.
Created attachment 241709 [details] Changes to carry annotations to bridge methods Changes to Carry annotations to bridge methods
Created attachment 241710 [details] mylyn/context/zip
Srikanth, please look at proposed patch to carry annotations to bridge methods. The tests test208, test208a, test288658 and test288658a in MethodVerifyTest need to be modified after this change to pass.
(In reply to Sasikanth Bharadwaj from comment #4) > Created attachment 241710 [details] > mylyn/context/zip I don't use mylyn, so these are not useful for me. (In reply to Sasikanth Bharadwaj from comment #5) > Srikanth, please look at proposed patch to carry annotations to bridge > methods. The tests test208, test208a, test288658 and test288658a in > MethodVerifyTest need to be modified after this change to pass. Could you post a patch that also includes the tests please ? Thanks.
Created attachment 241721 [details] Patch to carry annotations to bridge methods Patch that includes modifications to tests as well
(In reply to comment #6) > (In reply to Sasikanth Bharadwaj from comment #4) > > Created attachment 241710 [details] > > mylyn/context/zip > > I don't use mylyn, so these are not useful for me. > > (In reply to Sasikanth Bharadwaj from comment #5) > > Srikanth, please look at proposed patch to carry annotations to bridge > > methods. The tests test208, test208a, test288658 and test288658a in > > MethodVerifyTest need to be modified after this change to pass. > > Could you post a patch that also includes the tests please ? Thanks. New patch that includes modifications to tests is attached. Thanks Sasikanth
My contribution for this defect fix complies with http://www.eclipse.org/legal/CoO.php
Patch looks good. With minor changed released here: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=fbdad6f7f08557483f413498112ee14ccf916e02
Verified for 4.4 M7 with build I20140428-2000
*** Bug 437446 has been marked as a duplicate of this bug. ***