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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java (-117 / +291 lines)
Lines 1903-1937 Link Here
1903
	}
1903
	}
1904
1904
1905
	/**
1905
	/**
1906
	 * Bug 65180: Spurious "Javadoc: xxx cannot be resolved or is not a field" error with inner classes
1906
	 * @bug 65180: Spurious "Javadoc: xxx cannot be resolved or is not a field" error with inner classes
1907
	 * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65180">65180</a>
1907
	 * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=65180"
1908
	 */
1908
	 */
1909
	 // Conform since bug "http://bugs.eclipse.org/bugs/show_bug.cgi?id=191322" has been fixed
1909
	public void testBug65180() {
1910
	public void testBug65180() {
1910
		runNegativeTest(
1911
		runConformTest(
1911
			new String[] {
1912
			new String[] {
1912
				"Test.java",
1913
				"Test.java",
1913
				"public class Test {\n" + 
1914
				"public class Test {\n" + 
1914
					"	public class Inner {\n" + 
1915
				"	public class Inner {\n" + 
1915
					"		/**\n" + 
1916
				"		/**\n" + 
1916
					"		 * Does something.\n" + 
1917
				"		 * Does something.\n" + 
1917
					"		 * \n" + 
1918
				"		 * \n" + 
1918
					"		 * @see #testFunc\n" + 
1919
				"		 * @see #testFunc\n" + 
1919
					"		 */\n" + 
1920
				"		 */\n" + 
1920
					"		public void innerFunc() {\n" + 
1921
				"		public void innerFunc() {\n" + 
1921
					"			testFunc();\n" + 
1922
				"			testFunc();\n" + 
1922
					"		}\n" + 
1923
				"		}\n" + 
1923
					"	}\n" + 
1924
				"	}\n" + 
1924
					"	\n" + 
1925
				"	\n" + 
1925
					"	public void testFunc() {}\n" + 
1926
				"	public void testFunc() {}\n" + 
1926
					"}\n" + 
1927
				"}\n" + 
1927
					"\n"
1928
				"\n"
1928
			},
1929
			}
1929
			"----------\n" + 
1930
				"1. ERROR in Test.java (at line 6)\r\n" + 
1931
				"	* @see #testFunc\r\n" + 
1932
				"	        ^^^^^^^^\n" + 
1933
				"Javadoc: testFunc cannot be resolved or is not a field\n" + 
1934
				"----------\n"
1935
		);
1930
		);
1936
	}
1931
	}
1937
	public void testBug65180a() {
1932
	public void testBug65180a() {
Lines 1939-1958 Link Here
1939
			new String[] {
1934
			new String[] {
1940
				"Test.java",
1935
				"Test.java",
1941
				"public class Test {\n" + 
1936
				"public class Test {\n" + 
1942
					"	public class Inner {\n" + 
1937
				"	public class Inner {\n" + 
1943
					"		/**\n" + 
1938
				"		/**\n" + 
1944
					"		 * Does something.\n" + 
1939
				"		 * Does something.\n" + 
1945
					"		 * \n" + 
1940
				"		 * \n" + 
1946
					"		 * @see #testFunc()\n" + 
1941
				"		 * @see #testFunc()\n" + 
1947
					"		 */\n" + 
1942
				"		 */\n" + 
1948
					"		public void innerFunc() {\n" + 
1943
				"		public void innerFunc() {\n" + 
1949
					"			testFunc();\n" + 
1944
				"			testFunc();\n" + 
1950
					"		}\n" + 
1945
				"		}\n" + 
1951
					"	}\n" + 
1946
				"	}\n" + 
1952
					"	\n" + 
1947
				"	\n" + 
1953
					"	public void testFunc() {}\n" + 
1948
				"	public void testFunc() {}\n" + 
1954
					"}\n" + 
1949
				"}\n"
1955
					"\n"
1956
			}
1950
			}
1957
		);
1951
		);
1958
	}
1952
	}
