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.

Bug 134429 - Autocompletion in class-inside-method should include non-final matches in method scope
Summary: Autocompletion in class-inside-method should include non-final matches in met...
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: Macintosh All
: P3 blocker with 1 vote (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-02 19:56 UTC by _ tboudreau
Modified: 2013-09-02 14:19 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ tboudreau 2008-05-02 19:56:16 UTC
If in inner class in method, completions should include non-final objects in scope and automatically final them if necessary.  Example:

 public void testLongDescription() {
        System.out.println("testLongDescription");
        Wizard w = WizardPage.createWizard(new Class[] { AP.class });
        EventQueue.invokeAndWait(new Runnable() {
            public void run() {
                WizardDisplayer.showWizard(w);
            }
        });
        String s = w.getLongDescription("one");
        assertEquals ("LONG DESCRIPTION", ((AP) jc).getLongDescription());
        assertEquals ("LONG DESCRIPTION", s);
    }

I am adding the EventQueue.invokeAndWait() call and creating the runnable.  I complete WizardDisplayer.showWizard(), which takes an argument of Wizard.  
The variable w is in scope, but it is not final.  So code completion supplies a bogus variable "wizard".

It would be better if it would offer "w" and if I accept it, it would add "final" before the line beginning "Wizard w".