-
Notifications
You must be signed in to change notification settings - Fork 173
(doc) Simplify CompilationFailureException #19
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
Conversation
06dc84a
to
cee6ad8
Compare
Should this change have a Jira ticket? |
@@ -43,13 +43,11 @@ public static String longMessage( List<CompilerMessage> messages ) | |||
{ | |||
StringBuilder sb = new StringBuilder(); | |||
|
|||
if ( messages != null ) | |||
for ( CompilerMessage compilerError : messages ) |
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.
Let's use this opportunity to improve javadoc as well and to make clear that messages cannot be null
.
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.
Sounds good to me - how's it looking now?
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.
Should these methods be private static
or just inlined into the constructor? They have no other callers
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, it's not possible to inline them because of the super()
call
If the messages list is null, this class will throw a NullPointerException in its shortMessage() method, so having a check for a null message list in longMessage() seems unnecessary. Remove it.
cee6ad8
to
8a5e02d
Compare
8a5e02d
to
83b0343
Compare
I'm afraid the tests aren't working for me locally - |
Tests passed for me on an OS X device |
@rfscholte any love for this little cleanup? |
Jenkins was happy too, so PR is merged. Thanks for the patch! |
This class can be a little bit more concise.
The nullity check in
longMessage()
is made redundant by the lack of an equivalent check inshortMessage
.CompilationFailureException
is thrown in two places inAbstractCompilerMojo
and both of those are guaranteed to pass a non-null object.Whilst we're in here, remove a redundant local variable in
shortMessage()
and merge theStringBuilder
calls onto a single line.