What to do when Maven says "For more information, please recompile with the -Xlint: unchecked option"

"For more information, please recompile with the -Xlint: unchecked option"

$ mvn compile
(Omission)
[WARNING] /Users/az/app/src/main/java/MyApp.java: /Users/az/app/src/main/java/MyApp.Java operations are unchecked or unsafe.
[WARNING] /Users/az/app/src/main/java/MyApp.java:Detail is,-Xlint:Recompile with the unchecked option.

Workaround

Add the Compiler Plugin settings to the plugins element of pom.xml as follows.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>3.8.1</version>
  <configuration>
    <compilerArgs>
      <arg>-Xlint:unchecked</arg>
    </compilerArgs>
  </configuration>
</plugin>

Now the specific warning content will be displayed.

[WARNING] /Users/az/app/src/main/java/MyApp.java:[50,17]raw type java.util.Put as a member of Map(K,V)It is an unchecked call to
[WARNING] /Users/az/app/src/main/java/MyApp.java:[53,12]Unchecked conversion
Expected value: java.util.Map<java.lang.String,java.lang.Object>
Detected value:    java.util.Map

This environment

Reference material

Recommended Posts

What to do when Maven says "For more information, please recompile with the -Xlint: unchecked option"
[IOS] What to do when the image is filled with one color
WELD-001408: What to do when Unsatisfied dependencies for type Bean with qualifiers @Default
What to do when The SSL certificate has expired
[Rails] What to do when the view collapses when a message is displayed with the errors method
What to do when you launch an application with rails
What to do if the app is not created with the latest Rails version installed when rails new
What to do if validation doesn't work with the update action
What to do if the Eclipse Maven dependency Jar is wrong
What to do when javax.batch.operations.JobStartException occurs
What to do when CentOS cannot be started with VirtualBox on Catalina
Notes on what to do when EC2 is set up with t2.micro
What to do when a javax.el.PropertyNotWritableException occurs
What to do when undefined method ʻuser_signed_in?'
What to do when the value becomes null in the second getSubmittedValue () in JSF Validator
[Grails] Error occurred running What to do when the Grails CLI does not start
What to do when is invalid because it does not start with a'-'
What to do if you hit the wall of Too many symbol files when uploading with App Store Connect
What to do when ‘Could not find’ in any of the sources appears in the development environment with Docker × Rails × RSpec
What to do if you get an error saying "Please enter a valid value" when getting with Rails datetime_field