use of com.intellij.psi.PsiType in project intellij-community by JetBrains.
the class GrDocMethodParamsImpl method getParameterTypes.
@Override
public PsiType[] getParameterTypes() {
ArrayList<PsiType> types = new ArrayList<>();
PsiManagerEx manager = getManager();
GlobalSearchScope scope = GlobalSearchScope.allScope(getProject());
PsiElementFactory factory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
for (GrDocMethodParameter parameter : getParameters()) {
GrDocReferenceElement typeElement = parameter.getTypeElement();
try {
PsiType type = factory.createTypeFromText(typeElement.getText(), this);
type = TypesUtil.boxPrimitiveType(type, manager, scope);
types.add(type);
} catch (IncorrectOperationException e) {
LOG.info(e);
types.add(null);
}
}
return types.toArray(PsiType.createArray(types.size()));
}
use of com.intellij.psi.PsiType in project intellij-community by JetBrains.
the class GrTupleType method isAssignableFrom.
@Override
public boolean isAssignableFrom(@NotNull PsiType type) {
if (type instanceof GrTupleType) {
PsiType[] otherComponents = ((GrTupleType) type).getComponentTypes();
PsiType[] componentTypes = getComponentTypes();
for (int i = 0; i < Math.min(componentTypes.length, otherComponents.length); i++) {
PsiType componentType = componentTypes[i];
PsiType otherComponent = otherComponents[i];
if (otherComponent == null) {
if (componentType != null && !TypesUtil.isClassType(componentType, CommonClassNames.JAVA_LANG_OBJECT))
return false;
} else if (componentType != null && !componentType.isAssignableFrom(otherComponent))
return false;
}
return true;
}
return super.isAssignableFrom(type);
}
use of com.intellij.psi.PsiType in project intellij-community by JetBrains.
the class GrMapType method merge.
public static GrMapType merge(GrMapType l, GrMapType r) {
final GlobalSearchScope scope = l.getScope().intersectWith(r.getResolveScope());
final LinkedHashMap<String, PsiType> strings = ContainerUtil.newLinkedHashMap();
strings.putAll(l.getStringEntries());
strings.putAll(r.getStringEntries());
List<Couple<PsiType>> other = new ArrayList<>();
other.addAll(l.getOtherEntries());
other.addAll(r.getOtherEntries());
return create(l.myFacade, scope, strings, other);
}
use of com.intellij.psi.PsiType in project intellij-community by JetBrains.
the class GrMapType method create.
public static GrMapType create(GlobalSearchScope scope) {
JavaPsiFacade facade = JavaPsiFacade.getInstance(scope.getProject());
List<Couple<PsiType>> otherEntries = Collections.emptyList();
LinkedHashMap<String, PsiType> stringEntries = ContainerUtil.newLinkedHashMap();
return new GrMapTypeImpl(facade, scope, stringEntries, otherEntries, LanguageLevel.JDK_1_5);
}
use of com.intellij.psi.PsiType in project intellij-community by JetBrains.
the class DFAType method create.
@Nullable
public static DFAType create(DFAType t1, DFAType t2, PsiManager manager) {
if (t1.equals(t2))
return t1;
final PsiType primary = TypesUtil.getLeastUpperBoundNullable(t1.primary, t2.primary, manager);
final DFAType type = new DFAType(primary);
for (Mixin mixin1 : t1.mixins) {
for (Mixin mixin2 : t2.mixins) {
if (mixin1.ID == mixin2.ID && mixin1.myNegated == mixin2.myNegated) {
type.mixins.add(mixin1);
}
}
}
return type;
}
Aggregations