Visit the end of the class. All of the methods and fieldInfos defined in
the class have been visited at this point. If we didn't encounter a
trace state field or static initializer, we'll add them now.
337655
@Override
    public void visitEnd() {
        if (isInstrumentableClass()) {
            // Add a field to hold the trace state if needed
            if (isTraceObjectFieldDefinitionRequired()) {
                int access = (Opcodes.ACC_PRIVATE | Opcodes.ACC_FINAL | Opcodes.ACC_STATIC | Opcodes.ACC_SYNTHETIC);
                String name = getTraceObjectFieldName();
                String desc = getTraceObjectFieldType().getDescriptor();
                visitField(access, name, desc, null, null);
            }

            // Add a static initializer to setup trace if needed
            if (isStaticInitializerRequired() && !isStaticInitDefined()) {
                staticInitializerGenerated = true;

                MethodVisitor mv = visitMethod(Opcodes.ACC_STATIC, "<clinit>", "()V", null, null);
                Label lineNumberLabel = new Label();
                mv.visitCode();
                mv.visitLabel(lineNumberLabel);
                mv.visitLineNumber(65535, lineNumberLabel);
                mv.visitInsn(Opcodes.RETURN);
                mv.visitMaxs(1, 0);
                mv.visitEnd();
            }
        }
        super.visitEnd();
    }
789672
public void init()
	{
		for (String packageName : traceManager.getTracePackages())
		{
			Logger logger = (Logger) LoggerFactory.getLogger(packageName);
			logger.addAppender(this);
		}
		start();
	}
242448
@Override
    public void visitMethod(Method obj) {
        methodSignatureIsConstrained = false;
        String methodName = obj.getName();

        if (!Values.CONSTRUCTOR.equals(methodName) && !Values.STATIC_INITIALIZER.equals(methodName)) {

            String methodSig = obj.getSignature();

            methodSignatureIsConstrained = methodIsSpecial(methodName, methodSig)
                    || methodHasSyntheticTwin(methodName, methodSig);

            if (!methodSignatureIsConstrained) {
                for (AnnotationEntry entry : obj.getAnnotationEntries()) {
                    if (CONVERSION_ANNOTATIONS.contains(entry.getAnnotationType())) {
                        methodSignatureIsConstrained = true;
                        break;
                    }
                }
            }
            if (!methodSignatureIsConstrained) {
                String parms = methodSig.split("\\(|\\)")[1];
                if (parms.indexOf(Values.SIG_QUALIFIED_CLASS_SUFFIX_CHAR) >= 0) {

                    outer: for (JavaClass constrainCls : constrainingClasses) {
                        Method[] methods = constrainCls.getMethods();
                        for (Method m : methods) {
                            if (methodName.equals(m.getName()) && methodSig.equals(m.getSignature())) {
                                methodSignatureIsConstrained = true;
                                break outer;
                            }
                        }
                    }
                }
            }
        }
    }
1010879
@Override
    public void visitClassContext(ClassContext classContext) {
        try {
            JavaClass cls = classContext.getJavaClass();
            if ((serializableClass != null) && (cls.implementationOf(serializableClass))) {
                Field[] fields = cls.getFields();
                setupVisitorForClass(cls);
                for (Field f : fields) {
                    if (!f.isStatic() && f.isFinal() && f.isTransient()) {
                        bugReporter.reportBug(new BugInstance(this, BugType.NFF_NON_FUNCTIONAL_FIELD.name(), Priorities.NORMAL_PRIORITY).addClass(this)
                                .addField(cls.getClassName(), f.getName(), f.getSignature(), f.getAccessFlags()));
                    }
                }
            }
        } catch (ClassNotFoundException cnfe) {
            bugReporter.reportMissingClass(cnfe);
        }
    }
56930
public void addListeners()
    {
        super.addListeners();
        
            // Link the screen field to the passed in record
        ((ReferenceField)this.getScreenRecord().getField(ClassInfoScreenRecord.CLASS_PROJECT_ID)).syncReference(this.getHeaderRecord());
        this.getScreenRecord().getField(ClassInfoScreenRecord.CLASS_PROJECT_ID).addListener(new FieldReSelectHandler(this));
        
        this.getMainRecord().addListener(new ExtractRangeFilter(Resource.DESCRIPTION, this.getScreenRecord().getField(ClassInfoScreenRecord.NAME)));
        this.getScreenRecord().getField(ClassInfoScreenRecord.NAME).addListener(new FieldReSelectHandler(this));
        
        this.getMainRecord().addListener(new ExtractRangeFilter(Resource.LOCATION, this.getScreenRecord().getField(ClassInfoScreenRecord.PACKAGE)));
        this.getScreenRecord().getField(ClassInfoScreenRecord.PACKAGE).addListener(new FieldReSelectHandler(this));
    }
