Java Code Examples for com.sun.tools.classfile.Attributes

The following examples show how to use com.sun.tools.classfile.Attributes. These examples are extracted from open source projects. 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
Source Project: dragonwell8_jdk   Source File: ClassReader.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected  void readAttributesFor(ClassFile c, Attributes attrs, Element x) {
    Element container = new Element();
    AttributeVisitor av = new AttributeVisitor(this, c);
    for (Attribute a : attrs) {
        av.visit(a, container);
    }
    if (!keepOrder) {
        container.sort();
    }
    x.addAll(container);
}
 
Example 2
public void write(Object owner, Attributes attrs, ConstantPool constant_pool) {
    if (attrs != null) {
        // null checks
        owner.getClass();
        constant_pool.getClass();
        this.constant_pool = constant_pool;
        this.owner = owner;
        for (Attribute attr: attrs)
            attr.accept(this, null);
    }
}
 
Example 3
Source Project: TencentKona-8   Source File: ClassReader.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected  void readAttributesFor(ClassFile c, Attributes attrs, Element x) {
    Element container = new Element();
    AttributeVisitor av = new AttributeVisitor(this, c);
    for (Attribute a : attrs) {
        av.visit(a, container);
    }
    if (!keepOrder) {
        container.sort();
    }
    x.addAll(container);
}
 
Example 4
Source Project: jdk8u60   Source File: AttributeWriter.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void write(Object owner, Attributes attrs, ConstantPool constant_pool) {
    if (attrs != null) {
        // null checks
        owner.getClass();
        constant_pool.getClass();
        this.constant_pool = constant_pool;
        this.owner = owner;
        for (Attribute attr: attrs)
            attr.accept(this, null);
    }
}
 
Example 5
Source Project: jdk8u60   Source File: ClassReader.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected  void readAttributesFor(ClassFile c, Attributes attrs, Element x) {
    Element container = new Element();
    AttributeVisitor av = new AttributeVisitor(this, c);
    for (Attribute a : attrs) {
        av.visit(a, container);
    }
    if (!keepOrder) {
        container.sort();
    }
    x.addAll(container);
}
 
Example 6
public void write(Object owner, Attributes attrs, ConstantPool constant_pool) {
    if (attrs != null) {
        // null checks
        owner.getClass();
        constant_pool.getClass();
        this.constant_pool = constant_pool;
        this.owner = owner;
        for (Attribute attr: attrs)
            attr.accept(this, null);
    }
}
 
Example 7
Source Project: openjdk-jdk8u   Source File: ClassReader.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected  void readAttributesFor(ClassFile c, Attributes attrs, Element x) {
    Element container = new Element();
    AttributeVisitor av = new AttributeVisitor(this, c);
    for (Attribute a : attrs) {
        av.visit(a, container);
    }
    if (!keepOrder) {
        container.sort();
    }
    x.addAll(container);
}
 
Example 8
public void write(Object owner, Attributes attrs, ConstantPool constant_pool) {
    if (attrs != null) {
        // null checks
        owner.getClass();
        constant_pool.getClass();
        this.constant_pool = constant_pool;
        this.owner = owner;
        for (Attribute attr: attrs)
            attr.accept(this, null);
    }
}
 
Example 9
protected  void readAttributesFor(ClassFile c, Attributes attrs, Element x) {
    Element container = new Element();
    AttributeVisitor av = new AttributeVisitor(this, c);
    for (Attribute a : attrs) {
        av.visit(a, container);
    }
    if (!keepOrder) {
        container.sort();
    }
    x.addAll(container);
}
 
Example 10
Source Project: openjdk-jdk9   Source File: AttributeWriter.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void write(Object owner, Attributes attrs, ConstantPool constant_pool) {
    if (attrs != null) {
        Assert.checkNonNull(constant_pool);
        Assert.checkNonNull(owner);
        this.constant_pool = constant_pool;
        this.owner = owner;
        for (Attribute attr: attrs)
            attr.accept(this, null);
    }
}
 
