44 lines
1007 B
Plaintext
44 lines
1007 B
Plaintext
=== is related to: S3516
|
|
|
|
=== on 1 Dec 2015, 11:08:13 Michael Gumowski wrote:
|
|
LGTM!
|
|
|
|
=== on 5 Jan 2016, 10:07:18 Nicolas Peru wrote:
|
|
\[~ann.campbell.2] I kinda lack the definition of what is a constant and limitation of cases to be 100% sure of the scope of this rule.
|
|
|
|
What about the following for instance :
|
|
|
|
----
|
|
int foo(boolean a) {
|
|
if(a) {
|
|
return 12;
|
|
}
|
|
return 12;
|
|
}
|
|
----
|
|
this is actually detected by intellij idea but the following is not :
|
|
|
|
----
|
|
int foo(boolean a) {
|
|
int b = 12;
|
|
if(a) {
|
|
return b;
|
|
}
|
|
return b;
|
|
}
|
|
----
|
|
|
|
IMO first implementation should be limited to method with only one return statement and a constant with the following definition:
|
|
|
|
A constant is a literal or a static final primitive variable.
|
|
|
|
|
|
Then we might want to improve this using SE engine to detect cases like I described.
|
|
|
|
|
|
WDYT ?
|
|
|
|
=== on 5 Jan 2016, 16:21:17 Ann Campbell wrote:
|
|
Uhm... I thought it was evident from the examples [~nicolas.peru] that that's all that was expected.
|
|
|