JavaCompilerCore/resources/bytecode/javFiles/SwitchOverload.jav
Daniel Holle 6ccf2a3df6
All checks were successful
Build and Test with Maven / Build-and-test-with-Maven (push) Successful in 5m1s
Add overloading for switches, see #348
2024-10-01 17:28:20 +02:00

17 lines
316 B
Java

import java.lang.Integer;
import java.lang.Double;
import java.lang.Number;
public record R(Number n) {}
public class SwitchOverload {
Number f(Double d) { return d * 2; }
Number f(Integer i) { return i * 5; }
public m(r) {
return switch(r) {
case R(o) -> f(o);
};
}
}