refactoring/536_Resolve_Sonar_cloud_findings#539
Conversation
|
| result = prime * result + (this.withoutTags ? 1231 : 1237); | ||
| result = prime * result + ((this.tags == null) ? 0 : this.tags.hashCode()); | ||
| return result; | ||
| return Objects.hash(this.artifactTypes, this.tags, this.withoutTags); |
There was a problem hiding this comment.
Only mentioned once: check if a Test with equalsverifier exists
There was a problem hiding this comment.
Junie says:
No classes were found that override equals and/or
hashCodebut lack a matchingEqualsVerifierunit test. All identified classes that implement these methods are already covered byEqualsVerifier.
| */ | ||
| public Set<String> getArtifactTypes() | ||
| { | ||
| return this.artifactTypes; |
There was a problem hiding this comment.
Is this necessary when the builder already makes the list unmodifiable?
Only mentioned once.
There was a problem hiding this comment.
You are right. Should only be done once in the builder.
| public Builder artifactTypes(final Set<String> artifactTypes) | ||
| { | ||
| this.artifactTypes = artifactTypes; | ||
| this.artifactTypes = Collections.unmodifiableSet(artifactTypes); |
There was a problem hiding this comment.
Better create a defensive copy. Only mentioned once.
| public Map<LinkStatus, List<LinkedSpecificationItem>> getLinks() | ||
| { | ||
| return this.links; | ||
| return new EnumMap<>(this.links); |
There was a problem hiding this comment.
This one is tricky, since there is a bidirectional linking mechanism in the way.
Create issue #540.
| } | ||
| catch (final ClassNotFoundException ignore) | ||
| { | ||
| LOGGER.log(Level.FINEST, () -> "Unable to find class " + name + " with child logger." |
There was a problem hiding this comment.
Classloader, not logger.
Add classloader names to log Message
|
|
||
| final SpecificationListBuilder builder = this.builderArg.getValue(); | ||
| assertThat(result, sameInstance(builder.build())); | ||
| assertThat(result, equalTo(builder.build())); |
There was a problem hiding this comment.
Ensure that model class is tested with equalsverifier
There was a problem hiding this comment.
SpecificationItem has that test.
| @@ -49,7 +50,7 @@ private void processLine(final LineConsumer consumer, final int currentLineNumbe | |||
| catch (final Exception exception) | |||
There was a problem hiding this comment.
Maybe catching runtimeexception is enough here? Then you can avoid the suppression.
…ric wildcard parameter in AbstractLightWeightMarkupImporterTest.
…ilders do it already.


This is part 2 of the solution for #536. After the local Sonar findings are addressed, we now work on the SonarCloud findings.
Contributes to #536.