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

Type information is not maintained for parameters on inner classses

    XMLWordPrintable

    Details

      Description

      A DESCRIPTION OF THE PROBLEM :
      Constructor.getParameter().getParameterizedType() returns raw type for inner classes.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run test case

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      java.util.List<?>
      java.util.List<?>
      java.util.List<?>
      java.util.List<?>
      java.util.List<?>
      java.util.List<?>
      ACTUAL -
      java.util.List<?>
      java.util.List<?>
      java.util.List<?>
      interface java.util.List
      java.util.List<?>
      java.util.List<?>


      ---------- BEGIN SOURCE ----------
      public class TestClass {
          class NonStatic {
              List<?> f;

              NonStatic(List<?> l) {}

              public void me(List<?> l) {}
          }

          static class Static {
              List<?> f;

              Static(List<?> l) {}

              public void me(List<?> l) {}
          }

          public static void main(String[] args) {
              System.out.println(Static.class.getDeclaredConstructors()[0].getParameters()[0].getParameterizedType());
              System.out.println(Static.class.getDeclaredFields()[0].getGenericType());
              System.out.println(Static.class.getDeclaredMethods()[0].getParameters()[0].getParameterizedType());
              System.out.println(NonStatic.class.getDeclaredConstructors()[0].getParameters()[1].getParameterizedType());
              System.out.println(NonStatic.class.getDeclaredFields()[0].getGenericType());
              System.out.println(NonStatic.class.getDeclaredMethods()[0].getParameters()[0].getParameterizedType());
          }
      }

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

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              vromero Vicente Arturo Romero Zaldivar
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: