use of com.intellij.psi.PsiType in project android-parcelable-intellij-plugin by mcharmas.
the class PsiUtils method getResolvedGenerics.
/**
* Resolves generics on the given type and returns them (if any) or null if there are none
*
* @param type
* @return
*/
public static List<PsiType> getResolvedGenerics(PsiType type) {
List<PsiType> psiTypes = null;
if (type instanceof PsiClassType) {
PsiClassType pct = (PsiClassType) type;
psiTypes = new ArrayList<PsiType>(pct.resolveGenerics().getSubstitutor().getSubstitutionMap().values());
}
return psiTypes;
}
use of com.intellij.psi.PsiType in project intellij-community by JetBrains.
the class ExpandBooleanPredicate method isBooleanAssignment.
public static boolean isBooleanAssignment(GrStatement expression) {
if (!(expression instanceof GrAssignmentExpression)) {
return false;
}
final GrAssignmentExpression assignment = (GrAssignmentExpression) expression;
final GrExpression rhs = assignment.getRValue();
if (rhs == null) {
return false;
}
if (rhs instanceof GrLiteral) {
return false;
}
final PsiType assignmentType = rhs.getType();
if (assignmentType == null) {
return false;
}
return assignmentType.equals(PsiType.BOOLEAN) || assignmentType.equalsToText("java.lang.Boolean");
}
use of com.intellij.psi.PsiType in project intellij-community by JetBrains.
the class DynamicTest method testMethod.
public void testMethod() throws Throwable {
final GrReferenceExpression referenceExpression = doDynamicFix();
final PsiType[] psiTypes = PsiUtil.getArgumentTypes(referenceExpression, false);
final String[] methodArgumentsNames = GroovyNamesUtil.getMethodArgumentsNames(getProject(), psiTypes);
final List<ParamInfo> pairs = QuickfixUtil.swapArgumentsAndTypes(methodArgumentsNames, psiTypes);
assertNotNull(getDClassElement().getMethod(referenceExpression.getReferenceName(), QuickfixUtil.getArgumentsTypes(pairs)));
}
use of com.intellij.psi.PsiType in project intellij-community by JetBrains.
the class GroovyIntroduceParameterObjectDelegate method createMergedParameterInfo.
@Override
public GrParameterInfo createMergedParameterInfo(GroovyIntroduceObjectClassDescriptor descriptor, GrMethod method, List<GrParameterInfo> oldMethodParameters) {
final GroovyPsiElementFactory elementFactory = GroovyPsiElementFactory.getInstance(method.getProject());
PsiType classType = elementFactory.createTypeByFQClassName(StringUtil.getQualifiedName(descriptor.getPackageName(), descriptor.getClassName()));
return new GrParameterInfo(descriptor.getClassName(), null, null, classType, -1, false) {
@Nullable
@Override
public PsiElement getActualValue(PsiElement callExpression, Object substitutor) {
final IntroduceParameterObjectDelegate<PsiNamedElement, ParameterInfo, IntroduceParameterObjectClassDescriptor<PsiNamedElement, ParameterInfo>> delegate = findDelegate(callExpression);
return delegate != null ? delegate.createNewParameterInitializerAtCallSite(callExpression, descriptor, oldMethodParameters, substitutor) : null;
}
};
}
use of com.intellij.psi.PsiType in project intellij-community by JetBrains.
the class GrSetStrongTypeIntention method getClosureParameterType.
@Nullable
private static PsiType getClosureParameterType(@NotNull PsiParameter parameter) {
final PsiElement scope = parameter.getDeclarationScope();
final PsiType type;
if (scope instanceof GrClosableBlock) {
type = ClosureParameterEnhancer.inferType((GrClosableBlock) scope, ((GrParameterList) parameter.getParent()).getParameterIndex(parameter));
} else {
type = null;
}
return type;
}
Aggregations