aboutsummaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorFedor Ihnatkevich <jeffset@yandex-team.ru>2022-03-08 13:37:50 +0300
committerlaszio <ting-yuan@users.noreply.github.com>2022-03-08 21:35:09 -0800
commit040736e47d56905ac08008783ec2775cf690db77 (patch)
tree6d5bd90bfdf59d09d92eddf1fe81ab5b2e24e435 /api
parent822131e9f7ecd6f25db23426a9374d84bb7152d4 (diff)
downloadksp-040736e47d56905ac08008783ec2775cf690db77.tar.gz
#851: Add isJavaRawType function to Resolver.
This is required for checking if the underlying KSType's type is Java's raw type. Such information is sometimes required to correctly override Java methods while generating Java code.
Diffstat (limited to 'api')
-rw-r--r--api/api.base1
-rw-r--r--api/src/main/kotlin/com/google/devtools/ksp/processing/Resolver.kt9
2 files changed, 10 insertions, 0 deletions
diff --git a/api/api.base b/api/api.base
index 47487687..72f9eeb4 100644
--- a/api/api.base
+++ b/api/api.base
@@ -162,6 +162,7 @@ package com.google.devtools.ksp.processing {
method @Nullable public com.google.devtools.ksp.symbol.KSPropertyDeclaration getPropertyDeclarationByName(@NonNull com.google.devtools.ksp.symbol.KSName name, boolean includeTopLevel = false);
method @NonNull public kotlin.sequences.Sequence<com.google.devtools.ksp.symbol.KSAnnotated> getSymbolsWithAnnotation(@NonNull String annotationName, boolean inDepth = false);
method @NonNull public com.google.devtools.ksp.symbol.KSTypeArgument getTypeArgument(@NonNull com.google.devtools.ksp.symbol.KSTypeReference typeRef, @NonNull com.google.devtools.ksp.symbol.Variance variance);
+ method @com.google.devtools.ksp.KspExperimental public boolean isJavaRawType(@NonNull com.google.devtools.ksp.symbol.KSType type);
method @Nullable @com.google.devtools.ksp.KspExperimental public com.google.devtools.ksp.symbol.KSName mapJavaNameToKotlin(@NonNull com.google.devtools.ksp.symbol.KSName javaName);
method @Nullable @com.google.devtools.ksp.KspExperimental public com.google.devtools.ksp.symbol.KSName mapKotlinNameToJava(@NonNull com.google.devtools.ksp.symbol.KSName kotlinName);
method @Nullable @com.google.devtools.ksp.KspExperimental public String mapToJvmSignature(@NonNull com.google.devtools.ksp.symbol.KSDeclaration declaration);
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/processing/Resolver.kt b/api/src/main/kotlin/com/google/devtools/ksp/processing/Resolver.kt
index 0030bfb9..642b5c90 100644
--- a/api/src/main/kotlin/com/google/devtools/ksp/processing/Resolver.kt
+++ b/api/src/main/kotlin/com/google/devtools/ksp/processing/Resolver.kt
@@ -291,4 +291,13 @@ interface Resolver {
*/
@KspExperimental
fun getJavaWildcard(reference: KSTypeReference): KSTypeReference
+
+ /**
+ * Tests a type if it was declared as legacy "raw" type in Java - a type with its type arguments fully omitted.
+ *
+ * @param type a type to check.
+ * @return True if the type is a "raw" type.
+ */
+ @KspExperimental
+ fun isJavaRawType(type: KSType): Boolean
}