Skip to content

Instantly share code, notes, and snippets.

@peter-lawrey
Last active November 25, 2024 14:39
Show Gist options
  • Save peter-lawrey/babc913fa06b25d859ec059a851f87c2 to your computer and use it in GitHub Desktop.
Save peter-lawrey/babc913fa06b25d859ec059a851f87c2 to your computer and use it in GitHub Desktop.
package when;
public class When {
static class when {
boolean when = true;
}
@interface whėn {
String value();
}
String test(@whėn("when") Object whėn) {
return switch(whėn) {
case @whėn("when") when when
when when . when -> "when?";
default -> "if not now, ";
};
}
public static void main(String[] args) {
System.out.print(new When().test("hi"));
System.out.println(new When().test(new when()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment