Skip to content

Commit fad7d9a

Browse files
authored
Merge pull request #9120 from igfoo/igfoo/fixes
Kotlin: Fix some alerts
2 parents 6014614 + 33e17f1 commit fad7d9a

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

java/ql/consistency-queries/locations.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import java
22
import semmle.code.configfiles.ConfigFiles
3+
import semmle.code.java.Diagnostics
34

45
// Locations should either be :0:0:0:0 locations (UnknownLocation, or
56
// a whole file), or all 4 fields should be positive.
@@ -27,7 +28,7 @@ Location unusedLocation() {
2728
not exists(Top t | t.getLocation() = result) and
2829
not exists(XMLLocatable x | x.getLocation() = result) and
2930
not exists(ConfigLocatable c | c.getLocation() = result) and
30-
not exists(@diagnostic d | diagnostics(d, _, _, _, _, _, result)) and
31+
not exists(Diagnostic d | d.getLocation() = result) and
3132
not (
3233
result.getFile().getExtension() = "xml" and
3334
result.getStartLine() = 0 and

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,10 +1374,10 @@ class LambdaExpr extends FunctionalExpr, @lambdaexpr {
13741374
* The parameters of the lambda expression are the parameters of this method.
13751375
*/
13761376
override Method asMethod() {
1377-
not isKotlinFunctionN() and
1377+
not this.isKotlinFunctionN() and
13781378
result = this.getAnonymousClass().getAMethod()
13791379
or
1380-
isKotlinFunctionN() and
1380+
this.isKotlinFunctionN() and
13811381
result = this.getAnonymousClass().getAMethod() and
13821382
result.getNumberOfParameters() > 1
13831383
}
@@ -1644,7 +1644,7 @@ class NotInstanceOfExpr extends Expr, @notinstanceofexpr {
16441644
Expr getTypeName() { result.isNthChildOf(this, 1) }
16451645

16461646
/** Gets the type this `!is` expression checks for. */
1647-
RefType getCheckedType() { result = getTypeName().getType() }
1647+
RefType getCheckedType() { result = this.getTypeName().getType() }
16481648

16491649
/** Gets a printable representation of this expression. */
16501650
override string toString() { result = "... !is ..." }

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class Parameter extends Element, @param, LocalScopeVariable {
9191

9292
/** Holds if this formal parameter is a parameter representing the dispatch receiver in an extension method. */
9393
predicate isExtensionParameter() {
94-
getPosition() = 0 and this.getCallable() instanceof ExtensionMethod
94+
this.getPosition() = 0 and this.getCallable() instanceof ExtensionMethod
9595
}
9696

9797
/**

0 commit comments

Comments
 (0)