Example usage.
Add compiler configuration (requires Oracle javac 8):
<build>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<fork>true</fork>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<compilerArgs>
<arg>-processorpath</arg>
<arg>${settings.localRepository}${file.separator}eu${file.separator}nets${file.separator}distribution${file.separator}try-with-resources-checker${file.separator}1-SNAPSHOT${file.separator}try-with-resources-checker-1-SNAPSHOT.jar</arg>
<arg>-Xplugin:TryWithCheckPluginHardline</arg>
<!-- <arg>-Xplugin:TryWithCheckPlugin</arg> --><!-- Will give Warning on compilation instead of Error -->
<!-- <arg>-Xplugin:SystemErrOutUsageCheck</arg> --><!-- Will give Error on usage of System.(err|out) -->
</compilerArgs>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
</configuration>
<dependencies>
<dependency>
<groupId>eu.nets.distribution</groupId>
<artifactId>try-with-resources-checker</artifactId>
<version>1-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
...
</build>
Running "mvn clean compile" for input
public class Demo {
public static void main(String[] args) {
ZipInputStream unssafe = new ZipInputStream(null);
}
}
should give
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project nets-distribution: Compilation failure
[ERROR] C:\devel\...\src\main\java\eu\nets\distribution\Demo.java:[7,33] error: Use try-with-resources, offending class was java.util.zip.ZipInputStream
try-with-resources-checker's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.