Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Defect in flow analysis ?
Defect in flow analysis ? [message #244615] Mon, 18 June 2007 03: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 06: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 06: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: Thu May 01 16:53:35 EDT 2025

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

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

Back to the top