org.objectweb.asm.commons.MethodRemapper Java Examples
The following examples show how to use
org.objectweb.asm.commons.MethodRemapper.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WeavingClassVisitor.java From glowroot with Apache License 2.0 | 6 votes |
@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()))); } }