View | Details | Raw Unified | Return to bug 70135 | Differences between
and this patch

Collapse All | Expand All

(-)resources/ChangeSignature/canModify/A_test15_out.java (+6 lines)
Lines 5-8 Link Here
5
	private void foo(){
5
	private void foo(){
6
		m(true, 2);
6
		m(true, 2);
7
	}
7
	}
8
	/**
9
	 * @deprecated use instead m(boolean b, int i)
10
	 */
11
	private void m(int i, boolean b) {
12
		m(b, i);
13
	}
8
}
14
}
(-)resources/ChangeSignature/canModify/A_test16_out.java (+13 lines)
Lines 5-14 Link Here
5
	private void foo(){
5
	private void foo(){
6
		m(true, 2);
6
		m(true, 2);
7
	}
7
	}
8
	/**
9
	 * @deprecated use instead m(boolean b, int i)
10
	 */
11
	protected void m(int i, boolean b) {
12
		m(b, i);
13
	}
8
}
14
}
9
class B extends A{
15
class B extends A{
10
	protected void m(boolean b, int j){
16
	protected void m(boolean b, int j){
11
		m(false, 6);
17
		m(false, 6);
12
		super.m(true, 4);
18
		super.m(true, 4);
19
	}
20
21
	/**
22
	 * @deprecated use instead m(boolean b, int j)
23
	 */
24
	protected void m(int j, boolean b) {
25
		m(b, j);
13
	}
26
	}
14
}
27
}
(-)resources/ChangeSignature/canModify/A_test17_out.java (+18 lines)
Lines 6-18 Link Here
6
	private void foo(){
6
	private void foo(){
7
		m(true, 2);
7
		m(true, 2);
8
	}
8
	}
9
	/**
10
	 * @deprecated use instead m(boolean b, int i)
11
	 */
12
	public void m(int i, boolean b) {
13
		m(b, i);
14
	}
9
}
15
}
10
class B extends A1{
16
class B extends A1{
11
	public void m(boolean b, int j){
17
	public void m(boolean b, int j){
12
		m(false, 6);
18
		m(false, 6);
13
		super.m(true, 4);
19
		super.m(true, 4);
14
	}
20
	}
21
22
	/**
23
	 * @deprecated use instead m(boolean b, int j)
24
	 */
25
	public void m(int j, boolean b) {
26
		m(b, j);
27
	}
15
}
28
}
16
interface A {
29
interface A {
17
	public void m(boolean b, int i);
30
	public void m(boolean b, int i);
31
32
	/**
33
	 * @deprecated use instead m(boolean b, int i)
34
	 */
35
	public void m(int i, boolean b);
18
}
36
}
(-)resources/ChangeSignature/canModify/A_test18_out.java (+23 lines)
Lines 6-21 Link Here
6
	private void foo(){
6
	private void foo(){
7
		m(true, 2);
7
		m(true, 2);
8
	}
8
	}
9
	/**
10
	 * @deprecated use instead m(boolean b, int i)
11
	 */
12
	public void m(int i, boolean b) {
13
		m(b, i);
14
	}
9
}
15
}
10
class B extends A1 implements AA{
16
class B extends A1 implements AA{
11
	public void m(boolean b, int j){
17
	public void m(boolean b, int j){
12
		m(false, 6);
18
		m(false, 6);
13
		super.m(true, 4);
19
		super.m(true, 4);
14
	}
20
	}
21
22
	/**
23
	 * @deprecated use instead m(boolean b, int j)
24
	 */
25
	public void m(int j, boolean b) {
26
		m(b, j);
27
	}
15
}
28
}
16
interface A {
29
interface A {
17
	public void m(boolean b, int i);
30
	public void m(boolean b, int i);
31
32
	/**
33
	 * @deprecated use instead m(boolean b, int i)
34
	 */
35
	public void m(int i, boolean b);
18
}
36
}
19
interface AA {
37
interface AA {
20
	public void m(boolean yyy, int xxx);
38
	public void m(boolean yyy, int xxx);
39
40
	/**
41
	 * @deprecated use instead m(boolean yyy, int xxx)
42
	 */
43
	public void m(int xxx, boolean yyy);
21
}
44
}
(-)resources/ChangeSignature/canModify/A_test19_in.java (-1 / +1 lines)
Lines 2-5 Link Here
2
2
3
class A {
3
class A {
4
	public void m(int i, final boolean b){}
4
	public void m(int i, final boolean b){}
5
}
5
}
(-)resources/ChangeSignature/canModify/A_test19_out.java (-1 / +8 lines)
Lines 2-5 Link Here
2
2
3
class A {
3
class A {
4
	public void m(final boolean b, int i){}
4
	public void m(final boolean b, int i){}
5
}
5
6
	/**
7
	 * @deprecated use instead m(boolean b, int i)
8
	 */
9
	public void m(int i, final boolean b) {
10
		m(b, i);
11
	}
12
}
(-)resources/ChangeSignature/canModify/A_test20_out.java (+7 lines)
Lines 2-5 Link Here
2
2
3
class A {
3
class A {
4
	void m(int b[], int a){}
4
	void m(int b[], int a){}
5
6
	/**
7
	 * @deprecated use instead m(int[] b, int a)
8
	 */
9
	void m(int a, int b[]) {
10
		m(b, a);
11
	}
5
}
12
}
(-)resources/ChangeSignature/canModify/A_test27_out.java (+7 lines)
Lines 13-18 Link Here
13
		PoolMessageEvent( String msg, Object xml, int id, Object newParam ) {
13
		PoolMessageEvent( String msg, Object xml, int id, Object newParam ) {
14
			//empty
14
			//empty
15
		}
15
		}
16
17
		/**
18
		 * @deprecated use instead PoolMessageEvent(String msg, Object xml, int id, Object newParam)
19
		 */
20
		PoolMessageEvent(String msg, Object xml, int id) {
21
			this(msg, xml, id, null);
22
		}
16
	}
23
	}
17
}
24
}
18
25
(-)resources/ChangeSignature/canModify/A_testAdd28_out.java (+7 lines)
Lines 2-5 Link Here
2
class A{
2
class A{
3
	private void m(int i, int x){
3
	private void m(int i, int x){
4
	}
4
	}
5
6
	/**
7
	 * @deprecated use instead m(int i, int x)
8
	 */
9
	private void m(int i) {
10
		m(i, 0);
11
	}
5
}
12
}
(-)resources/ChangeSignature/canModify/A_testAdd29_out.java (+7 lines)
Lines 2-5 Link Here
2
class A{
2
class A{
3
	private void m(int x, int i){
3
	private void m(int x, int i){
4
	}
4
	}
5
6
	/**
7
	 * @deprecated use instead m(int x, int i)
8
	 */
9
	private void m(int i) {
10
		m(0, i);
11
	}
5
}
12
}
(-)resources/ChangeSignature/canModify/A_testAdd30_out.java (+7 lines)
Lines 3-6 Link Here
3
	private void m(int i, int x){
3
	private void m(int i, int x){
4
		m(i, x);
4
		m(i, x);
5
	}
5
	}
6
7
	/**
8
	 * @deprecated use instead m(int i, int x)
9
	 */
10
	private void m(int i) {
11
		m(i, 0);
12
	}
6
}
13
}
(-)resources/ChangeSignature/canModify/A_testAdd31_out.java (+14 lines)
Lines 3-13 Link Here
3
	void m(int i, int x){
3
	void m(int i, int x){
4
		m(i, x);
4
		m(i, x);
5
	}
5
	}
6
7
	/**
8
	 * @deprecated use instead m(int i, int x)
9
	 */
10
	void m(int i) {
11
		m(i, 0);
12
	}
6
}
13
}
7
class B extends A{
14
class B extends A{
8
	void m(int j, int x){
15
	void m(int j, int x){
9
		super.m(j, x);
16
		super.m(j, x);
10
		this.m(j, x);
17
		this.m(j, x);
11
		m(j, x);
18
		m(j, x);
19
	}
20
21
	/**
22
	 * @deprecated use instead m(int j, int x)
23
	 */
24
	void m(int j) {
25
		m(j, 0);
12
	}
26
	}
13
}
27
}
(-)resources/ChangeSignature/canModify/A_testAdd32_out.java (+7 lines)
Lines 3-6 Link Here
3
	private void m(int x, int i){
3
	private void m(int x, int i){
4
		m(x, i);
4
		m(x, i);
5
	}
5
	}
