Main

Refactoring Errors

Main.RefactoringErrors History

Show minor edits - Show changes to output

05-10-2009 09:46 by rohit -
Deleted lines 0-414:
!! Push Down Method



!!!  Push Down Method Leads to Undiagnosed Shadowing of a Method:



(:table  width=100% :)
(:cellnr:)
!!! Source
(:cell:)
!!! Target
(:cellnr:)
[@ 
public class A {
public int k(long i) {
return 23;
}

public int m() {
return k(2);
}
}
public class B extends A {
public int k(int i) {
return 42;
}

public int main() {
return m();
}

}
@]
(:cell:)
[@ 
public class A {
public int k(long i) {
return 23;
}
}
public class B extends A {
public int k(int i) {
return 42;
}

public int main() {
return m();
}

public int m() {
return k(2);
}

}
@]
(:tableend:)


The method B.main() returns 23. Pushing down A.m() into B just moves the method without any adjustments, so in the resulting program, the method B.main() returns 42.



!!! Push Down Method Leads to Undiagnosed Shadowing of a Method (ii):


(:table  width=100% :)
(:cellnr:)
!!! Source
(:cell:)
!!! Target
(:cellnr:)
[@ 
public class A {
  public int k(long i){
    return 23;
  }
}

public class B extends A {
  public int m(){
    return k(2);
  }
}

public class C extends B {
  public int main(){
    return m();
  }
  public int k(int i){
    return 42;
  }

}
@]
(:cell:)
[@ 
public class A {
  public int k(long i){
    return 23;
  }
}

public class B extends A {
}

public class C extends B {
  public int main(){
    return m();
  }
  public int k(int i){
    return 42;
  }
public int m() {
    return Name_0(2);
  }
}
@]
(:tableend:)


The method C.main() returns 23. Pushing down B.m() into C just moves the method without any adjustments, so in the resulting program, the method C.main() returns 42.

!!! Incorrect handling of super accesses:


(:table  width=100% :)
(:cellnr:)
!!! Source
(:cell:)
!!! Target
(:cellnr:)
[@ 
public class A {
public int k() {
return 23;
}
}

public class B extends A {
public int k() {
return 42;
}
public int m() {
return super.k();
}
}

public class C extends B {
public int main() {
return m();
}
}
@]
(:cell:)
[@ 
public class A {
public int k() {
return 23;
}
}

public class B extends A {
public int k() {
return 42;
}
}

public class C extends B {
public int main() {
return m();
}
public int m() {
return super.k();
}
}
@]
(:tableend:)

The method C.main() returns 23. Pushing down B.m() into C just moves the method without any adjustments, so in the resulting program, the method C.main() returns 42.

!!! Push Down Method Leads to  change the method invoked with super accesses to a method with different signature


(:table  width=100% :)
(:cellnr:)
!!! Source
(:cell:)
!!! Target
(:cellnr:)
[@ 
public class A {
public int k(long i) {
return 23;
}
}

public class B extends A {
public int k(int i) {
return 42;
}

public int m() {
return super.k(2);
}
}

public class C extends B {
public int main() {
return m();
}
}
@]
(:cell:)
[@ 
public class A {
public int k(long i) {
return 23;
}
}

public class B extends A {
public int k(int i) {
return 42;
}
}

public class C extends B {
public int main() {
return m();
}


public int m() {
return super.k(2);
}
}
@]
(:tableend:)

The method C.main() returns 23. Pushing down B.m() into C just moves the method without any adjustments, so in the resulting program, the method C.main() returns 42.


!!! Incorrect handling of field accesses


(:table  width=100% :)
(:cellnr:)
!!! Source
(:cell:)
!!! Target
(:cellnr:)
[@ 
public class A {
protected int x = 23;

public int m() {
return x;
}
}

public class B extends A {
protected int x = 42;

public int main() {
return new B().m();
}
}
@]
(:cell:)
[@ 
public class A {
protected int x = 23;
}

public class B extends A {
protected int x = 42;

public int main() {
return new B().m();
}

public int m() {
return x;
}
}
@]
(:tableend:)

