Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
[JENKINS-19047] Make column part of public API of FileAnnotation.
  • Loading branch information
uhafner committed Aug 14, 2013
1 parent f0f8dd4 commit c4b4da266808e8bf4a3609960764f183ddc67a53
@@ -135,7 +135,7 @@ public AbstractAnnotation(final Priority priority, final String message, final i
* the annotation to copy the values from
*/
@edu.umd.cs.findbugs.annotations.SuppressWarnings("ST")
public AbstractAnnotation(final AbstractAnnotation copy) {
public AbstractAnnotation(final FileAnnotation copy) {
key = currentKey++;

message = TreeString.of(copy.getMessage());
@@ -295,22 +295,12 @@ public String getOrigin() {
return StringUtils.defaultString(origin);
}

/**
* Returns the end column of the position of this warning.
*
* @return the end column
* @since 1.51
*/
/** {@inheritDoc} */
public int getColumnEnd() {
return primaryColumnEnd;
}

/**
* Returns the start column of the position of this warning.
*
* @return the start column
* @since 1.51
*/
/** {@inheritDoc} */
public int getColumnStart() {
return primaryColumnStart;
}
@@ -589,12 +579,9 @@ public int compareTo(final FileAnnotation other) {
if (result != 0) {
return result;
}
if (other instanceof AbstractAnnotation) {
AbstractAnnotation otherWarning = (AbstractAnnotation)other;
result = getColumnStart() - otherWarning.getColumnStart();
if (result != 0) {
return result;
}
result = getColumnStart() - other.getColumnStart();
if (result != 0) {
return result;
}

return hashCode() - other.hashCode(); // fallback
@@ -184,4 +184,20 @@ public interface FileAnnotation extends Comparable<FileAnnotation> {
* @param contextHashCode the value to set
*/
void setContextHashCode(long contextHashCode);

/**
* Returns the start column of the position of this warning.
*
* @return the start column
* @since 1.52
*/
int getColumnStart();

/**
* Returns the end column of the position of this warning.
*
* @return the end column
* @since 1.52
*/
int getColumnEnd();
}
@@ -54,7 +54,7 @@ public void issue17287() {

private void verifyOrder(final List<AbstractAnnotation> warnings, final boolean isAscending) {
int position = 0;
for (AbstractAnnotation warning : warnings) {
for (FileAnnotation warning : warnings) {
int actualPosition = isAscending ? position : warnings.size() - position - 1;
assertEquals("Wrong position: ", String.valueOf(actualPosition), warning.getMessage());

0 comments on commit c4b4da2

Please sign in to comment.