Lines 1961-2011 Link Here
1961
			new String[] {
1955
			new String[] {
1962
				"Test.java",
1956
				"Test.java",
1963
				"public class Test {\n" + 
1957
				"public class Test {\n" + 
1964
					"	public class Inner {\n" + 
1958
				"	public class Inner {\n" + 
1965
					"		/**\n" + 
1959
				"		/**\n" + 
1966
					"		 * Does something.\n" + 
1960
				"		 * Does something.\n" + 
1967
					"		 * \n" + 
1961
				"		 * \n" + 
1968
					"		 * @see Test#testFunc\n" + 
1962
				"		 * @see Test#testFunc\n" + 
1969
					"		 * @see Test#testFunc()\n" + 
1963
				"		 * @see Test#testFunc()\n" + 
1970
					"		 */\n" + 
1964
				"		 */\n" + 
1971
					"		public void innerFunc() {\n" + 
1965
				"		public void innerFunc() {\n" + 
1972
					"			testFunc();\n" + 
1966
				"			testFunc();\n" + 
1973
					"		}\n" + 
1967
				"		}\n" + 
1974
					"	}\n" + 
1968
				"	}\n" + 
1975
					"	\n" + 
1969
				"	\n" + 
1976
					"	public void testFunc() {}\n" + 
1970
				"	public void testFunc() {}\n" + 
1977
					"}\n" + 
1971
				"}\n"
1978
					"\n"
1979
			}
1972
			}
1980
		);
1973
		);
1981
	}
1974
	}
1975
	 // Ambiguous reference since bug "http://bugs.eclipse.org/bugs/show_bug.cgi?id=191322" has been fixed
1982
	public void testBug65180c() {
1976
	public void testBug65180c() {
1983
		runNegativeTest(
1977
		runNegativeTest(
1984
			new String[] {
1978
			new String[] {
1985
				"Test.java",
1979
				"Test.java",
1986
				"public class Test {\n" + 
1980
				"public class Test {\n" + 
1987
					"	public class Inner {\n" + 
1981
				"	public class Inner {\n" + 
1988
					"		/**\n" + 
1982
				"		/**\n" + 
1989
					"		 * Does something.\n" + 
1983
				"		 * Does something.\n" + 
1990
					"		 * \n" + 
1984
				"		 * \n" + 
1991
					"		 * @see #testFunc\n" + 
1985
				"		 * @see #testFunc\n" + 
1992
					"		 */\n" + 
1986
				"		 */\n" + 
1993
					"		public void innerFunc() {\n" + 
1987
				"		public void innerFunc() {\n" + 
1994
					"			testFunc();\n" + 
1988
				"			testFunc();\n" + 
1995
					"		}\n" + 
1989
				"		}\n" + 
1996
					"	}\n" + 
1990
				"	}\n" + 
1997
					"	\n" + 
1991
				"	\n" + 
1998
					"	public void testFunc() {}\n" + 
1992
				"	public void testFunc() {}\n" + 
1999
					"	public void testFunc(String str) {}\n" + 
1993
				"	public void testFunc(String str) {}\n" + 
2000
					"}\n" + 
1994
				"}\n"
2001
					"\n"
2002
			},
1995
			},
2003
			"----------\n" + 
1996
			"----------\n" + 
2004
				"1. ERROR in Test.java (at line 6)\n" + 
1997
			"1. ERROR in Test.java (at line 6)\r\n" + 
2005
				"	* @see #testFunc\n" + 
1998
			"	* @see #testFunc\r\n" + 
2006
				"	        ^^^^^^^^\n" + 
1999
			"	        ^^^^^^^^\n" + 
2007
				"Javadoc: testFunc cannot be resolved or is not a field\n" + 
2000
			"Javadoc: testFunc is an ambiguous method reference or is not a field\n" + 
2008
				"----------\n"
2001
			"----------\n"
2009
		);
2002
		);
2010
	}
2003
	}
