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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java (+315 lines)
Lines 949-954 Link Here
949
			false
949
			false
950
		);
950
		);
951
	}
951
	}
952
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=262209
953
	public void test014i() {
954
		this.runNegativeTest(
955
			new String[] {
956
				"X.java",
957
				"interface I<T> {}\n" +
958
				"interface J<T> extends I<T> {}\n" +
959
				"\n" +
960
				"class X {\n" +
961
				"	void a(G x) {}\n" +
962
				"	<T extends C, S extends F<T>> void a(S x) {}\n" +
963
				"\n" +
964
				"	void b(G x) {}\n" +
965
				"	void b(F x) {}\n" +
966
				"\n" +
967
				"	void c(G x) {}\n" +
968
				"	void c(F<?> x) {}\n" +
969
				"\n" +
970
				"	void d(G x) {}\n" +
971
				"	void d(F<C> x) {}\n" +
972
				"\n" +
973
				"	void e(G x) {}\n" +
974
				"	<T extends C> void e(F<T> x) {}\n" +
975
				"\n" +
976
				"	void f(G x) {}\n" +
977
				"	<S extends F> void f(S x) {}\n" +
978
				"\n" +
979
				"	void g(G x) {}\n" +
980
				"	<S extends F & J<S>> void g(S x) {}\n" +
981
				"\n" +
982
				"	<T extends G> void a2(T x) {}\n" +
983
				"	<T extends C, S extends F<T>> void a2(S x) {}\n" +
984
				"\n" +
985
				"	<T extends G> void b2(T x) {}\n" +
986
				"	void b2(F x) {}\n" +
987
				"\n" +
988
				"	<T extends G> void c2(T x) {}\n" +
989
				"	void c2(F<?> x) {}\n" +
990
				"\n" +
991
				"	<T extends G> void d2(T x) {}\n" +
992
				"	void d2(F<C> x) {}\n" +
993
				"\n" +
994
				"	<T extends G> void e2(T x) {}\n" +
995
				"	<T extends C> void e2(F<T> x) {}\n" +
996
				"\n" +
997
				"	<T extends G> void f2(T x) {}\n" +
998
				"	<S extends F & J> void f2(S x) {}\n" +
999
				"\n" +
1000
				"	<T extends G> void g2(T x) {}\n" +
1001
				"	<S extends F & J<S>> void g2(S x) {}\n" +
1002
				"\n" +
1003
				"	void test() {\n" +
1004
				"		X x = new X();\n" +
1005
				"		H<C> h = null;\n" +
1006
				"		H hraw = null;\n" +
1007
				"\n" +
1008
				"		x.a(h);\n" +
1009
				"		x.a(hraw);\n" +
1010
				"\n" +
1011
				"		x.b(h);\n" +
1012
				"		x.b(hraw);\n" +
1013
				"\n" +
1014
				"		x.c(h);\n" +
1015
				"		x.c(hraw);\n" +
1016
				"\n" +
1017
				"		x.d(h);\n" +
1018
				"		x.d(hraw);\n" +
1019
				"\n" +
1020
				"		x.e(h);\n" +
1021
				"		x.e(hraw);\n" +
1022
				"\n" +
1023
				"		x.f(h);\n" +
1024
				"		x.f(hraw);\n" +
1025
				"\n" +
1026
				"		x.g(h);\n" +
1027
				"		x.g(hraw);\n" +
1028
				"\n" +
1029
				"		x.a2(h);\n" +
1030
				"		x.a2(hraw);\n" +
1031
				"\n" +
1032
				"		x.b2(h);	\n" +
1033
				"		x.b2(hraw);\n" +
1034
				"\n" +
1035
				"		x.c2(h);\n" +
1036
				"		x.c2(hraw);\n" +
1037
				"\n" +
1038
				"		x.d2(h);\n" +
1039
				"		x.d2(hraw);\n" +
1040
				"\n" +
1041
				"		x.e2(h);\n" +
1042
				"		x.e2(hraw);\n" +
1043
				"\n" +
1044
				"		x.f2(h);\n" +
1045
				"		x.f2(hraw);\n" +
1046
				"\n" +
1047
				"		x.g2(h);	\n" +
1048
				"		x.g2(hraw);\n" +
1049
				"	}\n" +
1050
				"}\n" +
1051
				"\n" +
1052
				"class A {}\n" +
1053
				"class B extends A {}\n" +
1054
				"class C extends B implements I {}\n" +
1055
				"class F<T1> {} \n" +
1056
				"class G<T2> extends F<T2> implements J<T2> {}\n" +
1057
				"class H<T3> extends G<T3> {}\n"
1058
			},
1059
			"----------\n" + 
1060
			"1. WARNING in X.java (at line 5)\n" + 
1061
			"	void a(G x) {}\n" + 
1062
			"	       ^\n" + 
1063
			"G is a raw type. References to generic type G<T2> should be parameterized\n" + 
1064
			"----------\n" + 
1065
			"2. WARNING in X.java (at line 8)\n" + 
1066
			"	void b(G x) {}\n" + 
1067
			"	       ^\n" + 
1068
			"G is a raw type. References to generic type G<T2> should be parameterized\n" + 
1069
			"----------\n" + 
1070
			"3. WARNING in X.java (at line 9)\n" + 
1071
			"	void b(F x) {}\n" + 
1072
			"	       ^\n" + 
1073
			"F is a raw type. References to generic type F<T1> should be parameterized\n" + 
1074
			"----------\n" + 
1075
			"4. WARNING in X.java (at line 11)\n" + 
1076
			"	void c(G x) {}\n" + 
1077
			"	       ^\n" + 
1078
			"G is a raw type. References to generic type G<T2> should be parameterized\n" + 
1079
			"----------\n" + 
1080
			"5. WARNING in X.java (at line 14)\n" + 
1081
			"	void d(G x) {}\n" + 
1082
			"	       ^\n" + 
1083
			"G is a raw type. References to generic type G<T2> should be parameterized\n" + 
1084
			"----------\n" + 
1085
			"6. WARNING in X.java (at line 17)\n" + 
1086
			"	void e(G x) {}\n" + 
1087
			"	       ^\n" + 
1088
			"G is a raw type. References to generic type G<T2> should be parameterized\n" + 
1089
			"----------\n" + 
1090
			"7. WARNING in X.java (at line 20)\n" + 
1091
			"	void f(G x) {}\n" + 
1092
			"	       ^\n" + 
1093
			"G is a raw type. References to generic type G<T2> should be parameterized\n" + 
1094
			"----------\n" + 
1095
			"8. WARNING in X.java (at line 21)\n" + 
1096
			"	<S extends F> void f(S x) {}\n" + 
1097
			"	           ^\n" + 
1098
			"F is a raw type. References to generic type F<T1> should be parameterized\n" + 
1099
			"----------\n" + 
1100
			"9. WARNING in X.java (at line 23)\n" + 
1101
			"	void g(G x) {}\n" + 
1102
			"	       ^\n" + 
1103
			"G is a raw type. References to generic type G<T2> should be parameterized\n" + 
1104
			"----------\n" + 
1105
			"10. WARNING in X.java (at line 24)\n" + 
1106
			"	<S extends F & J<S>> void g(S x) {}\n" + 
1107
			"	           ^\n" + 
1108
			"F is a raw type. References to generic type F<T1> should be parameterized\n" + 
1109
			"----------\n" + 
1110
			"11. WARNING in X.java (at line 26)\n" + 
1111
			"	<T extends G> void a2(T x) {}\n" + 
1112
			"	           ^\n" + 
1113
			"G is a raw type. References to generic type G<T2> should be parameterized\n" + 
1114
			"----------\n" + 
1115
			"12. WARNING in X.java (at line 29)\n" + 
1116
			"	<T extends G> void b2(T x) {}\n" + 
1117
			"	           ^\n" + 
1118
			"G is a raw type. References to generic type G<T2> should be parameterized\n" + 
1119
			"----------\n" + 
1120
			"13. WARNING in X.java (at line 30)\n" + 
1121
			"	void b2(F x) {}\n" + 
1122
			"	        ^\n" + 
1123
			"F is a raw type. References to generic type F<T1> should be parameterized\n" + 
1124
			"----------\n" + 
1125
			"14. WARNING in X.java (at line 32)\n" + 
1126
			"	<T extends G> void c2(T x) {}\n" + 
1127
			"	           ^\n" + 
1128
			"G is a raw type. References to generic type G<T2> should be parameterized\n" + 
1129
			"----------\n" + 
1130
			"15. WARNING in X.java (at line 35)\n" + 
1131
			"	<T extends G> void d2(T x) {}\n" + 
1132
			"	           ^\n" + 
1133
			"G is a raw type. References to generic type G<T2> should be parameterized\n" + 
1134
			"----------\n" + 
1135
			"16. WARNING in X.java (at line 38)\n" + 
1136
			"	<T extends G> void e2(T x) {}\n" + 
1137
			"	           ^\n" + 
1138
			"G is a raw type. References to generic type G<T2> should be parameterized\n" + 
1139
			"----------\n" + 
1140
			"17. WARNING in X.java (at line 41)\n" + 
1141
			"	<T extends G> void f2(T x) {}\n" + 
1142
			"	           ^\n" + 
1143
			"G is a raw type. References to generic type G<T2> should be parameterized\n" + 
1144
			"----------\n" + 
1145
			"18. WARNING in X.java (at line 42)\n" + 
1146
			"	<S extends F & J> void f2(S x) {}\n" + 
1147
			"	           ^\n" + 
1148
			"F is a raw type. References to generic type F<T1> should be parameterized\n" + 
1149
			"----------\n" + 
1150
			"19. WARNING in X.java (at line 42)\n" + 
1151
			"	<S extends F & J> void f2(S x) {}\n" + 
1152
			"	               ^\n" + 
1153
			"J is a raw type. References to generic type J<T> should be parameterized\n" + 
1154
			"----------\n" + 
1155
			"20. WARNING in X.java (at line 44)\n" + 
1156
			"	<T extends G> void g2(T x) {}\n" + 
1157
			"	           ^\n" + 
1158
			"G is a raw type. References to generic type G<T2> should be parameterized\n" + 
1159
			"----------\n" + 
1160
			"21. WARNING in X.java (at line 45)\n" + 
1161
			"	<S extends F & J<S>> void g2(S x) {}\n" + 
1162
			"	           ^\n" + 
1163
			"F is a raw type. References to generic type F<T1> should be parameterized\n" + 
1164
			"----------\n" + 
1165
			"22. WARNING in X.java (at line 50)\n" + 
1166
			"	H hraw = null;\n" + 
1167
			"	^\n" + 
1168
			"H is a raw type. References to generic type H<T3> should be parameterized\n" + 
1169
			"----------\n" + 
1170
			"23. ERROR in X.java (at line 52)\n" + 
1171
			"	x.a(h);\n" + 
1172
			"	  ^\n" + 
1173
			"The method a(G) is ambiguous for the type X\n" + 
1174
			"----------\n" + 
1175
			"24. ERROR in X.java (at line 53)\n" + 
1176
			"	x.a(hraw);\n" + 
1177
			"	  ^\n" + 
1178
			"The method a(G) is ambiguous for the type X\n" + 
1179
			"----------\n" + 
1180
			"25. ERROR in X.java (at line 58)\n" + 
1181
			"	x.c(h);\n" + 
1182
			"	  ^\n" + 
1183
			"The method c(G) is ambiguous for the type X\n" + 
1184
			"----------\n" + 
1185
			"26. ERROR in X.java (at line 59)\n" + 
1186
			"	x.c(hraw);\n" + 
1187
			"	  ^\n" + 
1188
			"The method c(G) is ambiguous for the type X\n" + 
1189
			"----------\n" + 
1190
			"27. ERROR in X.java (at line 61)\n" + 
1191
			"	x.d(h);\n" + 
1192
			"	  ^\n" + 
1193
			"The method d(G) is ambiguous for the type X\n" + 
1194
			"----------\n" + 
1195
			"28. ERROR in X.java (at line 62)\n" + 
1196
			"	x.d(hraw);\n" + 
1197
			"	  ^\n" + 
1198
			"The method d(G) is ambiguous for the type X\n" + 
1199
			"----------\n" + 
1200
			"29. ERROR in X.java (at line 64)\n" + 
1201
			"	x.e(h);\n" + 
1202
			"	  ^\n" + 
1203
			"The method e(G) is ambiguous for the type X\n" + 
1204
			"----------\n" + 
1205
			"30. ERROR in X.java (at line 65)\n" + 
1206
			"	x.e(hraw);\n" + 
1207
			"	  ^\n" + 
1208
			"The method e(G) is ambiguous for the type X\n" + 
1209
			"----------\n" + 
1210
			"31. ERROR in X.java (at line 71)\n" + 
1211
			"	x.g(hraw);\n" + 
1212
			"	  ^\n" + 
1213
			"The method g(G) is ambiguous for the type X\n" + 
1214
			"----------\n" + 
1215
			"32. ERROR in X.java (at line 73)\n" + 
1216
			"	x.a2(h);\n" + 
1217
			"	  ^^\n" + 
1218
			"The method a2(H<C>) is ambiguous for the type X\n" + 
1219
			"----------\n" + 
1220
			"33. ERROR in X.java (at line 74)\n" + 
1221
			"	x.a2(hraw);\n" + 
1222
			"	  ^^\n" + 
1223
			"The method a2(H) is ambiguous for the type X\n" + 
1224
			"----------\n" + 
1225
			"34. ERROR in X.java (at line 79)\n" + 
1226
			"	x.c2(h);\n" + 
1227
			"	  ^^\n" + 
1228
			"The method c2(H<C>) is ambiguous for the type X\n" + 
1229
			"----------\n" + 
1230
			"35. ERROR in X.java (at line 80)\n" + 
1231
			"	x.c2(hraw);\n" + 
1232
			"	  ^^\n" + 
1233
			"The method c2(H) is ambiguous for the type X\n" + 
1234
			"----------\n" + 
1235
			"36. ERROR in X.java (at line 82)\n" + 
1236
			"	x.d2(h);\n" + 
1237
			"	  ^^\n" + 
1238
			"The method d2(H<C>) is ambiguous for the type X\n" + 
1239
			"----------\n" + 
1240
			"37. ERROR in X.java (at line 83)\n" + 
1241
			"	x.d2(hraw);\n" + 
1242
			"	  ^^\n" + 
1243
			"The method d2(H) is ambiguous for the type X\n" + 
1244
			"----------\n" + 
1245
			"38. ERROR in X.java (at line 85)\n" + 
1246
			"	x.e2(h);\n" + 
1247
			"	  ^^\n" + 
1248
			"The method e2(H<C>) is ambiguous for the type X\n" + 
1249
			"----------\n" + 
1250
			"39. ERROR in X.java (at line 86)\n" + 
1251
			"	x.e2(hraw);\n" + 
1252
			"	  ^^\n" + 
1253
			"The method e2(H) is ambiguous for the type X\n" + 
1254
			"----------\n" + 
1255
			"40. ERROR in X.java (at line 92)\n" + 
1256
			"	x.g2(hraw);\n" + 
1257
			"	  ^^\n" + 
1258
			"The method g2(H) is ambiguous for the type X\n" + 
1259
			"----------\n" + 
1260
			"41. WARNING in X.java (at line 98)\n" + 
1261
			"	class C extends B implements I {}\n" + 
1262
			"	                             ^\n" + 
1263
			"I is a raw type. References to generic type I<T> should be parameterized\n" + 
1264
			"----------\n"
1265
		);
1266
	}
