1 /* 2 * Copyright (C) 2009 The Guava Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS-IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.google.common.base; 18 19 import com.google.common.annotations.GwtCompatible; 20 import java.util.Set; 21 import org.checkerframework.checker.nullness.qual.Nullable; 22 23 /** 24 * Contains dummy collection implementations to convince GWT that part of serializing a collection 25 * is serializing its elements. 26 * 27 * <p>See {@linkplain com.google.common.collect.GwtSerializationDependencies the 28 * com.google.common.collect version} for more details. 29 * 30 * @author Chris Povirk 31 */ 32 @GwtCompatible 33 final class GwtSerializationDependencies { GwtSerializationDependencies()34 private GwtSerializationDependencies() {} 35 36 static final class OptionalDependencies<T> extends Optional<T> { 37 @Nullable T value; 38 OptionalDependencies()39 OptionalDependencies() { 40 super(); 41 } 42 43 @Override isPresent()44 public boolean isPresent() { 45 throw new AssertionError(); 46 } 47 48 @Override get()49 public T get() { 50 throw new AssertionError(); 51 } 52 53 @Override or(T defaultValue)54 public T or(T defaultValue) { 55 throw new AssertionError(); 56 } 57 58 @Override or(Optional<? extends T> secondChoice)59 public Optional<T> or(Optional<? extends T> secondChoice) { 60 throw new AssertionError(); 61 } 62 63 @Override or(Supplier<? extends T> supplier)64 public T or(Supplier<? extends T> supplier) { 65 throw new AssertionError(); 66 } 67 68 @Override orNull()69 public T orNull() { 70 throw new AssertionError(); 71 } 72 73 @Override asSet()74 public Set<T> asSet() { 75 throw new AssertionError(); 76 } 77 78 @Override transform(Function<? super T, V> function)79 public <V> Optional<V> transform(Function<? super T, V> function) { 80 throw new AssertionError(); 81 } 82 83 @Override equals(@ullable Object object)84 public boolean equals(@Nullable Object object) { 85 throw new AssertionError(); 86 } 87 88 @Override hashCode()89 public int hashCode() { 90 throw new AssertionError(); 91 } 92 93 @Override toString()94 public String toString() { 95 throw new AssertionError(); 96 } 97 } 98 } 99