Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Defect in flow analysis ?
Defect in flow analysis ? [message #244615] Mon, 18 June 2007 07:28 Go to next message
Eclipse UserFriend
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 messageGo to next message
Eclipse UserFriend
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
Eclipse UserFriend
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.
Previous Topic:Code formatting problem of AST (import statement)
Next Topic:Package Explorer - packages in source folder are hidden
Goto Forum:
  


Current Time: Sat Jul 13 23:40:34 GMT 2024

Powered by FUDForum. Page generated in 0.03519 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top