Example 11
Source Project: openjdk-jdk9   Source File: IncubatingTest.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void addModuleResolutionAttribute(Path classfile, int resolution_flags) throws Exception {
    ClassFile cf = ClassFile.read(classfile);
    Attributes attrs = cf.attributes;
    List<CPInfo> cpData = new ArrayList<>();
    cpData.add(null);
    for (CPInfo info : cf.constant_pool.entries()) {
        cpData.add(info);
        if (info.size() == 2)
            cpData.add(null);
    }
    cpData.add(new CONSTANT_Utf8_info(Attribute.ModuleResolution));
    ConstantPool newCP = new ConstantPool(cpData.toArray(new CPInfo[0]));
    ModuleResolution_attribute res = new ModuleResolution_attribute(newCP, resolution_flags);
    Map<String, Attribute> newAttributeMap = new HashMap<>(attrs.map);
    newAttributeMap.put(Attribute.ModuleResolution, res);
    Attributes newAttrs = new Attributes(newAttributeMap);
    ClassFile newCF = new ClassFile(cf.magic,
                                    cf.minor_version,
                                    cf.major_version,
                                    newCP,
                                    cf.access_flags,
                                    cf.this_class,
                                    cf.super_class,
                                    cf.interfaces,
                                    cf.fields,
                                    cf.methods,
                                    newAttrs);
    try (OutputStream out = Files.newOutputStream(classfile)) {
        new ClassWriter().write(newCF, out);
    }
}
 
Example 12
Source Project: openjdk-jdk9   Source File: ClassReader.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected  void readAttributesFor(ClassFile c, Attributes attrs, Element x) {
    Element container = new Element();
    AttributeVisitor av = new AttributeVisitor(this, c);
    for (Attribute a : attrs) {
        av.visit(a, container);
    }
    if (!keepOrder) {
        container.sort();
    }
    x.addAll(container);
}
 
Example 13
Source Project: jdk8u-jdk   Source File: ClassReader.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected  void readAttributesFor(ClassFile c, Attributes attrs, Element x) {
    Element container = new Element();
    AttributeVisitor av = new AttributeVisitor(this, c);
    for (Attribute a : attrs) {
        av.visit(a, container);
    }
    if (!keepOrder) {
        container.sort();
    }
    x.addAll(container);
}
 
Example 14
Source Project: hottub   Source File: AttributeWriter.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void write(Object owner, Attributes attrs, ConstantPool constant_pool) {
    if (attrs != null) {
        // null checks
        owner.getClass();
        constant_pool.getClass();
        this.constant_pool = constant_pool;
        this.owner = owner;
        for (Attribute attr: attrs)
            attr.accept(this, null);
    }
}
 
Example 15
Source Project: hottub   Source File: ClassReader.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected  void readAttributesFor(ClassFile c, Attributes attrs, Element x) {
    Element container = new Element();
    AttributeVisitor av = new AttributeVisitor(this, c);
    for (Attribute a : attrs) {
        av.visit(a, container);
    }
    if (!keepOrder) {
        container.sort();
    }
    x.addAll(container);
}
 
Example 16
public void write(Object owner, Attributes attrs, ConstantPool constant_pool) {
    if (attrs != null) {
        // null checks
        owner.getClass();
        constant_pool.getClass();
        this.constant_pool = constant_pool;
        this.owner = owner;
        for (Attribute attr: attrs)
            attr.accept(this, null);
    }
}
 
Example 17
Source Project: openjdk-8-source   Source File: ClassReader.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected  void readAttributesFor(ClassFile c, Attributes attrs, Element x) {
    Element container = new Element();
    AttributeVisitor av = new AttributeVisitor(this, c);
    for (Attribute a : attrs) {
        av.visit(a, container);
    }
    if (!keepOrder) {
        container.sort();
    }
    x.addAll(container);
}
 
