35 lines
554 B
Java
35 lines
554 B
Java
import java.lang.Integer;
|
|
import java.lang.Object;
|
|
|
|
public interface Base {
|
|
Object value();
|
|
}
|
|
public record R(Integer a) implements Base {
|
|
public Object value() { return this.a; }
|
|
}
|
|
|
|
public class PatternMatchingCaptures {
|
|
public test1(Base R(a)@r) {
|
|
return r.value();
|
|
}
|
|
|
|
public test2(Base R(a)) {
|
|
return a;
|
|
}
|
|
|
|
public test3(R(a)@r) {
|
|
return r.a;
|
|
}
|
|
|
|
public test4(R(a)) {
|
|
return a;
|
|
}
|
|
|
|
public test5(R r) {
|
|
return r.a;
|
|
}
|
|
|
|
public test6(r) {
|
|
return r.a;
|
|
}
|
|
} |