equal
deleted
inserted
replaced
89 final Symtab syms; |
89 final Symtab syms; |
90 final JavacMessages messages; |
90 final JavacMessages messages; |
91 final Names names; |
91 final Names names; |
92 final boolean allowDefaultMethods; |
92 final boolean allowDefaultMethods; |
93 final boolean mapCapturesToBounds; |
93 final boolean mapCapturesToBounds; |
94 final boolean returnTypeSustitutableSameType; |
|
95 final Check chk; |
94 final Check chk; |
96 final Enter enter; |
95 final Enter enter; |
97 JCDiagnostic.Factory diags; |
96 JCDiagnostic.Factory diags; |
98 List<Warner> warnStack = List.nil(); |
97 List<Warner> warnStack = List.nil(); |
99 final Name capturedName; |
98 final Name capturedName; |
113 syms = Symtab.instance(context); |
112 syms = Symtab.instance(context); |
114 names = Names.instance(context); |
113 names = Names.instance(context); |
115 Source source = Source.instance(context); |
114 Source source = Source.instance(context); |
116 allowDefaultMethods = Feature.DEFAULT_METHODS.allowedInSource(source); |
115 allowDefaultMethods = Feature.DEFAULT_METHODS.allowedInSource(source); |
117 mapCapturesToBounds = Feature.MAP_CAPTURES_TO_BOUNDS.allowedInSource(source); |
116 mapCapturesToBounds = Feature.MAP_CAPTURES_TO_BOUNDS.allowedInSource(source); |
118 returnTypeSustitutableSameType = Feature.RETURN_TYPE_SUBSTITUTABLE_SAME_TYPE.allowedInSource(source); |
|
119 chk = Check.instance(context); |
117 chk = Check.instance(context); |
120 enter = Enter.instance(context); |
118 enter = Enter.instance(context); |
121 capturedName = names.fromString("<captured wildcard>"); |
119 capturedName = names.fromString("<captured wildcard>"); |
122 messages = JavacMessages.instance(context); |
120 messages = JavacMessages.instance(context); |
123 diags = JCDiagnostic.Factory.instance(context); |
121 diags = JCDiagnostic.Factory.instance(context); |
4235 |
4233 |
4236 if (hasSameArgs(r1, r2)) |
4234 if (hasSameArgs(r1, r2)) |
4237 return covariantReturnType(r1.getReturnType(), r2res, warner); |
4235 return covariantReturnType(r1.getReturnType(), r2res, warner); |
4238 if (isSubtypeUnchecked(r1.getReturnType(), r2res, warner)) |
4236 if (isSubtypeUnchecked(r1.getReturnType(), r2res, warner)) |
4239 return true; |
4237 return true; |
4240 if (returnTypeSustitutableSameType) { |
4238 if (!isSubtype(r1.getReturnType(), erasure(r2res))) |
4241 if (!isSameType(r1.getReturnType(), erasure(r2res))) |
4239 return false; |
4242 return false; |
|
4243 } else { |
|
4244 if (!isSubtype(r1.getReturnType(), erasure(r2res))) |
|
4245 return false; |
|
4246 } |
|
4247 warner.warn(LintCategory.UNCHECKED); |
4240 warner.warn(LintCategory.UNCHECKED); |
4248 return true; |
4241 return true; |
4249 } |
4242 } |
4250 |
4243 |
4251 /** |
4244 /** |