Factory method to create a MethodAnnotation from the method the given
visitor is currently visiting.

@param visitor
the BetterVisitor currently visiting the method
17628
public static MethodAnnotation fromVisitedMethod(PreorderVisitor visitor) {
        String className = visitor.getDottedClassName();
        MethodAnnotation result = new MethodAnnotation(className, visitor.getMethodName(), visitor.getMethodSig(), visitor
                .getMethod().isStatic());

        // Try to find the source lines for the method
        SourceLineAnnotation srcLines = SourceLineAnnotation.fromVisitedMethod(visitor);
        result.setSourceLines(srcLines);

        return result;
    }
1248163
public void go(EditsVisitor visitor) throws IOException  {
    setEditsLoader(EditsLoader.LoaderFactory.getLoader(visitor));
    editsLoader.loadEdits();
  }
303063
@Override
  public MethodVisitor visitMethod(
      int access, String base, String desc, String signature, String[] exceptions) {
    MethodVisitor mv = cv.visitMethod(access, base, desc, signature, exceptions);

    if (mv != null) {
      // We need to compute stackmaps (see
      // AllocationInstrumenter#instrument).  This can't really be
      // done for old bytecode that contains JSR and RET instructions.
      // So, we remove JSRs and RETs.
      JSRInlinerAdapter jsria =
          new JSRInlinerAdapter(mv, access, base, desc, signature, exceptions);
      AllocationMethodAdapter aimv =
          new AllocationMethodAdapter(jsria, recorderClass, recorderMethod);
      LocalVariablesSorter lvs = new LocalVariablesSorter(access, desc, aimv);
      aimv.lvs = lvs;
      mv = lvs;
    }
    return mv;
  }
719326
@Override
  public MethodVisitor visitMethod(int access, String name, String desc,
                                   String signature, String[] exceptions) {
    MethodVisitor mv = cv.visitMethod(access | Opcodes.ACC_SYNTHETIC,
                                      name, desc, signature, exceptions);
    return new AccessMethodAdapter(mv);
  }
978492
@Override
    public void accept(ClientlibVisitor visitor, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder parent) {
        visitor.visit(this, ClientlibVisitor.VisitorMode.DEPENDS, parent);
    }
767957
public void callArgVisitors(XPathVisitor visitor)
  {
      for (int i = 0; i < m_argVec.size(); i++)
      {
         Expression exp = (Expression)m_argVec.elementAt(i);
         exp.callVisitors(new ArgExtOwner(exp), visitor);
      }
    
  }
944488
@Override
    public void visit(ClassOrInterfaceDeclaration declaration, ControllerModel controller) {
        controller.setName(declaration.getName());

        LOGGER.info("[controller]Visit " + controller.getName());
        //Go on with the methods and annotations
        super.visit(declaration,controller);
    }
