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

Introspector ignores default interface methods

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u25, 9
    • Fix Version/s: tbd
    • Component/s: client-libs
    • Labels:

      Description

      FULL PRODUCT VERSION :
      JDK 1.8.0 Update 25

      ADDITIONAL OS VERSION INFORMATION :
      Windows 8.1 Pro 64 Bit

      A DESCRIPTION OF THE PROBLEM :
      When retrieving the properties from a bean the java.beans.Introspector does not return the properties defined by getter/setter methods implemented as default methods in an interface implemented by the bean.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Implement a default getter method in an interface. Create a class that implements the interface but does not override the default method. Now use Introspector.getBeanInfo(beanClass) to get the properties.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The result should contain the properties defined by the default methods in the interface.
      ACTUAL -
      The result does not contain the properties defined by the default methods in the interface.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.beans.IntrospectionException;
      import java.beans.Introspector;
      import java.beans.PropertyDescriptor;

      public class Test {

      public static interface Named {
      public default String getName() {
      return "always the same";
      }
      }

      public static class NamedBean implements Named {
      }

      public static void main(final String[] args) throws IntrospectionException {
      for (final PropertyDescriptor desc : Introspector.getBeanInfo(NamedBean.class).getPropertyDescriptors()) {
      System.out.println(desc.getName());
      }
      // prints out "class" as the only property
      // should have inclided "name" too
      }
      }
      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated: