Minor, add javadoc to KotlinBuiltIns.isBuiltIn
This commit is contained in:
@@ -391,6 +391,15 @@ public abstract class KotlinBuiltIns {
|
||||
return packageFragments.invoke().builtInsPackageFragment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given descriptor is declared in the deserialized built-in package fragment, i.e. if it was loaded as a part of
|
||||
* loading .kotlin_builtins definition files.
|
||||
*
|
||||
* NOTE: this method returns false for descriptors loaded from .class files or other binaries, even if they are "built-in" in some
|
||||
* other sense! For example, it returns false for the class descriptor of `kotlin.IntRange` loaded from `kotlin/IntRange.class`.
|
||||
* In case you need to check if the class is "built-in" in another sense, you should probably do it by inspecting its FQ name,
|
||||
* or the FQ name of its containing package.
|
||||
*/
|
||||
public static boolean isBuiltIn(@NotNull DeclarationDescriptor descriptor) {
|
||||
return DescriptorUtils.getParentOfType(descriptor, BuiltInsPackageFragment.class, false) != null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user