Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-269

parameters of boolean type to methods were not generated correctly in bytecode

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-4
    • 1.0-beta-5
    • class generator
    • None
    • xp

    Description

      class Bean {
      String propA
      boolean propB
      }

      Bean a = new Bean(propA:"Montag", propB:false)

      The above script won't run with
      java.lang.NoClassDefFoundError: groovy/lang/GroovyObject
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
      ...

      The problem was caused by a missing branch to deal with boolean type in the following method in the BytecodeHelper class.

      public String getObjectTypeForPrimitive(String type) {
      if (type.equals("byte"))

      { return Byte.class.getName(); }

      else if (type.equals("char"))

      { return Character.class.getName(); }

      else if (type.equals("short"))

      { return Short.class.getName(); }

      else if (type.equals("int"))

      { return Integer.class.getName(); }

      else if (type.equals("long"))

      { return Long.class.getName(); }

      else if (type.equals("float"))

      { return Float.class.getName(); }

      else if (type.equals("double"))

      { return Double.class.getName(); }

      else if (type.equals("boolean"))

      { // this branch was missing return Boolean.class.getName(); }

      else

      { return null; }

      }

      Attachments

        Activity

          People

            jstrachan James Strachan
            bingran Bing Ran
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 10m
                10m
                Remaining:
                Remaining Estimate - 10m
                10m
                Logged:
                Time Spent - Not Specified
                Not Specified