Skip to content

Commit 9b74e9c

Browse files
committed
Java: Autoformat cookbook examples.
1 parent 34cdf7c commit 9b74e9c

16 files changed

+50
-40
lines changed

java/ql/examples/snippets/castexpr.ql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import java
1212

1313
from CastExpr c
14-
where c.getExpr().getType() instanceof FloatingPointType
15-
and c.getType() instanceof IntegralType
14+
where
15+
c.getExpr().getType() instanceof FloatingPointType and
16+
c.getType() instanceof IntegralType
1617
select c

java/ql/examples/snippets/catch_exception.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* try
77
* exception
88
*/
9-
9+
1010
import java
1111

1212
from CatchClause catch

java/ql/examples/snippets/constructor_call.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* constructor
77
* new
88
*/
9-
9+
1010
import java
1111

1212
from ClassInstanceExpr new

java/ql/examples/snippets/eq_true.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* test
77
* boolean
88
*/
9-
9+
1010
import java
1111

1212
from EqualityTest eq

java/ql/examples/snippets/extend_class.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* subtype
1010
* supertype
1111
*/
12-
12+
1313
import java
1414

1515
from RefType type

java/ql/examples/snippets/field_read.ql

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
* @tags field
66
* read
77
*/
8-
8+
99
import java
1010

1111
from Field f, FieldRead read
12-
where f.hasName("aField")
13-
and f.getDeclaringType().hasQualifiedName("com.example", "Class")
14-
and f = read.getField()
12+
where
13+
f.hasName("aField") and
14+
f.getDeclaringType().hasQualifiedName("com.example", "Class") and
15+
f = read.getField()
1516
select read

java/ql/examples/snippets/integer_literal.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @tags integer
66
* literal
77
*/
8-
8+
99
import java
1010

1111
from IntegerLiteral literal

java/ql/examples/snippets/method_call.ql

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
* @tags call
66
* method
77
*/
8-
8+
99
import java
1010

1111
from MethodAccess call, Method method
12-
where call.getMethod() = method
13-
and method.hasName("methodName")
14-
and method.getDeclaringType().hasQualifiedName("com.example", "Class")
12+
where
13+
call.getMethod() = method and
14+
method.hasName("methodName") and
15+
method.getDeclaringType().hasQualifiedName("com.example", "Class")
1516
select call

java/ql/examples/snippets/mutualrecursion.ql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
import java
1010

1111
from Method m, Method n
12-
where exists(MethodAccess ma | ma.getCaller() = m and ma.getCallee() = n)
13-
and exists(MethodAccess ma | ma.getCaller() = n and ma.getCallee() = m)
14-
and m != n
12+
where
13+
exists(MethodAccess ma | ma.getCaller() = m and ma.getCallee() = n) and
14+
exists(MethodAccess ma | ma.getCaller() = n and ma.getCallee() = m) and
15+
m != n
1516
select m, n

java/ql/examples/snippets/null_argument.ql

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
* collection
99
* add
1010
*/
11-
11+
1212
import java
1313

1414
from MethodAccess call, Method add
15-
where call.getMethod().overrides*(add)
16-
and add.hasName("add")
17-
and add.getDeclaringType().getSourceDeclaration().hasQualifiedName("java.util", "Collection")
18-
and call.getAnArgument() instanceof NullLiteral
15+
where
16+
call.getMethod().overrides*(add) and
17+
add.hasName("add") and
18+
add.getDeclaringType().getSourceDeclaration().hasQualifiedName("java.util", "Collection") and
19+
call.getAnArgument() instanceof NullLiteral
1920
select call

0 commit comments

Comments
 (0)