Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 63a4dd0

Browse files
committed
Java: Autoformat qlls.
1 parent c133362 commit 63a4dd0

33 files changed

Lines changed: 246 additions & 89 deletions

java/ql/src/Security/CWE/CWE-022/PathsCommon.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import java
22
import semmle.code.java.controlflow.Guards
33

4-
abstract class PathCreation extends Expr { abstract Expr getInput(); }
4+
abstract class PathCreation extends Expr {
5+
abstract Expr getInput();
6+
}
57

68
class PathsGet extends PathCreation, MethodAccess {
79
PathsGet() {

java/ql/src/external/Clover.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import java
55
* top-level children (usually, in fact, there is only one) is
66
* a tag with the name "coverage".
77
*/
8-
class CloverReport extends XMLFile { CloverReport() { this.getAChild().getName() = "coverage" } }
8+
class CloverReport extends XMLFile {
9+
CloverReport() { this.getAChild().getName() = "coverage" }
10+
}
911

1012
/**
1113
* The Clover "coverage" tag contains one or more "projects".

java/ql/src/semmle/code/configfiles/ConfigFiles.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,6 @@ class ConfigValue extends @configValue, ConfigLocatable {
6767
}
6868

6969
/** A Java property is a name-value pair in a `.properties` file. */
70-
class JavaProperty extends ConfigPair { JavaProperty() { getFile().getExtension() = "properties" } }
70+
class JavaProperty extends ConfigPair {
71+
JavaProperty() { getFile().getExtension() = "properties" }
72+
}

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

Lines changed: 90 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -513,28 +513,44 @@ class AssignOp extends Assignment, @assignop {
513513
}
514514

515515
/** A compound assignment expression using the `+=` operator. */
516-
class AssignAddExpr extends AssignOp, @assignaddexpr { override string getOp() { result = "+=" } }
516+
class AssignAddExpr extends AssignOp, @assignaddexpr {
517+
override string getOp() { result = "+=" }
518+
}
517519

518520
/** A compound assignment expression using the `-=` operator. */
519-
class AssignSubExpr extends AssignOp, @assignsubexpr { override string getOp() { result = "-=" } }
521+
class AssignSubExpr extends AssignOp, @assignsubexpr {
522+
override string getOp() { result = "-=" }
523+
}
520524

521525
/** A compound assignment expression using the `*=` operator. */
522-
class AssignMulExpr extends AssignOp, @assignmulexpr { override string getOp() { result = "*=" } }
526+
class AssignMulExpr extends AssignOp, @assignmulexpr {
527+
override string getOp() { result = "*=" }
528+
}
523529

524530
/** A compound assignment expression using the `/=` operator. */
525-
class AssignDivExpr extends AssignOp, @assigndivexpr { override string getOp() { result = "/=" } }
531+
class AssignDivExpr extends AssignOp, @assigndivexpr {
532+
override string getOp() { result = "/=" }
533+
}
526534

527535
/** A compound assignment expression using the `%=` operator. */
528-
class AssignRemExpr extends AssignOp, @assignremexpr { override string getOp() { result = "%=" } }
536+
class AssignRemExpr extends AssignOp, @assignremexpr {
537+
override string getOp() { result = "%=" }
538+
}
529539

530540
/** A compound assignment expression using the `&=` operator. */
531-
class AssignAndExpr extends AssignOp, @assignandexpr { override string getOp() { result = "&=" } }
541+
class AssignAndExpr extends AssignOp, @assignandexpr {
542+
override string getOp() { result = "&=" }
543+
}
532544

533545
/** A compound assignment expression using the `|=` operator. */
534-
class AssignOrExpr extends AssignOp, @assignorexpr { override string getOp() { result = "|=" } }
546+
class AssignOrExpr extends AssignOp, @assignorexpr {
547+
override string getOp() { result = "|=" }
548+
}
535549

536550
/** A compound assignment expression using the `^=` operator. */
537-
class AssignXorExpr extends AssignOp, @assignxorexpr { override string getOp() { result = "^=" } }
551+
class AssignXorExpr extends AssignOp, @assignxorexpr {
552+
override string getOp() { result = "^=" }
553+
}
538554

539555
/** A compound assignment expression using the `<<=` operator. */
540556
class AssignLShiftExpr extends AssignOp, @assignlshiftexpr {
@@ -643,37 +659,59 @@ class BinaryExpr extends Expr, @binaryexpr {
643659
}
644660

645661
/** A binary expression using the `*` operator. */
646-
class MulExpr extends BinaryExpr, @mulexpr { override string getOp() { result = " * " } }
662+
class MulExpr extends BinaryExpr, @mulexpr {
663+
override string getOp() { result = " * " }
664+
}
647665

648666
/** A binary expression using the `/` operator. */
649-
class DivExpr extends BinaryExpr, @divexpr { override string getOp() { result = " / " } }
667+
class DivExpr extends BinaryExpr, @divexpr {
668+
override string getOp() { result = " / " }
669+
}
650670

651671
/** A binary expression using the `%` operator. */
652-
class RemExpr extends BinaryExpr, @remexpr { override string getOp() { result = " % " } }
672+
class RemExpr extends BinaryExpr, @remexpr {
673+
override string getOp() { result = " % " }
674+
}
653675

654676
/** A binary expression using the `+` operator. */
655-
class AddExpr extends BinaryExpr, @addexpr { override string getOp() { result = " + " } }
677+
class AddExpr extends BinaryExpr, @addexpr {
678+
override string getOp() { result = " + " }
679+
}
656680

657681
/** A binary expression using the `-` operator. */
658-
class SubExpr extends BinaryExpr, @subexpr { override string getOp() { result = " - " } }
682+
class SubExpr extends BinaryExpr, @subexpr {
683+
override string getOp() { result = " - " }
684+
}
659685

660686
/** A binary expression using the `<<` operator. */
661-
class LShiftExpr extends BinaryExpr, @lshiftexpr { override string getOp() { result = " << " } }
687+
class LShiftExpr extends BinaryExpr, @lshiftexpr {
688+
override string getOp() { result = " << " }
689+
}
662690

663691
/** A binary expression using the `>>` operator. */
664-
class RShiftExpr extends BinaryExpr, @rshiftexpr { override string getOp() { result = " >> " } }
692+
class RShiftExpr extends BinaryExpr, @rshiftexpr {
693+
override string getOp() { result = " >> " }
694+
}
665695

666696
/** A binary expression using the `>>>` operator. */
667-
class URShiftExpr extends BinaryExpr, @urshiftexpr { override string getOp() { result = " >>> " } }
697+
class URShiftExpr extends BinaryExpr, @urshiftexpr {
698+
override string getOp() { result = " >>> " }
699+
}
668700

669701
/** A binary expression using the `&` operator. */
670-
class AndBitwiseExpr extends BinaryExpr, @andbitexpr { override string getOp() { result = " & " } }
702+
class AndBitwiseExpr extends BinaryExpr, @andbitexpr {
703+
override string getOp() { result = " & " }
704+
}
671705

672706
/** A binary expression using the `|` operator. */
673-
class OrBitwiseExpr extends BinaryExpr, @orbitexpr { override string getOp() { result = " | " } }
707+
class OrBitwiseExpr extends BinaryExpr, @orbitexpr {
708+
override string getOp() { result = " | " }
709+
}
674710

675711
/** A binary expression using the `^` operator. */
676-
class XorBitwiseExpr extends BinaryExpr, @xorbitexpr { override string getOp() { result = " ^ " } }
712+
class XorBitwiseExpr extends BinaryExpr, @xorbitexpr {
713+
override string getOp() { result = " ^ " }
714+
}
677715

678716
/** A binary expression using the `&&` operator. */
679717
class AndLogicalExpr extends BinaryExpr, @andlogicalexpr {
@@ -686,22 +724,34 @@ class OrLogicalExpr extends BinaryExpr, @orlogicalexpr {
686724
}
687725

688726
/** A binary expression using the `<` operator. */
689-
class LTExpr extends BinaryExpr, @ltexpr { override string getOp() { result = " < " } }
727+
class LTExpr extends BinaryExpr, @ltexpr {
728+
override string getOp() { result = " < " }
729+
}
690730

691731
/** A binary expression using the `>` operator. */
692-
class GTExpr extends BinaryExpr, @gtexpr { override string getOp() { result = " > " } }
732+
class GTExpr extends BinaryExpr, @gtexpr {
733+
override string getOp() { result = " > " }
734+
}
693735

694736
/** A binary expression using the `<=` operator. */
695-
class LEExpr extends BinaryExpr, @leexpr { override string getOp() { result = " <= " } }
737+
class LEExpr extends BinaryExpr, @leexpr {
738+
override string getOp() { result = " <= " }
739+
}
696740

697741
/** A binary expression using the `>=` operator. */
698-
class GEExpr extends BinaryExpr, @geexpr { override string getOp() { result = " >= " } }
742+
class GEExpr extends BinaryExpr, @geexpr {
743+
override string getOp() { result = " >= " }
744+
}
699745

700746
/** A binary expression using the `==` operator. */
701-
class EQExpr extends BinaryExpr, @eqexpr { override string getOp() { result = " == " } }
747+
class EQExpr extends BinaryExpr, @eqexpr {
748+
override string getOp() { result = " == " }
749+
}
702750

703751
/** A binary expression using the `!=` operator. */
704-
class NEExpr extends BinaryExpr, @neexpr { override string getOp() { result = " != " } }
752+
class NEExpr extends BinaryExpr, @neexpr {
753+
override string getOp() { result = " != " }
754+
}
705755

706756
/**
707757
* A bitwise expression.
@@ -852,16 +902,24 @@ class PreDecExpr extends UnaryAssignExpr, @predecexpr {
852902
}
853903

854904
/** A unary minus expression. For example, `-i`. */
855-
class MinusExpr extends UnaryExpr, @minusexpr { override string toString() { result = "-..." } }
905+
class MinusExpr extends UnaryExpr, @minusexpr {
906+
override string toString() { result = "-..." }
907+
}
856908

857909
/** A unary plus expression. For example, `+i`. */
858-
class PlusExpr extends UnaryExpr, @plusexpr { override string toString() { result = "+..." } }
910+
class PlusExpr extends UnaryExpr, @plusexpr {
911+
override string toString() { result = "+..." }
912+
}
859913

860914
/** A bit negation expression. For example, `~x`. */
861-
class BitNotExpr extends UnaryExpr, @bitnotexpr { override string toString() { result = "~..." } }
915+
class BitNotExpr extends UnaryExpr, @bitnotexpr {
916+
override string toString() { result = "~..." }
917+
}
862918

863919
/** A logical negation expression. For example, `!b`. */
864-
class LogNotExpr extends UnaryExpr, @lognotexpr { override string toString() { result = "!..." } }
920+
class LogNotExpr extends UnaryExpr, @lognotexpr {
921+
override string toString() { result = "!..." }
922+
}
865923

866924
/** A cast expression. */
867925
class CastExpr extends Expr, @castexpr {
@@ -1286,7 +1344,9 @@ class LValue extends VarAccess {
12861344
* a simple assignment, but it may occur as the destination of a compound assignment
12871345
* or a unary assignment.
12881346
*/
1289-
class RValue extends VarAccess { RValue() { this.isRValue() } }
1347+
class RValue extends VarAccess {
1348+
RValue() { this.isRValue() }
1349+
}
12901350

12911351
/** A method access is an invocation of a method with a list of arguments. */
12921352
class MethodAccess extends Expr, Call, @methodaccess {

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

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@ class TypeProcessBuilder extends Class {
2222
}
2323

2424
/** The class `java.lang.Runtime`. */
25-
class TypeRuntime extends Class { TypeRuntime() { hasQualifiedName("java.lang", "Runtime") } }
25+
class TypeRuntime extends Class {
26+
TypeRuntime() { hasQualifiedName("java.lang", "Runtime") }
27+
}
2628

2729
/** The class `java.lang.String`. */
28-
class TypeString extends Class { TypeString() { this.hasQualifiedName("java.lang", "String") } }
30+
class TypeString extends Class {
31+
TypeString() { this.hasQualifiedName("java.lang", "String") }
32+
}
2933

3034
/** The `length()` method of the class `java.lang.String`. */
3135
class StringLengthMethod extends Method {
@@ -43,7 +47,9 @@ class TypeStringBuilder extends Class {
4347
}
4448

4549
/** The class `java.lang.System`. */
46-
class TypeSystem extends Class { TypeSystem() { this.hasQualifiedName("java.lang", "System") } }
50+
class TypeSystem extends Class {
51+
TypeSystem() { this.hasQualifiedName("java.lang", "System") }
52+
}
4753

4854
/** The class `java.lang.Throwable`. */
4955
class TypeThrowable extends Class {
@@ -56,7 +62,9 @@ class TypeException extends Class {
5662
}
5763

5864
/** The class `java.lang.Error`. */
59-
class TypeError extends Class { TypeError() { this.hasQualifiedName("java.lang", "Error") } }
65+
class TypeError extends Class {
66+
TypeError() { this.hasQualifiedName("java.lang", "Error") }
67+
}
6068

6169
/** The class `java.lang.RuntimeException`. */
6270
class TypeRuntimeException extends Class {
@@ -89,7 +97,9 @@ class TypeConstructor extends Class {
8997
}
9098

9199
/** The class `java.lang.Math`. */
92-
class TypeMath extends Class { TypeMath() { this.hasQualifiedName("java.lang", "Math") } }
100+
class TypeMath extends Class {
101+
TypeMath() { this.hasQualifiedName("java.lang", "Math") }
102+
}
93103

94104
/** A numeric type, including both primitive and boxed types. */
95105
class NumericType extends Type {
@@ -131,18 +141,24 @@ class TypeObjectOutputStream extends RefType {
131141
}
132142

133143
/** The class `java.nio.file.Paths`. */
134-
class TypePaths extends Class { TypePaths() { this.hasQualifiedName("java.nio.file", "Paths") } }
144+
class TypePaths extends Class {
145+
TypePaths() { this.hasQualifiedName("java.nio.file", "Paths") }
146+
}
135147

136148
/** The type `java.nio.file.Path`. */
137-
class TypePath extends RefType { TypePath() { this.hasQualifiedName("java.nio.file", "Path") } }
149+
class TypePath extends RefType {
150+
TypePath() { this.hasQualifiedName("java.nio.file", "Path") }
151+
}
138152

139153
/** The class `java.nio.file.FileSystem`. */
140154
class TypeFileSystem extends Class {
141155
TypeFileSystem() { this.hasQualifiedName("java.nio.file", "FileSystem") }
142156
}
143157

144158
/** The class `java.io.File`. */
145-
class TypeFile extends Class { TypeFile() { this.hasQualifiedName("java.io", "File") } }
159+
class TypeFile extends Class {
160+
TypeFile() { this.hasQualifiedName("java.io", "File") }
161+
}
146162

147163
// --- Standard methods ---
148164
/**

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import Type
88
abstract class ManagedBean extends Interface { }
99

1010
/** An `MBean`. */
11-
class MBean extends ManagedBean { MBean() { this.getQualifiedName().matches("%MBean%") } }
11+
class MBean extends ManagedBean {
12+
MBean() { this.getQualifiedName().matches("%MBean%") }
13+
}
1214

1315
/** An `MXBean`. */
1416
class MXBean extends ManagedBean {

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,9 @@ abstract class InitializerMethod extends Method { }
504504
* A static initializer is a method that contains all static
505505
* field initializations and static initializer blocks.
506506
*/
507-
class StaticInitializer extends InitializerMethod { StaticInitializer() { hasName("<clinit>") } }
507+
class StaticInitializer extends InitializerMethod {
508+
StaticInitializer() { hasName("<clinit>") }
509+
}
508510

509511
/**
510512
* An instance initializer is a method that contains field initializations
@@ -604,4 +606,6 @@ class Field extends Member, ExprParent, @field, Variable {
604606
}
605607

606608
/** An instance field. */
607-
class InstanceField extends Field { InstanceField() { not this.isStatic() } }
609+
class InstanceField extends Field {
610+
InstanceField() { not this.isStatic() }
611+
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,9 @@ class SwitchStmt extends Stmt, @switchstmt {
404404
*
405405
* This includes both normal `case`s and the `default` case.
406406
*/
407-
class SwitchCase extends Stmt, @case { SwitchStmt getSwitch() { result.getACase() = this } }
407+
class SwitchCase extends Stmt, @case {
408+
SwitchStmt getSwitch() { result.getACase() = this }
409+
}
408410

409411
/** A constant `case` of a switch statement. */
410412
class ConstCase extends SwitchCase {

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,9 @@ class RefType extends Type, Annotatable, Modifiable, @reftype {
589589
}
590590

591591
/** A type that is the same as its source declaration. */
592-
class SrcRefType extends RefType { SrcRefType() { this.isSourceDeclaration() } }
592+
class SrcRefType extends RefType {
593+
SrcRefType() { this.isSourceDeclaration() }
594+
}
593595

594596
/** A class declaration. */
595597
class Class extends RefType, @class {
@@ -863,7 +865,9 @@ class PrimitiveType extends Type, @primitive {
863865
}
864866

865867
/** The type of the `null` literal. */
866-
class NullType extends Type, @primitive { NullType() { this.hasName("<nulltype>") } }
868+
class NullType extends Type, @primitive {
869+
NullType() { this.hasName("<nulltype>") }
870+
}
867871

868872
/** The `void` type. */
869873
class VoidType extends Type, @primitive {

java/ql/src/semmle/code/java/dataflow/InstanceAccess.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,9 @@ class InstanceAccessExt extends TInstanceAccessExt {
243243
/**
244244
* An access to an object's own instance.
245245
*/
246-
class OwnInstanceAccess extends InstanceAccessExt { OwnInstanceAccess() { isOwnInstanceAccess() } }
246+
class OwnInstanceAccess extends InstanceAccessExt {
247+
OwnInstanceAccess() { isOwnInstanceAccess() }
248+
}
247249

248250
/**
249251
* An access to an enclosing instance.

0 commit comments

Comments
 (0)