One of my x86_64 machines recently started to fail building openjdk, while my other x86_64 machines do not have this problem, despite running the same OS and build environment - Xubuntu 24.04.1 LTS.
What's special about the failing machine? It's very old - MacBookAir3,1 from 2010 with 4GB of RAM.
Build log snippet follows:
Compiling up to 4 files for COMPILE_CREATE_SYMBOLS
An exception has occurred in the compiler (24-internal). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com) after checking the Bug Database (https://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
java.lang.BootstrapMethodError: bootstrap method initialization exception
at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:187)
at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:316)
at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:277)
at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:267)
at java.base/java.util.Comparator.comparing(Comparator.java:472)
at jdk.compiler/com.sun.tools.javac.comp.Check.methodsGroupedByName(Check.java:2883)
at jdk.compiler/com.sun.tools.javac.comp.Check.checkPotentiallyAmbiguousOverloads(Check.java:2755)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:5600)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5515)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5339)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:5276)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1355)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:977)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:319)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:66)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:52)
Caused by: java.lang.ClassCastException: class jdk.internal.classfile.impl.AbstractPoolEntry$StringEntryImpl cannot be cast to class java.lang.classfile.constantpool.LoadableConstantEntry (jdk.internal.classfile.impl.AbstractPoolEntry$StringEntryImpl and java.lang.classfile.constantpool.LoadableConstantEntry are in module java.base of loader 'bootstrap')
at java.base/jdk.internal.classfile.impl.DirectCodeBuilder.ldc(DirectCodeBuilder.java:1688)
at java.base/java.lang.classfile.CodeBuilder.ldc(CodeBuilder.java:2085)
at java.base/java.lang.invoke.InnerClassLambdaMetafactory$4.accept(InnerClassLambdaMetafactory.java:438)
at java.base/java.lang.invoke.InnerClassLambdaMetafactory$4.accept(InnerClassLambdaMetafactory.java:432)
at java.base/jdk.internal.classfile.impl.DirectCodeBuilder.build(DirectCodeBuilder.java:92)
at java.base/jdk.internal.classfile.impl.DirectMethodBuilder.withCode(DirectMethodBuilder.java:118)
at java.base/jdk.internal.classfile.impl.DirectMethodBuilder.withCode(DirectMethodBuilder.java:125)
at java.base/jdk.internal.classfile.impl.Util$1WithCodeMethodHandler.accept(Util.java:78)
at java.base/jdk.internal.classfile.impl.Util$1WithCodeMethodHandler.accept(Util.java:75)
at java.base/jdk.internal.classfile.impl.DirectMethodBuilder.run(DirectMethodBuilder.java:139)
at java.base/jdk.internal.classfile.impl.DirectClassBuilder.withMethod(DirectClassBuilder.java:117)
at java.base/java.lang.classfile.ClassBuilder.withMethod(ClassBuilder.java:258)
at java.base/java.lang.classfile.ClassBuilder.withMethodBody(ClassBuilder.java:277)
at java.base/java.lang.invoke.InnerClassLambdaMetafactory.generateSerializationFriendlyMethods(InnerClassLambdaMetafactory.java:431)
at java.base/java.lang.invoke.InnerClassLambdaMetafactory$1.accept(InnerClassLambdaMetafactory.java:343)
at java.base/java.lang.invoke.InnerClassLambdaMetafactory$1.accept(InnerClassLambdaMetafactory.java:310)
at java.base/jdk.internal.classfile.impl.ClassFileImpl.build(ClassFileImpl.java:145)
at java.base/java.lang.invoke.InnerClassLambdaMetafactory.generateInnerClass(InnerClassLambdaMetafactory.java:310)
at java.base/java.lang.invoke.InnerClassLambdaMetafactory.spinInnerClass(InnerClassLambdaMetafactory.java:282)
at java.base/java.lang.invoke.InnerClassLambdaMetafactory.buildCallSite(InnerClassLambdaMetafactory.java:214)
at java.base/java.lang.invoke.LambdaMetafactory.altMetafactory(LambdaMetafactory.java:546)
at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:143)
... 16 more
printing javac parameters to: /home/martin/ws/jdk/build/linux-x86_64-server-release/support/javatmp/javac.20241116_200517.args
gmake[3]: *** [Gendata.gmk:64: /home/martin/ws/jdk/build/linux-x86_64-server-release/buildtools/create_symbols_javac/_the.COMPILE_CREATE_SYMBOLS_batch] Error 4
gmake[2]: *** [make/Main.gmk:139: jdk.compiler-gendata] Error 2