@Override
 public void visitMethodCallExpression(PsiMethodCallExpression methodCallExpression) {
   super.visitMethodCallExpression(methodCallExpression);
   if (!MethodCallUtils.isSimpleCallToMethod(
           methodCallExpression,
           "javax.servlet.http.HttpSession",
           PsiType.VOID,
           "putValue",
           "java.lang.String",
           "java.lang.Object")
       && !MethodCallUtils.isSimpleCallToMethod(
           methodCallExpression,
           "javax.servlet.http.HttpSession",
           PsiType.VOID,
           "setAttribute",
           "java.lang.String",
           "java.lang.Object")) {
     return;
   }
   final PsiExpressionList argumentList = methodCallExpression.getArgumentList();
   final PsiExpression[] arguments = argumentList.getExpressions();
   if (arguments.length != 2) {
     return;
   }
   final PsiExpression argument = arguments[1];
   final PsiType argumentType = argument.getType();
   if (argumentType == null) {
     return;
   }
   if (SerializationUtils.isProbablySerializable(argumentType)) {
     return;
   }
   registerError(argument);
 }
 @Override
 public void visitMethodCallExpression(@NotNull PsiMethodCallExpression expression) {
   super.visitMethodCallExpression(expression);
   if (!MethodCallUtils.isCallToMethod(
           expression, "java.lang.Thread", PsiType.VOID, "sleep", PsiType.LONG)
       && !MethodCallUtils.isCallToMethod(
           expression, "java.lang.Thread", PsiType.VOID, "sleep", PsiType.LONG, PsiType.INT)) {
     return;
   }
   if (!ControlFlowUtils.isInLoop(expression)) {
     return;
   }
   registerMethodCallError(expression);
 }
 @Override
 public void visitMethodCallExpression(@NotNull PsiMethodCallExpression expression) {
   super.visitMethodCallExpression(expression);
   if (!MethodCallUtils.isCallToMethod(
           expression,
           "java.util.concurrent.locks.Condition",
           PsiType.VOID,
           HardcodedMethodConstants.NOTIFY)
       && !MethodCallUtils.isCallToMethod(
           expression,
           "java.util.concurrent.locks.Condition",
           PsiType.VOID,
           HardcodedMethodConstants.NOTIFY_ALL)) {
     return;
   }
   registerMethodCallError(expression);
 }
 private static boolean isValueOfCall(PsiMethodCallExpression methodCallExpression) {
   final PsiExpressionList argumentList = methodCallExpression.getArgumentList();
   final PsiExpression[] arguments = argumentList.getExpressions();
   if (arguments.length != 1) {
     return false;
   }
   final PsiExpression argument = arguments[0];
   final PsiType type = argument.getType();
   return (MethodCallUtils.isCallToMethod(
               methodCallExpression,
               CommonClassNames.JAVA_LANG_INTEGER,
               null,
               "valueOf",
               PsiType.INT)
           && PsiType.INT.equals(type))
       || (MethodCallUtils.isCallToMethod(
               methodCallExpression,
               CommonClassNames.JAVA_LANG_SHORT,
               null,
               "valueOf",
               PsiType.SHORT)
           && PsiType.SHORT.equals(type))
       || (MethodCallUtils.isCallToMethod(
               methodCallExpression,
               CommonClassNames.JAVA_LANG_BYTE,
               null,
               "valueOf",
               PsiType.BYTE)
           && PsiType.BYTE.equals(type))
       || (MethodCallUtils.isCallToMethod(
               methodCallExpression,
               CommonClassNames.JAVA_LANG_LONG,
               null,
               "valueOf",
               PsiType.LONG)
           && PsiType.LONG.equals(type))
       || (MethodCallUtils.isCallToMethod(
               methodCallExpression,
               CommonClassNames.JAVA_LANG_CHARACTER,
               null,
               "valueOf",
               PsiType.CHAR)
           && PsiType.CHAR.equals(type))
       || (MethodCallUtils.isCallToMethod(
               methodCallExpression,
               CommonClassNames.JAVA_LANG_DOUBLE,
               null,
               "valueOf",
               PsiType.DOUBLE)
           && PsiType.DOUBLE.equals(type))
       || (MethodCallUtils.isCallToMethod(
               methodCallExpression,
               CommonClassNames.JAVA_LANG_FLOAT,
               null,
               "valueOf",
               PsiType.FLOAT)
           && PsiType.FLOAT.equals(type));
 }
 private static boolean shortcutReplace(PsiExpression expression, String classToConstruct) {
   if (!(expression instanceof PsiMethodCallExpression)) {
     return false;
   }
   final PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression) expression;
   final PsiReferenceExpression methodExpression = methodCallExpression.getMethodExpression();
   final PsiExpression qualifierExpression = methodExpression.getQualifierExpression();
   if (qualifierExpression == null) {
     return false;
   }
   if (classToConstruct.equals(CommonClassNames.JAVA_LANG_INTEGER)) {
     if (MethodCallUtils.isCallToMethod(
         methodCallExpression, CommonClassNames.JAVA_LANG_INTEGER, PsiType.INT, "intValue")) {
       expression.replace(qualifierExpression);
       return true;
     }
   } else if (classToConstruct.equals(CommonClassNames.JAVA_LANG_SHORT)) {
     if (MethodCallUtils.isCallToMethod(
         methodCallExpression, CommonClassNames.JAVA_LANG_SHORT, PsiType.SHORT, "shortValue")) {
       expression.replace(qualifierExpression);
       return true;
     }
   } else if (classToConstruct.equals(CommonClassNames.JAVA_LANG_BYTE)) {
     if (MethodCallUtils.isCallToMethod(
         methodCallExpression, CommonClassNames.JAVA_LANG_BYTE, PsiType.BYTE, "byteValue")) {
       expression.replace(qualifierExpression);
       return true;
     }
   } else if (classToConstruct.equals(CommonClassNames.JAVA_LANG_CHARACTER)) {
     if (MethodCallUtils.isCallToMethod(
         methodCallExpression,
         CommonClassNames.JAVA_LANG_CHARACTER,
         PsiType.CHAR,
         "charValue")) {
       expression.replace(qualifierExpression);
       return true;
     }
   } else if (classToConstruct.equals(CommonClassNames.JAVA_LANG_LONG)) {
     if (MethodCallUtils.isCallToMethod(
         methodCallExpression, CommonClassNames.JAVA_LANG_LONG, PsiType.LONG, "longValue")) {
       expression.replace(qualifierExpression);
       return true;
     }
   } else if (classToConstruct.equals(CommonClassNames.JAVA_LANG_FLOAT)) {
     if (MethodCallUtils.isCallToMethod(
         methodCallExpression, CommonClassNames.JAVA_LANG_FLOAT, PsiType.FLOAT, "floatValue")) {
       expression.replace(qualifierExpression);
       return true;
     }
   } else if (classToConstruct.equals(CommonClassNames.JAVA_LANG_DOUBLE)) {
     if (MethodCallUtils.isCallToMethod(
         methodCallExpression,
         CommonClassNames.JAVA_LANG_DOUBLE,
         PsiType.DOUBLE,
         "doubleValue")) {
       expression.replace(qualifierExpression);
       return true;
     }
   }
   return false;
 }