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

Incorrect substitution of type parameter in generic superclass

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      linux

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_71"
      Java(TM) SE Runtime Environment (build 1.8.0_71-b15)
      Java HotSpot(TM) Server VM (build 25.71-b15, mixed mode)


      A DESCRIPTION OF THE PROBLEM :
      In accordance with JLS 8.1.4, if type parameter name ("A", for example) of some class and other class name are equals then all occurrence "A" in type variable of generic superclass must be interpreted as type variable, not as class. But it is not.

      public class Main {

          public static class A {}

          public static class MyList<A> extends java.util.ArrayList<A> {}
      }

      java 7
      Compiled from "Main.java"
      public class Main$MyList<A> extends java.util.ArrayList<A> {
        public Main$MyList();
      }

      java 8
      Compiled from "Main.java"
      public class Main$MyList<A> extends java.util.ArrayList<Main$A> {
        public Main$MyList();
      }


      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      Just rename type parameter.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: