{"action":"created","issue":{"url":"https://api.github.com/repos/typetools/checker-framework/issues/1356","repository_url":"https://api.github.com/repos/typetools/checker-framework","labels_url":"https://api.github.com/repos/typetools/checker-framework/issues/1356/labels{/name}","comments_url":"https://api.github.com/repos/typetools/checker-framework/issues/1356/comments","events_url":"https://api.github.com/repos/typetools/checker-framework/issues/1356/events","html_url":"https://github.com/typetools/checker-framework/issues/1356","id":237359692,"number":1356,"title":"Type annotation in stub file stored as declaration annotation ","user":{"login":"smillst","id":13260174,"avatar_url":"https://avatars1.githubusercontent.com/u/13260174?v=4","gravatar_id":"","url":"https://api.github.com/users/smillst","html_url":"https://github.com/smillst","followers_url":"https://api.github.com/users/smillst/followers","following_url":"https://api.github.com/users/smillst/following{/other_user}","gists_url":"https://api.github.com/users/smillst/gists{/gist_id}","starred_url":"https://api.github.com/users/smillst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smillst/subscriptions","organizations_url":"https://api.github.com/users/smillst/orgs","repos_url":"https://api.github.com/users/smillst/repos","events_url":"https://api.github.com/users/smillst/events{/privacy}","received_events_url":"https://api.github.com/users/smillst/received_events","type":"User","site_admin":false},"labels":[{"id":589526556,"url":"https://api.github.com/repos/typetools/checker-framework/labels/StubParser","name":"StubParser","color":"d4c5f9","default":false}],"state":"open","locked":false,"assignee":{"login":"smillst","id":13260174,"avatar_url":"https://avatars1.githubusercontent.com/u/13260174?v=4","gravatar_id":"","url":"https://api.github.com/users/smillst","html_url":"https://github.com/smillst","followers_url":"https://api.github.com/users/smillst/followers","following_url":"https://api.github.com/users/smillst/following{/other_user}","gists_url":"https://api.github.com/users/smillst/gists{/gist_id}","starred_url":"https://api.github.com/users/smillst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smillst/subscriptions","organizations_url":"https://api.github.com/users/smillst/orgs","repos_url":"https://api.github.com/users/smillst/repos","events_url":"https://api.github.com/users/smillst/events{/privacy}","received_events_url":"https://api.github.com/users/smillst/received_events","type":"User","site_admin":false},"assignees":[{"login":"smillst","id":13260174,"avatar_url":"https://avatars1.githubusercontent.com/u/13260174?v=4","gravatar_id":"","url":"https://api.github.com/users/smillst","html_url":"https://github.com/smillst","followers_url":"https://api.github.com/users/smillst/followers","following_url":"https://api.github.com/users/smillst/following{/other_user}","gists_url":"https://api.github.com/users/smillst/gists{/gist_id}","starred_url":"https://api.github.com/users/smillst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smillst/subscriptions","organizations_url":"https://api.github.com/users/smillst/orgs","repos_url":"https://api.github.com/users/smillst/repos","events_url":"https://api.github.com/users/smillst/events{/privacy}","received_events_url":"https://api.github.com/users/smillst/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/typetools/checker-framework/milestones/2","html_url":"https://github.com/typetools/checker-framework/milestone/2","labels_url":"https://api.github.com/repos/typetools/checker-framework/milestones/2/labels","id":1202751,"number":2,"title":"Critical","description":null,"creator":{"login":"mernst","id":121025,"avatar_url":"https://avatars2.githubusercontent.com/u/121025?v=4","gravatar_id":"","url":"https://api.github.com/users/mernst","html_url":"https://github.com/mernst","followers_url":"https://api.github.com/users/mernst/followers","following_url":"https://api.github.com/users/mernst/following{/other_user}","gists_url":"https://api.github.com/users/mernst/gists{/gist_id}","starred_url":"https://api.github.com/users/mernst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mernst/subscriptions","organizations_url":"https://api.github.com/users/mernst/orgs","repos_url":"https://api.github.com/users/mernst/repos","events_url":"https://api.github.com/users/mernst/events{/privacy}","received_events_url":"https://api.github.com/users/mernst/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":107,"state":"open","created_at":"2015-07-10T16:54:20Z","updated_at":"2017-11-14T21:12:39Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2017-06-20T22:08:18Z","updated_at":"2017-11-14T21:13:53Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"The stubparser stores some type annotations as declaration annotations.   The annotation is put in `AnnotatedTypeFactory#declAnnosFromStubFiles` which is then written out to bytecode.  This cause errors `type.invalid` when the byte code is later used. (Example below or `checker/jtreg/stubs/issue1356`.)  This only seems to happen if the type annotation has some argument.\r\n\r\n~~This issue is blocking #1352, so we may want to add some work around such as removing type annotations from  `AnnotatedTypeFactory#declAnnosFromStubFiles`.~~  The ValueAnnotatedTypeFactory has been changed to work around this problem.  When this issue is fixed, please remove the work around.\r\n\r\nFile named MyClass.astub\r\n```\r\nimport org.checkerframework.checker.regex.qual.*;\r\nimport org.checkerframework.common.value.qual.*;\r\n\r\npackage mypackage;\r\n\r\nclass MyClass {\r\n   static @ArrayLen(1) @Regex(1) String toString(char c);\r\n}\r\n```\r\n```java\r\npackage mypackage;\r\n\r\npublic class MyClass {\r\n    static String toString(char c) {\r\n        return c + \"\";\r\n    }\r\n}\r\n```\r\n```java\r\npackage mypackage;\r\n\r\npublic class UseMyClass {\r\n    void test() {\r\n        String s = MyClass.toString('a');\r\n    }\r\n}\r\n```\r\n\r\nCompile MyClass:\r\n```\r\njavacheck -processor org.checkerframework.checker.regex.RegexChecker -Astubs=stub.astub mypackage/MyClass.java\r\n```\r\nCompile UseMyClass\r\n```\r\njavacheck -processor org.checkerframework.checker.regex.RegexChecker mypackage/UseMyClass.java\r\n```\r\nOutput:\r\n\r\n```\r\nmypackage/UseMyClass.java:5: error: [type.invalid] [@Regex(1), @UnknownRegex] may not be applied to the type \"@Regex(1) String\"\r\n        String s = MyClass.toString('a');\r\n                                   ^\r\n1 error\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/typetools/checker-framework/issues/comments/344400488","html_url":"https://github.com/typetools/checker-framework/issues/1356#issuecomment-344400488","issue_url":"https://api.github.com/repos/typetools/checker-framework/issues/1356","id":344400488,"user":{"login":"smillst","id":13260174,"avatar_url":"https://avatars1.githubusercontent.com/u/13260174?v=4","gravatar_id":"","url":"https://api.github.com/users/smillst","html_url":"https://github.com/smillst","followers_url":"https://api.github.com/users/smillst/followers","following_url":"https://api.github.com/users/smillst/following{/other_user}","gists_url":"https://api.github.com/users/smillst/gists{/gist_id}","starred_url":"https://api.github.com/users/smillst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smillst/subscriptions","organizations_url":"https://api.github.com/users/smillst/orgs","repos_url":"https://api.github.com/users/smillst/repos","events_url":"https://api.github.com/users/smillst/events{/privacy}","received_events_url":"https://api.github.com/users/smillst/received_events","type":"User","site_admin":false},"created_at":"2017-11-14T21:13:53Z","updated_at":"2017-11-14T21:13:53Z","author_association":"CONTRIBUTOR","body":"The workaround is no longer work and is causes failures such as https://travis-ci.org/typetests/daikon-typecheck/jobs/301695884#L1402.  "}}
{"actor":{"display_login":"smillst"}}