Echtzeitsysteme / java-refactoring-ttc

Object-oriented Refactoring of Java Programs using Graph Transformation (TTC'2015)
0 stars 0 forks source link

Why should PUM on hiddenProgram2 fail? #22

Closed tsdh closed 9 years ago

tsdh commented 9 years ago

In the hidden test hiddenProgram2, all ParentClass subclasses ChildClass1 and ChildClass3 (despite its name ChildClass2 doesn't extend ParentClass) have the method def

    public void method(){
        System.out.println("k="+k);
    }

where k is a field of ParentClass. My solution pulls that method but ARTE tells me

ssssssssssssss  Triggering Pull-Up Method Refactoring ssssssssssssss
applyPullUpMethod(hidden.program.two.ParentClass, method)
Pulling up method to hidden.program.two.ParentClass
The rule did match!
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss

FAILURE: Execution of refactoring has been expected to FAIL. (false-positive)
s

Why should it fail? method() is perfectly pullable, and ARTE itself confirms that the program behaves the same before and after the refactoring (at least when measured by its output).

By the way, what's the meaning of these "hidden" tests? I guess the first thing any solution writer does in her TestInterface implementation class is to copy the source java files ARTE generates into /tmp/ to somewhere else where they won't be deleted. So the only thing you can't see is the assertions it checks. Testing against some black box which just says "yes" or "no" without giving you a hint why it expects something else is really annoying.

SvenPeldszus commented 9 years ago

You are right in case hidden_pum2_2 is possible. I don't know why we assert false, as even the refactoring is called "possible_refactoring".

I've fixt it

tsdh commented 9 years ago

Ok, thanks.