mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] static trait method generic return type fixed (& test)
This commit is contained in:
+9
@@ -17,13 +17,22 @@ package org.jetbrains.plugins.groovy.lang.psi.impl.synthetic;
|
||||
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.PsiSubstitutor;
|
||||
import com.intellij.psi.PsiType;
|
||||
|
||||
/**
|
||||
* Created by Max Medvedev on 25/04/14
|
||||
*/
|
||||
public class GrTraitMethod extends GrMethodWrapper {
|
||||
private final PsiSubstitutor mySubstitutor;
|
||||
|
||||
protected GrTraitMethod(PsiMethod method, PsiSubstitutor substitutor) {
|
||||
super(method, substitutor);
|
||||
mySubstitutor = substitutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiType getReturnType() {
|
||||
return mySubstitutor.substitute(super.getReturnType());
|
||||
}
|
||||
|
||||
public static GrTraitMethod create(PsiMethod method, PsiSubstitutor substitutor) {
|
||||
|
||||
+10
@@ -2222,4 +2222,14 @@ class X {
|
||||
''', PsiMethod)
|
||||
}
|
||||
|
||||
void 'test static trait method generic return type'() {
|
||||
def method = resolveByText('''
|
||||
trait GenericSourceTrait<E> {
|
||||
static E someOtherStaticMethod() {null}
|
||||
}
|
||||
class SourceConcrete implements GenericSourceTrait<String> {})
|
||||
SourceConcrete.someOtherStatic<caret>Method()
|
||||
''', GrTraitMethod)
|
||||
assertEquals "java.lang.String", method.returnType.canonicalText
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user