google-java-format icon indicating copy to clipboard operation
google-java-format copied to clipboard

Weird format in constructor with annotated args

Open alessandrococco opened this issue 5 years ago • 3 comments

Hello!

I'm working on a Spring Batch application using IntelliJ IDEA 2019.3.3 CE and I noticed a "weird" format using google-java-format 1.7.

Code before gjf:

  @Autowired
  public AllineamentoTasklet(
      final @NonNull StoreRestRepository storeRepository,
      final @NonNull AllineamentoService allineamentoService,
      final @NonNull @Value("${allineamento-app.store-types}") List<String> storeTypes,
      final @NonNull @Value("${allineamento-app.skippable-exceptions}") List<Class<? extends Exception>> skippableExceptions) {
      ..
      ..
  }

  // @NonNull is lombok's

Code after gjf:

  @Autowired
  public AllineamentoTasklet(
      final @NonNull StoreRestRepository storeRepository,
      final @NonNull AllineamentoService allineamentoService,
      final @NonNull @Value("${allineamento-app.store-types}") List<String> storeTypes,
      final @NonNull @Value("${allineamento-app.skippable-exceptions}") List<
                  Class<? extends Exception>>
              skippableExceptions) {
      ..
      ..
  }

Is this the expected result?

Thank you

alessandrococco avatar Feb 24 '20 15:02 alessandrococco

Hello @alessandrococco

Did you try to change the version to google-java-format 1.8?

if the issue still exist try to add in labels IntelliJ IDEA 2019.3.3 CE

Thanks

bavly avatar May 24 '20 13:05 bavly

Hello @bavly, thank you for your response!

Sorry but I cannot run google-java-format 1.8 because I'm still on java 8 and the latest google-java-format needs java 11 :-(

alessandrococco avatar May 25 '20 07:05 alessandrococco

You can install java 11 and specific the target source code as java 8. So you can use the features of this locally but deploy on java 8 servers

ReXtrem avatar Nov 20 '20 08:11 ReXtrem