ADDITIONAL SYSTEM INFORMATION : System: Platform-Independent OS: Multiple Java Runtime: Issue replicable from JDK 16 through to the latest preview version (JDK 22 at the time of reporting). A DESCRIPTION OF THE PROBLEM : A StackOverflowError occurs in the Java compiler when attempting to extend an inner (non-static nested) class through its nested static class with more than one level of nesting. The issue manifests as a recursive stack trace during the compilation process. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : 1. Create a Java class with an inner class and multiple levels of nested static classes. 2. Attempt to extend the inner class from the deepest level of the nested static class. 3. Compile the code. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The code should compile without issues. ACTUAL - Compilation fails with a StackOverflowError and the message "Compilation failed: internal java compiler error". ---------- BEGIN SOURCE ---------- package p3; public class Test { public static void main(String[] args) { } class Inner { class N1 { static class N2 extends Inner {} } } } class Test2 { } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : None found at this time. FREQUENCY : always
|