mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
Kotlin: Towards KotlinType support
This commit is contained in:
@@ -314,6 +314,18 @@ classes(
|
||||
int sourceid: @class ref
|
||||
);
|
||||
|
||||
kt_nullable_types(
|
||||
unique int id: @kt_nullable_type,
|
||||
int classid: @classorinterface ref
|
||||
)
|
||||
|
||||
kt_notnull_types(
|
||||
unique int id: @kt_notnull_type,
|
||||
int classid: @classorinterface ref
|
||||
)
|
||||
|
||||
@kt_type = @kt_nullable_type | @kt_notnull_type
|
||||
|
||||
isRecord(
|
||||
unique int id: @class ref
|
||||
);
|
||||
@@ -906,7 +918,7 @@ javadocText(
|
||||
@type = @primitive | @reftype;
|
||||
@callable = @method | @constructor;
|
||||
@element = @file | @package | @primitive | @class | @interface | @method | @constructor | @modifier | @param | @exception | @field |
|
||||
@annotation | @boundedtype | @array | @localvar | @expr | @stmt | @import | @fielddecl;
|
||||
@annotation | @boundedtype | @array | @localvar | @expr | @stmt | @import | @fielddecl | @kt_type;
|
||||
|
||||
@modifiable = @member_modifiable| @param | @localvar ;
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import semmle.code.java.Javadoc
|
||||
import semmle.code.java.JDK
|
||||
import semmle.code.java.JDKAnnotations
|
||||
import semmle.code.java.JMX
|
||||
import semmle.code.java.KotlinType
|
||||
import semmle.code.java.Member
|
||||
import semmle.code.java.Modifier
|
||||
import semmle.code.java.Modules
|
||||
|
||||
27
java/ql/lib/semmle/code/java/KotlinType.qll
Executable file
27
java/ql/lib/semmle/code/java/KotlinType.qll
Executable file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Provides classes and predicates for working with Kotlin types.
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
class KotlinType extends Element, @kt_type {
|
||||
}
|
||||
|
||||
class KotlinNullableType extends KotlinType, @kt_nullable_type {
|
||||
override string toString() {
|
||||
exists(ClassOrInterface ci |
|
||||
kt_nullable_types(this, ci) and
|
||||
result = "Kotlin nullable " + ci.toString())
|
||||
}
|
||||
override string getAPrimaryQlClass() { result = "KotlinNullableType" }
|
||||
}
|
||||
|
||||
class KotlinNotnullType extends KotlinType, @kt_notnull_type {
|
||||
override string toString() {
|
||||
exists(ClassOrInterface ci |
|
||||
kt_notnull_types(this, ci) and
|
||||
result = "Kotlin not-null " + ci.toString())
|
||||
}
|
||||
override string getAPrimaryQlClass() { result = "KotlinNotnullType" }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user