mirror of https://github.com/apache/kafka.git
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:
parent
e4c53d093e
commit
96bfac4216
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue