Uast, Lint: Update and fix tests
This commit is contained in:
+1
-1
@@ -82,7 +82,7 @@ public class CipherGetInstanceDetector extends Detector implements UastScanner {
|
||||
UExpression expression = argumentList.get(0);
|
||||
if (expression instanceof ULiteralExpression) {
|
||||
ULiteralExpression argument = (ULiteralExpression)expression;
|
||||
String parameter = argument.asString();
|
||||
String parameter = argument.renderString();
|
||||
checkParameter(context, node, argument, parameter, false);
|
||||
} else if (expression instanceof UResolvable) {
|
||||
UDeclaration declaration = ((UResolvable)expression).resolve(context);
|
||||
|
||||
+14
-8
@@ -211,16 +211,22 @@ public class JavaPerformanceDetector extends Detector implements UastScanner {
|
||||
}
|
||||
|
||||
if (mCheckValueOf) {
|
||||
UType type = UastErrorType.INSTANCE;
|
||||
if (typeName == null) {
|
||||
typeName = classReference.getIdentifier();
|
||||
UDeclaration resolvedDeclaration = classReference.resolve(mContext);
|
||||
if (resolvedDeclaration instanceof UClass) {
|
||||
type = ((UClass) resolvedDeclaration).getDefaultType();
|
||||
typeName = type.getName();
|
||||
}
|
||||
}
|
||||
if ((typeName.equals(INTEGER)
|
||||
|| typeName.equals(BOOLEAN)
|
||||
|| typeName.equals(FLOAT)
|
||||
|| typeName.equals(CHARACTER)
|
||||
|| typeName.equals(LONG)
|
||||
|| typeName.equals(DOUBLE)
|
||||
|| typeName.equals(BYTE))
|
||||
if ((type.isInt()
|
||||
|| type.isBoolean()
|
||||
|| type.isFloat()
|
||||
|| type.isChar()
|
||||
|| type.isLong()
|
||||
|| type.isDouble()
|
||||
|| type.isShort()
|
||||
|| type.isByte())
|
||||
&& node.getValueArgumentCount() == 1) {
|
||||
String argument = node.getValueArguments().get(0).renderString();
|
||||
mContext.report(USE_VALUE_OF, node, mContext.getLocation(node), getUseValueOfErrorMessage(
|
||||
|
||||
Reference in New Issue
Block a user