Java Code Examples for com.sun.tools.javac.code.Attribute#Array

The following examples show how to use com.sun.tools.javac.code.Attribute#Array . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public void visitArray(Attribute.Array a) {
    // Omit braces from singleton.
    if (a.values.length != 1) sb.append('{');

    boolean first = true;
    for (Attribute elem : a.values) {
        if (first) {
            first = false;
        } else {
            sb.append(", ");
        }
        elem.accept(this);
    }
    // Omit braces from singleton.
    if (a.values.length != 1) sb.append('}');
}
 
Example 2
public void visitArray(Attribute.Array a) {
    // Omit braces from singleton.
    if (a.values.length != 1) sb.append('{');

    boolean first = true;
    for (Attribute elem : a.values) {
        if (first) {
            first = false;
        } else {
            sb.append(", ");
        }
        elem.accept(this);
    }
    // Omit braces from singleton.
    if (a.values.length != 1) sb.append('}');
}
 
Example 3
public void visitArray(Attribute.Array a) {
    // Omit braces from singleton.
    if (a.values.length != 1) sb.append('{');

    boolean first = true;
    for (Attribute elem : a.values) {
        if (first) {
            first = false;
        } else {
            sb.append(", ");
        }
        elem.accept(this);
    }
    // Omit braces from singleton.
    if (a.values.length != 1) sb.append('}');
}
 
Example 4
public void visitArray(Attribute.Array a) {
    // Omit braces from singleton.
    if (a.values.length != 1) sb.append('{');

    boolean first = true;
    for (Attribute elem : a.values) {
        if (first) {
            first = false;
        } else {
            sb.append(", ");
        }
        elem.accept(this);
    }
    // Omit braces from singleton.
    if (a.values.length != 1) sb.append('}');
}
 
Example 5
public void visitArray(Attribute.Array a) {
    // Omit braces from singleton.
    if (a.values.length != 1) sb.append('{');

    boolean first = true;
    for (Attribute elem : a.values) {
        if (first) {
            first = false;
        } else {
            sb.append(", ");
        }
        elem.accept(this);
    }
    // Omit braces from singleton.
    if (a.values.length != 1) sb.append('}');
}
 
Example 6
public void visitArray(Attribute.Array a) {
    // Omit braces from singleton.
    if (a.values.length != 1) sb.append('{');

    boolean first = true;
    for (Attribute elem : a.values) {
        if (first) {
            first = false;
        } else {
            sb.append(", ");
        }
        elem.accept(this);
    }
    // Omit braces from singleton.
    if (a.values.length != 1) sb.append('}');
}
 
Example 7
public void visitArray(Attribute.Array a) {
    AnnotationValue vals[] = new AnnotationValue[a.values.length];
    for (int i = 0; i < vals.length; i++) {
        vals[i] = new AnnotationValueImpl(env, a.values[i]);
    }
    value = vals;
}
 
Example 8
public void visitArray(Attribute.Array a) {
    AnnotationValue vals[] = new AnnotationValue[a.values.length];
    for (int i = 0; i < vals.length; i++) {
        vals[i] = new AnnotationValueImpl(env, a.values[i]);
    }
    value = vals;
}
 
Example 9
public void visitArray(Attribute.Array a) {
    AnnotationValue vals[] = new AnnotationValue[a.values.length];
    for (int i = 0; i < vals.length; i++) {
        vals[i] = new AnnotationValueImpl(env, a.values[i]);
    }
    value = vals;
}
 
Example 10
public void visitArray(Attribute.Array a) {
    AnnotationValue vals[] = new AnnotationValue[a.values.length];
    for (int i = 0; i < vals.length; i++) {
        vals[i] = new AnnotationValueImpl(env, a.values[i]);
    }
    value = vals;
}
 
Example 11
public void visitArrayAttributeProxy(ArrayAttributeProxy proxy) {
    int length = proxy.values.length();
    Attribute[] ats = new Attribute[length];
    Type elemtype = types.elemtype(type);
    int i = 0;
    for (List<Attribute> p = proxy.values; p.nonEmpty(); p = p.tail) {
        ats[i++] = deproxy(elemtype, p.head);
    }
    result = new Attribute.Array(type, ats);
}
 
