[patterns] Match against a enum constant
Tagir Valeev
amaembo at gmail.com
Mon Oct 2 10:11:26 UTC 2017
Hello!
Currently switch can match against a enum constant, e.g.:
static void switches(TimeUnit t) {
switch(t) {
case SECONDS:System.out.println("Matches");break;
}
}
However it seems that this is no case for __matches operator:
static void matches(TimeUnit t) {
if(t __matches SECONDS) {
System.out.println("Matches");
}
}
This cannot be compiled (even if I specify qualified
TimeUnit.SECONDS). Is this intended difference between switch and
__matches?
With best regards,
Tagir Valeev.
More information about the amber-dev
mailing list