Process all class, field, and method annotations for the class hierarchy.

@param classHierarchy the subclass of the hierarchy to process
354596
public void processAnnotations(Class<?> classHierarchy)
                    throws InjectionException
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "processAnnotations: " + classHierarchy);

        for (Class<?> klass = classHierarchy; klass != null && klass != Object.class; klass = klass.getSuperclass())
        {
            Field[] fields = getAllDeclaredFields(klass, classHierarchy);

            for (int processorIndex = 0; processorIndex < ivProviders.size(); processorIndex++)
            {
                InjectionProcessorProvider<?, ?> provider = ivProviders.get(processorIndex);

                processClassAnnotations(processorIndex, provider, klass);

                if (fields != null)
                {
                    processMemberAnnotations(processorIndex, provider, fields, fields);
                }
            }
        }

        Method[] methods = getAllDeclaredMethods(classHierarchy);
        for (int processorIndex = 0; processorIndex < ivProviders.size(); processorIndex++)
        {
            processMemberAnnotations(processorIndex, ivProviders.get(processorIndex), methods, methods);
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "processAnnotations");
    }
513044
private static ClassHierarchy loadClassHierarchy() {
    // TODO[JIRA REEF-400] The file should be created by AvroClassHierarchySerializer
    try (final InputStream chin = new FileInputStream(HelloCLR.CLASS_HIERARCHY_FILENAME)) {
      // TODO[JIRA REEF-400] Use AvroClassHierarchySerializer instead
      final ClassHierarchyProto.Node root = ClassHierarchyProto.Node.parseFrom(chin); // A
      final ClassHierarchy ch = new ProtocolBufferClassHierarchy(root);
      return ch;
    } catch (final IOException e) {
      final String message = "Unable to load class hierarchy.";
      LOG.log(Level.SEVERE, message, e);
      throw new RuntimeException(message, e);
    }
  }
954005
@Override
  public void setHierarchy(@Nullable DraweeHierarchy hierarchy) {
    if (FLog.isLoggable(FLog.VERBOSE)) {
      FLog.v(
          TAG,
          "controller %x %s: setHierarchy: %s",
          System.identityHashCode(this),
          mId,
          hierarchy);
    }
    mEventTracker.recordEvent(
        (hierarchy != null) ? Event.ON_SET_HIERARCHY : Event.ON_CLEAR_HIERARCHY);
    // force release in case request was submitted
    if (mIsRequestSubmitted) {
      mDeferredReleaser.cancelDeferredRelease(this);
      release();
    }
    // clear the existing hierarchy
    if (mSettableDraweeHierarchy != null) {
      mSettableDraweeHierarchy.setControllerOverlay(null);
      mSettableDraweeHierarchy = null;
    }
    // set the new hierarchy
    if (hierarchy != null) {
      Preconditions.checkArgument(hierarchy instanceof SettableDraweeHierarchy);
      mSettableDraweeHierarchy = (SettableDraweeHierarchy) hierarchy;
      mSettableDraweeHierarchy.setControllerOverlay(mControllerOverlay);
    }
  }
683249
protected function _processTree($parent)
    {
        foreach ($parent->tree as $node) {
            if ($node->hasMethods && $node->type !== 'interface') {
                $this->_processMethods($node);
            } elseif (!empty($node->tree)) {
                $this->_processTree($node);
            }
        }
    }
903120
@Override
    protected void processAnnotations(Object instance)
            throws IllegalAccessException, InvocationTargetException, NamingException
    {

        if (context == null)
        {
            // No resource injection
            return;
        }

        checkAnnotation(instance.getClass(), instance);

        /* 
         * May be only check non private fields and methods
         * for @Resource (JSR 250), if used all superclasses MUST be examined
         * to discover all uses of this annotation.
         */

        Class superclass = instance.getClass().getSuperclass();
        while (superclass != null && (!superclass.equals(Object.class)))
        {
            checkAnnotation(superclass, instance);
            superclass = superclass.getSuperclass();
        } 
    }
