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.
getMethod
1 parent 3119885 commit 6dd14a6Copy full SHA for 6dd14a6
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