You are right! Never write emails when your wife is asking you to go
home NOW ;-)
I guess when you analyze FURTHER ( ;-P ) my code block
if (i < 0) return 0;
....
return i;
You have a decision point and 2 sub blocks:
if (i < 0) {
return 0;
}
else {
....
return i;
}
Then is clearer what to do in the refactoring
public int foo(int i) {
int res = 0;
if (i < 0) {
res = 0;
}
else {
....
res = i;
}
return res;
}
I am sure I can trust Carlos to tell me if I made a fool of myself AGAIN
;-)
Jacques
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
On Behalf Of Carlos Costa e Silva
Sent: Wednesday, March 13, 2002 3:17 PM
To: [EMAIL PROTECTED]
Subject: RE: [Eap-list] Inline Method with "returns interrupting the
control flow" error
> Am I missing something?
Yes :)
> public int foo(int i) {
> return bar(i);
> }
>
> private int bar(int i) {
> if (i < 0) return 0;
> return i;
> }
foo(-3) -> 0
>
> public int foo(int i) {
> int res = 0;
> if (i < 0) res = 0;
> res = i;
> return res;
> }
>
>
foo(-3) -> -3
Carlos
--
Carlos Costa e Silva <[EMAIL PROTECTED]>
_______________________________________________
Eap-list mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-list
_______________________________________________
Eap-list mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-list