Skip to content

Commit c37dbb2

Browse files
Marcono1234smowton
authored andcommitted
Java: Override getAPrimaryQlClass() for more classes
1 parent 3cfd30e commit c37dbb2

File tree

6 files changed

+16
-0
lines changed

6 files changed

+16
-0
lines changed

java/ql/src/semmle/code/FileSystem.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ class Folder extends Container, @folder {
159159

160160
/** Gets the URL of this folder. */
161161
override string getURL() { result = "folder://" + getAbsolutePath() }
162+
163+
override string getAPrimaryQlClass() { result = "Folder" }
162164
}
163165

164166
/**
@@ -171,6 +173,8 @@ class File extends Container, @file {
171173

172174
/** Gets the URL of this file. */
173175
override string getURL() { result = "file://" + this.getAbsolutePath() + ":0:0:0:0" }
176+
177+
override string getAPrimaryQlClass() { result = "File" }
174178
}
175179

176180
/**
@@ -204,4 +208,6 @@ class JarFile extends File {
204208
string getManifestEntryAttribute(string entry, string key) {
205209
jarManifestEntries(this, entry, key, result)
206210
}
211+
212+
override string getAPrimaryQlClass() { result = "JarFile" }
207213
}

java/ql/src/semmle/code/java/Exception.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,6 @@ class Exception extends Element, @exception {
2727
override predicate hasName(string name) { this.getType().hasName(name) }
2828

2929
override string toString() { result = this.getType().toString() }
30+
31+
override string getAPrimaryQlClass() { result = "Exception" }
3032
}

java/ql/src/semmle/code/java/Modifier.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import Element
88
class Modifier extends Element, @modifier {
99
/** Gets the element to which this modifier applies. */
1010
Element getElement() { hasModifier(result, this) }
11+
12+
override string getAPrimaryQlClass() { result = "Modifier" }
1113
}
1214

1315
/** An element of the Java syntax tree that may have a modifier. */

java/ql/src/semmle/code/java/Package.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ class Package extends Element, Annotatable, @package {
2929
* since packages do not have locations.
3030
*/
3131
string getURL() { result = "file://:0:0:0:0" }
32+
33+
override string getAPrimaryQlClass() { result = "Package" }
3234
}

java/ql/src/semmle/code/java/Variable.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ class LocalVariableDecl extends @localvar, LocalScopeVariable {
5353

5454
/** Gets the initializer expression of this local variable declaration. */
5555
override Expr getInitializer() { result = getDeclExpr().getInit() }
56+
57+
override string getAPrimaryQlClass() { result = "LocalVariableDecl" }
5658
}
5759

5860
/** A formal parameter of a callable. */

java/ql/src/semmle/code/xml/XML.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ class XMLFile extends XMLParent, File {
149149

150150
/** Gets a DTD associated with this XML file. */
151151
XMLDTD getADTD() { xmlDTDs(result, _, _, _, this) }
152+
153+
override string getAPrimaryQlClass() { result = "XMLFile" }
152154
}
153155

154156
/**

0 commit comments

Comments
 (0)