Integrated: 8321207: javac is not accepting correct code
Vicente Romero
vromero at openjdk.org
Wed Dec 6 02:38:46 UTC 2023
On Tue, 5 Dec 2023 02:24:19 GMT, Vicente Romero <vromero at openjdk.org> wrote:
> Common code like:
>
>
> import java.util.*;
> import java.util.function.*;
>
> interface Test {
> Object O = new Object() { // but if the implicit static initializer is added here the code is accepted
> IntSupplier x(int m) {
> return () -> m;
> }
> };
> }
>
> is failing after fix for [JDK-8194743](https://bugs.openjdk.org/browse/JDK-8194743). The issue here is that method Flow.BaseAnalyzer::forEachInitializer is invoked twice once for static and another once for non-static initializers. The static-ness of the initializer is determined at this method by checking the modifiers in the corresponding AST. The problem with this is that implicit flags are added to symbols at Check::checkFlags but they don't make their way up to the AST's modifiers. The proposed fix is checking for static-ness at both the modifiers and the corresponding symbol
>
> TIA
This pull request has now been integrated.
Changeset: aaaae3ee
Author: Vicente Romero <vromero at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/aaaae3ee3cc966d05f6cf6fa81cecc122a8f9294
Stats: 45 lines in 2 files changed: 44 ins; 0 del; 1 mod
8321207: javac is not accepting correct code
Reviewed-by: jlahoda
-------------
PR: https://git.openjdk.org/jdk/pull/16963
More information about the compiler-dev
mailing list