got it.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<compilerArgs>
<arg>-Werror</arg>
<arg>-Xlint:all</arg>
<!--care for jdk8/jdk7 compatible problem-->
<arg>-Xlint:-classfile</arg>
<!--not referenced in try-with-resources-->
<arg>-Xlint:-try</arg>
</compilerArgs>
</configuration>
</plugin>
wjm wjm <[email protected]> 于2018年10月26日周五 上午9:51写道:
> if delete the red line, then even @SuppressWarnings("all") can not
> suppress this warning
> must reference the variable?
>
> public static boolean canTcpListen(InetAddress address, int port) {
> try (ServerSocket ss = new ServerSocket(port, 0, address)) {
> ss.getLocalPort();
> return true;
> } catch (IOException e) {
> return false;
> }
> }
>