org.objectweb.asm.tree.FieldNode类的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中org.objectweb.asm.tree.FieldNode类的一些代码示例,展示了FieldNode类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FieldNode类的具体详情如下:
包路径:org.objectweb.asm.tree.FieldNode
类名称:FieldNode

FieldNode介绍

[英]A node that represents a field.
[中]表示字段的节点。

代码示例

代码示例来源:origin: robolectric/robolectric

@Override
public void decorate(MutableClass mutableClass) {
 mutableClass.addInterface(Type.getInternalName(ShadowedObject.class));
 mutableClass.addField(0, new FieldNode(Opcodes.ACC_PUBLIC,
   ShadowConstants.CLASS_HANDLER_DATA_FIELD_NAME, OBJECT_DESC, OBJECT_DESC, null));
 addRoboGetDataMethod(mutableClass);
}

代码示例来源:origin: kilim/kilim

((FieldNode) cf.fields.get(i)).accept(cv);

代码示例来源:origin: pxb1988/dex2jar

public AnnotationNode visitAnnotation(final String desc, final boolean visible) {
    return (AnnotationNode) fn.visitAnnotation(desc, visible);
  }
};

代码示例来源:origin: org.ow2.asm/asm-debug-all

/**
 * Checks that this class node is compatible with the given ASM API version.
 * This methods checks that this node, and all its nodes recursively, do not
 * contain elements that were introduced in more recent versions of the ASM
 * API than the given version.
 * 
 * @param api
 *            an ASM API version. Must be one of {@link Opcodes#ASM4} or
 *            {@link Opcodes#ASM5}.
 */
public void check(final int api) {
  if (api == Opcodes.ASM4) {
    if (visibleTypeAnnotations != null
        && visibleTypeAnnotations.size() > 0) {
      throw new RuntimeException();
    }
    if (invisibleTypeAnnotations != null
        && invisibleTypeAnnotations.size() > 0) {
      throw new RuntimeException();
    }
    for (FieldNode f : fields) {
      f.check(api);
    }
    for (MethodNode m : methods) {
      m.check(api);
    }
  }
}

代码示例来源:origin: org.ow2.asm/asm-tree

fields.get(i).check(api);

代码示例来源:origin: jphp-group/jphp

