| 4 | import java.util.concurrent.ExecutionException; |
| 5 | |
| 6 | @ExampleAnnotation(value = "Hi", list = { "First", "Second", "Third" }, nested = @SimpleAnnotation("Inner")) |
| 7 | public abstract class ExampleClass { |
| 8 | public float publicField = 2.5f; |
| 9 | public final int publicFinalField = 1; |
| 10 | |
| 11 | @SimpleAnnotation("This is a Field") |
| 12 | private final boolean annotatedPrivateFinalField = true; |
| 13 | |
| 14 | public static double publicStaticField = 1.2d; |
| 15 | public static final char PUBLIC_STATIC_FINAL_FIELD = 'x'; |
| 16 | |
| 17 | public void instanceMethod() { |
| 18 | for (int i = 0; i < this.publicFinalField; i++) { |
| 19 | System.out.println("Hello Chasm!"); |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | public static void publicStaticMethod() { |
| 24 | System.out.println("Static Hello Chasm!"); |
| 25 | int five = 5; |
| 26 | try { |
| 27 | System.out.println("5 = " + 5); |
| 28 | int three = 3; |
| 29 | System.out.println(five + " + " + three + " = " + (five + three)); |
| 30 | } catch (Exception e) { |
| 31 | e.printStackTrace(); |
| 32 | five = 0; |
| 33 | } |
| 34 | |
| 35 | publicStaticMethod(); |
| 36 | |
| 37 | switch (five) { |
| 38 | case 5: |
| 39 | System.out.println("Still 5"); |
| 40 | break; |
| 41 | default: |
| 42 | System.out.println("No longer 5"); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | public static String testSwitch() { |
| 47 | return switch ((int) Math.round(Math.random() * 100)) { |
| 48 | case 10 -> { |
| 49 | String nested = "Test"; |
| 50 | yield switch (nested) { |
| 51 | case "NotTest" -> "NotTest"; |
| 52 | default -> throw new IllegalStateException("Unexpected value: " + "Test"); |
| 53 | }; |
| 54 | } |
| 55 | default -> "Not 10"; |
| 56 | }; |
| 57 | } |
| 58 | |
| 59 | public static int testGenerics() throws ExecutionException, InterruptedException { |
| 60 | int output = CompletableFuture.supplyAsync(() -> 5) |
| 61 | .thenApply(i -> Integer.toString(i)) |
| 62 | .thenAccept(System.out::println) |
| 63 | .thenApply(v -> 7) |
nothing calls this directly
no outgoing calls
no test coverage detected