Skip to content

Commit 151401e

Browse files
committed
[GR-61496] Exception on LDC with primitive class name.
PullRequest: graal/19848
2 parents 258a5d4 + 428b4b7 commit 151401e

File tree

1 file changed

+7
-3
lines changed
  • espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors

1 file changed

+7
-3
lines changed

espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/TypeSymbols.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,13 @@ public static Symbol<Type> fromDescriptorUnsafe(Symbol<? extends Descriptor> des
365365
* Converts a name symbol, as appear in constant pool entries to a type symbol. For historical
366366
* reasons, class name entries are not in internal form. For classes, the class name entry is
367367
* {@code java/lang/Thread} instead of {@code Ljava/lang/Thread;}. For arrays, the class name is
368-
* already in internal form. Primitives are not allowed.
368+
* already in internal form.
369369
*/
370370
public Symbol<Type> fromClassNameEntry(Symbol<Name> name) {
371371
ErrorUtil.guarantee(Validation.validClassNameEntry(name), "invalid class name entry");
372-
ErrorUtil.guarantee(!isPrimitive(name), "unexpected primitive name");
372+
// There are no "name" symbols for primitives, only "type" symbols.
373+
// That's why primitives cannot be represented here.
374+
// The entry "V" refers to the class "LV;" and not the void.class.
373375
if (name.byteAt(0) == '[') {
374376
return fromSymbol(name);
375377
}
@@ -378,7 +380,9 @@ public Symbol<Type> fromClassNameEntry(Symbol<Name> name) {
378380

379381
public Symbol<Type> fromClassNameEntryUnsafe(Symbol<Name> name) {
380382
assert Validation.validClassNameEntry(name) : name;
381-
assert !isPrimitive(name) : name;
383+
// There are no "name" symbols for primitives, only "type" symbols.
384+
// That's why primitives cannot be represented here.
385+
// The entry "V" refers to the class "LV;" and not the void.class.
382386
if (name.byteAt(0) == '[') {
383387
return fromSymbolUnsafe(name);
384388
}

0 commit comments

Comments
 (0)