Open CeylonMigrationBot opened 9 years ago
[@FroMage] Isn't that a duplicate of #2109? Reopen if not, but it looks that way to me.
[@jvasileff] If I understand correctly, the other one is for synthetic Ceylon annotation classes for Java annotations, whereas this is for generated Java annotations for real Ceylon annotation classes (so, not a dup).
[@FroMage] Mmm, but why do you need to differentiate CeylonAnnotation
from CeylonAnnotation_class
then? Presumably they're the same class, no?
[@jvasileff] Well, it's that when a Ceylon annotation class is compiled, there are two outputs: the class, and a Java annotation. I'd like to use the Java annotation in Ceylon code, to, for instance, satisfy http://docs.oracle.com/javaee/7/api/javax/validation/ConstraintValidator.html in Ceylon.
[@FroMage] Aw damn, right, but I guess this goes against the reasonable expectation that CeylonAnnotation
would be a java.lang.Annotation
… OK, so it's about the same thing as #2109 but for Ceylon annotations as well as Java annotations. It is indeed slightly different because for Ceylon annotations we can't fake it (I think) the same way we do for Java annotations and the typechecker will have to learn about them, right @tombentley?
[@tombentley] This is indeed not really a dupe of #2109.
While using a static member interface would be tidier and nicer when interacting with the Ceylon annotation from Java it doesn't actually help us with this problem, which requires a way to denote the annotation type which by design isn't exposed to Ceylon code.
I can't think of a way of making this work with any kind of sane interop. Literally the only thing I can think of is to say you have to write CObjectValidator
in Java.
Any thoughts @gavinking?
[@FroMage] Well, we could let you access it the same way we let you access the Java annotation type, no?
[@tombentley] Well, sure we could give it a denotable name and you could import it and use it, I suppose. But:
Basically it would be a departure from the annotations we have today.
[@gavinking] Call it _Annotation
and reference it as \I_Annotation
? ;-)
[@tombentley] Well fine I can do that. But it will break compatibility with 1.1. Are we still trying to keep compatibility?
[@gavinking] So I now agree that this is a shit problem. To solve this, java.lang.annotation.Annotation
must necessarily leak into the Ceylon view of the compiled Ceylon module. That's awful.
[@gavinking] It seems to me that, whatever the solution to this issue is, it's not for 1.2.
[@luolong] Forgive me if this is a stupid question, but isn't this a Java interop issue?
[@FroMage] I fixed #2109 and I think that unless we make the annotation type official as a triplet of annotation declarations, we can't fix this issue. I moved it to 1.3, sorry.
[@jvasileff] Java annotations generated by Ceylon are of the form
AnnotationClass$annotation$
, making them inaccessible from Ceylon code.This was originally discussed on the dev mailing list.
@tombentley noted:
@lucaswerkmeister suggested:
[Migrated from ceylon/ceylon-compiler#2121]