MINOR: Update javadocs and exception string in "deprecated" ProcessorRecordContext#hashcode (#15508)

This PR updates the javadocs for the "deprecated" hashCode() method of ProcessorRecordContext, as well as the UnsupportedOperationException thrown in its implementation, to actually explain why the class is mutable and therefore unsafe for use in hash collections. They now point out the mutable field in the class (namely the Headers)

Reviewers: Matthias Sax <mjsax@apache.org>, Bruno Cadonna <cadonna@apache.org>
This commit is contained in:
A. Sophie Blee-Goldman 2024-03-14 23:08:39 -07:00 committed by GitHub
parent e4c53d093e
commit 96bfac4216
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -193,12 +193,14 @@ public class ProcessorRecordContext implements RecordContext, RecordMetadata {
}
/**
* Equality is implemented in support of tests, *not* for use in Hash collections, since this class is mutable.
* Equality is implemented in support of tests, *not* for use in Hash collections, since this class is mutable
* due to the {@link Headers} field it contains.
*/
@Deprecated
@Override
public int hashCode() {
throw new UnsupportedOperationException("ProcessorRecordContext is unsafe for use in Hash collections");
throw new UnsupportedOperationException("ProcessorRecordContext is unsafe for use in Hash collections "
+ "due to the mutable Headers field");
}
@Override