View | Details | Raw Unified | Return to bug 132677
Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-103 / +137 lines)
Lines 419-426 Link Here
419
		arguments,
419
		arguments,
420
		arguments,
420
		arguments,
421
		ProblemSeverities.Error | ProblemSeverities.Abort | ProblemSeverities.Fatal,
421
		ProblemSeverities.Error | ProblemSeverities.Abort | ProblemSeverities.Fatal,
422
		location.sourceStart,
422
		nameSourceStart(location),
423
		location.sourceEnd);
423
		nameSourceEnd(location));
424
}
424
}
425
public void abstractMethodCannotBeOverridden(SourceTypeBinding type, MethodBinding concreteMethod) {
425
public void abstractMethodCannotBeOverridden(SourceTypeBinding type, MethodBinding concreteMethod) {
426
426
Lines 776-783 Link Here
776
		IProblem.DirectInvocationOfAbstractMethod,
776
		IProblem.DirectInvocationOfAbstractMethod,
777
		new String[] {new String(method.declaringClass.readableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, false)},
777
		new String[] {new String(method.declaringClass.readableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, false)},
778
		new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, true)},
778
		new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, true)},
779
		messageSend.sourceStart,
779
		nameSourceStart(messageSend),
780
		messageSend.sourceEnd);
780
		nameSourceEnd(messageSend));
781
}
781
}
782
public void cannotExtendEnum(SourceTypeBinding type, TypeReference superclass, TypeBinding superTypeBinding) {
782
public void cannotExtendEnum(SourceTypeBinding type, TypeReference superclass, TypeBinding superTypeBinding) {
783
	String name = new String(type.sourceName());
783
	String name = new String(type.sourceName());
Lines 1139-1156 Link Here
1139
			new String[] {new String(method.declaringClass.readableName()), typesAsString(method.isVarargs(), method.parameters, false)},
1139
			new String[] {new String(method.declaringClass.readableName()), typesAsString(method.isVarargs(), method.parameters, false)},
1140
			new String[] {new String(method.declaringClass.shortReadableName()), typesAsString(method.isVarargs(), method.parameters, true)},
1140
			new String[] {new String(method.declaringClass.shortReadableName()), typesAsString(method.isVarargs(), method.parameters, true)},
1141
			severity,
1141
			severity,
1142
			location.sourceStart,
1142
			nameSourceStart(location),
1143
			location.sourceEnd);
1143
			nameSourceEnd(location));
1144
	} else {
1144
	} else {
1145
		this.handle(
1145
		this.handle(
1146
			IProblem.UsingDeprecatedMethod,
1146
			IProblem.UsingDeprecatedMethod,
1147
			new String[] {new String(method.declaringClass.readableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, false)},
1147
			new String[] {new String(method.declaringClass.readableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, false)},
1148
			new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, true)},
1148
			new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, true)},
1149
			severity,
1149
			severity,
1150
			location.sourceStart,
1150
			nameSourceStart(location),
1151
			location.sourceEnd);
1151
			nameSourceEnd(location));
1152
	}
1152
	}
1153
}
1153
}
1154
private int nameSourceStart(ASTNode node) {
1155
	if (node instanceof MessageSend) {
1156
		MessageSend messageSend = (MessageSend) node;
1157
		return (int) (messageSend.nameSourcePosition >>> 32);
1158
	}
1159
	if (node instanceof AllocationExpression) {
1160
		AllocationExpression allocationExpression = (AllocationExpression) node;
1161
		if (allocationExpression instanceof JavadocAllocationExpression) {
1162
			JavadocAllocationExpression javadocAllocationExpression = (JavadocAllocationExpression) allocationExpression;
1163
			return javadocAllocationExpression.sourceStart;			
1164
		}
1165
		if (allocationExpression.enumConstant != null) {
1166
			return allocationExpression.enumConstant.sourceStart;
1167
		}
1168
		return allocationExpression.type.sourceStart;
1169
	}
1170
	return node.sourceStart;
1171
}
1172
private int nameSourceEnd(ASTNode node) {
1173
	if (node instanceof MessageSend) {
1174
		MessageSend messageSend = (MessageSend) node;
1175
		return (int) messageSend.nameSourcePosition;
1176
	}
1177
	if (node instanceof AllocationExpression) {
1178
		AllocationExpression allocationExpression = (AllocationExpression) node;
1179
		if (allocationExpression instanceof JavadocAllocationExpression) {
1180
			JavadocAllocationExpression javadocAllocationExpression = (JavadocAllocationExpression) allocationExpression;
1181
			return javadocAllocationExpression.originalSourceEnd;			
1182
		}
1183
		if (allocationExpression.enumConstant != null) {
1184
			return allocationExpression.enumConstant.sourceEnd;
1185
		}
1186
		return allocationExpression.type.sourceEnd;
1187
	}
1188
	return node.sourceEnd;
1189
}
1190
private int invocationSiteSourceStart(InvocationSite invocationSite) {
1191
	if (invocationSite instanceof ASTNode) {
1192
		return nameSourceStart((ASTNode) invocationSite);
1193
	}
1194
	return invocationSite.sourceStart();
1195
}
1196
private int invocationSiteSourceEnd(InvocationSite invocationSite) {
1197
	if (invocationSite instanceof ASTNode) {
1198
		return nameSourceEnd((ASTNode) invocationSite);
1199
	}
1200
	return invocationSite.sourceEnd();
1201
}
1154
public void deprecatedType(TypeBinding type, ASTNode location) {
1202
public void deprecatedType(TypeBinding type, ASTNode location) {
1155
	if (location == null) return; // 1G828DN - no type ref for synthetic arguments
1203
	if (location == null) return; // 1G828DN - no type ref for synthetic arguments
1156
	int severity = computeSeverity(IProblem.UsingDeprecatedType);
1204
	int severity = computeSeverity(IProblem.UsingDeprecatedType);
Lines 1491-1498 Link Here
1491
		id,
1539
		id,
1492
		new String[] {new String(recType.readableName()), new String(messageSend.selector), buffer.toString()},
1540
		new String[] {new String(recType.readableName()), new String(messageSend.selector), buffer.toString()},
1493
		new String[] {new String(recType.shortReadableName()), new String(messageSend.selector), shortBuffer.toString()},
1541
		new String[] {new String(recType.shortReadableName()), new String(messageSend.selector), shortBuffer.toString()},
1494
		messageSend.sourceStart,
1542
		nameSourceStart(messageSend),
1495
		messageSend.sourceEnd);
1543
		nameSourceEnd(messageSend));
