From eb8b5c0823a4fa117db1bc2fc58ff018584fedd7 Mon Sep 17 00:00:00 2001 From: Natalia Ukhorskaya Date: Thu, 24 Apr 2014 17:15:27 +0400 Subject: [PATCH] Remove interface for JetExpressionCodeFragment --- .../lang/psi/JetExpressionCodeFragment.java | 26 ------------------- ...ntImpl.kt => JetExpressionCodeFragment.kt} | 6 ++--- .../jetbrains/jet/lang/psi/JetPsiFactory.java | 2 +- .../debugger/KotlinEditorTextProvider.kt | 4 +-- .../evaluate/KotlinCodeFragmentFactory.kt | 4 +-- .../evaluate/KotlinEvaluationBuilder.kt | 4 +-- 6 files changed, 10 insertions(+), 36 deletions(-) delete mode 100644 compiler/frontend/src/org/jetbrains/jet/lang/psi/JetExpressionCodeFragment.java rename compiler/frontend/src/org/jetbrains/jet/lang/psi/{JetExpressionCodeFragmentImpl.kt => JetExpressionCodeFragment.kt} (95%) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetExpressionCodeFragment.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetExpressionCodeFragment.java deleted file mode 100644 index cdaca372494..00000000000 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetExpressionCodeFragment.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2010-2013 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.jet.lang.psi; - -import com.intellij.psi.JavaCodeFragment; -import org.jetbrains.annotations.Nullable; - -public interface JetExpressionCodeFragment extends JavaCodeFragment { - @Nullable - JetExpression getExpression(); -} - diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetExpressionCodeFragmentImpl.kt b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetExpressionCodeFragment.kt similarity index 95% rename from compiler/frontend/src/org/jetbrains/jet/lang/psi/JetExpressionCodeFragmentImpl.kt rename to compiler/frontend/src/org/jetbrains/jet/lang/psi/JetExpressionCodeFragment.kt index 51be7f37955..ab6686d7f85 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetExpressionCodeFragmentImpl.kt +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetExpressionCodeFragment.kt @@ -23,12 +23,12 @@ import com.intellij.psi.JavaCodeFragment import com.intellij.psi.PsiType import com.intellij.psi.PsiClass -class JetExpressionCodeFragmentImpl( +public class JetExpressionCodeFragment( project: Project, name: String, text: CharSequence, context: PsiElement? -) : JetCodeFragment(project, name, text, JetNodeTypes.EXPRESSION_CODE_FRAGMENT, context), JetExpressionCodeFragment { +) : JetCodeFragment(project, name, text, JetNodeTypes.EXPRESSION_CODE_FRAGMENT, context), JavaCodeFragment { private var _thisType: PsiType? = null private var _superType: PsiType? = null @@ -73,7 +73,7 @@ class JetExpressionCodeFragmentImpl( return true } - override fun getExpression(): JetExpression? { + fun getExpression(): JetExpression? { var resultingExpression: JetExpression? = null this.accept(object: JetTreeVisitor() { override fun visitExpression(expression: JetExpression, data: Void?): Void? { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiFactory.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiFactory.java index 2b6d49c41b3..49f72fc12c8 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiFactory.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiFactory.java @@ -339,7 +339,7 @@ public class JetPsiFactory { @NotNull public static JetExpressionCodeFragment createExpressionCodeFragment(Project project, String text, PsiElement context) { - return new JetExpressionCodeFragmentImpl(project, "fragment.kt", text, context); + return new JetExpressionCodeFragment(project, "fragment.kt", text, context); } @NotNull diff --git a/idea/src/org/jetbrains/jet/plugin/debugger/KotlinEditorTextProvider.kt b/idea/src/org/jetbrains/jet/plugin/debugger/KotlinEditorTextProvider.kt index daa37bc67f3..a1089a2c971 100644 --- a/idea/src/org/jetbrains/jet/plugin/debugger/KotlinEditorTextProvider.kt +++ b/idea/src/org/jetbrains/jet/plugin/debugger/KotlinEditorTextProvider.kt @@ -33,7 +33,7 @@ import org.jetbrains.jet.lang.psi.JetThisExpression import org.jetbrains.jet.lang.psi.JetSimpleNameExpression import org.jetbrains.jet.lang.psi.JetOperationExpression import org.jetbrains.jet.lang.psi.JetExpression -import org.jetbrains.jet.lang.psi.JetExpressionCodeFragmentImpl +import org.jetbrains.jet.lang.psi.JetExpressionCodeFragment import org.jetbrains.jet.lang.psi.JetSuperExpression class KotlinEditorTextProvider : EditorTextProvider { @@ -55,7 +55,7 @@ class KotlinEditorTextProvider : EditorTextProvider { return containingFile.getImportList()?.getImports() ?.map { it.getText() } - ?.makeString(JetExpressionCodeFragmentImpl.IMPORT_SEPARATOR) ?: "" + ?.makeString(JetExpressionCodeFragment.IMPORT_SEPARATOR) ?: "" } fun findExpressionInner(element: PsiElement): JetExpression? { diff --git a/idea/src/org/jetbrains/jet/plugin/debugger/evaluate/KotlinCodeFragmentFactory.kt b/idea/src/org/jetbrains/jet/plugin/debugger/evaluate/KotlinCodeFragmentFactory.kt index bbdd87ae1b9..54824026f66 100644 --- a/idea/src/org/jetbrains/jet/plugin/debugger/evaluate/KotlinCodeFragmentFactory.kt +++ b/idea/src/org/jetbrains/jet/plugin/debugger/evaluate/KotlinCodeFragmentFactory.kt @@ -22,7 +22,7 @@ import com.intellij.psi.PsiElement import com.intellij.openapi.project.Project import com.intellij.psi.JavaCodeFragment import org.jetbrains.jet.plugin.JetFileType -import org.jetbrains.jet.lang.psi.JetExpressionCodeFragmentImpl +import org.jetbrains.jet.lang.psi.JetExpressionCodeFragment import com.intellij.psi.PsiCodeBlock import com.intellij.debugger.engine.evaluation.CodeFragmentKind import com.intellij.psi.JavaCodeFragmentFactory @@ -33,7 +33,7 @@ import org.jetbrains.jet.lang.psi.JetExpression class KotlinCodeFragmentFactory: CodeFragmentFactory() { override fun createCodeFragment(item: TextWithImports, context: PsiElement?, project: Project): JavaCodeFragment { if (item.getKind() == CodeFragmentKind.EXPRESSION) { - val codeFragment = JetExpressionCodeFragmentImpl(project, "fragment.kt", item.getText(), getContextElement(context)) + val codeFragment = JetExpressionCodeFragment(project, "fragment.kt", item.getText(), getContextElement(context)) if (item.getImports().isNotEmpty()) { codeFragment.addImportsFromString(item.getImports()) } diff --git a/idea/src/org/jetbrains/jet/plugin/debugger/evaluate/KotlinEvaluationBuilder.kt b/idea/src/org/jetbrains/jet/plugin/debugger/evaluate/KotlinEvaluationBuilder.kt index 0d04eb7ab40..0c8557ba341 100644 --- a/idea/src/org/jetbrains/jet/plugin/debugger/evaluate/KotlinEvaluationBuilder.kt +++ b/idea/src/org/jetbrains/jet/plugin/debugger/evaluate/KotlinEvaluationBuilder.kt @@ -63,7 +63,7 @@ import org.jetbrains.jet.codegen.ClassFileFactory import org.jetbrains.jet.plugin.codeInsight.CodeInsightUtils import org.jetbrains.jet.OutputFileCollection import org.jetbrains.jet.lang.psi.JetExpressionCodeFragment -import org.jetbrains.jet.lang.psi.JetExpressionCodeFragmentImpl +import org.jetbrains.jet.lang.psi.JetExpressionCodeFragment import org.jetbrains.jet.plugin.caches.resolve.getAnalysisResults object KotlinEvaluationBuilder: EvaluatorBuilder { @@ -222,7 +222,7 @@ private fun createFileForDebugger(codeFragment: JetExpressionCodeFragment, ): JetFile { var fileText = template.replace("!IMPORT_LIST!", codeFragment.importsToString() - .split(JetExpressionCodeFragmentImpl.IMPORT_SEPARATOR) + .split(JetExpressionCodeFragment.IMPORT_SEPARATOR) .makeString("\n")) fileText = fileText.replace("!FUNCTION!", extractedFunction.getText())