mirror of
https://github.com/github/codeql.git
synced 2025-12-19 10:23:15 +01:00
For example, Java code might use `HasOutVariance<? extends String>`, or `HasInVariance<? super Object>`, both of which are needless wildcards and which the Kotlin extractor would previously have refused to reintroduce due to their not specifying a larger type than their bound. However this led to inconsistency with Java extraction, which extracts the type as it appears in source. This seems to particularly happen with generated code, e.g. the output of the Kotlin protobuf compiler.
10 lines
454 B
Java
10 lines
454 B
Java
public class Test {
|
|
|
|
// This gets mapped to kotlin.Iterable<out T>, meaning we must reintroduce the use-site extends variance to get a type consistent with Java.
|
|
public static void needlessExtends(Iterable<? extends String> l) { }
|
|
|
|
// This type is defined KotlinConsumer<in T>, meaning we must reintroduce the use-site extends variance to get a type consistent with Java.
|
|
public static void needlessSuper(KotlinConsumer<? super Object> l) { }
|
|
|
|
}
|