Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
[JENKINS-19047] Make column part of public API of FileAnnotation.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Aug 14, 2013
1 parent f0f8dd4 commit c4b4da2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
Expand Up @@ -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());
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down
Expand Up @@ -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();
}
Expand Up @@ -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());

Expand Down

0 comments on commit c4b4da2

Please sign in to comment.