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

Remove GWT's Map polyfill #10063

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
class InternalHashCodeMap<K, V> implements Iterable<Entry<K, V>> {

private final InternalJsMap<Object> backingMap = InternalJsMapFactory.newJsMap();
private final InternalJsMap<Object> backingMap = new InternalJsMap<>();
private AbstractHashMap<K, V> host;
private int size;

Expand Down
35 changes: 9 additions & 26 deletions user/super/com/google/gwt/emul/java/util/InternalJsMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import jsinterop.annotations.JsType;

@JsType(isNative = true, name = "Map", namespace = JsPackage.GLOBAL)
interface InternalJsMap<V> {
class InternalJsMap<V> {

@JsType(isNative = true, name = "IteratorIterable", namespace = JsPackage.GLOBAL)
interface Iterator<V> {
Expand All @@ -47,31 +47,14 @@ interface IteratorEntry<V> {
default V getValue() { return JsUtils.uncheckedCast(getValueInternal()[1]); }
}

V get(int key);
V get(String key);
void set(int key, V value);
void set(String key, V value);
Iterator<V> entries();

@JsOverlay
default void delete(int key) {
// Calls delete without map.delete in order to be compatible with old browsers where delete is a
// keyword.
DeleteFunction fn = JsUtils.getProperty(this, "delete");
fn.call(this, key);
}

@JsOverlay
default void delete(String key) {
// Calls delete without map.delete in order to be compatible with old browsers where delete is a
// keyword.
DeleteFunction fn = JsUtils.getProperty(this, "delete");
fn.call(this, key);
InternalJsMap() {
}

@JsType(isNative = true, name = "Function", namespace = JsPackage.GLOBAL)
interface DeleteFunction {
void call(InternalJsMap<?> thisArg, String key);
void call(InternalJsMap<?> thisArg, int key);
}
native V get(int key);
native V get(String key);
native void set(int key, V value);
native void set(String key, V value);
native Iterator<V> entries();
native void delete(String key);
native void delete(int key);
}
168 changes: 0 additions & 168 deletions user/super/com/google/gwt/emul/java/util/InternalJsMapFactory.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
class InternalStringMap<K, V> implements Iterable<Entry<K, V>> {

private final InternalJsMap<V> backingMap = InternalJsMapFactory.newJsMap();
private final InternalJsMap<V> backingMap = new InternalJsMap<>();
private AbstractHashMap<K, V> host;
private int size;

Expand Down
Loading