JDK-7108495 : [macosx] JRE 1.7: Introspector.getBeanInfo cannot introspect JSR14 class
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.beans
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: os_x
  • CPU: x86
  • Submitted: 2011-11-04
  • Updated: 2014-03-12
  • Resolved: 2014-03-12
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
MacOS:
openjdk version "1.7.0-ea"
OpenJDK Runtime Environment (build 1.7.0-ea-b215)
OpenJDK 64-Bit Server VM (build 21.0-b17, mixed mode)

Windows version unknown, but latest 1.7 release as of late October 2011

ADDITIONAL OS VERSION INFORMATION :
MacOS, Windows 2003 server

EXTRA RELEVANT SYSTEM CONFIGURATION :
Tested on MacOS X and Windows Server 2003

A DESCRIPTION OF THE PROBLEM :
Our application is normally deployed using Java 6.  We tried deploying using Java 7 and we got the Introspect exception.  I tracked it down to the following case:

rt.jar: JDK 1.7 runtime jar

collections_util.jar: contains MapAdapter.class, built using javac -target jsr14
   abstract class MapAdapter <K,V> implements java.util.Map<K,V>

application.jar: contains ConfigurationBean.class, built using javac -target 1.5
   class ConfigurationBean extends MapAdapter<String, String>

Introspector.getBeanInfo(ConfigurationBean.class) throws java.lang.reflect.MalformedParameterizedTypeException because the "actual type parameters don't match the superclass type parameters", because the type information was erased from MapAdapter when compiled for -target jsr14.

We used -target jsr14 so the collections_util.jar could be utilized in legacy JDK 1.4 applications.  I realize -target jsr14 is not supported, and we have switched our collections_util.jar library away from -target jsr14.  However, this worked fine in Java 6, so I am submitting the bug.

REGRESSION.  Last worked in version 6u29

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Extend a generic class from a JSR14 library JAR.  Try to run Introspector.getBeanInfo on your class.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The classes are valid, they compile and run.  I expect as much JavaBean information as is available.
ACTUAL -
java.lang.reflect.MalformedParameterizedTypeException

ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.reflect.MalformedParameterizedTypeException
   sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(Unknown Source)
   sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.<init>(Unknown Source)
   sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make(Unknown Source)
   sun.reflect.generics.factory.CoreReflectionFactory.makeParameterizedType(Unknown Source)
   sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Unknown Source)
   sun.reflect.generics.tree.ClassTypeSignature.accept(Unknown Source)
   sun.reflect.generics.repository.ClassRepository.getSuperclass(Unknown Source)
   java.lang.Class.getGenericSuperclass(Unknown Source)
   com.sun.beans.TypeResolver.prepare(Unknown Source)
   com.sun.beans.TypeResolver.<init>(Unknown Source)
   com.sun.beans.TypeResolver.resolve(Unknown Source)
   com.sun.beans.TypeResolver.resolveInClass(Unknown Source)
   java.beans.FeatureDescriptor.getParameterTypes(Unknown Source)
   java.beans.MethodDescriptor.setMethod(Unknown Source)
   java.beans.MethodDescriptor.<init>(Unknown Source)
   java.beans.MethodDescriptor.<init>(Unknown Source)
   java.beans.Introspector.getTargetMethodInfo(Unknown Source)
   java.beans.Introspector.getBeanInfo(Unknown Source)
   java.beans.Introspector.getBeanInfo(Unknown Source)
   org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRuntimeLibrary.java:322)
   org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:308)
   org.apache.jsp.category.portlets.Meds_jsp._jspService(Meds_jsp.java:307)
   org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
Do not use -target jsr14 :)

Comments
target jsr14 is not supported
12-03-2014

EVALUATION Looks like a duplicate of 7092744.
09-11-2011