public static boolean isCompiledKotlinPackageClass(@NotNull JavaClass javaClass) { if (javaClass.getOriginKind() == JavaClass.OriginKind.COMPILED) { return javaClass.findAnnotation(JvmAnnotationNames.KOTLIN_PACKAGE) != null || javaClass.findAnnotation(JvmAnnotationNames.KOTLIN_PACKAGE_FRAGMENT) != null; } return false; }
@NotNull public static Collection<JavaClass> getClassesInPackage(@NotNull JavaPackage javaPackage) { Collection<JavaClass> classes = javaPackage.getClasses(); Set<FqName> addedQualifiedNames = new HashSet<FqName>(classes.size()); List<JavaClass> result = new ArrayList<JavaClass>(classes.size()); for (JavaClass javaClass : classes) { FqName fqName = javaClass.getFqName(); if (fqName != null && addedQualifiedNames.add(fqName)) { result.add(javaClass); } } return result; }
@Nullable @Override public ClassDescriptor getClass(@NotNull JavaClass javaClass) { FqName fqName = javaClass.getFqName(); if (fqName != null && KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME.equals(fqName.parent())) { if (javaClass.findAnnotation(ASSERT_INVISIBLE_IN_RESOLVER_ANNOTATION) != null) { if (ApplicationManager.getApplication().isInternal()) { LOG.error( "Classpath is configured incorrectly:" + " class " + fqName + " from runtime must not be loaded by compiler"); } return null; } } return trace.get(CLASS, ((JavaClassImpl) javaClass).getPsi()); }
private static boolean hasStaticMembers(@NotNull JavaClass javaClass) { for (JavaMethod method : javaClass.getMethods()) { if (method.isStatic() && !shouldBeInEnumClassObject(method)) { return true; } } for (JavaField field : javaClass.getFields()) { if (field.isStatic() && !field.isEnumEntry()) { return true; } } for (JavaClass nestedClass : javaClass.getInnerClasses()) { if (SingleAbstractMethodUtils.isSamInterface(nestedClass)) { return true; } if (nestedClass.isStatic() && hasStaticMembers(nestedClass)) { return true; } } return false; }
public static boolean isCompiledKotlinClass(@NotNull JavaClass javaClass) { if (javaClass.getOriginKind() == JavaClass.OriginKind.COMPILED) { return javaClass.findAnnotation(JvmAnnotationNames.KOTLIN_CLASS) != null; } return false; }