[lworld] RFR: 8280194: Abstract classes that allow value subclasses should be marked ACC_PERMITS_VALUE (0x0040)
Aggelos Biboudis
duke at openjdk.java.net
Tue Feb 1 11:12:44 UTC 2022
On Mon, 31 Jan 2022 14:10:03 GMT, Srikanth Adayapalam <sadayapalam at openjdk.org> wrote:
>> Mark abstract classes that qualify with ACC_PERMITS_VALUE flag.
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 2381:
>
>> 2379: if ((s.flags() & (SYNCHRONIZED | STATIC)) == SYNCHRONIZED) {
>> 2380: return true;
>> 2381: } else if (s.isConstructor()) {
>
> This is a bug fix - static methods may be synchronized or not - immaterial.
Do you think the comment above the signature of `implicitIdentityType` needs to reflect this change in a parenthesis?
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 1255:
>
>> 1253: }
>> 1254: }
>> 1255:
>
> This is too late here. Now this is moved up to MemberEnter
Why was this moved up? (for me to understand better)
> test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInLocalClassTest.java line 56:
>
>> 54: sb.append(outerModifier.getString()).append(' ');
>> 55: sb.append("class Local { int f; ");
>> 56: Map<String, Set<String>> class2Flags = new HashMap<>();
>
> Hack to suppress ACC_PERMITS_VALUE bit from being set thereby causing the test to "fail"
I was playing around to understand this generated test:
public class OuterClass {
static void method() {abstract class Local { class A0{}
abstract class A1{}
final class A2{}
};}
}
Why do we get the following for an inner class that is abstract,
[ASSERT] : inner_class_access_flags 1Local
Expected: [ACC_ABSTRACT],
Got: [ACC_ABSTRACT, 0x40]
while `abstract class A8` in `PermitsValueTest.java` does not emit `ACC_PERMITS_VALUE`?
nitpick (and possibly not addressed yet): `Modifiers:getString()` doesn't return the name for `ACC_PERMITS_VALUE` yet. Do we need to address this in this PR? possibly not
-------------
PR: https://git.openjdk.java.net/valhalla/pull/622
More information about the valhalla-dev
mailing list