resolve generic constructor
This commit is contained in:
+16
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.jet.lang.resolve.java;
|
package org.jetbrains.jet.lang.resolve.java;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
import com.intellij.psi.*;
|
import com.intellij.psi.*;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -25,6 +26,7 @@ import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
|||||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||||
import org.jetbrains.jet.lang.resolve.FqName;
|
import org.jetbrains.jet.lang.resolve.FqName;
|
||||||
import org.jetbrains.jet.lang.types.*;
|
import org.jetbrains.jet.lang.types.*;
|
||||||
|
import org.jetbrains.jet.lang.types.checker.JetTypeChecker;
|
||||||
import org.jetbrains.jet.lang.types.lang.JetStandardClasses;
|
import org.jetbrains.jet.lang.types.lang.JetStandardClasses;
|
||||||
import org.jetbrains.jet.lang.types.lang.JetStandardLibrary;
|
import org.jetbrains.jet.lang.types.lang.JetStandardLibrary;
|
||||||
import org.jetbrains.jet.lang.types.lang.PrimitiveType;
|
import org.jetbrains.jet.lang.types.lang.PrimitiveType;
|
||||||
@@ -35,6 +37,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author abreslav
|
* @author abreslav
|
||||||
@@ -126,6 +129,19 @@ public class JavaTypeTransformer {
|
|||||||
|
|
||||||
if (psiClass instanceof PsiTypeParameter) {
|
if (psiClass instanceof PsiTypeParameter) {
|
||||||
PsiTypeParameter typeParameter = (PsiTypeParameter) psiClass;
|
PsiTypeParameter typeParameter = (PsiTypeParameter) psiClass;
|
||||||
|
|
||||||
|
PsiTypeParameterListOwner typeParameterListOwner = typeParameter.getOwner();
|
||||||
|
if (typeParameterListOwner instanceof PsiMethod) {
|
||||||
|
PsiMethod psiMethod = (PsiMethod) typeParameterListOwner;
|
||||||
|
if (psiMethod.isConstructor()) {
|
||||||
|
Set<JetType> supertypesJet = Sets.newHashSet();
|
||||||
|
for (PsiClassType supertype : typeParameter.getExtendsListTypes()) {
|
||||||
|
supertypesJet.add(transformToType(supertype, TypeUsage.UPPER_BOUND, typeVariableResolver));
|
||||||
|
}
|
||||||
|
return TypeUtils.intersect(JetTypeChecker.INSTANCE, supertypesJet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TypeParameterDescriptor typeParameterDescriptor = typeVariableResolver.getTypeVariable(typeParameter.getName());
|
TypeParameterDescriptor typeParameterDescriptor = typeVariableResolver.getTypeVariable(typeParameter.getName());
|
||||||
|
|
||||||
if (howThisTypeIsUsed == TypeUsage.TYPE_ARGUMENT || howThisTypeIsUsed == TypeUsage.UPPER_BOUND) {
|
if (howThisTypeIsUsed == TypeUsage.TYPE_ARGUMENT || howThisTypeIsUsed == TypeUsage.UPPER_BOUND) {
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package test;
|
||||||
|
|
||||||
|
class ConstructorGenericDeep {
|
||||||
|
<P> ConstructorGenericDeep(java.lang.Class<P> cl) {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
open class ConstructorGenericDeep(p0: java.lang.Class<Any?>?) : java.lang.Object()
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
namespace test
|
||||||
|
|
||||||
|
open class test.ConstructorGenericDeep : java.lang.Object {
|
||||||
|
final /*constructor*/ fun <init>(/*0*/ p0: java.lang.Class<jet.Any?>?): test.ConstructorGenericDeep
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package test;
|
||||||
|
|
||||||
|
class ConstructorGenericSimple {
|
||||||
|
<P> ConstructorGenericSimple(P p) {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
open class ConstructorGenericSimple(p0: Any?) : java.lang.Object()
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
namespace test
|
||||||
|
|
||||||
|
open class test.ConstructorGenericSimple : java.lang.Object {
|
||||||
|
final /*constructor*/ fun <init>(/*0*/ p0: jet.Any?): test.ConstructorGenericSimple
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package test;
|
||||||
|
|
||||||
|
class ConstructorGenericUpperBound {
|
||||||
|
<P extends java.util.RandomAccess> ConstructorGenericUpperBound(P p) {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
open class ConstructorGenericUpperBound(p0: java.util.RandomAccess?) : java.lang.Object()
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
namespace test
|
||||||
|
|
||||||
|
open class test.ConstructorGenericUpperBound : java.lang.Object {
|
||||||
|
final /*constructor*/ fun <init>(/*0*/ p0: java.util.RandomAccess?): test.ConstructorGenericUpperBound
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user