Skip to content

Commit 23b5c5d

Browse files
committed
Overlay: Add discarding for Java classes, interfaces & fields
1 parent 3134c0a commit 23b5c5d

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

java/ql/lib/semmle/code/java/Member.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,9 @@ class Field extends Member, ExprParent, @field, Variable {
848848
override string getAPrimaryQlClass() { result = "Field" }
849849
}
850850

851+
overlay[local]
852+
private class DiscardableField extends DiscardableReferableLocatable, @field { }
853+
851854
/** An instance field. */
852855
class InstanceField extends Field {
853856
InstanceField() { not this.isStatic() }

java/ql/lib/semmle/code/java/Type.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import Member
1616
import Modifier
1717
import JDK
1818

19+
private import semmle.code.java.Overlay
20+
1921
/**
2022
* Holds if reference type `t` is an immediate super-type of `sub`.
2123
*/
@@ -998,6 +1000,9 @@ class ClassOrInterface extends RefType, @classorinterface {
9981000
CompanionObject getCompanionObject() { type_companion_object(this, _, result) }
9991001
}
10001002

1003+
overlay[local]
1004+
private class DiscardableClassOrInterface extends DiscardableReferableLocatable, @classorinterface { }
1005+
10011006
private string getAPublicObjectMethodSignature() {
10021007
exists(Method m |
10031008
m.getDeclaringType() instanceof TypeObject and

0 commit comments

Comments
 (0)