@SuppressWarnings("unchecked")
protected void writeSystemInfo() {
  node.fields.add(new FieldNode(
      ACC_PUBLIC + ACC_FINAL + ACC_STATIC, "$FN",
      Type.getDescriptor(String.class),
  node.fields.add(new FieldNode(
      ACC_PUBLIC + ACC_STATIC, "$TRC",
      Type.getDescriptor(TraceInfo[].class),
  node.fields.add(new FieldNode(
      ACC_PUBLIC + ACC_STATIC, "$MEM",
      Type.getDescriptor(Memory[].class),
  node.fields.add(new FieldNode(
      ACC_PUBLIC + ACC_STATIC, "$AMEM",
      Type.getDescriptor(Memory[][].class),
  node.fields.add(new FieldNode(
      ACC_PUBLIC + ACC_STATIC, "$CALL_FUNC_CACHE",
      Type.getDescriptor(FunctionCallCache.class),
  node.fields.add(new FieldNode(
      ACC_PUBLIC + ACC_STATIC, "$CALL_METH_CACHE",
      Type.getDescriptor(MethodCallCache.class),
  node.fields.add(new FieldNode(
      ACC_PUBLIC + ACC_STATIC, "$CALL_PROP_CACHE",
      Type.getDescriptor(PropertyCallCache.class),

代码示例来源:origin: glowroot/glowroot

@RequiresNonNull("type")
private void addMixin(ClassNode mixinClassNode) {
  List<FieldNode> fieldNodes = mixinClassNode.fields;
  for (FieldNode fieldNode : fieldNodes) {
    if (!Modifier.isTransient(fieldNode.access)) {
      // this is needed to avoid serialization issues (even if the new field is
      // serializable, this can still cause issues in a cluster if glowroot is not
      // deployed on all nodes)
      throw new IllegalStateException(
          "@Mixin fields must be marked transient: " + mixinClassNode.name);
    }
    fieldNode.accept(this);
  }
  List<MethodNode> methodNodes = mixinClassNode.methods;
  for (MethodNode mn : methodNodes) {
    if (mn.name.equals("<init>")) {
      continue;
    }
    String[] exceptions = Iterables.toArray(mn.exceptions, String.class);
    MethodVisitor mv =
        cw.visitMethod(mn.access, mn.name, mn.desc, mn.signature, exceptions);
    mn.accept(new MethodRemapper(mv,
        new SimpleRemapper(mixinClassNode.name, type.getInternalName())));
  }
}

代码示例来源:origin: christian-schlichtherle/truelicense

@Override
  public AnnotationVisitor visitAnnotation(
      final String desc,
      final boolean visible) {
    if (OBFUSCATE_DESCRIPTOR.equals(desc)) {
      needsObfuscation = true;
      if (value instanceof String) value = null; // erase
      return null;
    } else {
      return super.visitAnnotation(desc, visible);
    }
  }
}

代码示例来源:origin: pxb1988/dex2jar

fn=new FieldNode(0,null,null,null,null);
cn.fields.add(fn);

代码示例来源:origin: org.apache.drill.exec/drill-java-exec

field.accept(this);

代码示例来源:origin: net.java.truelicense/truelicense-maven-plugin

@Override
  public AnnotationVisitor visitAnnotation(
      final String desc,
      final boolean visible) {
    if (OBFUSCATE_DESCRIPTOR.equals(desc)) {
      needsObfuscation = true;
      if (value instanceof String) value = null; // erase
      return null;
    } else {
      return super.visitAnnotation(desc, visible);
    }
  }
}

代码示例来源:origin: mjanicek/rembulan

public FieldNode fieldNode() {
  return new FieldNode(
      ACC_PRIVATE + ACC_STATIC + ACC_FINAL,
      fieldName,
      fieldType.getDescriptor(),
      null,
      null);
}

代码示例来源:origin: org.ow2.asm/asm-debug-all

fields.get(i).accept(cv);

代码示例来源:origin: org.ow2.asm/asm-debug-all

@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;
}

代码示例来源:origin: org.ow2.asm/asm-tree

fields.get(i).accept(classVisitor);

代码示例来源:origin: org.ow2.asm/asm-tree

@Override
public FieldVisitor visitField(
  final int access,
  final String name,
  final String descriptor,
  final String signature,
  final Object value) {
 FieldNode field = new FieldNode(access, name, descriptor, signature, value);
 fields.add(field);
 return field;
}

代码示例来源:origin: org.multiverse/multiverse-alpha-unborn

/**
 * Creates the static field that contains the txFactory for a transactional method.
 *
 * @return the created FieldNode.
 */
private FieldNode createTransactionFactoryField() {
  int access = ACC_FINAL + ACC_PUBLIC + ACC_STATIC + ACC_SYNTHETIC;
  String name = "___transactionFactory_" + System.nanoTime(); //todo: improve, use better name
  String desc = Type.getDescriptor(TransactionFactory.class);
  String sig = null;
  Object value = null;
  return new FieldNode(access, name, desc, sig, value);
}

代码示例来源:origin: apache/felix

/**
 * Visit a field.
 * Call the field collector visitor.
 *
 * @param access    : field access.
 * @param name      : field name
 * @param desc      : field descriptor
 * @param signature : field signature
 * @param value     : field value (static field only)
 * @return the field visitor.
 * @see org.objectweb.asm.ClassVisitor#visitField(int, java.lang.String, java.lang.String, java.lang.String,
 * java.lang.Object)
 */
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
  return new FieldMetadataCollector(workbench, new FieldNode(access, name, desc, signature, value));
}

代码示例来源:origin: org.activecomponents.jadex/jadex-kernel-bdiv3

/**
   *  Create field node helper.
   */
  public FieldNode createField(int access, String name, String desc, String[] signature, Object initialValue)
  {
    StringBuilder sig = new StringBuilder();
    for(String string : signature)
    {
      sig.append(string);
    }
    
    FieldNode fieldNode = new FieldNode(access, name, desc, sig.toString(), initialValue);
    return fieldNode;
  }
}

代码示例来源:origin: Mine-and-blade-admin/Battlegear2

@Override
boolean processFields(List<FieldNode> fields) {
  logger.log(Level.INFO, "\tAdding new fields to EntityPlayer");
  fields.add(fields.size(), new FieldNode(ACC_PUBLIC, "specialActionTimer", "I", null, 0));
  fields.add(fields.size(), new FieldNode(ACC_PUBLIC, "isShielding", "Z", null, false));
  return true;
}

相关文章

微信公众号

最新文章

更多