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 258255 - Not able to change the variable type.
Summary: Not able to change the variable type.
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 8.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Ralph Ruijs
Depends on:
Reported: 2016-03-05 13:09 UTC by blacharz
Modified: 2016-05-22 10:09 UTC (History)
0 users

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description blacharz 2016-03-05 13:09:38 UTC

Netbeans is unable to change the type of the newly created variable from context menu alt+enter. It makes the IDE NOT TDD friendly.

Please fix it.


Best regards.
Comment 1 Ralph Ruijs 2016-05-19 07:30:43 UTC
I'm not really sure what you describe exactly, could you add some more details to the feature request? Some sample start code, the expected menu item and the expected outcome when the item is used?

Comment 2 blacharz 2016-05-22 10:09:04 UTC

Thanks for your interest on the issue :-)

When working with intellj or eclipse the following use case ins possible.
For example i want to write something like this. As an example i provide you a unit test, but it can happen also in the regular method in a ordinary class.

public void canSumTwoNumbers()
//below line is new in the test method; before that, the method was empty.
calculator.sum(1, 2);

Please bare in mind, i do not have a calculator class available yet. So we have a compilation error. I want to fix it automatically. So i am pressing alt+enter shortcut. A popup appears. I can create local variable. Ok, i select that. A new variable is then created, but automatically Object type is assigned. Ok, but it is something that is not editable out of the box. Then i have something like bellow.

public void canSumTwoNumbers()
Object calculator;
calculator.sum(1, 2);

But the Object type is not editable. I have to erase with backspace or del keys. In intellij or eclipse you have the possibility to type in a type. Then i would like to type Calculator (a name of a class), which does not exists yet. Obviously i will have compilation error, but that is fine. Further, putting the cursor in the Calculator type, that i have just written, pressing alt+enter i have a fix, where i can create a Calculator class. And that is it.

The same situation happens when i work with a fields. Not type editing is possible.

A good reference point could be the intellij idea IDE. Community edition has the same refactoring possibilities then ultimate version. 

If you have trouble with reproducing the steps or doubt about what i have explained, please let me know.

I am keen on helping to make the Netbeans a better IDE :-)