From 5f3507252d43c0e9c4e7f16dfddb08c387435eb1 Mon Sep 17 00:00:00 2001 From: cpovirk Date: Mon, 25 Feb 2019 07:17:22 -0800 Subject: [PATCH] Remove GWT emulations that are no longer needed as of GWT 2.8.2. RELNOTES=Removed GWT emulations that are no longer needed as of GWT 2.8.2. This means that GWT projects that use this version of Guava must use GWT 2.8.2 or higher. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=235524613 --- guava-gwt/src-super/java/lang/Lang.gwt.xml | 1 - .../super/java/lang/InterruptedException.java | 32 -- guava-gwt/src-super/java/util/Util.gwt.xml | 6 - .../super/java/util/concurrent/Callable.java | 26 -- .../concurrent/CancellationException.java | 27 -- .../util/concurrent/ConcurrentHashMap.java | 149 -------- .../java/util/concurrent/ConcurrentMap.java | 35 -- .../super/java/util/concurrent/Delayed.java | 16 - .../util/concurrent/ExecutionException.java | 38 -- .../super/java/util/concurrent/Executor.java | 22 -- .../super/java/util/concurrent/Executors.java | 47 --- .../super/java/util/concurrent/Future.java | 42 --- .../RejectedExecutionException.java | 34 -- .../java/util/concurrent/RunnableFuture.java | 20 -- .../java/util/concurrent/ScheduledFuture.java | 18 - .../super/java/util/concurrent/TimeUnit.java | 336 ------------------ .../util/concurrent/TimeoutException.java | 26 -- .../util/concurrent/atomic/AtomicBoolean.java | 73 ---- .../util/concurrent/atomic/AtomicInteger.java | 109 ------ .../util/concurrent/atomic/AtomicLong.java | 109 ------ 20 files changed, 1166 deletions(-) delete mode 100644 guava-gwt/src-super/java/lang/Lang.gwt.xml delete mode 100644 guava-gwt/src-super/java/lang/super/java/lang/InterruptedException.java delete mode 100644 guava-gwt/src-super/java/util/Util.gwt.xml delete mode 100644 guava-gwt/src-super/java/util/super/java/util/concurrent/Callable.java delete mode 100644 guava-gwt/src-super/java/util/super/java/util/concurrent/CancellationException.java delete mode 100644 guava-gwt/src-super/java/util/super/java/util/concurrent/ConcurrentHashMap.java delete mode 100644 guava-gwt/src-super/java/util/super/java/util/concurrent/ConcurrentMap.java delete mode 100644 guava-gwt/src-super/java/util/super/java/util/concurrent/Delayed.java delete mode 100644 guava-gwt/src-super/java/util/super/java/util/concurrent/ExecutionException.java delete mode 100644 guava-gwt/src-super/java/util/super/java/util/concurrent/Executor.java delete mode 100644 guava-gwt/src-super/java/util/super/java/util/concurrent/Executors.java delete mode 100644 guava-gwt/src-super/java/util/super/java/util/concurrent/Future.java delete mode 100644 guava-gwt/src-super/java/util/super/java/util/concurrent/RejectedExecutionException.java delete mode 100644 guava-gwt/src-super/java/util/super/java/util/concurrent/RunnableFuture.java delete mode 100644 guava-gwt/src-super/java/util/super/java/util/concurrent/ScheduledFuture.java delete mode 100644 guava-gwt/src-super/java/util/super/java/util/concurrent/TimeUnit.java delete mode 100644 guava-gwt/src-super/java/util/super/java/util/concurrent/TimeoutException.java delete mode 100644 guava-gwt/src-super/java/util/super/java/util/concurrent/atomic/AtomicBoolean.java delete mode 100644 guava-gwt/src-super/java/util/super/java/util/concurrent/atomic/AtomicInteger.java delete mode 100644 guava-gwt/src-super/java/util/super/java/util/concurrent/atomic/AtomicLong.java diff --git a/guava-gwt/src-super/java/lang/Lang.gwt.xml b/guava-gwt/src-super/java/lang/Lang.gwt.xml deleted file mode 100644 index bd7134fce2b1..000000000000 --- a/guava-gwt/src-super/java/lang/Lang.gwt.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/guava-gwt/src-super/java/lang/super/java/lang/InterruptedException.java b/guava-gwt/src-super/java/lang/super/java/lang/InterruptedException.java deleted file mode 100644 index 9bfcecec7642..000000000000 --- a/guava-gwt/src-super/java/lang/super/java/lang/InterruptedException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2012 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package java.lang; - -/** - * Minimal emulation of {@link java.lang.InterruptedException}, that should only be used in method - * signatures. New GWT code should not reference this class at all. It is here only to ease the - * GWTification of common code. - * - * @author Tom O'Neill - */ -public class InterruptedException extends Exception { - public InterruptedException() {} - - public InterruptedException(String message) { - super(message); - } -} diff --git a/guava-gwt/src-super/java/util/Util.gwt.xml b/guava-gwt/src-super/java/util/Util.gwt.xml deleted file mode 100644 index 1968a1e606ce..000000000000 --- a/guava-gwt/src-super/java/util/Util.gwt.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/guava-gwt/src-super/java/util/super/java/util/concurrent/Callable.java b/guava-gwt/src-super/java/util/super/java/util/concurrent/Callable.java deleted file mode 100644 index 607d3f76d599..000000000000 --- a/guava-gwt/src-super/java/util/super/java/util/concurrent/Callable.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2011 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package java.util.concurrent; - -/** - * Emulation of Callable. - * - * @author Charles Fry - */ -public interface Callable { - V call() throws Exception; -} diff --git a/guava-gwt/src-super/java/util/super/java/util/concurrent/CancellationException.java b/guava-gwt/src-super/java/util/super/java/util/concurrent/CancellationException.java deleted file mode 100644 index 29bd332e6bad..000000000000 --- a/guava-gwt/src-super/java/util/super/java/util/concurrent/CancellationException.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2015 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package java.util.concurrent; - -/** Emulation of CancellationException. */ -public class CancellationException extends IllegalStateException { - - public CancellationException() {} - - public CancellationException(String message) { - super(message); - } -} diff --git a/guava-gwt/src-super/java/util/super/java/util/concurrent/ConcurrentHashMap.java b/guava-gwt/src-super/java/util/super/java/util/concurrent/ConcurrentHashMap.java deleted file mode 100644 index 7367f04c00a1..000000000000 --- a/guava-gwt/src-super/java/util/super/java/util/concurrent/ConcurrentHashMap.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (C) 2009 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package java.util.concurrent; - -import java.util.AbstractMap; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -/** - * Minimal emulation of {@link java.util.concurrent.ConcurrentHashMap}. Note that the javascript - * interpreter is - * single-threaded, it is essentially a {@link java.util.HashMap}, implementing the new methods - * introduced by {@link ConcurrentMap}. - * - * @author Hayward Chan - */ -public class ConcurrentHashMap extends AbstractMap implements ConcurrentMap { - - private final Map backingMap; - - public ConcurrentHashMap() { - this.backingMap = new HashMap(); - } - - public ConcurrentHashMap(int initialCapacity) { - this.backingMap = new HashMap(initialCapacity); - } - - public ConcurrentHashMap(int initialCapacity, float loadFactor) { - this.backingMap = new HashMap(initialCapacity, loadFactor); - } - - public ConcurrentHashMap(Map t) { - this.backingMap = new HashMap(t); - } - - public V putIfAbsent(K key, V value) { - if (!containsKey(key)) { - return put(key, value); - } else { - return get(key); - } - } - - public boolean remove(Object key, Object value) { - if (containsKey(key) && get(key).equals(value)) { - remove(key); - return true; - } else { - return false; - } - } - - public boolean replace(K key, V oldValue, V newValue) { - if (oldValue == null || newValue == null) { - throw new NullPointerException(); - } else if (containsKey(key) && get(key).equals(oldValue)) { - put(key, newValue); - return true; - } else { - return false; - } - } - - public V replace(K key, V value) { - if (value == null) { - throw new NullPointerException(); - } else if (containsKey(key)) { - return put(key, value); - } else { - return null; - } - } - - @Override - public boolean containsKey(Object key) { - if (key == null) { - throw new NullPointerException(); - } - return backingMap.containsKey(key); - } - - @Override - public V get(Object key) { - if (key == null) { - throw new NullPointerException(); - } - return backingMap.get(key); - } - - @Override - public V put(K key, V value) { - if (key == null || value == null) { - throw new NullPointerException(); - } - return backingMap.put(key, value); - } - - @Override - public boolean containsValue(Object value) { - if (value == null) { - throw new NullPointerException(); - } - return backingMap.containsValue(value); - } - - @Override - public V remove(Object key) { - if (key == null) { - throw new NullPointerException(); - } - return backingMap.remove(key); - } - - @Override - public Set> entrySet() { - return backingMap.entrySet(); - } - - public boolean contains(Object value) { - return containsValue(value); - } - - public Enumeration elements() { - return Collections.enumeration(values()); - } - - public Enumeration keys() { - return Collections.enumeration(keySet()); - } -} diff --git a/guava-gwt/src-super/java/util/super/java/util/concurrent/ConcurrentMap.java b/guava-gwt/src-super/java/util/super/java/util/concurrent/ConcurrentMap.java deleted file mode 100644 index 49c05ce22d2b..000000000000 --- a/guava-gwt/src-super/java/util/super/java/util/concurrent/ConcurrentMap.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2009 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package java.util.concurrent; - -import java.util.Map; - -/** - * Minimal GWT emulation of a map providing atomic operations. - * - * @author Jesse Wilson - */ -public interface ConcurrentMap extends Map { - - V putIfAbsent(K key, V value); - - boolean remove(Object key, Object value); - - V replace(K key, V value); - - boolean replace(K key, V oldValue, V newValue); -} diff --git a/guava-gwt/src-super/java/util/super/java/util/concurrent/Delayed.java b/guava-gwt/src-super/java/util/super/java/util/concurrent/Delayed.java deleted file mode 100644 index 4fa57f20280e..000000000000 --- a/guava-gwt/src-super/java/util/super/java/util/concurrent/Delayed.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * This file is a modified version of - * http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java/util/concurrent/Delayed.java?revision=1.11 - * which contained the following notice: - * - * Written by Doug Lea with assistance from members of JCP JSR-166 - * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -package java.util.concurrent; - -/** Emulation of Delayed. */ -public interface Delayed extends Comparable { - long getDelay(TimeUnit unit); -} diff --git a/guava-gwt/src-super/java/util/super/java/util/concurrent/ExecutionException.java b/guava-gwt/src-super/java/util/super/java/util/concurrent/ExecutionException.java deleted file mode 100644 index 7484438d8943..000000000000 --- a/guava-gwt/src-super/java/util/super/java/util/concurrent/ExecutionException.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2011 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package java.util.concurrent; - -/** - * Emulation of ExecutionException. - * - * @author Charles Fry - */ -public class ExecutionException extends Exception { - protected ExecutionException() {} - - protected ExecutionException(String message) { - super(message); - } - - public ExecutionException(String message, Throwable cause) { - super(message, cause); - } - - public ExecutionException(Throwable cause) { - super(cause); - } -} diff --git a/guava-gwt/src-super/java/util/super/java/util/concurrent/Executor.java b/guava-gwt/src-super/java/util/super/java/util/concurrent/Executor.java deleted file mode 100644 index d74ec076af7a..000000000000 --- a/guava-gwt/src-super/java/util/super/java/util/concurrent/Executor.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2015 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package java.util.concurrent; - -/** Emulation of Executor. */ -public interface Executor { - void execute(Runnable command); -} diff --git a/guava-gwt/src-super/java/util/super/java/util/concurrent/Executors.java b/guava-gwt/src-super/java/util/super/java/util/concurrent/Executors.java deleted file mode 100644 index afb41e2ea69c..000000000000 --- a/guava-gwt/src-super/java/util/super/java/util/concurrent/Executors.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is a modified version of - * http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java/util/concurrent/Executors.java?revision=1.90 - * which contained the following notice: - * - * Written by Doug Lea with assistance from members of JCP JSR-166 - * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -package java.util.concurrent; - -/** Emulation of executors. */ -public class Executors { - - public static Callable callable(Runnable task, T result) { - if (task == null) { - throw new NullPointerException(); - } - return new RunnableAdapter(task, result); - } - - public static Callable callable(Runnable task) { - if (task == null) { - throw new NullPointerException(); - } - return new RunnableAdapter(task, null); - } - - static final class RunnableAdapter implements Callable { - - final Runnable task; - final T result; - - RunnableAdapter(Runnable task, T result) { - this.task = task; - this.result = result; - } - - public T call() { - task.run(); - return result; - } - } - - private Executors() {} -} diff --git a/guava-gwt/src-super/java/util/super/java/util/concurrent/Future.java b/guava-gwt/src-super/java/util/super/java/util/concurrent/Future.java deleted file mode 100644 index f52ac619b33e..000000000000 --- a/guava-gwt/src-super/java/util/super/java/util/concurrent/Future.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2015 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package java.util.concurrent; - -/** - * Emulation of Future. Since GWT environment is single threaded, attempting to block on the future - * by calling {@link #get()} or {@link #get(long, TimeUnit)} when the future is not yet done is - * considered illegal because it would lead to a deadlock. Future implementations must throw {@link - * IllegalStateException} to avoid a deadlock. - * - * @param value type returned by the future. - */ -public interface Future { - boolean cancel(boolean mayInterruptIfRunning); - - boolean isCancelled(); - - boolean isDone(); - - // Even though the 'get' methods below are blocking, they are the only built-in APIs to get the - // result of the {@code Future}, hence they are not removed. The implementation must throw {@link - // IllegalStateException} if the {@code Future} is not done yet (see the class javadoc). - - V get() throws InterruptedException, ExecutionException; - - V get(long timeout, TimeUnit unit) - throws InterruptedException, ExecutionException, TimeoutException; -} diff --git a/guava-gwt/src-super/java/util/super/java/util/concurrent/RejectedExecutionException.java b/guava-gwt/src-super/java/util/super/java/util/concurrent/RejectedExecutionException.java deleted file mode 100644 index 56a19f7f25f1..000000000000 --- a/guava-gwt/src-super/java/util/super/java/util/concurrent/RejectedExecutionException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2015 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package java.util.concurrent; - -/** GWT emulation of RejectedExecutionException. */ -public class RejectedExecutionException extends RuntimeException { - public RejectedExecutionException() {} - - public RejectedExecutionException(String message) { - super(message); - } - - public RejectedExecutionException(String message, Throwable cause) { - super(message, cause); - } - - public RejectedExecutionException(Throwable cause) { - super(cause); - } -} diff --git a/guava-gwt/src-super/java/util/super/java/util/concurrent/RunnableFuture.java b/guava-gwt/src-super/java/util/super/java/util/concurrent/RunnableFuture.java deleted file mode 100644 index c33168a491af..000000000000 --- a/guava-gwt/src-super/java/util/super/java/util/concurrent/RunnableFuture.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2015 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package java.util.concurrent; - -/** Emulation of RunnableFuture. */ -public interface RunnableFuture extends Runnable, Future {} diff --git a/guava-gwt/src-super/java/util/super/java/util/concurrent/ScheduledFuture.java b/guava-gwt/src-super/java/util/super/java/util/concurrent/ScheduledFuture.java deleted file mode 100644 index 5aab49fef93e..000000000000 --- a/guava-gwt/src-super/java/util/super/java/util/concurrent/ScheduledFuture.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * This file is a modified version of - * http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java/util/concurrent/ScheduledFuture.java?revision=1.6 - * which contained the following notice: - * - * Written by Doug Lea with assistance from members of JCP JSR-166 - * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -package java.util.concurrent; - -/** - * Emulation of ScheduleFuture. - * - * @param value type returned by the future. - */ -public interface ScheduledFuture extends Delayed, Future {} diff --git a/guava-gwt/src-super/java/util/super/java/util/concurrent/TimeUnit.java b/guava-gwt/src-super/java/util/super/java/util/concurrent/TimeUnit.java deleted file mode 100644 index d2966f1a4576..000000000000 --- a/guava-gwt/src-super/java/util/super/java/util/concurrent/TimeUnit.java +++ /dev/null @@ -1,336 +0,0 @@ -/* - * This file is a modified version of - * http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java/util/concurrent/TimeUnit.java - * which contained the following notice: - * - * Written by Doug Lea with assistance from members of JCP JSR-166 - * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -package java.util.concurrent; - -/** - * GWT emulation of TimeUnit, created by removing unsupported operations from Doug Lea's public - * domain version. - */ -public enum TimeUnit { - NANOSECONDS { - public long toNanos(long d) { - return d; - } - - public long toMicros(long d) { - return d / C1_C0; - } - - public long toMillis(long d) { - return d / C2_C0; - } - - public long toSeconds(long d) { - return d / C3_C0; - } - - public long toMinutes(long d) { - return d / C4_C0; - } - - public long toHours(long d) { - return d / C5_C0; - } - - public long toDays(long d) { - return d / C6_C0; - } - - public long convert(long d, TimeUnit u) { - return u.toNanos(d); - } - }, - MICROSECONDS { - public long toNanos(long d) { - return x(d, C1_C0, MAX_C1_C0); - } - - public long toMicros(long d) { - return d; - } - - public long toMillis(long d) { - return d / C2_C1; - } - - public long toSeconds(long d) { - return d / C3_C1; - } - - public long toMinutes(long d) { - return d / C4_C1; - } - - public long toHours(long d) { - return d / C5_C1; - } - - public long toDays(long d) { - return d / C6_C1; - } - - public long convert(long d, TimeUnit u) { - return u.toMicros(d); - } - }, - MILLISECONDS { - public long toNanos(long d) { - return x(d, C2_C0, MAX_C2_C0); - } - - public long toMicros(long d) { - return x(d, C2_C1, MAX_C2_C1); - } - - public long toMillis(long d) { - return d; - } - - public long toSeconds(long d) { - return d / C3_C2; - } - - public long toMinutes(long d) { - return d / C4_C2; - } - - public long toHours(long d) { - return d / C5_C2; - } - - public long toDays(long d) { - return d / C6_C2; - } - - public long convert(long d, TimeUnit u) { - return u.toMillis(d); - } - }, - SECONDS { - public long toNanos(long d) { - return x(d, C3_C0, MAX_C3_C0); - } - - public long toMicros(long d) { - return x(d, C3_C1, MAX_C3_C1); - } - - public long toMillis(long d) { - return x(d, C3_C2, MAX_C3_C2); - } - - public long toSeconds(long d) { - return d; - } - - public long toMinutes(long d) { - return d / C4_C3; - } - - public long toHours(long d) { - return d / C5_C3; - } - - public long toDays(long d) { - return d / C6_C3; - } - - public long convert(long d, TimeUnit u) { - return u.toSeconds(d); - } - }, - MINUTES { - public long toNanos(long d) { - return x(d, C4_C0, MAX_C4_C0); - } - - public long toMicros(long d) { - return x(d, C4_C1, MAX_C4_C1); - } - - public long toMillis(long d) { - return x(d, C4_C2, MAX_C4_C2); - } - - public long toSeconds(long d) { - return x(d, C4_C3, MAX_C4_C3); - } - - public long toMinutes(long d) { - return d; - } - - public long toHours(long d) { - return d / C5_C4; - } - - public long toDays(long d) { - return d / C6_C4; - } - - public long convert(long d, TimeUnit u) { - return u.toMinutes(d); - } - }, - HOURS { - public long toNanos(long d) { - return x(d, C5_C0, MAX_C5_C0); - } - - public long toMicros(long d) { - return x(d, C5_C1, MAX_C5_C1); - } - - public long toMillis(long d) { - return x(d, C5_C2, MAX_C5_C2); - } - - public long toSeconds(long d) { - return x(d, C5_C3, MAX_C5_C3); - } - - public long toMinutes(long d) { - return x(d, C5_C4, MAX_C5_C4); - } - - public long toHours(long d) { - return d; - } - - public long toDays(long d) { - return d / C6_C5; - } - - public long convert(long d, TimeUnit u) { - return u.toHours(d); - } - }, - DAYS { - public long toNanos(long d) { - return x(d, C6_C0, MAX_C6_C0); - } - - public long toMicros(long d) { - return x(d, C6_C1, MAX_C6_C1); - } - - public long toMillis(long d) { - return x(d, C6_C2, MAX_C6_C2); - } - - public long toSeconds(long d) { - return x(d, C6_C3, MAX_C6_C3); - } - - public long toMinutes(long d) { - return x(d, C6_C4, MAX_C6_C4); - } - - public long toHours(long d) { - return x(d, C6_C5, MAX_C6_C5); - } - - public long toDays(long d) { - return d; - } - - public long convert(long d, TimeUnit u) { - return u.toDays(d); - } - }; - - // Handy constants for conversion methods - private static final long C0 = 1L; - private static final long C1 = C0 * 1000L; - private static final long C2 = C1 * 1000L; - private static final long C3 = C2 * 1000L; - private static final long C4 = C3 * 60L; - private static final long C5 = C4 * 60L; - private static final long C6 = C5 * 24L; - - private static final long MAX = Long.MAX_VALUE; - - private static final long C6_C0 = C6 / C0; - private static final long C6_C1 = C6 / C1; - private static final long C6_C2 = C6 / C2; - private static final long C6_C3 = C6 / C3; - private static final long C6_C4 = C6 / C4; - private static final long C6_C5 = C6 / C5; - - private static final long C5_C0 = C5 / C0; - private static final long C5_C1 = C5 / C1; - private static final long C5_C2 = C5 / C2; - private static final long C5_C3 = C5 / C3; - private static final long C5_C4 = C5 / C4; - - private static final long C4_C0 = C4 / C0; - private static final long C4_C1 = C4 / C1; - private static final long C4_C2 = C4 / C2; - private static final long C4_C3 = C4 / C3; - - private static final long C3_C0 = C3 / C0; - private static final long C3_C1 = C3 / C1; - private static final long C3_C2 = C3 / C2; - - private static final long C2_C0 = C2 / C0; - private static final long C2_C1 = C2 / C1; - - private static final long C1_C0 = C1 / C0; - - private static final long MAX_C6_C0 = MAX / C6_C0; - private static final long MAX_C6_C1 = MAX / C6_C1; - private static final long MAX_C6_C2 = MAX / C6_C2; - private static final long MAX_C6_C3 = MAX / C6_C3; - private static final long MAX_C6_C4 = MAX / C6_C4; - private static final long MAX_C6_C5 = MAX / C6_C5; - - private static final long MAX_C5_C0 = MAX / C5_C0; - private static final long MAX_C5_C1 = MAX / C5_C1; - private static final long MAX_C5_C2 = MAX / C5_C2; - private static final long MAX_C5_C3 = MAX / C5_C3; - private static final long MAX_C5_C4 = MAX / C5_C4; - - private static final long MAX_C4_C0 = MAX / C4_C0; - private static final long MAX_C4_C1 = MAX / C4_C1; - private static final long MAX_C4_C2 = MAX / C4_C2; - private static final long MAX_C4_C3 = MAX / C4_C3; - - private static final long MAX_C3_C0 = MAX / C3_C0; - private static final long MAX_C3_C1 = MAX / C3_C1; - private static final long MAX_C3_C2 = MAX / C3_C2; - - private static final long MAX_C2_C0 = MAX / C2_C0; - private static final long MAX_C2_C1 = MAX / C2_C1; - - private static final long MAX_C1_C0 = MAX / C1_C0; - - static long x(long d, long m, long over) { - if (d > over) return Long.MAX_VALUE; - if (d < -over) return Long.MIN_VALUE; - return d * m; - } - - public abstract long convert(long sourceDuration, TimeUnit sourceUnit); - - public abstract long toNanos(long duration); - - public abstract long toMicros(long duration); - - public abstract long toMillis(long duration); - - public abstract long toSeconds(long duration); - - public abstract long toMinutes(long duration); - - public abstract long toHours(long duration); - - public abstract long toDays(long duration); -} diff --git a/guava-gwt/src-super/java/util/super/java/util/concurrent/TimeoutException.java b/guava-gwt/src-super/java/util/super/java/util/concurrent/TimeoutException.java deleted file mode 100644 index 4cbf128fafc4..000000000000 --- a/guava-gwt/src-super/java/util/super/java/util/concurrent/TimeoutException.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2015 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package java.util.concurrent; - -/** Emulation of TimeoutException. */ -public class TimeoutException extends Exception { - public TimeoutException() {} - - public TimeoutException(String message) { - super(message); - } -} diff --git a/guava-gwt/src-super/java/util/super/java/util/concurrent/atomic/AtomicBoolean.java b/guava-gwt/src-super/java/util/super/java/util/concurrent/atomic/AtomicBoolean.java deleted file mode 100644 index 4be46d42bdd9..000000000000 --- a/guava-gwt/src-super/java/util/super/java/util/concurrent/atomic/AtomicBoolean.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2015 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * Atomically sets the value to the given updated value if the current value {@code ==} the expected - * value. - * - *

May fail spuriously and does not provide ordering - * guarantees, so is only rarely an appropriate alternative to {@code compareAndSet}. - * - * @param expect the expected value - * @param update the new value - * @return true if successful. - */ -package java.util.concurrent.atomic; - -/** GWT emulation of AtomicBoolean. */ -public class AtomicBoolean implements java.io.Serializable { - private boolean value; - - public AtomicBoolean(boolean initialValue) { - value = initialValue; - } - - public AtomicBoolean() {} - - public final boolean get() { - return value; - } - - public final boolean compareAndSet(boolean expect, boolean update) { - if (get() == expect) { - set(update); - return true; - } - - return false; - } - - public boolean weakCompareAndSet(boolean expect, boolean update) { - return compareAndSet(expect, update); - } - - public final void set(boolean newValue) { - value = newValue; - } - - public final void lazySet(boolean newValue) { - set(newValue); - } - - public final boolean getAndSet(boolean newValue) { - boolean current = get(); - set(newValue); - return current; - } - - public String toString() { - return Boolean.toString(get()); - } -} diff --git a/guava-gwt/src-super/java/util/super/java/util/concurrent/atomic/AtomicInteger.java b/guava-gwt/src-super/java/util/super/java/util/concurrent/atomic/AtomicInteger.java deleted file mode 100644 index 0a680f3be550..000000000000 --- a/guava-gwt/src-super/java/util/super/java/util/concurrent/atomic/AtomicInteger.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2009 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package java.util.concurrent.atomic; - -/** - * GWT emulated version of {@link AtomicInteger}. It's a thin wrapper around the primitive {@code - * int}. - * - * @author Hayward Chan - */ -public class AtomicInteger extends Number implements java.io.Serializable { - - private int value; - - public AtomicInteger(int initialValue) { - value = initialValue; - } - - public AtomicInteger() {} - - public final int get() { - return value; - } - - public final void set(int newValue) { - value = newValue; - } - - public final void lazySet(int newValue) { - set(newValue); - } - - public final int getAndSet(int newValue) { - int current = value; - value = newValue; - return current; - } - - public final boolean compareAndSet(int expect, int update) { - if (value == expect) { - value = update; - return true; - } else { - return false; - } - } - - public final int getAndIncrement() { - return value++; - } - - public final int getAndDecrement() { - return value--; - } - - public final int getAndAdd(int delta) { - int current = value; - value += delta; - return current; - } - - public final int incrementAndGet() { - return ++value; - } - - public final int decrementAndGet() { - return --value; - } - - public final int addAndGet(int delta) { - value += delta; - return value; - } - - @Override - public String toString() { - return Integer.toString(value); - } - - public int intValue() { - return value; - } - - public long longValue() { - return (long) value; - } - - public float floatValue() { - return (float) value; - } - - public double doubleValue() { - return (double) value; - } -} diff --git a/guava-gwt/src-super/java/util/super/java/util/concurrent/atomic/AtomicLong.java b/guava-gwt/src-super/java/util/super/java/util/concurrent/atomic/AtomicLong.java deleted file mode 100644 index af782b3a6bbe..000000000000 --- a/guava-gwt/src-super/java/util/super/java/util/concurrent/atomic/AtomicLong.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2011 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package java.util.concurrent.atomic; - -/** - * GWT emulated version of {@link AtomicLong}. It's a thin wrapper around the primitive {@code - * long}. - * - * @author Jige Yu - */ -public class AtomicLong extends Number implements java.io.Serializable { - - private long value; - - public AtomicLong(long initialValue) { - this.value = initialValue; - } - - public AtomicLong() {} - - public final long get() { - return value; - } - - public final void set(long newValue) { - value = newValue; - } - - public final void lazySet(long newValue) { - set(newValue); - } - - public final long getAndSet(long newValue) { - long current = value; - value = newValue; - return current; - } - - public final boolean compareAndSet(long expect, long update) { - if (value == expect) { - value = update; - return true; - } else { - return false; - } - } - - public final long getAndIncrement() { - return value++; - } - - public final long getAndDecrement() { - return value--; - } - - public final long getAndAdd(long delta) { - long current = value; - value += delta; - return current; - } - - public final long incrementAndGet() { - return ++value; - } - - public final long decrementAndGet() { - return --value; - } - - public final long addAndGet(long delta) { - value += delta; - return value; - } - - @Override - public String toString() { - return Long.toString(value); - } - - public int intValue() { - return (int) value; - } - - public long longValue() { - return value; - } - - public float floatValue() { - return (float) value; - } - - public double doubleValue() { - return (double) value; - } -}