@Test public void shouldWork() { JabelExample jabelExample = new JabelExample(); String result = jabelExample.run(new String[0]); assertTrue("'" + result + "' should start with 'idk '", result.startsWith("idk ")); }
public String run(String[] args) { var result = switch (args.length) { case 1 -> { yield """ one... yet pretty long! """; } case 2, 3 -> "two or three"; default -> new JabelExample().new Inner().innerPublic(); }; return result; } @SafeVarargs private String outerPrivate(List<String>... args) { var callable = new Callable<>() { @Override public String call() { Function<Object, String> function = (var prefix) -> { if (prefix instanceof String s) { return s + Integer.toString(0); } else { throw new IllegalArgumentException("Expected string!"); } }; return function.apply("idk "); } }; var closeable = new AutoCloseable() { @Override public void close() { } }; try (closeable) { return callable.call(); } } class Inner { public String innerPublic() { return outerPrivate(); } } }
JabelExample { public String run(String[] args) { var result = switch (args.length) { case 1 -> { yield """ one... yet pretty long! """; } case 2, 3 -> "two or three"; default -> new JabelExample().new Inner().innerPublic(); }; return result; } @SafeVarargs private String outerPrivate(List<String>... args) { var callable = new Callable<>() { @Override public String call() { Function<Object, String> function = (var prefix) -> { if (prefix instanceof String s) { return s + Integer.toString(0); } else { throw new IllegalArgumentException("Expected string!"); } }; return function.apply("idk "); } }; var closeable = new AutoCloseable() { @Override public void close() { } }; try (closeable) { return callable.call(); } } class Inner { public String innerPublic() { return outerPrivate(); } } } }
JabelExample { public String run(String[] args) { var result = switch (args.length) { case 1 -> { yield """ one... yet pretty long! """; } case 2, 3 -> "two or three"; default -> new JabelExample().new Inner().innerPublic(); }; return result; } @SafeVarargs private String outerPrivate(List<String>... args) { var callable = new Callable<>() { @Override public String call() { Function<Object, String> function = (var prefix) -> { if (prefix instanceof String s) { return s + Integer.toString(0); } else { throw new IllegalArgumentException("Expected string!"); } }; return function.apply("idk "); } }; var closeable = new AutoCloseable() { @Override public void close() { } }; try (closeable) { return callable.call(); } } class Inner { public String innerPublic() { return outerPrivate(); } } }  }
JabelExample { public String run(String[] args) { var result = switch (args.length) { case 1 -> { yield """ one... yet pretty long! """; } case 2, 3 -> "two or three"; default -> new JabelExample().new Inner().innerPublic(); }; return result; } @SafeVarargs private String outerPrivate(List<String>... args) { var callable = new Callable<>() { @Override public String call() { Function<Object, String> function = (var prefix) -> { if (prefix instanceof String s) { return s + Integer.toString(0); } else { throw new IllegalArgumentException("Expected string!"); } }; return function.apply("idk "); } }; var closeable = new AutoCloseable() { @Override public void close() { } }; try (closeable) { return callable.call(); } } class Inner { public String innerPublic() { return outerPrivate(); } } }  static void main(String[] args); String run(String[] args); }
JabelExample { public String run(String[] args) { var result = switch (args.length) { case 1 -> { yield """ one... yet pretty long! """; } case 2, 3 -> "two or three"; default -> new JabelExample().new Inner().innerPublic(); }; return result; } @SafeVarargs private String outerPrivate(List<String>... args) { var callable = new Callable<>() { @Override public String call() { Function<Object, String> function = (var prefix) -> { if (prefix instanceof String s) { return s + Integer.toString(0); } else { throw new IllegalArgumentException("Expected string!"); } }; return function.apply("idk "); } }; var closeable = new AutoCloseable() { @Override public void close() { } }; try (closeable) { return callable.call(); } } class Inner { public String innerPublic() { return outerPrivate(); } } }  static void main(String[] args); String run(String[] args);  }