United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-7079713 : javac hangs when compiling a class that references a cyclically inherited class

Details
Type:
Bug
Submit Date:
2011-08-16
Status:
Closed
Updated Date:
2012-03-20
Project Name:
JDK
Resolved Date:
2011-10-03
Component:
tools
OS:
linux
Sub-Component:
javac
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u26
Fixed Versions:
6u30 (b08)

Related Reports
Backport:
Backport:
Relates:
Relates:

Sub Tasks

Description
FULL PRODUCT VERSION :
javac 1.6.0_20

ADDITIONAL OS VERSION INFORMATION :
Linux 2.6.18-238.19.1.el5 #1 SMP x86_64 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
javac hangs when compiling a class C, which references a class A that suffers from cyclic inheritance.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Create a directory "A_extends_B" containing A.java and B.java as below.
-----------------------------------
public class A extends B
{
}
-----------------------------------
public class B
{
}
-----------------------------------

2) Compile the classes.

3) Create a directory "B_extends_A" containing A.java and B.java as below:
-----------------------------------
public class A
{
}
-----------------------------------
public class B extends A
{
}
-----------------------------------

4) Compile the classes.

5) Create a directory "circular_inheritance" containing C.java as below:
-----------------------------------
public class C
{
  A a = new A();
}
-----------------------------------

6) Copy A_extends_B/A.class and B_extends_A/B.class to circular_inheritance.

7) Compile C.java

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
An error.
ACTUAL -
javac hangs indefinitely.

REPRODUCIBILITY :
This bug can be reproduced always.

                                    

Comments
EVALUATION

Original jdk8 fix is not applicable to jdk6, so it will be fixed by 7024568.
                                     
2011-09-17
EVALUATION

The fix for 7024568 will also fix this.

I think the fact that javac 7 compiles the test without error is ok - I don't think javac should have to search already compiled classes for circular inheritance.

When the program is run under JDK 7, this error occurs:
   Exception in thread "main" java.lang.ClassCircularityError
                                     
2011-08-25



Hardware and Software, Engineered to Work Together