Java: Autoformat QL

This commit is contained in:
Ian Lynagh
2022-02-25 19:08:08 +00:00
parent 691473bd6e
commit 0bf1370cd5
4 changed files with 7 additions and 11 deletions

View File

@@ -415,8 +415,7 @@ class EnableReplaceObjectMethod extends Method {
this.hasName("enableReplaceObject") and
this.getNumberOfParameters() = 1 and
this.getParameter(0).getType().(PrimitiveType).hasName("boolean") and
this.getDeclaringType().getAnAncestor().getSourceDeclaration() instanceof
TypeObjectOutputStream
this.getDeclaringType().getAnAncestor().getSourceDeclaration() instanceof TypeObjectOutputStream
}
}
@@ -429,8 +428,7 @@ class ReplaceObjectMethod extends Method {
this.hasName("replaceObject") and
this.getNumberOfParameters() = 1 and
this.getParameter(0).getType() instanceof TypeObject and
this.getDeclaringType().getAnAncestor().getSourceDeclaration() instanceof
TypeObjectOutputStream
this.getDeclaringType().getAnAncestor().getSourceDeclaration() instanceof TypeObjectOutputStream
}
}

View File

@@ -23,7 +23,8 @@ where
// completely to distinguish grammatical punctuation after which a space is
// needed, and intra-identifier punctuation in, for example, a fully
// qualified java class name.
pragma[only_bind_into](s).getLiteral()
pragma[only_bind_into](s)
.getLiteral()
.regexpCapture(".* (([-A-Za-z/'\\.:,]*[a-zA-Z]|[0-9]+)[\\.:,;!?']*)\"[^\"]*\\+[^\"]*\"[a-zA-Z].*",
1) = word and
not word.regexpMatch(".*[,\\.:].*[a-zA-Z].*[^a-zA-Z]")

View File

@@ -18,9 +18,8 @@ import semmle.code.java.Reflection
* Gets a transitive superType avoiding magic optimisation
*/
pragma[nomagic]
cached private RefType getASuperTypePlus(RefType t) {
hasDescendant(result, t) and result != t
}
cached
private RefType getASuperTypePlus(RefType t) { hasDescendant(result, t) and result != t }
/**
* A class or interface that is not used anywhere.

View File

@@ -37,9 +37,7 @@ class WebComponentMainMethod extends Method {
this.getDeclaringType() instanceof ServletClass or
this.getDeclaringType() instanceof ServletFilterClass or
this.getDeclaringType() instanceof ServletListenerClass or
this.getDeclaringType()
.getAnAncestor()
.hasQualifiedName("org.apache.struts.action", "Action") or // Struts actions
this.getDeclaringType().getAnAncestor().hasQualifiedName("org.apache.struts.action", "Action") or // Struts actions
this.getDeclaringType()
.getAStrictAncestor()
.hasQualifiedName("com.opensymphony.xwork2", "ActionSupport") or // Struts 2 actions