当前位置: 首页>>代码示例>>Java>>正文


Java Field类代码示例

本文整理汇总了Java中com.sun.tools.classfile.Field的典型用法代码示例。如果您正苦于以下问题:Java Field类的具体用法?Java Field怎么用?Java Field使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Field类属于com.sun.tools.classfile包,在下文中一共展示了Field类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testFields

import com.sun.tools.classfile.Field; //导入依赖的package包/类
private void testFields(Map<String, ExpectedSignature> expectedSignatures, ClassFile classFile)
        throws ConstantPoolException {
    String className = classFile.getName();
    Set<String> foundFields = new HashSet<>();
    for (Field field : classFile.fields) {
        String fieldName = field.getName(classFile.constant_pool);
        printf("Testing field %s\n", fieldName);
        testAttribute(
                fieldName,
                classFile,
                () -> (Signature_attribute) field.attributes.get(Attribute.Signature),
                expectedSignatures.get(fieldName));
        foundFields.add(fieldName);
    }
    checkAllMembersFound(foundFields, expectedSignatures,
            "Checking that all fields of class " + className + " with Signature attribute found");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:Driver.java

示例2: getFieldName

import com.sun.tools.classfile.Field; //导入依赖的package包/类
String getFieldName(Field f) {
    try {
        return f.getName(constant_pool);
    } catch (ConstantPoolException e) {
        return report(e);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:ClassWriter.java

示例3: getKind

import com.sun.tools.classfile.Field; //导入依赖的package包/类
private AccessFlags.Kind getKind(Element e) {
    switch(e.getName()) {
        case "Class":
            return AccessFlags.Kind.Class;
        case "InnerClass":
            return AccessFlags.Kind.InnerClass;
        case "Field":
            return AccessFlags.Kind.Field ;
        case "Method":
            return AccessFlags.Kind.Method;
        default: throw new RuntimeException("should not reach here");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:ClassReader.java

示例4: testFields

import com.sun.tools.classfile.Field; //导入依赖的package包/类
private void testFields(ClassFile cf) throws ConstantPoolException {
    for (Field f : cf.fields) {
        String fieldName = cf.constant_pool.getUTF8Value(f.name_index);
        echo("Testing field : " + fieldName);
        Deprecated_attribute attr = (Deprecated_attribute)
                f.attributes.get(Attribute.Deprecated);
        testAttribute(fieldName, attr, cf);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:DeprecatedTest.java

示例5: analyzeClassFile

import com.sun.tools.classfile.Field; //导入依赖的package包/类
void analyzeClassFile(ClassFile classFileToCheck)
    throws
        IOException,
        ConstantPoolException,
        Descriptor.InvalidDescriptor {
    boolean enumClass =
            (classFileToCheck.access_flags.flags & ACC_ENUM) != 0;
    boolean nonFinalStaticEnumField;
    boolean nonFinalStaticField;

    currentFieldsToIgnore =
            classFieldsToIgnoreMap.get(classFileToCheck.getName());

    for (Field field : classFileToCheck.fields) {
        if (ignoreField(field.getName(classFileToCheck.constant_pool))) {
            continue;
        }
        nonFinalStaticEnumField =
                (field.access_flags.flags & (ACC_ENUM | ACC_FINAL)) == 0;
        nonFinalStaticField =
                (field.access_flags.flags & ACC_STATIC) != 0 &&
                (field.access_flags.flags & ACC_FINAL) == 0;
        if (enumClass ? nonFinalStaticEnumField : nonFinalStaticField) {
            errors.add("There is a mutable field named " +
                    field.getName(classFileToCheck.constant_pool) +
                    ", at class " +
                    classFileToCheck.getName());
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:DetectMutableStaticFields.java

示例6: findAnnotations

import com.sun.tools.classfile.Field; //导入依赖的package包/类
private static void findAnnotations(ClassFile cf, List<TypeAnnotation> annos) {
    findAnnotations(cf, Attribute.RuntimeVisibleTypeAnnotations, annos);
    findAnnotations(cf, Attribute.RuntimeInvisibleTypeAnnotations, annos);

    for (Field f : cf.fields) {
        findAnnotations(cf, f, annos);
    }
    for (Method m: cf.methods) {
        findAnnotations(cf, m, annos);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:ReferenceInfoUtil.java

示例7: scanFields

import com.sun.tools.classfile.Field; //导入依赖的package包/类
private void scanFields(Set<Integer> utf8Descriptors)
        throws Exception {
    for (Field field : cf.fields) {
        int descriptorIndex = field.descriptor.index;
        utf8Descriptors.add(descriptorIndex);
        scanAttributes(field.attributes, utf8Descriptors);
    }

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:StringSharingPlugin.java


注:本文中的com.sun.tools.classfile.Field类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。