Search in sources :

Example 1 with Compound

use of org.eclipse.ceylon.langtools.tools.javac.code.Attribute.Compound in project ceylon by eclipse.

the class JavacAnnotation method attributeToRefl.

private Object attributeToRefl(Attribute attr) {
    if (attr == null)
        return null;
    if (attr instanceof Attribute.Constant)
        return attr.getValue();
    if (attr instanceof Attribute.Array) {
        Attribute[] values = ((Attribute.Array) attr).values;
        List<Object> list = new ArrayList<Object>(values.length);
        for (Attribute elem : values) {
            list.add(attributeToRefl(elem));
        }
        return list;
    }
    if (attr instanceof Attribute.Compound)
        return new JavacAnnotation((Compound) attr);
    if (attr instanceof Attribute.Enum)
        return ((Attribute.Enum) attr).getValue().name.toString();
    if (attr instanceof Attribute.Class)
        return new JavacType(((Attribute.Class) attr).getValue());
    // FIXME: turn into error
    throw new RuntimeException("Unknown attribute type: " + attr);
}
Also used : Attribute(org.eclipse.ceylon.langtools.tools.javac.code.Attribute) ArrayList(java.util.ArrayList) Compound(org.eclipse.ceylon.langtools.tools.javac.code.Attribute.Compound)

Aggregations

ArrayList (java.util.ArrayList)1 Attribute (org.eclipse.ceylon.langtools.tools.javac.code.Attribute)1 Compound (org.eclipse.ceylon.langtools.tools.javac.code.Attribute.Compound)1