ADDITIONAL SYSTEM INFORMATION :
Windows 10 build using JDK 8u211
A DESCRIPTION OF THE PROBLEM :
Compiling the supplied source file in Java 8 produces the following output, before consuming system resources and giving up.
C:\CompileTest>"C:\Program Files\Java\jdk1.8.0_211\bin\javac" com\compile\CompileTest.java
The system is out of resources.
Consult the following stack trace for details.
java.lang.StackOverflowError
at com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2296)
at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1624)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2435)
at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1624)
....
at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1624)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2435)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the supplied file:
"C:\Program Files\Java\jdk1.8.0_211\bin\javac" com\compile\CompileTest.java:
package com.compile;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class CompileTest {
public static String[] ROLES_DATA = {"ROLE"};
public static String[][] USERS_DATA = {
{"FIELDS", "DATA"}
};
private static final String SCHEMA_INSERT_DATA = Stream.of(ROLES_DATA).map(v -> "INSERT INTO ROLES VALUES(" + v + ");\n")
.collect(Collectors.joining())
+ Stream.of(USERS_DATA).map(v -> "INSERT INTO USERS (" + v[0] + ") VALUES(" + v[1] + ");\n")
.collect(Collectors.joining());
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Produces class file without error.
ACTUAL -
Infinite loop, runs out of memory
---------- BEGIN SOURCE ----------
package com.compile;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class CompileTest {
public static String[] ROLES_DATA = {"ROLE"};
public static String[][] USERS_DATA = {
{"FIELDS", "DATA"}
};
private static final String SCHEMA_INSERT_DATA = Stream.of(ROLES_DATA).map(v -> "INSERT INTO ROLES VALUES(" + v + ");\n")
.collect(Collectors.joining())
+ Stream.of(USERS_DATA).map(v -> "INSERT INTO USERS (" + v[0] + ") VALUES(" + v[1] + ");\n")
.collect(Collectors.joining());
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Don't use static initialisation with Lambdas.
Compile with JDK 11, but source code 8
FREQUENCY : always
Windows 10 build using JDK 8u211
A DESCRIPTION OF THE PROBLEM :
Compiling the supplied source file in Java 8 produces the following output, before consuming system resources and giving up.
C:\CompileTest>"C:\Program Files\Java\jdk1.8.0_211\bin\javac" com\compile\CompileTest.java
The system is out of resources.
Consult the following stack trace for details.
java.lang.StackOverflowError
at com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2296)
at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1624)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2435)
at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1624)
....
at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1624)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2435)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the supplied file:
"C:\Program Files\Java\jdk1.8.0_211\bin\javac" com\compile\CompileTest.java:
package com.compile;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class CompileTest {
public static String[] ROLES_DATA = {"ROLE"};
public static String[][] USERS_DATA = {
{"FIELDS", "DATA"}
};
private static final String SCHEMA_INSERT_DATA = Stream.of(ROLES_DATA).map(v -> "INSERT INTO ROLES VALUES(" + v + ");\n")
.collect(Collectors.joining())
+ Stream.of(USERS_DATA).map(v -> "INSERT INTO USERS (" + v[0] + ") VALUES(" + v[1] + ");\n")
.collect(Collectors.joining());
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Produces class file without error.
ACTUAL -
Infinite loop, runs out of memory
---------- BEGIN SOURCE ----------
package com.compile;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class CompileTest {
public static String[] ROLES_DATA = {"ROLE"};
public static String[][] USERS_DATA = {
{"FIELDS", "DATA"}
};
private static final String SCHEMA_INSERT_DATA = Stream.of(ROLES_DATA).map(v -> "INSERT INTO ROLES VALUES(" + v + ");\n")
.collect(Collectors.joining())
+ Stream.of(USERS_DATA).map(v -> "INSERT INTO USERS (" + v[0] + ") VALUES(" + v[1] + ");\n")
.collect(Collectors.joining());
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Don't use static initialisation with Lambdas.
Compile with JDK 11, but source code 8
FREQUENCY : always
- duplicates
-
JDK-8077605 Initializing static fields causes unbounded recursion in javac
- Closed