Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Reimplement CharSequenceMap to obey Map contract #11308

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Reimplement CharSequenceMap to obey Map contract
The previous `CharSequenceMap` implementation did not follow general
`Map` contract. For example, `Map.keySet()` should be a live view of the
keys in the map, but it was a copy. This commit reimplements the class
so that it obeys the map contract, while maintaining the fundamental
objective of the class, which is to compare `CharSequence` keys by the
value of char sequences they describe.
  • Loading branch information
findepi committed Oct 12, 2024
commit cf74397db16b826410ed61fd0aeba38db902ef0d
159 changes: 159 additions & 0 deletions .palantir/revapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,159 @@ acceptedBreaks:
new: "method void org.apache.iceberg.encryption.PlaintextEncryptionManager::<init>()"
justification: "Deprecations for 1.6.0 release"
"1.6.0":
org.apache.iceberg:iceberg-api:
- code: "java.class.noLongerImplementsInterface"
old: "class org.apache.iceberg.util.CharSequenceMap<V extends java.lang.Object>"
new: "class org.apache.iceberg.util.CharSequenceMap"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.class.nowAbstract"
old: "class org.apache.iceberg.util.CharSequenceMap<V extends java.lang.Object>"
new: "class org.apache.iceberg.util.CharSequenceMap"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.generics.formalTypeParameterRemoved"
old: "class org.apache.iceberg.util.CharSequenceMap<V extends java.lang.Object>"
new: "class org.apache.iceberg.util.CharSequenceMap"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method <K, V> java.util.Map.Entry<K, V> java.util.Map<K, V>::entry(K,\
\ V) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method <K, V> java.util.Map<K, V> java.util.Map<K, V>::copyOf(java.util.Map<?\
\ extends K, ? extends V>) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method <K, V> java.util.Map<K, V> java.util.Map<K, V>::of() @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method <K, V> java.util.Map<K, V> java.util.Map<K, V>::of(K, V) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method <K, V> java.util.Map<K, V> java.util.Map<K, V>::of(K, V, K, V)\
\ @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method <K, V> java.util.Map<K, V> java.util.Map<K, V>::of(K, V, K, V,\
\ K, V) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method <K, V> java.util.Map<K, V> java.util.Map<K, V>::of(K, V, K, V,\
\ K, V, K, V) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method <K, V> java.util.Map<K, V> java.util.Map<K, V>::of(K, V, K, V,\
\ K, V, K, V, K, V) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method <K, V> java.util.Map<K, V> java.util.Map<K, V>::of(K, V, K, V,\
\ K, V, K, V, K, V, K, V) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method <K, V> java.util.Map<K, V> java.util.Map<K, V>::of(K, V, K, V,\
\ K, V, K, V, K, V, K, V, K, V) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method <K, V> java.util.Map<K, V> java.util.Map<K, V>::of(K, V, K, V,\
\ K, V, K, V, K, V, K, V, K, V, K, V) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method <K, V> java.util.Map<K, V> java.util.Map<K, V>::of(K, V, K, V,\
\ K, V, K, V, K, V, K, V, K, V, K, V, K, V) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method <K, V> java.util.Map<K, V> java.util.Map<K, V>::of(K, V, K, V,\
\ K, V, K, V, K, V, K, V, K, V, K, V, K, V, K, V) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method <K, V> java.util.Map<K, V> java.util.Map<K, V>::ofEntries(java.util.Map.Entry<?\
\ extends K, ? extends V>[]) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method V java.util.Map<K, V>::compute(K, java.util.function.BiFunction<?\
\ super K, ? super V, ? extends V>) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method V java.util.Map<K, V>::computeIfAbsent(K, java.util.function.Function<?\
\ super K, ? extends V>) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method V java.util.Map<K, V>::computeIfPresent(K, java.util.function.BiFunction<?\
\ super K, ? super V, ? extends V>) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method V java.util.Map<K, V>::getOrDefault(java.lang.Object, V) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method V java.util.Map<K, V>::merge(K, V, java.util.function.BiFunction<?\
\ super V, ? super V, ? extends V>) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method V java.util.Map<K, V>::putIfAbsent(K, V) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method V java.util.Map<K, V>::replace(K, V) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method V org.apache.iceberg.util.CharSequenceMap<V>::computeIfAbsent(java.lang.CharSequence,\
\ java.util.function.Supplier<V>)"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method V org.apache.iceberg.util.CharSequenceMap<V>::get(java.lang.Object)"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method V org.apache.iceberg.util.CharSequenceMap<V>::put(java.lang.CharSequence,\
\ V)"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method V org.apache.iceberg.util.CharSequenceMap<V>::remove(java.lang.Object)"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method boolean java.util.Map<K, V>::remove(java.lang.Object, java.lang.Object)\
\ @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method boolean java.util.Map<K, V>::replace(K, V, V) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method boolean org.apache.iceberg.util.CharSequenceMap<V>::containsKey(java.lang.Object)"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method boolean org.apache.iceberg.util.CharSequenceMap<V>::containsValue(java.lang.Object)"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method boolean org.apache.iceberg.util.CharSequenceMap<V>::isEmpty()"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method int org.apache.iceberg.util.CharSequenceMap<V>::size()"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method java.util.Collection<V> org.apache.iceberg.util.CharSequenceMap<V>::values()"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method java.util.Set<java.lang.CharSequence> org.apache.iceberg.util.CharSequenceMap<V>::keySet()"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method java.util.Set<java.util.Map.Entry<java.lang.CharSequence, V>> org.apache.iceberg.util.CharSequenceMap<V>::entrySet()"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method void java.util.Map<K, V>::forEach(java.util.function.BiConsumer<?\
\ super K, ? super V>) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method void java.util.Map<K, V>::replaceAll(java.util.function.BiFunction<?\
\ super K, ? super V, ? extends V>) @ org.apache.iceberg.util.CharSequenceMap<V>"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method void org.apache.iceberg.util.CharSequenceMap<V>::clear()"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.removed"
old: "method void org.apache.iceberg.util.CharSequenceMap<V>::putAll(java.util.Map<?\
\ extends java.lang.CharSequence, ? extends V>)"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.returnTypeChanged"
old: "method <T> org.apache.iceberg.util.CharSequenceMap<T> org.apache.iceberg.util.CharSequenceMap<V>::create()"
new: "method <V> java.util.Map<java.lang.CharSequence, V> org.apache.iceberg.util.CharSequenceMap::create()"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
org.apache.iceberg:iceberg-common:
- code: "java.method.removed"
old: "method <T> org.apache.iceberg.common.DynFields.StaticField<T> org.apache.iceberg.common.DynFields.Builder::buildStaticChecked()\
Expand Down Expand Up @@ -1139,6 +1292,12 @@ acceptedBreaks:
\ java.lang.String>, java.lang.String, java.lang.String, java.lang.String,\
\ java.lang.String, java.lang.String)"
justification: "Removing deprecated code"
- code: "java.method.returnTypeChanged"
old: "method <T extends org.apache.iceberg.StructLike> org.apache.iceberg.util.CharSequenceMap<org.apache.iceberg.deletes.PositionDeleteIndex>\
\ org.apache.iceberg.deletes.Deletes::toPositionIndexes(org.apache.iceberg.io.CloseableIterable<T>)"
new: "method <T extends org.apache.iceberg.StructLike> java.util.Map<java.lang.CharSequence,\
\ org.apache.iceberg.deletes.PositionDeleteIndex> org.apache.iceberg.deletes.Deletes::toPositionIndexes(org.apache.iceberg.io.CloseableIterable<T>)"
justification: "CharSequenceMap did not fulfill Map contract and was reimplemented"
- code: "java.method.returnTypeChanged"
old: "method org.apache.iceberg.BaseMetastoreTableOperations.CommitStatus org.apache.iceberg.BaseMetastoreTableOperations::checkCommitStatus(java.lang.String,\
\ org.apache.iceberg.TableMetadata)"
Expand Down
Loading
Loading