Project: clover
Issue CLOV-1779: Groovy code with Generics throw NPEs
Starting with Clover version 4.0.1 when running JUnit tests against clover instrumented code I am getting a null pointer exception when attempting to call this method: {code:java} // in DateUtil.groovy static T copy(T date) { (T) date?.clone() } {code} It seems like something has changed with the instrumentation. Either of these two other variations of this same code *doesn't* have this problem: {code:java} static Date copy(Date date) { date?.clone() } static def copy(def date) { date?.clone() } {code} Here's the top of the stacktrace: {noformat} java.lang.NullPointerException com.sun.beans.TypeResolver.resolve(TypeResolver.java:203) com.sun.beans.TypeResolver.resolve(TypeResolver.java:218) com.sun.beans.TypeResolver.resolveInClass(TypeResolver.java:96) java.beans.FeatureDescriptor.getParameterTypes(FeatureDescriptor.java:387) java.beans.MethodDescriptor.setMethod(MethodDescriptor.java:116) java.beans.MethodDescriptor.(MethodDescriptor.java:72) java.beans.MethodDescriptor.(MethodDescriptor.java:56) java.beans.Introspector.getTargetMethodInfo(Introspector.java:1205) java.beans.Introspector.getBeanInfo(Introspector.java:426) java.beans.Introspector.getBeanInfo(Introspector.java:173) groovy.lang.MetaClassImpl$15.run(MetaClassImpl.java:3244) java.security.AccessController.doPrivileged(Native Method) groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:3242) groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3225) org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:222) org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:253) org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:255) org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:859) org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallStaticSite(CallSiteArray.java:72) org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:159) org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) com.surescripts.common.DateUtilTest.clone_NonNullValue(DateUtilTest.groovy:16) {noformat}
Story points: 3