1496
}
1544
}
1497
public void errorThisSuperInStatic(ASTNode reference) {
1545
public void errorThisSuperInStatic(ASTNode reference) {
1498
	String[] arguments = new String[] {reference.isSuper() ? "super" : "this"}; //$NON-NLS-2$ //$NON-NLS-1$
1546
	String[] arguments = new String[] {reference.isSuper() ? "super" : "this"}; //$NON-NLS-2$ //$NON-NLS-1$
Lines 1645-1652 Link Here
1645
			new String[] { 
1693
			new String[] { 
1646
				MessageFormat.format(messageTemplate,
1694
				MessageFormat.format(messageTemplate,
1647
						new String[]{new String(method.shortReadableName())})},
1695
						new String[]{new String(method.shortReadableName())})},
1648
			location.sourceStart,
1696
			nameSourceStart(location),
1649
			location.sourceEnd);
1697
			nameSourceEnd(location));
1650
	else
1698
	else
1651
		this.handle(
1699
		this.handle(
1652
			problemId,
1700
			problemId,
Lines 1656-1663 Link Here
1656
					new String[]{
1704
					new String[]{
1657
						new String(method.shortReadableName()),
1705
						new String(method.shortReadableName()),
1658
				        new String(method.declaringClass.shortReadableName())})},
1706
				        new String(method.declaringClass.shortReadableName())})},
1659
			location.sourceStart,
1707
			nameSourceStart(location),
1660
			location.sourceEnd);
1708
			nameSourceEnd(location));
1661
}
1709
}
1662
public void forbiddenReference(TypeBinding type, ASTNode location, String messageTemplate, int problemId) {
1710
public void forbiddenReference(TypeBinding type, ASTNode location, String messageTemplate, int problemId) {
1663
	if (location == null) return;
1711
	if (location == null) return;
Lines 2210-2217 Link Here
2210
		IProblem.InvalidVoidExpression,
2258
		IProblem.InvalidVoidExpression,
2211
		NoArgument,
2259
		NoArgument,
2212
		NoArgument,
2260
		NoArgument,
2213
		location.sourceStart,
2261
		nameSourceStart(location),
2214
		location.sourceEnd);
2262
		nameSourceEnd(location));
2215
}
2263
}
2216
public void importProblem(ImportReference importRef, Binding expectedImport) {
2264
public void importProblem(ImportReference importRef, Binding expectedImport) {
2217
	if (expectedImport instanceof FieldBinding) {
2265
	if (expectedImport instanceof FieldBinding) {
Lines 2409-2416 Link Here
2409
		new String[] {new String(method.declaringClass.readableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, false)},
2457
		new String[] {new String(method.declaringClass.readableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, false)},
2410
		new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, true)},
2458
		new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, true)},
2411
		severity,
2459
		severity,
2412
		location.sourceStart,
2460
		nameSourceStart(location),
2413
		location.sourceEnd);
2461
		nameSourceEnd(location));
