Files
javademos/java17-features/output/09-compile-errors.txt
T

19 lines
937 B
Plaintext

$ javac broken/SealedViolation.java (17.0.20.1)
broken/SealedViolation.java:5: error: class is not allowed to extend sealed class: Shape (as it is not listed in its permits clause)
record Triangle(double b, double h) implements Shape {}
^
1 error
$ javac broken/RecordFieldMutation.java (17.0.20.1)
broken/RecordFieldMutation.java:3: error: cannot assign a value to final variable x
record Point(int x, int y) { void move() { this.x = 10; } }
^
1 error
$ javac broken/SwitchPatternOn17.java (17.0.20.1)
broken/SwitchPatternOn17.java:3: error: patterns in switch statements are a preview feature and are disabled by default.
static String f(Object o) { return switch (o) { case String s -> "string"; default -> "other"; }; }
^
(use --enable-preview to enable patterns in switch statements)
1 error