private MethodDefinition findMethodInType(TypeDefinition typeDef, String uniqueStr) { String[] linkParts = uniqueStr.split("\\|"); if (linkParts.length != 5) return null; String methodName = linkParts[3]; String methodErasedSignature = linkParts[4]; if (methodName.trim().length() <= 0 || methodErasedSignature.trim().length() <= 0) return null; List<MethodDefinition> declaredMethods = typeDef.getDeclaredMethods(); if (declaredMethods == null) return null; boolean isFound = false; for (MethodDefinition declaredMethod : declaredMethods) { isFound = (declaredMethod != null && methodName.equals(declaredMethod.getName())); isFound = (isFound && methodErasedSignature.equals(declaredMethod.getErasedSignature())); if (isFound) { if (declaredMethod.isSynthetic() && !settings.getShowSyntheticMembers()) { return null; } else { return declaredMethod; } } } return null; }
@MethodVisitor public boolean checkMethod(MethodDefinition md) { return !md.isSynthetic(); }
@MethodVisitor public boolean check(MethodDefinition md) { return !md.isSynthetic(); }
@Override public Void visitMethodDeclaration(final MethodDeclaration node, final Void _) { final MethodDefinition method = node.getUserData(Keys.METHOD_DEFINITION); if (method != null) { if (method.isSynthetic() && method.isStatic()) { if (tryMatchAccessor(node) || tryMatchCallWrapper(node)) { _accessMethodDeclarations.put(makeMethodKey(method), node); } } } return super.visitMethodDeclaration(node, _); }
@Override public Void visitMethodDeclaration(final MethodDeclaration node, final Void _) { final MethodDefinition method = node.getUserData(Keys.METHOD_DEFINITION); if (method != null) { if (method.isSynthetic() && method.isStatic()) { if (tryMatchAccessor(node) || tryMatchCallWrapper(node)) { _accessMethodDeclarations.put(makeMethodKey(method), node); } } } return super.visitMethodDeclaration(node, _); }
@Override public Void visitMethodDeclaration(final MethodDeclaration node, final Void p) { final MethodDefinition method = node.getUserData(Keys.METHOD_DEFINITION); if (method != null) { if (method.isSynthetic() && method.isStatic()) { if (tryMatchAccessor(node) || tryMatchCallWrapper(node)) { _accessMethodDeclarations.put(makeMethodKey(method), node); } } } return super.visitMethodDeclaration(node, p); }
@Override public boolean test(final MethodDefinition m) { return m.isConstructor() && !m.isSynthetic() && !StringUtilities.equals(m.getErasedSignature(), method.getErasedSignature()); } }
@Override public boolean test(final MethodDefinition m) { return m.isConstructor() && !m.isSynthetic() && !StringUtilities.equals(m.getErasedSignature(), method.getErasedSignature()); } }
@Override public boolean test(final MethodDefinition m) { return m.isConstructor() && !m.isSynthetic() && !StringUtilities.equals(m.getErasedSignature(), method.getErasedSignature()); } }
@MethodVisitor public boolean check(MethodDefinition md, TypeDefinition td) { if(md.isSynthetic()) return false; if(md.getName().equals("compare") && md.getParameters().size() == 2 && md.getReturnType().getSimpleType() == JvmType.Integer && Types.isInstance(td, "java/util/Comparator")) return true; if(md.getName().equals("compareTo") && md.getParameters().size() == 1 && md.getReturnType().getSimpleType() == JvmType.Integer && Types.isInstance(td, "java/lang/Comparable")) return true; return false; }
static boolean isClassMethodCandidate(final MethodDefinition m) { return m != null && m.isSynthetic() && m.isStatic() && m.isPackagePrivate() && m.getParameters().size() == 1 && CommonTypeReferences.Class.isEquivalentTo(m.getReturnType()) && CommonTypeReferences.String.isEquivalentTo(m.getParameters().get(0).getParameterType()); }
@Override public Void visitMethodGroupExpression(final MethodGroupExpression node, final Void data) { final MemberReference reference = node.getUserData(Keys.MEMBER_REFERENCE); if (reference instanceof MethodReference) { final MethodReference method = (MethodReference) reference; final MethodDefinition resolvedMethod = method.resolve(); final DynamicCallSite callSite = node.getUserData(Keys.DYNAMIC_CALL_SITE); if (resolvedMethod != null && resolvedMethod.isSynthetic() && callSite != null) { inlineLambda(node, resolvedMethod); return null; } } return super.visitMethodGroupExpression(node, data); }
@Override public Void visitMethodGroupExpression(final MethodGroupExpression node, final Void data) { final MemberReference reference = node.getUserData(Keys.MEMBER_REFERENCE); if (reference instanceof MethodReference) { final MethodReference method = (MethodReference) reference; final MethodDefinition resolvedMethod = method.resolve(); final DynamicCallSite callSite = node.getUserData(Keys.DYNAMIC_CALL_SITE); if (resolvedMethod != null && resolvedMethod.isSynthetic() && callSite != null) { inlineLambda(node, resolvedMethod); return null; } } return super.visitMethodGroupExpression(node, data); }
@Override public Void visitMethodGroupExpression(final MethodGroupExpression node, final Void data) { final MemberReference reference = node.getUserData(Keys.MEMBER_REFERENCE); if (reference instanceof MethodReference) { final MethodReference method = (MethodReference) reference; final MethodDefinition resolvedMethod = method.resolve(); final DynamicCallSite callSite = node.getUserData(Keys.DYNAMIC_CALL_SITE); if (resolvedMethod != null && resolvedMethod.isSynthetic() && callSite != null) { inlineLambda(node, resolvedMethod); return null; } } return super.visitMethodGroupExpression(node, data); }
private static List<AssertionData> analyzeMember(MemberReference md) { List<AssertionData> assertions = new ArrayList<>(); if(md instanceof MethodDefinition && ((MethodDefinition) md).isSynthetic()) return assertions; for(CustomAnnotation anno : md.getAnnotations()) { if(anno.getAnnotationType().getFullName().equals(AssertWarning.class.getName())) { String type = ""; int minScore = 0, maxScore = 100; for(AnnotationParameter param : anno.getParameters()) { if(param.getMember().equals("value")) type = (String) ((ConstantAnnotationElement)param.getValue()).getConstantValue(); else if(param.getMember().equals("minScore")) minScore = (int) ((ConstantAnnotationElement)param.getValue()).getConstantValue(); else if(param.getMember().equals("maxScore")) maxScore = (int) ((ConstantAnnotationElement)param.getValue()).getConstantValue(); } assertions.add(new AssertionData(true, type, minScore, maxScore)); } else if(anno.getAnnotationType().getFullName().equals(AssertNoWarning.class.getName())) { String type = ""; for(AnnotationParameter param : anno.getParameters()) { if(param.getMember().equals("value")) type = (String) ((ConstantAnnotationElement)param.getValue()).getConstantValue(); } assertions.add(new AssertionData(false, type, Warning.MIN_SCORE, Warning.MAX_SCORE)); } } return assertions; }
private static boolean isSwitchMapMethod(final MethodReference method) { if (method == null) { return false; } final MethodDefinition definition = method instanceof MethodDefinition ? (MethodDefinition) method : method.resolve(); return definition != null && definition.isSynthetic() && definition.isStatic() && definition.isPackagePrivate() && StringUtilities.startsWith(definition.getName(), "$SWITCH_TABLE$") && MetadataResolver.areEquivalent(BuiltinTypes.Integer.makeArrayType(), definition.getReturnType()); }
resolvedMethod.isSynthetic() && (resolvedMethod.getFlags() & Flags.AccessFlags) == 0) {
private static boolean isSwitchMapMethod(final MethodReference method) { if (method == null) { return false; } final MethodDefinition definition = method instanceof MethodDefinition ? (MethodDefinition) method : method.resolve(); return definition != null && definition.isSynthetic() && definition.isStatic() && definition.isPackagePrivate() && StringUtilities.startsWith(definition.getName(), "$SWITCH_TABLE$") && MetadataResolver.areEquivalent(BuiltinTypes.Integer.makeArrayType(), definition.getReturnType()); }
private static boolean isSwitchMapMethod(final MethodReference method) { if (method == null) { return false; } final MethodDefinition definition = method instanceof MethodDefinition ? (MethodDefinition) method : method.resolve(); return definition != null && definition.isSynthetic() && definition.isStatic() && definition.isPackagePrivate() && StringUtilities.startsWith(definition.getName(), "$SWITCH_TABLE$") && MetadataResolver.areEquivalent(BuiltinTypes.Integer.makeArrayType(), definition.getReturnType()); }
@AstVisitor(nodes=AstNodes.ROOT, methodName="clone") public void visitBody(MethodDefinition md, Block body, TypeDefinition td, MethodContext mc, TypeHierarchy th) { if(!md.isSynthetic() && md.getErasedSignature().startsWith("()")) { hasClone = true; boolean onlyThrows = body.getBody().size() == 1 && Nodes.isOp(body.getBody().get(0), AstCode.AThrow);