diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/state/JetTypeMapper.java b/compiler/backend/src/org/jetbrains/jet/codegen/state/JetTypeMapper.java index d30e9c690cb..43c6ea03348 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/state/JetTypeMapper.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/state/JetTypeMapper.java @@ -282,7 +282,7 @@ public class JetTypeMapper extends BindingTraceAware { if (descriptor instanceof TypeParameterDescriptor) { TypeParameterDescriptor typeParameterDescriptor = (TypeParameterDescriptor) descriptor; - Type type = mapType(typeParameterDescriptor.getUpperBoundsAsType(), kind); + Type type = mapType(typeParameterDescriptor.getUpperBounds().iterator().next(), kind); if (signatureVisitor != null) { signatureVisitor.writeTypeVariable(typeParameterDescriptor.getName(), type); } diff --git a/compiler/testData/codegen/boxWithJava/functions/max.java b/compiler/testData/codegen/boxWithJava/functions/max.java new file mode 100644 index 00000000000..aa9bb7bfe98 --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/functions/max.java @@ -0,0 +1,7 @@ +import java.util.*; + +public class max { + public static > T max(Collection coll) { + return Collections.max(coll); + } +} diff --git a/compiler/testData/codegen/boxWithJava/functions/max.kt b/compiler/testData/codegen/boxWithJava/functions/max.kt new file mode 100644 index 00000000000..1b701b3a9d3 --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/functions/max.kt @@ -0,0 +1,3 @@ +fun box(): String { + return max.max(java.util.Arrays.asList("AK", "OK", "EK"))!! +} diff --git a/compiler/testData/codegen/boxWithJava/functions/unrelatedUpperBounds.java b/compiler/testData/codegen/boxWithJava/functions/unrelatedUpperBounds.java new file mode 100644 index 00000000000..ef6bbe40827 --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/functions/unrelatedUpperBounds.java @@ -0,0 +1,7 @@ +import java.util.Collection; + +public class unrelatedUpperBounds { + public static T id(T p) { + return p; + } +} diff --git a/compiler/testData/codegen/boxWithJava/functions/unrelatedUpperBounds.kt b/compiler/testData/codegen/boxWithJava/functions/unrelatedUpperBounds.kt new file mode 100644 index 00000000000..3bd2a24f1cb --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/functions/unrelatedUpperBounds.kt @@ -0,0 +1,3 @@ +fun box(): String { + return unrelatedUpperBounds.id("OK" as java.lang.String)!! as jet.String +} diff --git a/compiler/testData/loadJava/compiledJavaCompareWithKotlin/library/Max.java b/compiler/testData/loadJava/compiledJavaCompareWithKotlin/library/Max.java new file mode 100644 index 00000000000..e20729bf430 --- /dev/null +++ b/compiler/testData/loadJava/compiledJavaCompareWithKotlin/library/Max.java @@ -0,0 +1,9 @@ +package test; + +import java.util.Collection; + +public class Max { + public > T max(Collection coll) { + throw new UnsupportedOperationException(); + } +} diff --git a/compiler/testData/loadJava/compiledJavaCompareWithKotlin/library/Max.kt b/compiler/testData/loadJava/compiledJavaCompareWithKotlin/library/Max.kt new file mode 100644 index 00000000000..c8aa91532be --- /dev/null +++ b/compiler/testData/loadJava/compiledJavaCompareWithKotlin/library/Max.kt @@ -0,0 +1,7 @@ +package test + +public open class Max: Object() { + public open fun max(p0 : Collection?): T? where T : Comparable? { + throw UnsupportedOperationException() + } +} diff --git a/compiler/testData/loadJava/compiledJavaCompareWithKotlin/library/Max.txt b/compiler/testData/loadJava/compiledJavaCompareWithKotlin/library/Max.txt new file mode 100644 index 00000000000..245709a918f --- /dev/null +++ b/compiler/testData/loadJava/compiledJavaCompareWithKotlin/library/Max.txt @@ -0,0 +1,6 @@ +package test + +public open class Max : java.lang.Object { + public constructor Max() + public open fun max(/*0*/ p0: jet.Collection?): T? where T : jet.Comparable? +} diff --git a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java index 51f2679b555..9fc4e99d8ed 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java @@ -16,17 +16,14 @@ package org.jetbrains.jet.codegen.generated; -import junit.framework.Assert; import junit.framework.Test; import junit.framework.TestSuite; - -import java.io.File; -import java.util.regex.Pattern; import org.jetbrains.jet.JetTestUtils; import org.jetbrains.jet.test.InnerTestClasses; import org.jetbrains.jet.test.TestMetadata; -import org.jetbrains.jet.codegen.generated.AbstractBlackBoxCodegenTest; +import java.io.File; +import java.util.regex.Pattern; /** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") @@ -137,6 +134,11 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege doTestWithJava("compiler/testData/codegen/boxWithJava/functions/constructor.kt"); } + @TestMetadata("max.kt") + public void testMax() throws Exception { + doTestWithJava("compiler/testData/codegen/boxWithJava/functions/max.kt"); + } + @TestMetadata("referencesStaticInnerClassMethod.kt") public void testReferencesStaticInnerClassMethod() throws Exception { doTestWithJava("compiler/testData/codegen/boxWithJava/functions/referencesStaticInnerClassMethod.kt"); @@ -147,6 +149,11 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege doTestWithJava("compiler/testData/codegen/boxWithJava/functions/referencesStaticInnerClassMethodL2.kt"); } + @TestMetadata("unrelatedUpperBounds.kt") + public void testUnrelatedUpperBounds() throws Exception { + doTestWithJava("compiler/testData/codegen/boxWithJava/functions/unrelatedUpperBounds.kt"); + } + } @TestMetadata("compiler/testData/codegen/boxWithJava/innerClass") diff --git a/compiler/tests/org/jetbrains/jet/jvm/compiler/LoadJavaTestGenerated.java b/compiler/tests/org/jetbrains/jet/jvm/compiler/LoadJavaTestGenerated.java index d948204cb51..66654e0d46c 100644 --- a/compiler/tests/org/jetbrains/jet/jvm/compiler/LoadJavaTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/jvm/compiler/LoadJavaTestGenerated.java @@ -1386,6 +1386,11 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest { doTestCompiledJavaCompareWithKotlin("compiler/testData/loadJava/compiledJavaCompareWithKotlin/library/LoadIterator.java"); } + @TestMetadata("Max.java") + public void testMax() throws Exception { + doTestCompiledJavaCompareWithKotlin("compiler/testData/loadJava/compiledJavaCompareWithKotlin/library/Max.java"); + } + } @TestMetadata("compiler/testData/loadJava/compiledJavaCompareWithKotlin/modality") diff --git a/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveRecursiveComparingTestGenerated.java b/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveRecursiveComparingTestGenerated.java index 5639187eac4..81d08533f3b 100644 --- a/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveRecursiveComparingTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveRecursiveComparingTestGenerated.java @@ -2369,6 +2369,11 @@ public class LazyResolveRecursiveComparingTestGenerated extends AbstractLazyReso doTestNotCheckingPrimaryConstructors("compiler/testData/loadJava/compiledJavaCompareWithKotlin/library/LoadIterator.kt"); } + @TestMetadata("Max.kt") + public void testMax() throws Exception { + doTestNotCheckingPrimaryConstructors("compiler/testData/loadJava/compiledJavaCompareWithKotlin/library/Max.kt"); + } + } @TestMetadata("compiler/testData/loadJava/compiledJavaCompareWithKotlin/modality") diff --git a/jdk-annotations/java/util/annotations.xml b/jdk-annotations/java/util/annotations.xml index 296c3570ba0..8843aa74602 100644 --- a/jdk-annotations/java/util/annotations.xml +++ b/jdk-annotations/java/util/annotations.xml @@ -1259,7 +1259,7 @@ - + @@ -1281,7 +1281,7 @@ - +