The Java > Code Style preference page allows to configure naming conventions, style rules and comment settings. These preferences are used when new code has to be generated.
Sub pages offer more code style settings:
The options are:
The list defines the naming conventions for fields (static and non-static), parameters and local variables. For each variable type it is possible to configure a list of prefix or suffix or both.
Naming conventions are used by all actions and 'Quick Fix' proposals that create fields, parameters and local variables, in particular the
Source actions.
Action |
Description |
---|---|
Edit... |
Opens a dialog to edit the list of prefix and suffixes for the currently selected variable type |
The following settings specify how newly generated code should look like. The names of getter methods can be specified as well as the format of field accesses, method comments, annotations and exception variables.
Action |
Description |
Default |
---|---|---|
Qualify all generated field accesses with 'this.' |
If selected, field accesses are always prefixed with 'this', regardless whether the name of the field is unique in the scope of the field access or not. |
Off |
Use 'is' prefix for getters that return boolean |
If selected, the names of getter methods of boolean type are prefixed with 'is' rather than 'get'. |
On |
Add '@Override' annotation for overriding methods |
If selected, methods which override an already implemented method are annotated with an '@Override' annotation. See the Compiler preference page for settings related to annotations. |
On |
Exception variable name in catch blocks |
Specify the name of the exception variable declared in catch blocks. |
e |
Source actions
Java editor
Java editor preferences
Java compiler preferences
Code templates preferences