Java: Autoformat qls.

This commit is contained in:
Anders Schack-Mulligen
2019-02-12 13:45:09 +01:00
parent 63a4dd09ad
commit 25469637db
10 changed files with 36 additions and 12 deletions

View File

@@ -12,7 +12,9 @@
import java
class CharType extends PrimitiveType { CharType() { this.hasName("char") } }
class CharType extends PrimitiveType {
CharType() { this.hasName("char") }
}
private Type getABranchType(ConditionalExpr ce) {
result = ce.getTrueExpr().getType() or

View File

@@ -16,7 +16,9 @@
import java
/** A comparison (using `==`) with `null`. */
class NullEQExpr extends EQExpr { NullEQExpr() { exists(NullLiteral l | l.getParent() = this) } }
class NullEQExpr extends EQExpr {
NullEQExpr() { exists(NullLiteral l | l.getParent() = this) }
}
/** An assignment to a static field. */
class StaticFieldInit extends AssignExpr {

View File

@@ -15,7 +15,9 @@ import semmle.code.java.Collections
import semmle.code.java.Maps
/** A union of the possible kinds of container size calls. */
abstract class SizeOfContainer extends Expr { abstract string getContainerKind(); }
abstract class SizeOfContainer extends Expr {
abstract string getContainerKind();
}
/** A read access to the `length` field of an array. */
class ArrayLengthRead extends FieldRead, SizeOfContainer {

View File

@@ -16,7 +16,9 @@ import semmle.code.java.Statement
import semmle.code.java.JDK
/** A use of `+` that has type `String`. */
class StringCat extends AddExpr { StringCat() { this.getType() instanceof TypeString } }
class StringCat extends AddExpr {
StringCat() { this.getType() instanceof TypeString }
}
/**
* An assignment of the form

View File

@@ -39,7 +39,9 @@ predicate emptyArrayLiteral(Expr e) {
)
}
class EmptyArrayLiteral extends Expr { EmptyArrayLiteral() { emptyArrayLiteral(this) } }
class EmptyArrayLiteral extends Expr {
EmptyArrayLiteral() { emptyArrayLiteral(this) }
}
from EmptyArrayLiteral l, MethodAccess ma, Method m, GenericInterface coll
where

View File

@@ -21,9 +21,13 @@ abstract class ExtremeValueField extends Field {
ExtremeValueField() { getType() instanceof IntegralType }
}
class MinValueField extends ExtremeValueField { MinValueField() { this.getName() = "MIN_VALUE" } }
class MinValueField extends ExtremeValueField {
MinValueField() { this.getName() = "MIN_VALUE" }
}
class MaxValueField extends ExtremeValueField { MaxValueField() { this.getName() = "MAX_VALUE" } }
class MaxValueField extends ExtremeValueField {
MaxValueField() { this.getName() = "MAX_VALUE" }
}
class ExtremeSource extends VarAccess {
ExtremeSource() { this.getVariable() instanceof ExtremeValueField }

View File

@@ -12,7 +12,9 @@
import java
import HardcodedCredentials
class EqualsAccess extends MethodAccess { EqualsAccess() { getMethod() instanceof EqualsMethod } }
class EqualsAccess extends MethodAccess {
EqualsAccess() { getMethod() instanceof EqualsMethod }
}
from EqualsAccess sink, HardcodedExpr source, PasswordVariable p
where

View File

@@ -25,7 +25,9 @@ class TypeShiroWCPermission extends RefType {
}
}
abstract class PermissionsConstruction extends Top { abstract Expr getInput(); }
abstract class PermissionsConstruction extends Top {
abstract Expr getInput();
}
class PermissionsCheckMethodAccess extends MethodAccess, PermissionsConstruction {
PermissionsCheckMethodAccess() {

View File

@@ -12,7 +12,9 @@
import semmle.code.java.Member
class ConstantField extends Field { ConstantField() { this.isStatic() and this.isFinal() } }
class ConstantField extends Field {
ConstantField() { this.isStatic() and this.isFinal() }
}
pragma[noinline]
predicate typeWithConstantField(RefType t) { exists(ConstantField f | f.getDeclaringType() = t) }

View File

@@ -12,10 +12,14 @@
import java
/** An expression of primitive type. */
class PrimitiveExpr extends Expr { PrimitiveExpr() { this.getType() instanceof PrimitiveType } }
class PrimitiveExpr extends Expr {
PrimitiveExpr() { this.getType() instanceof PrimitiveType }
}
/** An expression of boxed type. */
class BoxedExpr extends Expr { BoxedExpr() { this.getType() instanceof BoxedType } }
class BoxedExpr extends Expr {
BoxedExpr() { this.getType() instanceof BoxedType }
}
/**
* Relate expressions and the variables they flow into in one step,