On Sunday, December 3, 2017 at 8:00:29 AM UTC+1, Bob Woodbury wrote: > > I am learning to use jsinterop, and I am stuck at square one -- javac > won't recognize the @JsType annotation. > > I'm using the jdk1.8.0_102 and apache-ant-1.10.1 and gwt-2.8.2 on Linux > (Fedora). > > My project compiles without problems until I try to add "MyClass" with the > @JsType annotation. > > I lifted the following code from the tutorial at: > http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsJsInterop.html > > > package com.webshoz.insight.client.iaol; > > > import jsinterop.annotations.*; // I have tried compiling with and > without this import, without success. > > > @JsType > public class MyClass { > > > public String name; > > > public MyClass(String name) { > this.name = name; > } > > > public void sayHello() { > return "Hello" + this.name; > } > } > > > > The relevant parts of my Ant build file are: > > > <?xml version="1.0" encoding="utf-8" ?> > <project name="Insight" default="build" basedir="."> > > > <path id="project.class.path"> > <pathelement location="war/WEB-INF/classes"/> > <fileset dir="war/WEB-INF/lib" includes="**/*.jar"/> > </path> > > > <target name="javac" description="Compile java source"> > <javac srcdir="src" includes="**" encoding="utf-8" > destdir="war/WEB-INF/classes" > source="1.8" target="1.8" nowarn="false" > includeantruntime="false" > debug="true" debuglevel="lines,vars,source"> > <classpath refid="project.class.path"/> > <compilerarg value="-Xlint:deprecation"/> > <compilerarg value="-Xlint:unchecked"/> > <compilerarg value="-verbose"/> > <compilerarg value="-Xlint"/> > <compilerarg value="-XprintProcessorInfo"/> > </javac> > </target> > > > <target name="gwtc" depends="javac" description="GWT compile to > JavaScript"> > <java failonerror="true" fork="true" classname= > "com.google.gwt.dev.Compiler"> > <classpath> > <pathelement location="src"/> > <path refid="project.class.path"/> > </classpath> > <jvmarg value="-Xmx512M"/> > <arg line="-generateJsInteropExports -strict -XdisableUpdateCheck"/> > <arg value="com.webshoz.insight.Application"/> > <arg value="com.webshoz.insight.Iaol"/> > </java> > </target> > > > </project> > > > The javac compiler puts out the following: > > [javac] Processor com.google.web.bindery.requestfactory.apt.RfValidator > matches [java.lang.Override, jsinterop.annotations.JsType] and returns > false. > [javac] warning: No processor claimed any of these annotations: > jsinterop.annotations.JsType > [javac] [search path for source files: > /house/Dev/Insight/branches/IAOL/src] > > Can anyone tell me what I'm missing? Thanks! >
If you see this message I would believe that it means javac did find the annotation (it's in gwt-user.jar, so how could it not find it?) This warning is inconsequential, of the kind that you would always silence because it's a false positive 99% of the time. So, what's missing? Well, I'd say <compilerarg value="-Xlint:-processing"/> Does compilation fail after that? Or were you only worried by the warning? -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
