JDK-7079713 : javac hangs when compiling a class that references a cyclically inherited class
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6u26
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2011-08-16
  • Updated: 2012-03-20
  • Resolved: 2011-10-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 JDK 8
6u30 b08Fixed 7-poolResolved 8Fixed
Related Reports
Relates :  
Relates :  
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.
17-09-2011

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
25-08-2011