6
7
	/**
8
	 * @deprecated use instead m(int x, int i)
9
	 */
10
	private void m(int i) {
11
		m(0, i);
12
	}
6
}
13
}
(-)resources/ChangeSignature/canModify/A_testAdd33_out.java (+7 lines)
Lines 3-6 Link Here
3
	private void m(int x){
3
	private void m(int x){
4
		m(x);
4
		m(x);
5
	}
5
	}
6
7
	/**
8
	 * @deprecated use instead m(int x)
9
	 */
10
	private void m() {
11
		m(0);
12
	}
6
}
13
}
(-)resources/ChangeSignature/canModify/A_testAddRecursive1_out.java (+48 lines)
Lines 3-26 Link Here
3
class A {
3
class A {
4
	int i;
4
	int i;
5
	void m(int i, boolean bool) {this.i = i;}
5
	void m(int i, boolean bool) {this.i = i;}
6
	/**
7
	 * @deprecated use instead m(int i, boolean bool)
8
	 */
9
	void m(int i) {
10
		m(i, true);
11
	}
6
}
12
}
7
class Super extends A {
13
class Super extends A {
8
	void m(int i, boolean bool) { super.m(1, bool); }
14
	void m(int i, boolean bool) { super.m(1, bool); }
15
16
	/**
17
	 * @deprecated use instead m(int i, boolean bool)
18
	 */
19
	void m(int i) {
20
		m(i, true);
21
	}
9
}
22
}
10
class Recursive extends A {
23
class Recursive extends A {
11
	void m(int i, boolean bool) { if (true) m(i, bool); }
24
	void m(int i, boolean bool) { if (true) m(i, bool); }
25
26
	/**
27
	 * @deprecated use instead m(int i, boolean bool)
28
	 */
29
	void m(int i) {
30
		m(i, true);
31
	}
12
}
32
}
13
class ThisRecursive extends A {
33
class ThisRecursive extends A {
14
	void m(int i, boolean bool) { this.m(i, bool); }
34
	void m(int i, boolean bool) { this.m(i, bool); }
35
36
	/**
37
	 * @deprecated use instead m(int i, boolean bool)
38
	 */
39
	void m(int i) {
40
		m(i, true);
41
	}
15
}
42
}
16
class AlmostRecursive extends A {
43
class AlmostRecursive extends A {
17
	void m(int i, boolean bool) { new A().m(i, true); }
44
	void m(int i, boolean bool) { new A().m(i, true); }
45
46
	/**
47
	 * @deprecated use instead m(int i, boolean bool)
48
	 */
49
	void m(int i) {
50
		m(i, true);
51
	}
18
}
52
}
19
class RecursiveOrNot extends A {
53
class RecursiveOrNot extends A {
20
	void m(int i, boolean bool) { new RecursiveOrNot().m(i, bool); }
54
	void m(int i, boolean bool) { new RecursiveOrNot().m(i, bool); }
55
56
	/**
57
	 * @deprecated use instead m(int i, boolean bool)
58
	 */
59
	void m(int i) {
60
		m(i, true);
61
	}
21
}
62
}
22
class NonRecursive extends A {
63
class NonRecursive extends A {
23
	void m(int i, boolean bool) { int k= i; }
64
	void m(int i, boolean bool) { int k= i; }
65
66
	/**
67
	 * @deprecated use instead m(int i, boolean bool)
68
	 */
69
	void m(int i) {
70
		m(i, true);
71
	}
24
}
72
}
25
class Calling extends A {
73
class Calling extends A {
26
	void bar() { m(17, true); }
74
	void bar() { m(17, true); }
(-)resources/ChangeSignature/canModify/A_testAddReorderRename34_out.java (+7 lines)
Lines 3-6 Link Here
3
	private int m(boolean jj, Object x, int i){
3
	private int m(boolean jj, Object x, int i){
4
		return m(false, x, m(jj, x, i));
4
		return m(false, x, m(jj, x, i));
5
	}
5
	}
6
7
	/**
8
	 * @deprecated use instead m(boolean j, Object x, int iii)
9
	 */
10
	private int m(int iii, boolean j) {
11
		return m(j, null, iii);
12
	}
6
}
13
}
(-)resources/ChangeSignature/canModify/A_testAll41_out.java (+7 lines)
Lines 3-6 Link Here
3
	void m(){
3
	void m(){
4
		m();
4
		m();
5
	}
5
	}
6
7
	/**
8
	 * @deprecated use instead m()
9
	 */
10
	void m(int i) {
11
		m();
12
	}
6
}
13
}
(-)resources/ChangeSignature/canModify/A_testAll43_out.java (+7 lines)
Lines 3-6 Link Here
3
	void m(int j){
3
	void m(int j){
4
		m(1);
4
		m(1);
5
	}
5
	}
6
7
	/**
8
	 * @deprecated use instead m(int j)
9
	 */
10
	void m(int i, int j) {
11
		m(j);
12
	}
6
}
13
}
(-)resources/ChangeSignature/canModify/A_testAll44_out.java (+7 lines)
Lines 3-6 Link Here
3
	boolean m(int j){
3
	boolean m(int j){
4
		m(1);
4
		m(1);
5
	}
5
	}
6
7
	/**
8
	 * @deprecated use instead m(int j)
9
	 */
10
	public void m(int i, int j) {
11
		m(j);
12
	}
6
}
13
}
(-)resources/ChangeSignature/canModify/A_testAll45_out.java (+7 lines)
Lines 3-6 Link Here
3
	void m(boolean j){
3
	void m(boolean j){
4
		m(1);
4
		m(1);
5
	}
5
	}
6
7
	/**
8
	 * @deprecated use instead m(boolean j)
9
	 */
10
	public void m(int i, int j) {
11
		m(j); // but what if the other direction - was value, now void?
12
	}
6
}
13
}
(-)resources/ChangeSignature/canModify/A_testEnum04_in.java (-1 / +1 lines)
Lines 15-18 Link Here
15
	{
15
	{
16
		A a= A.GREEN.getNext();
16
		A a= A.GREEN.getNext();
17
	}
17
	}
18
}
18
}
(-)resources/ChangeSignature/canModify/A_testEnum04_out.java (-1 / +1 lines)
Lines 15-18 Link Here
15
	{
15
	{
16
		A a= A.GREEN.getNext(true);
16
		A a= A.GREEN.getNext(true);
17
	}
17
	}
18
}
18
}
(-)resources/ChangeSignature/canModify/A_testGenerics01_out.java (+14 lines)
Lines 2-11 Link Here
2
2
3
class A<E> {
3
class A<E> {
4
	void m(E e, Integer integer) {}
4
	void m(E e, Integer integer) {}
5
6
	/**
7
	 * @deprecated use instead m(E e, Integer integer)
8
	 */
9
	public void m(Integer integer, E e) {
10
		m(e, integer);
11
	}
5
}
12
}
6
13
7
class Sub<Q> extends A<Q> {
14
class Sub<Q> extends A<Q> {
8
	void m(Q q, Integer integer) {
15
	void m(Q q, Integer integer) {
9
		super.m(q, integer);
16
		super.m(q, integer);
17
	}
18
19
	/**
20
	 * @deprecated use instead m(Q q, Integer integer)
21
	 */
22
	public void m(Integer integer, Q q) {
23
		m(q, integer);
10
	}
24
	}
11
}
25
}
(-)resources/ChangeSignature/canModify/A_testGenerics02_out.java (+14 lines)
Lines 5-12 Link Here
5
5
6
class A<E> {
6
class A<E> {
7
	<T> void m(E e, T t, List<HashMap> maps) {}
7
	<T> void m(E e, T t, List<HashMap> maps) {}
8
9
	/**
10
	 * @deprecated use instead m(E e, Integer integer, List<HashMap> maps)
11
	 */
12
	public void m(T t, E e) {
13
		m(e, t, null);
14
	}
8
}
15
}
9
16
10
class Sub<Q> extends A<Q> {
17
class Sub<Q> extends A<Q> {
11
	void m(Q q, Integer i, List<HashMap> maps) {}
18
	void m(Q q, Integer i, List<HashMap> maps) {}
19
20
	/**
21
	 * @deprecated use instead m(Q q, Integer integer, List<HashMap> maps)
22
	 */
23
	public void m(Integer i, Q q) {
24
		m(q, i, null);
25
	}
12
}
26
}
(-)resources/ChangeSignature/canModify/A_testName01_out.java (+7 lines)
Lines 4-9 Link Here
4
	void newName(String y){
4
	void newName(String y){
5
        newName(y);
5
        newName(y);
6
    }
6
    }
