Sunday, December 3, 2017

Re: JsInterop: annotations not found

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:

package com.webshoz.insight.client.iaol;

import jsinterop.annotations.*;  // I have tried compiling with and without this import, without success.

public class MyClass {

public String name;

public MyClass(String name) { = name;

public void sayHello() {
return "Hello" +;

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"/>

<target name="javac" description="Compile java source">
<javac srcdir="src" includes="**" encoding="utf-8"
source="1.8" target="1.8" nowarn="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"/>

<target name="gwtc" depends="javac" description="GWT compile to JavaScript">
<java failonerror="true" fork="true" classname="">
<pathelement location="src"/>
<path refid="project.class.path"/>
<jvmarg value="-Xmx512M"/>
<arg line="-generateJsInteropExports -strict -XdisableUpdateCheck"/>
<arg value="com.webshoz.insight.Application"/>
<arg value="com.webshoz.insight.Iaol"/>


The javac compiler puts out the following:

[javac] Processor 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
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment