netty5/codec-smtp/src
Nikolay Fedorovskikh 0234878c4b Fix the commands cache and hashCode() in SmtpCommand
Motivation:
- A `hashCode` of the SmtpCommand is recalculated on each call of `hashCode()`. Cached hash code value can be just replaced with call of `name.hashCode()`.
- The commands cache don't work for strings: `SmtpCommand.valueOf("HELO")` returns a new instance.
- Field `contentExpected` is redundant and can be replaced with `equals(DATA)`.

Modifications:
- Use the `name.hashCode()` as hash code result.
- Fix a command cache: use strings as map keys.
- Replace field `contentExpected` to using `this.equals(DATA)`.
- Add unit tests.

Result:
More correct and clean code.
2017-08-18 09:46:53 +02:00
..
main/java/io/netty/handler/codec/smtp Fix the commands cache and hashCode() in SmtpCommand 2017-08-18 09:46:53 +02:00
test/java/io/netty/handler/codec/smtp Fix the commands cache and hashCode() in SmtpCommand 2017-08-18 09:46:53 +02:00