2011
	public void testBug65180d() {
2004
	public void testBug65180d() {
Lines 2014-2036 Link Here
2014
				"Test.java",
2007
				"Test.java",
2015
				"public class Test {\n" + 
2008
				"public class Test {\n" + 
2016
					"	int testField;\n" + 
2009
					"	int testField;\n" + 
2017
					"	public class Inner {\n" + 
2010
				"	public class Inner {\n" + 
2018
					"		/**\n" + 
2011
				"		/**\n" + 
2019
					"		 * Does something.\n" + 
2012
				"		 * Does something.\n" + 
2020
					"		 * \n" + 
2013
				"		 * \n" + 
2021
					"		 * @see #testField\n" + 
2014
				"		 * @see #testField\n" + 
2022
					"		 * @see #testFunc(int)\n" + 
2015
				"		 * @see #testFunc(int)\n" + 
2023
					"		 */\n" + 
2016
				"		 */\n" + 
2024
					"		public void innerFunc() {\n" + 
2017
				"		public void innerFunc() {\n" + 
2025
					"			testFunc(testField);\n" + 
2018
				"			testFunc(testField);\n" + 
2026
					"		}\n" + 
2019
				"		}\n" + 
2027
					"	}\n" + 
2020
				"	}\n" + 
2028
					"	\n" + 
2021
				"	\n" + 
2029
					"	public void testFunc(int test) {\n" + 
2022
				"	public void testFunc(int test) {\n" + 
2030
					"		testField = test; \n" + 
2023
				"		testField = test; \n" + 
2031
					"	}\n" + 
2024
				"	}\n" + 
2032
					"}\n" + 
2025
				"}\n"
2033
					"\n"
2034
			}
2026
			}
2035
		);
2027
		);
2036
	}
2028
	}
Lines 2039-2053 Link Here
2039
			new String[] {
2031
			new String[] {
2040
				"ITest.java",
2032
				"ITest.java",
2041
				"public interface ITest {\n" + 
2033
				"public interface ITest {\n" + 
2042
					"	/**\n" + 
2034
				"	/**\n" + 
2043
					"	 * @see #foo() \n" + 
2035
				"	 * @see #foo() \n" + 
2044
					"	 */\n" + 
2036
				"	 */\n" + 
2045
					"	public static int field = 0;\n" + 
2037
				"	public static int field = 0;\n" + 
2046
					"	/**\n" + 
2038
				"	/**\n" + 
2047
					"	 * @see #field\n" + 
2039
				"	 * @see #field\n" + 
2048
					"	 */\n" + 
2040
				"	 */\n" + 
2049
					"	public void foo();\n" + 
2041
				"	public void foo();\n" + 
2050
					"}\n"
2042
				"}\n"
2051
			}
2043
			}
2052
		);
2044
		);
2053
	}
2045
	}
Lines 2056-2079 Link Here
2056
			new String[] {
2048
			new String[] {
2057
				"Test.java",
2049
				"Test.java",
2058
				"public class Test {\n" + 
2050
				"public class Test {\n" + 
2059
					"    static class SuperInner {\n" + 
2051
				"    static class SuperInner {\n" + 
2060
					"    	public int field;\n" + 
2052
				"    	public int field;\n" + 
2061
					"        public void foo() {}\n" + 
2053
				"        public void foo() {}\n" + 
2062
					"     }\n" + 
2054
				"     }\n" + 
2063
					"    \n" + 
2055
				"    \n" + 
2064
					"	public static class Inner extends SuperInner {\n" + 
2056
				"	public static class Inner extends SuperInner {\n" + 
2065
					"		/**\n" + 
2057
				"		/**\n" + 
2066
					"		 * @see #field\n" + 
2058
				"		 * @see #field\n" + 
2067
					"		 */\n" + 
2059
				"		 */\n" + 
2068
					"		public static int f;\n" + 
2060
				"		public static int f;\n" + 
2069
					"		/**\n" + 
2061
				"		/**\n" + 
2070
					"		 * @see #foo()\n" + 
2062
				"		 * @see #foo()\n" + 
2071
					"		 */\n" + 
2063
				"		 */\n" + 
2072
					"		public static void bar() {}\n" + 
2064
				"		public static void bar() {}\n" + 
2073
					"	}\n" + 
2065
				"	}\n" + 
2074
					"	\n" + 
2066
				"	\n" + 
2075
					"	public void foo() {}\n" + 
2067
				"	public void foo() {}\n" + 
2076
					"}"
2068
				"}"
2077
			}
2069
			}
2078
		);
2070
		);
2079
	}
