[ https://issues.apache.org/jira/browse/GROOVY-7793?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pascal Schumacher resolved GROOVY-7793. --------------------------------------- Resolution: Fixed Assignee: Pascal Schumacher Fix Version/s: 2.4.7 Pull request merged. Thanks! > Compiler compiles class with private abstract method > ---------------------------------------------------- > > Key: GROOVY-7793 > URL: https://issues.apache.org/jira/browse/GROOVY-7793 > Project: Groovy > Issue Type: Bug > Components: bytecode, Compiler > Affects Versions: 2.3.11 > Environment: - OS X > - Java(TM) SE Runtime Environment (build 1.8.0_66-b17) > - IntelliJ Idea 14 CE \w Groovy plugin > - Gradle 2.2 > Reporter: Simo Tuokko > Assignee: Pascal Schumacher > Fix For: 2.4.7 > > > Using Groovy and JDBI in following class: > {code:title=ItemDAO.groovy|borderStyle=solid} > abstract class ItemDAO { > @SqlUpdate("...") > @GetGeneratedKeys > private abstract long insertItem(@BindBean Item item) > } > {code} > 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) -- This message was sent by Atlassian JIRA (v6.3.4#6332)