@Override public PlasticMethod introduceMethod(MethodDescription description) { check(); if (Modifier.isAbstract(description.modifiers)) { description = description.withModifiers(description.modifiers & ~ACC_ABSTRACT); } PlasticMethod result = description2method.get(description); if (result == null) { result = createNewMethod(description); description2method.put(description, result); } methodNames.add(description.methodName); // Note that is it not necessary to add the new MethodNode to // fieldTransformMethods (the default implementations provided by introduceMethod() do not // ever access instance fields) ... unless the caller invokes changeImplementation(). return result; }
@Override public PlasticMethod introduceMethod(MethodDescription description) { check(); if (Modifier.isAbstract(description.modifiers)) { description = description.withModifiers(description.modifiers & ~ACC_ABSTRACT); } PlasticMethod result = description2method.get(description); if (result == null) { result = createNewMethod(description); description2method.put(description, result); } methodNames.add(description.methodName); // Note that is it not necessary to add the new MethodNode to // fieldTransformMethods (the default implementations provided by introduceMethod() do not // ever access instance fields) ... unless the caller invokes changeImplementation(). return result; }
@Override public PlasticMethod changeImplementation(InstructionBuilderCallback callback) { plasticClass.check(); // If the method is currently abstract, clear that flag. if (Modifier.isAbstract(node.access)) { node.access = node.access & ~org.apache.tapestry5.internal.plastic.asm.Opcodes.ACC_ABSTRACT; description = description.withModifiers(node.access); } node.instructions.clear(); plasticClass.newBuilder(description, node).doCallback(callback); // With the implementation changed, it is necessary to intercept field reads/writes. // The node may not already have been in the fieldTransformMethods Set if it was // an introduced method. plasticClass.fieldTransformMethods.add(node); return this; }
@Override public PlasticMethod changeImplementation(InstructionBuilderCallback callback) { plasticClass.check(); // If the method is currently abstract, clear that flag. if (Modifier.isAbstract(node.access)) { node.access = node.access & ~org.apache.tapestry5.internal.plastic.asm.Opcodes.ACC_ABSTRACT; description = description.withModifiers(node.access); } node.instructions.clear(); plasticClass.newBuilder(description, node).doCallback(callback); // With the implementation changed, it is necessary to intercept field reads/writes. // The node may not already have been in the fieldTransformMethods Set if it was // an introduced method. plasticClass.fieldTransformMethods.add(node); return this; }