2071
	}
Lines 6089-6094 Link Here
6089
	}
6081
	}
6090
	
6082
	
6091
	/**
6083
	/**
6084
	 * @bug 191322: [javadoc] @see or @link reference to method without signature fails to resolve to base class method
6085
	 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=191322"
6086
	 */
6087
	public void testBug191322() {
6088
		runConformTest(
6089
			new String[] {
6090
				"X.java",
6091
				"public class X {\n" + 
6092
				"	void foo() {}\n" + 
6093
				"	/**\n" + 
6094
				"	 * {@link #foo}.\n" + 
6095
				"	 * @see #foo\n" + 
6096
				"	 */\n" + 
6097
				"	void goo() {}\n" + 
6098
				"}\n",
6099
				"Y.java",
6100
				"class Y extends X {\n" + 
6101
				"	/**\n" + 
6102
				"	 * {@link #foo}\n" + 
6103
				"	 * @see #foo\n" + 
6104
				"	 */\n" + 
6105
				"	void hoo() {}\n" + 
6106
				"}"
6107
			}
6108
		);
6109
	}
6110
	public void testBug191322b() {
6111
		runConformTest(
6112
			new String[] {
6113
				"b/X.java",
6114
				"package b;\n" + 
6115
				"public class X {\n" + 
6116
				"	void foo() {}\n" + 
6117
				"}\n" + 
6118
				"class Y extends X {}\n" + 
6119
				"class W extends Y {}\n" + 
6120
				"class Z extends W {\n" + 
6121
				"	/**\n" + 
6122
				"	 * {@link #foo}\n" + 
6123
				"	 * @see #foo\n" + 
6124
				"	 */\n" + 
6125
				"	void hoo() {}\n" + 
6126
				"}\n"
6127
			}
6128
		);
6129
	}
6130
	public void testBug191322c() {
6131
		runConformTest(
6132
			new String[] {
6133
				"c/X.java",
6134
				"package c;\n" + 
6135
				"public interface X {\n" + 
6136
				"	void foo();\n" + 
6137
				"}\n" + 
6138
				"interface Y extends X {\n" + 
6139
				"	/**\n" + 
6140
				"	 * {@link #foo}\n" + 
6141
				"	 * @see #foo\n" + 
6142
				"	 */\n" + 
6143
				"	void hoo();\n" + 
6144
				"}\n"
6145
			}
6146
		);
6147
	}
6148
	public void testBug191322d() {
6149
		runConformTest(
6150
			new String[] {
6151
				"d/X.java",
6152
				"package d;\n" + 
6153
				"public interface X {\n" + 
6154
				"	void foo();\n" + 
6155
				"}\n" + 
6156
				"interface Y extends X {}\n" + 
6157
				"abstract class W implements Y {}\n" + 
6158
				"abstract class Z extends W {\n" + 
6159
				"	/**\n" + 
6160
				"	 * {@link #foo}\n" + 
6161
				"	 * @see #foo\n" + 
6162
				"	 */\n" + 
6163
				"	void hoo() {}\n" + 
6164
				"}\n"
6165
			}
6166
		);
6167
	}
6168
	public void testBug191322e() {
6169
		runConformTest(
6170
			new String[] {
6171
				"e/X.java",
6172
				"package e;\n" + 
6173
				"public class X {\n" + 
6174
				"	void foo() {}\n" + 
6175
				"	class Y {\n" + 
6176
				"		/**\n" + 
6177
				"		 * {@link #foo}\n" + 
6178
				"		 * @see #foo\n" + 
6179
				"		 */\n" + 
6180
				"		void hoo() {}\n" + 
6181
				"	}\n" + 
6182
				"}\n"
6183
			}
6184
		);
6185
	}