2414
}
2462
}
2415
public void inheritedMethodReducesVisibility(SourceTypeBinding type, MethodBinding concreteMethod, MethodBinding[] abstractMethods) {
2463
public void inheritedMethodReducesVisibility(SourceTypeBinding type, MethodBinding concreteMethod, MethodBinding[] abstractMethods) {
2416
	StringBuffer concreteSignature = new StringBuffer();
2464
	StringBuffer concreteSignature = new StringBuffer();
Lines 2551-2565 Link Here
2551
		(statement instanceof ExplicitConstructorCall)
2599
		(statement instanceof ExplicitConstructorCall)
2552
			&& (((ExplicitConstructorCall) statement).accessMode == ExplicitConstructorCall.ImplicitSuper);
2600
			&& (((ExplicitConstructorCall) statement).accessMode == ExplicitConstructorCall.ImplicitSuper);
2553
2601
2554
	int sourceStart = statement.sourceStart;
2602
	int sourceStart = nameSourceStart(statement);
2555
	int sourceEnd = statement.sourceEnd;
2603
	int sourceEnd = nameSourceEnd(statement);
2556
	if (statement instanceof AllocationExpression) {
2557
		AllocationExpression allocation = (AllocationExpression)statement;
2558
		if (allocation.enumConstant != null) {
2559
			sourceStart = allocation.enumConstant.sourceStart;
2560
			sourceEnd = allocation.enumConstant.sourceEnd;
2561
		}
2562
	}
2563
	
2604
	
2564
	int id = IProblem.UndefinedConstructor; //default...
2605
	int id = IProblem.UndefinedConstructor; //default...
2565
    MethodBinding shownConstructor = targetConstructor;
2606
    MethodBinding shownConstructor = targetConstructor;
Lines 3000-3007 Link Here
3000
							closestParameterTypeShortNames,
3041
							closestParameterTypeShortNames,
3001
							parameterTypeShortNames
3042
							parameterTypeShortNames
3002
						},
3043
						},
3003
						(int) (messageSend.nameSourcePosition >>> 32),
3044
						nameSourceStart(messageSend),
3004
						(int) messageSend.nameSourcePosition);
3045
						nameSourceEnd(messageSend));
3005
					return;
3046
					return;
3006
			}			
3047
			}			
3007
			break;
3048
			break;
Lines 3059-3066 Link Here
3059
				        new String(inferredTypeArgument.shortReadableName()), 
3100
				        new String(inferredTypeArgument.shortReadableName()), 
3060
				        new String(typeParameter.sourceName), 
3101
				        new String(typeParameter.sourceName), 
3061
				        parameterBoundAsString(typeParameter, true) },
3102
				        parameterBoundAsString(typeParameter, true) },
3062
				(int) (messageSend.nameSourcePosition >>> 32),
3103
				nameSourceStart(messageSend),
3063
				(int) messageSend.nameSourcePosition);		    
3104
				nameSourceEnd(messageSend));		    
3064
			return;
3105
			return;
3065
		case ProblemReasons.TypeParameterArityMismatch :
3106
		case ProblemReasons.TypeParameterArityMismatch :
3066
			problemMethod = (ProblemMethodBinding) method;
3107
			problemMethod = (ProblemMethodBinding) method;
Lines 3078-3085 Link Here
3078
					        typesAsString(shownMethod.isVarargs(), shownMethod.parameters, true), 
3119
					        typesAsString(shownMethod.isVarargs(), shownMethod.parameters, true), 
3079
					        new String(shownMethod.declaringClass.shortReadableName()), 
3120
					        new String(shownMethod.declaringClass.shortReadableName()), 
3080
					        typesAsString(method.isVarargs(), method.parameters, true) },
3121
					        typesAsString(method.isVarargs(), method.parameters, true) },
3081
					(int) (messageSend.nameSourcePosition >>> 32),
3122
					nameSourceStart(messageSend),
3082
					(int) messageSend.nameSourcePosition);		    
3123
					nameSourceEnd(messageSend));		    
3083
			} else {
3124
			} else {
3084
				this.handle(
3125
				this.handle(
3085
					IProblem.IncorrectArityForParameterizedMethod  ,
3126
					IProblem.IncorrectArityForParameterizedMethod  ,
Lines 3095-3102 Link Here
3095
					        new String(shownMethod.declaringClass.shortReadableName()), 
3136
					        new String(shownMethod.declaringClass.shortReadableName()), 
3096
							typesAsString(false, shownMethod.typeVariables, true),
3137
							typesAsString(false, shownMethod.typeVariables, true),
3097
					        typesAsString(method.isVarargs(), method.parameters, true) },
3138
					        typesAsString(method.isVarargs(), method.parameters, true) },
3098
					(int) (messageSend.nameSourcePosition >>> 32),
3139
					nameSourceStart(messageSend),
3099
					(int) messageSend.nameSourcePosition);		    
3140
					nameSourceEnd(messageSend));		    
3100
			}
3141
			}
3101
			return;
3142
			return;
3102
		case ProblemReasons.ParameterizedMethodTypeMismatch :
3143
		case ProblemReasons.ParameterizedMethodTypeMismatch :
Lines 3116-3123 Link Here
3116
				        new String(shownMethod.declaringClass.shortReadableName()), 
3157
				        new String(shownMethod.declaringClass.shortReadableName()), 
3117
						typesAsString(false, ((ParameterizedGenericMethodBinding)shownMethod).typeArguments, true),
