NoozNooz42
NoozNooz42

Reputation: 4328

Changing the default method parameters IntelliJ creates

I'd like to change the default generated parameters by IntelliJ when I ask it to automatically create a method.

For example if I write the following (it's just an example, this question isn't about using List instead of ArrayList), before the method generate() is created:

generate( new ArrayList<String>{}, 42 );

and ask IntelliJ to create the method, it creates this:

private void generate( ArrayList<String> strings, int i ) {
}

But I'd like to have this instead:

private void generate(
    @NotNull final ArrayList<String> strings,
    final int i
) {
}

In other words I'd like:

How can I do this?

Upvotes: 0

Views: 616

Answers (1)

duffymo
duffymo

Reputation: 308763

Go into the settings and have a look at the code formatting for most of this.

I'm not sure about the @NotNull or final choices.

UPDATE: I think @NotNull annotation will show up if you tell IntelliJ that you want JDK 6 or higher language features. This means that you have to compile with JDK 6 or higher, of course.

The rest should be under code style settings. Or file or method templates.

Upvotes: 0

Related Questions