use of org.jetbrains.plugins.groovy.lang.psi.impl.GrClassReferenceType in project intellij-community by JetBrains.
the class GrAnonymousClassDefinitionImpl method getBaseClassType.
@Override
@NotNull
public PsiClassType getBaseClassType() {
PsiClassType type = SoftReference.dereference(myCachedBaseType);
if (type != null && type.isValid())
return type;
type = new GrClassReferenceType(getBaseClassReferenceGroovy());
myCachedBaseType = new SoftReference<>(type);
return type;
}
use of org.jetbrains.plugins.groovy.lang.psi.impl.GrClassReferenceType in project intellij-community by JetBrains.
the class GrReferenceListImpl method getReferencedTypes.
@NotNull
@Override
public PsiClassType[] getReferencedTypes() {
if (myCachedTypes == null || !isValid()) {
final ArrayList<PsiClassType> types = new ArrayList<>();
for (GrCodeReferenceElement ref : getReferenceElementsGroovy()) {
types.add(new GrClassReferenceType(ref));
}
myCachedTypes = types.toArray(new PsiClassType[types.size()]);
}
return myCachedTypes;
}
use of org.jetbrains.plugins.groovy.lang.psi.impl.GrClassReferenceType in project intellij-community by JetBrains.
the class GrClassReferenceTypePointer method calcType.
@Nullable
@Override
protected GrClassReferenceType calcType() {
final GrReferenceElement reference = mySmartPsiElementPointer.getElement();
if (reference != null) {
return new GrClassReferenceType(reference);
}
try {
final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(myProject);
GrTypeElement typeElement = factory.createTypeElement(myReferenceText, null);
return (GrClassReferenceType) typeElement.getType();
} catch (IncorrectOperationException e) {
LOG.error(e);
}
return null;
}
use of org.jetbrains.plugins.groovy.lang.psi.impl.GrClassReferenceType in project intellij-community by JetBrains.
the class GrTypeParameterParameterExtendsListImpl method getReferencedTypes.
@Override
@NotNull
public PsiClassType[] getReferencedTypes() {
final GrCodeReferenceElement[] refs = findChildrenByClass(GrCodeReferenceElement.class);
PsiClassType[] result = new PsiClassType[refs.length];
for (int i = 0; i < result.length; i++) {
result[i] = new GrClassReferenceType(refs[i]);
}
return result;
}
use of org.jetbrains.plugins.groovy.lang.psi.impl.GrClassReferenceType in project intellij-community by JetBrains.
the class GroovyShellCodeFragment method addVariable.
public void addVariable(String name, GrExpression expr) {
PsiType type = expr.getType();
if (type instanceof GrClassReferenceType) {
final PsiClassType.ClassResolveResult resolveResult = ((GrClassReferenceType) type).resolveGenerics();
final PsiClass psiClass = resolveResult.getElement();
type = psiClass == null ? null : new PsiImmediateClassType(psiClass, resolveResult.getSubstitutor());
}
if (type != null) {
myVariables.put(name, new GrLightVariable(getManager(), name, type, this));
}
}
Aggregations