We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
I used your latest testcase in issue #715 and that worked fine. I made a minor modification and now it works with javac, but fails with j2objc.
Sorry to bother you again with this one ;-) This issue is not a blocker for me.
BTW: I like j2objc very much and I really appreciate your efforts. Besides this minor issue j2objc works very well. Thank you!
import java.lang.annotation.*; @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface SomeAnnotation { String value() default ""; }
import java.lang.reflect.Method; @SomeAnnotation("type") public class SomeClass { public static void main(String... args) throws NoSuchMethodException { final Method method = SomeClass.class.getMethod("someMethod"); //works System.out.println("annotation on method: " + method.getAnnotation(SomeAnnotation.class)); //works System.out.println("1: annotation on return type: " + method.getReturnType().getAnnotation(SomeAnnotation.class)); //fails final SomeAnnotation someAnnotation = method.getReturnType().getAnnotation(SomeAnnotation.class); System.out.println("2: annotation on return type: " + someAnnotation); } @SomeAnnotation("method") public SomeClass someMethod() { return null; } }
Output:
$ javac SomeClass.java SomeAnnotation.java $ java SomeClass annotation on method: @SomeAnnotation(value=method) 1: annotation on return type: @SomeAnnotation(value=type) 2: annotation on return type: @SomeAnnotation(value=type) $ /usr/local/j2objc/2.1.1/j2objc SomeClass.java SomeAnnotation.java SomeClass.java:18: error: incompatible types: java.lang.annotation.Annotation cannot be converted to SomeAnnotation final SomeAnnotation someAnnotation = method.getReturnType().getAnnotation(SomeAnnotation.class);
The text was updated successfully, but these errors were encountered:
Issue #987: Type mismatch problem when trying to get annotation from …
68645b3
…returnType of method (was issue 715) Matching signature defined in: https://android.googlesource.com/platform/libcore/+/android-7.1.2_r36/ojluni/src/main/java/java/lang/reflect/Method.java Change on 2018/07/13 by antoniocortes <antoniocortes@google.com> ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=204470786
Fixed in current source.
Sorry, something went wrong.
antonio-cortes-perez
No branches or pull requests
Hi,
I used your latest testcase in issue #715 and that worked fine. I made a minor modification and now it works with javac, but fails with j2objc.
Sorry to bother you again with this one ;-) This issue is not a blocker for me.
BTW: I like j2objc very much and I really appreciate your efforts. Besides this minor issue j2objc works very well. Thank you!
Output:
The text was updated successfully, but these errors were encountered: