From bdf4173680b4207e89e01292f553d6547e3bbae2 Mon Sep 17 00:00:00 2001 From: svtk Date: Tue, 4 Oct 2011 14:48:19 +0400 Subject: [PATCH] Added error 'public member should specify type' and quick fix --- .../jet/lang/diagnostics/Errors.java | 2 + .../lang/resolve/ClassDescriptorResolver.java | 27 +++--- .../jet/lang/resolve/DeclarationsChecker.java | 24 +++++ .../jet/plugin/quickfix/AddReturnTypeFix.java | 92 +++++++++++++++++++ .../jet/plugin/quickfix/QuickFixes.java | 2 + .../quickfix/RemovePartsFromPropertyFix.java | 14 +-- .../full/FunctionReturnTypes.jet | 5 + .../checkerWithErrorTypes/full/Properties.jet | 1 + idea/testData/codegen/classes/outerThis.jet | 2 +- .../codegen/classes/propertyDelegation.jet | 2 +- .../codegen/classes/propertyInInitializer.jet | 4 +- .../afterProtectedFunWithoutReturnType.kt | 6 ++ .../afterPublicFunWithoutReturnType.kt | 6 ++ .../afterPublicValWithoutReturnType.kt | 6 ++ ...reInternalProtectedFunWithoutReturnType.kt | 6 ++ .../beforeProtectedFunWithoutReturnType.kt | 6 ++ .../beforePublicFunWithoutBody.kt | 6 ++ .../beforePublicFunWithoutReturnType.kt | 6 ++ .../beforePublicValWithoutReturnType.kt | 4 + .../jet/codegen/PropertyGenTest.java | 8 +- .../plugin/quickfix/TypeAdditionFixTests.java | 6 ++ 21 files changed, 203 insertions(+), 32 deletions(-) create mode 100644 idea/src/org/jetbrains/jet/plugin/quickfix/AddReturnTypeFix.java create mode 100644 idea/testData/quickfix/typeAddition/afterProtectedFunWithoutReturnType.kt create mode 100644 idea/testData/quickfix/typeAddition/afterPublicFunWithoutReturnType.kt create mode 100644 idea/testData/quickfix/typeAddition/afterPublicValWithoutReturnType.kt create mode 100644 idea/testData/quickfix/typeAddition/beforeInternalProtectedFunWithoutReturnType.kt create mode 100644 idea/testData/quickfix/typeAddition/beforeProtectedFunWithoutReturnType.kt create mode 100644 idea/testData/quickfix/typeAddition/beforePublicFunWithoutBody.kt create mode 100644 idea/testData/quickfix/typeAddition/beforePublicFunWithoutReturnType.kt create mode 100644 idea/testData/quickfix/typeAddition/beforePublicValWithoutReturnType.kt diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java index 826c5cd9813..58f6616fc0e 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java @@ -123,6 +123,8 @@ public interface Errors { DiagnosticWithParameterFactory NON_FINAL_MEMBER_IN_FINAL_CLASS = DiagnosticWithParameterFactory.create(ERROR, "Non final member in a final class", DiagnosticParameters.CLASS); + DiagnosticWithParameterFactory PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE = DiagnosticWithParameterFactory.create(ERROR, "Public member should specify a type", DiagnosticParameters.TYPE); + SimpleDiagnosticFactory PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT = SimpleDiagnosticFactory.create(ERROR, "Projections are not allowed on type arguments of functions and properties"); // TODO : better positioning SimpleDiagnosticFactory SUPERTYPE_NOT_INITIALIZED = SimpleDiagnosticFactory.create(ERROR, "This type has a constructor, and thus must be initialized here"); SimpleDiagnosticFactory SECONDARY_CONSTRUCTOR_BUT_NO_PRIMARY = SimpleDiagnosticFactory.create(ERROR, "A secondary constructor may appear only in a class that has a primary constructor"); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/ClassDescriptorResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/ClassDescriptorResolver.java index 1672a1329c8..49f3ab24bc3 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/ClassDescriptorResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/ClassDescriptorResolver.java @@ -481,17 +481,7 @@ public class ClassDescriptorResolver { JetType type = getVariableType(scopeWithTypeParameters, property, true); - boolean hasBody = property.getInitializer() != null; - if (!hasBody) { - JetPropertyAccessor getter = property.getGetter(); - if (getter != null && getter.getBodyExpression() != null) { - hasBody = true; - } - JetPropertyAccessor setter = property.getSetter(); - if (!hasBody && setter != null && setter.getBodyExpression() != null) { - hasBody = true; - } - } + boolean hasBody = hasBody(property); Modality defaultModality = getDefaultModality(containingDeclaration, hasBody); PropertyDescriptor propertyDescriptor = new PropertyDescriptor( containingDeclaration, @@ -513,6 +503,21 @@ public class ClassDescriptorResolver { return propertyDescriptor; } + /*package*/ static boolean hasBody(JetProperty property) { + boolean hasBody = property.getInitializer() != null; + if (!hasBody) { + JetPropertyAccessor getter = property.getGetter(); + if (getter != null && getter.getBodyExpression() != null) { + hasBody = true; + } + JetPropertyAccessor setter = property.getSetter(); + if (!hasBody && setter != null && setter.getBodyExpression() != null) { + hasBody = true; + } + } + return hasBody; + } + @NotNull private JetType getVariableType(@NotNull final JetScope scope, @NotNull final JetProperty property, boolean allowDeferred) { // TODO : receiver? diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DeclarationsChecker.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DeclarationsChecker.java index 5fc9b02b565..acebd21b8e6 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DeclarationsChecker.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DeclarationsChecker.java @@ -137,6 +137,29 @@ public class DeclarationsChecker { checkPropertyAbstractness(property, propertyDescriptor, classDescriptor); checkPropertyInitializer(property, propertyDescriptor, classDescriptor); checkAccessors(property, propertyDescriptor); + checkDeclaredTypeInPublicMember(property, propertyDescriptor); + } + + private void checkDeclaredTypeInPublicMember(JetNamedDeclaration member, CallableMemberDescriptor memberDescriptor) { + PsiElement nameIdentifier = member.getNameIdentifier(); + boolean hasDeferredType; + if (member instanceof JetProperty) { + hasDeferredType = ((JetProperty) member).getPropertyTypeRef() == null && ClassDescriptorResolver.hasBody((JetProperty) member); + } + else { + assert member instanceof JetFunction; + JetFunction function = (JetFunction) member; + hasDeferredType = function.getReturnTypeRef() == null && function.getBodyExpression() != null && !function.hasBlockBody(); + } + if ((memberDescriptor.getVisibility() == Visibility.PUBLIC || memberDescriptor.getVisibility() == Visibility.PROTECTED) && + hasDeferredType && nameIdentifier != null) { + + JetType returnType = memberDescriptor.getReturnType(); + if (returnType instanceof DeferredType) { + returnType = ((DeferredType) returnType).getActualType(); + } + context.getTrace().report(PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE.on(member, nameIdentifier, returnType)); + } } private void checkPropertyAbstractness(JetProperty property, PropertyDescriptor propertyDescriptor, ClassDescriptor classDescriptor) { @@ -232,6 +255,7 @@ public class DeclarationsChecker { JetModifierList modifierList = function.getModifierList(); ASTNode abstractNode = modifierList != null ? modifierList.getModifierNode(JetTokens.ABSTRACT_KEYWORD) : null; boolean hasAbstractModifier = abstractNode != null; + checkDeclaredTypeInPublicMember(function, functionDescriptor); if (containingDescriptor instanceof ClassDescriptor) { ClassDescriptor classDescriptor = (ClassDescriptor) containingDescriptor; boolean inTrait = classDescriptor.getKind() == ClassKind.TRAIT; diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/AddReturnTypeFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/AddReturnTypeFix.java new file mode 100644 index 00000000000..7314585e233 --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/AddReturnTypeFix.java @@ -0,0 +1,92 @@ +package org.jetbrains.jet.plugin.quickfix; + +import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.Pair; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; +import com.intellij.util.IncorrectOperationException; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.lang.diagnostics.DiagnosticParameters; +import org.jetbrains.jet.lang.diagnostics.DiagnosticWithParameters; +import org.jetbrains.jet.lang.diagnostics.DiagnosticWithPsiElement; +import org.jetbrains.jet.lang.psi.*; +import org.jetbrains.jet.lang.types.JetType; + +/** +* @author svtk +*/ +public class AddReturnTypeFix extends JetIntentionAction { + private JetType type; + + public AddReturnTypeFix(@NotNull JetNamedDeclaration element, JetType type) { + super(element); + this.type = type; + } + + @NotNull + @Override + public String getText() { + return "Add return type declaration"; + } + + @NotNull + @Override + public String getFamilyName() { + return "Add return type declaration"; + } + + @Override + public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { + PsiElement newElement; + if (element instanceof JetProperty) { + newElement = addPropertyType(project, (JetProperty) element, type); + } + else { + assert element instanceof JetFunction; + newElement = addFunctionType(project, (JetFunction) element, type); + } + ImportClassHelper.perform(type, element, newElement); + } + + @Override + public boolean startInWriteAction() { + return true; + } + + public static JetProperty addPropertyType(Project project, JetProperty property, JetType type) { + JetProperty newProperty = (JetProperty) property.copy(); + JetTypeReference typeReference = JetPsiFactory.createType(project, type.toString()); + Pair colon = JetPsiFactory.createColon(project); + PsiElement nameIdentifier = newProperty.getNameIdentifier(); + addTypeReference(newProperty, typeReference, colon, nameIdentifier); + return newProperty; + } + + public static JetFunction addFunctionType(Project project, JetFunction function, JetType type) { + JetFunction newFunction = (JetFunction) function.copy(); + JetTypeReference typeReference = JetPsiFactory.createType(project, type.toString()); + Pair colon = JetPsiFactory.createColon(project); + JetParameterList valueParameterList = newFunction.getValueParameterList(); + addTypeReference(newFunction, typeReference, colon, valueParameterList); + return newFunction; + } + + private static void addTypeReference(JetNamedDeclaration element, JetTypeReference typeReference, Pair colon, PsiElement anchor) { + assert anchor != null; + element.addAfter(typeReference, anchor); + element.addRangeAfter(colon.getFirst(), colon.getSecond(), anchor); + } + + public static JetIntentionActionFactory createFactory() { + return new JetIntentionActionFactory() { + @Override + public JetIntentionAction createAction(DiagnosticWithPsiElement diagnostic) { + assert diagnostic.getPsiElement() instanceof JetNamedDeclaration; + DiagnosticWithParameters diagnosticWithParameters = assertAndCastToDiagnosticWithParameters(diagnostic, DiagnosticParameters.TYPE); + JetType type = diagnosticWithParameters.getParameter(DiagnosticParameters.TYPE); + return new AddReturnTypeFix((JetNamedDeclaration) diagnostic.getPsiElement(), type); + } + }; + } +} \ No newline at end of file diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixes.java b/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixes.java index 290b95890fb..76f37013470 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixes.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/QuickFixes.java @@ -103,5 +103,7 @@ public class QuickFixes { add(Errors.GETTER_VISIBILITY_DIFFERS_FROM_PROPERTY_VISIBILITY, removeModifierFactory); add(Errors.REDUNDANT_MODIFIER_IN_GETTER, removeRedundantModifierFactory); add(Errors.ILLEGAL_MODIFIER, removeModifierFactory); + + add(Errors.PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE, AddReturnTypeFix.createFactory()); } } \ No newline at end of file diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/RemovePartsFromPropertyFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/RemovePartsFromPropertyFix.java index 34c99ff3155..f9e3afc1295 100644 --- a/idea/src/org/jetbrains/jet/plugin/quickfix/RemovePartsFromPropertyFix.java +++ b/idea/src/org/jetbrains/jet/plugin/quickfix/RemovePartsFromPropertyFix.java @@ -2,7 +2,6 @@ package org.jetbrains.jet.plugin.quickfix; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Pair; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.util.IncorrectOperationException; @@ -97,7 +96,7 @@ public class RemovePartsFromPropertyFix extends JetIntentionAction newElement.deleteChildRange(nextSibling, initializer); if (newElement.getPropertyTypeRef() == null && type != null) { - newElement = addPropertyType(project, newElement, type); + newElement = AddReturnTypeFix.addPropertyType(project, newElement, type); needImport = true; } } @@ -108,17 +107,6 @@ public class RemovePartsFromPropertyFix extends JetIntentionAction } } - public static JetProperty addPropertyType(Project project, JetProperty property, JetType type) { - JetProperty newProperty = (JetProperty) property.copy(); - JetTypeReference typeReference = JetPsiFactory.createType(project, type.toString()); - Pair colon = JetPsiFactory.createColon(project); - PsiElement nameIdentifier = newProperty.getNameIdentifier(); - assert nameIdentifier != null; - newProperty.addAfter(typeReference, nameIdentifier); - newProperty.addRangeAfter(colon.getFirst(), colon.getSecond(), nameIdentifier); - return newProperty; - } - public static JetIntentionActionFactory createFactory() { return new JetIntentionActionFactory() { @Override diff --git a/idea/testData/checkerWithErrorTypes/full/FunctionReturnTypes.jet b/idea/testData/checkerWithErrorTypes/full/FunctionReturnTypes.jet index 64012287566..bd049b81d25 100644 --- a/idea/testData/checkerWithErrorTypes/full/FunctionReturnTypes.jet +++ b/idea/testData/checkerWithErrorTypes/full/FunctionReturnTypes.jet @@ -164,3 +164,8 @@ fun f(): Int { } fun f(): Int = if (1 < 2) 1 else returnNothing() + +public fun f() = 1 +class B() { + protected fun f() = "ss" +} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/full/Properties.jet b/idea/testData/checkerWithErrorTypes/full/Properties.jet index 999ebc5173e..1b3ca0b8dee 100644 --- a/idea/testData/checkerWithErrorTypes/full/Properties.jet +++ b/idea/testData/checkerWithErrorTypes/full/Properties.jet @@ -25,4 +25,5 @@ class Test() { $b = $a a = $b } + public val i = 1 } \ No newline at end of file diff --git a/idea/testData/codegen/classes/outerThis.jet b/idea/testData/codegen/classes/outerThis.jet index 61642ffa2e2..123fde68b46 100644 --- a/idea/testData/codegen/classes/outerThis.jet +++ b/idea/testData/codegen/classes/outerThis.jet @@ -3,7 +3,7 @@ class Outer() { val outer: Outer get() = this@Outer } - public val x = Inner() + public val x : Inner = Inner() } fun box() : String { diff --git a/idea/testData/codegen/classes/propertyDelegation.jet b/idea/testData/codegen/classes/propertyDelegation.jet index 0d030e74a8a..614c624f124 100644 --- a/idea/testData/codegen/classes/propertyDelegation.jet +++ b/idea/testData/codegen/classes/propertyDelegation.jet @@ -1,5 +1,5 @@ open class Base() { - public val plain = 239 + val plain = 239 public val read : Int get() = 239 diff --git a/idea/testData/codegen/classes/propertyInInitializer.jet b/idea/testData/codegen/classes/propertyInInitializer.jet index ed507f6278f..f6e84b15afd 100644 --- a/idea/testData/codegen/classes/propertyInInitializer.jet +++ b/idea/testData/codegen/classes/propertyInInitializer.jet @@ -1,5 +1,5 @@ class Outer() { - public val s = "xyzzy" + val s = "xyzzy" open class InnerBase(public val name: String) { } @@ -7,7 +7,7 @@ class Outer() { class InnerDerived(): InnerBase(s) { } - public val x = InnerDerived() + val x = InnerDerived() } fun box() : String { diff --git a/idea/testData/quickfix/typeAddition/afterProtectedFunWithoutReturnType.kt b/idea/testData/quickfix/typeAddition/afterProtectedFunWithoutReturnType.kt new file mode 100644 index 00000000000..21bb2b8a61b --- /dev/null +++ b/idea/testData/quickfix/typeAddition/afterProtectedFunWithoutReturnType.kt @@ -0,0 +1,6 @@ +// "Add return type declaration" "true" +namespace a + +class A() { + protected fun foo() : Int = 1 +} \ No newline at end of file diff --git a/idea/testData/quickfix/typeAddition/afterPublicFunWithoutReturnType.kt b/idea/testData/quickfix/typeAddition/afterPublicFunWithoutReturnType.kt new file mode 100644 index 00000000000..d6915a73b54 --- /dev/null +++ b/idea/testData/quickfix/typeAddition/afterPublicFunWithoutReturnType.kt @@ -0,0 +1,6 @@ +// "Add return type declaration" "true" +namespace a + +class A() { + public fun foo() : String = "a" +} \ No newline at end of file diff --git a/idea/testData/quickfix/typeAddition/afterPublicValWithoutReturnType.kt b/idea/testData/quickfix/typeAddition/afterPublicValWithoutReturnType.kt new file mode 100644 index 00000000000..ff8817efeff --- /dev/null +++ b/idea/testData/quickfix/typeAddition/afterPublicValWithoutReturnType.kt @@ -0,0 +1,6 @@ +// "Add return type declaration" "true" +namespace a + +import java.util.List + +public val l : List? = java.util.Collections.emptyList() \ No newline at end of file diff --git a/idea/testData/quickfix/typeAddition/beforeInternalProtectedFunWithoutReturnType.kt b/idea/testData/quickfix/typeAddition/beforeInternalProtectedFunWithoutReturnType.kt new file mode 100644 index 00000000000..00fb6506546 --- /dev/null +++ b/idea/testData/quickfix/typeAddition/beforeInternalProtectedFunWithoutReturnType.kt @@ -0,0 +1,6 @@ +// "Add return type declaration" "false" +namespace a + +class A() { + internal protected fun foo() = 1 +} \ No newline at end of file diff --git a/idea/testData/quickfix/typeAddition/beforeProtectedFunWithoutReturnType.kt b/idea/testData/quickfix/typeAddition/beforeProtectedFunWithoutReturnType.kt new file mode 100644 index 00000000000..5f8cb2d9cf1 --- /dev/null +++ b/idea/testData/quickfix/typeAddition/beforeProtectedFunWithoutReturnType.kt @@ -0,0 +1,6 @@ +// "Add return type declaration" "true" +namespace a + +class A() { + protected fun foo() = 1 +} \ No newline at end of file diff --git a/idea/testData/quickfix/typeAddition/beforePublicFunWithoutBody.kt b/idea/testData/quickfix/typeAddition/beforePublicFunWithoutBody.kt new file mode 100644 index 00000000000..c031a9e7577 --- /dev/null +++ b/idea/testData/quickfix/typeAddition/beforePublicFunWithoutBody.kt @@ -0,0 +1,6 @@ +// "Add return type declaration" "false" +namespace a + +class A() { + public fun foo() +} \ No newline at end of file diff --git a/idea/testData/quickfix/typeAddition/beforePublicFunWithoutReturnType.kt b/idea/testData/quickfix/typeAddition/beforePublicFunWithoutReturnType.kt new file mode 100644 index 00000000000..ad53bc3e9fd --- /dev/null +++ b/idea/testData/quickfix/typeAddition/beforePublicFunWithoutReturnType.kt @@ -0,0 +1,6 @@ +// "Add return type declaration" "true" +namespace a + +class A() { + public fun foo() = "a" +} \ No newline at end of file diff --git a/idea/testData/quickfix/typeAddition/beforePublicValWithoutReturnType.kt b/idea/testData/quickfix/typeAddition/beforePublicValWithoutReturnType.kt new file mode 100644 index 00000000000..a162305a91c --- /dev/null +++ b/idea/testData/quickfix/typeAddition/beforePublicValWithoutReturnType.kt @@ -0,0 +1,4 @@ +// "Add return type declaration" "true" +namespace a + +public val l = java.util.Collections.emptyList() \ No newline at end of file diff --git a/idea/tests/org/jetbrains/jet/codegen/PropertyGenTest.java b/idea/tests/org/jetbrains/jet/codegen/PropertyGenTest.java index fa54529a99f..cd81cc54e01 100644 --- a/idea/tests/org/jetbrains/jet/codegen/PropertyGenTest.java +++ b/idea/tests/org/jetbrains/jet/codegen/PropertyGenTest.java @@ -34,7 +34,7 @@ public class PropertyGenTest extends CodegenTestCase { } public void testPublicVar() throws Exception { - loadText("class PublicVar() { public var foo = 0; }"); + loadText("class PublicVar() { public var foo : Int = 0; }"); final Class aClass = loadImplementationClass(generateClassesInFile(), "PublicVar"); final Object instance = aClass.newInstance(); Method setter = findMethodByName(aClass, "setFoo"); @@ -44,7 +44,7 @@ public class PropertyGenTest extends CodegenTestCase { } public void testAccessorsInInterface() { - loadText("class AccessorsInInterface() { public var foo = 0; }"); + loadText("class AccessorsInInterface() { public var foo : Int = 0; }"); final Class aClass = loadClass("AccessorsInInterface", generateClassesInFile()); assertNotNull(findMethodByName(aClass, "getFoo")); assertNotNull(findMethodByName(aClass, "setFoo")); @@ -108,7 +108,7 @@ public class PropertyGenTest extends CodegenTestCase { } public void testInitializersForNamespaceProperties() throws Exception { - loadText("public val x = System.currentTimeMillis()"); + loadText("val x = System.currentTimeMillis()"); final Method method = generateFunction("getX"); assertIsCurrentTime((Long) method.invoke(null)); } @@ -136,7 +136,7 @@ public class PropertyGenTest extends CodegenTestCase { } public void testKt160() throws Exception { - loadText("public val s = java.lang.Double.toString(1.0)"); + loadText("internal val s = java.lang.Double.toString(1.0)"); final Method method = generateFunction("getS"); assertEquals(method.invoke(null), "1.0"); } diff --git a/idea/tests/org/jetbrains/jet/plugin/quickfix/TypeAdditionFixTests.java b/idea/tests/org/jetbrains/jet/plugin/quickfix/TypeAdditionFixTests.java index 42c100016f6..b9154602f09 100644 --- a/idea/tests/org/jetbrains/jet/plugin/quickfix/TypeAdditionFixTests.java +++ b/idea/tests/org/jetbrains/jet/plugin/quickfix/TypeAdditionFixTests.java @@ -1,6 +1,7 @@ package org.jetbrains.jet.plugin.quickfix; import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase; +import com.intellij.openapi.projectRoots.Sdk; import org.jetbrains.jet.JetTestCaseBase; /** @@ -21,5 +22,10 @@ public class TypeAdditionFixTests extends LightQuickFixTestCase { protected String getTestDataPath() { return JetTestCaseBase.getTestDataPathBase(); } + + @Override + protected Sdk getProjectJDK() { + return JetTestCaseBase.jdkFromIdeaHome(); + } }