{"action":"opened","issue":{"url":"https://api.github.com/repos/google/j2objc/issues/473","labels_url":"https://api.github.com/repos/google/j2objc/issues/473/labels{/name}","comments_url":"https://api.github.com/repos/google/j2objc/issues/473/comments","events_url":"https://api.github.com/repos/google/j2objc/issues/473/events","html_url":"https://github.com/google/j2objc/issues/473","id":54207277,"number":473,"title":"Annotations on non-default constructors aren't found","user":{"login":"mvoong","id":571634,"avatar_url":"https://avatars.githubusercontent.com/u/571634?v=3","gravatar_id":"","url":"https://api.github.com/users/mvoong","html_url":"https://github.com/mvoong","followers_url":"https://api.github.com/users/mvoong/followers","following_url":"https://api.github.com/users/mvoong/following{/other_user}","gists_url":"https://api.github.com/users/mvoong/gists{/gist_id}","starred_url":"https://api.github.com/users/mvoong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvoong/subscriptions","organizations_url":"https://api.github.com/users/mvoong/orgs","repos_url":"https://api.github.com/users/mvoong/repos","events_url":"https://api.github.com/users/mvoong/events{/privacy}","received_events_url":"https://api.github.com/users/mvoong/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-01-13T15:34:09Z","updated_at":"2015-01-13T15:34:09Z","closed_at":null,"body":"The following class demonstrates that when isAnnotationPresent() is called on a non-default constructor,  it returns false. It correctly returns true on a default constructor.\r\n\r\n```\r\nimport java.lang.annotation.ElementType;\r\nimport java.lang.annotation.Retention;\r\nimport java.lang.annotation.RetentionPolicy;\r\nimport java.lang.annotation.Target;\r\nimport java.lang.reflect.Constructor;\r\n\r\npublic class JavaTest {\r\n    \r\n    @Target({ElementType.CONSTRUCTOR})\r\n    @Retention(RetentionPolicy.RUNTIME)\r\n    public @interface Inject {\r\n    }\r\n    \r\n    // This one works\r\n    @Inject\r\n    JavaTest() {\r\n        \r\n    }\r\n\r\n//     This one doesn't work\r\n//    @Inject\r\n//    JavaTest(String hello) {\r\n//        \r\n//    }\r\n    \r\n    public void performTest() {\r\n        Constructor<?>[] constructors = JavaTest.class.getDeclaredConstructors();\r\n        assert constructors[0].isAnnotationPresent(Inject.class);\r\n    }\r\n}\r\n```\r\n\r\nI've done a bit of digging and it seems that getDeclaredAnnotations() in ExecutableMember.m calls -[JavaLangReflectConstructor internalName], which always returns \"JavaTest\". For the non-default constructor in the code sample, this should probably be returning \"JavaTestWithNSString_\"."}}