Skip to content

Commit

Permalink
8338013: [lworld] User defined value classes cannot extend j.l.Number
Browse files Browse the repository at this point in the history
  • Loading branch information
Vicente Romero committed Aug 8, 2024
1 parent e45febc commit cbf3b7a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,7 @@ else if (proxy.type.tsym.flatName() == syms.profileType.tsym.flatName()) {
sym.flags_field |= MIGRATED_VALUE_CLASS;
if (needsValueFlag(sym, sym.flags_field)) {
sym.flags_field |= VALUE_CLASS;
sym.flags_field &= ~IDENTITY_TYPE;
}
} else if (proxy.type.tsym.flatName() == syms.restrictedType.tsym.flatName()) {
Assert.check(sym.kind == MTH);
Expand All @@ -1548,6 +1549,7 @@ else if (proxy.type.tsym.flatName() == syms.profileType.tsym.flatName()) {
sym.flags_field |= MIGRATED_VALUE_CLASS;
if (needsValueFlag(sym, sym.flags_field)) {
sym.flags_field |= VALUE_CLASS;
sym.flags_field &= ~IDENTITY_TYPE;
}
} else if (proxy.type.tsym == syms.restrictedType.tsym) {
Assert.check(sym.kind == MTH);
Expand Down Expand Up @@ -3178,6 +3180,7 @@ long adjustClassFlags(ClassSymbol c, long flags) {
flags |= IDENTITY_TYPE;
} else if (needsValueFlag(c, flags)) {
flags |= VALUE_CLASS;
flags &= ~IDENTITY_TYPE;
}
flags &= ~ACC_IDENTITY; // ACC_IDENTITY and SYNCHRONIZED bits overloaded
return flags;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,16 @@ static abstract value class V extends ConcreteSuperType {} // Error: concrete s
value record Point(int x, int y) {}
"""
),
new TestData(
"""
value class One extends Number {
public int intValue() { return 0; }
public long longValue() { return 0; }
public float floatValue() { return 0; }
public double doubleValue() { return 0; }
}
"""
),
new TestData(
"""
value class V extends Object {}
Expand Down

0 comments on commit cbf3b7a

Please sign in to comment.