7
8
	/**
9
	 * @deprecated use instead newName(String y)
10
	 */
11
	void m(String y) {
12
		newName(y);
13
	}
7
}
14
}
8
15
9
class B {
16
class B {
(-)resources/ChangeSignature/canModify/A_testName02_out.java (+14 lines)
Lines 4-14 Link Here
4
	void newName(String y){
4
	void newName(String y){
5
        newName(y);
5
        newName(y);
6
    }
6
    }
7
8
	/**
9
	 * @deprecated use instead newName(String y)
10
	 */
11
	void m(String y) {
12
		newName(y);
13
	}
7
}
14
}
8
15
9
class B extends A {
16
class B extends A {
10
	public void newName(String q) {
17
	public void newName(String q) {
11
		new A().newName("x");
18
		new A().newName("x");
12
		return newName("k");
19
		return newName("k");
20
	}
21
22
	/**
23
	 * @deprecated use instead newName(String q)
24
	 */
25
	public void m(String q) {
26
		newName(q);
13
	}
27
	}
14
}
28
}
(-)resources/ChangeSignature/canModify/A_testRenameReorder26_in.java (+1 lines)
Lines 3-7 Link Here
3
class A{
3
class A{
4
	private void m(boolean y, int a){
4
	private void m(boolean y, int a){
5
        m(y, a);
5
        m(y, a);
6
        m(y, a);
6
    }
7
    }
7
}
8
}
(-)resources/ChangeSignature/canModify/A_testRenameReorder26_out.java (+9 lines)
Lines 3-7 Link Here
3
class A{
3
class A{
4
	private void m(int bb, boolean zzz){
4
	private void m(int bb, boolean zzz){
5
        m(bb, zzz);
5
        m(bb, zzz);
6
        m(bb, zzz);
6
    }
7
    }
8
9
	/**
10
	 * @deprecated use instead m(int a, boolean y)
11
	 */
12
	private void m(boolean y, int a) {
13
		m(y, a);
14
		m(y, a);
15
	}
7
}
16
}
(-)resources/ChangeSignature/canModify/A_testRenameReorder27_in.java (+1 lines)
Lines 3-7 Link Here
3
class A{
3
class A{
4
	private void m(boolean y, int a){
4
	private void m(boolean y, int a){
5
        m(y, a);
5
        m(y, a);
6
        m(y, a);
6
    }
7
    }
7
}
8
}
(-)resources/ChangeSignature/canModify/A_testRenameReorder27_out.java (-2 / +11 lines)
Lines 1-7 Link Here
1
package p;
1
package p;
2
2
3
class A{
3
class A{
4
	private void m(int a, boolean yyy){
4
	private void m(int y, boolean a){
5
        m(a, yyy);
5
        m(y, a);
6
        m(y, a);
6
    }
7
    }
8
9
	/**
10
	 * @deprecated use instead m(int a, boolean y)
11
	 */
12
	private void m(boolean y, int a) {
13
		m(y, a);
14
		m(y, a);
15
	}
7
}
16
}
(-)resources/ChangeSignature/canModify/A_testVararg02_out.java (+14 lines)
Lines 6-11 Link Here
6
			System.out.println(name);
6
			System.out.println(name);
7
		}
7
		}
8
	}
8
	}
9
10
	/**
11
	 * @deprecated use instead m(Object o, int i, String... names)
12
	 */
13
	public void m(int i, String... names) {
14
		m(new Object(), i, names);
15
	}
9
}
16
}
10
17
11
class B extends A {
18
class B extends A {
Lines 13-18 Link Here
13
		for (String name : names) {
20
		for (String name : names) {
14
			System.out.println(name);
21
			System.out.println(name);
15
		}
22
		}
23
	}
24
25
	/**
26
	 * @deprecated use instead m(Object o, int i, String... names)
27
	 */
28
	public void m(int i, String[] names) {
29
		m(new Object(), i, names);
16
	}
30
	}
17
}
31
}
18
32
(-)resources/ChangeSignature/canModify/A_testVararg05_out.java (+7 lines)
Lines 17-20 Link Here
17
		use(null);
17
		use(null);
18
		use(null);
18
		use(null);
19
	}
19
	}
20
21
	/**
22
	 * @deprecated use instead use(Object first)
23
	 */
24
	public void use(Object first, String... args) {
25
		use(first);
26
	}
20
}
27
}
(-)resources/ChangeSignature/canModify/A_testVararg07_out.java (+14 lines)
Lines 3-12 Link Here
3
class A {
3
class A {
4
	public void m(int i, String j, Integer k) {
4
	public void m(int i, String j, Integer k) {
5
	}
5
	}
6
7
	/**
8
	 * @deprecated use instead m(int i, String j, Integer k)
9
	 */
10
	public void m(int i, String[] names) {
11
		m(i, "none", 17);
12
	}
6
}
13
}
7
14
8
class B extends A {
15
class B extends A {
9
	public void m(int i, String j, Integer k) {
16
	public void m(int i, String j, Integer k) {
17
	}
18
19
	/**
20
	 * @deprecated use instead m(int i, String j, Integer k)
21
	 */
22
	public void m(int i, String... names) {
23
		m(i, "none", 17);
10
	}	
24
	}	
11
}
25
}
12
26
(-)test cases/org/eclipse/jdt/ui/tests/refactoring/ChangeSignatureTests.java (-50 / +206 lines)
Lines 1-15 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Common Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/cpl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.ui.tests.refactoring;
11
package org.eclipse.jdt.ui.tests.refactoring;
12
12
13
import java.io.IOException;
13
import java.util.ArrayList;
14
import java.util.ArrayList;
14
import java.util.Arrays;
15
import java.util.Arrays;
15
import java.util.Iterator;
16
import java.util.Iterator;
Lines 27-32 Link Here
27
import org.eclipse.jdt.core.IMethod;
28
import org.eclipse.jdt.core.IMethod;
28
import org.eclipse.jdt.core.IPackageFragment;
29
import org.eclipse.jdt.core.IPackageFragment;
29
import org.eclipse.jdt.core.IType;
30
import org.eclipse.jdt.core.IType;
31
import org.eclipse.jdt.core.JavaModelException;
30
import org.eclipse.jdt.core.dom.Modifier;
32
import org.eclipse.jdt.core.dom.Modifier;
31
33
32
import org.eclipse.jdt.internal.corext.refactoring.ExceptionInfo;
34
import org.eclipse.jdt.internal.corext.refactoring.ExceptionInfo;
Lines 79-94 Link Here
79
		return fileName + ".java"; 
81
		return fileName + ".java"; 
80
	}
82
	}
81
	
83
	
82
	private String getTestFileName(boolean canReorder, boolean input){
84
	private String getTestFileName(boolean canReorder, boolean input, boolean leaveStub){
83
		String fileName= TEST_PATH_PREFIX + getRefactoringPath();
85
		String fileName= TEST_PATH_PREFIX + getRefactoringPath();
84
		fileName += (canReorder ? "canModify/": "cannotModify/");
86
		fileName += (canReorder ? "canModify/": "cannotModify/");
85
		return fileName + getSimpleTestFileName(canReorder, input);
87
		return fileName + getSimpleTestFileName(canReorder, input);
86
	}
88
	}
87
		
89
		
88
	//---helpers 
90
	//---helpers 
89
	
