[ https://issues.apache.org/jira/browse/OOZIE-3468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16877949#comment-16877949 ]
Hadoop QA commented on OOZIE-3468: ---------------------------------- PreCommit-OOZIE-Build started > Use modernizer plugin > --------------------- > > Key: OOZIE-3468 > URL: https://issues.apache.org/jira/browse/OOZIE-3468 > Project: Oozie > Issue Type: Improvement > Components: build > Affects Versions: trunk > Reporter: Andras Salamon > Assignee: Andras Salamon > Priority: Major > Attachments: OOZIE-3468-01-wip.patch, OOZIE-3468-02-wip.patch > > > Recently I've opened a few jiras which suggested to use standard java classes > instead of external libraries ( OOZIE-3463, OOZIE-3467). There is a tool > which can find such technical depts: [maven modernizer > plugin|https://github.com/gaul/modernizer-maven-plugin]. > The usage is quite simple: > {noformat} > $ mvn modernizer:modernizer > ... > [ERROR] /src/oozie/core/src/main/java/org/apache/oozie/StringBlob.java:88: > Prefer java.lang.String.<init>(byte[], java.nio.charset.Charset) > > [ERROR] /src/oozie/core/src/main/java/org/apache/oozie/StringBlob.java:122: > Prefer java.nio.charset.StandardCharsets > [ERROR] > /src/oozie/core/src/main/java/org/apache/oozie/servlet/V2ValidateServlet.java:85: > Prefer java.nio.charset.StandardCharsets > [ERROR] > /src/oozie/core/src/main/java/org/apache/oozie/servlet/V2ValidateServlet.java:92: > Prefer java.nio.charset.StandardCharsets > [ERROR] > /src/oozie/core/src/main/java/org/apache/oozie/servlet/V1JobsServlet.java:188: > Prefer java.util.ArrayList<>() > [ERROR] > /src/oozie/core/src/main/java/org/apache/oozie/servlet/JVMInfo.java:91: > Prefer java.lang.StringBuilder > [ERROR] > /src/oozie/core/src/main/java/org/apache/oozie/servlet/JVMInfo.java:101: > Prefer java.lang.StringBuilder > [ERROR] > /src/oozie/core/src/main/java/org/apache/oozie/servlet/JVMInfo.java:110: > Prefer java.lang.StringBuilder > [ERROR] > /src/oozie/core/src/main/java/org/apache/oozie/servlet/JVMInfo.java:119: > Prefer java.lang.StringBuilder > [ERROR] > /src/oozie/core/src/main/java/org/apache/oozie/servlet/VersionServlet.java:36: > Prefer java.util.Collections.emptyList() > [ERROR] > /src/oozie/core/src/main/java/org/apache/oozie/servlet/V1AdminServlet.java:49: > Prefer java.util.Collections.emptyList() > ... > {noformat} > There are several ways to use this plugin: > # Add the plugin to the root pom and let developers manually use this > plugin. It's the simplest solution, but it will be easy to forget it. > # Add this to the precommit script similarly to findbugs and at least avoid > to insert new code which uses old style API. Probably we will have the same > problems like we have with findbugs, we will have lots of false positive > warnings. > # Turn the plugin on by default and fail the compilation if it finds any > problem. I think this is too strict. > If we choose option 2 or 3 we should probably specify an ignore list, I don't > think for instance that we really want to change all the {{new Long(10)}} > code to {{Long.valueOf(10)}}. > By default this plugin checks the target java version (1.8 right now) but > it's possible to specify 1.7 instead if we want to focus on those problems > first. (It was not working for me without specifying the java version.) > -- This message was sent by Atlassian JIRA (v7.6.3#76005)