Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6528714

Introspector uses interface signature in property descriptor

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 6
    • Fix Version/s: 7
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b15
    • CPU:
      x86
    • OS:
      windows_xp
    • Verification:
      Verified

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0"
      Java(TM) SE Runtime Environment (build 1.6.0-b105)
      Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      I have a generic interface that defines a getter method that uses the generic type.

      When I Introspect a a class that implements this method, the Propertydescriptor for the method claims that the property type is Object when it should return the actual type declared in the class.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and run the test case:

      javac NameBean.java
      java NamedBean


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I expected to see:
      Property class: class java.lang.Class
      Property name: class java.lang.String

      Which is what I get if I compile and run using :
      java version "1.5.0_06"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
      Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
      ACTUAL -
      What I get is:
      Property class: class java.lang.Class
      Property name: class java.lang.Object

      I also get the same result when I run this with the latest build:
      java version "1.6.0_01-ea"
      Java(TM) SE Runtime Environment (build 1.6.0_01-ea-b03)
      Java HotSpot(TM) Client VM (build 1.6.0_01-ea-b03, mixed mode)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Named.java:

      public interface Named<T> {

        public T getName();

      }

      NamedBean.java:
      import java.beans.*;

      class NamedBean implements Named<String> {
        private String myName;

        public String getName() {
           return myName;
        }

        public void setName(String name) {
           myName = name;
        }

        public static void main(String[] args) throws Exception {
          BeanInfo bi = Introspector.getBeanInfo(NamedBean.class);
          for (PropertyDescriptor d: bi.getPropertyDescriptors()) {
            System.out.println("Property "+d.getName()+": "+d.getPropertyType());
          }
        }

      }


      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              malenkov Sergey Malenkov (Inactive)
              Reporter:
              ryeung Roger Yeung (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: