Package org.drools.mvel.asm
Class MethodComparator
- java.lang.Object
-
- org.drools.mvel.asm.MethodComparator
-
public class MethodComparator extends java.lang.ObjectThe purpose of this utility it to check if 2 method implementations are equivalent, by comparing the bytecode. This essentual for node sharing where java semantics are involved.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMethodComparator.Tracer
-
Constructor Summary
Constructors Constructor Description MethodComparator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleancompareBytecode(java.lang.String b1, java.lang.String b2)Compares 2 bytecode listings.booleanequivalent(java.lang.String method1, org.mvel2.asm.ClassReader class1, java.lang.String method2, org.mvel2.asm.ClassReader class2)This actually does the comparing.static java.lang.StringgetMethodBytecode(java.lang.Class cls, java.lang.String ruleClassName, java.lang.String packageName, java.lang.String methodName, java.lang.String resource)static java.lang.StringgetMethodBytecode(java.lang.String methodName, byte[] bytes)This will return a series of bytecode instructions which can be used to compare one method with another.java.lang.StringgetMethodBytecode(java.lang.String methodName, org.mvel2.asm.ClassReader classReader)This will return a series of bytecode instructions which can be used to compare one method with another.
-
-
-
Method Detail
-
equivalent
public boolean equivalent(java.lang.String method1, org.mvel2.asm.ClassReader class1, java.lang.String method2, org.mvel2.asm.ClassReader class2)This actually does the comparing. Class1 and Class2 are class reader instances to the respective classes. method1 and method2 are looked up on the respective classes and their contents compared. This is a convenience method.
-
getMethodBytecode
public java.lang.String getMethodBytecode(java.lang.String methodName, org.mvel2.asm.ClassReader classReader)This will return a series of bytecode instructions which can be used to compare one method with another. debug info like local var declarations and line numbers are ignored, so the focus is on the content.
-
getMethodBytecode
public static java.lang.String getMethodBytecode(java.lang.String methodName, byte[] bytes)This will return a series of bytecode instructions which can be used to compare one method with another. debug info like local var declarations and line numbers are ignored, so the focus is on the content.
-
compareBytecode
public static boolean compareBytecode(java.lang.String b1, java.lang.String b2)Compares 2 bytecode listings. Returns true if they are identical.
-
getMethodBytecode
public static java.lang.String getMethodBytecode(java.lang.Class cls, java.lang.String ruleClassName, java.lang.String packageName, java.lang.String methodName, java.lang.String resource)
-
-