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

Skip to content

Commit d495bad

Browse files
tamasvajkigfoo
authored andcommitted
Rename companion object QL class
1 parent 5356104 commit d495bad

3 files changed

Lines changed: 10 additions & 13 deletions

File tree

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -711,15 +711,11 @@ class ClassObject extends Class {
711711
}
712712

713713
/** A Kotlin `companion object`. */
714-
class ClassCompanionObject extends Class {
715-
ClassCompanionObject() {
716-
type_companion_object(_, _, this)
717-
}
714+
class CompanionObject extends Class {
715+
CompanionObject() { type_companion_object(_, _, this) }
718716

719717
/** Gets the instance variable that implements this `companion object`. */
720-
Field getInstance() {
721-
type_companion_object(_, result, this)
722-
}
718+
Field getInstance() { type_companion_object(_, result, this) }
723719
}
724720

725721
/**
@@ -961,7 +957,7 @@ class ClassOrInterface extends RefType, @classorinterface {
961957
predicate isSealed() { exists(this.getAPermittedSubtype()) }
962958

963959
/** Get the companion object of this class or interface, if any. */
964-
ClassCompanionObject getCompanionObject() { type_companion_object(this, _, result) }
960+
CompanionObject getCompanionObject() { type_companion_object(this, _, result) }
965961
}
966962

967963
private string getAPublicObjectMethodSignature() {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import java
22

3-
from VarAccess va, ClassCompanionObject cco
3+
from VarAccess va, CompanionObject cco
44
where va.getVariable() = cco.getInstance()
55
select cco, va
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import java
22

3-
from ClassOrInterface c, ClassCompanionObject cco, Field f
4-
where c.fromSource()
5-
and cco = c.getCompanionObject()
6-
and f = cco.getInstance()
3+
from ClassOrInterface c, CompanionObject cco, Field f
4+
where
5+
c.fromSource() and
6+
cco = c.getCompanionObject() and
7+
f = cco.getInstance()
78
select c, f, cco, concat(f.getAModifier().toString(), ",")

0 commit comments

Comments
 (0)