forked from openjdk/amber
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fix crash when assigning to bindings - Disallow pattern no matching on all control paths Co-authored-by: Jan Lahoda <[email protected]>o
- Loading branch information
Showing
9 changed files
with
105 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
test/langtools/tools/javac/patterns/declarations/FinishingNormally.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* @test | ||
* @enablePreview | ||
* @compile/fail/ref=FinishingNormally.out -XDrawDiagnostics FinishingNormally.java | ||
*/ | ||
public class FinishingNormally { | ||
public pattern FinishingNormally(String content) {} | ||
} |
4 changes: 4 additions & 0 deletions
4
test/langtools/tools/javac/patterns/declarations/FinishingNormally.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FinishingNormally.java:7:55: compiler.err.missing.match.stmt | ||
- compiler.note.preview.filename: FinishingNormally.java, DEFAULT | ||
- compiler.note.preview.recompile | ||
1 error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
test/langtools/tools/javac/patterns/declarations/Shadowing.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* @test | ||
* @enablePreview | ||
* @compile Shadowing.java | ||
*/ | ||
public class Shadowing { | ||
public class Point { | ||
final int x; | ||
final int y; | ||
|
||
protected Point(int x, int y) { | ||
this.x = x; | ||
this.y = y; | ||
} | ||
|
||
protected pattern Point(int x, int y) { | ||
match Point (this.x, this.y); | ||
} | ||
} | ||
|
||
public class GreatPoint extends Point { | ||
final int magnitude; | ||
|
||
public GreatPoint(int x, int y, int magnitude) { | ||
super(x, y); | ||
if (magnitude < 0) throw new IllegalArgumentException(); | ||
this.magnitude = magnitude; | ||
} | ||
|
||
public pattern GreatPoint(int x, int y, int magnitude) { | ||
switch (this) { | ||
case Point(var x, var y): | ||
match GreatPoint (x, y, this.magnitude); | ||
} | ||
} | ||
} | ||
} |