private boolean isMethodDefinedOnConstructedType(Symbol symbol) { TypeJavaSymbol methodEnclosingClass = (TypeJavaSymbol) symbol.enclosingClass(); for (ClassJavaType superType : constructorType.superTypes()) { if (superType.getSymbol().equals(methodEnclosingClass)) { return true; } } return constructorType.equals(methodEnclosingClass); } }
private boolean isMethodDefinedOnConstructedType(Symbol symbol) { TypeJavaSymbol methodEnclosingClass = (TypeJavaSymbol) symbol.enclosingClass(); for (ClassJavaType superType : constructorType.superTypes()) { if (superType.getSymbol().equals(methodEnclosingClass)) { return true; } } return constructorType.equals(methodEnclosingClass); } }
private boolean isMethodDefinedOnConstructedType(Symbol symbol) { TypeJavaSymbol methodEnclosingClass = (TypeJavaSymbol) symbol.enclosingClass(); for (ClassJavaType superType : constructorType.superTypes()) { if (superType.getSymbol().equals(methodEnclosingClass)) { return true; } } return constructorType.equals(methodEnclosingClass); }
private static String getMethodRef(Symbol symbol) { return symbol.enclosingClass().name() + "." + symbol.name(); }
private static String getMethodRef(Symbol symbol) { return symbol.enclosingClass().name() + "." + symbol.name(); }
private boolean isCompareToInvocation(MethodInvocationTree invocation) { Symbol method = invocation.symbol(); if ("compareTo".equals(method.name()) && invocation.arguments().size() == 1) { return method.owner().enclosingClass().type().isSubtypeOf("java.lang.Comparable"); } return false; }
private static boolean isIteratorMethod(Symbol method) { Type type = method.owner().enclosingClass().type(); return !type.is("java.util.Iterator") && type.isSubtypeOf("java.util.Iterator"); }
private static boolean isStrutsActionParameter(VariableTree variableTree) { Type superClass = variableTree.symbol().enclosingClass().superClass(); return superClass != null && superClass.isSubtypeOf(STRUTS_ACTION_SUPERCLASS) && EXCLUDED_STRUTS_ACTION_PARAMETER_TYPES.contains(variableTree.symbol().type().fullyQualifiedName()); }
@CheckForNull private static Type getCallSiteType(MethodInvocationTree mit) { ExpressionTree methodSelect = mit.methodSelect(); // methodSelect can only be Tree.Kind.IDENTIFIER or Tree.Kind.MEMBER_SELECT if (methodSelect.is(Tree.Kind.IDENTIFIER)) { Symbol.TypeSymbol enclosingClassSymbol = ((IdentifierTree) methodSelect).symbol().enclosingClass(); return enclosingClassSymbol != null ? enclosingClassSymbol.type() : null; } else { return ((MemberSelectExpressionTree) methodSelect).expression().symbolType(); } }
private static boolean isIteratorMethod(Symbol method) { Type type = method.owner().enclosingClass().type(); return !type.is("java.util.Iterator") && type.isSubtypeOf("java.util.Iterator"); }
private boolean isIteratorMethod(Symbol method) { Type type = method.owner().enclosingClass().type(); return !type.is("java.util.Iterator") && type.isSubtypeOf("java.util.Iterator"); }
@CheckForNull private static Type getCallSiteType(MethodInvocationTree mit) { ExpressionTree methodSelect = mit.methodSelect(); // methodSelect can only be Tree.Kind.IDENTIFIER or Tree.Kind.MEMBER_SELECT if (methodSelect.is(Tree.Kind.IDENTIFIER)) { Symbol.TypeSymbol enclosingClassSymbol = ((IdentifierTree) methodSelect).symbol().enclosingClass(); return enclosingClassSymbol != null ? enclosingClassSymbol.type() : null; } else { return ((MemberSelectExpressionTree) methodSelect).expression().symbolType(); } }
private static boolean isStrutsActionParameter(VariableTree variableTree) { Type superClass = variableTree.symbol().enclosingClass().superClass(); return superClass != null && superClass.isSubtypeOf(STRUTS_ACTION_SUPERCLASS) && EXCLUDED_STRUTS_ACTION_PARAMETER_TYPES.contains(variableTree.symbol().type().fullyQualifiedName()); }
private static boolean isStrutsActionParameter(VariableTree variableTree) { Type superClass = variableTree.symbol().enclosingClass().superClass(); return superClass != null && superClass.isSubtypeOf(STRUTS_ACTION_SUPERCLASS) && EXCLUDED_STRUTS_ACTION_PARAMETER_TYPES.contains(variableTree.symbol().type().fullyQualifiedName()); }
private void checkIdentifier(IdentifierTree identifier) { Symbol.TypeSymbol enclosingClass = identifier.symbol().enclosingClass(); if (enclosingClass != null && enclosingClass.type().is("java.lang.System") && identifier.symbolType().is("java.io.InputStream") && identifier.name().equals("in") && !isClosingStream(identifier.parent())) { reportIssue(identifier); } }
private void checkIdentifier(IdentifierTree identifier) { Symbol.TypeSymbol enclosingClass = identifier.symbol().enclosingClass(); if (enclosingClass != null && enclosingClass.type().is("java.lang.System") && identifier.symbolType().is("java.io.InputStream") && identifier.name().equals("in") && !isClosingStream(identifier.parent())) { reportIssue(identifier); } }
private Type getCallSiteType(MethodInvocationTree mit) { ExpressionTree methodSelect = mit.methodSelect(); if (methodSelect.is(Tree.Kind.IDENTIFIER)) { Symbol.TypeSymbol enclosingClassSymbol = ((IdentifierTree) methodSelect).symbol().enclosingClass(); if (enclosingClassSymbol != null) { return enclosingClassSymbol.type(); } } else if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { MemberSelectExpressionTree memberSelect = (MemberSelectExpressionTree) methodSelect; return memberSelect.expression().symbolType(); } return null; }