971434
public void traverse(JavacASTVisitor visitor) {
		switch (this.getKind()) {
		case COMPILATION_UNIT:
			visitor.visitCompilationUnit(this, (JCCompilationUnit) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitCompilationUnit(this, (JCCompilationUnit) get());
			break;
		case TYPE:
			visitor.visitType(this, (JCClassDecl) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitType(this, (JCClassDecl) get());
			break;
		case FIELD:
			visitor.visitField(this, (JCVariableDecl) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitField(this, (JCVariableDecl) get());
			break;
		case METHOD:
			visitor.visitMethod(this, (JCMethodDecl) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitMethod(this, (JCMethodDecl) get());
			break;
		case INITIALIZER:
			visitor.visitInitializer(this, (JCBlock) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitInitializer(this, (JCBlock) get());
			break;
		case ARGUMENT:
			JCMethodDecl parentMethod = (JCMethodDecl) up().get();
			visitor.visitMethodArgument(this, (JCVariableDecl) get(), parentMethod);
			ast.traverseChildren(visitor, this);
			visitor.endVisitMethodArgument(this, (JCVariableDecl) get(), parentMethod);
			break;
		case LOCAL:
			visitor.visitLocal(this, (JCVariableDecl) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitLocal(this, (JCVariableDecl) get());
			break;
		case STATEMENT:
			visitor.visitStatement(this, get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitStatement(this, get());
			break;
		case ANNOTATION:
			switch (up().getKind()) {
			case TYPE:
				visitor.visitAnnotationOnType((JCClassDecl) up().get(), this, (JCAnnotation) get());
				break;
			case FIELD:
				visitor.visitAnnotationOnField((JCVariableDecl) up().get(), this, (JCAnnotation) get());
				break;
			case METHOD:
				visitor.visitAnnotationOnMethod((JCMethodDecl) up().get(), this, (JCAnnotation) get());
				break;
			case ARGUMENT:
				JCVariableDecl argument = (JCVariableDecl) up().get();
				JCMethodDecl method = (JCMethodDecl) up().up().get();
				visitor.visitAnnotationOnMethodArgument(argument, method, this, (JCAnnotation) get());
				break;
			case LOCAL:
				visitor.visitAnnotationOnLocal((JCVariableDecl) up().get(), this, (JCAnnotation) get());
				break;
			case TYPE_USE:
				visitor.visitAnnotationOnTypeUse(up().get(), this, (JCAnnotation) get());
				break;
			default:
				throw new AssertionError("Annotion not expected as child of a " + up().getKind());
			}
			break;
		case TYPE_USE:
			visitor.visitTypeUse(this, get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitTypeUse(this, get());
			break;
		default:
			throw new AssertionError("Unexpected kind during node traversal: " + getKind());
		}
	}
1300238
public void accept(final MethodVisitor mv) {
        mv.visitTryCatchBlock(start.getLabel(), end.getLabel(),
                handler == null ? null : handler.getLabel(), type);
        int n = visibleTypeAnnotations == null ? 0 : visibleTypeAnnotations
                .size();
        for (int i = 0; i < n; ++i) {
            TypeAnnotationNode an = visibleTypeAnnotations.get(i);
            an.accept(mv.visitTryCatchAnnotation(an.typeRef, an.typePath,
                    an.desc, true));
        }
        n = invisibleTypeAnnotations == null ? 0 : invisibleTypeAnnotations
                .size();
        for (int i = 0; i < n; ++i) {
            TypeAnnotationNode an = invisibleTypeAnnotations.get(i);
            an.accept(mv.visitTryCatchAnnotation(an.typeRef, an.typePath,
                    an.desc, false));
        }
    }
826798
public static MethodAnnotation fromMethodDescriptor(MethodDescriptor methodDescriptor) {
        return fromForeignMethod(methodDescriptor.getSlashedClassName(), methodDescriptor.getName(),
                methodDescriptor.getSignature(), methodDescriptor.isStatic());
    }
588229
public function addVisitor($location, RequestVisitorInterface $visitor)
    {
        $this->factory->addRequestVisitor($location, $visitor);

        return $this;
    }
535273
@Override
    public void visitMethod(Method obj) {
        LocalVariableTable lvt = obj.getLocalVariableTable();
        if (lvt != null) {
            LocalVariable[] lvs = lvt.getLocalVariableTable();
            for (LocalVariable lv : lvs) {
                if (checkConfusedName(lv.getName(), lv.getSignature())) {
                    bugReporter.reportBug(new BugInstance(this, BugType.CNC_COLLECTION_NAMING_CONFUSION.name(), NORMAL_PRIORITY).addClass(this)
                            .addString(lv.getName()).addSourceLine(this.clsContext, this, lv.getStartPC()));
                }
            }
        }
    }
519663
protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs)
  {
  	if(callAttrs && (null != m_selectPattern))
  		m_selectPattern.getExpression().callVisitors(m_selectPattern, visitor);
    super.callChildVisitors(visitor, callAttrs);
  }
1006293
@Override
    public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
        fieldAlreadyExists |= name.equals(versionFieldName);

        return super.visitField(access, name, desc, signature, value);
    }
182847
@Override
	public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc, boolean itf) {
		// Is it a private method call?
		// TODO r$ check here because we use invokespecial to avoid virtual dispatch on field changes...
		if (opcode == INVOKESPECIAL && name.charAt(0) != '<' && !name.startsWith("r$")) {
			if (owner.equals(classname)) {
				// private method call
				// leaving the invokespecial alone will cause a verify error
				String descriptor = Utils.insertExtraParameter(owner, desc);
				super.visitMethodInsn(INVOKESTATIC, Utils.getExecutorName(classname, suffix), name, descriptor, false);
				return;
			}
			else {
				// super call
				// TODO Check if this is true: we can just call the catcher directly if there was one, there is no need
				// for a superdispatcher

				// Only need to redirect to the superdispatcher if it was a protected method
				TypeDescriptor supertypeDescriptor = getType(owner);
				MethodMember target = supertypeDescriptor.getByNameAndDescriptor(name + desc);
				if (target != null && target.isProtected()) {
					// A null target means that method is not in the supertype, so didn't get a superdispatcher
					super.visitMethodInsn(INVOKESPECIAL, classname, name + methodSuffixSuperDispatcher, desc, false);
				}
				else {
					super.visitMethodInsn(opcode, owner, name, desc, itf);
				}
				return;
			}
		}
		// Might be a private static method
		boolean done = false;
		if (opcode == INVOKESTATIC) {
			MethodMember mm = typeDescriptor.getByDescriptor(name, desc);
			if (mm != null && mm.isPrivate()) {
				super.visitMethodInsn(INVOKESTATIC, Utils.getExecutorName(classname, suffix), name, desc, false);
				done = true;
			}
		}
		if (!done) {
			super.visitMethodInsn(opcode, owner, name, desc, itf);
		}
	}
996423
public static SourceLineAnnotation fromVisitedMethod(MethodGen methodGen, String sourceFile) {
        LineNumberTable lineNumberTable = methodGen.getLineNumberTable(methodGen.getConstantPool());
        String className = methodGen.getClassName();
        int codeSize = methodGen.getInstructionList().getLength();
        if (lineNumberTable == null) {
            return createUnknown(className, sourceFile, 0, codeSize - 1);
        }
        return forEntireMethod(className, sourceFile, lineNumberTable, codeSize);
    }
1349207
protected void callSubtreeVisitors(XPathVisitor visitor)
  {
    if (null != m_predicates)
    {
      int n = m_predicates.length;
      for (int i = 0; i < n; i++)
      {
        ExpressionOwner predOwner = new PredOwner(i);
        if (visitor.visitPredicate(predOwner, m_predicates[i]))
        {
          m_predicates[i].callVisitors(predOwner, visitor);
        }
      }
    }
    if (null != m_relativePathPattern)
    {
      m_relativePathPattern.callVisitors(this, visitor);
    }
  }