Skip to content

Commit c6ffacb

Browse files
committed
8344703: Compiler Implementation for Flexible Constructor Bodies
Reviewed-by: vromero, liach, jlahoda
1 parent 2ea629f commit c6ffacb

39 files changed

+129
-133
lines changed

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ public boolean isEnabled() {
226226
*/
227227
public boolean isPreview(Feature feature) {
228228
return switch (feature) {
229-
case FLEXIBLE_CONSTRUCTORS -> true;
230229
case PRIMITIVE_PATTERNS -> true;
231230
//Note: this is a backdoor which allows to optionally treat all features as 'preview' (for testing).
232231
//When real preview features will be added, this method can be implemented to return 'true'

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ public enum Feature {
266266
WARN_ON_ILLEGAL_UTF8(MIN, JDK21),
267267
UNNAMED_VARIABLES(JDK22, Fragments.FeatureUnnamedVariables, DiagKind.PLURAL),
268268
PRIMITIVE_PATTERNS(JDK23, Fragments.FeaturePrimitivePatterns, DiagKind.PLURAL),
269-
FLEXIBLE_CONSTRUCTORS(JDK22, Fragments.FeatureFlexibleConstructors, DiagKind.NORMAL),
269+
FLEXIBLE_CONSTRUCTORS(JDK25, Fragments.FeatureFlexibleConstructors, DiagKind.NORMAL),
270270
MODULE_IMPORTS(JDK25, Fragments.FeatureModuleImports, DiagKind.PLURAL),
271271
JAVA_BASE_TRANSITIVE(JDK25, Fragments.FeatureJavaBaseTransitive, DiagKind.PLURAL),
272272
PRIVATE_MEMBERS_IN_PERMITS_CLAUSE(JDK19),

test/langtools/tools/javac/DefiniteAssignment/DA_DUConstructors.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* @bug 8325805
44
* @summary Permit non-superclass instance field assignments before this/super in constructors
55
* @compile/fail/ref=DA_DUConstructors.out -XDrawDiagnostics DA_DUConstructors.java
6-
* @enablePreview
76
*/
87

98
public class DA_DUConstructors {
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
DA_DUConstructors.java:23:17: compiler.err.var.might.already.be.assigned: x
2-
DA_DUConstructors.java:42:23: compiler.err.var.might.not.have.been.initialized: x
3-
- compiler.note.preview.filename: DA_DUConstructors.java, DEFAULT
4-
- compiler.note.preview.recompile
1+
DA_DUConstructors.java:22:17: compiler.err.var.might.already.be.assigned: x
2+
DA_DUConstructors.java:41:23: compiler.err.var.might.not.have.been.initialized: x
53
2 errors

test/langtools/tools/javac/LocalClassCtorPrologue.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* @bug 8328649
44
* @summary Verify local classes in constructor prologues don't have enclosing instances
55
* @compile/fail/ref=LocalClassCtorPrologue.out -XDrawDiagnostics LocalClassCtorPrologue.java
6-
* @enablePreview
76
*/
87

98
class LocalClassCtorPrologue {
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
LocalClassCtorPrologue.java:16:17: compiler.err.cant.ref.before.ctor.called: x
2-
- compiler.note.preview.filename: LocalClassCtorPrologue.java, DEFAULT
3-
- compiler.note.preview.recompile
1+
LocalClassCtorPrologue.java:15:17: compiler.err.cant.ref.before.ctor.called: x
42
1 error

test/langtools/tools/javac/SuperInit/EarlyAssignmentNoPreview1.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @test /nodynamiccopyright/
33
* @bug 8334258
44
* @summary Disallow early assignment if FLEXIBLE_CONSTRUCTORS preview feature is not enabled
5-
* @compile/fail/ref=EarlyAssignmentNoPreview1.out -XDrawDiagnostics EarlyAssignmentNoPreview1.java
5+
* @compile/fail/ref=EarlyAssignmentNoPreview1.out --release 24 -XDrawDiagnostics EarlyAssignmentNoPreview1.java
66
*/
77
public class EarlyAssignmentNoPreview1 {
88

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
EarlyAssignmentNoPreview1.java:12:14: compiler.err.preview.feature.disabled: (compiler.misc.feature.flexible.constructors)
1+
EarlyAssignmentNoPreview1.java:12:14: compiler.err.feature.not.supported.in.source: (compiler.misc.feature.flexible.constructors), 24, 25
22
1 error

test/langtools/tools/javac/SuperInit/EarlyAssignmentNoPreview2.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @test /nodynamiccopyright/
33
* @bug 8334258
44
* @summary Disallow early assignment if FLEXIBLE_CONSTRUCTORS preview feature is not enabled
5-
* @compile/fail/ref=EarlyAssignmentNoPreview2.out -XDrawDiagnostics EarlyAssignmentNoPreview2.java
5+
* @compile/fail/ref=EarlyAssignmentNoPreview2.out --release 24 -XDrawDiagnostics EarlyAssignmentNoPreview2.java
66
*/
77
public class EarlyAssignmentNoPreview2 {
88

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
EarlyAssignmentNoPreview2.java:12:14: compiler.err.preview.feature.disabled: (compiler.misc.feature.flexible.constructors)
1+
EarlyAssignmentNoPreview2.java:12:14: compiler.err.feature.not.supported.in.source: (compiler.misc.feature.flexible.constructors), 24, 25
22
1 error

0 commit comments

Comments
 (0)