Skip to content

Commit 830f02a

Browse files
committed
java: fixes from the CI bots
1 parent 93fc287 commit 830f02a

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

java/ql/lib/semmle/code/java/ConflictingAccess.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ module Modification {
159159
predicate isThreadSafeType(Type t) {
160160
t.(RefType).getSourceDeclaration().getName().matches(["Atomic%", "Concurrent%"])
161161
or
162-
t.(RefType).getSourceDeclaration().getName() in ["ThreadLocal"]
162+
t.(RefType).getSourceDeclaration().getName() = "ThreadLocal"
163163
or
164-
// Anything in `java.itul.concurrent` is thread safe.
164+
// Anything in `java.util.concurrent` is thread safe.
165165
// See https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/package-summary.html#MemoryVisibility
166166
t.(RefType).getPackage().getName() = "java.util.concurrent"
167167
or
@@ -303,7 +303,7 @@ class ClassAnnotatedAsThreadSafe extends Class {
303303
)
304304
}
305305

306-
/** Holds if `a` can be reached by a path from a public method and `e` is the expression in that method that stsarts the path. */
306+
/** Holds if `a` can be reached by a path from a public method and `e` is the expression in that method that starts the path. */
307307
predicate publicAccess(Expr e, ExposedFieldAccess a) {
308308
exists(Method m | m.isPublic() | this.providesAccess(m, e, a))
309309
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ predicate isAssignedDefaultValue(Field f) {
7777
}
7878

7979
predicate isSafelyPublished(Field f) {
80-
f.isFinal() or // TODO: Consider non-primitive types
80+
f.isFinal() or // NOTE: For non-primitive types, 'final' alone does not guarantee safe publication unless the object is immutable or safely constructed. Consider reviewing the handling of non-primitive fields for safe publication.
8181
f.isStatic() or
8282
f.isVolatile() or
8383
isThreadSafeType(f.getType()) or

java/ql/test/query-tests/ThreadSafe/examples/LockExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// If the variable is involved in several different monitors, we get an alert for each monitor that
44
// is not correctly used.
55
// A single alert can have many related locations, since each conflicting access which is not
6-
// prpoerly synchronized is a related location.
6+
// properly synchronized is a related location.
77
// This leads to many lines in the .expected file.
88
package examples;
99

java/ql/test/query-tests/ThreadSafe/examples/Test.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
@ThreadSafe
66
public class Test {
77
/**
8-
* Escaping field due to public visuability.
8+
* Escaping field due to public visibility.
99
*/
1010
int publicField;
1111

1212
private int y;
1313
final int immutableField = 1;
1414

15-
// As of the below examples with synchronized as well. Except the incorretly placed lock.
15+
// As of the below examples with synchronized as well. Except the incorrectly placed lock.
1616

1717
private Lock lock = new ReentrantLock();
1818

@@ -53,7 +53,7 @@ private void setYPrivate(int y) {
5353
}
5454

5555
/**
56-
* Incorretly locks y.
56+
* Incorrectly locks y.
5757
* @param y
5858
*/
5959
public void setYWrongLock(int y) {

0 commit comments

Comments
 (0)