We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4d2a3b3 + 6dd14a6 commit bbb6d08Copy full SHA for bbb6d08
java/ql/lib/semmle/code/java/Reflection.qll
@@ -355,9 +355,11 @@ class ReflectiveMethodAccess extends ClassMethodAccess {
355
then
356
// The method must be declared on the type itself.
357
result.getDeclaringType() = this.getInferredClassType()
358
- else
359
- // The method may be declared on an inferred type or a super-type.
+ else (
+ // The method must be public, and declared or inherited by the inferred class type.
360
+ result.isPublic() and
361
this.getInferredClassType().inherits(result)
362
+ )
363
) and
364
// Only consider instances where the method name is provided as a `StringLiteral`.
365
result.hasName(this.getArgument(0).(StringLiteral).getValue())
0 commit comments