6186
	public void testBug191322f() {
6187
		runNegativeTest(
6188
			new String[] {
6189
				"f/X.java",
6190
				"package f;\n" + 
6191
				"public class X {\n" + 
6192
				"	void foo() {}\n" + 
6193
				"	void foo(String str) {}\n" + 
6194
				"}\n" + 
6195
				"class Y extends X {\n" + 
6196
				"	/**\n" + 
6197
				"	 * {@link #foo}\n" + 
6198
				"	 * @see #foo\n" + 
6199
				"	 */\n" + 
6200
				"	void hoo() {}\n" + 
6201
				"}\n"
6202
			},
6203
			"----------\n" + 
6204
			"1. ERROR in f\\X.java (at line 8)\r\n" + 
6205
			"	* {@link #foo}\r\n" + 
6206
			"	          ^^^\n" + 
6207
			"Javadoc: foo is an ambiguous method reference or is not a field\n" + 
6208
			"----------\n" + 
6209
			"2. ERROR in f\\X.java (at line 9)\r\n" + 
6210
			"	* @see #foo\r\n" + 
6211
			"	        ^^^\n" + 
6212
			"Javadoc: foo is an ambiguous method reference or is not a field\n" + 
6213
			"----------\n"
6214
		);
6215
	}
6216
	public void testBug191322g() {
6217
		runNegativeTest(
6218
			new String[] {
6219
				"g/X.java",
6220
				"package g;\n" + 
6221
				"public class X {\n" + 
6222
				"	void foo(String str) {}\n" + 
6223
				"	void foo(int x) {}\n" + 
6224
				"}\n" + 
6225
				"class Y extends X {\n" + 
6226
				"	/**\n" + 
6227
				"	 * {@link #foo}\n" + 
6228
				"	 * @see #foo\n" + 
6229
				"	 */\n" + 
6230
				"	void hoo() {}\n" + 
6231
				"}\n"
6232
			},
6233
			"----------\n" + 
6234
			"1. ERROR in g\\X.java (at line 8)\r\n" + 
6235
			"	* {@link #foo}\r\n" + 
6236
			"	          ^^^\n" + 
6237
			"Javadoc: foo is an ambiguous method reference or is not a field\n" + 
6238
			"----------\n" + 
6239
			"2. ERROR in g\\X.java (at line 9)\r\n" + 
6240
			"	* @see #foo\r\n" + 
6241
			"	        ^^^\n" + 
6242
			"Javadoc: foo is an ambiguous method reference or is not a field\n" + 
6243
			"----------\n"
6244
		);
6245
	}
6246
	public void testBug191322h() {
6247
		runConformTest(
6248
			new String[] {
6249
				"h/X.java",
6250
				"package h;\n" + 
6251
				"public class X {\n" + 
6252
				"	void foo(String str) {}\n" + 
6253
				"}\n" + 
6254
				"class Y extends X {\n" + 
6255
				"	/**\n" + 
6256
				"	 * {@link #foo}\n" + 
6257
				"	 * @see #foo\n" + 
6258
				"	 */\n" + 
6259
				"	void hoo() {}\n" + 
6260
				"}\n"
6261
			}
6262
		);
6263
	}
6264
	
6265
	/**
6092
	 * @bug 195374: [javadoc] Missing Javadoc warning for required qualification for inner types at 1.4 level
6266
	 * @bug 195374: [javadoc] Missing Javadoc warning for required qualification for inner types at 1.4 level
6093
	 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=195374"
6267
	 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=195374"
6094
	 */
6268
	 */
(-)compiler/org/eclipse/jdt/internal/compiler/ast/JavadocFieldReference.java (-9 / +33 lines)
Lines 24-38 Link Here
24
		super(source, pos);
24
		super(source, pos);
25
		this.bits |= InsideJavadoc;
25
		this.bits |= InsideJavadoc;
26
	}
26
	}
27
	
27
28
	/*
28
	private MethodBinding[] findPossibleMethod(ReferenceBinding refBinding) {
29
	public Binding getBinding() {
29
30
		if (this.methodBinding != null) {
30
		// Get methods with given token
31
			return this.methodBinding;
31
	    MethodBinding[] methodBindings = refBinding.getMethods(this.token);
32
	    if (methodBindings != Binding.NO_METHODS) return methodBindings;
33
	    
34
	    // Walk through type hierarchy
35
		ReferenceBinding[] superInterfaces = refBinding.superInterfaces();
36
		for (int i = 0, length = superInterfaces.length; i < length; ++i) {
37
			methodBindings = findPossibleMethod(superInterfaces[i]);
38
			if (methodBindings != Binding.NO_METHODS) {
39
				return methodBindings;
40
			}
32
		}
41
		}
33
		return this.binding;
42
		if (refBinding.superclass() != null) {
34
	}
43
			methodBindings = findPossibleMethod(refBinding.superclass());
35
	*/
