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

Compiler compiles class with private abstract method

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.11
    • Fix Version/s: 2.4.7
    • Component/s: bytecode, Compiler
    • Labels:
      None
    • Environment:
      - OS X
      - Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
      - IntelliJ Idea 14 CE \w Groovy plugin
      - Gradle 2.2

      Description

      Using Groovy and JDBI in following class:

      ItemDAO.groovy
      abstract class ItemDAO {
          @SqlUpdate("...")
          @GetGeneratedKeys
          private abstract long insertItem(@BindBean Item item)
      }
      

      When class is used JDBI will create proxy-implementation based on the the abstract class (or interface).

      It will compile without any issues, but running it causes (shown below) class-loading/verify error. This is programmers fault to have "private abstract" methods, but I guess Groovy-compiler should not let this thru? Maybe IntelliJ Idea groovy-plugin should say it's illegal as well?

      I haven't tried this with the latest Groovy-version but unless it has been specifically fixed it might still occur?

      Exception in thread "main" java.lang.ClassFormatError: Method insertDish in class com/company/ItemDAO has illegal modifiers: 0x402
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
      at java.lang.Class.getDeclaredMethods(Class.java:1975)
      at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:85)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:82)
      at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:80)
      at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
      at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
      at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:251)
      at groovy.lang.MetaClassImpl.populateMethods(MetaClassImpl.java:390)
      at groovy.lang.MetaClassImpl.fillMethodIndex(MetaClassImpl.java:340)
      at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3224)
      at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:222)
      at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:253)
      at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:255)
      at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:859)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:84)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:194)

        Attachments

          Activity

            People

            • Assignee:
              pascalschumacher Pascal Schumacher
              Reporter:
              situokko Simo Tuokko
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: