This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Product Version: NetBeans IDE Dev (Build 200708290343) Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b05 System: Linux version 2.6.17-11-generic running on i386; UTF-8; en_US (nb) Userdir: /home/jp159440/.netbeans/dev Introduce method hint can produce code which tries to return uninitialized variable. Steps to reproduce: 1) have a code: public void method(boolean arg) { int c = 0; if(arg) c = 3; System.out.println(c); } 2) introduce method from the 2nd line ( if(arg)... ) -> public void method(boolean arg) { int c = 0; c = newMethod(arg); System.out.println(c); } public int newMethod(boolean arg) { int c; if (arg) { c = 3; } return c; // <- variable c might not have been initialized }
Dane, please take a look at it. Thanks.
Max volunteered :)
Will be resolved LATER.
See issue #165780.
*** Issue 165780 has been marked as a duplicate of this issue. ***
*** Bug 179258 has been marked as a duplicate of this bug. ***
It's nearly three years from the initial report.. Has "LATER" become "NOW" yet?
Integrated into 'main-golden', will be available in build *201104100401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/8bf8d986179b User: Jan Lahoda <jlahoda@netbeans.org> Log: #114371: using flow to determine whether the introduce method hint should create a local variable or a parameter.
*** Bug 197549 has been marked as a duplicate of this bug. ***
*** Bug 196658 has been marked as a duplicate of this bug. ***
The above implemented flow should be able to handle the case described in this bug and cases in the duplicates. Possible bugs in the flow implementation should be relatively easy to solve and should be tracked as separate bugs.
Product Version: NetBeans IDE Dev (Build 201104140401) Java: 1.6.0_24; Java HotSpot(TM) Client VM 19.1-b02 System: Linux version 2.6.32-30-generic running on i386; UTF-8; en_US (nb) Verified, works for me, thanks.