Example 12
public void visitArray(Attribute.Array a) {
    Name elemName = ((ArrayType) a.type).elemtype.tsym.getQualifiedName();

    if (elemName.equals(elemName.table.names.java_lang_Class)) {   // Class[]
        // Construct a proxy for a MirroredTypesException
        ListBuffer<TypeMirror> elems = new ListBuffer<>();
        for (Attribute value : a.values) {
            Type elem = ((Attribute.Class) value).classType;
            elems.append(elem);
        }
        value = new MirroredTypesExceptionProxy(elems.toList());

    } else {
        int len = a.values.length;
        Class<?> returnClassSaved = returnClass;
        returnClass = returnClass.getComponentType();
        try {
            Object res = Array.newInstance(returnClass, len);
            for (int i = 0; i < len; i++) {
                a.values[i].accept(this);
                if (value == null || value instanceof ExceptionProxy) {
                    return;
                }
                try {
                    Array.set(res, i, value);
                } catch (IllegalArgumentException e) {
                    value = null;       // indicates a type mismatch
                    return;
                }
            }
            value = res;
        } finally {
            returnClass = returnClassSaved;
        }
    }
}
 
Example 13
Attribute.Array getAttributeTargetAttribute(TypeSymbol s) {
    Attribute.Compound atTarget = s.getAnnotationTypeMetadata().getTarget();
    if (atTarget == null) return null; // ok, is applicable
    Attribute atValue = atTarget.member(names.value);
    if (!(atValue instanceof Attribute.Array)) return null; // error recovery
    return (Attribute.Array) atValue;
}
 
Example 14
public void visitArray(Attribute.Array a) {
    Name elemName = ((ArrayType) a.type).elemtype.tsym.getQualifiedName();

    if (elemName.equals(elemName.table.names.java_lang_Class)) {   // Class[]
        // Construct a proxy for a MirroredTypesException
        ListBuffer<TypeMirror> elems = new ListBuffer<TypeMirror>();
        for (Attribute value : a.values) {
            Type elem = ((Attribute.Class) value).type;
            elems.append(elem);
        }
        value = new MirroredTypesExceptionProxy(elems.toList());

    } else {
        int len = a.values.length;
        Class<?> returnClassSaved = returnClass;
        returnClass = returnClass.getComponentType();
        try {
            Object res = Array.newInstance(returnClass, len);
            for (int i = 0; i < len; i++) {
                a.values[i].accept(this);
                if (value == null || value instanceof ExceptionProxy) {
                    return;
                }
                try {
                    Array.set(res, i, value);
                } catch (IllegalArgumentException e) {
                    value = null;       // indicates a type mismatch
                    return;
                }
            }
            value = res;
        } finally {
            returnClass = returnClassSaved;
        }
    }
}
 
Example 15
public void visitArray(Attribute.Array a) {
    AnnotationValue vals[] = new AnnotationValue[a.values.length];
    for (int i = 0; i < vals.length; i++) {
        vals[i] = new AnnotationValueImpl(env, a.values[i]);
    }
    value = vals;
}
 
Example 16
public void visitArray(Attribute.Array a) {
    AnnotationValue vals[] = new AnnotationValue[a.values.length];
    for (int i = 0; i < vals.length; i++) {
        vals[i] = new AnnotationValueImpl(env, a.values[i]);
    }
    value = vals;
}
 
Example 17
public void visitArray(Attribute.Array a) {
    printList("values", Arrays.asList(a.values));
    visitAttribute(a);
}
 
Example 18
Source Project: jdk8u60   File: DPrinter.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void visitArray(Attribute.Array a) {
    printList("values", Arrays.asList(a.values));
    visitAttribute(a);
}
 
Example 19
public void visitArray(Attribute.Array array) {
    throw new AssertionError(); // shouldn't happen
}
 
Example 20
public void visitArray(Attribute.Array a) {
    printList("values", Arrays.asList(a.values));
    visitAttribute(a);
}