The method B.main() returns 23. Pushing down A.m into B just moves the method without any adjustments, so in resulting program, B.main() returns 42.


!!! Incorrect Handling of Type Accesses:


(:table  width=100% :)
(:cellnr:)
!!! Source
(:cell:)
!!! Target
(:cellnr:)
[@ 
public class A {
class B {
public int getX() {
return 23;
}
}

public int m() {
return new B().getX();
}
}

public class C extends A {
class B {
public int getX() {
return 42;
}
}

public int main() {
return new C().m();

}
}
@]
(:cell:)
[@ 
public class A {
class B {
public int getX() {
return 23;
}
}
}

public class C extends A {
class B {
public int getX() {
return 42;
}
}

public int main() {
return new C().m();

}

public int m() {
return new B().getX();
}
}
@]
(:tableend:)

The method C.main() returns 23. Pushing down A.m into B just moves the method without any adjustments, so in the resulting program, C.main() returns 42.


!!! Incorrect Handling of Private Method Accesses:


(:table  width=100% :)
(:cellnr:)
!!! Source
(:cell:)
!!! Target
(:cellnr:)
[@ 
public class A {
private int k() {
return 23;
}

int m() {
return k();
}
}

public class B extends A {
protected int k() {
return 42;
}

public int main() {
return new B().m();
}
}
@]
(:cell:)
[@ 
public class A {
protected int k() {
return 23;
}
}

public class B extends A {
protected int k() {
return 42;
}

public int main() {
return new B().m();
}

int m() {
return k();
}
}
@]
(:tableend:)

The method B.main() returns 23. Pushing down A.m into B just moves the method without any adjustments, so in the resulting program, B.main() returns 42.
04-10-2009 03:01 by gustavo -
Changed lines 358-415 from:
The method C.main() returns 23. Pushing down A.m into B just moves the method without any adjustments, so in the resulting program, C.main() returns 42.
to:
The method C.main() returns 23. Pushing down A.m into B just moves the method without any adjustments, so in the resulting program, C.main() returns 42.


!!! Incorrect Handling of Private Method Accesses:


(:table  width=100% :)
(:cellnr:)
!!! Source
(:cell:)
!!! Target
(:cellnr:)
[@ 
public class A {
private int k() {
return 23;
}

int m() {
return k();
}
}

public class B extends A {
protected int k() {
return 42;
}

public int main() {
return new B().m();
}
}
@]
(:cell:)
[@ 
public class A {
protected int k() {
return 23;
}
}

public class B extends A {
protected int k() {
return 42;
}

public int main() {
return new B().m();
}

int m() {
return k();
}
}
@]
(:tableend:)