3158
						typesAsString(false, ((ParameterizedGenericMethodBinding)shownMethod).typeArguments, true),
3118
				        typesAsString(method.isVarargs(), method.parameters, true) },
3159
				        typesAsString(method.isVarargs(), method.parameters, true) },
3119
				(int) (messageSend.nameSourcePosition >>> 32),
3160
				nameSourceStart(messageSend),
3120
				(int) messageSend.nameSourcePosition);		    
3161
				nameSourceEnd(messageSend));		    
3121
			return;
3162
			return;
3122
		case ProblemReasons.TypeArgumentsForRawGenericMethod :
3163
		case ProblemReasons.TypeArgumentsForRawGenericMethod :
3123
			problemMethod = (ProblemMethodBinding) method;
3164
			problemMethod = (ProblemMethodBinding) method;
Lines 3134-3141 Link Here
3134
				        typesAsString(shownMethod.isVarargs(), shownMethod.parameters, true), 
3175
				        typesAsString(shownMethod.isVarargs(), shownMethod.parameters, true), 
3135
				        new String(shownMethod.declaringClass.shortReadableName()), 
3176
				        new String(shownMethod.declaringClass.shortReadableName()), 
3136
				        typesAsString(method.isVarargs(), method.parameters, true) },
3177
				        typesAsString(method.isVarargs(), method.parameters, true) },
3137
				(int) (messageSend.nameSourcePosition >>> 32),
3178
				nameSourceStart(messageSend),
3138
				(int) messageSend.nameSourcePosition);		       
3179
				nameSourceEnd(messageSend));		       
3139
			return;
3180
			return;
3140
		case ProblemReasons.NoError : // 0
3181
		case ProblemReasons.NoError : // 0
3141
		default :
3182
		default :
Lines 3151-3158 Link Here
3151
		new String[] {
3192
		new String[] {
3152
			new String(method.declaringClass.shortReadableName()),
3193
			new String(method.declaringClass.shortReadableName()),
3153
			new String(shownMethod.selector), typesAsString(shownMethod.isVarargs(), shownMethod.parameters, true)},
3194
			new String(shownMethod.selector), typesAsString(shownMethod.isVarargs(), shownMethod.parameters, true)},
3154
		(int) (messageSend.nameSourcePosition >>> 32),
3195
		nameSourceStart(messageSend),
3155
		(int) messageSend.nameSourcePosition);
3196
		nameSourceEnd(messageSend));
3156
}
3197
}
3157
public void invalidNullToSynchronize(Expression expression) {
3198
public void invalidNullToSynchronize(Expression expression) {
3158
	this.handle(
3199
	this.handle(
Lines 3533-3548 Link Here
3533
				new String[] {new String(method.declaringClass.readableName()), typesAsString(method.isVarargs(), method.parameters, false)},
3574
				new String[] {new String(method.declaringClass.readableName()), typesAsString(method.isVarargs(), method.parameters, false)},
3534
				new String[] {new String(method.declaringClass.shortReadableName()), typesAsString(method.isVarargs(), method.parameters, true)},
3575
				new String[] {new String(method.declaringClass.shortReadableName()), typesAsString(method.isVarargs(), method.parameters, true)},
3535
				severity,
3576
				severity,
3536
				location.sourceStart,
3577
				nameSourceStart(location),
3537
				location.sourceEnd);
3578
				nameSourceEnd(location));
3538
		} else {
3579
		} else {
3539
			this.handle(
3580
			this.handle(
3540
				IProblem.JavadocUsingDeprecatedMethod,
3581
				IProblem.JavadocUsingDeprecatedMethod,
3541
				new String[] {new String(method.declaringClass.readableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, false)},
3582
				new String[] {new String(method.declaringClass.readableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, false)},
3542
				new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, true)},
3583
				new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, true)},
3543
				severity,
3584
				severity,
3544
				location.sourceStart,
3585
				nameSourceStart(location),
3545
				location.sourceEnd);
3586
				nameSourceEnd(location));
3546
		}
3587
		}
3547
	}
3588
	}
3548
}
3589
}
Lines 3614-3635 Link Here
3614
			new String[] {new String(recType.readableName()), new String(messageSend.selector), buffer.toString()},
3655
			new String[] {new String(recType.readableName()), new String(messageSend.selector), buffer.toString()},
3615
			new String[] {new String(recType.shortReadableName()), new String(messageSend.selector), shortBuffer.toString()},
3656
			new String[] {new String(recType.shortReadableName()), new String(messageSend.selector), shortBuffer.toString()},
3616
			severity,
3657
			severity,
3617
			messageSend.sourceStart,
3658
			nameSourceStart(messageSend),
3618
			messageSend.sourceEnd);
3659
			nameSourceEnd(messageSend));
3619
	}
3660
	}
