Do not generate KotlinClass/Package annotation when not in ClassBuilderMode.FULL
#KT-3967 Fixed
This commit is contained in:
committed by
Alexander Udalov
parent
6d9e50f1b2
commit
61d5d43e15
@@ -214,6 +214,10 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
@Override
|
||||
protected void generateKotlinAnnotation() {
|
||||
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isTopLevelOrInnerClass(descriptor)) return;
|
||||
|
||||
DescriptorSerializer serializer = new DescriptorSerializer(new JavaSerializerExtension(v.getMemberMap()));
|
||||
|
||||
@@ -137,6 +137,10 @@ public class NamespaceCodegen extends MemberCodegen {
|
||||
}
|
||||
|
||||
private void writeKotlinPackageAnnotationIfNeeded(@NotNull MemberMap members) {
|
||||
if (state.getClassBuilderMode() != ClassBuilderMode.FULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (JetFile file : files) {
|
||||
if (file.isScript()) return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package test
|
||||
|
||||
class C() {
|
||||
fun V.f() : {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun V.f() {
|
||||
|
||||
}
|
||||
@@ -19,15 +19,10 @@ package org.jetbrains.jet.asJava;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Collections2;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiClassType;
|
||||
import com.intellij.psi.PsiModifier;
|
||||
import com.intellij.psi.PsiTypeParameter;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
@@ -142,6 +137,25 @@ public abstract class KotlinLightClassTest extends KotlinAsJavaTestBase {
|
||||
}
|
||||
}
|
||||
|
||||
public static class CodeWithErrors extends KotlinLightClassTest {
|
||||
@Override
|
||||
protected List<File> getKotlinSourceRoots() {
|
||||
return Collections.singletonList(new File("compiler/testData/asJava/lightClasses/CodeWithErrors.kt"));
|
||||
}
|
||||
|
||||
public void testClassWithErrors() {
|
||||
assertTrue(findMethodsOfClass("test.C").length == 2);
|
||||
}
|
||||
|
||||
public void testPackageWithErrors() {
|
||||
assertTrue(findMethodsOfClass("test.TestPackage").length == 1);
|
||||
}
|
||||
|
||||
private PsiMethod[] findMethodsOfClass(String qualifiedName) {
|
||||
return findClass(qualifiedName).getMethods();
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected PsiClass findClass(String qualifiedName) {
|
||||
PsiClass psiClass = finder.findClass(qualifiedName, GlobalSearchScope.allScope(getProject()));
|
||||
|
||||
Reference in New Issue
Block a user