>
>
> Fwiw, I think it would work, according to 
> https://github.com/AdoptOpenJDK/openjdk-jdk9/blob/f9129bba032f3b75be9b67f45636f76940e029a6/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java#L70-L73
> (for now, I'm not interested in supporting modules, just making GWT 2 work 
> in a Java 9 VM)
>

Hm.  One would assume that most people using Java 9 are going to be using 
modules, since, AFAIK, you can't access anything but the java.base module 
without requiring said modules (no java.logging, java.sql, java.xml, 
java.xml.bind, or jdk.management allowed).  Not sure how ReflectiveParser 
is going to create ModuleDefs w/out java.xml unless we repackage all of 
org.xml.sax... Though, I suppose we could try it and see if / how it blows 
up?

I mean, reading the java.class.path as a fallback would be ok, but we'd 
still want to prefer classloader scanning for cases where the user is 
launching their gwtc on a thread with a different classloader than the 
system classloader.

Though, I think any solution which requires "never run gwtc with modules 
involved at all" would be pretty poor, considering almost any dependency 
which also uses java 9 will almost assuredly choke and die.
Considering the ugly hack I have does technically work, it doesn't seem 
worth it to limit scope so we can use a less-bad hack.

 

> Another alternative is to go the way of apt and use something akin to 
>> AnnotationMirror... meaning you can't just do MyAnnoClass anno = 
>> member.getAnnotation(MyAnnoClass.class), but will instead be stuck 
>> operating on a generic mirror which can get members by string name.  Not 
>> exactly pretty, but if it's good enough for apt, it can clearly be made to 
>> work (plus, with the impetus to ditch generators, we'd be stuck with it 
>> anyway).
>>
>
> But isn't the whole issue with annotations due to JDT?
>

It is my understanding that we use ASM to load the annotation attributes 
from source classes, and then create a Proxy to load member values / 
classes / enums off the classpath.  JDT is not involved at all (strange 
that it isn't...).  

Really, any solution which exposes actual instances of the annotation class 
are somewhat doomed to have to be able to load those types off the 
classpath.

One solution, not sure it's a good one, would be to generate a 
MyAnnotationMirror type, which still affords type safety and ease of use, 
but exposes classes and enums as objects containing only type / name 
information.  Obviously not going to work w/out a precompilation pass, but 
could work well in combination with other tools to help get generators out 
of gwtc (AKA, not a good solution for right now). 
 

>  
>
>> I (also) have another project which converts AnnotationMirror to a proxy 
>> of MyAnnoClass that can either load a dependent Class/Enum, or fail if that 
>> class is not on classpath (but only fail if you try to access that member).
>>
>
> You mean like 
> https://docs.oracle.com/javase/7/docs/api/javax/lang/model/element/Element.html#getAnnotation(java.lang.Class)
>  ?
> (ok, that one won't load the Class/enum from the classpath, but always 
> throw when accessing members of those types)
>


Precisely that, actually.  Except I catch those exceptions (which contain 
the TypeMirror of the offending type), and then try to recover by loading 
the class (and could make that even better by looking for source and 
compiling on the fly, as needed... requires a dynamic classloader though, 
which can make things... complex.) 

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/18414c9f-6050-44e5-87ef-4eb11299cf57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to