Ashok Purushotham
(ashok@cs.arizona.edu)
Rathna Prabhu Rajendran
(prabhu@cs.arizona.edu)
False refactoring is performed on two classes C1 and C2 that have no common behavior. If both classes have instance variables of the same type, these can be moved into the new parent class C3. C3's methods can be buggy versions of some of the methods from C1 and C2.
Consider the following sample code:
C1.java class C1 { String customerName = ""; public void process( ) { /* Process customer */ customerName = ... } } C2.java class C2 { String furnitureName = ""; public int polish( ) { furnitureName = ... /* Polish the furniture */ } }
After false refactoring the classes:
class SMBaseC1 { String smstring = ""; public void process( ) { /* Buggy code */ } } class C1 extends SMBaseC1 { public void process( ) { smstring = ... } } class C1 extends SMBaseC1 { public int polish( ) { smstring = ... } }
If one of the classes inherits from some other class other than java.lang.Object, then SMBaseC1 has to be an interface and the two classes have to implement SMBaseC1 instead of extending it.
No additional configuration parameters are required to carry out this obfuscation.