You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by eo...@apache.org on 2020/01/03 09:55:34 UTC
[maven-checkstyle-plugin] 05/06: [[MCHECKSTYLE-385]] apply existing
code conventions
This is an automated email from the ASF dual-hosted git repository.
eolivelli pushed a commit to branch MCHECKSTYLE-385
in repository https://gitbox.apache.org/repos/asf/maven-checkstyle-plugin.git
commit ff0b3759c19dcbbba3774bb8014670ea160d77b8
Author: Benjamin Marwell <bm...@gmail.com>
AuthorDate: Fri Dec 13 20:51:51 2019 +0100
[[MCHECKSTYLE-385]] apply existing code conventions
- change collections to remain modifiable.
- Use 'else' instead of guard statements in Violation.java.
---
.../plugins/checkstyle/CheckstyleViolationCheckMojo.java | 2 +-
.../org/apache/maven/plugins/checkstyle/Violation.java | 15 ++++++++++-----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
index 531a108..9a0c4ba 100644
--- a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
+++ b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
@@ -658,7 +658,7 @@ public class CheckstyleViolationCheckMojo
violations.add( violation );
}
- return Collections.unmodifiableList( violations );
+ return violations;
}
private int countViolations( List<Violation> violations )
diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/Violation.java b/src/main/java/org/apache/maven/plugins/checkstyle/Violation.java
index 0590b95..91f1343 100644
--- a/src/main/java/org/apache/maven/plugins/checkstyle/Violation.java
+++ b/src/main/java/org/apache/maven/plugins/checkstyle/Violation.java
@@ -121,22 +121,27 @@ public class Violation
/**
* Returns the column in which the violation occurred, if available.
*
- * @return the column in which the violation occurred, if available. Otherwise returns {@code "-1"}.
+ * @return the column in which the violation occurred, if available. Otherwise returns {@link #NO_COLUMN}.
*/
protected String getColumn( )
{
return column;
}
+ /**
+ * Sets the column value for this violation to the given string value.
+ * @param column the column value to set. May be {@code null}, which will set it to the {@link #NO_COLUMN} value.
+ */
protected void setColumn( /* Nullable */ String column )
{
- if ( null == column || column.length() < 1 )
+ if ( column == null || column.length() < 1 )
{
this.column = NO_COLUMN;
- return;
}
-
- this.column = column;
+ else
+ {
+ this.column = column;
+ }
}
/**