Package org.apache.bcel.classfile

Examples of org.apache.bcel.classfile.Annotations


                String[] names = ((ExceptionTable) a).getExceptionNames();
                for (int j = 0; j < names.length; j++) {
                    addException(names[j]);
                }
            } else if (a instanceof Annotations) {
          Annotations runtimeAnnotations = (Annotations) a;
          AnnotationEntry[] aes = runtimeAnnotations.getAnnotationEntries();
          for (int k = 0; k < aes.length; k++) {
            AnnotationEntry element = aes[k];
            addAnnotationEntry(new AnnotationEntryGen(element, cp, false));
          }
            } else {
View Full Code Here


    Map<String, String> result= new LinkedHashMap<String, String>();
    for (Attribute attribute : attributes)
    {
      if (attribute instanceof Annotations)
      {
        Annotations annotations= (Annotations) attribute;
        AnnotationEntry[] entries= annotations.getAnnotationEntries();
        List<AnnotationEntry> newEntries= new ArrayList<AnnotationEntry>();
        for (AnnotationEntry entry : entries)
        {
          if (entry.getElementValuePairs().length == 0)
            result.put(Type.getType(entry.getAnnotationType()) + "# ", " ");
View Full Code Here

    public static void generate(Attribute[] old, Attribute[] new_,
            List<AttributePatch> patches){
        // One patch for runtime, one for non-runtime.
        for(boolean isRuntime : new boolean[]{true, false}){
            // Find old Annotations
            Annotations oldAnnots = null;
            for(int i = 0; i < old.length; i++){
                boolean correct = false;
                correct |= isRuntime &&
                        old[i] instanceof RuntimeVisibleAnnotations;
                correct |= !isRuntime &&
                        old[i] instanceof RuntimeInvisibleAnnotations;
                if(correct){
                    oldAnnots = (Annotations)old[i];
                    break;
                }
            }
           
            //Find new Annotations
            Annotations newAnnots = null;
            for(int i = 0; i < new_.length; i++){
                boolean correct = false;
                correct |= isRuntime &&
                        new_[i] instanceof RuntimeVisibleAnnotations;
                correct |= !isRuntime &&
                        new_[i] instanceof RuntimeInvisibleAnnotations;
                if(correct){
                    newAnnots = (Annotations)new_[i];
                    break;
                }
            }
           
            AnnotationEntry[] oldEntries = oldAnnots == null ?
                    new AnnotationEntry[0] :
                    oldAnnots.getAnnotationEntries();
            AnnotationEntry[] newEntries = newAnnots == null ?
                    new AnnotationEntry[0] :
                    newAnnots.getAnnotationEntries();
           
            // Finds entries which are new.
            List<AnnotationEntry> addedEntries =
                    new ArrayList<AnnotationEntry>();
            outer: for(AnnotationEntry newAe : newEntries){
View Full Code Here

            empty = false;
        }
        if(empty)
            return attribs;
       
        Annotations new_;
       
        if(isRuntime)
            new_ = new RuntimeVisibleAnnotations(
                    Util.findConstantStringIn(map,
                            "RuntimeVisibleAnnotations"),
View Full Code Here

        Attribute[] attrs = field.getAttributes();
        for (int i = 0; i < attrs.length; i++) {
            if (attrs[i] instanceof ConstantValue) {
                setValue(((ConstantValue) attrs[i]).getConstantValueIndex());
            } else if (attrs[i] instanceof Annotations) {
              Annotations runtimeAnnotations = (Annotations)attrs[i];
            AnnotationEntry[] annotationEntries = runtimeAnnotations.getAnnotationEntries();
            for (int j = 0; j < annotationEntries.length; j++) {
              AnnotationEntry element = annotationEntries[j];
              addAnnotationEntry(new AnnotationEntryGen(element,cp,false));
            }
            } else {
View Full Code Here

TOP

Related Classes of org.apache.bcel.classfile.Annotations

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.