44
			if (methodBindings != Binding.NO_METHODS) {
45
				return methodBindings;
46
			}
47
		}
48
49
		// Walk through type enclosing types
50
		ReferenceBinding enclosingTypeBinding = refBinding;
51
		while (enclosingTypeBinding.isMemberType() || enclosingTypeBinding.isLocalType()) {
52
			enclosingTypeBinding = enclosingTypeBinding.enclosingType();
53
			methodBindings = findPossibleMethod(enclosingTypeBinding);
54
			if (methodBindings != Binding.NO_METHODS) {
55
				return methodBindings;
56
			}
57
		}
58
	    return Binding.NO_METHODS;
59
    }
36
60
37
	/*
61
	/*
38
	 * Resolves type on a Block or Class scope.
62
	 * Resolves type on a Block or Class scope.
Lines 74-80 Link Here
74
			}						
98
			}						
75
			if (this.receiverType instanceof ReferenceBinding) {
99
			if (this.receiverType instanceof ReferenceBinding) {
76
				ReferenceBinding refBinding = (ReferenceBinding) this.receiverType;
100
				ReferenceBinding refBinding = (ReferenceBinding) this.receiverType;
77
				MethodBinding[] methodBindings = refBinding.getMethods(this.token);
101
				MethodBinding[] methodBindings = findPossibleMethod(refBinding);
78
				if (methodBindings == null) {
102
				if (methodBindings == null) {
79
					scope.problemReporter().javadocInvalidField(this, fieldBinding, this.receiverType, scope.getDeclarationModifiers());
103
					scope.problemReporter().javadocInvalidField(this, fieldBinding, this.receiverType, scope.getDeclarationModifiers());
80
				} else {
104
				} else {
(-)src/org/eclipse/jdt/core/tests/model/SelectionJavadocModelTests.java (+211 lines)
Lines 1022-1025 Link Here
1022
			elements
1022
			elements
1023
		);
1023
		);
1024
	}
1024
	}
1025
1026
	/**
1027
	 * @bug 191322: [javadoc] @see or @link reference to method without signature fails to resolve to base class method
1028
	 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=191322"
1029
	 */
1030
	public void testBug191322a() throws CoreException {
1031
		this.wcOwner = new WorkingCopyOwner() {};
1032
		workingCopies = new ICompilationUnit[1];
1033
		workingCopies[0] = getWorkingCopy("/Tests/b191322/X.java",
1034
			"package b191322;\n" + 
1035
			"public class X {\n" + 
1036
			"	void foo() {}\n" + 
1037
			"}\n" + 
1038
			"class Y extends X {\n" + 
1039
			"	/**\n" + 
1040
			"	 * {@link #foo}\n" + 
1041
			"	 * @see #foo\n" + 
1042
			"	 */\n" + 
1043
			"	void hoo() {}\n" + 
1044
			"}\n"
1045
		);
1046
		IJavaElement[] elements = new IJavaElement[1];
1047
		elements[0] = selectMethod(this.workingCopies[0], "foo", 2);
1048
		assertElementsEqual("Invalid selection(s)",
1049
			"foo() [in X [in [Working copy] X.java [in b191322 [in <project root> [in Tests]]]]]",
1050
			elements
1051
		);
1052
	}
1053
	public void testBug191322b() throws CoreException {
1054
		this.wcOwner = new WorkingCopyOwner() {};
1055
		workingCopies = new ICompilationUnit[1];
1056
		workingCopies[0] = getWorkingCopy("/Tests/b191322/X.java",
1057
			"package b191322;\n" + 
1058
			"public class X {\n" + 
1059
			"	void foo() {}\n" + 
1060
			"}\n" + 
1061
			"class Y extends X {}\n" + 
1062
			"class W extends Y {}\n" + 
1063
			"class Z extends W {\n" + 
1064
			"	/**\n" + 
1065
			"	 * @see #foo\n" + 
1066
			"	 */\n" + 
1067
			"	void hoo() {}\n" + 
1068
			"}\n"
1069
		);
1070
		IJavaElement[] elements = new IJavaElement[1];
1071
		elements[0] = selectMethod(this.workingCopies[0], "foo", 2);
1072
		assertElementsEqual("Invalid selection(s)",
1073
			"foo() [in X [in [Working copy] X.java [in b191322 [in <project root> [in Tests]]]]]",
1074
			elements
1075
		);
1076
	}
