Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ public boolean isEnabled() {
*/
public boolean isPreview(Feature feature) {
return switch (feature) {
case FLEXIBLE_CONSTRUCTORS -> true;
case PRIMITIVE_PATTERNS -> true;
//Note: this is a backdoor which allows to optionally treat all features as 'preview' (for testing).
//When real preview features will be added, this method can be implemented to return 'true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public enum Feature {
WARN_ON_ILLEGAL_UTF8(MIN, JDK21),
UNNAMED_VARIABLES(JDK22, Fragments.FeatureUnnamedVariables, DiagKind.PLURAL),
PRIMITIVE_PATTERNS(JDK23, Fragments.FeaturePrimitivePatterns, DiagKind.PLURAL),
FLEXIBLE_CONSTRUCTORS(JDK22, Fragments.FeatureFlexibleConstructors, DiagKind.NORMAL),
FLEXIBLE_CONSTRUCTORS(JDK25, Fragments.FeatureFlexibleConstructors, DiagKind.NORMAL),
MODULE_IMPORTS(JDK25, Fragments.FeatureModuleImports, DiagKind.PLURAL),
JAVA_BASE_TRANSITIVE(JDK25, Fragments.FeatureJavaBaseTransitive, DiagKind.PLURAL),
PRIVATE_MEMBERS_IN_PERMITS_CLAUSE(JDK19),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* @bug 8325805
* @summary Permit non-superclass instance field assignments before this/super in constructors
* @compile/fail/ref=DA_DUConstructors.out -XDrawDiagnostics DA_DUConstructors.java
* @enablePreview
*/

public class DA_DUConstructors {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
DA_DUConstructors.java:23:17: compiler.err.var.might.already.be.assigned: x
DA_DUConstructors.java:42:23: compiler.err.var.might.not.have.been.initialized: x
- compiler.note.preview.filename: DA_DUConstructors.java, DEFAULT
- compiler.note.preview.recompile
DA_DUConstructors.java:22:17: compiler.err.var.might.already.be.assigned: x
DA_DUConstructors.java:41:23: compiler.err.var.might.not.have.been.initialized: x
2 errors
1 change: 0 additions & 1 deletion test/langtools/tools/javac/LocalClassCtorPrologue.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* @bug 8328649
* @summary Verify local classes in constructor prologues don't have enclosing instances
* @compile/fail/ref=LocalClassCtorPrologue.out -XDrawDiagnostics LocalClassCtorPrologue.java
* @enablePreview
*/

class LocalClassCtorPrologue {
Expand Down
4 changes: 1 addition & 3 deletions test/langtools/tools/javac/LocalClassCtorPrologue.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
LocalClassCtorPrologue.java:16:17: compiler.err.cant.ref.before.ctor.called: x
- compiler.note.preview.filename: LocalClassCtorPrologue.java, DEFAULT
- compiler.note.preview.recompile
LocalClassCtorPrologue.java:15:17: compiler.err.cant.ref.before.ctor.called: x
1 error
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8334258
* @summary Disallow early assignment if FLEXIBLE_CONSTRUCTORS preview feature is not enabled
* @compile/fail/ref=EarlyAssignmentNoPreview1.out -XDrawDiagnostics EarlyAssignmentNoPreview1.java
* @compile/fail/ref=EarlyAssignmentNoPreview1.out --release 24 -XDrawDiagnostics EarlyAssignmentNoPreview1.java
*/
public class EarlyAssignmentNoPreview1 {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
EarlyAssignmentNoPreview1.java:12:14: compiler.err.preview.feature.disabled: (compiler.misc.feature.flexible.constructors)
EarlyAssignmentNoPreview1.java:12:14: compiler.err.feature.not.supported.in.source: (compiler.misc.feature.flexible.constructors), 24, 25
1 error
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8334258
* @summary Disallow early assignment if FLEXIBLE_CONSTRUCTORS preview feature is not enabled
* @compile/fail/ref=EarlyAssignmentNoPreview2.out -XDrawDiagnostics EarlyAssignmentNoPreview2.java
* @compile/fail/ref=EarlyAssignmentNoPreview2.out --release 24 -XDrawDiagnostics EarlyAssignmentNoPreview2.java
*/
public class EarlyAssignmentNoPreview2 {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
EarlyAssignmentNoPreview2.java:12:14: compiler.err.preview.feature.disabled: (compiler.misc.feature.flexible.constructors)
EarlyAssignmentNoPreview2.java:12:14: compiler.err.feature.not.supported.in.source: (compiler.misc.feature.flexible.constructors), 24, 25
1 error
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @test /nodynamiccopyright/
* @bug 8334258
* @summary Disallow early assignment if FLEXIBLE_CONSTRUCTORS preview feature is not enabled
* @compile/fail/ref=EarlyAssignmentNoPreview3.out -XDrawDiagnostics EarlyAssignmentNoPreview3.java
* @compile/fail/ref=EarlyAssignmentNoPreview3.out --release 24 -XDrawDiagnostics EarlyAssignmentNoPreview3.java
*/
public class EarlyAssignmentNoPreview3 {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
EarlyAssignmentNoPreview3.java:12:39: compiler.err.preview.feature.disabled: (compiler.misc.feature.flexible.constructors)
EarlyAssignmentNoPreview3.java:12:39: compiler.err.feature.not.supported.in.source: (compiler.misc.feature.flexible.constructors), 24, 25
1 error
1 change: 0 additions & 1 deletion test/langtools/tools/javac/SuperInit/EarlyAssignments.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* @bug 8325805
* @summary Permit non-superclass instance field assignments before this/super in constructors
* @compile/fail/ref=EarlyAssignments.out -XDrawDiagnostics EarlyAssignments.java
* @enablePreview
*/
public class EarlyAssignments {

Expand Down
54 changes: 26 additions & 28 deletions test/langtools/tools/javac/SuperInit/EarlyAssignments.out
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
EarlyAssignments.java:21:17: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:22:17: compiler.err.cant.ref.before.ctor.called: this
EarlyAssignments.java:23:23: compiler.err.cant.ref.before.ctor.called: this
EarlyAssignments.java:31:21: compiler.err.cant.ref.before.ctor.called: super
EarlyAssignments.java:32:21: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:33:26: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:34:34: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:36:36: compiler.err.cant.ref.before.ctor.called: this
EarlyAssignments.java:40:17: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:44:21: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:48:22: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:66:13: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:67:17: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:68:25: compiler.err.cant.ref.before.ctor.called: this
EarlyAssignments.java:69:31: compiler.err.cant.ref.before.ctor.called: this
EarlyAssignments.java:98:17: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:104:22: compiler.err.cant.ref.before.ctor.called: this
EarlyAssignments.java:110:35: compiler.err.cant.ref.before.ctor.called: this
EarlyAssignments.java:119:17: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:124:22: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:129:29: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:134:17: compiler.err.cant.ref.before.ctor.called: super
EarlyAssignments.java:139:23: compiler.err.cant.ref.before.ctor.called: this
EarlyAssignments.java:148:13: compiler.err.cant.assign.initialized.before.ctor.called: x
EarlyAssignments.java:157:13: compiler.err.cant.assign.val.to.var: final, x
EarlyAssignments.java:168:13: compiler.err.cant.ref.before.ctor.called: this
- compiler.note.preview.filename: EarlyAssignments.java, DEFAULT
- compiler.note.preview.recompile
EarlyAssignments.java:20:17: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:21:17: compiler.err.cant.ref.before.ctor.called: this
EarlyAssignments.java:22:23: compiler.err.cant.ref.before.ctor.called: this
EarlyAssignments.java:30:21: compiler.err.cant.ref.before.ctor.called: super
EarlyAssignments.java:31:21: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:32:26: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:33:34: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:35:36: compiler.err.cant.ref.before.ctor.called: this
EarlyAssignments.java:39:17: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:43:21: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:47:22: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:65:13: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:66:17: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:67:25: compiler.err.cant.ref.before.ctor.called: this
EarlyAssignments.java:68:31: compiler.err.cant.ref.before.ctor.called: this
EarlyAssignments.java:97:17: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:103:22: compiler.err.cant.ref.before.ctor.called: this
EarlyAssignments.java:109:35: compiler.err.cant.ref.before.ctor.called: this
EarlyAssignments.java:118:17: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:123:22: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:128:29: compiler.err.cant.ref.before.ctor.called: x
EarlyAssignments.java:133:17: compiler.err.cant.ref.before.ctor.called: super
EarlyAssignments.java:138:23: compiler.err.cant.ref.before.ctor.called: this
EarlyAssignments.java:147:13: compiler.err.cant.assign.initialized.before.ctor.called: x
EarlyAssignments.java:156:13: compiler.err.cant.assign.val.to.var: final, x
EarlyAssignments.java:167:13: compiler.err.cant.ref.before.ctor.called: this
26 errors
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* @bug 8334488
* @summary Verify the error message generated for early access from inner class
* @compile/fail/ref=EarlyInnerAccessErrorMessageTest.out -XDrawDiagnostics EarlyInnerAccessErrorMessageTest.java
* @enablePreview
*/
public class EarlyInnerAccessErrorMessageTest {
int x;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
EarlyInnerAccessErrorMessageTest.java:12:34: compiler.err.cant.ref.before.ctor.called: x
- compiler.note.preview.filename: EarlyInnerAccessErrorMessageTest.java, DEFAULT
- compiler.note.preview.recompile
EarlyInnerAccessErrorMessageTest.java:11:34: compiler.err.cant.ref.before.ctor.called: x
1 error
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/SuperInit/EarlyLambdaReturn.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -24,7 +24,6 @@
* @test
* @bug 8345438
* @summary Verify 'return' allowed in a lambda declared in an early construction context
* @enablePreview
*/
public class EarlyLambdaReturn {

Expand Down
1 change: 0 additions & 1 deletion test/langtools/tools/javac/SuperInit/EarlyLocalClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* @bug 8325805
* @summary Verify local class in early construction context has no outer instance
* @compile/fail/ref=EarlyLocalClass.out -XDrawDiagnostics EarlyLocalClass.java
* @enablePreview
*/
public class EarlyLocalClass {
EarlyLocalClass() {
Expand Down
4 changes: 1 addition & 3 deletions test/langtools/tools/javac/SuperInit/EarlyLocalClass.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
EarlyLocalClass.java:12:32: compiler.err.cant.ref.before.ctor.called: this
- compiler.note.preview.filename: EarlyLocalClass.java, DEFAULT
- compiler.note.preview.recompile
EarlyLocalClass.java:11:32: compiler.err.cant.ref.before.ctor.called: this
1 error
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/SuperInit/EarlyLocalCtorRef.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -24,7 +24,6 @@
* @test
* @bug 8334248
* @summary Allow early construction local class constructor method references
* @enablePreview
*/

import java.util.function.Supplier;
Expand Down
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/SuperInit/EarlyLocalTest1.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -24,7 +24,6 @@
* @test
* @bug 8333313
* @summary Verify references to local classes declared in early construction contexts
* @enablePreview
*/
public class EarlyLocalTest1 {

Expand Down
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/SuperInit/EarlyLocalTest2.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -24,7 +24,6 @@
* @test
* @bug 8333313
* @summary Verify references to local classes declared in early construction contexts
* @enablePreview
*/
public class EarlyLocalTest2 {

Expand Down
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/SuperInit/EarlyLocalTest3.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -24,7 +24,6 @@
* @test
* @bug 8333313
* @summary Verify references to local classes declared in early construction contexts
* @enablePreview
*/
public class EarlyLocalTest3 {

Expand Down
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/SuperInit/EarlyLocalTest4.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -24,7 +24,6 @@
* @test
* @bug 8333313
* @summary Verify references to local classes declared in early construction contexts
* @enablePreview
*/
public class EarlyLocalTest4 {

Expand Down
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/SuperInit/EarlyLocalTest5.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -24,7 +24,6 @@
* @test
* @bug 8333313
* @summary Verify references to local classes declared in early construction contexts
* @enablePreview
*/
import java.util.concurrent.atomic.AtomicReference;

Expand Down
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/SuperInit/EarlyLocalTest6.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -24,7 +24,6 @@
* @test
* @bug 8333313
* @summary Verify references to local classes declared in early construction contexts
* @enablePreview
*/
import java.util.concurrent.atomic.AtomicReference;

Expand Down
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/SuperInit/EarlyLocalTest7.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -24,7 +24,6 @@
* @test
* @bug 8333313
* @summary Verify references to local classes declared in early construction contexts
* @enablePreview
*/
import java.util.concurrent.atomic.AtomicReference;

Expand Down
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/SuperInit/EarlyLocalTest8.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -24,7 +24,6 @@
* @test
* @bug 8333313
* @summary Verify references to local classes declared in early construction contexts
* @enablePreview
*/
import java.util.concurrent.atomic.AtomicReference;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -24,7 +24,6 @@
* @test
* @bug 8334037
* @summary Test for compiler crash when local class created in early lambda
* @enablePreview
*/

public class LambdaLocalEarlyCrash {
Expand Down
3 changes: 1 addition & 2 deletions test/langtools/tools/javac/SuperInit/LambdaOuterCapture.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -24,7 +24,6 @@
* @test
* @bug 8334252
* @summary Test lambda declared in early construction context
* @enablePreview
*/

public class LambdaOuterCapture {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -24,7 +24,6 @@
* @test
* @bug 8334121
* @summary Anonymous class capturing two enclosing instances fails to compile
* @enablePreview
*/

public class MultiLevelOuterInstance {
Expand Down
1 change: 0 additions & 1 deletion test/langtools/tools/javac/SuperInit/SuperInitFails.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* @bug 8194743
* @summary Permit additional statements before this/super in constructors
* @compile/fail/ref=SuperInitFails.out -XDrawDiagnostics SuperInitFails.java
* @enablePreview
*/
import java.util.concurrent.atomic.AtomicReference;
public class SuperInitFails extends AtomicReference<Object> implements Iterable<Object> {
Expand Down
Loading