952
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=79798
1267
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=79798
953
	public void test015() {
1268
	public void test015() {
954
		this.runConformTest(
1269
		this.runConformTest(
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java (+23 lines)
Lines 148-153 Link Here
148
			return false;
148
			return false;
149
	return true;
149
	return true;
150
}
150
}
151
MethodBinding asRawMethod(LookupEnvironment env) {
152
	if (this.typeVariables == Binding.NO_TYPE_VARIABLES) return this;
153
154
	// substitute type arguments with raw types
155
	int length = this.typeVariables.length;
156
	TypeBinding[] arguments = new TypeBinding[length];
157
	for (int i = 0; i < length; i++) {
158
		TypeVariableBinding var = this.typeVariables[i];
159
		if (var.boundsCount() <= 1) {
160
			arguments[i] = env.convertToRawType(var.upperBound(), false /*do not force conversion of enclosing types*/);
161
		} else {
162
			// use an intersection type to retain full bound information if more than 1 bound
163
			TypeBinding rawSuperclass = env.convertToRawType(var.superclass(), false);
164
			TypeBinding[] itsSuperinterfaces = var.superInterfaces();
165
			int superLength = itsSuperinterfaces.length;
166
			TypeBinding[] rawSuperinterfaces = new TypeBinding[superLength];
167
			for (int s = 0; s < superLength; s++)
168
				rawSuperinterfaces[s] = env.convertToRawType(itsSuperinterfaces[s], false);
169
			arguments[i] = env.createWildcard(null, 0, rawSuperclass, rawSuperinterfaces, org.eclipse.jdt.internal.compiler.ast.Wildcard.EXTENDS);
170
		}
171
	}
172
	return env.createParameterizedGenericMethod(this, arguments);
173
}
151
/* Answer true if the receiver is visible to the type provided by the scope.
174
/* Answer true if the receiver is visible to the type provided by the scope.
152
* InvocationSite implements isSuperAccess() to provide additional information
175
* InvocationSite implements isSuperAccess() to provide additional information
153
* if the receiver is protected.
176
* if the receiver is protected.
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java (-18 / +3 lines)
Lines 11-17 Link Here
11
package org.eclipse.jdt.internal.compiler.lookup;
11
package org.eclipse.jdt.internal.compiler.lookup;
12
12
13
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
13
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
14
import org.eclipse.jdt.internal.compiler.ast.Wildcard;
15
14
16
/**
15
/**
17
 * Binding denoting a generic method after type parameter substitutions got performed.
16
 * Binding denoting a generic method after type parameter substitutions got performed.
Lines 485-506 Link Here
485
	 * @see org.eclipse.jdt.internal.compiler.lookup.MethodBinding#tiebreakMethod()
484
	 * @see org.eclipse.jdt.internal.compiler.lookup.MethodBinding#tiebreakMethod()
486
	 */
485
	 */
487
	public MethodBinding tiebreakMethod() {
486
	public MethodBinding tiebreakMethod() {
488
		if (this.tiebreakMethod == null) {
487
		if (this.tiebreakMethod == null)
489
			TypeVariableBinding[] originalVariables = this.originalMethod.typeVariables;
488
			this.tiebreakMethod = this.originalMethod.asRawMethod(this.environment);
490
			int length = originalVariables.length;
491
			TypeBinding[] newArguments = new TypeBinding[length];
492
			for (int i = 0; i < length; i++) {
493
				TypeVariableBinding originalVariable = originalVariables[i];
494
				if (originalVariable.boundsCount() <= 1) {
495
					newArguments[i] = this.environment.convertToRawType(originalVariable.upperBound(), false /*do not force conversion of enclosing types*/);
496
				} else {
497
					newArguments[i] = this.environment.convertToRawType(
498
							// use an intersection type to retain full bound information
499
							this.environment.createWildcard(null, 0, originalVariable.superclass(), originalVariable.superInterfaces(), Wildcard.EXTENDS), false /*do not force conversion of enclosing types*/);
500
				}
501
			}
502
			this.tiebreakMethod = this.environment.createParameterizedGenericMethod(this.originalMethod, newArguments);
503
		}
504
		return this.tiebreakMethod;
489
		return this.tiebreakMethod;
505
	}
490
	}
506
}
491
}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java (+11 lines)
Lines 290-295 Link Here
290
		return this.genericTypeSignature = CharOperation.concat('T', this.sourceName, ';');