1077
	public void testBug191322c() throws CoreException {
1078
		this.wcOwner = new WorkingCopyOwner() {};
1079
		workingCopies = new ICompilationUnit[1];
1080
		workingCopies[0] = getWorkingCopy("/Tests/b191322/X.java",
1081
			"package b191322;\n" + 
1082
			"public interface X {\n" + 
1083
			"	void foo();\n" + 
1084
			"}\n" + 
1085
			"interface Y extends X {\n" + 
1086
			"	/**\n" + 
1087
			"	 * {@link #foo}\n" + 
1088
			"	 */\n" + 
1089
			"	void hoo();\n" + 
1090
			"}\n"
1091
		);
1092
		IJavaElement[] elements = new IJavaElement[1];
1093
		elements[0] = selectMethod(this.workingCopies[0], "foo", 2);
1094
		assertElementsEqual("Invalid selection(s)",
1095
			"foo() [in X [in [Working copy] X.java [in b191322 [in <project root> [in Tests]]]]]",
1096
			elements
1097
		);
1098
	}
1099
	public void testBug191322d() throws CoreException {
1100
		this.wcOwner = new WorkingCopyOwner() {};
1101
		workingCopies = new ICompilationUnit[1];
1102
		workingCopies[0] = getWorkingCopy("/Tests/b191322/X.java",
1103
			"package b191322;\n" + 
1104
			"public interface X {\n" + 
1105
			"	void foo();\n" + 
1106
			"}\n" + 
1107
			"interface Y extends X {}\n" + 
1108
			"abstract class W implements Y {}\n" + 
1109
			"abstract class Z extends W {\n" + 
1110
			"	/**\n" + 
1111
			"	 * @see #foo\n" + 
1112
			"	 */\n" + 
1113
			"	void hoo() {}\n" + 
1114
			"}\n"
1115
		);
1116
		IJavaElement[] elements = new IJavaElement[1];
1117
		elements[0] = selectMethod(this.workingCopies[0], "foo", 2);
1118
		assertElementsEqual("Invalid selection(s)",
1119
			"foo() [in X [in [Working copy] X.java [in b191322 [in <project root> [in Tests]]]]]",
1120
			elements
1121
		);
1122
	}
1123
	public void testBug191322e() throws CoreException {
1124
		this.wcOwner = new WorkingCopyOwner() {};
1125
		workingCopies = new ICompilationUnit[1];
1126
		workingCopies[0] = getWorkingCopy("/Tests/b191322/X.java",
1127
			"package b191322;\n" + 
1128
			"public class X {\n" + 
1129
			"	void foo() {}\n" + 
1130
			"	class Y {\n" + 
1131
			"		/**\n" + 
1132
			"		 * @see #foo\n" + 
1133
			"		 */\n" + 
1134
			"		void hoo() {}\n" + 
1135
			"	}\n" + 
1136
			"}\n"
1137
		);
1138
		IJavaElement[] elements = new IJavaElement[1];
1139
		elements[0] = selectMethod(this.workingCopies[0], "foo", 2);
1140
		assertElementsEqual("Invalid selection(s)",
1141
			"foo() [in X [in [Working copy] X.java [in b191322 [in <project root> [in Tests]]]]]",
1142
			elements
1143
		);
1144
	}
