dependency: bump org.gaul:modernizer-maven-plugin from 2.9.0 to 3.0.0#16095
Conversation
|
Hmmm All violations are same type Here are details gaul/modernizer-maven-plugin#301 |
|
for anyone working on this change, please DON'T use Paths.get(...) when refactoring, but rather Path.of(...). See the javadoc of Paths.get(...) and gaul/modernizer-maven-plugin#303 |
eb7ae6d to
520a366
Compare
|
blocked by gaul/modernizer-maven-plugin#303 |
520a366 to
2c9b323
Compare
|
2c9b323 to
7434ad3
Compare
|
7434ad3 to
833b3fc
Compare
|
The target is to get rid of the |
| // oops, we've got an additional one to process, don't | ||
| // forget it. No sweat, it's fully resolved via the setter. | ||
| log("Adding standalone file for audit", Project.MSG_VERBOSE); | ||
| allFiles.add(new File(fileName)); |
There was a problem hiding this comment.
Either return List<Path> (preferrable, if consumer is on Java 7+), otherwise (and only then) stick with new File(fileName) but annotate the code line to be ignored by Modernizer.
There was a problem hiding this comment.
Windows test execution is failing, so update is not that trivial.
There was a problem hiding this comment.
Wherever you see java.io.File get rid of it.
Hmmm, looks like we need to do this in phases, too much to change.
There was a problem hiding this comment.
Modernizing is a non-trivial task, typically, and Modernizer ist just a trigger to think over the solution - it does not provide it. ;-)
There was a problem hiding this comment.
@mkarg , do you know how to make suppression annotation to work ?
@SuppressWarnings("modernizer")
private static URI getFilepathOrClasspathUri(String filename) throws CheckstyleException {
I pushed this to PR ... but it is ignored, I tried on class - ignored, on variable - ignored. Ignored means still violation present.
✔ ~/java/github/checkstyle/checkstyle [dependabot/maven/org.gaul-modernizer-maven-plugin-3.0.0|✔]
$ mvn modernizer:modernizer
[INFO] Scanning for projects...
[INFO] Inspecting build with total of 1 modules...
[INFO] Installing Nexus Staging features:
[INFO] ... total of 1 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
[INFO]
[INFO] ------------------< com.puppycrawl.tools:checkstyle >-------------------
[INFO] Building checkstyle 10.21.2-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- modernizer-maven-plugin:3.0.0:modernizer (default-cli) @ checkstyle ---
[ERROR] /home/rivanov/java/github/checkstyle/checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/utils/CommonUtil.java:396: Prefer java.nio.file.Paths.get(String)
@SuppressModernizer is not an option as it will extend dependencies, we are library project we do not do this easily.
There was a problem hiding this comment.
what is wrong with this update allFiles.add(Paths.get(fileName).toFile()); ?
There was a problem hiding this comment.
CI failure #16095 (comment)
We need someone with Windows to figure out a reason and do workaround in test implementation
There was a problem hiding this comment.
what is wrong with this update
allFiles.add(Paths.get(fileName).toFile());?
Nothing, as long as you are on Java 7...10; on Java 11+ replace Paths.get by Path.of.
There was a problem hiding this comment.
@mkarg , do you know how to make suppression annotation to work ?
@SuppressWarnings("modernizer") private static URI getFilepathOrClasspathUri(String filename) throws CheckstyleException {I pushed this to PR ... but it is ignored, I tried on class - ignored, on variable - ignored. Ignored means still violation present.
✔ ~/java/github/checkstyle/checkstyle [dependabot/maven/org.gaul-modernizer-maven-plugin-3.0.0|✔] $ mvn modernizer:modernizer [INFO] Scanning for projects... [INFO] Inspecting build with total of 1 modules... [INFO] Installing Nexus Staging features: [INFO] ... total of 1 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin [INFO] [INFO] ------------------< com.puppycrawl.tools:checkstyle >------------------- [INFO] Building checkstyle 10.21.2-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- modernizer-maven-plugin:3.0.0:modernizer (default-cli) @ checkstyle --- [ERROR] /home/rivanov/java/github/checkstyle/checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/utils/CommonUtil.java:396: Prefer java.nio.file.Paths.get(String)
@SuppressModernizeris not an option as it will extend dependencies, we are library project we do not do this easily.
This is not supported yet. Feel free to post a PR if needed.
833b3fc to
d434230
Compare
| final List<Integer> result = new ArrayList<>(); | ||
| try (BufferedReader br = Files.newBufferedReader( | ||
| Paths.get(aFileName), StandardCharsets.UTF_8)) { | ||
| Path.of(aFileName), StandardCharsets.UTF_8)) { |
There was a problem hiding this comment.
public static Path get(URI uri)
Converts the given URI to a Path object.
Implementation Requirements:
This method simply invokes Path.of(URI) with the given parameter.
d434230 to
28b7d06
Compare
28b7d06 to
ec95fdb
Compare
|
f792590 to
545327b
Compare
Bumps commons-beanutils:commons-beanutils from 1.9.4 to 1.10.0. --- updated-dependencies: - dependency-name: commons-beanutils:commons-beanutils dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
545327b to
ee60147
Compare
| <exclusionPattern>java/util/Optional.get:.*</exclusionPattern> | ||
| <!-- until https://github.com/gaul/modernizer-maven-plugin/issues/318 --> | ||
| <exclusionPattern>java/io/File.*</exclusionPattern> | ||
| <exclusionPattern>java/nio/file/Paths.get:.*</exclusionPattern> |
There was a problem hiding this comment.
I was not able to find way to suppress violation on
checkstyle/src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java:321: Prefer java.nio.file.Path.of(String, String...) by exact match to pattern, so falled back to regexp. kind of suppress all, unfortunate.
Bumps org.gaul:modernizer-maven-plugin from 2.9.0 to 3.0.0.
Release notes
Sourced from org.gaul:modernizer-maven-plugin's releases.
Commits
29746e7modernizer-maven-plugin 3.0.0 release2c6c8b9Add missing url and descriptionbc5061aAdd nexus-staging-maven-pluginc2042e3ci.yml: Java 8 -> Java11243a9a9Do not ask people to stick with java.io.FileWriter in Java 11 when asking peo...f2f1b8cfixup! Add violation for FileReader507d6c0Tests for File, Paths, FileInputStream, FileOutputStream, FileReader and File...e457fadAdd violation for FileWriter53f81ceDo not ask people to stick with java.io.FileReader in Java 11 when asking peo...964d4ccAdd violation for FileReaderDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot mergewill merge this PR after your CI passes on it@dependabot squash and mergewill squash and merge this PR after your CI passes on it@dependabot cancel mergewill cancel a previously requested merge and block automerging@dependabot reopenwill reopen this PR if it is closed@dependabot closewill close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditionswill show all of the ignore conditions of the specified dependency@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)