From 77df57c150d0a4f22ba6a4eaac47c8537496171c Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Mon, 2 Jul 2012 23:48:27 +0400 Subject: [PATCH] Replaced jdk-headers with jdk-annotations everywhere. --- build.xml | 22 ++---- .../jetbrains/jet/cli/jvm/K2JVMCompiler.java | 14 ++-- .../jet/cli/jvm/K2JVMCompilerArguments.java | 4 +- .../cli/jvm/compiler/JetCoreEnvironment.java | 6 +- .../resolve/java/CompilerDependencies.java | 26 +++---- .../resolve/java/CompilerSpecialMode.java | 2 +- .../resolve/java/PsiClassFinderForJvm.java | 2 +- compiler/testData/cli/help.out | 2 +- .../testData/codegen/regressions/kt471.kt | 2 +- .../tests/alt-headers/ArrayListClone.jet | 1 - .../tests/alt-headers/ArrayListToArray.jet | 3 +- .../jet/CompileCompilerDependenciesTest.java | 9 ++- .../ForTestCompileJdkHeaders.java | 55 -------------- .../ForTestCompileSomething.java | 2 +- .../ForTestPackJdkAnnotations.java | 72 +++++++++++++++++++ .../jvm/compiler/CompileEnvironmentTest.java | 16 ++--- .../compiler/JavaDescriptorResolverTest.java | 6 +- .../src/org/jetbrains/jet/utils/PathUtil.java | 4 +- libraries/tools/kotlin-maven-plugin/pom.xml | 2 +- .../kotlin/maven/KotlinCompileMojoBase.java | 38 +++++----- 20 files changed, 143 insertions(+), 145 deletions(-) delete mode 100644 compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestCompileJdkHeaders.java create mode 100644 compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestPackJdkAnnotations.java diff --git a/build.xml b/build.xml index 3e33ea8f50d..8950dc6f06b 100644 --- a/build.xml +++ b/build.xml @@ -349,29 +349,17 @@ - + - - - - - - - - - - - - - - + + - + @@ -438,7 +426,7 @@ + depends="init,prepareDist,injectorsGenerator,generateInjectors,compiler,compilerSources,antTools,jdkAnnotations,runtime,lang,jslib"/> diff --git a/compiler/cli/src/org/jetbrains/jet/cli/jvm/K2JVMCompiler.java b/compiler/cli/src/org/jetbrains/jet/cli/jvm/K2JVMCompiler.java index 021a6a4067a..030bdbf9f37 100644 --- a/compiler/cli/src/org/jetbrains/jet/cli/jvm/K2JVMCompiler.java +++ b/compiler/cli/src/org/jetbrains/jet/cli/jvm/K2JVMCompiler.java @@ -57,17 +57,17 @@ public class K2JVMCompiler extends CLICompiler argumentsSourceDirs = arguments.getSourceDirs(); if (!arguments.script && diff --git a/compiler/cli/src/org/jetbrains/jet/cli/jvm/K2JVMCompilerArguments.java b/compiler/cli/src/org/jetbrains/jet/cli/jvm/K2JVMCompilerArguments.java index 5b8a8da64fe..f7b7a592e01 100644 --- a/compiler/cli/src/org/jetbrains/jet/cli/jvm/K2JVMCompilerArguments.java +++ b/compiler/cli/src/org/jetbrains/jet/cli/jvm/K2JVMCompilerArguments.java @@ -57,8 +57,8 @@ public class K2JVMCompilerArguments extends CompilerArguments { @Argument(value = "stdlib", description = "Path to the stdlib.jar") public String stdlib; - @Argument(value = "jdkHeaders", description = "Path to the kotlin-jdk-headers.jar") - public String jdkHeaders; + @Argument(value = "jdkAnnotations", description = "Path to the kotlin-jdk-annotations.jar") + public String jdkAnnotations; @Argument(value = "mode", description = "Special compiler modes: stubs or jdkHeaders") public String mode; diff --git a/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java b/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java index fdf06424186..1aa3da3cdf9 100644 --- a/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java +++ b/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java @@ -90,9 +90,9 @@ public class JetCoreEnvironment extends JavaCoreEnvironment { } annotationsProvider = new CoreAnnotationsProvider(); - if (compilerSpecialMode.includeJdkHeaders()) { - for (VirtualFile root : compilerDependencies.getJdkHeaderRoots()) { - addLibraryRoot(root); + if (compilerSpecialMode.includeJdkAnnotations()) { + for (VirtualFile root : compilerDependencies.getJdkAnnotationsRoots()) { + annotationsProvider.addExternalAnnotationsRoot(root); } } diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/CompilerDependencies.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/CompilerDependencies.java index fd6abaa85d0..5fa03ebcf52 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/CompilerDependencies.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/CompilerDependencies.java @@ -1,3 +1,4 @@ +/* /* * Copyright 2010-2012 JetBrains s.r.o. * @@ -35,14 +36,14 @@ public class CompilerDependencies { @Nullable private final File jdkJar; @Nullable - private final File jdkHeadersJar; + private final File jdkAnnotationsJar; @Nullable private final File runtimeJar; - public CompilerDependencies(@NotNull CompilerSpecialMode compilerSpecialMode, @Nullable File jdkJar, @Nullable File jdkHeadersJar, @Nullable File runtimeJar) { + public CompilerDependencies(@NotNull CompilerSpecialMode compilerSpecialMode, @Nullable File jdkJar, @Nullable File jdkAnnotationsJar, @Nullable File runtimeJar) { this.compilerSpecialMode = compilerSpecialMode; this.jdkJar = jdkJar; - this.jdkHeadersJar = jdkHeadersJar; + this.jdkAnnotationsJar = jdkAnnotationsJar; this.runtimeJar = runtimeJar; if (compilerSpecialMode.includeJdk()) { @@ -50,9 +51,9 @@ public class CompilerDependencies { throw new IllegalArgumentException("jdk must be included for mode " + compilerSpecialMode); } } - if (compilerSpecialMode.includeJdkHeaders()) { - if (jdkHeadersJar == null) { - throw new IllegalArgumentException("jdkHeaders must be included for mode " + compilerSpecialMode); + if (compilerSpecialMode.includeJdkAnnotations()) { + if (jdkAnnotationsJar == null) { + throw new IllegalArgumentException("jdkAnnotations must be included for mode " + compilerSpecialMode); } } if (compilerSpecialMode.includeKotlinRuntime()) { @@ -72,20 +73,15 @@ public class CompilerDependencies { return jdkJar; } - @Nullable - public File getJdkHeadersJar() { - return jdkHeadersJar; - } - @Nullable public File getRuntimeJar() { return runtimeJar; } @NotNull - public List getJdkHeaderRoots() { - if (compilerSpecialMode.includeJdkHeaders()) { - return Collections.singletonList(PathUtil.jarFileOrDirectoryToVirtualFile(jdkHeadersJar)); + public List getJdkAnnotationsRoots() { + if (compilerSpecialMode.includeJdkAnnotations()) { + return Collections.singletonList(PathUtil.jarFileOrDirectoryToVirtualFile(jdkAnnotationsJar)); } else { return Collections.emptyList(); @@ -107,7 +103,7 @@ public class CompilerDependencies { return new CompilerDependencies( compilerSpecialMode, compilerSpecialMode.includeJdk() ? findRtJar() : null, - compilerSpecialMode.includeJdkHeaders() ? PathUtil.getAltHeadersPath() : null, + compilerSpecialMode.includeJdkAnnotations() ? PathUtil.getJdkAnnotationsPath() : null, compilerSpecialMode.includeKotlinRuntime() ? PathUtil.getDefaultRuntimePath() : null); } diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/CompilerSpecialMode.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/CompilerSpecialMode.java index a75759cc274..bbaf18e7e97 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/CompilerSpecialMode.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/CompilerSpecialMode.java @@ -28,7 +28,7 @@ public enum CompilerSpecialMode { JS, ; - public boolean includeJdkHeaders() { + public boolean includeJdkAnnotations() { return this == REGULAR || this == STDLIB || this == IDEA; } diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/PsiClassFinderForJvm.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/PsiClassFinderForJvm.java index 86d6a0691b6..1b8ea48944c 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/PsiClassFinderForJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/PsiClassFinderForJvm.java @@ -59,7 +59,7 @@ public class PsiClassFinderForJvm implements PsiClassFinder { @PostConstruct public void initialize() { - this.altClassFinder = new AltClassFinder(project, compilerDependencies.getJdkHeaderRoots()); + this.altClassFinder = new AltClassFinder(project, compilerDependencies.getJdkAnnotationsRoots()); this.javaSearchScope = new DelegatingGlobalSearchScope(GlobalSearchScope.allScope(project)) { @Override public boolean contains(VirtualFile file) { diff --git a/compiler/testData/cli/help.out b/compiler/testData/cli/help.out index 1ccd9f21337..b8ae6583445 100644 --- a/compiler/testData/cli/help.out +++ b/compiler/testData/cli/help.out @@ -5,7 +5,7 @@ Usage: org.jetbrains.jet.cli.jvm.K2JVMCompilerArguments -annotations [String] paths to external annotations -includeRuntime [flag] -stdlib [String] Path to the stdlib.jar - -jdkHeaders [String] Path to the kotlin-jdk-headers.jar + -jdkAnnotations [String] Path to the kotlin-jdk-annotations.jar -mode [String] Special compiler modes: stubs or jdkHeaders -output [String] output directory -module [String] module to compile diff --git a/compiler/testData/codegen/regressions/kt471.kt b/compiler/testData/codegen/regressions/kt471.kt index 8fe5d415cbc..72c05984f79 100644 --- a/compiler/testData/codegen/regressions/kt471.kt +++ b/compiler/testData/codegen/regressions/kt471.kt @@ -50,7 +50,7 @@ fun test6() : Boolean { return true } -// ArrayList without jdk-headers cannot be used in these tests +// ArrayList without jdk-annotations cannot be used in these tests class MyArrayList() { private var value17: T? = null private var value39: T? = null diff --git a/compiler/testData/diagnostics/tests/alt-headers/ArrayListClone.jet b/compiler/testData/diagnostics/tests/alt-headers/ArrayListClone.jet index e45e0a7a99e..e33c2a3c3fb 100644 --- a/compiler/testData/diagnostics/tests/alt-headers/ArrayListClone.jet +++ b/compiler/testData/diagnostics/tests/alt-headers/ArrayListClone.jet @@ -1,4 +1,3 @@ - package kotlin1 import java.util.* diff --git a/compiler/testData/diagnostics/tests/alt-headers/ArrayListToArray.jet b/compiler/testData/diagnostics/tests/alt-headers/ArrayListToArray.jet index 33e3ff9136d..d1e7a54987c 100644 --- a/compiler/testData/diagnostics/tests/alt-headers/ArrayListToArray.jet +++ b/compiler/testData/diagnostics/tests/alt-headers/ArrayListToArray.jet @@ -1,4 +1,3 @@ - package kotlin1 import java.util.* @@ -6,6 +5,6 @@ import java.util.* fun main(args : Array) { val al : ArrayList = ArrayList() - // A type mismatch on this line means that alt-headers were not loaded + // A type mismatch on this line means that jdk-annotations were not loaded al.toArray(Array(3, {1})) : Array } diff --git a/compiler/tests/org/jetbrains/jet/CompileCompilerDependenciesTest.java b/compiler/tests/org/jetbrains/jet/CompileCompilerDependenciesTest.java index c3e084a4c68..f720cb232d4 100644 --- a/compiler/tests/org/jetbrains/jet/CompileCompilerDependenciesTest.java +++ b/compiler/tests/org/jetbrains/jet/CompileCompilerDependenciesTest.java @@ -18,11 +18,10 @@ package org.jetbrains.jet; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileBuiltins; -import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileJdkHeaders; +import org.jetbrains.jet.codegen.forTestCompile.ForTestPackJdkAnnotations; import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileRuntime; import org.jetbrains.jet.lang.resolve.java.CompilerDependencies; import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode; -import org.jetbrains.jet.utils.PathUtil; import org.junit.Test; /** @@ -36,8 +35,8 @@ public class CompileCompilerDependenciesTest { } @Test - public void compileJdkHeaders() { - ForTestCompileJdkHeaders.jdkHeadersForTests(); + public void packJdkAnnotations() { + ForTestPackJdkAnnotations.jdkAnnotationsForTests(); } @Test @@ -53,7 +52,7 @@ public class CompileCompilerDependenciesTest { return new CompilerDependencies( compilerSpecialMode, compilerSpecialMode.includeJdk() ? (mockJdk ? JetTestUtils.findMockJdkRtJar() : CompilerDependencies.findRtJar()) : null, - compilerSpecialMode.includeJdkHeaders() ? ForTestCompileJdkHeaders.jdkHeadersForTests() : null, + compilerSpecialMode.includeJdkAnnotations() ? ForTestPackJdkAnnotations.jdkAnnotationsForTests() : null, compilerSpecialMode.includeKotlinRuntime() ? ForTestCompileRuntime.runtimeJarForTests() : null); } } diff --git a/compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestCompileJdkHeaders.java b/compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestCompileJdkHeaders.java deleted file mode 100644 index b94fbbc14b5..00000000000 --- a/compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestCompileJdkHeaders.java +++ /dev/null @@ -1,55 +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.codegen.forTestCompile; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.jet.cli.common.ExitCode; -import org.jetbrains.jet.cli.jvm.K2JVMCompiler; - -import java.io.File; - -/** - * @author Stepan Koltsov - */ -public class ForTestCompileJdkHeaders { - - private ForTestCompileJdkHeaders() { - } - - private static class JdkHeaders extends ForTestCompileSomething { - - JdkHeaders() { - super("jdkHeaders"); - } - - @Override - protected void doCompile(@NotNull File classesDir) throws Exception { - ExitCode exitCode = new K2JVMCompiler().exec( - System.err, "-output", classesDir.getPath(), "-src", "./jdk-headers/src", "-mode", "jdkHeaders"); - if (exitCode != ExitCode.OK) { - throw new IllegalStateException("jdk headers compilation failed: " + exitCode); - } - } - - private static final JdkHeaders jdkHeaders = new JdkHeaders(); - } - - @NotNull - public static File jdkHeadersForTests() { - return ForTestCompileSomething.ACTUALLY_COMPILE ? JdkHeaders.jdkHeaders.getJarFile() : new File("dist/kotlinc/lib/alt/kotlin-jdk-headers.jar"); - } -} diff --git a/compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestCompileSomething.java b/compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestCompileSomething.java index 1682f61309a..b7049853eb0 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestCompileSomething.java +++ b/compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestCompileSomething.java @@ -80,7 +80,7 @@ abstract class ForTestCompileSomething { } } - private static void copyToJar(File root, JarOutputStream os) throws IOException { + static void copyToJar(File root, JarOutputStream os) throws IOException { Stack> toCopy = new Stack>(); toCopy.add(new Pair("", root)); while (!toCopy.empty()) { diff --git a/compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestPackJdkAnnotations.java b/compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestPackJdkAnnotations.java new file mode 100644 index 00000000000..95703cf44da --- /dev/null +++ b/compiler/tests/org/jetbrains/jet/codegen/forTestCompile/ForTestPackJdkAnnotations.java @@ -0,0 +1,72 @@ +/* + * 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.codegen.forTestCompile; + +import com.google.common.io.Files; +import com.intellij.openapi.util.Pair; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.JetTestUtils; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Stack; +import java.util.jar.JarEntry; +import java.util.jar.JarOutputStream; + +/** + * @author Stepan Koltsov + */ +public class ForTestPackJdkAnnotations { + + private ForTestPackJdkAnnotations() { + } + + private static File jarFile = null; + + private static File getJarFile() { + if (jarFile == null) { + try { + File tmpDir = JetTestUtils.tmpDir("runtimejar"); + jarFile = new File(tmpDir, "runtime.jar"); + FileOutputStream annotationsJar = new FileOutputStream(jarFile); + try { + JarOutputStream jarOutputStream = new JarOutputStream(new BufferedOutputStream(annotationsJar)); + try { + ForTestCompileSomething.copyToJar(new File("./jdk-annotations"), jarOutputStream); + } + finally { + jarOutputStream.close(); + } + } + finally { + annotationsJar.close(); + } + } + catch (IOException e) { + throw new AssertionError(e); + } + } + return jarFile; + } + + @NotNull + public static File jdkAnnotationsForTests() { + return ForTestCompileSomething.ACTUALLY_COMPILE ? getJarFile() : new File("dist/kotlinc/lib/alt/kotlin-jdk-annotations.jar"); + } +} diff --git a/compiler/tests/org/jetbrains/jet/jvm/compiler/CompileEnvironmentTest.java b/compiler/tests/org/jetbrains/jet/jvm/compiler/CompileEnvironmentTest.java index 9a709e18d8e..c4cf024f8a0 100644 --- a/compiler/tests/org/jetbrains/jet/jvm/compiler/CompileEnvironmentTest.java +++ b/compiler/tests/org/jetbrains/jet/jvm/compiler/CompileEnvironmentTest.java @@ -20,7 +20,7 @@ import com.intellij.openapi.util.io.FileUtil; import junit.framework.TestCase; import org.jetbrains.jet.cli.common.ExitCode; import org.jetbrains.jet.cli.jvm.K2JVMCompiler; -import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileJdkHeaders; +import org.jetbrains.jet.codegen.forTestCompile.ForTestPackJdkAnnotations; import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileRuntime; import org.jetbrains.jet.parsing.JetParsingTest; import org.junit.Assert; @@ -44,13 +44,13 @@ public class CompileEnvironmentTest extends TestCase { try { File stdlib = ForTestCompileRuntime.runtimeJarForTests(); - File jdkHeaders = ForTestCompileJdkHeaders.jdkHeadersForTests(); + File jdkAnnotations = ForTestPackJdkAnnotations.jdkAnnotationsForTests(); File resultJar = new File(tempDir, "result.jar"); ExitCode rv = new K2JVMCompiler().exec(System.out, - "-module", JetParsingTest.getTestDataDir() + "/compiler/smoke/Smoke.kts", - "-jar", resultJar.getAbsolutePath(), - "-stdlib", stdlib.getAbsolutePath(), - "-jdkHeaders", jdkHeaders.getAbsolutePath()); + "-module", JetParsingTest.getTestDataDir() + "/compiler/smoke/Smoke.kts", + "-jar", resultJar.getAbsolutePath(), + "-stdlib", stdlib.getAbsolutePath(), + "-jdkAnnotations", jdkAnnotations.getAbsolutePath()); Assert.assertEquals("compilation completed with non-zero code", ExitCode.OK, rv); FileInputStream fileInputStream = new FileInputStream(resultJar); try { @@ -78,10 +78,10 @@ public class CompileEnvironmentTest extends TestCase { try { File out = new File(tempDir, "out"); File stdlib = ForTestCompileRuntime.runtimeJarForTests(); - File jdkHeaders = ForTestCompileJdkHeaders.jdkHeadersForTests(); + File jdkAnnotations = ForTestPackJdkAnnotations.jdkAnnotationsForTests(); ExitCode exitCode = new K2JVMCompiler() .exec(System.out, "-src", JetParsingTest.getTestDataDir() + "/compiler/smoke/Smoke.kt", "-output", - out.getAbsolutePath(), "-stdlib", stdlib.getAbsolutePath(), "-jdkHeaders", jdkHeaders.getAbsolutePath()); + out.getAbsolutePath(), "-stdlib", stdlib.getAbsolutePath(), "-jdkAnnotations", jdkAnnotations.getAbsolutePath()); Assert.assertEquals(ExitCode.OK, exitCode); assertEquals(1, out.listFiles().length); assertEquals(1, out.listFiles()[0].listFiles().length); diff --git a/compiler/tests/org/jetbrains/jet/jvm/compiler/JavaDescriptorResolverTest.java b/compiler/tests/org/jetbrains/jet/jvm/compiler/JavaDescriptorResolverTest.java index cd44e7d0798..13d4c760a87 100644 --- a/compiler/tests/org/jetbrains/jet/jvm/compiler/JavaDescriptorResolverTest.java +++ b/compiler/tests/org/jetbrains/jet/jvm/compiler/JavaDescriptorResolverTest.java @@ -19,7 +19,7 @@ package org.jetbrains.jet.jvm.compiler; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.JetTestUtils; import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment; -import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileJdkHeaders; +import org.jetbrains.jet.codegen.forTestCompile.ForTestPackJdkAnnotations; import org.jetbrains.jet.di.InjectorForJavaSemanticServices; import org.jetbrains.jet.lang.descriptors.ClassDescriptor; import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor; @@ -36,7 +36,6 @@ import org.junit.Assert; import java.io.File; import java.io.IOException; import java.util.Collection; -import java.util.Set; /** * @author Stepan Koltsov @@ -80,7 +79,8 @@ public class JavaDescriptorResolverTest extends TestCaseWithTmpdir { } public void testResolveJdkHeaderClassWithoutJdk() { - JetCoreEnvironment jetCoreEnvironment = new JetCoreEnvironment(myTestRootDisposable, new CompilerDependencies(CompilerSpecialMode.IDEA, null, ForTestCompileJdkHeaders.jdkHeadersForTests(), null)); + JetCoreEnvironment jetCoreEnvironment = new JetCoreEnvironment(myTestRootDisposable, new CompilerDependencies(CompilerSpecialMode.IDEA, null, ForTestPackJdkAnnotations + .jdkAnnotationsForTests(), null)); InjectorForJavaSemanticServices injector = new InjectorForJavaSemanticServices( jetCoreEnvironment.getCompilerDependencies(), jetCoreEnvironment.getProject()); diff --git a/compiler/util/src/org/jetbrains/jet/utils/PathUtil.java b/compiler/util/src/org/jetbrains/jet/utils/PathUtil.java index d6c2e2e7d53..67872ec6984 100644 --- a/compiler/util/src/org/jetbrains/jet/utils/PathUtil.java +++ b/compiler/util/src/org/jetbrains/jet/utils/PathUtil.java @@ -94,8 +94,8 @@ public class PathUtil { } @Nullable - public static File getAltHeadersPath() { - return getFilePackedIntoLib("alt/kotlin-jdk-headers.jar"); + public static File getJdkAnnotationsPath() { + return getFilePackedIntoLib("alt/kotlin-jdk-annotations.jar"); } @NotNull diff --git a/libraries/tools/kotlin-maven-plugin/pom.xml b/libraries/tools/kotlin-maven-plugin/pom.xml index 04eabd45912..c33637e151f 100644 --- a/libraries/tools/kotlin-maven-plugin/pom.xml +++ b/libraries/tools/kotlin-maven-plugin/pom.xml @@ -38,7 +38,7 @@ - + ${kotlin-sdk}/lib/alt false diff --git a/libraries/tools/kotlin-maven-plugin/src/main/java/org/jetbrains/kotlin/maven/KotlinCompileMojoBase.java b/libraries/tools/kotlin-maven-plugin/src/main/java/org/jetbrains/kotlin/maven/KotlinCompileMojoBase.java index 68c7b255e1a..81776965737 100644 --- a/libraries/tools/kotlin-maven-plugin/src/main/java/org/jetbrains/kotlin/maven/KotlinCompileMojoBase.java +++ b/libraries/tools/kotlin-maven-plugin/src/main/java/org/jetbrains/kotlin/maven/KotlinCompileMojoBase.java @@ -205,8 +205,8 @@ public abstract class KotlinCompileMojoBase extends AbstractMojo { log.info("Classes directory is " + output); arguments.setOutputDir(output); - arguments.jdkHeaders = getAltHeaders().getPath(); - log.debug("Using alt headers from " + arguments.jdkHeaders); + arguments.jdkAnnotations = getJdkAnnotations().getPath(); + log.debug("Using jdk annotations from " + arguments.jdkAnnotations); } // TODO: Make a better runtime detection or get rid of it entirely @@ -224,37 +224,37 @@ public abstract class KotlinCompileMojoBase extends AbstractMojo { return null; } - private File altHeadersPath; + private File jdkAnnotationsPath; - protected File getAltHeaders() { - if (altHeadersPath != null) - return altHeadersPath; + protected File getJdkAnnotations() { + if (jdkAnnotationsPath != null) + return jdkAnnotationsPath; try { - altHeadersPath = extractAltHeaders(); + jdkAnnotationsPath = extractJdkAnnotations(); - if (altHeadersPath == null) - throw new RuntimeException("Can't find kotlin alt headers in maven plugin resources"); + if (jdkAnnotationsPath == null) + throw new RuntimeException("Can't find kotlin jdk annotations in maven plugin resources"); } catch (IOException e) { throw new RuntimeException(e); } - return altHeadersPath; + return jdkAnnotationsPath; } - private File extractAltHeaders() throws IOException { - final String kotlin_jdk_headers = "kotlin-jdk-headers.jar"; + private File extractJdkAnnotations() throws IOException { + final String kotlin_jdk_annotations = "kotlin-jdk-annotations.jar"; - final URL jdkHeadersResource = Resources.getResource(kotlin_jdk_headers); - if (jdkHeadersResource == null) + final URL jdkAnnotationsResource = Resources.getResource(kotlin_jdk_annotations); + if (jdkAnnotationsResource == null) return null; - final File jdkHeadersTempDir = Files.createTempDir(); - jdkHeadersTempDir.deleteOnExit(); + final File jdkAnnotationsTempDir = Files.createTempDir(); + jdkAnnotationsTempDir.deleteOnExit(); - final File jdkHeadersFile = new File(jdkHeadersTempDir, kotlin_jdk_headers); - Files.copy(Resources.newInputStreamSupplier(jdkHeadersResource), jdkHeadersFile); + final File jdkAnnotationsFile = new File(jdkAnnotationsTempDir, kotlin_jdk_annotations); + Files.copy(Resources.newInputStreamSupplier(jdkAnnotationsResource), jdkAnnotationsFile); - return jdkHeadersFile; + return jdkAnnotationsFile; } }