-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Closed
fmeum/rules_jni
#116Closed
Copy link
Labels
Description
Building with class files emitted by the JDK 21 javac will result in crashes like the following:
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 207
at com.google.turbine.bytecode.ConstantPoolReader.utf8(ConstantPoolReader.java:120)
at com.google.turbine.bytecode.ClassReader.readMethodParameters(ClassReader.java:229)
at com.google.turbine.bytecode.ClassReader.readMethods(ClassReader.java:438)
at com.google.turbine.bytecode.ClassReader.read(ClassReader.java:105)
at com.google.turbine.bytecode.ClassReader.read(ClassReader.java:55)
at com.google.turbine.binder.bytecode.BytecodeBoundClass$1.get(BytecodeBoundClass.java:91)
at com.google.turbine.binder.bytecode.BytecodeBoundClass$1.get(BytecodeBoundClass.java:88)
at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:183)
at com.google.turbine.binder.bytecode.BytecodeBoundClass$6.get(BytecodeBoundClass.java:194)
at com.google.turbine.binder.bytecode.BytecodeBoundClass$6.get(BytecodeBoundClass.java:191)
at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:183)
at com.google.turbine.binder.bytecode.BytecodeBoundClass$7.get(BytecodeBoundClass.java:207)
at com.google.turbine.binder.bytecode.BytecodeBoundClass$7.get(BytecodeBoundClass.java:204)
at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:183)
at com.google.turbine.binder.bytecode.BytecodeBoundClass.typeParameters(BytecodeBoundClass.java:221)
at com.google.turbine.types.Canonicalize.isRaw(Canonicalize.java:152)
at com.google.turbine.types.Canonicalize.canon(Canonicalize.java:127)
at com.google.turbine.types.Canonicalize.canonicalizeClassTy(Canonicalize.java:360)
at com.google.turbine.types.Canonicalize.canonicalize(Canonicalize.java:115)
at com.google.turbine.types.Canonicalize.canonicalize(Canonicalize.java:366)
at com.google.turbine.types.Canonicalize.canonicalizeClassTy(Canonicalize.java:357)
at com.google.turbine.types.Canonicalize.canonicalizeClassTy(Canonicalize.java:87)
at com.google.turbine.binder.CanonicalTypeBinder.bind(CanonicalTypeBinder.java:52)
at com.google.turbine.binder.Binder.canonicalizeTypes(Binder.java:319)
at com.google.turbine.binder.Binder.bind(Binder.java:172)
at com.google.turbine.binder.Binder.bind(Binder.java:97)
at com.google.turbine.main.Main.bind(Main.java:259)
at com.google.turbine.main.Main.compile(Main.java:157)
at com.google.turbine.main.Main.compile(Main.java:132)
at com.google.turbine.main.Main.main(Main.java:88)
The latest JDK 21 builds contain some system classes with MethodParameters
attributes that contain empty names. This change was caused by the fix for JDK-8292275: javac does not emit SYNTHETIC and MANDATED flags for parameters by default.
Turbine was fixed to correctly handle these class files in google/turbine@0f20345, but that change isn't available in Bazel yet.
I opened https://github.com/bazelbuild/bazel/pulls to update turbine. We should merge that fix and cut a java_rules
release that includes the change before JDK 21 is released in September.