3620
}
3661
}
3621
public void javadocInvalidConstructor(Statement statement, MethodBinding targetConstructor, int modifiers) {
3662
public void javadocInvalidConstructor(Statement statement, MethodBinding targetConstructor, int modifiers) {
3622
3663
3623
	if (!javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) return;
3664
	if (!javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) return;
3624
	int sourceStart = statement.sourceStart;
3665
	int sourceStart = nameSourceStart(statement);
3625
	int sourceEnd = statement.sourceEnd;
3666
	int sourceEnd = nameSourceEnd(statement);
3626
	if (statement instanceof AllocationExpression) {
3627
		AllocationExpression allocation = (AllocationExpression)statement;
3628
		if (allocation.enumConstant != null) {
3629
			sourceStart = allocation.enumConstant.sourceStart;
3630
			sourceEnd = allocation.enumConstant.sourceEnd;
3631
		}
3632
	}
3633
	int id = IProblem.JavadocUndefinedConstructor; //default...
3667
	int id = IProblem.JavadocUndefinedConstructor; //default...
3634
	ProblemMethodBinding problemConstructor = null;
3668
	ProblemMethodBinding problemConstructor = null;
3635
	MethodBinding shownConstructor = null;
3669
	MethodBinding shownConstructor = null;
Lines 3777-3784 Link Here
3777
		new String[] {new String(targetConstructor.declaringClass.readableName()), typesAsString(targetConstructor.isVarargs(), targetConstructor.parameters, false)},
3811
		new String[] {new String(targetConstructor.declaringClass.readableName()), typesAsString(targetConstructor.isVarargs(), targetConstructor.parameters, false)},
3778
		new String[] {new String(targetConstructor.declaringClass.shortReadableName()), typesAsString(targetConstructor.isVarargs(), targetConstructor.parameters, true)},
3812
		new String[] {new String(targetConstructor.declaringClass.shortReadableName()), typesAsString(targetConstructor.isVarargs(), targetConstructor.parameters, true)},
3779
		severity,
3813
		severity,
3780
		statement.sourceStart,
3814
		sourceStart,
3781
		statement.sourceEnd);
3815
		sourceEnd);
