|
Lines 364-370
public class NullAnnotationMatching {
Link Here
|
| 364 |
* Problems are either reported directly (if scope != null) or by returning a ProblemMethodBinding. |
364 |
* Problems are either reported directly (if scope != null) or by returning a ProblemMethodBinding. |
| 365 |
*/ |
365 |
*/ |
| 366 |
public static MethodBinding checkForContraditions( |
366 |
public static MethodBinding checkForContraditions( |
| 367 |
final MethodBinding method, final InvocationSite invocationSite, final Scope scope) { |
367 |
final MethodBinding method, final InvocationSite invocationSite, final Scope scope, TypeBinding returnType) { |
| 368 |
|
368 |
|
| 369 |
class SearchContradictions extends TypeBindingVisitor { |
369 |
class SearchContradictions extends TypeBindingVisitor { |
| 370 |
ReferenceBinding typeWithContradiction; |
370 |
ReferenceBinding typeWithContradiction; |
|
Lines 389-396
public class NullAnnotationMatching {
Link Here
|
| 389 |
SearchContradictions searchContradiction = new SearchContradictions(); |
389 |
SearchContradictions searchContradiction = new SearchContradictions(); |
| 390 |
TypeBindingVisitor.visit(searchContradiction, method.returnType); |
390 |
TypeBindingVisitor.visit(searchContradiction, method.returnType); |
| 391 |
if (searchContradiction.typeWithContradiction != null) { |
391 |
if (searchContradiction.typeWithContradiction != null) { |
| 392 |
if (scope == null) |
392 |
if (scope == null) { |
| 393 |
return new ProblemMethodBinding(method, method.selector, method.parameters, ProblemReasons.ContradictoryNullAnnotations); |
393 |
ProblemMethodBinding problem = new ProblemMethodBinding(method, method.selector, method.parameters, ProblemReasons.ContradictoryNullAnnotations); |
|
|
394 |
problem.returnType = returnType; |
| 395 |
return problem; |
| 396 |
} |
| 394 |
scope.problemReporter().contradictoryNullAnnotationsInferred(method, invocationSite); |
397 |
scope.problemReporter().contradictoryNullAnnotationsInferred(method, invocationSite); |
| 395 |
// note: if needed, we might want to update the method by removing the contradictory annotations?? |
398 |
// note: if needed, we might want to update the method by removing the contradictory annotations?? |
| 396 |
return method; |
399 |
return method; |
|
Lines 402-409
public class NullAnnotationMatching {
Link Here
|
| 402 |
for (int i = 0; i < method.parameters.length; i++) { |
405 |
for (int i = 0; i < method.parameters.length; i++) { |
| 403 |
TypeBindingVisitor.visit(searchContradiction, method.parameters[i]); |
406 |
TypeBindingVisitor.visit(searchContradiction, method.parameters[i]); |
| 404 |
if (searchContradiction.typeWithContradiction != null) { |
407 |
if (searchContradiction.typeWithContradiction != null) { |
| 405 |
if (scope == null) |
408 |
if (scope == null) { |
| 406 |
return new ProblemMethodBinding(method, method.selector, method.parameters, ProblemReasons.ContradictoryNullAnnotations); |
409 |
ProblemMethodBinding problem = new ProblemMethodBinding(method, method.selector, method.parameters, ProblemReasons.ContradictoryNullAnnotations); |
|
|
410 |
problem.returnType = method.returnType; |
| 411 |
return problem; |
| 412 |
} |
| 407 |
if (arguments != null && i < arguments.length) |
413 |
if (arguments != null && i < arguments.length) |
| 408 |
scope.problemReporter().contradictoryNullAnnotationsInferred(method, arguments[i]); |
414 |
scope.problemReporter().contradictoryNullAnnotationsInferred(method, arguments[i]); |
| 409 |
else |
415 |
else |