GeezerVison is showing github.com — add explicit this qualifier on all of java · github/codeql@caeeebf
File treeExpand file treeCollapse file tree Open diff view settings experimental/Security/CWE/CWE-016
Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/external/ExternalArtifact.qll +10-9Lines changed: 10 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -3,24 +3,25 @@ import java | 3 | 3 | class ExternalData extends @externalDataElement { | 4 | 4 | string getDataPath() { externalData(this, result, _, _) } | 5 | 5 |
| 6 | | - string getQueryPath() { result = getDataPath().regexpReplaceAll("\\.[^.]*$", ".ql") } | | 6 | + string getQueryPath() { result = this.getDataPath().regexpReplaceAll("\\.[^.]*$", ".ql") } | 7 | 7 |
| 8 | 8 | int getNumFields() { result = 1 + max(int i | externalData(this, _, i, _) | i) } | 9 | 9 |
| 10 | 10 | string getField(int index) { externalData(this, _, index, result) } | 11 | 11 |
| 12 | | - int getFieldAsInt(int index) { result = getField(index).toInt() } | | 12 | + int getFieldAsInt(int index) { result = this.getField(index).toInt() } | 13 | 13 |
| 14 | | - float getFieldAsFloat(int index) { result = getField(index).toFloat() } | | 14 | + float getFieldAsFloat(int index) { result = this.getField(index).toFloat() } | 15 | 15 |
| 16 | | - date getFieldAsDate(int index) { result = getField(index).toDate() } | | 16 | + date getFieldAsDate(int index) { result = this.getField(index).toDate() } | 17 | 17 |
| 18 | | - string toString() { result = getQueryPath() + ": " + buildTupleString(0) } | | 18 | + string toString() { result = this.getQueryPath() + ": " + this.buildTupleString(0) } | 19 | 19 |
| 20 | 20 | private string buildTupleString(int start) { | 21 | | - start = getNumFields() - 1 and result = getField(start) | | 21 | + start = this.getNumFields() - 1 and result = this.getField(start) | 22 | 22 | or | 23 | | - start < getNumFields() - 1 and result = getField(start) + "," + buildTupleString(start + 1) | | 23 | + start < this.getNumFields() - 1 and | | 24 | + result = this.getField(start) + "," + this.buildTupleString(start + 1) | 24 | 25 | } | 25 | 26 | } | 26 | 27 |
| @@ -33,7 +34,7 @@ class DefectExternalData extends ExternalData { | 33 | 34 | this.getNumFields() = 2 | 34 | 35 | } | 35 | 36 |
| 36 | | - string getURL() { result = getField(0) } | | 37 | + string getURL() { result = this.getField(0) } | 37 | 38 |
| 38 | | - string getMessage() { result = getField(1) } | | 39 | + string getMessage() { result = this.getField(1) } | 39 | 40 | } |
Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/FileSystem.qll +21-13Lines changed: 21 additions & 13 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -47,7 +47,7 @@ class Container extends @container, Top { | 47 | 47 | */ | 48 | 48 | string getRelativePath() { | 49 | 49 | exists(string absPath, string pref | | 50 | | - absPath = getAbsolutePath() and sourceLocationPrefix(pref) | | 50 | + absPath = this.getAbsolutePath() and sourceLocationPrefix(pref) | 51 | 51 | | | 52 | 52 | absPath = pref and result = "" | 53 | 53 | or | @@ -74,7 +74,7 @@ class Container extends @container, Top { | 74 | 74 | * </table> | 75 | 75 | */ | 76 | 76 | string getBaseName() { | 77 | | - result = getAbsolutePath().regexpCapture(".*/(([^/]*?)(?:\\.([^.]*))?)", 1) | | 77 | + result = this.getAbsolutePath().regexpCapture(".*/(([^/]*?)(?:\\.([^.]*))?)", 1) | 78 | 78 | } | 79 | 79 |
| 80 | 80 | /** | @@ -100,7 +100,9 @@ class Container extends @container, Top { | 100 | 100 | * <tr><td>"/tmp/x.tar.gz"</td><td>"gz"</td></tr> | 101 | 101 | * </table> | 102 | 102 | */ | 103 | | - string getExtension() { result = getAbsolutePath().regexpCapture(".*/([^/]*?)(\\.([^.]*))?", 3) } | | 103 | + string getExtension() { | | 104 | + result = this.getAbsolutePath().regexpCapture(".*/([^/]*?)(\\.([^.]*))?", 3) | | 105 | + } | 104 | 106 |
| 105 | 107 | /** | 106 | 108 | * Gets the stem of this container, that is, the prefix of its base name up to | @@ -119,7 +121,9 @@ class Container extends @container, Top { | 119 | 121 | * <tr><td>"/tmp/x.tar.gz"</td><td>"x.tar"</td></tr> | 120 | 122 | * </table> | 121 | 123 | */ | 122 | | - string getStem() { result = getAbsolutePath().regexpCapture(".*/([^/]*?)(?:\\.([^.]*))?", 1) } | | 124 | + string getStem() { | | 125 | + result = this.getAbsolutePath().regexpCapture(".*/([^/]*?)(?:\\.([^.]*))?", 1) | | 126 | + } | 123 | 127 |
| 124 | 128 | /** Gets the parent container of this file or folder, if any. */ | 125 | 129 | Container getParentContainer() { containerparent(result, this) } | @@ -128,20 +132,20 @@ class Container extends @container, Top { | 128 | 132 | Container getAChildContainer() { this = result.getParentContainer() } | 129 | 133 |
| 130 | 134 | /** Gets a file in this container. */ | 131 | | - File getAFile() { result = getAChildContainer() } | | 135 | + File getAFile() { result = this.getAChildContainer() } | 132 | 136 |
| 133 | 137 | /** Gets the file in this container that has the given `baseName`, if any. */ | 134 | 138 | File getFile(string baseName) { | 135 | | - result = getAFile() and | | 139 | + result = this.getAFile() and | 136 | 140 | result.getBaseName() = baseName | 137 | 141 | } | 138 | 142 |
| 139 | 143 | /** Gets a sub-folder in this container. */ | 140 | | - Folder getAFolder() { result = getAChildContainer() } | | 144 | + Folder getAFolder() { result = this.getAChildContainer() } | 141 | 145 |
| 142 | 146 | /** Gets the sub-folder in this container that has the given `baseName`, if any. */ | 143 | 147 | Folder getFolder(string baseName) { | 144 | | - result = getAFolder() and | | 148 | + result = this.getAFolder() and | 145 | 149 | result.getBaseName() = baseName | 146 | 150 | } | 147 | 151 |
| @@ -152,15 +156,15 @@ class Container extends @container, Top { | 152 | 156 | * to provide a different result. To get the absolute path of any `Container`, call | 153 | 157 | * `Container.getAbsolutePath()` directly. | 154 | 158 | */ | 155 | | - override string toString() { result = getAbsolutePath() } | | 159 | + override string toString() { result = this.getAbsolutePath() } | 156 | 160 | } | 157 | 161 |
| 158 | 162 | /** A folder. */ | 159 | 163 | class Folder extends Container, @folder { | 160 | 164 | override string getAbsolutePath() { folders(this, result) } | 161 | 165 |
| 162 | 166 | /** Gets the URL of this folder. */ | 163 | | - override string getURL() { result = "folder://" + getAbsolutePath() } | | 167 | + override string getURL() { result = "folder://" + this.getAbsolutePath() } | 164 | 168 |
| 165 | 169 | override string getAPrimaryQlClass() { result = "Folder" } | 166 | 170 | } | @@ -183,7 +187,7 @@ class File extends Container, @file { | 183 | 187 | * A Java archive file with a ".jar" extension. | 184 | 188 | */ | 185 | 189 | class JarFile extends File { | 186 | | - JarFile() { getExtension() = "jar" } | | 190 | + JarFile() { this.getExtension() = "jar" } | 187 | 191 |
| 188 | 192 | /** | 189 | 193 | * Gets the main attribute with the specified `key` | @@ -195,13 +199,17 @@ class JarFile extends File { | 195 | 199 | * Gets the "Specification-Version" main attribute | 196 | 200 | * from this JAR file's manifest. | 197 | 201 | */ | 198 | | - string getSpecificationVersion() { result = getManifestMainAttribute("Specification-Version") } | | 202 | + string getSpecificationVersion() { | | 203 | + result = this.getManifestMainAttribute("Specification-Version") | | 204 | + } | 199 | 205 |
| 200 | 206 | /** | 201 | 207 | * Gets the "Implementation-Version" main attribute | 202 | 208 | * from this JAR file's manifest. | 203 | 209 | */ | 204 | | - string getImplementationVersion() { result = getManifestMainAttribute("Implementation-Version") } | | 210 | + string getImplementationVersion() { | | 211 | + result = this.getManifestMainAttribute("Implementation-Version") | | 212 | + } | 205 | 213 |
| 206 | 214 | /** | 207 | 215 | * Gets the per-entry attribute for the specified `entry` and `key` | |
Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/Location.qll +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -63,10 +63,10 @@ class Top extends @top { | 63 | 63 | predicate hasLocationInfo( | 64 | 64 | string filepath, int startline, int startcolumn, int endline, int endcolumn | 65 | 65 | ) { | 66 | | - hasLocationInfoAux(filepath, startline, startcolumn, endline, endcolumn) | | 66 | + this.hasLocationInfoAux(filepath, startline, startcolumn, endline, endcolumn) | 67 | 67 | or | 68 | 68 | exists(string outFilepath, int outStartline, int outEndline | | 69 | | - hasLocationInfoAux(outFilepath, outStartline, _, outEndline, _) and | | 69 | + this.hasLocationInfoAux(outFilepath, outStartline, _, outEndline, _) and | 70 | 70 | hasSmapLocationInfo(filepath, startline, startcolumn, endline, endcolumn, outFilepath, | 71 | 71 | outStartline, outEndline) | 72 | 72 | ) | @@ -103,7 +103,7 @@ class Top extends @top { | 103 | 103 | /** | 104 | 104 | * Gets a comma-separated list of the names of the primary CodeQL classes to which this element belongs. | 105 | 105 | */ | 106 | | - final string getPrimaryQlClasses() { result = concat(getAPrimaryQlClass(), ",") } | | 106 | + final string getPrimaryQlClasses() { result = concat(this.getAPrimaryQlClass(), ",") } | 107 | 107 |
| 108 | 108 | /** | 109 | 109 | * Gets the name of a primary CodeQL class to which this element belongs. | |
Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/java/Annotation.qll +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -51,7 +51,7 @@ class Annotation extends @annotation, Expr { | 51 | 51 | Expr getValue(string name) { filteredAnnotValue(this, this.getAnnotationElement(name), result) } | 52 | 52 |
| 53 | 53 | /** Gets the element being annotated. */ | 54 | | - Element getTarget() { result = getAnnotatedElement() } | | 54 | + Element getTarget() { result = this.getAnnotatedElement() } | 55 | 55 |
| 56 | 56 | override string toString() { result = this.getType().getName() } | 57 | 57 |
| @@ -67,8 +67,8 @@ class Annotation extends @annotation, Expr { | 67 | 67 | * expression defined for the value. | 68 | 68 | */ | 69 | 69 | Expr getAValue(string name) { | 70 | | - getType().getAnnotationElement(name).getType() instanceof Array and | 71 | | - exists(Expr value | value = getValue(name) | | | 70 | + this.getType().getAnnotationElement(name).getType() instanceof Array and | | 71 | + exists(Expr value | value = this.getValue(name) | | 72 | 72 | if value instanceof ArrayInit then result = value.(ArrayInit).getAnInit() else result = value | 73 | 73 | ) | 74 | 74 | } | @@ -104,7 +104,7 @@ class Annotatable extends Element { | 104 | 104 |
| 105 | 105 | /** Holds if this element has the specified annotation. */ | 106 | 106 | predicate hasAnnotation(string package, string name) { | 107 | | - exists(AnnotationType at | at = getAnAnnotation().getType() | | | 107 | + exists(AnnotationType at | at = this.getAnAnnotation().getType() | | 108 | 108 | at.nestedName() = name and at.getPackage().getName() = package | 109 | 109 | ) | 110 | 110 | } | @@ -118,7 +118,7 @@ class Annotatable extends Element { | 118 | 118 | * annotation attached to it for the specified `category`. | 119 | 119 | */ | 120 | 120 | predicate suppressesWarningsAbout(string category) { | 121 | | - category = getAnAnnotation().(SuppressWarningsAnnotation).getASuppressedWarning() | | 121 | + category = this.getAnAnnotation().(SuppressWarningsAnnotation).getASuppressedWarning() | 122 | 122 | or | 123 | 123 | this.(Member).getDeclaringType().suppressesWarningsAbout(category) | 124 | 124 | or | |
Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/java/ControlFlowGraph.qll +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -528,13 +528,13 @@ private module ControlFlowGraphImpl { | 528 | 528 |
| 529 | 529 | /** Gets the first child node, if any. */ | 530 | 530 | ControlFlowNode firstChild() { | 531 | | - result = getChildNode(-1) | | 531 | + result = this.getChildNode(-1) | 532 | 532 | or | 533 | | - result = getChildNode(0) and not exists(getChildNode(-1)) | | 533 | + result = this.getChildNode(0) and not exists(this.getChildNode(-1)) | 534 | 534 | } | 535 | 535 |
| 536 | 536 | /** Holds if this CFG node has any child nodes. */ | 537 | | - predicate isLeafNode() { not exists(getChildNode(_)) } | | 537 | + predicate isLeafNode() { not exists(this.getChildNode(_)) } | 538 | 538 |
| 539 | 539 | /** Holds if this node can finish with a `normalCompletion`. */ | 540 | 540 | predicate mayCompleteNormally() { | @@ -1222,10 +1222,10 @@ class ConditionNode extends ControlFlowNode { | 1222 | 1222 | ControlFlowNode getABranchSuccessor(boolean branch) { result = branchSuccessor(this, branch) } | 1223 | 1223 |
| 1224 | 1224 | /** Gets a true-successor of the `ConditionNode`. */ | 1225 | | - ControlFlowNode getATrueSuccessor() { result = getABranchSuccessor(true) } | | 1225 | + ControlFlowNode getATrueSuccessor() { result = this.getABranchSuccessor(true) } | 1226 | 1226 |
| 1227 | 1227 | /** Gets a false-successor of the `ConditionNode`. */ | 1228 | | - ControlFlowNode getAFalseSuccessor() { result = getABranchSuccessor(false) } | | 1228 | + ControlFlowNode getAFalseSuccessor() { result = this.getABranchSuccessor(false) } | 1229 | 1229 |
| 1230 | 1230 | /** Gets the condition of this `ConditionNode`. This is equal to the node itself. */ | 1231 | 1231 | Expr getCondition() { result = this } | |
Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/java/Conversions.qll +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -27,7 +27,7 @@ abstract class ConversionSite extends Expr { | 27 | 27 | /** | 28 | 28 | * Whether this conversion site actually induces a conversion. | 29 | 29 | */ | 30 | | - predicate isTrivial() { getConversionTarget() = getConversionSource() } | | 30 | + predicate isTrivial() { this.getConversionTarget() = this.getConversionSource() } | 31 | 31 |
| 32 | 32 | /** | 33 | 33 | * Whether this conversion is implicit. | |
Collapse file Copy file name to clipboardExpand all lines: java/ql/lib/semmle/code/java/Element.qll +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -34,10 +34,10 @@ class Element extends @element, Top { | 34 | 34 | * Elements pertaining to source files may include generated elements | 35 | 35 | * not visible in source code, such as implicit default constructors. | 36 | 36 | */ | 37 | | - predicate fromSource() { getCompilationUnit().getExtension() = "java" } | | 37 | + predicate fromSource() { this.getCompilationUnit().getExtension() = "java" } | 38 | 38 |
| 39 | 39 | /** Gets the compilation unit that this element belongs to. */ | 40 | | - CompilationUnit getCompilationUnit() { result = getFile() } | | 40 | + CompilationUnit getCompilationUnit() { result = this.getFile() } | 41 | 41 |
| 42 | 42 | /** Cast this element to a `Documentable`. */ | 43 | 43 | Documentable getDoc() { result = this } | |
|