remove annotation in gwt compiler process ?

291 views
Skip to first unread message

Marian S

unread,
Aug 28, 2016, 6:45:22 PM8/28/16
to GWT Users
Hi, 

Im write a annotation processor for  shared package and need remove this in gwt compilation process ?
Im try with "super source"  but I take only error  ......  ( have maybe someone example project for "super source " ?) 
e.g. expected package not the same like .........
Im using gwt 2.8 from eclipse !
For moment I comment this for compilation but this is not really solution ! I miss preprocessor like in C or C++ ....

Have someone a ideea ? or solution better as my ?

Greeting
Marian


JonL

unread,
Aug 29, 2016, 10:28:16 AM8/29/16
to GWT Users
If you need to specify specific annotation processors, or mess with the annotation processors that are on the path, these two javac options might help you:

-processor class1[,class2,class3...]
Names of the annotation processors to run. This bypasses the default discovery process.
-processorpath path
Specify where to find annotation processors; if this option is not used, the class path will be searched for processors.

https://docs.oracle.com/javase/7/docs/technotes/tools/solaris/javac.html

Thomas Broyer

unread,
Aug 29, 2016, 12:00:51 PM8/29/16
to GWT Users
GWT does not run annotation processors; so what exactly do you need to "remove" from "what"?
Do you need GWT to ignore the sources that your processor generated? Then you can:
  • avoid writing the sources to disk (do not pass the -d argument to JavaC)
  • avoid passing the generated sources destination directory to GWT on the classpath
  • annotate the generated code with @GwtIncompatible where appropriate (only the annotation "simple name" matters, whichever the package it's in; GWT provides com.google.gwt.core.shared.GwtIncompatible)

Marian S

unread,
Aug 29, 2016, 1:39:54 PM8/29/16
to GWT Users
Hi, thanks for you answer.

I want "remove" annotation  or override with dummy annotation for gwt compilation !
I have a Object with @myannotation in shared folder for server and client ( need to known on both sides ...) 

like:
import myprocessor.annotation

@MyAnnotation
class TestPerson {
blaa....
}

for GWT compilation need this "import" and @MyAnnotation to "ignore" or override with dummy annotation !
I think solution is define dummy @MyAnnotation for gwt process ?
I hope now is more clearly !

Thanks, Marian

Thomas Broyer

unread,
Aug 29, 2016, 2:01:44 PM8/29/16
to GWT Users
I can't see any reason to do that. In case you'd really need to do that, you could use a different classpath, like with any Java application/compilation (note that super-sources won't work, as annotations are -partially- loaded from bytecode, not only source code). Details will depend on how you build your project.

Ignacio Baca Moreno-Torres

unread,
Aug 29, 2016, 2:59:53 PM8/29/16
to GWT Users
If your problem is that the annotations is making your GWT module compilation fail, maybe you should try to add your annotations to the GWT compilation so you don't need to "remove them". Substituting an annotation with an dummy annotation makes no senses at all XD, are more or less "value classes", is like substituting a string with a dummy string... but, sometimes the class might has dependencies to a enums or a Class<T> where the enum or the T is incompatible, in this situation just add a super source with the dummy annotation (pretty weird) or a GwtIncompatible in the annotation or annotation method. Frequently you just need to create a GWT module pointing to the annotation package, for example, we did that for jackson adding a module like this:

file://src/com/fasterxml/jackson/annotation/Jackson.gwt.xml
<module>
<source path="">
<exclude name="**/JsonAutoDetect*"/>
<exclude name="**/JsonFormat*"/>
<exclude name="**/JsonIdentityInfo*"/>
<exclude name="**/*ObjectId*"/>
</source> </module> 

On Mon, Aug 29, 2016 at 8:01 PM Thomas Broyer <t.br...@gmail.com> wrote:
I can't see any reason to do that. In case you'd really need to do that, you could use a different classpath, like with any Java application/compilation (note that super-sources won't work, as annotations are -partially- loaded from bytecode, not only source code). Details will depend on how you build your project.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages