Enum.values() not working in GWT throws compilation error

0

I'm using an enum class in my GWT class.I'm using enum.values() in order to iterate through the enum class. this throws error during complilation. the GXT version i'm using is 2.2.5. gwt-dev jar version is 2.4.0

Tried using EnumSet.allOf(DaysOfWeekEnum.class) still getting same error

This article -> https://github.com/gwtproject/gwt/issues/7065 says that it was a bug with gxt. but could not find a fix from it

    for (DaysOfWeekEnum day : DaysOfWeekEnum.values()) { 
        System.out.println(day); 
    }

Getting the below exception:

 [java] Apr 23, 2019 5:27:38 PM java.util.prefs.WindowsPreferences <init>
 [java] WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
 [java] Compiling module com.dashboard_gxt
 [java]    Validating newly compiled units
 [java]       Ignored 9 units with compilation errors in first pass.
 [java] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
 [java]    [ERROR] An internal compiler exception occurred
 [java] com.google.gwt.dev.jjs.InternalCompilerException: Failed to get JNode
 [java]     at com.google.gwt.dev.jjs.impl.TypeMap.get(TypeMap.java:140)
 [java]     at com.google.gwt.dev.jjs.impl.TypeMap.get(TypeMap.java:71)
 [java]     at com.google.gwt.dev.jjs.impl.BuildTypeMap.getType(BuildTypeMap.java:730)
 [java]     at com.google.gwt.dev.jjs.impl.BuildTypeMap.access$000(BuildTypeMap.java:99)
 [java]     at com.google.gwt.dev.jjs.impl.BuildTypeMap$BuildDeclMapVisitor.visit(BuildTypeMap.java:195)
 [java]     at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.traverse(LocalDeclaration.java:237)
 [java]     at org.eclipse.jdt.internal.compiler.ast.ForeachStatement.traverse(ForeachStatement.java:527)
 [java]     at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:239)
 [java]     at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1239)
 [java]     at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:687)
 [java]     at com.google.gwt.dev.jjs.impl.BuildTypeMap.createPeersForNonTypeDecls(BuildTypeMap.java:637)
 [java]     at com.google.gwt.dev.jjs.impl.BuildTypeMap.exec(BuildTypeMap.java:514)
 [java]     at com.google.gwt.dev.jjs.impl.BuildTypeMap.exec(BuildTypeMap.java:523)
 [java]     at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:599)
 [java]     at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:33)
 [java]     at com.google.gwt.dev.Precompile.precompile(Precompile.java:284)
 [java]     at com.google.gwt.dev.Precompile.precompile(Precompile.java:233)
 [java]     at com.google.gwt.dev.Precompile.precompile(Precompile.java:145)
 [java]     at com.google.gwt.dev.Compiler.run(Compiler.java:232)
 [java]     at com.google.gwt.dev.Compiler.run(Compiler.java:198)
 [java]     at com.google.gwt.dev.Compiler$1.run(Compiler.java:170)
 [java]     at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)
 [java]     at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
 [java]     at com.google.gwt.dev.Compiler.main(Compiler.java:177)
 [java]       [ERROR] <no source info>: public final enum com.dashboard.enums.DaysOfWeekEnum
 [java]     extends Enum<com.dashboard.enums.DaysOfWeekEnum>
 [java] /*   fields   */
 [java] public static final [unresolved] com.dashboard.enums.DaysOfWeekEnum Monday
 [java] public static final [unresolved] com.dashboard.enums.DaysOfWeekEnum Tuesday
 [java] public static final [unresolved] com.dashboard.enums.DaysOfWeekEnums Wednesday
 [java] public static final [unresolved] com.dashboard.enums.DaysOfWeekEnum Thursday
 [java] public static final [unresolved] com.dashboard.enums.DaysOfWeekEnum Friday
 [java] public static final [unresolved] com.dashboard.enums.DaysOfWeekEnum Saturday
 [java] public static final [unresolved] com.dashboard.enums.DaysOfWeekEnum Sunday
    com.dashboard.enums.DaysOfWeekEnum[] $VALUES
         [java] /*   methods   */
         [java] [unresolved] private void <init>() 
         [java] [unresolved] public static com.dashboard.enums.DaysOfWeekEnum valueOf(java.lang.String) 
         [java] [unresolved] public static com.dashboard.enums.DaysOfWeekEnum[] values() 
         [java]          org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding
         [java]       [ERROR] at FormPanel.java(104): com.dashboard.enums.DaysOfWeekEnum day;
         [java]          org.eclipse.jdt.internal.compiler.ast.LocalDeclaration
gwt
enums
gxt
asked on Stack Overflow Apr 23, 2019 by Heisenberg

1 Answer

0

Got it fixed by adding the Enum class package under source path="" in gwt.xml.

<source path='myapplication/enums/'/>
answered on Stack Overflow May 21, 2019 by Heisenberg

User contributions licensed under CC BY-SA 3.0