{"action":"created","issue":{"url":"https://api.github.com/repos/ceylon/ceylon-compiler/issues/2160","labels_url":"https://api.github.com/repos/ceylon/ceylon-compiler/issues/2160/labels{/name}","comments_url":"https://api.github.com/repos/ceylon/ceylon-compiler/issues/2160/comments","events_url":"https://api.github.com/repos/ceylon/ceylon-compiler/issues/2160/events","html_url":"https://github.com/ceylon/ceylon-compiler/issues/2160","id":76193740,"number":2160,"title":"annotations of ClassWithInitializer / ClassWithConstructors / ReferenceDeclaration","user":{"login":"gavinking","id":579974,"avatar_url":"https://avatars.githubusercontent.com/u/579974?v=3","gravatar_id":"","url":"https://api.github.com/users/gavinking","html_url":"https://github.com/gavinking","followers_url":"https://api.github.com/users/gavinking/followers","following_url":"https://api.github.com/users/gavinking/following{/other_user}","gists_url":"https://api.github.com/users/gavinking/gists{/gist_id}","starred_url":"https://api.github.com/users/gavinking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gavinking/subscriptions","organizations_url":"https://api.github.com/users/gavinking/orgs","repos_url":"https://api.github.com/users/gavinking/repos","events_url":"https://api.github.com/users/gavinking/events{/privacy}","received_events_url":"https://api.github.com/users/gavinking/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ceylon/ceylon-compiler/labels/annotations","name":"annotations","color":"207de5"},{"url":"https://api.github.com/repos/ceylon/ceylon-compiler/labels/constructors","name":"constructors","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/ceylon/ceylon-compiler/milestones/11","html_url":"https://github.com/ceylon/ceylon-compiler/milestones/1.2","labels_url":"https://api.github.com/repos/ceylon/ceylon-compiler/milestones/11/labels","id":809477,"number":11,"title":"1.2","description":"","creator":{"login":"tombentley","id":879487,"avatar_url":"https://avatars.githubusercontent.com/u/879487?v=3","gravatar_id":"","url":"https://api.github.com/users/tombentley","html_url":"https://github.com/tombentley","followers_url":"https://api.github.com/users/tombentley/followers","following_url":"https://api.github.com/users/tombentley/following{/other_user}","gists_url":"https://api.github.com/users/tombentley/gists{/gist_id}","starred_url":"https://api.github.com/users/tombentley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tombentley/subscriptions","organizations_url":"https://api.github.com/users/tombentley/orgs","repos_url":"https://api.github.com/users/tombentley/repos","events_url":"https://api.github.com/users/tombentley/events{/privacy}","received_events_url":"https://api.github.com/users/tombentley/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":381,"state":"open","created_at":"2014-10-01T08:51:07Z","updated_at":"2015-09-17T10:23:26Z","due_on":"2014-11-02T23:00:00Z","closed_at":null},"comments":9,"created_at":"2015-05-14T01:49:13Z","updated_at":"2015-09-17T12:40:37Z","closed_at":null,"body":"There are two parts to this.\r\n\r\nFirst: make the following work:\r\n\r\n```ceylon\r\nfinal annotation class Foo() \r\n        satisfies OptionalAnnotation<Foo, ClassWithInitializerDeclaration> {}\r\nannotation Foo foo() => Foo();\r\nfinal annotation class Bar() \r\n        satisfies OptionalAnnotation<Bar, ClassWithConstructorsDeclaration> {}\r\nannotation Bar bar() => Bar();\r\n\r\nbar\r\nclass Z {\r\n    new New() {}\r\n}\r\n\r\nfoo\r\nclass W() {}\r\n```\r\n\r\nSecond: make use of this in the Java annotation interop:\r\n\r\n1. Any Java annotation marked `@Target(CONSTRUCTOR)` but not `@Target(CLASS)` gets the constraint `ConstructorDeclaration|ClassWithInitializerDeclaration`.\r\n2. Any Java annotation marked `@Target(CLASS)` but not `@Target(CONSTRUCTOR)` gets the constraint `ClassDeclaration`.\r\n2. Any Java annotation marked both `@Target({CLASS, CONSTRUCTOR})` gets the constraint `ClassWithConstructorsDeclaration|ConstructorDeclaration`.\r\n\r\nDoes that sound right to you @FroMage and @jvasileff?\r\n\r\nSee https://github.com/ceylon/ceylon-spec/issues/1294 and https://github.com/ceylon/ceylon.language/issues/680.\r\n"},"comment":{"url":"https://api.github.com/repos/ceylon/ceylon-compiler/issues/comments/141068352","html_url":"https://github.com/ceylon/ceylon-compiler/issues/2160#issuecomment-141068352","issue_url":"https://api.github.com/repos/ceylon/ceylon-compiler/issues/2160","id":141068352,"user":{"login":"tombentley","id":879487,"avatar_url":"https://avatars.githubusercontent.com/u/879487?v=3","gravatar_id":"","url":"https://api.github.com/users/tombentley","html_url":"https://github.com/tombentley","followers_url":"https://api.github.com/users/tombentley/followers","following_url":"https://api.github.com/users/tombentley/following{/other_user}","gists_url":"https://api.github.com/users/tombentley/gists{/gist_id}","starred_url":"https://api.github.com/users/tombentley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tombentley/subscriptions","organizations_url":"https://api.github.com/users/tombentley/orgs","repos_url":"https://api.github.com/users/tombentley/repos","events_url":"https://api.github.com/users/tombentley/events{/privacy}","received_events_url":"https://api.github.com/users/tombentley/received_events","type":"User","site_admin":false},"created_at":"2015-09-17T12:40:37Z","updated_at":"2015-09-17T12:40:37Z","body":"> Any Java annotation marked `@Target(METHOD)` but not `@Target(FIELD)` gets the constraint `FunctionDeclaration`.\r\n\r\nI think that should be `FunctionDeclaration|ValueDeclaration` because someone in Javaland might write a constructor which they mean to be applied to getters only (for example). They have to annotate that annotation type with `@Target(METHOD)` because there's no `GETTER` (damn you Java for never making properties into a language level thing!), but then ceylon would prevent you from putting it on the value."}}