mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
Kotlin: Add a test for Kotlin seeing Java code as properties
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
Prop.java:
|
||||
# 0| [CompilationUnit] Prop
|
||||
# 2| 1: [Class] Prop
|
||||
# 2| 1: [Constructor] Prop
|
||||
# 4| 2: [Method] getFoo
|
||||
# 4| 3: [TypeAccess] String
|
||||
# 4| 5: [BlockStmt] { ... }
|
||||
# 5| 0: [ReturnStmt] return ...
|
||||
# 5| 0: [StringLiteral] "foo"
|
||||
Use.kt:
|
||||
# 0| [CompilationUnit] Use
|
||||
# 0| 1: [Class] UseKt
|
||||
# 2| 1: [Method] use
|
||||
#-----| 4: (Parameters)
|
||||
# 2| 0: [Parameter] prop
|
||||
# 2| 5: [BlockStmt] { ... }
|
||||
# 3| 0: [ReturnStmt] return ...
|
||||
# 3| 0: [CastExpr] (...)...
|
||||
# 3| 0: [TypeAccess] String
|
||||
# 3| 1: [MethodAccess] getFoo(...)
|
||||
# 3| -1: [VarAccess] prop
|
||||
@@ -0,0 +1 @@
|
||||
semmle/code/java/PrintAst.ql
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
public class Prop {
|
||||
// This will look like a property in Kotlin
|
||||
String getFoo() {
|
||||
return "foo";
|
||||
}
|
||||
}
|
||||
4
java/ql/test/kotlin/library-tests/java_properties/Use.kt
Normal file
4
java/ql/test/kotlin/library-tests/java_properties/Use.kt
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
fun use(prop: Prop): String {
|
||||
return prop.foo
|
||||
}
|
||||
Reference in New Issue
Block a user