GMaven
  1. GMaven
  2. GMAVEN-71

Generated Java stubs miss import for class BigDecimal (-> javac compile error)

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3
    • Component/s: None
    • Labels:
      None
    • Environment:
      GMaven 1.2
      Groovy 1.7.1
    • Number of attachments :
      0

      Description

      Try to joint-compile the following Groovy code:

      class JointCompilation {
        BigDecimal foo
      }
      

      Compilation of the generated Java stub fails with:

      /testprj/target/generated-sources/groovy-stubs/JointCompilation.java:[20,8] cannot find symbol
      symbol  : class BigDecimal
      location: class JointCompilation
      

      Here is the generated Java stub:

      import groovy.util.*;
      import java.lang.*;
      import groovy.lang.*;
      import java.util.*;
      import java.io.*;
      import java.net.*;
      
      public class JointCompilation
        extends java.lang.Object  implements
          groovy.lang.GroovyObject {
      public JointCompilation
      () {}
      public  groovy.lang.MetaClass getMetaClass() { return (groovy.lang.MetaClass)null;}
      public  void setMetaClass(groovy.lang.MetaClass mc) { }
      public  java.lang.Object invokeMethod(java.lang.String method, java.lang.Object arguments) { return null;}
      public  java.lang.Object getProperty(java.lang.String property) { return null;}
      public  void setProperty(java.lang.String property, java.lang.Object value) { }
      public  BigDecimal getProp() { return (BigDecimal)null;}
      public  void setProp(BigDecimal value) { }
      protected  groovy.lang.MetaClass $getStaticMetaClass() { return (groovy.lang.MetaClass)null;}
      }
      

      As you can see, an import for java.math.BigDecimal is missing. Strangely, I can't reproduce this bug with plain groovyc (although to my knowledge GMaven uses groovyc's stub generation by now).

        Activity

        Hide
        Peter Niederwieser added a comment -

        same for BigInteger

        Show
        Peter Niederwieser added a comment - same for BigInteger
        Hide
        Peter Niederwieser added a comment -

        Correction: The generated stub code I posted is for a JointCompilation class whose property is named "prop" rather than "foo" (but it doesn't matter).

        Show
        Peter Niederwieser added a comment - Correction: The generated stub code I posted is for a JointCompilation class whose property is named "prop" rather than "foo" (but it doesn't matter).
        Hide
        Andreas Hartmann-Schneevoigt added a comment - - edited

        i switched gmaven to use

        <providerSelection>1.7</providerSelection>

        and changed the corresponing configuration taken from http://btilford.blogspot.com/2010/02/groovy-170-and-gmaven-12-multi-module.html
        i got also compile errors:

        [ERROR] /home/andreas/Workspaces/Eclipse3.5_Java_EE/TOPAS/topas-server/target/generated-sources/groovy-stubs/main/com/topas/server/core/util/ZipUtils.java:[22,47] cannot find symbol
        symbol  : class File
        location: class com.topas.server.core.util.ZipUtils
        
        [ERROR] /home/andreas/Workspaces/Eclipse3.5_Java_EE/TOPAS/topas-server/target/generated-sources/groovy-stubs/main/com/topas/server/core/util/ZipUtils.java:[22,61] cannot find symbol
        symbol  : class FilenameFilter
        location: class com.topas.server.core.util.ZipUtils
        

        Looking at the generated Stubs, i found that there were no import rendered except those that are dircetly declared in the groovy class.

        – boring

        Environment: java 1.6; gmaven1.2; groovy 1.7.3

        what's wrong with gmaven's stub generation?
        under eclipse using the maven-eclipse-plugin, everything is working fine.

        Show
        Andreas Hartmann-Schneevoigt added a comment - - edited i switched gmaven to use <providerSelection>1.7</providerSelection> and changed the corresponing configuration taken from http://btilford.blogspot.com/2010/02/groovy-170-and-gmaven-12-multi-module.html i got also compile errors: [ERROR] /home/andreas/Workspaces/Eclipse3.5_Java_EE/TOPAS/topas-server/target/generated-sources/groovy-stubs/main/com/topas/server/core/util/ZipUtils.java:[22,47] cannot find symbol symbol : class File location: class com.topas.server.core.util.ZipUtils [ERROR] /home/andreas/Workspaces/Eclipse3.5_Java_EE/TOPAS/topas-server/target/generated-sources/groovy-stubs/main/com/topas/server/core/util/ZipUtils.java:[22,61] cannot find symbol symbol : class FilenameFilter location: class com.topas.server.core.util.ZipUtils Looking at the generated Stubs, i found that there were no import rendered except those that are dircetly declared in the groovy class. – boring Environment: java 1.6; gmaven1.2; groovy 1.7.3 what's wrong with gmaven's stub generation? under eclipse using the maven-eclipse-plugin, everything is working fine.
        Hide
        Andreas Hartmann-Schneevoigt added a comment -

        If i switch to groovy 1.7.2 the imports were generated in the form of wildcards (see below)

        import groovy.util.*;
        import java.lang.*;
        import java.util.zip.*;
        import groovy.lang.*;
        import java.util.*;
        import java.io.*;
        import java.net.*;

        this leads than to problems in resolving the right class.

        reference to List is ambiguous, both class java.util.List in java.util and class org.hibernate.mapping.List in org.hibernate.mapping match
        Show
        Andreas Hartmann-Schneevoigt added a comment - If i switch to groovy 1.7.2 the imports were generated in the form of wildcards (see below) import groovy.util.*; import java.lang.*; import java.util.zip.*; import groovy.lang.*; import java.util.*; import java.io.*; import java.net.*; this leads than to problems in resolving the right class. reference to List is ambiguous, both class java.util.List in java.util and class org.hibernate.mapping.List in org.hibernate.mapping match
        Hide
        Jason Dillon added a comment -

        Honestly I have no idea what has been changed to break this...

        Show
        Jason Dillon added a comment - Honestly I have no idea what has been changed to break this...
        Hide
        Peter Niederwieser added a comment -

        Jason, is the bug described by Andreas fixed by now, or should I open a new issue for it?

        Show
        Peter Niederwieser added a comment - Jason, is the bug described by Andreas fixed by now, or should I open a new issue for it?

          People

          • Assignee:
            Unassigned
            Reporter:
            Peter Niederwieser
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: