Files
javademos/java21-features/output/14-compile-errors.txt
T

19 lines
1.0 KiB
Plaintext

$ javac broken/PreviewWithoutFlag.java (21.0.12.1)
broken/PreviewWithoutFlag.java:3: error: string templates are a preview feature and are disabled by default.
public static void main(String[] args) { String n = "x"; System.out.println(STR."hi \{n}"); }
^
(use --enable-preview to enable string templates)
1 error
$ javac broken/NonExhaustive.java (21.0.12.1)
broken/NonExhaustive.java:6: error: the switch expression does not cover all possible input values
static String f(S s) { return switch (s) { case A a -> "a"; }; }
^
1 error
$ javac broken/DominatedCase.java (21.0.12.1)
broken/DominatedCase.java:3: error: this case label is dominated by a preceding case label
static String f(Object o) { return switch (o) { case CharSequence cs -> "cs"; case String s -> "s"; default -> "d"; }; }
^
1 error