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

Groovy is producing incorrect generic type signatures for getters that are created by closures with JDK7

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Incomplete
    • 1.8.6, 1.8.9
    • None
    • Compiler
    • JDK7 (Java SE 7u17)

    Description

      The same problem that was http://jira.codehaus.org/browse/GROOVY-5034 still exists with JDK7.
      The code

          private <T> List<T> getFilterablesForScreen(Collection<PriorityWrapper<T>> sourceSet, Class<? extends IUIScreen> screenClass) {
              sourceSet?.each { PriorityWrapper<T> wrapper ->
                      def wrappedObj = wrapper.content
                      ...
              }
              ...
          }

      throws java.lang.NullPointerException at

      sourceSet?.each { PriorityWrapper<T> wrapper ->

      execution:

      java.lang.NullPointerException
      	at com.sun.beans.TypeResolver.resolve(TypeResolver.java:332)
      	at com.sun.beans.TypeResolver.resolve(TypeResolver.java:362)
      	at com.sun.beans.TypeResolver.resolve(TypeResolver.java:321)
      	at com.sun.beans.TypeResolver.resolve(TypeResolver.java:362)
      	at com.sun.beans.TypeResolver.resolve(TypeResolver.java:172)
      	at com.sun.beans.TypeResolver.resolveInClass(TypeResolver.java:93)
      	at java.beans.FeatureDescriptor.getParameterTypes(FeatureDescriptor.java:387)
      	at java.beans.MethodDescriptor.setMethod(MethodDescriptor.java:114)
      	at java.beans.MethodDescriptor.<init>(MethodDescriptor.java:72)
      	at java.beans.MethodDescriptor.<init>(MethodDescriptor.java:56)
      	at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1130)
      	at java.beans.Introspector.getBeanInfo(Introspector.java:414)
      	at java.beans.Introspector.getBeanInfo(Introspector.java:161)
      	at groovy.lang.MetaClassImpl$15.run(MetaClassImpl.java:2956)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:2954)
      	at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:2937)
      	at groovy.lang.ExpandoMetaClass.initialize(ExpandoMetaClass.java:479)
      	at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:166)
      	at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:182)
      	at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:227)
      	at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:751)
      	at groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:32)
      	at groovy.lang.Closure.<init>(Closure.java:224)
      	at com.devexperts.auto.common.ui.nav.BasicUINavigator$_getFilterablesForScreen_closure2.<init>(BasicUINavigator.groovy)

      while

          private <T> List<T> getFilterablesForScreen(Collection<PriorityWrapper<T>> sourceSet, Class<? extends IUIScreen> screenClass) {
              for (PriorityWrapper<T> wrapper: sourceSet){
                      def wrappedObj = wrapper.content
                      ...
              }
              ...
          }

      works properly.

      The issue is reproduced only with JDK7 and is not with JDK6.

      Attachments

        Activity

          People

            Unassigned Unassigned
            aufklaerung Mikhail Vaschinsky
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: