示例#1
0
 /** Method invocation. */
 public void visitInvokeInstruction(InvokeInstruction i) {
   Type[] argTypes = i.getArgumentTypes(cp);
   for (int j = 0; j < argTypes.length; j++) cv.registerCoupling(argTypes[j]);
   cv.registerCoupling(i.getReturnType(cp));
   /* Measuring decision: measure overloaded methods separately */
   cv.registerMethodInvocation(i.getClassName(cp), i.getMethodName(cp), argTypes);
 }
示例#2
0
  /** Visit the method's exception handlers. */
  private void updateExceptionHandlers() {
    CodeExceptionGen[] handlers = mg.getExceptionHandlers();

    /* Measuring decision: couple exceptions */
    for (int i = 0; i < handlers.length; i++) {
      Type t = handlers[i].getCatchType();
      if (t != null) cv.registerCoupling(t);
    }
  }
示例#3
0
 /** Visit an instanceof instruction. */
 public void visitINSTANCEOF(INSTANCEOF i) {
   cv.registerCoupling(i.getType(cp));
 }
示例#4
0
 /** Field access. */
 public void visitFieldInstruction(FieldInstruction i) {
   cv.registerFieldAccess(i.getClassName(cp), i.getFieldName(cp));
   cv.registerCoupling(i.getFieldType(cp));
 }
示例#5
0
 /** Array use. */
 public void visitArrayInstruction(ArrayInstruction i) {
   cv.registerCoupling(i.getType(cp));
 }
示例#6
0
 /** Local variable use. */
 public void visitLocalVariableInstruction(LocalVariableInstruction i) {
   if (i.getOpcode() != Constants.IINC) cv.registerCoupling(i.getType(cp));
 }
示例#7
0
 /** Constructor. */
 MethodVisitor(MethodGen m, ClassVisitor c) {
   mg = m;
   cv = c;
   cp = mg.getConstantPool();
   cm = cv.getMetrics();
 }
示例#8
0
 /** Visit return instruction. */
 public void visitReturnInstruction(ReturnInstruction i) {
   cv.registerCoupling(i.getType(cp));
 }
示例#9
0
 /** Visit checklast instruction. */
 public void visitCHECKCAST(CHECKCAST i) {
   cv.registerCoupling(i.getType(cp));
 }