forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOverridePackagePrivate.ql
More file actions
24 lines (22 loc) · 868 Bytes
/
OverridePackagePrivate.ql
File metadata and controls
24 lines (22 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
* @name Confusing non-overriding of package-private method
* @description A method that appears to override another method but does not, because the
* declaring classes are in different packages, is potentially confusing.
* @kind problem
* @problem.severity warning
* @precision medium
* @id java/non-overriding-package-private
* @suites security-and-quality
* @tags maintainability
* readability
*/
import java
from Method superMethod, Method method
where
overridesIgnoringAccess(method, _, superMethod, _) and
not method.overrides(superMethod) and
not superMethod.isPublic() and
not superMethod.isProtected() and
not superMethod.isPrivate()
select method, "This method does not override $@ because it is private to another package.",
superMethod, superMethod.getDeclaringType().getName() + "." + superMethod.getName()