mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
Add java.lang.Enum ordinal and name accessors to special-cased JVM names
Kotlin represents these as read-only properties with unusual getter names.
This commit is contained in:
1
java/ql/test/kotlin/library-tests/enum/enumUser.kt
Normal file
1
java/ql/test/kotlin/library-tests/enum/enumUser.kt
Normal file
@@ -0,0 +1 @@
|
||||
fun usesEnum(e: Enum<*>) = e.ordinal.toString() + e.name
|
||||
27
java/ql/test/kotlin/library-tests/enum/test.expected
Normal file
27
java/ql/test/kotlin/library-tests/enum/test.expected
Normal file
@@ -0,0 +1,27 @@
|
||||
| addAll |
|
||||
| addRange |
|
||||
| allOf |
|
||||
| asIterator |
|
||||
| clone |
|
||||
| compareTo |
|
||||
| complement |
|
||||
| complementOf |
|
||||
| copyOf |
|
||||
| describeConstable |
|
||||
| equals |
|
||||
| finalize |
|
||||
| getDeclaringClass |
|
||||
| hasMoreElements |
|
||||
| hashCode |
|
||||
| name |
|
||||
| nextElement |
|
||||
| noneOf |
|
||||
| of |
|
||||
| ordinal |
|
||||
| range |
|
||||
| resolveConstantDesc |
|
||||
| toString |
|
||||
| typeCheck |
|
||||
| usesEnum |
|
||||
| valueOf |
|
||||
| writeReplace |
|
||||
5
java/ql/test/kotlin/library-tests/enum/test.ql
Normal file
5
java/ql/test/kotlin/library-tests/enum/test.ql
Normal file
@@ -0,0 +1,5 @@
|
||||
import java
|
||||
|
||||
from Method m
|
||||
where m.getDeclaringType().getName().matches("Enum%")
|
||||
select m.getName()
|
||||
Reference in New Issue
Block a user