1145
	public void testBug191322f() throws CoreException {
1146
		this.wcOwner = new WorkingCopyOwner() {};
1147
		workingCopies = new ICompilationUnit[1];
1148
		workingCopies[0] = getWorkingCopy("/Tests/b191322/X.java",
1149
			"package b191322;\n" + 
1150
			"public class X {\n" + 
1151
			"	void foo() {}\n" + 
1152
			"	void foo(String str) {}\n" + 
1153
			"}\n" + 
1154
			"class Y extends X {\n" + 
1155
			"	/**\n" + 
1156
			"	 * @see #foo\n" + 
1157
			"	 */\n" + 
1158
			"	void hoo() {}\n" + 
1159
			"}\n"
1160
		);
1161
		IJavaElement[] elements = new IJavaElement[1];
1162
		elements[0] = selectMethod(this.workingCopies[0], "foo", 3);
1163
		assertElementsEqual("Invalid selection(s)",
1164
			"foo() [in X [in [Working copy] X.java [in b191322 [in <project root> [in Tests]]]]]",
1165
			elements
1166
		);
1167
	}
1168
	public void testBug191322g() throws CoreException {
1169
		this.wcOwner = new WorkingCopyOwner() {};
1170
		workingCopies = new ICompilationUnit[1];
1171
		workingCopies[0] = getWorkingCopy("/Tests/b191322/X.java",
1172
			"package b191322;\n" + 
1173
			"public class X {\n" + 
1174
			"	void foo(String str) {}\n" + 
1175
			"	void foo() {}\n" + 
1176
			"}\n" + 
1177
			"class Y extends X {\n" + 
1178
			"	/**\n" + 
1179
			"	 * {@link #foo}\n" + 
1180
			"	 */\n" + 
1181
			"	void hoo() {}\n" + 
1182
			"}\n"
1183
		);
1184
		IJavaElement[] elements = new IJavaElement[1];
1185
		elements[0] = selectMethod(this.workingCopies[0], "foo", 3);
1186
		assertElementsEqual("Invalid selection(s)",
1187
			"foo(String) [in X [in [Working copy] X.java [in b191322 [in <project root> [in Tests]]]]]",
1188
			elements
1189
		);
1190
	}
1191
	public void testBug191322h() throws CoreException {
1192
		this.wcOwner = new WorkingCopyOwner() {};
1193
		workingCopies = new ICompilationUnit[1];
1194
		workingCopies[0] = getWorkingCopy("/Tests/b191322/X.java",
1195
			"package b191322;\n" + 
1196
			"public class X {\n" + 
1197
			"	void foo(String str) {}\n" + 
1198
			"	void foo(int x) {}\n" + 
1199
			"}\n" + 
1200
			"class Y extends X {\n" + 
1201
			"	/**\n" + 
1202
			"	 * @see #foo\n" + 
1203
			"	 */\n" + 
1204
			"	void hoo() {}\n" + 
1205
			"}\n"
1206
		);
1207
		IJavaElement[] elements = new IJavaElement[1];
1208
		elements[0] = selectMethod(this.workingCopies[0], "foo", 3);
1209
		assertElementsEqual("Invalid selection(s)",
1210
			"foo(String) [in X [in [Working copy] X.java [in b191322 [in <project root> [in Tests]]]]]",
1211
			elements
1212
		);
1213
	}
1214
	public void testBug191322i() throws CoreException {
1215
		this.wcOwner = new WorkingCopyOwner() {};
1216
		workingCopies = new ICompilationUnit[1];
1217
		workingCopies[0] = getWorkingCopy("/Tests/b191322/X.java",
1218
			"package b191322;\n" + 
1219
			"public class X {\n" + 
1220
			"	void foo(String str) {}\n" + 
1221
			"}\n" + 
1222
			"class Y extends X {\n" + 
1223
			"	/**\n" + 
1224
			"	 * @see #foo\n" + 
1225
			"	 */\n" + 
1226
			"	void hoo() {}\n" + 
1227
			"}\n"
1228
		);
1229
		IJavaElement[] elements = new IJavaElement[1];
1230
		elements[0] = selectMethod(this.workingCopies[0], "foo", 2);
1231
		assertElementsEqual("Invalid selection(s)",
1232
			"foo(String) [in X [in [Working copy] X.java [in b191322 [in <project root> [in Tests]]]]]",
1233
			elements
1234
		);
1235
	}
1025
}
1236
}

Return to bug 191322