122328
@Override
    public void validateUpdate(IDataType newType) throws TypeUpdateException {
        super.validateUpdate(newType);

        HierarchicalType newHierarchicalType = (HierarchicalType) newType;

        //validate on supertypes

        if ((newHierarchicalType.superTypes.size() != superTypes.size())
                || !newHierarchicalType.superTypes.containsAll(superTypes)) {
            throw new TypeUpdateException(newType, "New type cannot modify superTypes");
        }

        //validate on fields
        try {
            TypeUtils.validateUpdate(fieldMapping, newHierarchicalType.fieldMapping);
        } catch (TypeUpdateException e) {
            throw new TypeUpdateException(newType, e);
        }
    }
1318139
@Override
	public void process(Node externs, Node root) {
		this.expandedDepsList.clear();
		List<DependencyList> enclosingDependencies = new LinkedList<DependencyList>();
		try {
			processChildren(root, enclosingDependencies);
		} catch (ProcessingDependenciesException e) {
			throw new RuntimeProcessingDependenciesException(e);
		} catch (DependencyVerificationException e) {
			throw new RuntimeDependencyVerificationException(e);
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
		appendConsoleLogging(root);
	}
881685
public static ClassHierarchy deserialize(final File file) throws IOException {
    try (final InputStream stream = new FileInputStream(file)) {
      final ClassHierarchyProto.Node root = ClassHierarchyProto.Node.parseFrom(stream);
      return new ProtocolBufferClassHierarchy(root);
    }
  }
915544
private void callAnnotatedMethod(final Class<? extends Annotation> annotationClass) {
        if (this.lifecycleMethod.get(annotationClass.getName()) != null) {
            for (final Method method : this.lifecycleMethod.get(annotationClass.getName())) {

                try {
                    ClassUtility.callMethod(method, this);
                } catch (final CoreException e) {
                    LOGGER.error(CALL_ANNOTATED_METHOD_ERROR, e);
                }
            }
        }
    }
896846
private static void listHierarchy(ProjectFile file)
   {
      for (Task task : file.getChildTasks())
      {
         System.out.println("Task: " + task.getName() + "\t" + task.getStart() + "\t" + task.getFinish());
         listHierarchy(task, " ");
      }

      System.out.println();
   }
859708
private void processViewAnnotation() {

        // Find the AutoHandler annotation if any because it's optional
        final AutoHandler ah = ClassUtility.getLastClassAnnotation(this.getClass(), AutoHandler.class);

        // Use the annotation value to define the callbackObject : View or Controller
        // When controller is null always use the view as callbackObject
        if (ah != null && ah.value() == CallbackObject.View || controller() == null) {
            this.callbackObject = this;
        } else {
            // by default use the controller object as callback object
            this.callbackObject = this.controller();
        }

        // Find the RootNodeId annotation
        final RootNodeId rni = ClassUtility.getLastClassAnnotation(this.getClass(), RootNodeId.class);
        if (rni != null) {
            node().setId(rni.value().isEmpty() ? this.getClass().getSimpleName() : rni.value());
        }

        // Find the RootNodeClass annotation
        final RootNodeClass rnc = ClassUtility.getLastClassAnnotation(this.getClass(), RootNodeClass.class);
        if (rnc != null && rnc.value().length > 0) {
            for (final String styleClass : rnc.value()) {
                if (styleClass != null && !styleClass.isEmpty()) {
                    node().getStyleClass().add(styleClass);
                }
            }
        }

        // Process Event Handler Annotation
        // For each View class annotation we will attach an event handler to the root node
        for (final Annotation a : this.getClass().getAnnotations()) {
            // Manage only JRebirth OnXxxxx annotations
            if (a.annotationType().getName().startsWith(BASE_ANNOTATION_NAME)) {
                try {
                    // Process the annotation if the node is not null
                    if (node() != null && controller() instanceof AbstractController) {
                        addHandler(node(), a);
                    }
                } catch (IllegalArgumentException | CoreException e) {
                    LOGGER.log(UIMessages.VIEW_ANNO_PROCESSING_FAILURE, e, this.getClass().getName());
                }
            }
        }

    }
1243537
protected void processRemoterElements(TypeSpec.Builder classBuilder, ElementVisitor elementVisitor, MethodSpec.Builder methodBuilder) {
        processRemoterElements(classBuilder, getRemoterInterfaceElement(), 0, elementVisitor, methodBuilder);
    }
1248680
public static void applyToHierarchy (Component comp, ComponentOp op)
    {
        applyToHierarchy(comp, Integer.MAX_VALUE, op);
    }
448451
function processClass (options, name, node) {
    processClassConstructor(options, name, node);
    processClassAppend(options, name, node);

    shuffleArray(options, node.children);

    for (let i = 0, max = node.children.length; i < max; i++) {
        let child = node.children[i];

        processClass(options, child, hierarchy[child]);
    }
}
1085327
@Override
	public List<Object> listDocumentsInHierarchy() throws Exception 
	{
		Vector<Object> hierarchy = toHierarchyNodeVector(root);
		hierarchy.setElementAt(root.getName(), 0);
		hierarchy.setElementAt(false, 1);
		hierarchy.setElementAt(false, 2);
		return hierarchy;
	}
1113339
private Field[] getAllDeclaredFields(Class<?> klass, Class<?> classHierarchy)
    {
        try
        {
            return klass.getDeclaredFields();
        } catch (Throwable ex)
        {
            // The most common 'problem' here is a NoClassDefFoundError because
            // a dependency class (super/field type, etc) could not be found
            // when the class is fully initialized.

            // Since interrogating a class for annotations is new in Java EE 1.5,
            // it is possible this application may have worked in prior versions
            // of WebSphere, if the application never actually used the class.
            // So, rather than just fail the app start, a Warning will be logged
            // indicating the class will not be processed for annotations, and
            // the application will be allowed to start.                 d477931

            FFDCFilter.processException(ex, CLASS_NAME + ".getAllDeclaredFields",
                                        "249", new Object[] { classHierarchy, klass });

            if (classHierarchy != klass)
            {
                Tr.warning(tc, "SUPER_FIELD_ANNOTATIONS_IGNORED_CWNEN0048W",
                           klass.getName(), classHierarchy.getName(), ex.toString()); // d479669 RTC119889
                if (ivInjectionEngine.isValidationFailable(ivNameSpaceConfig.isCheckApplicationConfiguration())) // F743-14449
                {
                    throw new RuntimeException("Resource annotations on the fields of the " + klass.getName() +
                                               " class could not be processed. The " + klass.getName() +
                                               " class is being processed for annotations because it is" +
                                               " referenced by the " + classHierarchy.getName() + " application class." +
                                               " The annotations could not be obtained because of the exception : " +
                                               ex, ex);
                }
            }
            else
            {
                Tr.warning(tc, "FIELD_ANNOTATIONS_IGNORED_CWNEN0047W",
                           klass.getName(), ex.toString()); // d479669 d641396 RTC119889
                if (ivInjectionEngine.isValidationFailable(ivNameSpaceConfig.isCheckApplicationConfiguration())) // F743-14449
                {
                    throw new RuntimeException("Resource annotations on the fields of the " + klass.getName() +
                                               " class could not be processed. The annotations could not be obtained" +
                                               " because of the exception : " + ex, ex);
                }
            }

            return null;
        }
    }
746723
private void processCollectionStore() {
        String fieldClassName = getDottedClassConstantOperand();
        if (fieldClassName.equals(className) && (stack.getStackDepth() > 0)) {
            OpcodeStack.Item item = stack.getStackItem(0);
            if (item.getUserValue() != null) {
                String fieldName = getNameConstantOperand();
                if (fieldName != null) {
                    FieldInfo fi = collectionFields.get(fieldName);
                    if (fi != null) {
                        fi.getFieldAnnotation().setSourceLines(SourceLineAnnotation.fromVisitedInstruction(this));
                        fi.setSynchronized();
                    }
                }
            }
        }
    }