mirror of
https://github.com/github/codeql.git
synced 2025-12-25 21:26:37 +01:00
20 lines
376 B
Java
20 lines
376 B
Java
public class DubiousDowncastOfThis {
|
|
private static class BadBase {
|
|
private Derived d;
|
|
|
|
public BadBase(Derived d) {
|
|
if(d != null && this instanceof Derived)
|
|
this.d = (Derived)this; // violation
|
|
else
|
|
this.d = d;
|
|
}
|
|
}
|
|
|
|
private static class Derived extends BadBase {
|
|
public Derived() {
|
|
super(null);
|
|
}
|
|
}
|
|
|
|
public static void main(String[] args) {}
|
|
} |