GWTTestCase fails with Guava 10.0.1 - stack traces complain about javax.annotation.Nullable

438 views Asked by At

I'm writing code using ImmutableCollections. I've included gwt-guava, guava and jsr305 jars in my classpath. I'm using ant to compile and run the tests. I consistently get run time errors from the GWT/Junit test execution phase. Besides the stack trace itself, the code for ForwardingImmutableCollection is marked as follows, does this indicate that this won't work until ForwardingImmutableCollection is made GWT serializable?

// TODO: Make this class GWT serializable. class ForwardingImmutableCollection extends ImmutableCollection {

Runtime error stack trace:

[junit] ------------- Standard Output ---------------
[junit] 0    [main] INFO  {gwt-log} () - database file path is /Users/glick/alpp-sqlite.db
[junit] 371  [main] INFO  {gwt-log} () - ProtocolServiceImpl.init
[junit] 371  [main] WARN  {gwt-log} () - This is a 'WARN' test message in ProtocolServiceImpl.init
[junit] 371  [main] ERROR {gwt-log} () - This is a 'ERROR' test message in ProtocolServiceImpl.init
[junit] 371  [main] FATAL {gwt-log} () - This is a 'FATAL' test message ProtocolServiceImpl.init
[junit] 1250 [main] ERROR {gwt-log} () - an UNKNOWN USER was encountered with userId "0"
[junit] 1751 [main] ERROR {gwt-log} () - an UNKNOWN USER was encountered with userId "11"
[junit] 1754 [main] ERROR {gwt-log} () - an UNKNOWN USER was encountered with userId "11"
[junit] 1764 [main] ERROR {gwt-log} () - an UNKNOWN USER was encountered with userId "11"
[junit] logging for HtmlUnit thread
[junit]    [WARN] Expected content type of 'application/javascript' or 'application/ecmascript' for remotely loaded JavaScript element at 'http://192.168.1.13:52522/com.abacalab.alpp.ALPP.JUnit/com.abacalab.alpp.ALPP.JUnit.nocache.js', but got 'application/x-javascript'.
[junit] [ERROR] Errors in 'jar:file:/m2-repo/com/google/guava/guava-gwt/10.0.1/guava-gwt-10.0.1.jar!/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableCollection.java'
[junit]    [ERROR] Line 21: The import javax.annotation.Nullable cannot be resolved
[junit]    [ERROR] Line 42: Nullable cannot be resolved to a type
[junit] [ERROR] Errors in 'jar:file:/m2-repo/com/google/guava/guava-gwt/10.0.1/guava-gwt-10.0.1.jar!/com/google/common/collect/super/com/google/common/collect/ImmutableCollection.java'
[junit]    [ERROR] Line 25: The import javax.annotation.Nullable cannot be resolved
[junit]    [ERROR] Line 67: Nullable cannot be resolved to a type
[junit] ------------- ---------------- ---------------
[junit] Testcase: testStub(com.abacalab.alpp.client.GwtRpcStubTest):    Caused an ERROR
[junit] Remote test failed at 192.168.1.13 / Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.19) Gecko/2010031422 Firefox/3.0.19
[junit] java.lang.RuntimeException: Remote test failed at 192.168.1.13 / Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.19) Gecko/2010031422 Firefox/3.0.19
[junit]     at com.google.gwt.junit.JUnitShell.processTestResult(JUnitShell.java:1288)
[junit]     at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1408)
[junit]     at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1309)
[junit]     at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:653)
[junit]     at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:441)
[junit]     at com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:296)
[junit] Caused by: java.lang.Error: Unresolved compilation problems: 
[junit]     The import javax.annotation.Nullable cannot be resolved
[junit]     Nullable cannot be resolved to a type
[junit] 
[junit]     at com.google.common.collect.ForwardingImmutableCollection.<init>(ForwardingImmutableCollection.java:21)
[junit]     at com.google.common.collect.ImmutableSet.<init>(ImmutableSet.java:44)
[junit]     at com.google.common.collect.ImmutableSet.<init>(ImmutableSet.java:48)
[junit]     at com.google.common.collect.EmptyImmutableSet.<init>(EmptyImmutableSet.java:24)
[junit]     at com.google.common.collect.EmptyImmutableSet.<clinit>(EmptyImmutableSet.java:26)
[junit]     at com.google.common.collect.ImmutableSet.of(ImmutableSet.java:54)
[junit]     at com.google.common.collect.ImmutableSet.copyOf(ImmutableSet.java:125)
[junit]     at com.google.common.collect.ImmutableSet.copyOf(ImmutableSet.java:120)
[junit]     at com.google.common.collect.ImmutableSet.copyOf(ImmutableSet.java:110)
[junit]     at com.abacalab.alpp.shared.ConcretePrivilegeSetProvider.getPrivilegeSet(ConcretePrivilegeSetProvider.java:88)
1

There are 1 answers

0
fry On

Looks like you just need to get jsr305 into your classpath:

Caused by: java.lang.Error: Unresolved compilation problems: 
[junit]     The import javax.annotation.Nullable cannot be resolved
[junit]     Nullable cannot be resolved to a type