1196145
@Override
    public void visitClassContext(ClassContext classContext) {
        try {
            if ((collectionClass != null) && (mapClass != null)) {
                collectionFields = new HashMap<>();
                aliases = new HashMap<>();
                stack = new OpcodeStack();
                JavaClass cls = classContext.getJavaClass();
                className = cls.getClassName();
                super.visitClassContext(classContext);
                for (FieldInfo fi : collectionFields.values()) {
                    if (fi.isSynchronized()) {
                        bugReporter.reportBug(new BugInstance(this, BugType.NMCS_NEEDLESS_MEMBER_COLLECTION_SYNCHRONIZATION.name(), NORMAL_PRIORITY)
                                .addClass(this).addField(fi.getFieldAnnotation()));
                    }
                }
            }
        } finally {
            collectionFields = null;
            aliases = null;
            stack = null;
        }
    }
989480
@Override
    public void visitCode(Code obj) {
        if (Values.STATIC_INITIALIZER.equals(getMethod().getName())) {
            state = State.SAW_NOTHING;
            super.visitCode(obj);
        }
    }
819041
public void addListeners()
    {
        super.addListeners();
        Record record = this.getMainRecord();
        Record recClassInfo = this.getRecord(ClassInfo.CLASS_INFO_FILE);
        if (recClassInfo != null)
        {
            record.setKeyArea(LogicFile.SEQUENCE_KEY);
            SubFileFilter listener = new SubFileFilter(recClassInfo.getField(ClassInfo.CLASS_NAME), LogicFile.METHOD_CLASS_NAME, null, null, null, null, true);
            record.addListener(listener);
            recClassInfo.getField(ClassInfo.CLASS_NAME).addListener(new FieldReSelectHandler(this));
        }
    }
146854
@Override
    public void visitCode(Code obj) {
        if (collectionFields.isEmpty()) {
            return;
        }
        aliases.clear();
        String methodName = getMethodName();
        if (Values.STATIC_INITIALIZER.equals(methodName)) {
            state = State.IN_CLINIT;
        } else if (Values.CONSTRUCTOR.equals(methodName)) {
            state = State.IN_INIT;
        } else {
            state = State.IN_METHOD;
        }
        stack.resetForMethodEntry(this);
        super.visitCode(obj);
    }
1170185
@Override
    public void visitClassContext(ClassContext classContext) {
        try {
            ifBlocks = new ArrayList<>();
            loadedRegs = new HashMap<>();
            loopLocations = new BitSet();
            stack = new OpcodeStack();
            super.visitClassContext(classContext);
        } finally {
            ifBlocks = null;
            loadedRegs = null;
            loopLocations = null;
            stack = null;
        }
    }
1040597
@Override
    public void visitEnd() {
        if (name == null  || name.length() == 0) {
            reporter.error("The 'name' attribute of @Model from " + workbench.getType().getClassName() + " must be " +
                    "set");
            return;
        }

        // Check the type of the field
        if (! Type.getDescriptor(Crud.class).equals(node.desc)) {
            reporter.warn("The type of the field " + field + " from " + workbench.getType().getClassName() + " should" +
                    " be " + Crud.class.getName() + " because the field is annotated with @Model");
        }

        Element requires = new Element("requires", "");
        requires.addAttribute(new Attribute("field", field));
        requires.addAttribute(new Attribute("filter", getFilter(name)));

        workbench.getElements().put(requires, null);
    }
546362
@Override
    public void visitClassContext(final ClassContext classContext) {
        try {
            JavaClass cls = classContext.getJavaClass();
            if (!cls.isFinal()) {
                stack = new OpcodeStack();
                methodToCalledMethods = new HashMap<>();
                super.visitClassContext(classContext);

                if (!methodToCalledMethods.isEmpty()) {
                    reportChainedMethods();
                }
            }
        } finally {
            stack = null;
            methodToCalledMethods = null;
        }
    }
