Accidentally found that the following code generates SOE at runtime with JDK13b17, while passing with b16:
System.setSecurityManager(new SecurityManager() {
@Override
public void checkPermission(java.security.Permission p) {
String e = "a" + p + "b";
}
});
new Object() { Class c = getClass(); };
The stacktrace looks like
Exception in thread "main" java.lang.StackOverflowError
at java.base/java.util.Arrays$ArrayList.toArray(Arrays.java:4360)
at java.base/java.lang.invoke.MethodType.listToArray(MethodType.java:233)
at java.base/java.lang.invoke.MethodType.insertParameterTypes(MethodType.java:449)
at java.base/java.lang.invoke.MethodHandles.dropArguments0(MethodHandles.java:3623)
at java.base/java.lang.invoke.MethodHandles.dropArguments(MethodHandles.java:3695)
at java.base/java.lang.invoke.StringConcatFactory$MethodHandleInlineCopyStrategy.generate(StringConcatFactory.java:1580)
at java.base/java.lang.invoke.StringConcatFactory.generate(StringConcatFactory.java:780)
at java.base/java.lang.invoke.StringConcatFactory.doStringConcat(StringConcatFactory.java:689)
at java.base/java.lang.invoke.StringConcatFactory.makeConcatWithConstants(StringConcatFactory.java:605)
at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:99)
at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:307)
at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:259)
at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:249)
...
or
Exception in thread "main" java.lang.StackOverflowError
at java.base/jdk.internal.org.objectweb.asm.SymbolTable.hash(SymbolTable.java:1268)
at java.base/jdk.internal.org.objectweb.asm.SymbolTable.addConstantUtf8(SymbolTable.java:795)
at java.base/jdk.internal.org.objectweb.asm.SymbolTable.addConstantNameAndType(SymbolTable.java:771)
at java.base/jdk.internal.org.objectweb.asm.SymbolTable.addConstantMemberReference(SymbolTable.java:603)
at java.base/jdk.internal.org.objectweb.asm.SymbolTable.addConstantFieldref(SymbolTable.java:557)
at java.base/jdk.internal.org.objectweb.asm.MethodWriter.visitFieldInsn(MethodWriter.java:1036)
at java.base/java.lang.invoke.ClassSpecializer$Factory.generateConcreteSpeciesCodeFile(ClassSpecializer.java:736)
at java.base/java.lang.invoke.ClassSpecializer$Factory.generateConcreteSpeciesCode(ClassSpecializer.java:574)
at java.base/java.lang.invoke.ClassSpecializer$Factory.loadSpecies(ClassSpecializer.java:489)
at java.base/java.lang.invoke.ClassSpecializer.findSpecies(ClassSpecializer.java:193)
at java.base/java.lang.invoke.BoundMethodHandle$SpeciesData.extendWith(BoundMethodHandle.java:352)
at java.base/java.lang.invoke.LambdaFormEditor.newSpeciesData(LambdaFormEditor.java:392)
at java.base/java.lang.invoke.LambdaFormEditor.makeArgumentCombinationForm(LambdaFormEditor.java:760)
at java.base/java.lang.invoke.LambdaFormEditor.filterArgumentForm(LambdaFormEditor.java:643)
at java.base/java.lang.invoke.MethodHandles.filterArgument(MethodHandles.java:3950)
at java.base/java.lang.invoke.MethodHandles.filterArguments(MethodHandles.java:3922)
at java.base/java.lang.invoke.StringConcatFactory$MethodHandleInlineCopyStrategy.generate(StringConcatFactory.java:1658)
at java.base/java.lang.invoke.StringConcatFactory.generate(StringConcatFactory.java:780)
at java.base/java.lang.invoke.StringConcatFactory.doStringConcat(StringConcatFactory.java:689)
at java.base/java.lang.invoke.StringConcatFactory.makeConcatWithConstants(StringConcatFactory.java:605)
at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:99)
at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:307)
at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:259)
at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:249)
...
or could look differently but always with a StackOverflowError