Example 18
Source Project: openjdk-8   Source File: AttributeWriter.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void write(Object owner, Attributes attrs, ConstantPool constant_pool) {
    if (attrs != null) {
        // null checks
        owner.getClass();
        constant_pool.getClass();
        this.constant_pool = constant_pool;
        this.owner = owner;
        for (Attribute attr: attrs)
            attr.accept(this, null);
    }
}
 
Example 19
Source Project: openjdk-8   Source File: ClassReader.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected  void readAttributesFor(ClassFile c, Attributes attrs, Element x) {
    Element container = new Element();
    AttributeVisitor av = new AttributeVisitor(this, c);
    for (Attribute a : attrs) {
        av.visit(a, container);
    }
    if (!keepOrder) {
        container.sort();
    }
    x.addAll(container);
}
 
Example 20
Source Project: jdk8u_jdk   Source File: ClassReader.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected  void readAttributesFor(ClassFile c, Attributes attrs, Element x) {
    Element container = new Element();
    AttributeVisitor av = new AttributeVisitor(this, c);
    for (Attribute a : attrs) {
        av.visit(a, container);
    }
    if (!keepOrder) {
        container.sort();
    }
    x.addAll(container);
}
 
Example 21
Source Project: jdk8u-jdk   Source File: ClassReader.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected  void readAttributesFor(ClassFile c, Attributes attrs, Element x) {
    Element container = new Element();
    AttributeVisitor av = new AttributeVisitor(this, c);
    for (Attribute a : attrs) {
        av.visit(a, container);
    }
    if (!keepOrder) {
        container.sort();
    }
    x.addAll(container);
}
 
Example 22
Source Project: jdk8u-dev-jdk   Source File: ClassReader.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected  void readAttributesFor(ClassFile c, Attributes attrs, Element x) {
    Element container = new Element();
    AttributeVisitor av = new AttributeVisitor(this, c);
    for (Attribute a : attrs) {
        av.visit(a, container);
    }
    if (!keepOrder) {
        container.sort();
    }
    x.addAll(container);
}
 
Example 23
Source Project: TencentKona-8   Source File: ClassWriter.java    License: GNU General Public License v2.0 4 votes vote down vote up
Signature_attribute getSignature(Attributes attributes) {
    return (Signature_attribute) attributes.get(Attribute.Signature);
}
 
Example 24
void checkForAttr(Attributes attrs, String errorMsg, String... attrNames) {
    for (String attrName : attrNames) {
        Assert.checkNonNull(attrs.get(attrName), errorMsg);
    }
}
 
Example 25
Source Project: jdk8u60   Source File: ClassWriter.java    License: GNU General Public License v2.0 4 votes vote down vote up
Signature_attribute getSignature(Attributes attributes) {
    return (Signature_attribute) attributes.get(Attribute.Signature);
}
 
Example 26
void checkForAttr(Attributes attrs, String errorMsg, String... attrNames) {
    for (String attrName : attrNames) {
        Assert.checkNonNull(attrs.get(attrName), errorMsg);
    }
}
 
Example 27
Source Project: openjdk-jdk8u   Source File: ClassWriter.java    License: GNU General Public License v2.0 4 votes vote down vote up
Signature_attribute getSignature(Attributes attributes) {
    return (Signature_attribute) attributes.get(Attribute.Signature);
}
 
Example 28
void checkForAttr(Attributes attrs, String errorMsg, String... attrNames) {
    for (String attrName : attrNames) {
        Assert.checkNonNull(attrs.get(attrName), errorMsg);
    }
}
 
Example 29
Signature_attribute getSignature(Attributes attributes) {
    return (Signature_attribute) attributes.get(Attribute.Signature);
}
 
Example 30
void checkForAttr(Attributes attrs, String errorMsg, String... attrNames) {
    for (String attrName : attrNames) {
        Assert.checkNonNull(attrs.get(attrName), errorMsg);
    }
}