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


Java FieldVisitor类代码示例

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


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

示例1: visitField

import jdk.internal.org.objectweb.asm.FieldVisitor; //导入依赖的package包/类
@Override
public FieldVisitor visitField(final int access, final String name,
        final String desc, final String signature, final Object value) {
    checkState();
    checkAccess(access, Opcodes.ACC_PUBLIC + Opcodes.ACC_PRIVATE
            + Opcodes.ACC_PROTECTED + Opcodes.ACC_STATIC
            + Opcodes.ACC_FINAL + Opcodes.ACC_VOLATILE
            + Opcodes.ACC_TRANSIENT + Opcodes.ACC_SYNTHETIC
            + Opcodes.ACC_ENUM + Opcodes.ACC_DEPRECATED + 0x40000); // ClassWriter.ACC_SYNTHETIC_ATTRIBUTE
    CheckMethodAdapter.checkUnqualifiedName(version, name, "field name");
    CheckMethodAdapter.checkDesc(desc, false);
    if (signature != null) {
        checkFieldSignature(signature);
    }
    if (value != null) {
        CheckMethodAdapter.checkConstant(value);
    }
    FieldVisitor av = super
            .visitField(access, name, desc, signature, value);
    return new CheckFieldAdapter(av);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:CheckClassAdapter.java

示例2: visit

import jdk.internal.org.objectweb.asm.FieldVisitor; //导入依赖的package包/类
@Override
public byte[] visit(VariableDeclaration node) {
    VariableInfo vi = node.getVariableInfo();
    String ownerName = vi.getOwner().getName();
    ContextDependedClassWriter cw = classWriters.get(ownerName);
    String typeName = new String(vi.type.accept(this));
    if (vi.isLocal()) {
        locals.addLocal(vi);
    } else {
        FieldVisitor fv = cw.visitField(asAccessFlags(vi),
                vi.name,
                typeName,
                null /* Generic */,
                null /* Constant value */);
        fv.visitEnd(); // doesn't need visitAnnotation and visitAttribute
    }
    return EMPTY_BYTE_ARRAY;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:ByteCodeVisitor.java

示例3: visitField

import jdk.internal.org.objectweb.asm.FieldVisitor; //导入依赖的package包/类
@Override
public FieldVisitor visitField(
    final int access,
    final String name,
    final String desc,
    final String signature,
    final Object value)
{
    checkState();
    checkAccess(access, Opcodes.ACC_PUBLIC + Opcodes.ACC_PRIVATE
            + Opcodes.ACC_PROTECTED + Opcodes.ACC_STATIC
            + Opcodes.ACC_FINAL + Opcodes.ACC_VOLATILE
            + Opcodes.ACC_TRANSIENT + Opcodes.ACC_SYNTHETIC
            + Opcodes.ACC_ENUM + Opcodes.ACC_DEPRECATED
            + 0x40000); // ClassWriter.ACC_SYNTHETIC_ATTRIBUTE
    CheckMethodAdapter.checkUnqualifiedName(version, name, "field name");
    CheckMethodAdapter.checkDesc(desc, false);
    if (signature != null) {
        CheckMethodAdapter.checkFieldSignature(signature);
    }
    if (value != null) {
        CheckMethodAdapter.checkConstant(value);
    }
    FieldVisitor av = super.visitField(access, name, desc, signature, value);
    return new CheckFieldAdapter(av);
}
 
开发者ID:wro4j,项目名称:nashorn-backport,代码行数:27,代码来源:CheckClassAdapter.java

示例4: visitField

import jdk.internal.org.objectweb.asm.FieldVisitor; //导入依赖的package包/类
@Override
public FieldVisitor visitField(
    final int access,
    final String name,
    final String desc,
    final String signature,
    final Object value)
{
    Printer p = this.p.visitField(access,
            name,
            desc,
            signature,
            value);
    FieldVisitor fv = cv == null ? null : cv.visitField(access,
            name,
            desc,
            signature,
            value);
    return new TraceFieldVisitor(fv, p);
}
 
开发者ID:wro4j,项目名称:nashorn-backport,代码行数:21,代码来源:TraceClassVisitor.java

示例5: visitField

import jdk.internal.org.objectweb.asm.FieldVisitor; //导入依赖的package包/类
@Override
public FieldVisitor visitField(final int access, final String name,
        final String desc, final String signature, final Object value) {
    if (computeSVUID) {
        if ("serialVersionUID".equals(name)) {
            // since the class already has SVUID, we won't be computing it.
            computeSVUID = false;
            hasSVUID = true;
        }
        /*
         * Remember field for SVUID computation For field modifiers, only
         * the ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC,
         * ACC_FINAL, ACC_VOLATILE, and ACC_TRANSIENT flags are used when
         * computing serialVersionUID values.
         */
        if ((access & Opcodes.ACC_PRIVATE) == 0
                || (access & (Opcodes.ACC_STATIC | Opcodes.ACC_TRANSIENT)) == 0) {
            int mods = access
                    & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PRIVATE
                            | Opcodes.ACC_PROTECTED | Opcodes.ACC_STATIC
                            | Opcodes.ACC_FINAL | Opcodes.ACC_VOLATILE | Opcodes.ACC_TRANSIENT);
            svuidFields.add(new Item(name, mods, desc));
        }
    }

    return super.visitField(access, name, desc, signature, value);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:SerialVersionUIDAdder.java

示例6: addSVUID

import jdk.internal.org.objectweb.asm.FieldVisitor; //导入依赖的package包/类
protected void addSVUID(long svuid) {
    FieldVisitor fv = super.visitField(Opcodes.ACC_FINAL
            + Opcodes.ACC_STATIC, "serialVersionUID", "J", null, svuid);
    if (fv != null) {
        fv.visitEnd();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:SerialVersionUIDAdder.java

示例7: visitField

import jdk.internal.org.objectweb.asm.FieldVisitor; //导入依赖的package包/类
@Override
public FieldVisitor visitField(int access, String name, String desc,
        String signature, Object value) {
    FieldVisitor fv = super.visitField(access,
            remapper.mapFieldName(className, name, desc),
            remapper.mapDesc(desc), remapper.mapSignature(signature, true),
            remapper.mapValue(value));
    return fv == null ? null : createRemappingFieldAdapter(fv);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:RemappingClassAdapter.java

示例8: visitField

import jdk.internal.org.objectweb.asm.FieldVisitor; //导入依赖的package包/类
@Override
public FieldVisitor visitField(final int access, final String name,
        final String desc, final String signature, final Object value) {
    FieldNode fn = new FieldNode(access, name, desc, signature, value);
    fields.add(fn);
    return fn;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:ClassNode.java

示例9: visitField

import jdk.internal.org.objectweb.asm.FieldVisitor; //导入依赖的package包/类
@Override
public FieldVisitor visitField(final int access, final String name,
        final String desc, final String signature, final Object value) {
    Printer p = this.p.visitField(access, name, desc, signature, value);
    FieldVisitor fv = cv == null ? null : cv.visitField(access, name, desc,
            signature, value);
    return new TraceFieldVisitor(fv, p);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:TraceClassVisitor.java

示例10: addMapField

import jdk.internal.org.objectweb.asm.FieldVisitor; //导入依赖的package包/类
static void addMapField(final ClassVisitor cv) {
    // add a PropertyMap static field
    final FieldVisitor fv = cv.visitField(ACC_PRIVATE | ACC_STATIC | ACC_FINAL,
        PROPERTYMAP_FIELD_NAME, PROPERTYMAP_DESC, null, null);
    if (fv != null) {
        fv.visitEnd();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:ClassGenerator.java

示例11: visitField

import jdk.internal.org.objectweb.asm.FieldVisitor; //导入依赖的package包/类
@Override
public FieldVisitor visitField(
    final int access,
    final String name,
    final String desc,
    final String signature,
    final Object value) {
    return new FieldVisitor(Opcodes.ASM4) {
        @Override
        public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
            return new NullAnnotationVisitor();
        }
    };
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:NullVisitor.java

示例12: visitField

import jdk.internal.org.objectweb.asm.FieldVisitor; //导入依赖的package包/类
@Override
public FieldVisitor visitField(final int fieldAccess, final String fieldName,
        final String fieldDesc, final String signature, final Object value) {
    final MemberInfo memInfo = scriptClassInfo.find(fieldName, fieldDesc, fieldAccess);
    if (memInfo != null && memInfo.getKind() == Kind.PROPERTY &&
            memInfo.getWhere() != Where.INSTANCE && !memInfo.isStaticFinal()) {
        // non-instance @Property fields - these have to go elsewhere unless 'static final'
        return null;
    }

    final FieldVisitor delegateFV = super.visitField(fieldAccess, fieldName, fieldDesc,
            signature, value);
    return new FieldVisitor(Opcodes.ASM4, delegateFV) {
        @Override
        public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
            if (ScriptClassInfo.annotations.containsKey(desc)) {
                // ignore script field annotations
                return null;
            }

            return fv.visitAnnotation(desc, visible);
        }

        @Override
        public void visitAttribute(final Attribute attr) {
            fv.visitAttribute(attr);
        }

        @Override
        public void visitEnd() {
            fv.visitEnd();
        }
    };
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:35,代码来源:ScriptClassInstrumentor.java

示例13: visitField

import jdk.internal.org.objectweb.asm.FieldVisitor; //导入依赖的package包/类
@Override public FieldVisitor visitField(int access, String name,
        String desc, String signature, Object value) {
    if (name.startsWith("dummy")) {
        // Remove dummy field
        fields.addLast(new F(access, name, desc, signature, value));
        return null;
    }
    return cv.visitField(access, name, desc, signature, value);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:RedefineAnnotations.java

示例14: visitField

import jdk.internal.org.objectweb.asm.FieldVisitor; //导入依赖的package包/类
@Override
public FieldVisitor visitField(int access, String name, String desc,
        String signature, Object value) {
    FieldVisitor fv = super.visitField(access,
            remapper.mapFieldName(className, name, desc),
            remapper.mapDesc(desc), remapper.mapSignature(signature, true),
            remapper.mapValue(value));
    return fv == null ? null : createFieldRemapper(fv);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:ClassRemapper.java

示例15: visitField

import jdk.internal.org.objectweb.asm.FieldVisitor; //导入依赖的package包/类
@Override
public FieldVisitor visitField(
    final int access,
    final String name,
    final String desc,
    final String signature,
    final Object value) {
    return new FieldVisitor(Main.ASM_VERSION) {
        @Override
        public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
            return new NullAnnotationVisitor();
        }
    };
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:NullVisitor.java


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