Skip to content

Commit 9b7a728

Browse files
committed
Java: Autoformat.
1 parent fb90c2b commit 9b7a728

File tree

63 files changed

+425
-310
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+425
-310
lines changed

java/ql/src/Advisory/Documentation/SpuriousJavadocParam.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ where
2222
not exists(TypeVariable tv | tv.getGenericCallable() = callable |
2323
"<" + tv.getName() + ">" = paramTag.getParamName()
2424
) and
25-
msg = "@param tag \"" + paramTag.getParamName() + "\" does not match any actual parameter of " +
25+
msg =
26+
"@param tag \"" + paramTag.getParamName() + "\" does not match any actual parameter of " +
2627
what + " \"" + callable.getName() + "()\"."
2728
else
2829
// The tag has no value at all.

java/ql/src/AlertSuppressionAnnotations.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ class SuppressionAnnotation extends SuppressWarningsAnnotation {
3838
}
3939

4040
private Annotation firstAnnotation() {
41-
result = min(this.getASiblingAnnotation() as m
41+
result =
42+
min(this.getASiblingAnnotation() as m
4243
order by
4344
m.getLocation().getStartLine(), m.getLocation().getStartColumn()
4445
)

java/ql/src/Compatibility/JDK9/JdkInternalsReplacement.qll

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,21 @@ predicate jdkInternalReplacement(string old, string new) {
1111
}
1212

1313
private predicate jdkInternalReplacement(string r) {
14-
r = "com.sun.crypto.provider.SunJCE=Use java.security.Security.getProvider(provider-name) @since 1.3" or
14+
r =
15+
"com.sun.crypto.provider.SunJCE=Use java.security.Security.getProvider(provider-name) @since 1.3" or
1516
r = "com.sun.org.apache.xml.internal.security=Use java.xml.crypto @since 1.6" or
1617
r = "com.sun.org.apache.xml.internal.security.utils.Base64=Use java.util.Base64 @since 1.8" or
1718
r = "com.sun.org.apache.xml.internal.resolver=Use javax.xml.catalog @since 9" or
1819
r = "com.sun.net.ssl=Use javax.net.ssl @since 1.4" or
19-
r = "com.sun.net.ssl.internal.ssl.Provider=Use java.security.Security.getProvider(provider-name) @since 1.3" or
20+
r =
21+
"com.sun.net.ssl.internal.ssl.Provider=Use java.security.Security.getProvider(provider-name) @since 1.3" or
2022
r = "com.sun.rowset=Use javax.sql.rowset.RowSetProvider @since 1.7" or
2123
r = "com.sun.tools.javac.tree=Use com.sun.source @since 1.6" or
2224
r = "com.sun.tools.javac=Use javax.tools and javax.lang.model @since 1.6" or
2325
r = "java.awt.peer=Should not use. See https://bugs.openjdk.java.net/browse/JDK-8037739" or
2426
r = "java.awt.dnd.peer=Should not use. See https://bugs.openjdk.java.net/browse/JDK-8037739" or
25-
r = "jdk.internal.ref.Cleaner=Use java.lang.ref.PhantomReference @since 1.2 or java.lang.ref.Cleaner @since 9" or
27+
r =
28+
"jdk.internal.ref.Cleaner=Use java.lang.ref.PhantomReference @since 1.2 or java.lang.ref.Cleaner @since 9" or
2629
r = "sun.awt.CausedFocusEvent=Use java.awt.event.FocusEvent::getCause @since 9" or
2730
r = "sun.font.FontUtilities=See java.awt.Font.textRequiresLayout @since 9" or
2831
r = "sun.reflect.Reflection=Use java.lang.StackWalker @since 9" or
@@ -32,10 +35,13 @@ private predicate jdkInternalReplacement(string r) {
3235
r = "sun.misc.SignalHandler=See http://openjdk.java.net/jeps/260" or
3336
r = "sun.security.action=Use java.security.PrivilegedAction @since 1.1" or
3437
r = "sun.security.krb5=Use com.sun.security.jgss" or
35-
r = "sun.security.provider.PolicyFile=Use java.security.Policy.getInstance(\"JavaPolicy\", new URIParameter(uri)) @since 1.6" or
38+
r =
39+
"sun.security.provider.PolicyFile=Use java.security.Policy.getInstance(\"JavaPolicy\", new URIParameter(uri)) @since 1.6" or
3640
r = "sun.security.provider.Sun=Use java.security.Security.getProvider(provider-name) @since 1.3" or
37-
r = "sun.security.util.HostnameChecker=Use javax.net.ssl.SSLParameters.setEndpointIdentificationAlgorithm(\"HTTPS\") @since 1.7 or javax.net.ssl.HttpsURLConnection.setHostnameVerifier() @since 1.4" or
38-
r = "sun.security.util.SecurityConstants=Use appropriate java.security.Permission subclass @since 1.1" or
41+
r =
42+
"sun.security.util.HostnameChecker=Use javax.net.ssl.SSLParameters.setEndpointIdentificationAlgorithm(\"HTTPS\") @since 1.7 or javax.net.ssl.HttpsURLConnection.setHostnameVerifier() @since 1.4" or
43+
r =
44+
"sun.security.util.SecurityConstants=Use appropriate java.security.Permission subclass @since 1.1" or
3945
r = "sun.security.x509.X500Name=Use javax.security.auth.x500.X500Principal @since 1.4" or
4046
r = "sun.tools.jar=Use java.util.jar or jar tool @since 1.2" or
4147
// Internal APIs removed in JDK 9
@@ -45,7 +51,8 @@ private predicate jdkInternalReplacement(string r) {
4551
r = "sun.awt.image.codec=Use javax.imageio @since 1.4" or
4652
r = "sun.misc.BASE64Encoder=Use java.util.Base64 @since 1.8" or
4753
r = "sun.misc.BASE64Decoder=Use java.util.Base64 @since 1.8" or
48-
r = "sun.misc.Cleaner=Use java.lang.ref.PhantomReference @since 1.2 or java.lang.ref.Cleaner @since 9" or
54+
r =
55+
"sun.misc.Cleaner=Use java.lang.ref.PhantomReference @since 1.2 or java.lang.ref.Cleaner @since 9" or
4956
r = "sun.misc.Service=Use java.util.ServiceLoader @since 1.6" or
5057
r = "sun.misc=Removed. See http://openjdk.java.net/jeps/260" or
5158
r = "sun.reflect=Removed. See http://openjdk.java.net/jeps/260"

java/ql/src/Likely Bugs/Concurrency/DoubleCheckedLocking.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ where
3030
// Non-volatile double-checked locking is ok when the object is immutable and
3131
// there is only a single non-synchronized field read.
3232
immutableFieldType(f.getType()) and
33-
1 = strictcount(FieldAccess fa |
33+
1 =
34+
strictcount(FieldAccess fa |
3435
fa.getField() = f and
3536
fa.getEnclosingCallable() = sync.getEnclosingCallable() and
3637
not fa.getEnclosingStmt().getEnclosingStmt*() = sync.getBlock()

java/ql/src/Likely Bugs/Concurrency/InconsistentAccess.ql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ class MyField extends Field {
5353
}
5454

5555
int getNumSynchedAccesses() {
56-
result = count(Expr synched |
57-
synched = this.getAnAccess() and withinLocalSynchronization(synched)
58-
)
56+
result =
57+
count(Expr synched | synched = this.getAnAccess() and withinLocalSynchronization(synched))
5958
}
6059

6160
int getNumAccesses() { result = count(this.getAnAccess()) }

java/ql/src/Likely Bugs/Concurrency/LazyInitStaticField.ql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ class LockObjectField extends Field {
5151
class ValidSynchStmt extends Stmt {
5252
ValidSynchStmt() {
5353
// It's OK to lock the enclosing class.
54-
this.(SynchronizedStmt).getExpr().(TypeLiteral).getTypeName().getType() = this
55-
.getEnclosingCallable()
56-
.getDeclaringType()
54+
this.(SynchronizedStmt).getExpr().(TypeLiteral).getTypeName().getType() =
55+
this.getEnclosingCallable().getDeclaringType()
5756
or
5857
// It's OK to lock on a "lock object field".
5958
this.(SynchronizedStmt).getExpr().(FieldRead).getField() instanceof LockObjectField

java/ql/src/Likely Bugs/Likely Typos/UnusedFormatArg.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import semmle.code.java.StringFormat
1818
int getNumberOfReferencedIndices(FormattingCall fmtcall) {
1919
exists(int maxref, int skippedrefs |
2020
maxref = max(FormatString fmt | fmtcall.getAFormatString() = fmt | fmt.getMaxFmtSpecIndex()) and
21-
skippedrefs = count(int i |
21+
skippedrefs =
22+
count(int i |
2223
forex(FormatString fmt | fmtcall.getAFormatString() = fmt |
2324
i = fmt.getASkippedFmtSpecIndex()
2425
)

java/ql/src/Likely Bugs/Statements/ImpossibleCast.ql

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ where
6767
(
6868
// No unchecked operations, so the cast would crash straight away.
6969
not uncheckedCastType(target) and
70-
message = "Impossible downcast: the cast from " + source.getName() + "[] to " + target.getName()
71-
+ "[] will always fail with a ClassCastException."
70+
message =
71+
"Impossible downcast: the cast from " + source.getName() + "[] to " + target.getName() +
72+
"[] will always fail with a ClassCastException."
7273
or
7374
// For unchecked operations, the crash would not occur at the cast site,
7475
// but only if/when the value is assigned to a variable of different array type.
@@ -80,7 +81,8 @@ where
8081
returnedFrom(ce, ce.getEnclosingCallable()) and
8182
ce.getEnclosingCallable().getReturnType().(Array).getElementType() = target and
8283
not ce.getEnclosingCallable().isPrivate() and
83-
message = "Impossible downcast: this is returned by " + ce.getEnclosingCallable().getName() +
84+
message =
85+
"Impossible downcast: this is returned by " + ce.getEnclosingCallable().getName() +
8486
" as a value of type " + target.getName() + "[], but the array has type " + source.getName()
8587
+ "[]. Callers of " + ce.getEnclosingCallable().getName() +
8688
" may fail with a ClassCastException."
@@ -91,8 +93,9 @@ where
9193
returnedVariableFrom(v, m) and
9294
m.getReturnType().(Array).getElementType() = target and
9395
not m.isPrivate() and
94-
message = "Impossible downcast: this is assigned to " + v.getName() + " which is returned by "
95-
+ m + " as a value of type " + target.getName() + "[], but the array has type " +
96+
message =
97+
"Impossible downcast: this is assigned to " + v.getName() + " which is returned by " + m +
98+
" as a value of type " + target.getName() + "[], but the array has type " +
9699
source.getName() + "[]. Callers of " + m.getName() +
97100
" may fail with a ClassCastException."
98101
)

java/ql/src/Likely Bugs/Statements/ReturnValueIgnored.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ predicate methodStats(Method m, int used, int total, int percentage) {
8888
}
8989

9090
int chainedUses(Method m) {
91-
result = count(MethodAccess ma, MethodAccess qual |
91+
result =
92+
count(MethodAccess ma, MethodAccess qual |
9293
ma.getMethod() = m and
9394
ma.getQualifier() = qual and
9495
qual.getMethod() = m

java/ql/src/Metrics/Authors/AuthorsPerFile.ql

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

1414
from CompilationUnit u, int num
1515
where
16-
num = strictcount(string s |
17-
exists(Documentable d | d.getAuthor() = s and d.getCompilationUnit() = u)
18-
)
16+
num =
17+
strictcount(string s | exists(Documentable d | d.getAuthor() = s and d.getCompilationUnit() = u))
1918
select u, num

0 commit comments

Comments
 (0)