91
90
	protected ICompilationUnit createCUfromTestFile(IPackageFragment pack, boolean canRename, boolean input) throws Exception {
92
	protected ICompilationUnit createCUfromTestFile(IPackageFragment pack, boolean canRename, boolean input) throws Exception {
91
		return createCU(pack, getSimpleTestFileName(canRename, input), getFileContents(getTestFileName(canRename, input)));
93
		return createCUfromTestFile(pack, canRename, input, false);
94
	}
95
96
	protected ICompilationUnit createCUfromTestFile(IPackageFragment pack, boolean canRename, boolean input, boolean leaveStub) throws Exception {
97
		return createCU(pack, getSimpleTestFileName(canRename, input), getFileContents(getTestFileName(canRename, input, leaveStub)));
92
	}
98
	}
93
99
94
	private static ParameterInfo[] createNewParamInfos(String[] newTypes, String[] newNames, String[] newDefaultValues) {
100
	private static ParameterInfo[] createNewParamInfos(String[] newTypes, String[] newNames, String[] newDefaultValues) {
Lines 111-124 Link Here
111
			list.add(newIndices[i], newParamInfos[i]);
117
			list.add(newIndices[i], newParamInfos[i]);
112
		}
118
		}
113
	}
119
	}
114
		
120
	
115
	private void helperAdd(String[] signature, ParameterInfo[] newParamInfos, int[] newIndices) throws Exception {
121
	private void helperAdd(String[] signature, ParameterInfo[] newParamInfo, int[] newIndices) throws Exception {
122
		helperAdd(signature, newParamInfo, newIndices, false, true);
123
	}		
124
	
125
	private void helperAdd(String[] signature, ParameterInfo[] newParamInfo, int[] newIndices, boolean leaveStub) throws Exception {
126
		helperAdd(signature, newParamInfo, newIndices, leaveStub, true);
127
	}
128
129
	private void helperAdd(String[] signature, ParameterInfo[] newParamInfos, int[] newIndices, boolean leaveStub, boolean propogateChanges) throws Exception {
116
		ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true);
130
		ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true);
117
		IType classA= getType(cu, "A");
131
		IType classA= getType(cu, "A");
118
		IMethod method = classA.getMethod("m", signature);
132
		IMethod method = classA.getMethod("m", signature);
119
		assertTrue("method does not exist", method.exists());
133
		assertTrue("method does not exist", method.exists());
120
		ChangeSignatureRefactoring ref= ChangeSignatureRefactoring.create(method);
134
		ChangeSignatureRefactoring ref= ChangeSignatureRefactoring.create(method);
121
		addInfos(ref.getParameterInfos(), newParamInfos, newIndices);
135
		addInfos(ref.getParameterInfos(), newParamInfos, newIndices);
136
		ref.setLeaveStub(leaveStub);
137
		ref.setTagAsDeprecated(propogateChanges);
138
		ref.setUpdateReferences(propogateChanges);
122
		RefactoringStatus result= performRefactoring(ref);
139
		RefactoringStatus result= performRefactoring(ref);
123
		assertEquals("precondition was supposed to pass", null, result);
140
		assertEquals("precondition was supposed to pass", null, result);
124
		
141
		
Lines 126-144 Link Here
126
		String newCuName= getSimpleTestFileName(true, true);
143
		String newCuName= getSimpleTestFileName(true, true);
127
		ICompilationUnit newcu= pack.getCompilationUnit(newCuName);
144
		ICompilationUnit newcu= pack.getCompilationUnit(newCuName);
128
		assertTrue(newCuName + " does not exist", newcu.exists());
145
		assertTrue(newCuName + " does not exist", newcu.exists());
129
		String expectedFileContents= getFileContents(getTestFileName(true, false));
146
		String expectedFileContents= getFileContents(getTestFileName(true, false, false));
130
		assertEqualLines("invalid renaming", expectedFileContents, newcu.getSource());
147
		assertEqualLines("invalid renaming", expectedFileContents, newcu.getSource());
131
	}
148
	}
132
	
149
	
133
	/*
150
	/*
134
	 * Rename method 'A.m(signature)' to 'A.newMethodName(signature)'
151
	 * Rename method 'A.m(signature)' to 'A.newMethodName(signature)'
135
	 */
152
	 */
136
	private void helperRenameMethod(String[] signature, String newMethodName) throws Exception {
153
	private void helperRenameMethod(String[] signature, String newMethodName, boolean leaveStub) throws Exception {
137
		ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true);
154
		ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true);
138
		IType classA= getType(cu, "A");
155
		IType classA= getType(cu, "A");
139
		IMethod method = classA.getMethod("m", signature);
156
		IMethod method = classA.getMethod("m", signature);
140
		assertTrue("method m does not exist in A", method.exists());
157
		assertTrue("method m does not exist in A", method.exists());
141
		ChangeSignatureRefactoring ref= ChangeSignatureRefactoring.create(method);
158
		ChangeSignatureRefactoring ref= ChangeSignatureRefactoring.create(method);
159
		ref.setLeaveStub(leaveStub);
142
		ref.setNewMethodName(newMethodName);
160
		ref.setNewMethodName(newMethodName);
143
		RefactoringStatus result= performRefactoring(ref);
161
		RefactoringStatus result= performRefactoring(ref);
144
		assertEquals("precondition was supposed to pass", null, result);
162
		assertEquals("precondition was supposed to pass", null, result);
Lines 147-157 Link Here
147
		String newCuName= getSimpleTestFileName(true, true);
165
		String newCuName= getSimpleTestFileName(true, true);
148
		ICompilationUnit newcu= pack.getCompilationUnit(newCuName);
166
		ICompilationUnit newcu= pack.getCompilationUnit(newCuName);
149
		assertTrue(newCuName + " does not exist", newcu.exists());
167
		assertTrue(newCuName + " does not exist", newcu.exists());
150
		String expectedFileContents= getFileContents(getTestFileName(true, false));
168
		String expectedFileContents= getFileContents(getTestFileName(true, false, false));
151
		assertEqualLines("invalid change of method name", expectedFileContents, newcu.getSource());
169
		assertEqualLines("invalid change of method name", expectedFileContents, newcu.getSource());
152
	}
170
	}
153
171
154
	private void helperDoAll(String typeName, 
172
	private void helperDoAll(String typeName, 
173
			String methodName, 
174
		  	String[] signature, 
175
		  	ParameterInfo[] newParamInfos, 
176
		  	int[] newIndices, 
177
		  	String[] oldParamNames, 
178
		  	String[] newParamNames, 
179
		  	String[] newParameterTypeNames, 
180
		  	int[] permutation,
181
		  	int newVisibility,
182
		  	int[] deleted, String returnTypeName) throws Exception {
183
		helperDoAll( typeName, 
184
				methodName, 
185
			  	signature, 
186
			  	newParamInfos, 
187
			  	newIndices, 
188
			  	oldParamNames, 
189
			  	newParamNames, 
190
			  	newParameterTypeNames, 
191
			  	permutation,
192
			  	newVisibility,
193
			  	deleted, returnTypeName, false, false, true);
194
	}
195
	
196
	private void helperDoAll(String typeName, 
155
								String methodName, 
197
								String methodName, 
156
							  	String[] signature, 
198
							  	String[] signature, 
157
							  	ParameterInfo[] newParamInfos, 
199
							  	ParameterInfo[] newParamInfos, 
Lines 161-168 Link Here
161
							  	String[] newParameterTypeNames, 
203
							  	String[] newParameterTypeNames, 
162
							  	int[] permutation,
204
							  	int[] permutation,
163
							  	int newVisibility,
205
							  	int newVisibility,
164
							  	int[] deleted, String returnTypeName)  throws Exception{
206
							  	int[] deleted, String returnTypeName,
165
		ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true);
207
							  	boolean leaveStub, 
208
							  	boolean leaveBody, boolean updateReferences)  throws Exception{
209
		ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true, leaveStub);
166
		IType classA= getType(cu, typeName);
210
		IType classA= getType(cu, typeName);
167
		IMethod method = classA.getMethod(methodName, signature);
211
		IMethod method = classA.getMethod(methodName, signature);
168
		assertTrue("method " + methodName +" does not exist", method.exists());
212
		assertTrue("method " + methodName +" does not exist", method.exists());
Lines 173-178 Link Here
173
		modifyInfos(ref.getParameterInfos(), newParamInfos, newIndices, oldParamNames, newParamNames, newParameterTypeNames, permutation);
