RFR: 8254105: allow static members in inner classes, add binary compatibil…

Vicente Romero vromero at openjdk.java.net
Fri Oct 9 00:10:36 UTC 2020


On Fri, 9 Oct 2020 00:01:12 GMT, Vicente Romero <vromero at openjdk.org> wrote:

> Please review the fix for [JDK-8254105](https://bugs.openjdk.java.net/browse/JDK-8254105). The intention of the fix is
> to allow static members to be declared inside inner classes. The spec allowing this change can be seen at [Local and
> Nested Static
> Declarations](http://cr.openjdk.java.net/~gbierman/8246771/8246771-20200928/specs/local-statics-jls.html). This change
> is part of the [Records JEP](https://openjdk.java.net/jeps/395). The idea is to allow not only records to be defined
> inside inner classes but also interfaces, enums, static classes and methods.  TIA, Vicente

test/langtools/tools/javac/LocalInterface.java line 6:

> 4:  * @summary test for local interfaces
> 5:  * @compile/fail/ref=LocalInterface.out -XDrawDiagnostics LocalInterface.java
> 6:  * @compile --enable-preview -source ${jdk.version} LocalInterface.java

the current patch is supposed to be applied after the code being reviewed at
[PR-290](https://github.com/openjdk/jdk/pull/290) which also modifies this particular line, once
[PR-290](https://github.com/openjdk/jdk/pull/290) has been pushed this line and others removing the --enable-preview
option from tests will change

test/langtools/tools/javac/records/RecordsBinaryCompatibilityTests.java line 2:

> 1: /*
> 2:  * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.

this code is not strictly related to the patch but this test is just basically testing the changes Chapter 13 int the
record spec. I'm OK moving this to another PR if needed

-------------

PR: https://git.openjdk.java.net/jdk/pull/571


More information about the compiler-dev mailing list