Detecting method calls where receiver is of given type #1122
-
I would like to write a rule where I want to check the type of the receiver of the call. Specifically, I want to check that there is no code which calls Of course this rule can only be expected to catch cases where the type of the receiver can statically be determined to be of type |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I fear that the byte code might not contain the information that class Foo {
boolean eq() {
Foo foo = new Foo();
return foo.equals(new Object());
}
} the method
|
Beta Was this translation helpful? Give feedback.
I fear that the byte code might not contain the information that
Object#equals(Object)
was called on aFoo
:In the example
the method
eq
is compiled to the byte code (cf.javap -c -p -v Foo.class
):