3782
}
3816
}
3783
/*
3817
/*
3784
 * Similar implementation than invalidField(FieldReference...)
3818
 * Similar implementation than invalidField(FieldReference...)
Lines 3861-3868 Link Here
3861
						parameterTypeShortNames
3895
						parameterTypeShortNames
3862
					},
3896
					},
3863
					severity,
3897
					severity,
3864
					(int) (messageSend.nameSourcePosition >>> 32),
3898
					nameSourceStart(messageSend),
3865
					(int) messageSend.nameSourcePosition);
3899
					nameSourceEnd(messageSend));
3866
				return;
3900
				return;
3867
			}
3901
			}
3868
			break;
3902
			break;
Lines 3902-3909 Link Here
3902
				        new String(typeParameter.sourceName), 
3936
				        new String(typeParameter.sourceName), 
3903
				        parameterBoundAsString(typeParameter, true) },
3937
				        parameterBoundAsString(typeParameter, true) },
3904
				severity,
3938
				severity,
3905
				(int) (messageSend.nameSourcePosition >>> 32),
3939
				nameSourceStart(messageSend),
3906
				(int) messageSend.nameSourcePosition);		    
3940
				nameSourceEnd(messageSend));		    
3907
			return;
3941
			return;
3908
		case ProblemReasons.TypeParameterArityMismatch :
3942
		case ProblemReasons.TypeParameterArityMismatch :
3909
			problemMethod = (ProblemMethodBinding) method;
3943
			problemMethod = (ProblemMethodBinding) method;
Lines 3943-3950 Link Here
3943
							typesAsString(false, shownMethod.typeVariables, true),
3977
							typesAsString(false, shownMethod.typeVariables, true),
3944
					        typesAsString(method.isVarargs(), method.parameters, true) },
3978
					        typesAsString(method.isVarargs(), method.parameters, true) },
3945
					severity,
3979
					severity,
3946
					(int) (messageSend.nameSourcePosition >>> 32),
3980
					nameSourceStart(messageSend),
3947
					(int) messageSend.nameSourcePosition);		    
3981
					nameSourceEnd(messageSend));		    
3948
			}
3982
			}
3949
			return;
3983
			return;
3950
		case ProblemReasons.ParameterizedMethodTypeMismatch :
3984
		case ProblemReasons.ParameterizedMethodTypeMismatch :
Lines 3967-3974 Link Here
3967
						typesAsString(false, ((ParameterizedGenericMethodBinding)shownMethod).typeArguments, true),
4001
						typesAsString(false, ((ParameterizedGenericMethodBinding)shownMethod).typeArguments, true),
3968
				        typesAsString(method.isVarargs(), method.parameters, true) },
4002
				        typesAsString(method.isVarargs(), method.parameters, true) },
3969
				severity,
4003
				severity,
3970
				(int) (messageSend.nameSourcePosition >>> 32),
4004
				nameSourceStart(messageSend),
3971
				(int) messageSend.nameSourcePosition);		    
4005
				nameSourceEnd(messageSend));		    
3972
			return;
4006
			return;
3973
		case ProblemReasons.TypeArgumentsForRawGenericMethod :
4007
		case ProblemReasons.TypeArgumentsForRawGenericMethod :
3974
			severity = computeSeverity(IProblem.JavadocTypeArgumentsForRawGenericMethod);
4008
			severity = computeSeverity(IProblem.JavadocTypeArgumentsForRawGenericMethod);
Lines 3988-3995 Link Here
3988
				        new String(shownMethod.declaringClass.shortReadableName()), 
4022
				        new String(shownMethod.declaringClass.shortReadableName()), 
3989
				        typesAsString(method.isVarargs(), method.parameters, true) },
4023
				        typesAsString(method.isVarargs(), method.parameters, true) },
3990
				severity,
4024
				severity,
3991
				(int) (messageSend.nameSourcePosition >>> 32),
4025
				nameSourceStart(messageSend),
3992
				(int) messageSend.nameSourcePosition);		       
4026
				nameSourceEnd(messageSend));		       
3993
			return;
4027
			return;
3994
		case ProblemReasons.NoError : // 0
4028
		case ProblemReasons.NoError : // 0
3995
		default :
4029
		default :
Lines 4008-4015 Link Here
4008
			new String(method.declaringClass.shortReadableName()),
4042
			new String(method.declaringClass.shortReadableName()),
4009
			new String(method.selector), typesAsString(method.isVarargs(), method.parameters, true)},
4043
			new String(method.selector), typesAsString(method.isVarargs(), method.parameters, true)},
4010
		severity,
4044
		severity,
4011
		(int) (messageSend.nameSourcePosition >>> 32),
4045
		nameSourceStart(messageSend),
4012
		(int) messageSend.nameSourcePosition);
4046
		nameSourceEnd(messageSend));
4013
}
4047
}
4014
public void javadocInvalidParamTagName(int sourceStart, int sourceEnd) {
4048
public void javadocInvalidParamTagName(int sourceStart, int sourceEnd) {
4015
	this.handle(IProblem.JavadocInvalidParamTagName, NoArgument, NoArgument, sourceStart, sourceEnd);
4049
	this.handle(IProblem.JavadocInvalidParamTagName, NoArgument, NoArgument, sourceStart, sourceEnd);
Lines 4501-4508 Link Here
4501
		IProblem.StaticMethodRequested,
4535
		IProblem.StaticMethodRequested,
4502
		new String[] {new String(method.declaringClass.readableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, false)},
4536
		new String[] {new String(method.declaringClass.readableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, false)},
4503
		new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, true)},
4537
		new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, true)},
4504
		messageSend.sourceStart,
4538
		nameSourceStart(messageSend),
4505
		messageSend.sourceEnd);
4539
		nameSourceEnd(messageSend));
4506
}
4540
}
4507
public void nativeMethodsCannotBeStrictfp(ReferenceBinding type, AbstractMethodDeclaration methodDecl) {
4541
public void nativeMethodsCannotBeStrictfp(ReferenceBinding type, AbstractMethodDeclaration methodDecl) {
4508
	String[] arguments = new String[] {new String(type.sourceName()), new String(methodDecl.selector)};
4542
	String[] arguments = new String[] {new String(type.sourceName()), new String(methodDecl.selector)};
Lines 4551-4558 Link Here
4551
				typesAsString(method.isVarargs(), method.parameters, true)
4585
				typesAsString(method.isVarargs(), method.parameters, true)
4552
			 }, 
4586
			 }, 
4553
			severity,
4587
			severity,
4554
			location.sourceStart, 
4588
			nameSourceStart(location), 
4555
			location.sourceEnd); 
4589
			nameSourceEnd(location)); 
4556
		return;
4590
		return;
4557
	}
4591
	}
4558
	int severity = computeSeverity(IProblem.NeedToEmulateMethodAccess);
4592
	int severity = computeSeverity(IProblem.NeedToEmulateMethodAccess);
Lines 4570-4577 Link Here
4570
			typesAsString(method.isVarargs(), method.parameters, true)
4604
			typesAsString(method.isVarargs(), method.parameters, true)
4571
		 }, 
4605
		 }, 
4572
		 severity,
4606
		 severity,
4573
		location.sourceStart, 
4607
		nameSourceStart(location), 
4574
		location.sourceEnd); 
4608
		nameSourceEnd(location)); 
4575
}
4609
}
4576
public void noAdditionalBoundAfterTypeVariable(TypeReference boundReference) {
4610
public void noAdditionalBoundAfterTypeVariable(TypeReference boundReference) {
4577
	this.handle(
4611
	this.handle(
Lines 4623-4629 Link Here
4623
		typeDeclaration.sourceStart,
4657
		typeDeclaration.sourceStart,
4624
		typeDeclaration.sourceEnd);
4658
		typeDeclaration.sourceEnd);
4625
}
4659
}
4626
public void nonExternalizedStringLiteral(ASTNode location) {
4660
public void nonExternalizedStringLiteral(StringLiteral location) {
4627
	this.handle(
4661
	this.handle(
4628
		IProblem.NonExternalizedStringLiteral,
4662
		IProblem.NonExternalizedStringLiteral,
4629
		NoArgument,
4663
		NoArgument,
Lines 4665-4672 Link Here
4665
		IProblem.NonStaticAccessToStaticMethod,
4699
		IProblem.NonStaticAccessToStaticMethod,
4666
		new String[] {new String(method.declaringClass.readableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, false)},
4700
		new String[] {new String(method.declaringClass.readableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, false)},
4667
		new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, true)},
4701
		new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), typesAsString(method.isVarargs(), method.parameters, true)},
4668
		location.sourceStart,
4702
		nameSourceStart(location),
4669
		location.sourceEnd);
4703
		nameSourceEnd(location));
4670
}
4704
}
4671
public void nonStaticContextForEnumMemberType(SourceTypeBinding type) {
4705
public void nonStaticContextForEnumMemberType(SourceTypeBinding type) {
4672
	String[] arguments = new String[] {new String(type.sourceName())};
4706
	String[] arguments = new String[] {new String(type.sourceName())};
Lines 4703-4710 Link Here
4703
		id,
4737
		id,
4704
		new String[] { new String(targetType.readableName())}, 
4738
		new String[] { new String(targetType.readableName())}, 
4705
		new String[] { new String(targetType.shortReadableName())}, 
4739
		new String[] { new String(targetType.shortReadableName())}, 
4706
		location.sourceStart, 
4740
		nameSourceStart(location), 
4707
		location.sourceEnd); 
4741
		nameSourceEnd(location)); 
4708
}
4742
}
4709
public void notCompatibleTypesError(EqualExpression expression, TypeBinding leftType, TypeBinding rightType) {
4743
public void notCompatibleTypesError(EqualExpression expression, TypeBinding leftType, TypeBinding rightType) {
4710
	String leftName = new String(leftType.readableName());
4744
	String leftName = new String(leftType.readableName());
Lines 5591-5598 Link Here
5591
		IProblem.TypeMismatch,
5625
		IProblem.TypeMismatch,
5592
		new String[] {new String(actualType.readableName()), new String(expectedType.readableName())},
5626
		new String[] {new String(actualType.readableName()), new String(expectedType.readableName())},
5593
		new String[] {new String(actualType.shortReadableName()), new String(expectedType.shortReadableName())},
5627
		new String[] {new String(actualType.shortReadableName()), new String(expectedType.shortReadableName())},
5594
		location.sourceStart,
5628
		nameSourceStart(location),
5595
		location.sourceEnd);
5629
		nameSourceEnd(location));
5596
}
5630
}
5597
public void typeMismatchError(TypeBinding typeArgument, TypeVariableBinding typeParameter, ReferenceBinding genericType, ASTNode location) {
5631
public void typeMismatchError(TypeBinding typeArgument, TypeVariableBinding typeParameter, ReferenceBinding genericType, ASTNode location) {
5598
    if (location == null) { // binary case
5632
    if (location == null) { // binary case
Lines 5912-5919 Link Here
5912
				typesAsString(rawMethod.original().isVarargs(), rawMethod.parameters, true),
5946
				typesAsString(rawMethod.original().isVarargs(), rawMethod.parameters, true),
5913
			 },
5947
			 },
5914
			severity,
5948
			severity,
5915
			location.sourceStart,
5949
			nameSourceStart(location),
5916
			location.sourceEnd);    
5950
			nameSourceEnd(location));    
5917
    } else {
5951
    } else {
5918
		this.handle(
5952
		this.handle(
5919
			IProblem.UnsafeRawGenericMethodInvocation,
5953
			IProblem.UnsafeRawGenericMethodInvocation,
Lines 5930-5937 Link Here
5930
				typesAsString(rawMethod.original().isVarargs(), rawMethod.parameters, true),
5964
				typesAsString(rawMethod.original().isVarargs(), rawMethod.parameters, true),
5931
			 },
5965
			 },
5932
			severity,
5966
			severity,
5933
			location.sourceStart,
5967
			nameSourceStart(location),
5934
			location.sourceEnd);    
5968
			nameSourceEnd(location));    
5935
    }
5969
    }
5936
}
5970
}
5937
public void unsafeRawInvocation(ASTNode location, MethodBinding rawMethod) {
5971
public void unsafeRawInvocation(ASTNode location, MethodBinding rawMethod) {
Lines 5952-5959 Link Here
5952
				new String(rawMethod.declaringClass.erasure().shortReadableName()),
5986
				new String(rawMethod.declaringClass.erasure().shortReadableName()),
5953
			 }, 
5987
			 }, 
5954
			severity,
5988
			severity,
5955
			location.sourceStart,
5989
			nameSourceStart(location),
5956
			location.sourceEnd);    
5990
			nameSourceEnd(location));    
5957
    } else {
5991
    } else {
5958
		this.handle(
5992
		this.handle(
5959
			IProblem.UnsafeRawMethodInvocation,
5993
			IProblem.UnsafeRawMethodInvocation,
Lines 5970-5977 Link Here
5970
				new String(rawMethod.declaringClass.erasure().shortReadableName()),
6004
				new String(rawMethod.declaringClass.erasure().shortReadableName()),
5971
			 },
6005
			 },
5972
			severity,
6006
			severity,
5973
			location.sourceStart,
6007
			nameSourceStart(location),
5974
			location.sourceEnd);    
6008
			nameSourceEnd(location));    
5975
    }
6009
    }
5976
}
6010
}
5977
public void unsafeReturnTypeOverride(MethodBinding currentMethod, MethodBinding inheritedMethod, SourceTypeBinding type) {
6011
public void unsafeReturnTypeOverride(MethodBinding currentMethod, MethodBinding inheritedMethod, SourceTypeBinding type) {
Lines 6049-6056 Link Here
6049
				new String(exceptionType.shortReadableName()),
6083
				new String(exceptionType.shortReadableName()),
6050
			 }, 
6084
			 }, 
6051
			severity,
6085
			severity,
6052
			location.sourceStart,
6086
			nameSourceStart(location),
6053
			location.sourceEnd);
6087
			nameSourceEnd(location));
6054
	} else {
6088
	} else {
6055
		this.handle(
6089
		this.handle(
6056
			IProblem.UnusedMethodDeclaredThrownException,
6090
			IProblem.UnusedMethodDeclaredThrownException,
Lines 6067-6074 Link Here
6067
				new String(exceptionType.shortReadableName()),
6101
				new String(exceptionType.shortReadableName()),
6068
			 }, 
6102
			 }, 
6069
			severity,
6103
			severity,
6070
			location.sourceStart,
6104
			nameSourceStart(location),
6071
			location.sourceEnd);
6105
			nameSourceEnd(location));
6072
	}
6106
	}
6073
}
6107
}
6074
public void unusedImport(ImportReference importRef) {
6108
public void unusedImport(ImportReference importRef) {
Lines 6274-6281 Link Here
6274
					new String(varargsType.elementsType().shortReadableName()), 
6308
					new String(varargsType.elementsType().shortReadableName()), 
6275
			},
6309
			},
6276
			severity,
6310
			severity,
6277
			location.sourceStart(),
6311
			invocationSiteSourceStart(location),
6278
			location.sourceEnd());
6312
			invocationSiteSourceEnd(location));
6279
	} else {
6313
	} else {
6280
		this.handle(
6314
		this.handle(
6281
			IProblem.MethodVarargsArgumentNeedCast,
6315
			IProblem.MethodVarargsArgumentNeedCast,
Lines 6295-6302 Link Here
6295
					new String(varargsType.elementsType().shortReadableName()), 
6329
					new String(varargsType.elementsType().shortReadableName()), 
6296
			},
6330
			},
6297
			severity,
6331
			severity,
6298
			location.sourceStart(),
6332
			invocationSiteSourceStart(location),
6299
			location.sourceEnd());
6333
			invocationSiteSourceEnd(location));
6300
	}
6334
	}
6301
}
6335
}
6302
public void varargsConflict(MethodBinding method1, MethodBinding method2, SourceTypeBinding type) {
6336
public void varargsConflict(MethodBinding method1, MethodBinding method2, SourceTypeBinding type) {
Lines 6389-6396 Link Here
6389
				new String(offendingArgument.shortReadableName()),
6423
				new String(offendingArgument.shortReadableName()),
6390
				new String(offendingParameter.shortReadableName()),
6424
				new String(offendingParameter.shortReadableName()),
6391
			 }, 
6425
			 }, 
6392
			location.sourceStart,
6426
			nameSourceStart(location),
6393
			location.sourceEnd);    
6427
			nameSourceEnd(location));    
6394
    } else {
6428
    } else {
6395
		this.handle(
6429
		this.handle(
6396
			IProblem.WildcardMethodInvocation,
6430
			IProblem.WildcardMethodInvocation,
Lines 6410-6417 Link Here
6410
				new String(offendingArgument.shortReadableName()),
6444
				new String(offendingArgument.shortReadableName()),
6411
				new String(offendingParameter.shortReadableName()),
6445
				new String(offendingParameter.shortReadableName()),
6412
			 }, 
6446
			 }, 
6413
			location.sourceStart,
6447
			nameSourceStart(location),
6414
			location.sourceEnd);    
6448
			nameSourceEnd(location));
6415
    }
6449
    }
6416
}
6450
}
6417
public void wrongSequenceOfExceptionTypesError(TryStatement statement, TypeBinding exceptionType, int under, TypeBinding hidingExceptionType) {
6451
public void wrongSequenceOfExceptionTypesError(TryStatement statement, TypeBinding exceptionType, int under, TypeBinding hidingExceptionType) {

Return to bug 132677