com.sun.tools.classfile.Attributes Java Examples

The following examples show how to use com.sun.tools.classfile.Attributes. 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   Author: alibaba   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
Source Project: TencentKona-8   Author: Tencent   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 #3
Source Project: TencentKona-8   Author: Tencent   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   Author: chenghanpeng   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   Author: chenghanpeng   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
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   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 #7
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   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
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   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 #9
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   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 #10
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   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   Author: AdoptOpenJDK   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   Author: AdoptOpenJDK   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   Author: lambdalab-mirror   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   Author: dsrg-uoft   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   Author: dsrg-uoft   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
Source Project: openjdk-8-source   Author: keerath   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 #17
Source Project: openjdk-8-source   Author: keerath   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   Author: bpupadhyaya   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   Author: bpupadhyaya   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   Author: JetBrains   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   Author: frohoff   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   Author: frohoff   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   Author: Tencent   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   Author: chenghanpeng   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
Source Project: jdk8u60   Author: chenghanpeng   File: AnnotationsAreNotCopiedToBridgeMethodsTest.java    License: GNU General Public License v2.0 4 votes vote down vote up
void checkForAttr(Attributes attrs, String errorMsg, String... attrNames) {
    for (String attrName : attrNames) {
        Assert.checkNonNull(attrs.get(attrName), errorMsg);
    }
}
 
Example #27
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   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
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   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 #30
void checkForAttr(Attributes attrs, String errorMsg, String... attrNames) {
    for (String attrName : attrNames) {
        Assert.checkNonNull(attrs.get(attrName), errorMsg);
    }
}