diff --git a/build.xml b/build.xml index 42ef3114596..890a9ac740c 100644 --- a/build.xml +++ b/build.xml @@ -73,7 +73,6 @@ - diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/GenerationState.java b/compiler/backend/src/org/jetbrains/jet/codegen/GenerationState.java index d474f7f5b01..5cfb8b6ba57 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/GenerationState.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/GenerationState.java @@ -26,12 +26,14 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.containers.Stack; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.codegen.intrinsics.IntrinsicMethods; -import org.jetbrains.jet.compiler.FileNameTransformer; import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory; import org.jetbrains.jet.lang.descriptors.ClassDescriptor; import org.jetbrains.jet.lang.descriptors.ConstructorDescriptor; import org.jetbrains.jet.lang.diagnostics.DiagnosticUtils; -import org.jetbrains.jet.lang.psi.*; +import org.jetbrains.jet.lang.psi.JetExpression; +import org.jetbrains.jet.lang.psi.JetFile; +import org.jetbrains.jet.lang.psi.JetObjectDeclaration; +import org.jetbrains.jet.lang.psi.JetObjectLiteralExpression; import org.jetbrains.jet.lang.resolve.AnalyzingUtils; import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM; @@ -50,18 +52,11 @@ public class GenerationState { private final JetStandardLibrary standardLibrary; private final IntrinsicMethods intrinsics; - private final FileNameTransformer fileNameTransformer; - public GenerationState(Project project, ClassBuilderFactory builderFactory) { - this(project, builderFactory, FileNameTransformer.IDENTITY); - } - - public GenerationState(Project project, ClassBuilderFactory builderFactory, FileNameTransformer fileNameTransformer) { this.project = project; this.standardLibrary = JetStandardLibrary.getInstance(); this.factory = new ClassFileFactory(builderFactory, this); this.intrinsics = new IntrinsicMethods(project, standardLibrary); - this.fileNameTransformer = fileNameTransformer; } @NotNull @@ -196,6 +191,6 @@ public class GenerationState { @NotNull public String transformFileName(@NotNull String fileName) { - return fileNameTransformer.transformFileName(fileName); + return fileName; } } diff --git a/compiler/backend/src/org/jetbrains/jet/compiler/FileNameTransformer.java b/compiler/backend/src/org/jetbrains/jet/compiler/FileNameTransformer.java deleted file mode 100644 index 6a623009340..00000000000 --- a/compiler/backend/src/org/jetbrains/jet/compiler/FileNameTransformer.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2010-2012 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.compiler; - -import org.jetbrains.annotations.NotNull; - -/** - * @author abreslav - */ -public interface FileNameTransformer { - FileNameTransformer IDENTITY = new FileNameTransformer() { - @NotNull - @Override - public String transformFileName(@NotNull String fileName) { - return fileName; - } - }; - - @NotNull - String transformFileName(@NotNull String fileName); -} diff --git a/compiler/cli/src/org/jetbrains/jet/cli/CompilerArguments.java b/compiler/cli/src/org/jetbrains/jet/cli/CompilerArguments.java index 89f2ebf8a93..46884482d80 100644 --- a/compiler/cli/src/org/jetbrains/jet/cli/CompilerArguments.java +++ b/compiler/cli/src/org/jetbrains/jet/cli/CompilerArguments.java @@ -56,9 +56,6 @@ public class CompilerArguments { @Argument(value = "tags", description = "Demarcate each compilation message (error, warning, etc) with an open and close tag") public boolean tags; - @Argument(value = "transformNamesToJava", description = "Transform Kotlin file names to *.java. This option is needed for compiling kotlinized Java library headers") - public boolean transformNamesToJava; - public String getClasspath() { return classpath; @@ -147,12 +144,4 @@ public class CompilerArguments { public void setTags(boolean tags) { this.tags = tags; } - - public boolean isTransformNamesToJava() { - return transformNamesToJava; - } - - public void setTransformNamesToJava(boolean transformNamesToJava) { - this.transformNamesToJava = transformNamesToJava; - } } diff --git a/compiler/cli/src/org/jetbrains/jet/cli/KotlinCompiler.java b/compiler/cli/src/org/jetbrains/jet/cli/KotlinCompiler.java index b18278d45be..57434101076 100644 --- a/compiler/cli/src/org/jetbrains/jet/cli/KotlinCompiler.java +++ b/compiler/cli/src/org/jetbrains/jet/cli/KotlinCompiler.java @@ -17,8 +17,9 @@ package org.jetbrains.jet.cli; import com.sampullara.cli.Args; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.jet.compiler.*; +import org.jetbrains.jet.compiler.CompileEnvironment; +import org.jetbrains.jet.compiler.CompileEnvironmentException; +import org.jetbrains.jet.compiler.MessageRenderer; import java.io.PrintStream; @@ -28,13 +29,6 @@ import java.io.PrintStream; */ @SuppressWarnings("UseOfSystemOutOrSystemErr") public class KotlinCompiler { - private static final FileNameTransformer ANY_EXTENSION_TO_JAVA = new FileNameTransformer() { - @NotNull - @Override - public String transformFileName(@NotNull String fileName) { - return fileName.replaceFirst("\\.\\w+$", ".java"); - } - }; public static void main(String... args) { doMain(new KotlinCompiler(), args); @@ -78,11 +72,8 @@ public class KotlinCompiler { } System.setProperty("java.awt.headless", "true"); - FileNameTransformer fileNameTransformer = arguments.transformNamesToJava - ? ANY_EXTENSION_TO_JAVA - : FileNameTransformer.IDENTITY; MessageRenderer messageRenderer = arguments.tags ? MessageRenderer.TAGS : MessageRenderer.PLAIN; - CompileEnvironment environment = new CompileEnvironment(fileNameTransformer, messageRenderer); + CompileEnvironment environment = new CompileEnvironment(messageRenderer); try { configureEnvironment(environment, arguments, errStream); diff --git a/compiler/cli/src/org/jetbrains/jet/compiler/CompileEnvironment.java b/compiler/cli/src/org/jetbrains/jet/compiler/CompileEnvironment.java index ee4ec0a0c36..e5441b3bfa8 100644 --- a/compiler/cli/src/org/jetbrains/jet/compiler/CompileEnvironment.java +++ b/compiler/cli/src/org/jetbrains/jet/compiler/CompileEnvironment.java @@ -59,24 +59,22 @@ public class CompileEnvironment { private final MessageRenderer myMessageRenderer; private PrintStream myErrorStream = System.err; - private final FileNameTransformer myFileNameTransformer; private URL myStdlib; private boolean ignoreErrors = false; private boolean stubs = false; public CompileEnvironment() { - this(FileNameTransformer.IDENTITY, MessageRenderer.PLAIN); + this(MessageRenderer.PLAIN); } - public CompileEnvironment(FileNameTransformer fileNameTransformer, MessageRenderer messageRenderer) { + public CompileEnvironment(MessageRenderer messageRenderer) { myRootDisposable = new Disposable() { @Override public void dispose() { } }; myEnvironment = new JetCoreEnvironment(myRootDisposable); - myFileNameTransformer = fileNameTransformer; myMessageRenderer = messageRenderer; } @@ -181,7 +179,7 @@ public class CompileEnvironment { final String directory = new File(moduleScriptFile).getParent(); for (Module moduleBuilder : modules) { - CompileEnvironment compileEnvironment = new CompileEnvironment(myFileNameTransformer, myMessageRenderer); + CompileEnvironment compileEnvironment = new CompileEnvironment(myMessageRenderer); compileEnvironment.setIgnoreErrors(ignoreErrors); compileEnvironment.setErrorStream(myErrorStream); // copy across any compiler plugins @@ -206,7 +204,7 @@ public class CompileEnvironment { } public List loadModuleScript(String moduleFile) { - CompileSession scriptCompileSession = new CompileSession(myEnvironment, myFileNameTransformer); + CompileSession scriptCompileSession = new CompileSession(myEnvironment); scriptCompileSession.addSources(moduleFile); ensureRuntime(); @@ -353,7 +351,7 @@ public class CompileEnvironment { } public ClassLoader compileText(String code) { - CompileSession session = new CompileSession(myEnvironment, myFileNameTransformer); + CompileSession session = new CompileSession(myEnvironment); session.addSources(new LightVirtualFile("script" + LocalTimeCounter.currentTime() + ".kt", JetLanguage.INSTANCE, code)); if (!session.analyze(myErrorStream, myMessageRenderer) && !ignoreErrors) { @@ -365,7 +363,7 @@ public class CompileEnvironment { } public boolean compileBunchOfSources(String sourceFileOrDir, String jar, String outputDir, boolean includeRuntime) { - CompileSession session = new CompileSession(myEnvironment, myFileNameTransformer); + CompileSession session = new CompileSession(myEnvironment); session.setStubs(stubs); session.addSources(sourceFileOrDir); diff --git a/compiler/cli/src/org/jetbrains/jet/compiler/CompileSession.java b/compiler/cli/src/org/jetbrains/jet/compiler/CompileSession.java index ec53cd8a23b..9e67675a583 100644 --- a/compiler/cli/src/org/jetbrains/jet/compiler/CompileSession.java +++ b/compiler/cli/src/org/jetbrains/jet/compiler/CompileSession.java @@ -42,7 +42,8 @@ import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM; import org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver; import org.jetbrains.jet.plugin.JetFileType; -import java.io.*; +import java.io.File; +import java.io.PrintStream; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -55,7 +56,6 @@ import java.util.List; public class CompileSession { private final JetCoreEnvironment myEnvironment; private final List mySourceFiles = new ArrayList(); - private final FileNameTransformer myFileNameTransformer; private List myErrors = new ArrayList(); private boolean stubs = false; @@ -66,12 +66,7 @@ public class CompileSession { private BindingContext myBindingContext; public CompileSession(JetCoreEnvironment environment) { - this(environment, FileNameTransformer.IDENTITY); - } - - public CompileSession(JetCoreEnvironment environment, FileNameTransformer fileNameTransformer) { myEnvironment = environment; - myFileNameTransformer = fileNameTransformer; } public void setStubs(boolean stubs) { @@ -211,7 +206,7 @@ public class CompileSession { @NotNull public ClassFileFactory generate(boolean module) { Project project = myEnvironment.getProject(); - GenerationState generationState = new GenerationState(project, ClassBuilderFactories.binaries(stubs), myFileNameTransformer); + GenerationState generationState = new GenerationState(project, ClassBuilderFactories.binaries(stubs)); generationState.compileCorrectFiles(myBindingContext, mySourceFiles, CompilationErrorHandler.THROW_EXCEPTION, true); ClassFileFactory answer = generationState.getFactory();