RFR(XS): 8187669: [MVT] ValueTypeHolder::unreflectWithers fails with ClassFormatError: Illegal method name

Tobias Hartmann tobias.hartmann at oracle.com
Tue Sep 19 11:52:49 UTC 2017


Hi,

I noticed that initialization of test/compiler/valhalla/valuetypes/ValueCapableClass2.java fails with "ClassFormatError: 
Illegal method name "compiler.valhalla.valuetypes.ValueCapableClass2_unreflectWithers"" if the verifier is enabled.

The problem is that ValueCapableClass2 is declared in a package and ValueTypeHolder::getOrLoad uses 
sourceClass().getName() for the method name which contains the package path.

We should use "getSimpleName":

--- a/src/java.base/share/classes/valhalla/shady/ValueTypeHolder.java	Fri Sep 15 13:49:03 2017 -0700
+++ b/src/java.base/share/classes/valhalla/shady/ValueTypeHolder.java	Tue Sep 19 13:51:32 2017 +0200
@@ -495,7 +495,7 @@
      private MethodHandle getOrLoad(Lookup lookup, ValueHandleKey key, Supplier<MethodType> typeSupplier, Consumer<? 
super MethodHandleCodeBuilder<?>> codeBuilder) {
          MethodHandle result = handleMap.get(key);
          if (result == null) {
-            String handleDebugName = sourceClass().getName() + "_" + key.kind.handleName();
+            String handleDebugName = sourceClass().getSimpleName() + "_" + key.kind.handleName();
              result = MethodHandleBuilder.loadCode(lookup, handleDebugName, typeSupplier.get(), codeBuilder);
              handleMap.put(key, result);
          }

Thanks,
Tobias


More information about the valhalla-dev mailing list