Defect in flow analysis ? [message #244615] |
Mon, 18 June 2007 07:28 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: none.domain.invalid
Should i report a bug for this :
public class TestUndefined {
Object throwRuntimeException() {
throw new RuntimeException();
}
void test1() {
Object o;
try {
o = throwRuntimeException();
} finally {
// The local variable o may not have been initialized
o.hashCode();
}
}
void test2() {
Object o;
try {
o = throwRuntimeException();
} finally {
}
// nothing reported
o.hashCode();
}
}
|
|
|
Re: Defect in flow analysis ? [message #244624 is a reply to message #244615] |
Mon, 18 June 2007 10:27 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: merks.ca.ibm.com
If in test2, an exception is thrown, o.hashCode() won't be reached,
right? In other words, if o.hashCode is call in test2(), then it must
have been initialized properly.
Name wrote:
> Should i report a bug for this :
>
>
> public class TestUndefined {
>
> Object throwRuntimeException() {
> throw new RuntimeException();
> }
>
> void test1() {
> Object o;
> try {
> o = throwRuntimeException();
> } finally {
> // The local variable o may not have been initialized
> o.hashCode();
> }
> }
>
> void test2() {
> Object o;
> try {
> o = throwRuntimeException();
> } finally {
> }
> // nothing reported
> o.hashCode();
> }
>
> }
|
|
|
Re: Defect in flow analysis ? [message #244628 is a reply to message #244624] |
Mon, 18 June 2007 10:46 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: none.domain.invalid
Ed Merks a écrit :
> If in test2, an exception is thrown, o.hashCode() won't be reached,
> right? In other words, if o.hashCode is call in test2(), then it must
> have been initialized properly.
Thanks of the explanation. With a catch block i get an error, so it's ok.
|
|
|
Powered by
FUDForum. Page generated in 0.03130 seconds