Björn Raupach created NETBEANS-1290:
---------------------------------------

             Summary: Generate Getters and Setters fails with Unexpected 
Exception
                 Key: NETBEANS-1290
                 URL: https://issues.apache.org/jira/browse/NETBEANS-1290
             Project: NetBeans
          Issue Type: Bug
    Affects Versions: 9.0
            Reporter: Björn Raupach


*Steps to reproduce:*

1) Write a class with a single int property.

 
{code:java}
public class Foo {
  int id;
}{code}
2) Use CTRL+I to generate Code and select Getters and Setters.

 

The class should now look like this. This works fine.

 
{code:java}
public class Foo {
  int id;

  public int getId() { return id; }
 
  public int setId(int id) { this.id = id; }
}
{code}
 

3) Use CTRL+I to generate Code and select Getters and Setters. Nothing shows up 
since we have no additional properties. This behaviour is expected.

4) Change int to Integer, use  CTRL+I to generate Code and select Getters and 
Setters. Now the property id does show up and if once presses the button 
'Generate' nothing happens in the editor.  The notifications report a 
Unexpected Exception with "Class member already exists."

One can also reproduce the behaviour with Integer first and the changing to int.

I think the correct behaviour is to ignore the change of the datatype. Integer 
-> int is just auto boxing.

This happend after I added several new properties to an existing POJO. During I 
did change the data type from Integer to int and forgot to adjust the datatype 
in the setters and getters. I wondered why the dialog did not create the new 
Getters and Setters for the new properties.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to