The method B.main() returns 23. Pushing down A.m into B just moves the method without any adjustments, so in the resulting program, B.main() returns 42.
04-10-2009 02:52 by gustavo -
Changed line 306 from:
public int getTamanho() {
to:
public int getX() {
Changed line 312 from:
return new B().getTamanho();
to:
return new B().getX();
Changed line 318 from:
public int getTamanho() {
to:
public int getX() {
Changed line 333 from:
public int getTamanho() {
to:
public int getX() {
Changed line 341 from:
public int getTamanho() {
to:
public int getX() {
Changed line 352 from:
return new B().getTamanho();
to:
return new B().getX();
04-10-2009 02:51 by gustavo -
Changed lines 291-358 from:
The method B.main() returns 23. Pushing down A.m into B just moves the method without any adjustments, so in resulting program, B.main() returns 42.
to:
The method B.main() returns 23. Pushing down A.m into B just moves the method without any adjustments, so in resulting program, B.main() returns 42.


!!! Incorrect Handling of Type Accesses:


(:table  width=100% :)
(:cellnr:)
!!! Source
(:cell:)
!!! Target
(:cellnr:)
[@ 
public class A {
class B {
public int getTamanho() {
return 23;
}
}

public int m() {
return new B().getTamanho();
}
}

public class C extends A {
class B {
public int getTamanho() {
return 42;
}
}

public int main() {
return new C().m();

}
}
@]
(:cell:)
[@ 
public class A {
class B {
public int getTamanho() {
return 23;
}
}
}

public class C extends A {
class B {
public int getTamanho() {
return 42;
}
}

public int main() {
return new C().m();

}

public int m() {
return new B().getTamanho();
}
}
@]
(:tableend:)

The method C.main() returns 23. Pushing down A.m into B just moves the method without any adjustments, so in the resulting program, C.main() returns 42.
04-10-2009 02:44 by gustavo -
Changed lines 242-291 from:
The method C.main() returns 23. Pushing down B.m() into C just moves the method without any adjustments, so in the resulting program, the method C.main() returns 42.
to:
The method C.main() returns 23. Pushing down B.m() into C just moves the method without any adjustments, so in the resulting program, the method C.main() returns 42.


!!! Incorrect handling of field accesses


(:table  width=100% :)
(:cellnr:)
!!! Source
(:cell:)
!!! Target
(:cellnr:)
[@ 
public class A {
protected int x = 23;

public int m() {
return x;
}
}

public class B extends A {
protected int x = 42;

public int main() {
return new B().m();
}
}
@]
(:cell:)
[@ 
public class A {
protected int x = 23;
}

public class B extends A {
protected int x = 42;

public int main() {
return new B().m();
}

public int m() {
return x;
}
}
@]
(:tableend:)

The method B.main() returns 23. Pushing down A.m into B just moves the method without any adjustments, so in resulting program, B.main() returns 42.
04-10-2009 01:32 by gustavo -
Changed lines 183-242 from:
!!! Push Down Method Leads to  change the method invoked with super accesses to a method with different signature
to:
!!! Push Down Method Leads to  change the method invoked with super accesses to a method with different signature


(:table  width=100% :)
(:cellnr:)
!!! Source
(:cell:)
!!! Target
(:cellnr:)
[@ 
public class A {
public int k(long i) {
return 23;
}
}

public class B extends A {
public int k(int i) {
return 42;
}

public int m() {
return super.k(2);
}
}

public class C extends B {
public int main() {
return m();
}
}
@]
(:cell:)
[@ 
public class A {
public int k(long i) {
return 23;
}
}

public class B extends A {
public int k(int i) {
return 42;
}
}

public class C extends B {
public int main() {
return m();
}


public int m() {
return super.k(2);
}
}
@]
(:tableend:)

The method C.main() returns 23. Pushing down B.m() into C just moves the method without any adjustments, so in the resulting program, the method C.main() returns 42.
04-10-2009 01:13 by gustavo -
Deleted lines 153-154:
}
04-10-2009 01:12 by gustavo -
Added lines 182-183:

The method C.main() returns 23. Pushing down B.m() into C just moves the method without any adjustments, so in the resulting program, the method C.main() returns 42.
04-10-2009 01:10 by gustavo -
Added lines 126-181:


(:table  width=100% :)
(:cellnr:)
!!! Source
(:cell:)
!!! Target
(:cellnr:)
[@ 
public class A {
public int k() {
return 23;
}
}

public class B extends A {
public int k() {
return 42;
}
public int m() {
return super.k();
}
}

public class C extends B {
public int main() {
return m();
}
}

}
@]
(:cell:)
[@ 
public class A {
public int k() {
return 23;
}
}

public class B extends A {
public int k() {
return 42;
}
}

public class C extends B {
public int main() {
return m();
}
public int m() {
return super.k();
}
}
@]
(:tableend:)
04-10-2009 01:06 by gustavo -
Changed lines 5-8 from:
#  Push Down Method Leads to Undiagnosed Shadowing of a Method:


to:
!!!  Push Down Method Leads to Undiagnosed Shadowing of a Method:


Changed lines 65-67 from:
# !Push Down Method Leads to Undiagnosed Shadowing of a Method (ii):

to:
!!! Push Down Method Leads to Undiagnosed Shadowing of a Method (ii):

Changed lines 125-127 from:
# Incorrect handling of super accesses:

# Push Down Method Leads to  change the method invoked with super accesses to a method with different signature
to:
!!! Incorrect handling of super accesses:

!!! Push Down Method Leads to  change the method invoked with super accesses to a method with different signature
04-10-2009 01:03 by gustavo -
Deleted line 75:
Deleted line 76:
Deleted line 77:
Deleted line 78:
Deleted line 81:
Deleted line 82:
Deleted line 83:
Deleted line 84:
Deleted line 87:
Deleted line 88:
Deleted line 89:
Deleted line 90:
Deleted line 91:
Deleted line 92:
Deleted line 99:
Deleted line 100:
Deleted line 101:
Deleted line 102:
Deleted line 105:
Deleted line 108:
Deleted line 109:
Deleted line 110:
Deleted line 111:
Deleted line 112:
Deleted line 113:
Deleted line 114:
Deleted line 115:
Deleted line 116:
Deleted line 117:
04-10-2009 01:02 by gustavo -
Changed lines 5-8 from:
!!! #  Push Down Method Leads to Undiagnosed Shadowing of a Method:


to:
#  Push Down Method Leads to Undiagnosed Shadowing of a Method:


Changed lines 65-67 from:
# !!!Push Down Method Leads to Undiagnosed Shadowing of a Method (ii):

to:
# !Push Down Method Leads to Undiagnosed Shadowing of a Method (ii):

Changed lines 154-156 from:
# !!!Incorrect handling of super accesses:

# !!!Push Down Method Leads to  change the method invoked with super accesses to a method with different signature
to:
# Incorrect handling of super accesses:

# Push Down Method Leads to  change the method invoked with super accesses to a method with different signature
04-10-2009 01:01 by gustavo -
Changed line 5 from:
# !!! Push Down Method Leads to Undiagnosed Shadowing of a Method:
to:
!!! # Push Down Method Leads to Undiagnosed Shadowing of a Method:
04-10-2009 01:01 by gustavo -
Changed line 5 from:
# !!!Push Down Method Leads to Undiagnosed Shadowing of a Method:
to:
# !!! Push Down Method Leads to Undiagnosed Shadowing of a Method:
04-10-2009 01:01 by gustavo -
Changed lines 5-8 from:
# Push Down Method Leads to Undiagnosed Shadowing of a Method:


to:
# !!!Push Down Method Leads to Undiagnosed Shadowing of a Method:


Changed lines 65-67 from:
# Push Down Method Leads to Undiagnosed Shadowing of a Method (ii):

to:
# !!!Push Down Method Leads to Undiagnosed Shadowing of a Method (ii):

Changed lines 154-156 from:
# Incorrect handling of super accesses:

# Push Down Method Leads to  change the method invoked with super accesses to a method with different signature
to:
# !!!Incorrect handling of super accesses:

# !!!Push Down Method Leads to  change the method invoked with super accesses to a method with different signature
04-10-2009 01:00 by gustavo -
Changed lines 61-67 from:
The method B.main() returns 23. Pushing down A.m() into B just moves the method without any adjustments, so in the resulting program, the method C.test returns 42.





to:
The method B.main() returns 23. Pushing down A.m() into B just moves the method without any adjustments, so in the resulting program, the method B.main() returns 42.


Added lines 66-152:


(:table  width=100% :)
(:cellnr:)
!!! Source
(:cell:)
!!! Target
(:cellnr:)
[@ 
public class A {

  public int k(long i){

    return 23;

  }

}

public class B extends A {

  public int m(){

    return k(2);

  }

}

public class C extends B {

  public int main(){

    return m();

  }

  public int k(int i){

    return 42;

  }

}
@]
(:cell:)
[@ 
public class A {

  public int k(long i){

    return 23;

  }

}

public class B extends A {

}

public class C extends B {

  public int main(){

    return m();

  }

  public int k(int i){

    return 42;

  }

public int m() {

    return Name_0(2);

  }

}
@]
(:tableend:)


The method C.main() returns 23. Pushing down B.m() into C just moves the method without any adjustments, so in the resulting program, the method C.main() returns 42.
04-10-2009 00:54 by gustavo -
Changed line 61 from:
to:
The method B.main() returns 23. Pushing down A.m() into B just moves the method without any adjustments, so in the resulting program, the method C.test returns 42.
04-10-2009 00:52 by gustavo -
Added lines 3-4:

Added lines 6-7:

04-10-2009 00:51 by gustavo -
Deleted lines 37-40:

public int m() {
return k(2);
}
Added lines 46-49:
}

public int m() {
return k(2);
04-10-2009 00:50 by gustavo -
Changed lines 5-9 from:
|| border=0
|| cell 1      ||
cell 2  ||

to:
(:table  width=100% :)
(:cellnr:)
!!! Source
(:cell:)
!!! Target
(:cellnr:)
Added lines 32-58:
(:cell:)
[@ 
public class A {
public int k(long i) {
return 23;
}

public int m() {
return k(2);
}
}
public class B extends A {
public int k(int i) {
return 42;
}

public int main() {
return m();
}

}
@]
(:tableend:)



04-10-2009 00:40 by gustavo -
Added lines 4-8:

|| border=0
|| cell 1      ||
cell 2  ||

04-10-2009 00:33 by gustavo -
Changed line 5 from:
[@  background-color:#ffffcc"
to:
[@ 
Changed lines 7-12 from:
 public int k(long i) {return 23;}
 public int m() {return k(2);}
}
public class B extends A {
public int k(int i) {
return 42
;
to:
public int k(long i) {
return 23;
Added lines 10-19:

public int m() {
return k(2);
}
}
public class B extends A {
public int k(int i) {
return 42;
}

04-10-2009 00:31 by gustavo -
Changed lines 5-24 from:
(:div class="green" style="font-style:italic; border:0px solid blue; background-color:#ffffcc":)

public class A {

->public int k(long i) {return 23;}

->public int m() {return k(2);}

->}

public class B extends A {
 public int k(int i) { return 42;}
 public int main() {
  return m();
 }
}

(:divend:)

[@
to:
[@  background-color:#ffffcc"
04-10-2009 00:08 by gustavo -
Added lines 23-39:

[@
public class A {
 public int k(long i) {return 23;}
 public int m() {return k(2);}
}
public class B extends A {
public int k(int i) {
return 42;
}
public int main() {
return m();
}

}
@]

03-10-2009 22:10 by gustavo -
Changed lines 7-9 from:
public class A {\\
->public int k(long i) {return 23;}\\
->public int m() {return k(2);}\\
to:
public class A {

->public int k(long i) {return 23;}

->public int m() {return k(2);}
03-10-2009 22:10 by gustavo -
Changed lines 7-11 from:
public class A {

  public int
k(long i) {return 23;}
     public int m() {return k(2);}
 }
to:
public class A {\\
->public int
k(long i) {return 23;}\\
->public int m() {return k
(2);}\\
->
}
03-10-2009 22:05 by gustavo -
Added line 8:
03-10-2009 22:05 by gustavo -
Changed lines 7-8 from:
public class A {\\
    ---- public int k(long i) {return 23;}\\
to:
public class A {
  public int k(long i) {return 23;}
03-10-2009 22:01 by gustavo -
Changed line 8 from:
     public int k(long i) {return 23;}\\
to:
   ---- public int k(long i) {return 23;}\\
03-10-2009 22:00 by gustavo -
Changed lines 8-9 from:
  public int k(long i) {return 23;}
  public int m() {return k(2);}
to:
     public int k(long i) {return 23;}\\
 
  public int m() {return k(2);}
03-10-2009 22:00 by gustavo -
Changed line 7 from:
 public class A {\\
to:
public class A {\\
03-10-2009 21:59 by gustavo -
Changed line 7 from:
 public class A {
to:
 public class A {\\
03-10-2009 21:56 by gustavo -
Changed lines 7-10 from:
public class A {
 public int k(long i) {return 23;}
 public int m() {return k(2);}
}
to:
 public class A {
  public int k(long i) {return 23;}
  public int m() {return k(2);}
 }
03-10-2009 21:51 by gustavo -
Changed lines 5-6 from:
(:div class="green" style="font-style:italic; border:1px solid blue; background-color:#ffffcc":)
to:
(:div class="green" style="font-style:italic; border:0px solid blue; background-color:#ffffcc":)
Changed lines 13-14 from:
 public int k(int i) { return 42;}
to:
 public int k(int i) { return 42;}
03-10-2009 21:50 by gustavo -
Added line 11:
Changed lines 13-19 from:
public int k(int i) {
return 42;
}
public int main() {
return m();
}
to:
 public int k(int i) { return 42;}

 
public int main() {
  return
m();
 }
03-10-2009 21:49 by gustavo -
Changed lines 6-12 from:
Everything after the above line is
styled with green italic text,

This includes
 
  preformatted text
* lists
-> indented items
to:

public class A {
 public int k(long i) {return 23;}
 public int m() {return k(2);}
}
public class B extends A {
public int k(int i) {
return 42;
}
public int main() {
return m();
}

}

03-10-2009 21:47 by gustavo -
Changed lines 5-6 from:
(:table class="green" style="font-style:italic; border:1px solid blue; background-color:#ffffcc":)
(:cellnr
:)
to:
(:div class="green" style="font-style:italic; border:1px solid blue; background-color:#ffffcc":)
Changed lines 13-14 from:
(:tableend:)
to:
(:divend:)
03-10-2009 21:46 by gustavo -
Changed lines 5-8 from:
%p bgcolor=#ffeeee% The wikistyle specification at the beginning of this
line applies to the entire paragraph, even if there are %blue% other
wikistyle specifications %% in the middle of the paragraph.

to:
(:table class="green" style="font-style:italic; border:1px solid blue; background-color:#ffffcc":)
(:cellnr:)
Everything after the above line is
styled with green italic text,

This includes
 
  preformatted text
* lists
-> indented items
(:tableend:)
03-10-2009 21:41 by gustavo -
Changed lines 5-28 from:
(:table class="green"
style="font-style:italic; border:1px
solid blue; background-color:#ffffcc":)
(:cellnr:)
Everything after the above line is
styled with green italic text,

This includes
    preformatted text
* lists
-> indented items
(:tableend:)


||class="green"
style="font-style:italic; border:1px
solid blue; background-color:#ffffcc"
||Everything after the above line is
styled with green italic text, ||
|| ||
||This includes ||
||    preformatted text ||
||* lists ||
||-> indented items ||
to:
%p bgcolor=#ffeeee% The wikistyle specification at the beginning of this
line applies to the entire paragraph, even if there are %blue% other
wikistyle specifications %% in the middle of the paragraph.
03-10-2009 21:41 by gustavo -
03-10-2009 21:41 by gustavo -
Changed lines 5-6 from:
>>blue font-style:italic
bgcolor
=#ffffcc<<
to:
(:table class="green"
style="font-style:italic; border:1px
solid blue; background-color:
#ffffcc":)
(:cellnr:)
Changed lines 10-11 from:
styled with blue italic text,
to:
styled with green italic text,
Changed lines 16-30 from:
>><<
to:
(:tableend:)


||class="green"
style="font-style:italic; border:1px
solid blue; background-color:#ffffcc"
||Everything after the above line is
styled with green italic text, ||
|| ||
||This includes ||
||    preformatted text ||
||* lists ||
||-
> indented items ||

03-10-2009 21:39 by gustavo -
Added lines 4-15:

>>blue font-style:italic
bgcolor=#ffffcc<<
Everything after the above line is
styled with blue italic text,

This includes
    preformatted text
* lists
-> indented items
>><<

03-10-2009 21:27 by gustavo -
Added lines 1-9:
!! Push Down Method

# Push Down Method Leads to Undiagnosed Shadowing of a Method:

# Push Down Method Leads to Undiagnosed Shadowing of a Method (ii):

# Incorrect handling of super accesses:

# Push Down Method Leads to  change the method invoked with super accesses to a method with different signature

Menu * Main * Members * Awards * Publications * Tools * Thesis * Internal Links * Contact

Blix theme adapted by David Gilbert, powered by PmWiki