@Nullable
 private static PsiClass getContainingContextClass(PsiElement element) {
   final PsiClass aClass = ClassUtils.getContainingClass(element);
   if (aClass instanceof PsiAnonymousClass) {
     final PsiAnonymousClass anonymousClass = (PsiAnonymousClass) aClass;
     final PsiExpressionList args = anonymousClass.getArgumentList();
     if (args != null && PsiTreeUtil.isAncestor(args, element, true)) {
       return ClassUtils.getContainingClass(aClass);
     }
   }
   return aClass;
 }
 @Override
 public void visitMethodCallExpression(@NotNull PsiMethodCallExpression call) {
   super.visitMethodCallExpression(call);
   final PsiReferenceExpression methodExpression = call.getMethodExpression();
   final PsiElement qualifier = methodExpression.getQualifier();
   if (!(qualifier instanceof PsiReferenceExpression)) {
     return;
   }
   final PsiMethod method = call.resolveMethod();
   if (method == null) {
     return;
   }
   if (!method.hasModifierProperty(PsiModifier.STATIC)) {
     return;
   }
   final PsiElement referent = ((PsiReference) qualifier).resolve();
   if (!(referent instanceof PsiClass)) {
     return;
   }
   final PsiClass referencedClass = (PsiClass) referent;
   final PsiClass declaringClass = method.getContainingClass();
   if (declaringClass == null) {
     return;
   }
   if (declaringClass.equals(referencedClass)) {
     return;
   }
   final PsiClass containingClass = ClassUtils.getContainingClass(call);
   if (!ClassUtils.isClassVisibleFromClass(containingClass, declaringClass)) {
     return;
   }
   registerMethodCallError(call, declaringClass, referencedClass);
 }
 @Override
 public void visitReferenceExpression(@NotNull PsiReferenceExpression expression) {
   if (FileTypeUtils.isInServerPageFile(expression)) {
     // disable for jsp files IDEADEV-12957
     return;
   }
   super.visitReferenceExpression(expression);
   if (expression.getQualifierExpression() == null) {
     return;
   }
   final PsiElement referenceNameElement = expression.getReferenceNameElement();
   if (referenceNameElement == null) {
     return;
   }
   final PsiElement containingClass = getContainingContextClass(expression);
   if (containingClass == null) {
     return;
   }
   final PsiElement element = expression.resolve();
   if (!(element instanceof PsiMethod || element instanceof PsiField)) {
     return;
   }
   final PsiMember member = (PsiMember) element;
   if (!member.hasModifierProperty(PsiModifier.PRIVATE)) {
     return;
   }
   final PsiClass memberClass = ClassUtils.getContainingClass(member);
   if (memberClass == null) {
     return;
   }
   if (memberClass.equals(containingClass)) {
     return;
   }
   registerError(referenceNameElement, memberClass, member);
 }
 @Override
 public void visitNewExpression(@NotNull PsiNewExpression expression) {
   if (!PsiUtil.isLanguageLevel5OrHigher(expression)) {
     return;
   }
   super.visitNewExpression(expression);
   final PsiType type = expression.getType();
   if (type == null) {
     return;
   }
   final String canonicalText = type.getCanonicalText();
   if (!cachedNumberTypes.contains(canonicalText)) {
     return;
   }
   final PsiClass aClass = ClassUtils.getContainingClass(expression);
   if (aClass != null && cachedNumberTypes.contains(aClass.getQualifiedName())) {
     return;
   }
   final PsiExpressionList argumentList = expression.getArgumentList();
   if (argumentList == null) {
     return;
   }
   final PsiExpression[] arguments = argumentList.getExpressions();
   if (arguments.length != 1) {
     return;
   }
   final PsiExpression argument = arguments[0];
   final PsiType argumentType = argument.getType();
   if (argumentType == null || argumentType.equalsToText("java.lang.String")) {
     return;
   }
   registerError(expression, expression);
 }