217
		modifyInfos(ref.getParameterInfos(), newParamInfos, newIndices, oldParamNames, newParamNames, newParameterTypeNames, permutation);
174
		if (newVisibility != JdtFlags.VISIBILITY_CODE_INVALID)
218
		if (newVisibility != JdtFlags.VISIBILITY_CODE_INVALID)
175
			ref.setVisibility(newVisibility);
219
			ref.setVisibility(newVisibility);
220
		ref.setLeaveStub(leaveStub);
221
		ref.setLeaveBody(leaveBody);
222
		ref.setUpdateReferences(updateReferences);
223
		ref.setTagAsDeprecated(updateReferences);
176
		RefactoringStatus result= performRefactoring(ref);
224
		RefactoringStatus result= performRefactoring(ref);
177
		assertEquals("precondition was supposed to pass", null, result);
225
		assertEquals("precondition was supposed to pass", null, result);
178
		
226
		
Lines 180-186 Link Here
180
		String newCuName= getSimpleTestFileName(true, true);
228
		String newCuName= getSimpleTestFileName(true, true);
181
		ICompilationUnit newcu= pack.getCompilationUnit(newCuName);
229
		ICompilationUnit newcu= pack.getCompilationUnit(newCuName);
182
		assertTrue(newCuName + " does not exist", newcu.exists());
230
		assertTrue(newCuName + " does not exist", newcu.exists());
183
		String expectedFileContents= getFileContents(getTestFileName(true, false));
231
		String expectedFileContents= getFileContents(getTestFileName(true, false, leaveStub));
184
		assertEqualLines(expectedFileContents, newcu.getSource());
232
		assertEqualLines(expectedFileContents, newcu.getSource());
185
	}
233
	}
186
	
234
	
Lines 197-217 Link Here
197
	}
245
	}
198
	
246
	
199
	private void helper1(String[] newOrder, String[] signature, String[] oldNames, String[] newNames) throws Exception{
247
	private void helper1(String[] newOrder, String[] signature, String[] oldNames, String[] newNames) throws Exception{
248
		helper1(newOrder, signature, oldNames, newNames, false);
249
	}
250
251
	private void helper1(String[] newOrder, String[] signature, String[] oldNames, String[] newNames, boolean leaveStub) throws Exception, JavaModelException, IOException {
252
		helper1(newOrder, signature, oldNames, newNames, leaveStub, false);
253
	}
254
	
255
	private void helper1(String[] newOrder, String[] signature, String[] oldNames, String[] newNames, boolean leaveStub, boolean leaveBody) throws Exception, JavaModelException, IOException {
200
		ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true);
256
		ICompilationUnit cu= createCUfromTestFile(getPackageP(), true, true);
201
		IType classA= getType(cu, "A");
257
		IType classA= getType(cu, "A");
202
		IMethod method = classA.getMethod("m", signature);
258
		IMethod method = classA.getMethod("m", signature);
203
		assertTrue("method does not exist", method.exists());
259
		assertTrue("method must exist", method.exists());
204
		ChangeSignatureRefactoring ref= ChangeSignatureRefactoring.create(method);
260
		ChangeSignatureRefactoring ref= ChangeSignatureRefactoring.create(method);
205
		modifyInfos(ref.getParameterInfos(), newOrder, oldNames, newNames);
261
		modifyInfos(ref.getParameterInfos(), newOrder, oldNames, newNames);
262
		ref.setLeaveStub(leaveStub);
263
		ref.setLeaveBody(leaveBody);
206
		RefactoringStatus result= performRefactoring(ref);
264
		RefactoringStatus result= performRefactoring(ref);
207
		assertEquals("precondition was supposed to pass", null, result);
265
		assertEquals("precondition was supposed to pass", null, result);
208
		
209
		IPackageFragment pack= (IPackageFragment)cu.getParent();
266
		IPackageFragment pack= (IPackageFragment)cu.getParent();
210
		String newCuName= getSimpleTestFileName(true, true);
267
		String newCuName= getSimpleTestFileName(true, true);
211
		ICompilationUnit newcu= pack.getCompilationUnit(newCuName);
268
		ICompilationUnit newcu= pack.getCompilationUnit(newCuName);
212
		assertTrue(newCuName + " does not exist", newcu.exists());
269
		assertTrue(newCuName + " does not exist", newcu.exists());
213
		String expectedFileContents= getFileContents(getTestFileName(true, false));
270
		String expectedFileContents= getFileContents(getTestFileName(true, false, leaveStub));
214
//		assertEquals("invalid renaming", expectedFileContents, newcu.getSource());
271
		//		assertEquals("invalid renaming", expectedFileContents, newcu.getSource());
215
		assertEqualLines(expectedFileContents, newcu.getSource());
272
		assertEqualLines(expectedFileContents, newcu.getSource());
216
	}
273
	}
217
274
Lines 377-383 Link Here
377
		String newCuName= getSimpleTestFileName(true, true);
434
		String newCuName= getSimpleTestFileName(true, true);
378
		ICompilationUnit newcu= pack.getCompilationUnit(newCuName);
435
		ICompilationUnit newcu= pack.getCompilationUnit(newCuName);
379
		assertTrue(newCuName + " does not exist", newcu.exists());
436
		assertTrue(newCuName + " does not exist", newcu.exists());
380
		String expectedFileContents= getFileContents(getTestFileName(true, false));
437
		String expectedFileContents= getFileContents(getTestFileName(true, false, false));
381
		assertEqualLines(expectedFileContents, newcu.getSource());
438
		assertEqualLines(expectedFileContents, newcu.getSource());
382
	}
439
	}
383
440
Lines 404-410 Link Here
404
		String newCuName= getSimpleTestFileName(true, true);
461
		String newCuName= getSimpleTestFileName(true, true);
405
		ICompilationUnit newcu= pack.getCompilationUnit(newCuName);
462
		ICompilationUnit newcu= pack.getCompilationUnit(newCuName);
406
		assertTrue(newCuName + " does not exist", newcu.exists());
463
		assertTrue(newCuName + " does not exist", newcu.exists());
407
		String expectedFileContents= getFileContents(getTestFileName(true, false));
464
		String expectedFileContents= getFileContents(getTestFileName(true, false, false));
408
		assertEqualLines("invalid renaming", expectedFileContents, newcu.getSource());
465
		assertEqualLines("invalid renaming", expectedFileContents, newcu.getSource());
409
	}
466
	}
410
	
467
	
Lines 710-739 Link Here
710
	}
767
	}
711
	
768
	
712
	public void test15() throws Exception{
769
	public void test15() throws Exception{
713
		helper1(new String[]{"b", "i"}, new String[]{"I", "Z"});
770
		//helper1(new String[]{"b", "i"}, new String[]{"I", "Z"});
771
		helper1(new String[]{"b", "i"}, new String[]{"I", "Z"},null,null,true);
714
	}
772
	}
715
	
773
	
716
	public void test16() throws Exception{
774
	public void test16() throws Exception{
717
		helper1(new String[]{"b", "i"}, new String[]{"I", "Z"});
775
		helper1(new String[]{"b", "i"}, new String[]{"I", "Z"},null,null,true);
718
	}
776
	}
719
	
777
	
720
	public void test17() throws Exception{
778
	public void test17() throws Exception{
721
		//exception because of bug 11151
779
		//exception because of bug 11151
722
		helper1(new String[]{"b", "i"}, new String[]{"I", "Z"});
780
		//helper1(new String[]{"b", "i"}, new String[]{"I", "Z"});
781
		helper1(new String[]{"b", "i"}, new String[]{"I", "Z"},null,null,true);
723
	}
782
	}
724
	
783
	
725
	public void test18() throws Exception{
784
	public void test18() throws Exception{
726
		//exception because of bug 11151
785
		//exception because of bug 11151
727
		helper1(new String[]{"b", "i"}, new String[]{"I", "Z"});
786
		//helper1(new String[]{"b", "i"}, new String[]{"I", "Z"});
787
		helper1(new String[]{"b", "i"}, new String[]{"I", "Z"},null,null,true);
728
	}
788
	}
729
	
789
	
