diff options
-rw-r--r-- | NativeCode.mk | 1 | ||||
-rw-r--r-- | luni/src/main/java/java/lang/SafeVarargs.java | 35 | ||||
-rw-r--r-- | luni/src/main/java/java/util/Arrays.java | 1 | ||||
-rw-r--r-- | luni/src/main/java/java/util/Collections.java | 1 | ||||
-rw-r--r-- | luni/src/main/java/java/util/EnumSet.java | 1 |
5 files changed, 39 insertions, 0 deletions
diff --git a/NativeCode.mk b/NativeCode.mk index 2ba56fe..e50e25b 100644 --- a/NativeCode.mk +++ b/NativeCode.mk @@ -121,6 +121,7 @@ LOCAL_SHARED_LIBRARIES := libcrypto LOCAL_MODULE_TAGS := optional LOCAL_MODULE := libjavacoretests LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/NativeCode.mk +include external/stlport/libstlport.mk include $(BUILD_SHARED_LIBRARY) endif # LIBCORE_SKIP_TESTS diff --git a/luni/src/main/java/java/lang/SafeVarargs.java b/luni/src/main/java/java/lang/SafeVarargs.java new file mode 100644 index 0000000..52baa4d --- /dev/null +++ b/luni/src/main/java/java/lang/SafeVarargs.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * 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; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Claims to the compiler that the annotation target does nothing potentially unsafe + * to its varargs argument. + * + * @since 1.7 + */ +@Documented +@Retention(value=RetentionPolicy.RUNTIME) +@Target(value={ElementType.CONSTRUCTOR, ElementType.METHOD}) +public @interface SafeVarargs { +} diff --git a/luni/src/main/java/java/util/Arrays.java b/luni/src/main/java/java/util/Arrays.java index c1b2727..2c84795 100644 --- a/luni/src/main/java/java/util/Arrays.java +++ b/luni/src/main/java/java/util/Arrays.java @@ -150,6 +150,7 @@ public class Arrays { * the array. * @return a {@code List} of the elements of the specified array. */ + @SafeVarargs public static <T> List<T> asList(T... array) { return new ArrayList<T>(array); } diff --git a/luni/src/main/java/java/util/Collections.java b/luni/src/main/java/java/util/Collections.java index 491642b..7c5e059 100644 --- a/luni/src/main/java/java/util/Collections.java +++ b/luni/src/main/java/java/util/Collections.java @@ -2584,6 +2584,7 @@ public class Collections { * if at least one of the elements can't be inserted into the * collection. */ + @SafeVarargs public static <T> boolean addAll(Collection<? super T> c, T... a) { boolean modified = false; for (int i = 0; i < a.length; i++) { diff --git a/luni/src/main/java/java/util/EnumSet.java b/luni/src/main/java/java/util/EnumSet.java index 20be6f7..0393511 100644 --- a/luni/src/main/java/java/util/EnumSet.java +++ b/luni/src/main/java/java/util/EnumSet.java @@ -259,6 +259,7 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E> * @throws NullPointerException * if any of the specified elements is {@code null}. */ + @SafeVarargs public static <E extends Enum<E>> EnumSet<E> of(E start, E... others) { EnumSet<E> set = of(start); for (E e : others) { |