1305487
public void endMethod() throws IOException {
    Scope popped = popScope();
    if (popped == Scope.NON_ABSTRACT_METHOD) {
      indent();
      out.write("}\n");
    } else if (popped != Scope.ABSTRACT_METHOD) {
      throw new IllegalStateException();
    }
  }
1247047
protected void visitSetTraceObjectField() {
        visitFieldInsn(
                       PUTSTATIC,
                       classAdapter.getClassInternalName(),
                       classAdapter.getTraceObjectFieldName(),
                       classAdapter.getTraceObjectFieldType().getDescriptor());
    }
1198046
private static void addFields(ClassWriter cw) {
        FieldVisitor fv;

        // -----------------------------------------------------------------------
        // private static final String _type_ids[];
        // -----------------------------------------------------------------------
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, INDENT + "adding field : _type_ids [Ljava/lang/String;");

        fv = cw.visitField(ACC_PRIVATE + ACC_FINAL + ACC_STATIC, "_type_ids",
                           "[Ljava/lang/String;", null, null);
        fv.visitEnd();
    }
820259
@Override
    public void visitClassContext(ClassContext classContext) {
        try {
            refClasses = new HashSet<>();
            refClasses.add(classContext.getJavaClass().getClassName());
            state = State.COLLECT;
            super.visitClassContext(classContext);
            state = State.SEEN_NOTHING;
            super.visitClassContext(classContext);
        } finally {
            refClasses = null;
        }
    }
609509
public void traverse(EclipseASTVisitor visitor) {
		if (visitor.isDeferUntilPostDiet() && !isCompleteParse()) return;
		
		switch (getKind()) {
		case COMPILATION_UNIT:
			visitor.visitCompilationUnit(this, (CompilationUnitDeclaration) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitCompilationUnit(this, (CompilationUnitDeclaration) get());
			break;
		case TYPE:
			visitor.visitType(this, (TypeDeclaration) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitType(this, (TypeDeclaration) get());
			break;
		case FIELD:
			visitor.visitField(this, (FieldDeclaration) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitField(this, (FieldDeclaration) get());
			break;
		case INITIALIZER:
			visitor.visitInitializer(this, (Initializer) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitInitializer(this, (Initializer) get());
			break;
		case METHOD:
			if (get() instanceof Clinit) return;
			visitor.visitMethod(this, (AbstractMethodDeclaration) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitMethod(this, (AbstractMethodDeclaration) get());
			break;
		case ARGUMENT:
			AbstractMethodDeclaration method = (AbstractMethodDeclaration) up().get();
			visitor.visitMethodArgument(this, (Argument) get(), method);
			ast.traverseChildren(visitor, this);
			visitor.endVisitMethodArgument(this, (Argument) get(), method);
			break;
		case LOCAL:
			visitor.visitLocal(this, (LocalDeclaration) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitLocal(this, (LocalDeclaration) get());
			break;
		case ANNOTATION:
			switch (up().getKind()) {
			case TYPE:
				visitor.visitAnnotationOnType((TypeDeclaration) up().get(), this, (Annotation) get());
				break;
			case FIELD:
				visitor.visitAnnotationOnField((FieldDeclaration) up().get(), this, (Annotation) get());
				break;
			case METHOD:
				visitor.visitAnnotationOnMethod((AbstractMethodDeclaration) up().get(), this, (Annotation) get());
				break;
			case ARGUMENT:
				visitor.visitAnnotationOnMethodArgument(
						(Argument) parent.get(),
						(AbstractMethodDeclaration) parent.directUp().get(),
						this, (Annotation) get());
				break;
			case LOCAL:
				visitor.visitAnnotationOnLocal((LocalDeclaration) parent.get(), this, (Annotation) get());
				break;
			case TYPE_USE:
				visitor.visitAnnotationOnTypeUse((TypeReference) parent.get(), this, (Annotation) get());
				break;
			default:
				throw new AssertionError("Annotation not expected as child of a " + up().getKind());
			}
			break;
		case TYPE_USE:
			visitor.visitTypeUse(this, (TypeReference) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitTypeUse(this, (TypeReference) get());
			break;
		case STATEMENT:
			visitor.visitStatement(this, (Statement) get());
			ast.traverseChildren(visitor, this);
			visitor.endVisitStatement(this, (Statement) get());
			break;
		default:
			throw new AssertionError("Unexpected kind during node traversal: " + getKind());
		}
	}