import java.lang.Integer; import java.lang.Number; import java.lang.Float; public record Point(Number x, Number y) {} public class OverloadPattern { public Number m(Point(Integer x, Integer y), Point(Float a, Float b)) { return 1; } public Number m(Point(Integer x, Integer y), Point(Integer a, Integer b)) { return 2; } public Number m(Point(Float x, Float y), Point(Integer a, Integer b)) { return 3; } public Number m(Point(Float x, Float y), Point(Float a, Float b)) { return 4; } public Number m(Point(Integer x, Integer y)) { return 5; } public Number m(Point(Float x, Float y)) { return 6; } public m(Integer x) { return x; } } /* public class OverloadPattern { Integer m$Point$_$java$lang$Integer$_$java$lang$Integer$_$(Point point) { var x = point.x(); var y = point.y(); return x + y; } Float m$Point$_$java$lang$Float$_$java$lang$Float$_$(Point point) { var x = point.x(); var y = point.y(); return x * y; } Number m(Point point) { return switch(point) { case Point(Integer x, Integer y) -> m$Point$_$java$lang$Integer$_$java$lang$Integer$_$(point); case Point(Float x, Float y) -> m$Point$_$java$lang$Float$_$java$lang$Float$_$(point); default -> throw new IllegalArgumentException(); } } Integer m(Integer x) { return x; } } */