Package org.drools.mvel.asm
Class MethodComparator
java.lang.Object
org.drools.mvel.asm.MethodComparator
The 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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancompareBytecode(String b1, String b2) Compares 2 bytecode listings.booleanequivalent(String method1, org.mvel2.asm.ClassReader class1, String method2, org.mvel2.asm.ClassReader class2) This actually does the comparing.static StringgetMethodBytecode(Class cls, String ruleClassName, String packageName, String methodName, String resource) static StringgetMethodBytecode(String methodName, byte[] bytes) This will return a series of bytecode instructions which can be used to compare one method with another.getMethodBytecode(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.
-
Constructor Details
-
MethodComparator
public MethodComparator()
-
-
Method Details
-
equivalent
public boolean equivalent(String method1, org.mvel2.asm.ClassReader class1, 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
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
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
Compares 2 bytecode listings. Returns true if they are identical. -
getMethodBytecode
-