@Override protected Object createCollection(final Class type) { return new LineRangeList(); } }
@Override protected void populateCollection(final HierarchicalStreamReader reader, final UnmarshallingContext context, final Collection collection) { super.populateCollection(reader, context, collection); ((LineRangeList)collection).trim(); }
/** * Creates a new instance of <code>AbstractAnnotation</code>. * * @param message * the message of the warning * @param start * the first line of the line range * @param end * the last line of the line range * @param category * the category of the annotation * @param type * the type of the annotation */ @edu.umd.cs.findbugs.annotations.SuppressWarnings("ST") public AbstractAnnotation(final String message, final int start, final int end, final String category, final String type) { this.message = TreeString.of(StringUtils.strip(message)); this.category = StringUtils.defaultString(category); this.type = StringUtils.defaultString(type); key = currentKey++; lineRanges = new LineRangeList(); lineRanges.add(new LineRange(start, end)); primaryLineNumber = start; contextHashCode = currentKey; }
public LineRangeList(final Collection<LineRange> copy) { data = new byte[copy.size() * 4]; // guess for (LineRange lr : copy) { add(lr); } }
@Override public int hashCode() { int result = message != null ? message.hashCode() : 0; result = 31 * result + (priority != null ? priority.hashCode() : 0); result = 31 * result + (lineRanges != null ? lineRanges.hashCode() : 0); result = 31 * result + primaryLineNumber; result = 31 * result + (fileName != null ? fileName.hashCode() : 0); result = 31 * result + (moduleName != null ? moduleName.hashCode() : 0); result = 31 * result + (packageName != null ? packageName.hashCode() : 0); result = 31 * result + (category != null ? category.hashCode() : 0); result = 31 * result + (type != null ? type.hashCode() : 0); result = 31 * result + (origin != null ? origin.hashCode() : 0); result = 31 * result + (pathName != null ? pathName.hashCode() : 0); result = 31 * result + primaryColumnStart; result = 31 * result + primaryColumnEnd; return result; }
else if (!lineRanges.equals(other.lineRanges)) { return false;
/** * Creates a new instance of <code>AbstractAnnotation</code>. * * @param message * the message of the warning * @param start * the first line of the line range * @param end * the last line of the line range * @param category * the category of the annotation * @param type * the type of the annotation */ @SuppressFBWarnings("ST") public AbstractAnnotation(final String message, final int start, final int end, final String category, final String type) { this.message = TreeString.of(StringUtils.strip(message)); this.category = defaultString(category); this.type = defaultString(type); key = currentKey++; lineRanges = new LineRangeList(); lineRanges.add(new LineRange(start, end)); primaryLineNumber = start; contextHashCode = currentKey; }
public LineRangeList(final Collection<LineRange> copy) { data = new byte[copy.size() * 4]; // guess for (LineRange lr : copy) { add(lr); } }
@Override @SuppressWarnings("PMD") public int hashCode() { int prime = 31; int result = 1; result = prime * result + ((category == null) ? 0 : category.hashCode()); result = prime * result + ((fileName == null) ? 0 : fileName.hashCode()); result = prime * result + ((lineRanges == null) ? 0 : lineRanges.hashCode()); result = prime * result + ((message == null) ? 0 : message.hashCode()); result = prime * result + ((moduleName == null) ? 0 : moduleName.hashCode()); result = prime * result + ((packageName == null) ? 0 : packageName.hashCode()); result = prime * result + primaryLineNumber; result = prime * result + primaryColumnStart; result = prime * result + primaryColumnEnd; result = prime * result + ((priority == null) ? 0 : priority.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); return result; }
return false; if (lineRanges != null ? !lineRanges.equals(that.lineRanges) : that.lineRanges != null) { return false;
@Override protected void populateCollection(final HierarchicalStreamReader reader, final UnmarshallingContext context, final Collection collection) { super.populateCollection(reader, context, collection); ((LineRangeList)collection).trim(); }
@Override protected Object createCollection(final Class type) { return new LineRangeList(); } }
/** * {@link AbstractAnnotationParser} can call this method to let * {@link AbstractAnnotation}s to reduce their memory footprint by sharing * what they can share with other {@link AbstractAnnotation}s. * * @param builder * caches previously used strings * @since 1.43 */ public void intern(final TreeStringBuilder builder) { lineRanges.trim(); message = builder.intern(message); fileName = builder.intern(fileName); moduleName = builder.intern(moduleName); packageName = builder.intern(packageName); readResolve(); // String.intern some of the data fields }
/** * Copy constructor: Creates a new instance of {@link AbstractAnnotation}. * * @param copy * the annotation to copy the values from */ @edu.umd.cs.findbugs.annotations.SuppressWarnings("ST") public AbstractAnnotation(final AbstractAnnotation copy) { key = currentKey++; message = TreeString.of(copy.getMessage()); priority = copy.getPriority(); primaryLineNumber = copy.getPrimaryLineNumber(); lineRanges = new LineRangeList(copy.getLineRanges()); contextHashCode = copy.getContextHashCode(); fileName = TreeString.of(copy.getFileName()); category = copy.getCategory(); type = copy.getType(); moduleName = TreeString.of(copy.getModuleName()); packageName = TreeString.of(copy.getPackageName()); }
/** * {@link AbstractAnnotationParser} can call this method to let * {@link AbstractAnnotation}s to reduce their memory footprint by sharing * what they can share with other {@link AbstractAnnotation}s. * * @param builder * caches previously used strings * @since 1.43 */ public void intern(final TreeStringBuilder builder) { lineRanges.trim(); message = builder.intern(message); fileName = builder.intern(fileName); moduleName = builder.intern(moduleName); packageName = builder.intern(packageName); readResolve(); // String.intern some of the data fields }
/** * Copy constructor: Creates a new instance of {@link AbstractAnnotation}. * * @param copy * the annotation to copy the values from */ @SuppressFBWarnings("ST") public AbstractAnnotation(final FileAnnotation copy) { key = currentKey++; message = TreeString.of(copy.getMessage()); priority = copy.getPriority(); primaryLineNumber = copy.getPrimaryLineNumber(); lineRanges = new LineRangeList(copy.getLineRanges()); contextHashCode = copy.getContextHashCode(); fileName = TreeString.of(copy.getFileName()); category = copy.getCategory(); type = copy.getType(); moduleName = TreeString.of(copy.getModuleName()); packageName = TreeString.of(copy.getPackageName()); authorName = copy.getAuthorName(); authorEmail = copy.getAuthorEmail(); commitId = copy.getCommitId(); overridePackageCategoryName = TreeString.of(copy.getOverridePackageCategoryName()); }