290
		return this.genericTypeSignature = CharOperation.concat('T', this.sourceName, ';');
291
	}
291
	}
292
292
293
	boolean hasOnlyRawBounds() {
294
		if (this.superclass != null && !this.superclass.isRawType())
295
			return false;
296
297
		if (this.superInterfaces != null)
298
			for (int i = 0, l = this.superInterfaces.length; i < l; i++)
299
		   		if (!this.superInterfaces[i].isRawType())
300
		   			return false;
301
302
		return true;
303
	}
293
	/**
304
	/**
294
	 * Returns true if the type variable is directly bound to a given type
305
	 * Returns true if the type variable is directly bound to a given type
295
	 */
306
	 */
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java (-25 / +24 lines)
Lines 2778-2813 Link Here
2778
		int oneParamsLength = oneParams.length;
2778
		int oneParamsLength = oneParams.length;
2779
		int twoParamsLength = twoParams.length;
2779
		int twoParamsLength = twoParams.length;
2780
		if (oneParamsLength == twoParamsLength) {
2780
		if (oneParamsLength == twoParamsLength) {
2781
			for (int i = 0; i < oneParamsLength; i++) {
2781
			next : for (int i = 0; i < oneParamsLength; i++) {
2782
				TypeBinding oneParam = oneParams[i];
2782
				TypeBinding oneParam = oneParams[i];
2783
				TypeBinding twoParam = twoParams[i];
2783
				TypeBinding twoParam = twoParams[i];
2784
				if (oneParam == twoParam) {
2784
				if (oneParam == twoParam || oneParam.isCompatibleWith(twoParam)) {
2785
					if (twoParam.leafComponentType().isRawType()) {
2785
					if (two.declaringClass.isRawType()) continue next;
2786
						// must detect & reject this case
2786
2787
						// when Y<U> extends X<U>
2787
					TypeBinding originalOneParam = one.original().parameters[i].leafComponentType();
2788
						// void foo(Y y) {}
2788
					switch (originalOneParam.kind()) {
2789
						// <T extends X<Object>> void foo(T t) {}
2789
					   	case Binding.TYPE_PARAMETER :
2790
						// foo(T) will show up as foo(Y#RAW) and not foo(X#RAW)
2790
					   		if (!((TypeVariableBinding) originalOneParam).upperBound().isRawType()) break;
2791
						// Y#RAW is not more specific than a rawified X<T>
2791
					   		//$FALL-THROUGH$
2792
						TypeBinding originalOneParam = one.original().parameters[i].leafComponentType();
2792
					   	case Binding.RAW_TYPE:
2793
						if ((originalOneParam.isTypeVariable() ? ((TypeVariableBinding) originalOneParam).upperBound()
2793
					   		// originalOneParam is RAW so it cannot be more specific than a wildcard or parameterized type
2794
								: originalOneParam).isRawType())
2794
							TypeBinding originalTwoParam = two.original().parameters[i].leafComponentType();
2795
							if (twoParam.leafComponentType().erasure() != two.original().parameters[i]
2795
							switch (originalTwoParam.kind()) {
2796
									.leafComponentType().erasure())
2796
							   	case Binding.TYPE_PARAMETER :
2797
								return false;
2797
							   		if (((TypeVariableBinding) originalTwoParam).hasOnlyRawBounds())
2798
					}
2798
								   		continue next;
2799
				} else if (oneParam.isCompatibleWith(twoParam)) {
2799
								   	return false;
2800
					if (oneParam.leafComponentType().isRawType()) {
2800
							   	case Binding.WILDCARD_TYPE :
2801
						if (oneParam.needsUncheckedConversion(twoParam))
2801
							   	case Binding.INTERSECTION_TYPE:
2802
							if (oneParam.leafComponentType().erasure() != twoParam.leafComponentType().erasure())
2802
							   	case Binding.PARAMETERIZED_TYPE :
2803
								return false;
2803
							   		return false;
2804
							}
2804
					}
2805
					}
2805
				} else {
2806
				} else {
2806
					if (i == oneParamsLength - 1 && one.isVarargs() && two.isVarargs()) {
2807
					if (i == oneParamsLength - 1 && one.isVarargs() && two.isVarargs()) {
2807
						TypeBinding eType = ((ArrayBinding) twoParam).elementsType();
2808
						TypeBinding eType = ((ArrayBinding) twoParam).elementsType();
2808
						if (oneParam == eType || oneParam.isCompatibleWith(eType))
2809
						if (oneParam == eType || oneParam.isCompatibleWith(eType))
2809
							return true; // special case to choose between 2 varargs methods when the last arg is
2810
							return true; // special case to choose between 2 varargs methods when the last arg is Object[]
2810
											// Object[]
2811
					}
2811
					}
2812
					return false;
2812
					return false;
2813
				}
2813
				}
Lines 2817-2824 Link Here
2817
2817
2818
		if (one.isVarargs() && two.isVarargs()) {
2818
		if (one.isVarargs() && two.isVarargs()) {
2819
			if (oneParamsLength > twoParamsLength) {
2819
			if (oneParamsLength > twoParamsLength) {
2820
				// special case when autoboxing makes (int, int...) better than (Object...) but not (int...) or
2820
				// special case when autoboxing makes (int, int...) better than (Object...) but not (int...) or (Integer, int...)
2821
				// (Integer, int...)
2822
				if (((ArrayBinding) twoParams[twoParamsLength - 1]).elementsType().id != TypeIds.T_JavaLangObject)
2821
				if (((ArrayBinding) twoParams[twoParamsLength - 1]).elementsType().id != TypeIds.T_JavaLangObject)
2823
					return false;
2822
					return false;
2824
			}
2823
			}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java (-3 / +3 lines)
Lines 68-79 Link Here
68
	        case Wildcard.UNBOUND :
68
	        case Wildcard.UNBOUND :
69
	            return true;
69
	            return true;
70
	        case Wildcard.EXTENDS :
70
	        case Wildcard.EXTENDS :
71
	            if (argumentType.isCompatibleWith(this.bound)) return true;
71
	            if (!argumentType.isCompatibleWith(this.bound)) return false;
72
	            // check other bounds (lub scenario)
72
	            // check other bounds (lub scenario)
73
            	for (int i = 0, length = this.otherBounds == null ? 0 : this.otherBounds.length; i < length; i++) {
73
            	for (int i = 0, length = this.otherBounds == null ? 0 : this.otherBounds.length; i < length; i++) {
74
            		if (argumentType.isCompatibleWith(this.otherBounds[i])) return true;
74
            		if (!argumentType.isCompatibleWith(this.otherBounds[i])) return false;
75
            	}
75
            	}
76
            	return false;
76
            	return true;
77
	        default: // SUPER
77
	        default: // SUPER
78
	        	// ? super Exception   ok for:  IOException, since it would be ok for (Exception)ioException
78
	        	// ? super Exception   ok for:  IOException, since it would be ok for (Exception)ioException
79
	            return argumentType.isCompatibleWith(this.bound);
79
	            return argumentType.isCompatibleWith(this.bound);

Return to bug 262209