0

I'm having unit test checking my function that receive varargs of String.

In the function i'm checking if the parameter sent is null:

public static String generate(String... input) {
        if (input == null) {
            LOGGER.warn("Input is null for CheckSumGenerator");
            return null;
        }
     // Other not relevant code here
}

Unit test:

String checkSum2 = CheckSumGenerator.generate(null);
Assert.assertEquals(checkSum2, null);

When using Maven as build tool - test run fine. Passed. When change the project to run with gradle the build print warning in red:

warning: non-varargs call of varargs method with inexact argument type for last parameter

The question is why gradle print it and maven isn't?

ToYonos
  • 16,469
  • 2
  • 54
  • 70
Udi
  • 598
  • 8
  • 19

1 Answers1

1

The maven compiler plugin is configured to ignore warnings by default

https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#showWarnings

<showWarnings> Set to true to show compilation warnings.

Type: boolean
Since: 2.0
Required: No
User Property: maven.compiler.showWarnings
**Default: false**

On the other hand, Gradle displays them by default. You can turn them off.

ToYonos
  • 16,469
  • 2
  • 54
  • 70