コード例 #1
0
 @Override
 public void visitParameter(String name, int access) {
   AttributesImpl attrs = new AttributesImpl();
   if (name != null) {
     attrs.addAttribute("", "name", "name", "", name);
   }
   StringBuffer sb = new StringBuffer();
   SAXClassAdapter.appendAccess(access, sb);
   attrs.addAttribute("", "access", "access", "", sb.toString());
   sa.addElement("parameter", attrs);
 }
コード例 #2
0
 @Override
 public void visitInvokeDynamicInsn(String name, String desc, Handle bsm, Object... bsmArgs) {
   AttributesImpl attrs = new AttributesImpl();
   attrs.addAttribute("", "name", "name", "", name);
   attrs.addAttribute("", "desc", "desc", "", desc);
   attrs.addAttribute("", "bsm", "bsm", "", SAXClassAdapter.encode(bsm.toString()));
   sa.addStart("INVOKEDYNAMIC", attrs);
   for (int i = 0; i < bsmArgs.length; i++) {
     sa.addElement("bsmArg", getConstantAttribute(bsmArgs[i]));
   }
   sa.addEnd("INVOKEDYNAMIC");
 }
コード例 #3
0
  private void addValueElement(
      final String element, final String name, final String desc, final String value) {
    AttributesImpl att = new AttributesImpl();
    if (name != null) {
      att.addAttribute("", "name", "name", "", name);
    }
    if (desc != null) {
      att.addAttribute("", "desc", "desc", "", desc);
    }
    if (value != null) {
      att.addAttribute("", "value", "value", "", SAXClassAdapter.encode(value));
    }

    sa.addElement(element, att);
  }
コード例 #4
0
 @Override
 public void visitLocalVariable(
     final String name,
     final String desc,
     final String signature,
     final Label start,
     final Label end,
     final int index) {
   AttributesImpl attrs = new AttributesImpl();
   attrs.addAttribute("", "name", "name", "", name);
   attrs.addAttribute("", "desc", "desc", "", desc);
   if (signature != null) {
     attrs.addAttribute("", "signature", "signature", "", SAXClassAdapter.encode(signature));
   }
   attrs.addAttribute("", "start", "start", "", getLabel(start));
   attrs.addAttribute("", "end", "end", "", getLabel(end));
   attrs.addAttribute("", "var", "var", "", Integer.toString(index));
   sa.addElement("LocalVar", attrs);
 }
コード例 #5
0
 private static AttributesImpl getConstantAttribute(final Object cst) {
   AttributesImpl attrs = new AttributesImpl();
   attrs.addAttribute("", "cst", "cst", "", SAXClassAdapter.encode(cst.toString()));
   attrs.addAttribute("", "desc", "desc", "", Type.getDescriptor(cst.getClass()));
   return attrs;
 }