J2K: fixed bug

This commit is contained in:
Valentin Kipyatkov
2014-07-16 21:18:37 +04:00
parent d154d2e25b
commit d7e857ed0a
5 changed files with 28 additions and 5 deletions
+1 -2
View File
@@ -96,10 +96,9 @@ class CodeBuilder(private val topElement: PsiElement?) {
val prefixElements = ArrayList<PsiElement>(1)
val postfixElements = ArrayList<PsiElement>(1)
for ((prototype, inheritance) in element.prototypes!!) {
if (prototype is LightElement) continue
assert(prototype !is PsiComment)
assert(prototype !is PsiWhiteSpace)
assert(topElement.isAncestor(prototype))
if (!topElement.isAncestor(prototype)) continue
prefixElements.collectPrefixElements(prototype, inheritance, notInsideElements)
postfixElements.collectPostfixElements(prototype, inheritance, notInsideElements)
}
@@ -3148,6 +3148,11 @@ public class JavaToKotlinConverterTestGenerated extends AbstractJavaToKotlinConv
doTest("j2k/tests/testData/ast/typeParameters/traitDoubleParametrizationWithTwoBoundsWithExtending.java");
}
@TestMetadata("typeFromOtherFile.java")
public void testTypeFromOtherFile() throws Exception {
doTest("j2k/tests/testData/ast/typeParameters/typeFromOtherFile.java");
}
@TestMetadata("where.java")
public void testWhere() throws Exception {
doTest("j2k/tests/testData/ast/typeParameters/where.java");
+5 -3
View File
@@ -1,9 +1,7 @@
package javaApi;
import org.jetbrains.annotations.Nullable;
import java.lang.Override;
import java.lang.String;
import java.util.Set;
public @interface Anon1 {
String[] value();
@@ -60,3 +58,7 @@ public class Derived extends Base {
public class WithVarargConstructor {
public WithVarargConstructor(int p, Object... objects) { }
}
class T {
public Set<String> set;
}
@@ -0,0 +1,8 @@
import java.util.*;
import javaApi.T;
class A {
public Object foo(T t) {
return Collections.nCopies(1, t.set);
}
}
@@ -0,0 +1,9 @@
import java.util.*
import javaApi.T
import kotlin.Set
class A {
public fun foo(t: T): Any {
return Collections.nCopies<Set<String>>(1, t.set)
}
}