730
	public void test19() throws Exception{
790
	public void test19() throws Exception{
731
//		printTestDisabledMessage("bug 7274 - reorder parameters: incorrect when parameters have more than 1 modifiers");
791
//		printTestDisabledMessage("bug 7274 - reorder parameters: incorrect when parameters have more than 1 modifiers");
732
		helper1(new String[]{"b", "i"}, new String[]{"I", "Z"});
792
		//helper1(new String[]{"b", "i"}, new String[]{"I", "Z"});
793
		helper1(new String[]{"b", "i"}, new String[]{"I", "Z"},null,null,true);
733
	}
794
	}
734
	public void test20() throws Exception{
795
	public void test20() throws Exception{
735
//		printTestDisabledMessage("bug 18147");
796
//		printTestDisabledMessage("bug 18147");
736
		helper1(new String[]{"b", "a"}, new String[]{"I", "[I"});
797
//		helper1(new String[]{"b", "i"}, new String[]{"I", "Z"});
798
		helper1(new String[]{"b", "a"}, new String[]{"I", "[I"},null,null,true);
737
	}
799
	}
738
800
739
//constructor tests
801
//constructor tests
Lines 754-759 Link Here
754
		String newReturnTypeName= null;
816
		String newReturnTypeName= null;
755
		helperDoAll("A", "A", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deleted, newReturnTypeName);
817
		helperDoAll("A", "A", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deleted, newReturnTypeName);
756
	}
818
	}
819
	
757
	public void test22() throws Exception{
820
	public void test22() throws Exception{
758
		if (! RUN_CONSTRUCTOR_TEST){
821
		if (! RUN_CONSTRUCTOR_TEST){
759
			printTestDisabledMessage("disabled for constructors for now");
822
			printTestDisabledMessage("disabled for constructors for now");
Lines 771-776 Link Here
771
		String newReturnTypeName= null;
834
		String newReturnTypeName= null;
772
		helperDoAll("A", "A", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deleted, newReturnTypeName);
835
		helperDoAll("A", "A", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deleted, newReturnTypeName);
773
	}
836
	}
837
	
774
	public void test23() throws Exception{
838
	public void test23() throws Exception{
775
		if (! RUN_CONSTRUCTOR_TEST){
839
		if (! RUN_CONSTRUCTOR_TEST){
776
			printTestDisabledMessage("disabled for constructors for now");
840
			printTestDisabledMessage("disabled for constructors for now");
Lines 859-873 Link Here
859
		int newVisibility= JdtFlags.VISIBILITY_CODE_INVALID;//retain
923
		int newVisibility= JdtFlags.VISIBILITY_CODE_INVALID;//retain
860
		int[] deleted= null;
924
		int[] deleted= null;
861
		String newReturnTypeName= null;
925
		String newReturnTypeName= null;
862
		helperDoAll("Query.PoolMessageEvent", "PoolMessageEvent", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deleted, newReturnTypeName);
926
		helperDoAll("Query.PoolMessageEvent", "PoolMessageEvent", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deleted, newReturnTypeName, true, false, true);
863
	}
927
	}
864
928
865
	public void testRenameReorder26() throws Exception{
929
	public void testRenameReorder26() throws Exception{
866
		helper1(new String[]{"a", "y"}, new String[]{"Z", "I"}, new String[]{"y", "a"}, new String[]{"zzz", "bb"});
930
		helper1(new String[]{"a", "y"}, new String[]{"Z", "I"}, new String[]{"y", "a"}, new String[]{"zzz", "bb"}, true, true);
867
	}
931
	}
868
	
932
	
869
	public void testRenameReorder27() throws Exception{
933
	public void testRenameReorder27() throws Exception{
870
		helper1(new String[]{"a", "y"}, new String[]{"Z", "I"}, new String[]{"y", "a"}, new String[]{"yyy", "a"});
934
		helper1(new String[]{"a", "y"}, new String[]{"Z", "I"}, new String[]{"y", "a"}, new String[]{"a", "y"}, true, true);
871
	}
935
	}
872
936
873
	public void testAdd28()throws Exception{
937
	public void testAdd28()throws Exception{
Lines 877-883 Link Here
877
		String[] newDefaultValues= {"0"};
941
		String[] newDefaultValues= {"0"};
878
		ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
942
		ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
879
		int[] newIndices= {1};
943
		int[] newIndices= {1};
880
		helperAdd(signature, newParamInfo, newIndices);
944
		helperAdd(signature, newParamInfo, newIndices, true);
881
	}
945
	}
882
946
883
	public void testAdd29()throws Exception{
947
	public void testAdd29()throws Exception{
Lines 887-893 Link Here
887
		String[] newDefaultValues= {"0"};
951
		String[] newDefaultValues= {"0"};
888
		ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
952
		ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
889
		int[] newIndices= {0};
953
		int[] newIndices= {0};
890
		helperAdd(signature, newParamInfo, newIndices);
954
		helperAdd(signature, newParamInfo, newIndices, true);
891
	}
955
	}
892
956
893
	public void testAdd30()throws Exception{
957
	public void testAdd30()throws Exception{
Lines 897-903 Link Here
897
		String[] newDefaultValues= {"0"};
961
		String[] newDefaultValues= {"0"};
898
		ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
962
		ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
899
		int[] newIndices= {1};
963
		int[] newIndices= {1};
900
		helperAdd(signature, newParamInfo, newIndices);
964
		helperAdd(signature, newParamInfo, newIndices, true);
901
	}
965
	}
902
	
966
	
903
	public void testAdd31()throws Exception{
967
	public void testAdd31()throws Exception{
Lines 907-913 Link Here
907
		String[] newDefaultValues= {"0"};
971
		String[] newDefaultValues= {"0"};
908
		ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
972
		ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
909
		int[] newIndices= {1};
973
		int[] newIndices= {1};
910
		helperAdd(signature, newParamInfo, newIndices);
974
		helperAdd(signature, newParamInfo, newIndices, true);
911
	}
975
	}
912
976
913
	public void testAdd32()throws Exception{
977
	public void testAdd32()throws Exception{
Lines 917-923 Link Here
917
		String[] newDefaultValues= {"0"};
981
		String[] newDefaultValues= {"0"};
918
		ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
982
		ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
919
		int[] newIndices= {0};
983
		int[] newIndices= {0};
920
		helperAdd(signature, newParamInfo, newIndices);
984
		helperAdd(signature, newParamInfo, newIndices, true);
921
	}
985
	}
922
986
923
	public void testAdd33()throws Exception{
987
	public void testAdd33()throws Exception{
Lines 927-933 Link Here
927
		String[] newDefaultValues= {"0"};
991
		String[] newDefaultValues= {"0"};
928
		ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
992
		ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
929
		int[] newIndices= {0};
993
		int[] newIndices= {0};
930
		helperAdd(signature, newParamInfo, newIndices);
994
		helperAdd(signature, newParamInfo, newIndices, true);
931
	}
995
	}
932
996
933
	public void testAddReorderRename34()throws Exception{
997
	public void testAddReorderRename34()throws Exception{
Lines 944-950 Link Here
944
		int[] deletedIndices= null;
1008
		int[] deletedIndices= null;
945
		int newVisibility= JdtFlags.VISIBILITY_CODE_INVALID;//retain
1009
		int newVisibility= JdtFlags.VISIBILITY_CODE_INVALID;//retain
946
		String newReturnTypeName= null;
1010
		String newReturnTypeName= null;
947
		helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName);
1011
		helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, true);
948
	}	
1012
	}	
949
1013
950
	public void testAll35()throws Exception{
1014
	public void testAll35()throws Exception{
Lines 1063-1069 Link Here
1063
		int[] deletedIndices= {0};
1127
		int[] deletedIndices= {0};
1064
		int newVisibility= Modifier.NONE;
1128
		int newVisibility= Modifier.NONE;
1065
		String newReturnTypeName= null;
1129
		String newReturnTypeName= null;
1066
		helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName);
1130
		helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, true);
1067
	}	
1131
	}	
1068
1132
1069
	public void testAll42()throws Exception{
1133
	public void testAll42()throws Exception{
Lines 1097-1103 Link Here
1097
		int[] deletedIndices= {0};
1161
		int[] deletedIndices= {0};
1098
		int newVisibility= Modifier.NONE;
1162
		int newVisibility= Modifier.NONE;
1099
		String newReturnTypeName= null;
1163
		String newReturnTypeName= null;
1100
		helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName);
1164
		helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, true);
