mirror of
https://github.com/github/codeql.git
synced 2026-04-23 07:45:17 +02:00
Merge pull request #13025 from cklin/java-location-tostring-bindingset
Java: Add pragma[only_bind_out] to Top::toString() calls
This commit is contained in:
@@ -26,7 +26,7 @@ class Exception extends Element, @exception {
|
||||
/** Holds if this exception has the specified `name`. */
|
||||
override predicate hasName(string name) { this.getType().hasName(name) }
|
||||
|
||||
override string toString() { result = this.getType().toString() }
|
||||
override string toString() { result = pragma[only_bind_out](this.getType()).toString() }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "Exception" }
|
||||
}
|
||||
|
||||
@@ -1644,7 +1644,9 @@ class TypeLiteral extends Expr, @typeliteral {
|
||||
Type getReferencedType() { result = this.getTypeName().getType() }
|
||||
|
||||
/** Gets a printable representation of this expression. */
|
||||
override string toString() { result = this.getTypeName().toString() + ".class" }
|
||||
override string toString() {
|
||||
result = pragma[only_bind_out](this.getTypeName()).toString() + ".class"
|
||||
}
|
||||
|
||||
override string getAPrimaryQlClass() { result = "TypeLiteral" }
|
||||
}
|
||||
@@ -1752,7 +1754,7 @@ class VarAccess extends Expr, @varaccess {
|
||||
exists(Expr q | q = this.getQualifier() |
|
||||
if q.isParenthesized()
|
||||
then result = "(...)." + this.getVariable().getName()
|
||||
else result = q.toString() + "." + this.getVariable().getName()
|
||||
else result = pragma[only_bind_out](q).toString() + "." + this.getVariable().getName()
|
||||
)
|
||||
or
|
||||
not this.hasQualifier() and result = this.getVariable().getName()
|
||||
|
||||
@@ -27,7 +27,9 @@ class ImportType extends Import {
|
||||
/** Gets the imported type. */
|
||||
ClassOrInterface getImportedType() { imports(this, result, _, _) }
|
||||
|
||||
override string toString() { result = "import " + this.getImportedType().toString() }
|
||||
override string toString() {
|
||||
result = "import " + pragma[only_bind_out](this.getImportedType()).toString()
|
||||
}
|
||||
|
||||
override string getAPrimaryQlClass() { result = "ImportType" }
|
||||
}
|
||||
@@ -49,7 +51,9 @@ class ImportOnDemandFromType extends Import {
|
||||
/** Gets an imported type. */
|
||||
NestedType getAnImport() { result.getEnclosingType() = this.getTypeHoldingImport() }
|
||||
|
||||
override string toString() { result = "import " + this.getTypeHoldingImport().toString() + ".*" }
|
||||
override string toString() {
|
||||
result = "import " + pragma[only_bind_out](this.getTypeHoldingImport()).toString() + ".*"
|
||||
}
|
||||
|
||||
override string getAPrimaryQlClass() { result = "ImportOnDemandFromType" }
|
||||
}
|
||||
@@ -71,7 +75,7 @@ class ImportOnDemandFromPackage extends Import {
|
||||
|
||||
/** Gets a printable representation of this import declaration. */
|
||||
override string toString() {
|
||||
result = "import " + this.getPackageHoldingImport().toString() + ".*"
|
||||
result = "import " + pragma[only_bind_out](this.getPackageHoldingImport()).toString() + ".*"
|
||||
}
|
||||
|
||||
override string getAPrimaryQlClass() { result = "ImportOnDemandFromPackage" }
|
||||
@@ -100,7 +104,7 @@ class ImportStaticOnDemand extends Import {
|
||||
|
||||
/** Gets a printable representation of this import declaration. */
|
||||
override string toString() {
|
||||
result = "import static " + this.getTypeHoldingImport().toString() + ".*"
|
||||
result = "import static " + pragma[only_bind_out](this.getTypeHoldingImport()).toString() + ".*"
|
||||
}
|
||||
|
||||
override string getAPrimaryQlClass() { result = "ImportStaticOnDemand" }
|
||||
@@ -141,7 +145,9 @@ class ImportStaticTypeMember extends Import {
|
||||
|
||||
/** Gets a printable representation of this import declaration. */
|
||||
override string toString() {
|
||||
result = "import static " + this.getTypeHoldingImport().toString() + "." + this.getName()
|
||||
result =
|
||||
"import static " + pragma[only_bind_out](this.getTypeHoldingImport()).toString() + "." +
|
||||
this.getName()
|
||||
}
|
||||
|
||||
override string getAPrimaryQlClass() { result = "ImportStaticTypeMember" }
|
||||
|
||||
@@ -804,7 +804,9 @@ class AnonymousClass extends NestedClass {
|
||||
// Include super.toString, i.e. the name given in the database, because for Kotlin anonymous
|
||||
// classes we can get specialisations of anonymous generic types, and this will supply the
|
||||
// trailing type arguments.
|
||||
result = "new " + this.getClassInstanceExpr().getTypeName() + "(...) { ... }" + super.toString()
|
||||
result =
|
||||
"new " + pragma[only_bind_out](this.getClassInstanceExpr().getTypeName()).toString() +
|
||||
"(...) { ... }" + super.toString()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user