You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "breken-ai (via GitHub)" <gi...@apache.org> on 2026/10/08 00:25:45 UTC
Re: [PR] Fix Map.Entry contract for CaseInsensitiveKeyMap entries [tomcat]
breken-ai commented on PR #1075:
URL: https://github.com/apache/tomcat/pull/1075#issuecomment-6049588623
`SimpleImmutableEntry` here is the JDK's `java.util.AbstractMap.SimpleImmutableEntry` (since Java 6). `CaseInsensitiveKeyMap` extends `AbstractMap`, so the nested `EntrySet`/`EntryIterator` code can refer to it by its simple name through the inherited member type, and no import or new class is needed. The PR doesn't add a class of its own.
I checked this against the branch's `CaseInsensitiveKeyMap.java`, with a `StringManager` stub, using `javac -Xlint:all` from JDK 17. It compiles without warnings. An entry from `entrySet().iterator().next()` is a `java.util.AbstractMap$SimpleImmutableEntry`, `entry.equals(hashMapEntry)` is true, `hashMap.hashCode() == map.hashCode()` is true, and `setValue()` still throws `UnsupportedOperationException`. The full `ant test` run in the description was on JDK 21.
If you meant that it should be written out explicitly, I can change the call to `new AbstractMap.SimpleImmutableEntry<>(...)`. Or, if you'd rather keep a Tomcat-owned type, I can keep `EntryImpl` and give it `equals()`/`hashCode()` that follow the `Map.Entry` definitions. Let me know which you prefer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org