@Override public void visitMethod(Method obj) { currentVertex = findVertex(getXMethod()); super.visitMethod(obj); }
@Override public void visitMethod(Method obj) { if (!obj.isPrivate() || obj.isSynthetic()) { return; } super.visitMethod(obj); String methodName = getMethodName(); if (!"writeReplace".equals(methodName) && !"readResolve".equals(methodName) && !"readObject".equals(methodName) && !"readObjectNoData".equals(methodName) && !"writeObject".equals(methodName) && methodName.indexOf("debug") == -1 && methodName.indexOf("Debug") == -1 && methodName.indexOf("trace") == -1 && methodName.indexOf("Trace") == -1 && !Const.CONSTRUCTOR_NAME.equals(methodName) && !Const.STATIC_INITIALIZER_NAME.equals(methodName)) { for(AnnotationEntry a : obj.getAnnotationEntries()) { String typeName = a.getAnnotationType(); if ("Ljavax/annotation/PostConstruct;".equals(typeName) || "Ljavax/annotation/PreDestroy;".equals(typeName)) { return; } } definedPrivateMethods.add(MethodAnnotation.fromVisitedMethod(this)); } }
@Override public void visitMethod(Method obj) { if ((interfaceMethods != null) && ((obj.getAccessFlags() & Const.ACC_ABSTRACT) != 0)) { String curDetail = obj.getName() + obj.getSignature(); for (String infMethodDetail : interfaceMethods) { if (curDetail.equals(infMethodDetail)) { bugReporter.reportBug(new BugInstance(this, "USM_USELESS_ABSTRACT_METHOD", LOW_PRIORITY).addClassAndMethod( getClassContext().getJavaClass(), obj)); } } } super.visitMethod(obj); }
/** * implements the visitor to reset the state * * @param obj * the context object for the currently parsed method */ @Override public void visitMethod(Method obj) { stack.resetForMethodEntry(this); enumRegs.clear(); super.visitMethod(obj); }
/** * overrides the visitor to reset the opcode stack * * @param obj * the currently parsed method */ @Override public void visitMethod(Method obj) { stack.resetForMethodEntry(this); super.visitMethod(obj); }
/** * implements the visitor to reset the opcode stack * * @param obj * the context object of the currently parsed method */ @Override public void visitMethod(Method obj) { stack.resetForMethodEntry(this); super.visitMethod(obj); }
/** * overrides the visitor to reset the opcode stack * * @param obj * the currently parsed method */ @Override public void visitMethod(Method obj) { stack.resetForMethodEntry(this); super.visitMethod(obj); }
@Override public void visitMethod(Method obj) { stack.resetForMethodEntry(this); super.visitMethod(obj); }
/** * implements the visitor to reset the opcode stack * * @param obj * the context object of the currently parsed method */ @Override public void visitMethod(Method obj) { stack.resetForMethodEntry(this); super.visitMethod(obj); }
@Override public void visitMethod(Method obj) { stack.resetForMethodEntry(this); super.visitMethod(obj); }
/** * implements the visitor to reset the state * * @param obj * the context object for the currently parsed method */ @Override public void visitMethod(Method obj) { stack.resetForMethodEntry(this); enumRegs.clear(); super.visitMethod(obj); }
@Override public void visitMethod(Method obj) { currentVertex = findVertex(getXMethod()); super.visitMethod(obj); }
@Override public void visitMethod(Method obj) { if (!obj.isPrivate() || obj.isSynthetic()) { return; } super.visitMethod(obj); String methodName = getMethodName(); if (!"writeReplace".equals(methodName) && !"readResolve".equals(methodName) && !"readObject".equals(methodName) && !"readObjectNoData".equals(methodName) && !"writeObject".equals(methodName) && methodName.indexOf("debug") == -1 && methodName.indexOf("Debug") == -1 && methodName.indexOf("trace") == -1 && methodName.indexOf("Trace") == -1 && !"<init>".equals(methodName) && !"<clinit>".equals(methodName)) { for(AnnotationEntry a : obj.getAnnotationEntries()) { String typeName = a.getAnnotationType(); if ("Ljavax/annotation/PostConstruct;".equals(typeName) || "Ljavax/annotation/PreDestroy;".equals(typeName)) { return; } } definedPrivateMethods.add(MethodAnnotation.fromVisitedMethod(this)); } }
/** * implements the visitor to figure the pc where the method call must occur depending on whether the method returns a value, or not. * * @param obj * the context object of the currently parsed method */ @Override public void visitMethod(Method obj) { Code c = obj.getCode(); if (c != null) { byte[] opcodes = c.getCode(); if (opcodes != null) { trPCPos = opcodes.length - 1; if (!obj.getSignature().endsWith(Values.SIG_VOID)) { trPCPos -= 1; } trPCPos -= TAILRECURSIONFUDGE; possibleTailRecursion = true; isStatic = obj.isStatic(); stack.resetForMethodEntry(this); super.visitMethod(obj); } } }
/** * implements the visitor to figure the pc where the method call must occur depending on whether the method returns a value, or not. * * @param obj * the context object of the currently parsed method */ @Override public void visitMethod(Method obj) { Code c = obj.getCode(); if (c != null) { byte[] opcodes = c.getCode(); if (opcodes != null) { trPCPos = opcodes.length - 1; if (!obj.getSignature().endsWith(Values.SIG_VOID)) { trPCPos -= 1; } trPCPos -= TAILRECURSIONFUDGE; possibleTailRecursion = true; isStatic = obj.isStatic(); stack.resetForMethodEntry(this); super.visitMethod(obj); } } }
@Override public void visitMethod(Method obj) { if ((interfaceMethods != null) && ((obj.getAccessFlags() & Constants.ACC_ABSTRACT) != 0)) { String curDetail = obj.getName() + obj.getSignature(); for (String infMethodDetail : interfaceMethods) { if (curDetail.equals(infMethodDetail)) { bugReporter.reportBug(new BugInstance(this, "USM_USELESS_ABSTRACT_METHOD", LOW_PRIORITY).addClassAndMethod( getClassContext().getJavaClass(), obj)); } } } super.visitMethod(obj); }
state = State.SEEN_NOTHING; super.visitMethod(obj);
state = State.SEEN_NOTHING; super.visitMethod(obj);
/** * implements the visitor to look for non public methods that have an @Transactional annotation applied to it. Spring only scans public methods for special * handling. It also looks to see if the exceptions thrown by the method line up with the declared exceptions handled in the @Transactional annotation. * * @param obj * the currently parse method */ @Override public void visitMethod(Method obj) { if (getMethod().isSynthetic()) { return; } methodTransType = getTransactionalType(obj); if ((methodTransType != TransactionalType.NONE) && !obj.isPublic()) { bugReporter .reportBug(new BugInstance(this, BugType.JPAI_TRANSACTION_ON_NON_PUBLIC_METHOD.name(), NORMAL_PRIORITY).addClass(this).addMethod(cls, obj)); } if ((methodTransType == TransactionalType.WRITE) && (runtimeExceptionClass != null)) { try { Set<JavaClass> annotatedRollBackExceptions = getAnnotatedRollbackExceptions(obj); Set<JavaClass> declaredExceptions = getDeclaredExceptions(obj); reportExceptionMismatch(obj, annotatedRollBackExceptions, declaredExceptions, false, BugType.JPAI_NON_SPECIFIED_TRANSACTION_EXCEPTION_HANDLING); reportExceptionMismatch(obj, declaredExceptions, annotatedRollBackExceptions, true, BugType.JPAI_UNNECESSARY_TRANSACTION_EXCEPTION_HANDLING); } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } } super.visitMethod(obj); }
/** * implements the visitor to look for non public methods that have an @Transactional annotation applied to it. Spring only scans public methods for special * handling. It also looks to see if the exceptions thrown by the method line up with the declared exceptions handled in the @Transactional annotation. * * @param obj * the currently parse method */ @Override public void visitMethod(Method obj) { if (getMethod().isSynthetic()) { return; } methodTransType = getTransactionalType(obj); if ((methodTransType != TransactionalType.NONE) && !obj.isPublic()) { bugReporter .reportBug(new BugInstance(this, BugType.JPAI_TRANSACTION_ON_NON_PUBLIC_METHOD.name(), NORMAL_PRIORITY).addClass(this).addMethod(cls, obj)); } if ((methodTransType == TransactionalType.WRITE) && (runtimeExceptionClass != null)) { try { Set<JavaClass> annotatedRollBackExceptions = getAnnotatedRollbackExceptions(obj); Set<JavaClass> declaredExceptions = getDeclaredExceptions(obj); reportExceptionMismatch(obj, annotatedRollBackExceptions, declaredExceptions, false, BugType.JPAI_NON_SPECIFIED_TRANSACTION_EXCEPTION_HANDLING); reportExceptionMismatch(obj, declaredExceptions, annotatedRollBackExceptions, true, BugType.JPAI_UNNECESSARY_TRANSACTION_EXCEPTION_HANDLING); } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } } super.visitMethod(obj); }