diff --git a/.idea/libraries/jps_test.xml b/.idea/libraries/jps_test.xml index 07d5d5a1128..619b2699e5a 100644 --- a/.idea/libraries/jps_test.xml +++ b/.idea/libraries/jps_test.xml @@ -1,5 +1,8 @@ + + + diff --git a/annotations/com/intellij/util/io/annotations.xml b/annotations/com/intellij/util/io/annotations.xml new file mode 100644 index 00000000000..0c5ea3e945f --- /dev/null +++ b/annotations/com/intellij/util/io/annotations.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/annotations/org/jetbrains/jps/builders/annotations.xml b/annotations/org/jetbrains/jps/builders/annotations.xml new file mode 100644 index 00000000000..29724c2ab81 --- /dev/null +++ b/annotations/org/jetbrains/jps/builders/annotations.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/annotations/org/jetbrains/jps/model/java/annotations.xml b/annotations/org/jetbrains/jps/model/java/annotations.xml new file mode 100644 index 00000000000..7d0651e0bb7 --- /dev/null +++ b/annotations/org/jetbrains/jps/model/java/annotations.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/annotations/org/jetbrains/jps/model/module/annotations.xml b/annotations/org/jetbrains/jps/model/module/annotations.xml new file mode 100644 index 00000000000..1410e8cea16 --- /dev/null +++ b/annotations/org/jetbrains/jps/model/module/annotations.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/descriptors/DeserializedClassDescriptor.java b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/descriptors/DeserializedClassDescriptor.java index 3dc53c4a4c5..fab86d09a20 100644 --- a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/descriptors/DeserializedClassDescriptor.java +++ b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/descriptors/DeserializedClassDescriptor.java @@ -316,6 +316,18 @@ public class DeserializedClassDescriptor extends AbstractClassDescriptor impleme @NotNull @Override public Collection getSupertypes() { + // We cannot have error supertypes because subclasses inherit error functions from them + // Filtering right away means copying the list every time, so we check for the rare condition first, and only then filter + for (JetType supertype : supertypes) { + if (supertype.isError()) { + return KotlinPackage.filter(supertypes, new Function1() { + @Override + public Boolean invoke(JetType type) { + return !type.isError(); + } + }); + } + } return supertypes; } diff --git a/jps-plugin/test/org/jetbrains/jet/jps/build/SimpleKotlinJpsBuildTest.kt b/jps-plugin/test/org/jetbrains/jet/jps/build/SimpleKotlinJpsBuildTest.kt new file mode 100644 index 00000000000..651fcebdffc --- /dev/null +++ b/jps-plugin/test/org/jetbrains/jet/jps/build/SimpleKotlinJpsBuildTest.kt @@ -0,0 +1,74 @@ +/* + * Copyright 2010-2014 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.jps.build + +import org.jetbrains.jps.builders.JpsBuildTestCase +import com.intellij.util.PathUtil +import org.jetbrains.jps.model.java.JpsJavaExtensionService + +public class SimpleKotlinJpsBuildTest : JpsBuildTestCase() { + override fun setUp() { + super.setUp() + System.setProperty("kotlin.jps.tests", "true") + } + + override fun tearDown() { + System.clearProperty("kotlin.jps.tests") + super.tearDown() + } + + public fun testThreeModulesNoReexport() { + val aFile = createFile("a/a.kt", + """ + trait A1 { + fun bar() + } + trait A2 { + fun bar() + } + """) + val a = addModule("a", PathUtil.getParentPath(aFile)) + + val bFile = createFile("b/b.kt", + """ + trait B1 { + fun foo(): B2? = null + } + + trait B2 : A1, A2 { + override fun bar() {} + } + """) + val b = addModule("b", PathUtil.getParentPath(bFile)) + JpsJavaExtensionService.getInstance().getOrCreateDependencyExtension( + b.getDependenciesList().addModuleDependency(a) + ).setExported(false) + + val cFile = createFile("c/c.kt", + """ + class C : B1 { + fun test() { + foo()?.bar() + } + } + """) + val c = addModule("c", PathUtil.getParentPath(cFile)) + c.getDependenciesList().addModuleDependency(b) + + rebuildAll() + } +}