com.intellij.psi.PsiSubstitutor Java Examples

The following examples show how to use com.intellij.psi.PsiSubstitutor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InternalFolivoraApiDetector.java    From Folivora with Apache License 2.0 5 votes vote down vote up
@Override
public void visitMethod(@NotNull JavaContext context,
                        @NotNull UCallExpression call,
                        @NotNull PsiMethod method) {
  JavaEvaluator evaluator = context.getEvaluator();

  //check Folivora.applyDrawableToView() call
  String methodName = method.getName();
  if (!methodName.equals(APPLY_METHOD) || !evaluator.isMemberInClass(method, FOLIVORA_CLASS)) return;

  PsiClass viewClass = evaluator.findClass(VIEW_CLASS);
  PsiClass currentClass = UastUtils.getContainingClass(call);
  if(currentClass == null || viewClass == null) return;
  if (!currentClass.isInheritor(viewClass, true/*deep check*/)) {
    report(context, call);
    return;
  }

  UMethod uMethod = UastUtils.getParentOfType(call, UMethod.class, false);
  if(uMethod == null) return;

  //check it is a view's constructor
  if (!uMethod.isConstructor()) {
    report(context, call);
    return;
  }

  MethodSignature signature = uMethod.getSignature(PsiSubstitutor.EMPTY);
  PsiType[] types = signature.getParameterTypes();
  if (types.length != 2) {
    report(context, call);
    return;
  }

  if (!types[0].equalsToText(CONTEXT_CLASS)
    || !types[1].equalsToText(ATTRS_CLASS)) {
    report(context, call);
  }
}
 
Example #2
Source File: HaxeClassResolveResult.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
@NotNull
@Override public PsiSubstitutor getSubstitutor() { return PsiSubstitutor.EMPTY; }
 
Example #3
Source File: InnerBuilderCollector.java    From innerbuilder with Apache License 2.0 4 votes vote down vote up
private static PsiFieldMember buildFieldMember(final PsiField field, final PsiClass containingClass,
        final PsiClass clazz) {
    return new PsiFieldMember(field,
            TypeConversionUtil.getSuperClassSubstitutor(containingClass, clazz, PsiSubstitutor.EMPTY));
}