@Override protected void onMethodInvocationFound(MethodInvocationTree mit) { Type symbolType = mit.arguments().get(0).symbolType(); if (!(symbolType.is("long") || symbolType.is("java.lang.Long"))) { reportIssue(MethodsHelper.methodName(mit), "Remove this \"Double.longBitsToDouble\" call."); } }
private static boolean superClassHasOnlyStaticMethods(Symbol.TypeSymbol newClassTypeSymbol) { Type superClass = newClassTypeSymbol.superClass(); if (superClass != null && !superClass.is("java.lang.Object")) { return hasOnlyStaticMethods(superClass.symbol()); } return true; }
private static boolean needsClosing(Type type) { for (String ignoredTypes : IGNORED_CLOSEABLE_SUBTYPES) { if (type.is(ignoredTypes)) { return false; } } return isCloseable(type); }
private static String isSubclassOfAny(Type type, ListTree<TypeTree> thrownList) { for (TypeTree thrown : thrownList) { String name = thrown.symbolType().fullyQualifiedName(); if (!type.is(name) && type.isSubtypeOf(name)) { return name; } } return null; }
private SymbolicValue createIdentifierSymbolicValue(IdentifierTree identifier) { final Type type = identifier.symbol().type(); if (type != null && type.is("java.lang.Boolean")) { if ("TRUE".equals(identifier.name())) { return SymbolicValue.TRUE_LITERAL; } else if ("FALSE".equals(identifier.name())) { return SymbolicValue.FALSE_LITERAL; } } return createDefaultSymbolicValue(); }