[lworld] RFR: 8280194: Abstract classes that allow value subclasses should be marked ACC_PERMITS_VALUE (0x0040)
Srikanth Adayapalam
sadayapalam at openjdk.java.net
Mon Jan 31 14:18:15 UTC 2022
On Mon, 31 Jan 2022 14:08:59 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.
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
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 1452:
> 1450: env.dup(tree, env.info.dup(env.info.scope.dupUnshared(fakeOwner)));
> 1451:
> 1452: if ((tree.flags & STATIC) != 0) localEnv.info.staticLevel++;
This is too late in Attr. This is now moved up.
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java line 239:
> 237: }
> 238: }
> 239: }
This used to happen in Attr, but that is too late. Pulled up to here now
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java line 265:
> 263: }
> 264:
> 265: public void visitVarDef(JCVariableDecl tree) {
This used to happen in Attr, but that is too late. Pulled up to here now
test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java line 63:
> 61: setPrefix("class Anonymous { int f; } {new Anonymous() {");
> 62: List<TestCase> sources = super.generateTestCases();
> 63:
Hack to suppress ACC_PERMITS_VALUE bit from being set thereby causing the test to "fail"
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"
test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesTestBase.java line 300:
> 298: sb.append(String.format("%s A%d { %s %s}\n", innerClassType, count, instField, privateConstructor));
> 299: Set<String> flags = getFlags(innerClassType, innerMod);
> 300: class2Flags.put("A" + count, flags);
Hacks to suppress ACC_PERMITS_VALUE bit from being set thereby causing the test to "fail"
test/langtools/tools/javac/processing/rounds/OverwriteBetweenCompilations.java line 26:
> 24: /*
> 25: * @ignore
> 26: * @test
This test fails and will be followed up via a separate ticket.
-------------
PR: https://git.openjdk.java.net/valhalla/pull/622
More information about the valhalla-dev
mailing list