mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
44 lines
524 B
Java
44 lines
524 B
Java
class Super {
|
|
synchronized void quack() {
|
|
System.out.println("Quack.");
|
|
}
|
|
|
|
synchronized Super self() {
|
|
return this;
|
|
}
|
|
|
|
synchronized void foo() {}
|
|
void bar() {}
|
|
}
|
|
|
|
class Sub extends Super {
|
|
// NOT OK
|
|
void quack() {
|
|
super.quack();
|
|
super.quack();
|
|
}
|
|
|
|
// OK
|
|
Sub self() {
|
|
return (Sub)super.self();
|
|
}
|
|
|
|
// NOT OK
|
|
void foo() {
|
|
super.bar();
|
|
}
|
|
}
|
|
|
|
class A<T> {
|
|
synchronized void foo() {}
|
|
}
|
|
|
|
class B extends A<Integer> {
|
|
// NOT OK
|
|
void foo() {}
|
|
}
|
|
|
|
class C extends A<String> {
|
|
// NOT OK
|
|
void foo() {}
|
|
} |