-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code simplifications in AbstractMojo #47
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
just minor comment.
maybe it's only me but I find adding final not adding any real value here
@@ -196,16 +196,17 @@ protected File getJarFile( File basedir, String resultFinalName, String classifi | |||
throw new IllegalArgumentException( "finalName is not allowed to be null" ); | |||
} | |||
|
|||
StringBuilder fileName = new StringBuilder( resultFinalName ); | |||
|
|||
final String fileName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what is the need if final here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No real need, it's mostly just syntactic sugar in this case. It's somewhat a statement of intent indicating that the value will be calculated only once.
This was the kind of feedback I was seeking though - if you're happy with the changeset in principle, I'll take the final
s out, cut a Jira ticket and make the PR more presentable etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all good. please remove those final
as I don't think they make sense for a local variable. except adding more useless code.
btw I'm more a sugar free person if it's not really needed 🤣
if you want to create a jira why not but I'm not sure we need a Jira for such code polishing.
it's up2u
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The less I need to touch Jira the better. OK, I've removed the final
s and updated the PR description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rhowe great. Thanks! Still on final to remove ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, OK the final final
is gone
@@ -243,18 +244,11 @@ public File createArchive() | |||
} | |||
} | |||
|
|||
final String archiverName = containsModuleDescriptor ? "mjar" : "jar"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why final? no real need of this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh oh, I know people they insinst on final...
Inverting this test leads to a more readable flow.
We can remove all branching from this method and return the check directly.
Clean up a few overly-verbose code constructs:
StringBuilder
with string concatenation.else
branch by returning early inAbstractMojo#projectHasAlreadySetAnArtifact()
AbstractMojo#hasClassifier()