Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT 2.7.0 Compile fails [ERROR] Unable to find class java/lang/Object

Tags:

gwt-2.7

I have a project that builds in 2.6.1 and fails to build in 2.7.0. I have hunted the internet for a good answer but I could find none.

Here is the output from the Maven build:

... Uninteresting Stuff removed

[INFO] Compiling module XXXX
[INFO]    Looking for precompiled archives.  To disable, use -Dgwt.usearchives=false
[INFO]    Loading archived module: jar:file:/C:/Users/3433/.m2/repository/com/google/gwt/gwt-user/2.7.0/gwt-user-2.7.0.jar!/com/google/gwt/core/Core.gwtar

...

[INFO]    Compiling...
[INFO]       Compilation completed in 5,95 seconds
[INFO]    Invalid Unit: com.google.gwt.validation.client.impl.BaseGwtConfiguration
[INFO]    Invalid Unit: com.google.gwt.validation.client.spi.GwtValidationProvider

... other Invalid Units removed

[INFO]    Invalid Unit: com.google.gwt.validation.client.spi.BaseConfigurationState
[INFO]    Invalid Unit: java.lang.String
[INFO]    Invalid units found: 11
[INFO]    Compiling...
[INFO]       Compilation completed in 0,04 seconds
[INFO]    Added 3762 units to cache since last cleanup.
[INFO]    Tracing compile failure path for type 'java.lang.String'
[INFO]       Errors in 'jar:file:/C:/Users/3433/.m2/repository/com/google/gwt/gwt-user/2.7.0/gwt-user-2.7.0.jar!/com/google/gwt/emul/java/lang/String.java'
[INFO]          Line 976: The method getDefault() is undefined for the type Locale
[INFO]    Removing invalidated units
[INFO] Wrote 3762 units to persistent cache.
[INFO]    Resolving java.util.Locale
[INFO]       Found type 'java.util.Locale'
[INFO]          [WARN] Unable to resolve supertype java/lang/Object

Many errors removed...

[INFO]    Resolving com.google.gwt.core.client.AsyncProvider
[INFO]       Found type 'com.google.gwt.core.client.AsyncProvider'
[INFO]          [ERROR] Unable to find class java/lang/Object

[INFO]          Resolving method get
[INFO]             Found type 'com.google.gwt.core.client.Callback'
[INFO]                [ERROR] Unable to find class java/lang/Object

Hundreds of similar errors removed

[INFO]    Tracing compile failure path for type 'java.lang.Object'
[INFO]       [ERROR] Errors in 'file:/usr/local/google/home/dankurka/gwt/user/super/com/google/gwt/emul/java/lang/Object.java'
[INFO]          [ERROR] java.lang.String cannot be resolved to a type

What is Dan Kurka's home path doing in my build?

Any ideas?

like image 265
Mark Miller Avatar asked Oct 31 '22 05:10

Mark Miller


1 Answers

I know this is an old post, but I recently had the same problem, so I thought I would post my findings.

In my case, I was moving from GWT 2.5.1 to 2.7.0. We had a java.util.Locale class in our code so that the GWT compiler had all the source that it required for emulation, and it didn't match the structure of the same class in GWT 2.7.0. I had to add the missing methods, and it was fine after that.

To find the cause, I had to recompile with the -Dgwt.logLevel=DEBUG parameter. Without that set, the root cause of my problem was hidden. When I compiled with the log level set, I was able to see the what the problem was:

[INFO]    Compiling...
[INFO]       30% complete (ETR: 9 seconds)
[INFO]       30% complete (ETR: 9 seconds)
[INFO]       30% complete (ETR: 9 seconds)
[INFO]       30% complete (ETR: 9 seconds)
[INFO]       40% complete (ETR: 8 seconds)
[INFO]       50% complete (ETR: 6 seconds)
[INFO]       60% complete (ETR: 4 seconds)
[INFO]       70% complete (ETR: 3 seconds)
[INFO]       80% complete (ETR: 2 seconds)
[INFO]       90% complete (ETR: 1 seconds)
[INFO]       100% complete (ETR: 0 seconds)
[INFO]       Compilation completed in 11.10 seconds
[INFO]    java.util.Locale isn't structurally same.
[INFO]    Invalid Unit: java.lang.String
[INFO]    Invalid units found: 1
[INFO]    Compiling...
[INFO]       Compilation completed in 0.02 seconds
[INFO]    Added 5097 units to cache since last cleanup.
[INFO]    Tracing compile failure path for type 'java.lang.String'
[INFO]       Errors in 'jar:file:/Users/randymay/.m2/repository/com/google/gwt/gwt-user/2.7.0/gwt-user-2.7.0.jar!/com/google/gwt/emul/java/lang/String.java'
[INFO]          Line 991: The method getDefault() is undefined for the type Locale
[INFO]          Line 976: The method getDefault() is undefined for the type Locale
[INFO]       Checked 1 dependencies for errors.
like image 186
randymay Avatar answered Dec 20 '22 03:12

randymay