Pull #2291: Modernize codebase with Java improvements - Unnecessary throws#2291
Pull #2291: Modernize codebase with Java improvements - Unnecessary throws#2291Pankraz76 wants to merge 1 commit intoapache:masterfrom
Unnecessary throws#2291Conversation
b10c8fb to
bf48163
Compare
impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelProcessor.java
Show resolved
Hide resolved
Modernize codebase with Java improvements - Unnecessary throwsModernize codebase with Java improvements - Unnecessary throws
bf48163 to
01e5e53
Compare
gnodet
left a comment
There was a problem hiding this comment.
This may lead to incompatibilities if someone overrides a protected method and actually throw one exception that you removed. No incompatible change in compat modules is required.
new contract is not to throw; with checked it wont compile and runtime is always possible.
so undo in this module and then any good ? |
01e5e53 to
a84fac9
Compare
done. |
gnodet
left a comment
There was a problem hiding this comment.
If you remove a throws clause from a protected method, any class that overrides this method won't be able to throw that exception, so that's an API change.
Modernize codebase with Java improvements - Unnecessary throwsUnnecessary throws
|
how to fix this permanent @timtebeek ? We dont have checkstyle for this. Do we have the (local) I do not want to overload and spam PR´s like its done in rewrite. Ideally this breaks and fixes locally on dev´s machine/cost. Thank you so much for this tool. Its a great needed help. We enlight the code so much. This codebase is very smart as the code will format itself just like aimed in but, its still not capable of fixing all like imports. This we will cover with help of rewrite again. |
|
Thanks all! Indeed we should not be making changes to an API that was explicitly marked as protected with exceptions declared; |
* UnnecessaryThrows should not change API for protected methods For apache/maven#2291 Needs openrewrite/rewrite#5412 * Adjust logic following review
|
wip reopen: wait for bugfix release or rewrite. |
Pull #2291:
Modernize codebase with Java improvements - Unnecessary throwsApply:
Prerequisite:
DefaultModelProcessor#read#2292fix:

Ref:
Unnecessary throwscheckstyle/checkstyle#17005