1101
	}	
1165
	}	
1102
1166
1103
	public void testAll44()throws Exception{
1167
	public void testAll44()throws Exception{
Lines 1149-1155 Link Here
1149
			printTestDisabledMessage("disabled for constructors for now");
1213
			printTestDisabledMessage("disabled for constructors for now");
1150
			return;
1214
			return;
1151
		}
1215
		}
1152
1216
		
1153
		String[] signature= {};
1217
		String[] signature= {};
1154
		String[] newNames= {"i"};
1218
		String[] newNames= {"i"};
1155
		String[] newTypes= {"int"};
1219
		String[] newTypes= {"int"};
Lines 1166-1171 Link Here
1166
		helperDoAll("A", "A", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName);
1230
		helperDoAll("A", "A", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName);
1167
	}
1231
	}
1168
1232
1233
	public void testAll46b()throws Exception{
1234
		if (! RUN_CONSTRUCTOR_TEST){
1235
			printTestDisabledMessage("disabled for constructors for now");
1236
			return;
1237
		}
1238
		
1239
		String[] signature= {};
1240
		String[] newNames= {"i"};
1241
		String[] newTypes= {"int"};
1242
		String[] newDefaultValues= {"1"};
1243
		ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
1244
		int[] newIndices= {0};
1245
1246
		String[] oldParamNames= {};
1247
		String[] newParamNames= {};
1248
		int[] permutation= {0};
1249
		int[] deletedIndices= null;
1250
		int newVisibility= Modifier.NONE;
1251
		String newReturnTypeName= null;
1252
		helperDoAll("A", "A", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, false);
1253
	}
1254
1169
	public void testAll47()throws Exception{
1255
	public void testAll47()throws Exception{
1170
		if (! RUN_CONSTRUCTOR_TEST){
1256
		if (! RUN_CONSTRUCTOR_TEST){
1171
			printTestDisabledMessage("disabled for constructors for now");
1257
			printTestDisabledMessage("disabled for constructors for now");
Lines 1465-1471 Link Here
1465
		String[] newDefaultValues= {"true"};
1551
		String[] newDefaultValues= {"true"};
1466
		ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
1552
		ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
1467
		int[] newIndices= {1};
1553
		int[] newIndices= {1};
1468
		helperAdd(signature, newParamInfo, newIndices);
1554
		helperAdd(signature, newParamInfo, newIndices, true, true);
1555
	}
1556
1557
	public void testAddRecursive2()throws Exception{ 
1558
		// As above, but don't update callers
1559
		String[] signature= {"I"};
1560
		String[] newNames= {"bool"};
1561
		String[] newTypes= {"boolean"};
1562
		String[] newDefaultValues= {"true"};
1563
		ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
1564
		int[] newIndices= {1};
1565
		helperAdd(signature, newParamInfo, newIndices, true, false);
1469
	}
1566
	}
1470
	
1567
	
1471
	public void testException01() throws Exception {
1568
	public void testException01() throws Exception {
Lines 1525-1536 Link Here
1525
	
1622
	
1526
	public void testName01() throws Exception {
1623
	public void testName01() throws Exception {
1527
		String[] signature= {"QString;"};
1624
		String[] signature= {"QString;"};
1528
		helperRenameMethod(signature, "newName");
1625
		helperRenameMethod(signature, "newName",true);
1529
	}
1626
	}
1530
1627
1531
	public void testName02() throws Exception {
1628
	public void testName02() throws Exception {
1532
		String[] signature= {"QString;"};
1629
		String[] signature= {"QString;"};
1533
		helperRenameMethod(signature, "newName");
1630
		helperRenameMethod(signature, "newName",true);
1534
	}
1631
	}
1535
	
1632
	
1536
	public void testFailImport01() throws Exception {
1633
	public void testFailImport01() throws Exception {
Lines 1738-1744 Link Here
1738
			printTestDisabledMessage("BUG_83319_CORE_REFS_IN_STATIC_IMPORT");
1835
			printTestDisabledMessage("BUG_83319_CORE_REFS_IN_STATIC_IMPORT");
1739
			return;
1836
			return;
1740
		}
1837
		}
1741
		helperRenameMethod(new String[0], "abc");
1838
		helperRenameMethod(new String[0], "abc", false);
1742
	}
1839
	}
1743
	
1840
	
1744
	public void testStaticImport02() throws Exception {
1841
	public void testStaticImport02() throws Exception {
Lines 1782-1788 Link Here
1782
		int[] deletedIndices= {};
1879
		int[] deletedIndices= {};
1783
		int newVisibility= Modifier.PUBLIC;
1880
		int newVisibility= Modifier.PUBLIC;
1784
		String newReturnTypeName= null;
1881
		String newReturnTypeName= null;
1785
		helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName);
1882
		helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, true);
1786
	}
1883
	}
1787
	
1884
	
1788
	public void testVararg03() throws Exception {
1885
	public void testVararg03() throws Exception {
Lines 1823-1828 Link Here
1823
		String newReturnTypeName= null;
1920
		String newReturnTypeName= null;
1824
		helperDoAll("A", "use", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName);
1921
		helperDoAll("A", "use", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName);
1825
	}
1922
	}
1923
1924
	public void testVararg04b() throws Exception {
1925
		String[] signature= {"[QString;"};
1926
		String[] newNames= {"i"};
1927
		String[] newTypes= {"int"};
1928
		String[] newDefaultValues= {"1"};
1929
		ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
1930
		int[] newIndices= {0};
1931
1932
		String[] oldParamNames= {"args"};
1933
		String[] newParamNames= {"args"};
1934
		int[] permutation= {};
1935
		int[] deletedIndices= {};
1936
		int newVisibility= Modifier.PUBLIC;
1937
		String newReturnTypeName= null;
1938
		helperDoAll("A", "use", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName, true, true, false);
1939
	}
1826
	
1940
	
1827
	public void testVararg05() throws Exception {
1941
	public void testVararg05() throws Exception {
1828
		String[] signature= {"QObject;", "[QString;"};
1942
		String[] signature= {"QObject;", "[QString;"};
Lines 1838-1844 Link Here
1838
		int[] deletedIndices= {1};
1952
		int[] deletedIndices= {1};
1839
		int newVisibility= Modifier.PUBLIC;
1953
		int newVisibility= Modifier.PUBLIC;
1840
		String newReturnTypeName= null;
1954
		String newReturnTypeName= null;
1841
		helperDoAll("A", "use", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName);
1955
		helperDoAll("A", "use", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, true);
1842
	}
1956
	}
1843
	
1957
	
1844
	public void testVararg06() throws Exception {
1958
	public void testVararg06() throws Exception {
Lines 1874-1880 Link Here
1874
		int[] deletedIndices= { 1 };
1988
		int[] deletedIndices= { 1 };
1875
		int newVisibility= Modifier.PUBLIC;
1989
		int newVisibility= Modifier.PUBLIC;
1876
		String newReturnTypeName= null;
1990
		String newReturnTypeName= null;
1877
		helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName);
1991
		helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, null, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, true);
1878
	}
1992
	}
1879
	
1993
	
1880
	public void testVararg08() throws Exception {
1994
	public void testVararg08() throws Exception {
Lines 1972-1978 Link Here
1972
		int[] deletedIndices= { };
2086
		int[] deletedIndices= { };
1973
		int newVisibility= Modifier.NONE;
2087
		int newVisibility= Modifier.NONE;
1974
		String newReturnTypeName= null;
2088
		String newReturnTypeName= null;
1975
		helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, newParameterTypeNames, permutation, newVisibility, deletedIndices, newReturnTypeName);
2089
		helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, newParameterTypeNames, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, true);
1976
	}
2090
	}
1977
2091
1978
	public void testGenerics03() throws Exception {
2092
	public void testGenerics03() throws Exception {
Lines 2011-2015 Link Here
2011
		helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, newParameterTypeNames, permutation, newVisibility, deletedIndices, newReturnTypeName);
2125
		helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, newParameterTypeNames, permutation, newVisibility, deletedIndices, newReturnTypeName);
