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

infinite recursion while checking super class

    Details

    • Subcomponent:
    • Resolved In Build:
      b05
    • CPU:
      x86_64
    • OS:
      generic

      Backports

        Description

        A DESCRIPTION OF THE PROBLEM :
        The javac compiler goes into an infinite recursion in procedure
             jdk.compiler/com.sun.tools.javac.comp.Check.checkClassBounds
        when compiling the simple example below.



        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Compile the file below.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Error message.
        ACTUAL -
        Error message and then the compiler throws a stack overflow exception.

        CNode.java:5: error: unexpected type
        abstract class ANode<E extends ANode<E>> extends E {
                                                         ^
          required: class
          found: type parameter E
          where E is a type-variable:
            E declared in class ANode
        1 error

        The system is out of resources.
        Consult the following stack trace for details.
        java.lang.StackOverflowError
        at jdk.compiler/com.sun.tools.javac.code.Types$16.visitTypeVar(Types.java:2579)
        at jdk.compiler/com.sun.tools.javac.code.Types$16.visitTypeVar(Types.java:2535)
        at jdk.compiler/com.sun.tools.javac.code.Type$TypeVar.accept(Type.java:1654)
        at jdk.compiler/com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:4937)
        at jdk.compiler/com.sun.tools.javac.code.Types.interfaces(Types.java:2532)
        at jdk.compiler/com.sun.tools.javac.comp.Check.checkClassBounds(Check.java:2717)
        at jdk.compiler/com.sun.tools.javac.comp.Check.checkClassBounds(Check.java:2732)
        at jdk.compiler/com.sun.tools.javac.comp.Check.checkClassBounds(Check.java:2732)
        at jdk.compiler/com.sun.tools.javac.comp.Check.checkClassBounds(Check.java:2732)
        at jdk.compiler/com.sun.tools.javac.comp.Check.checkClassBounds(Check.java:2732)

        ---------- BEGIN SOURCE ----------
        interface Node<E extends Node<E>>
        {
        }

        abstract class ANode<E extends ANode<E>> extends E {
        // On the previous line we can replace "extends E" with "implements E"
        // and the compiler still goes into an infinite recursion.
        }
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        Fix the error.

        FREQUENCY : always


          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: