本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
}
示例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);
}
示例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;
}
示例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);
}
示例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();
}
}
示例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();
}
};
}
示例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();
}
};
}
示例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);
}
示例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);
}
示例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();
}
};
}