2012
	}
2126
	}
2013
2127
2014
}
2128
	public void testGenerics05() throws Exception {
2129
		if (true){
2130
			printTestDisabledMessage("how to add old bindings?");
2131
			return;
2132
		}
2133
		String[] signature= {"QT;", "QE;"};
2134
		String[] newNames= {"maps"};
2135
		String[] newTypes= {"java.util.List<HashMap>"};
2136
		String[] newDefaultValues= {"null"};
2137
		ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
2138
		int[] newIndices= {2};
2139
2140
		String[] oldParamNames= {"e", "t"};
2141
		String[] newParamNames= {"e", "t"};
2142
		String[] newParameterTypeNames= null;
2143
		int[] permutation= {1, 0, 2};
2144
		int[] deletedIndices= { };
2145
		int newVisibility= Modifier.NONE;
2146
		String newReturnTypeName= null;
2147
		helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, newParameterTypeNames, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, true);
2148
	}
2015
2149
2150
	public void testGenerics06() throws Exception {
2151
		if (true){
2152
			printTestDisabledMessage("how to add old bindings?");
2153
			return;
2154
		}
2155
		String[] signature= {"QList<QInteger;>;", "QA<QString;>;"};
2156
		String[] newNames= {"li"};
2157
		String[] newTypes= {"List<Integer>"};
2158
		String[] newDefaultValues= {"null"};
2159
		ParameterInfo[] newParamInfo= createNewParamInfos(newTypes, newNames, newDefaultValues);
2160
		int[] newIndices= {2};
2161
2162
		String[] oldParamNames= {"li", "as"};
2163
		String[] newParamNames= {"li", "as"};
2164
		String[] newParameterTypeNames= null;
2165
		int[] permutation= {1, 2, 0};
2166
		int[] deletedIndices= {0};
2167
		int newVisibility= Modifier.PUBLIC;
2168
		String newReturnTypeName= null;
2169
		helperDoAll("A", "m", signature, newParamInfo, newIndices, oldParamNames, newParamNames, newParameterTypeNames, permutation, newVisibility, deletedIndices, newReturnTypeName, true, false, true);
2170
	}
2171
}
(-)resources/ChangeSignature/canModify/A_testAddRecursive2_in.java (+33 lines)
Added Link Here
1
package p;
2
3
class Super extends A {
4
	void m(int i) { super.m(1); }
5
}
6
class A {
7
	int i;
8
	void m(int i) {this.i = i;}
9
}
10
class Recursive extends A {
11
	void m(int i) { if (true) m(i); }
12
}
13
class ThisRecursive extends A {
14
	void m(int i) { this.m(i); }
15
}
16
class AlmostRecursive extends A {
17
	void m(int i) { new A().m(i); }
18
}
19
class RecursiveOrNot extends A {
20
	void m(int i) { new RecursiveOrNot().m(i); }
21
}
22
class NonRecursive extends A {
23
	void m(int i) { int k= i; }
24
}
25
class Calling extends A {
26
	void bar() { m(17);m(18); }
27
}
28
class Calling2 {
29
	void bar() { new A().m(17); }
30
}
31
class Calling3 {
32
	void bar() { new Recursive().m(17); }
33
}
(-)resources/ChangeSignature/canModify/A_testAddRecursive2_out.java (+36 lines)
Added Link Here
1
package p;
2
3
class Super extends A {
4
	void m(int i) { super.m(1); }
5
}
6
class A {
7
	int i;
8
	void m(int i, boolean bool) {this.i = i;}
9
	void m(int i) {
10
		m(i, true);
11
	}
12
}
13
class Recursive extends A {
14
	void m(int i) { if (true) m(i); }
15
}
16
class ThisRecursive extends A {
17
	void m(int i) { this.m(i); }
18
}
19
class AlmostRecursive extends A {
20
	void m(int i) { new A().m(i); }
21
}
22
class RecursiveOrNot extends A {
23
	void m(int i) { new RecursiveOrNot().m(i); }
24
}
25
class NonRecursive extends A {
26
	void m(int i) { int k= i; }
27
}
28
class Calling extends A {
29
	void bar() { m(17);m(18); }
30
}
31
class Calling2 {
32
	void bar() { new A().m(17); }
33
}
34
class Calling3 {
35
	void bar() { new Recursive().m(17); }
36
}
(-)resources/ChangeSignature/canModify/A_testAll46b_in.java (+11 lines)
Added Link Here
1
package p;
2
class A{
3
	A(){
4
	}
5
	void f(){
6
		new A();
7
	}
8
	A(String a){
9
		this();
10
	}
11
}
(-)resources/ChangeSignature/canModify/A_testAll46b_out.java (+14 lines)
Added Link Here
1
package p;
2
class A{
3
	A(int i){
4
	}
5
	void f(){
6
		new A();
7
	}
8
	A(String a){
9
		this();
10
	}
11
	A() {
12
		this(1);
13
	}
14
}
(-)resources/ChangeSignature/canModify/A_testGenerics05_in.java (+5 lines)
Added Link Here
1
package p;
2
3
class A<E> {
4
	<T> void m(T t, E e) {}
5
}
(-)resources/ChangeSignature/canModify/A_testGenerics05_out.java (+15 lines)
Added Link Here
1
package p;
2
3
import java.util.HashMap;
4
import java.util.List;
5
6
class A<E> {
7
	<T> void m(E e, T t, List<HashMap> maps) {}
8
9
	/**
10
	 * @deprecated use instead m(E e, T t, java.util.List<HashMap> maps)
11
	 */
12
	<T> void m(T t, E e) {
13
		m(e, t, null);
14
	}
15
}
(-)resources/ChangeSignature/canModify/A_testGenerics06_in.java (+18 lines)
Added Link Here
1
package p;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
class A<E> {
7
	public <T extends Number> void m(List<Integer> li, A<String> as) {}
8
}
9
10
class Sub<E> extends A<E> {
11
	public <T> void m(List<Integer> li, A<String> as) {}
12
	
13
	void test() {
14
		A<String> as= new A<String>();
15
		as.m(new ArrayList<Integer>(1), as);
16
		new Sub<Double>().m(new ArrayList<Integer>(2), as);
17
	}
18
}
(-)resources/ChangeSignature/canModify/A_testGenerics06_out.java (+31 lines)
Added Link Here
1
package p;
2
3
import java.util.List;
4
5
class A<E> {
6
	public <T extends Number> void m(A<String> as, List<Integer> li) {}
7
8
	/**
9
	 * @deprecated use instead m(A<String> as, List<Integer> li)
10
	 */
11
	public <T extends Number> void m(List<Integer> li, A<String> as) {
12
		m(as, null);
13
	}
14
}
15
16
class Sub<E> extends A<E> {
17
	public <T> void m(A<String> as, List<Integer> li) {}
18
	
19
	void test() {
20
		A<String> as= new A<String>();
21
		as.m(as, null);
22
		new Sub<Double>().m(as, null);
23
	}
24
25
	/**
26
	 * @deprecated use instead m(A<String> as, List<Integer> li)
27
	 */
28
	public <T> void m(List<Integer> li, A<String> as) {
29
		m(as, null);
30
	}
31
}
(-)resources/ChangeSignature/canModify/A_testVararg04b_in.java (+15 lines)
Added Link Here
1
package p;
2
3
class A {
4
	public void use(String... args) { System.out.println("hello world",args); }
5
	
6
	public void call() {
7
		use();
8
		use("one");
9
		use("one", "two");
10
		use(new String[] {"one", "two"});
11
		use(null);
12
		use((String[]) null);
13
		use((String) null);
14
	}
15
}
(-)resources/ChangeSignature/canModify/A_testVararg04b_out.java (+19 lines)
Added Link Here
1
package p;
2
3
class A {
4
	public void use(int i, String... args) { System.out.println("hello world",args); }
5
	
6
	public void call() {
7
		use();
8
		use("one");
9
		use("one", "two");
10
		use(new String[] {"one", "two"});
11
		use(null);
12
		use((String[]) null);
13
		use((String) null);
14
	}
15
16
	public void use(String... args) {
17
		System.out.println("hello world", args);
18
	}
19
}

Return to bug 70135