Software Engineering

GWT 2.1 compilation issues on OSX

Today I experienced a compilation problem with GWT 2.1 and the Maven GWT plugin:

[INFO] Compiling module com.mycompany.platform.crm.ui.gwt.Crm
[INFO]    Validating newly compiled units
[INFO]       [WARN] Warnings in 'jar:file:/Users/myuser/.m2/repository/com/google/gwt/gwt-dev/2.1.0/gwt-dev-2.1.0.jar!/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Cast.java'
[INFO]          [WARN] Line 29: Referencing field 'java.lang.Object.castableTypeMap': unable to resolve field, expect subsequent failures
[INFO]          [WARN] Line 29: Referencing field 'java.lang.Object.castableTypeMap': unable to resolve field, expect subsequent failures
[INFO]          [WARN] Line 38: Referencing field 'java.lang.Object.castableTypeMap': unable to resolve field, expect subsequent failures
[INFO]          [WARN] Line 38: Referencing field 'java.lang.Object.castableTypeMap': unable to resolve field, expect subsequent failures
[INFO]       [WARN] Warnings in 'jar:file:/Users/myuser/.m2/repository/com/google/gwt/gwt-dev/2.1.0/gwt-dev-2.1.0.jar!/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Util.java'
[INFO]          [WARN] Line 27: Referencing field 'java.lang.Object.castableTypeMap': unable to resolve field, expect subsequent failures
[INFO]          [WARN] Line 35: Referencing field 'java.lang.Object.castableTypeMap': unable to resolve field, expect subsequent failures
[INFO]       [WARN] Warnings in 'jar:file:/Users/myuser/.m2/repository/com/google/gwt/gwt-user/2.1.0/gwt-user-2.1.0.jar!/com/google/gwt/emul/java/util/Arrays.java'
[INFO]          [WARN] Line 1348: Referencing method 'com.google.gwt.lang.LongLib.compare([D[D)': unable to resolve method, expect subsequent failures
[INFO]          [WARN] Line 1358: Referencing method 'com.google.gwt.lang.LongLib.compare([D[D)': unable to resolve method, expect subsequent failures
[INFO]    [ERROR] An internal compiler exception occurred
[INFO] com.google.gwt.dev.jjs.InternalCompilerException: Unable to locate index method: GWT.isProdMode
[INFO] 	at com.google.gwt.dev.jjs.ast.JProgram.getIndexedMethod(JProgram.java:824)
[INFO] 	at com.google.gwt.dev.jjs.impl.GenerateJavaAST$JavaASTGenerationVisitor.processType(GenerateJavaAST.java:550)
[INFO] 	at com.google.gwt.dev.jjs.impl.GenerateJavaAST.exec(GenerateJavaAST.java:3147)
[INFO] 	at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:519)
[INFO] 	at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:32)
[INFO] 	at com.google.gwt.dev.Precompile.precompile(Precompile.java:545)
[INFO] 	at com.google.gwt.dev.Precompile.precompile(Precompile.java:466)
[INFO] 	at com.google.gwt.dev.Compiler.run(Compiler.java:205)
[INFO] 	at com.google.gwt.dev.Compiler.run(Compiler.java:177)
[INFO] 	at com.google.gwt.dev.Compiler$1.run(Compiler.java:149)
[INFO] 	at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:87)
[INFO] 	at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:81)
[INFO] 	at com.google.gwt.dev.Compiler.main(Compiler.java:156)
[INFO]       [ERROR] at GWT.java(26): final class GWT extends Object
[INFO]          com.google.gwt.dev.jjs.ast.JClassType

I couldn’t really identify the origin of the problem, but scrapping the whole gwt Maven repository subdirectory and redownloading the 2.1.0 dependencies resolved the issue for me.