TypeConversionDescriptorBase (PsiType from, PsiType to, PsiMember member, PsiExpression context, TypeMigrationLabeler labeler) { if (!(from instanceof PsiClassType) || !(from.getCanonicalText().equals(AtomicInteger.class.getName()) || from.getCanonicalText().equals(AtomicLong.class.getName()))) { return null; } if (!(to instanceof PsiClassType) || !(to.getCanonicalText().equals(JAVA_UTIL_CONCURRENT_ATOMIC_LONG_ADDER))) { return null; } if (member != null) { final String name = member.getName(); if (INCREMENT_DECREMENT_METHODS.contains(name)) { if (isMethodCallWithIgnoredReturnValue(context)) return null; assert name != null; String replacementMethodName = StringUtil.toLowerCase(name).contains("increment") ? "increment" : "decrement"; return new TypeConversionDescriptor("$v$.$method$()", "$v$." + replacementMethodName + "()"); } else if ("getAndAdd".equals(name) || "addAndGet".equals(name)) { if (isMethodCallWithIgnoredReturnValue(context)) return null; return new TypeConversionDescriptor("$v$.$method$($toAdd$)", "$v$.add($toAdd$)"); } else if ("set".equals(name) || "lazySet".equals(name) || "getAndSet".equals(name)) { if ("getAndSet".equals(name) && isMethodCallWithIgnoredReturnValue(context)) return null; String template = getParametersCount((PsiCallExpression)context.getParent()) == 1 ? "$l$.reset()" : "$l$.add($v$ - $l$.sum())"; return new TypeConversionDescriptor("$l$.$setMethodName$($v$)", template); } else if ("get".equals(name)) { return new TypeConversionDescriptor("$l$.get()", "$l$.sum()"); } else if (IDENTICAL_METHODS.contains(name)) { return new TypeConversionDescriptorBase(); } } else if (context instanceof PsiNewExpression) { final int parametersCount = getParametersCount((PsiCallExpression)context); if (parametersCount != -1) { return new TypeConversionDescriptor("new $className$(" + (parametersCount == 1 ? "$p$" : "") + ")", "new " + JAVA_UTIL_CONCURRENT_ATOMIC_LONG_ADDER + "()"); } } return null; }