Skip to content

Commit

Permalink
Allow ValueType creation with new/<init>/putfield
Browse files Browse the repository at this point in the history
Signed-off-by: Theresa Mammarella <[email protected]>
  • Loading branch information
theresa-m committed Jun 5, 2024
1 parent 2a27e8a commit 57fc747
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions runtime/bcutil/cfreader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1876,22 +1876,10 @@ checkMethods(J9PortLibrary* portLib, J9CfrClassFile* classfile, U_8* segment, U_
}

if (nameIndexOK && utf8Equal(&classfile->constantPool[method->nameIndex], "<init>", 6)) {
#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES)
/**
* The spec says a method of a value class cannot be <init>. A method of an abstract class cannot be <vnew>.
* For a value abstract class, its constructor is compiled into <init> now, so allow <init> in abstract classes.
*/
if (J9_IS_CLASSFILE_VALUETYPE(classfile) && J9_ARE_NO_BITS_SET(classfile->accessFlags, CFR_ACC_ABSTRACT)) {
errorCode = J9NLS_CFR_ERR_INIT_ON_VALUE_CLASS__ID;
/* check no invalid flags set */
if (value & ~CFR_INIT_METHOD_ACCESS_MASK) {
errorCode = J9NLS_CFR_ERR_INIT_METHOD__ID;
goto _errorFound;
} else
#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */
{
/* check no invalid flags set */
if (value & ~CFR_INIT_METHOD_ACCESS_MASK) {
errorCode = J9NLS_CFR_ERR_INIT_METHOD__ID;
goto _errorFound;
}
}

/* Java SE 9 Edition:
Expand Down

0 comments on commit 57fc747

Please sign in to comment.