boolean (GrReferenceExpression ref) { PsiType qualifierType = PsiImplUtil.getQualifierType(ref); if (!(qualifierType instanceof PsiClassType)) return false; PsiClass resolved = ((PsiClassType)qualifierType).resolve(); if (resolved == null) return false; if (ref.getParent() instanceof GrCall) { PsiMethod[] found = resolved.findMethodsByName("methodMissing", true); for (PsiMethod method : found) { if (MissingMethodAndPropertyUtil.isMethodMissing(method)) return true; } } else { PsiMethod[] found = resolved.findMethodsByName("propertyMissing", true); for (PsiMethod method : found) { if (MissingMethodAndPropertyUtil.isPropertyMissing(method)) return true; } } return false; }