2011-11-03 26 views
0

我正在使用ImmutableCollections編寫代碼。我在我的課程路線中包含了gwt-guava,番石榴和jsr305罐子。我使用ant來編譯和運行測試。我一直從GWT/Junit測試執行階段獲取運行時錯誤。除了堆棧跟蹤本身,ForwardingImmutableCollection的代碼標記如下,這是否表明這將不會工作,直到ForwardingImmutableCollection GWT序列化?GWTTestCase使用Guava 10.0.1失敗 - 棧跟蹤抱怨javax.annotation.Nullable

// TODO:使這個類GWT可序列化。 類ForwardingImmutableCollection擴展ImmutableCollection {

運行時錯誤堆棧跟蹤:

[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) 

回答

0

看起來像你只需要得到JSR305到類路徑:

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