Minor, add javadoc to KotlinBuiltIns.isBuiltIn

This commit is contained in:
Alexander Udalov
2018-03-28 19:48:50 +02:00
parent 4d742c5266
commit c3b6abfb1f
@@ -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;
}