Merge "sun.security.x509: update classes in sun.security.x509"
diff --git a/JavaLibrary.mk b/JavaLibrary.mk
index 65fc39d..470484e 100644
--- a/JavaLibrary.mk
+++ b/JavaLibrary.mk
@@ -134,7 +134,7 @@
# A library that exists to satisfy javac when
# compiling source code that contains lambdas.
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(openjdk_lambda_stub_files)
+LOCAL_SRC_FILES := $(openjdk_lambda_stub_files) $(openjdk_lambda_duplicate_stub_files)
LOCAL_NO_STANDARD_LIBRARIES := true
LOCAL_JAVACFLAGS := $(local_javac_flags)
LOCAL_MODULE_TAGS := optional
@@ -318,7 +318,7 @@
# A library that exists to satisfy javac when
# compiling source code that contains lambdas.
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(openjdk_lambda_stub_files)
+LOCAL_SRC_FILES := $(openjdk_lambda_stub_files) $(openjdk_lambda_duplicate_stub_files)
LOCAL_NO_STANDARD_LIBRARIES := true
LOCAL_JAVACFLAGS := $(local_javac_flags)
LOCAL_MODULE_TAGS := optional
diff --git a/luni/src/main/java/java/net/DefaultFileNameMap.java b/luni/src/main/java/java/net/DefaultFileNameMap.java
index 2f254d9..6222d75 100644
--- a/luni/src/main/java/java/net/DefaultFileNameMap.java
+++ b/luni/src/main/java/java/net/DefaultFileNameMap.java
@@ -37,6 +37,6 @@
if (firstCharInExtension > filename.lastIndexOf('/')) {
ext = filename.substring(firstCharInExtension, lastCharInExtension);
}
- return MimeUtils.guessMimeTypeFromExtension(ext.toLowerCase(Locale.US));
+ return MimeUtils.guessMimeTypeFromExtension(ext);
}
}
diff --git a/luni/src/main/java/libcore/net/MimeUtils.java b/luni/src/main/java/libcore/net/MimeUtils.java
index 3b59b87..58afdf9 100644
--- a/luni/src/main/java/libcore/net/MimeUtils.java
+++ b/luni/src/main/java/libcore/net/MimeUtils.java
@@ -17,6 +17,7 @@
package libcore.net;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Map;
/**
@@ -407,52 +408,52 @@
}
/**
- * Returns true if the given MIME type has an entry in the map.
+ * Returns true if the given case insensitive MIME type has an entry in the map.
* @param mimeType A MIME type (i.e. text/plain)
- * @return True iff there is a mimeType entry in the map.
+ * @return True if a extension has been registered for
+ * the given case insensitive MIME type.
*/
public static boolean hasMimeType(String mimeType) {
- if (mimeType == null || mimeType.isEmpty()) {
- return false;
- }
- return mimeTypeToExtensionMap.containsKey(mimeType);
+ return (guessExtensionFromMimeType(mimeType) != null);
}
/**
- * Returns the MIME type for the given extension.
+ * Returns the MIME type for the given case insensitive file extension.
* @param extension A file extension without the leading '.'
- * @return The MIME type for the given extension or null iff there is none.
+ * @return The MIME type has been registered for
+ * the given case insensitive file extension or null if there is none.
*/
public static String guessMimeTypeFromExtension(String extension) {
if (extension == null || extension.isEmpty()) {
return null;
}
+ extension = extension.toLowerCase(Locale.US);
return extensionToMimeTypeMap.get(extension);
}
/**
- * Returns true if the given extension has a registered MIME type.
+ * Returns true if the given case insensitive extension has a registered MIME type.
* @param extension A file extension without the leading '.'
- * @return True iff there is an extension entry in the map.
+ * @return True if a MIME type has been registered for
+ * the given case insensitive file extension.
*/
public static boolean hasExtension(String extension) {
- if (extension == null || extension.isEmpty()) {
- return false;
- }
- return extensionToMimeTypeMap.containsKey(extension);
+ return (guessMimeTypeFromExtension(extension) != null);
}
/**
- * Returns the registered extension for the given MIME type. Note that some
+ * Returns the registered extension for the given case insensitive MIME type. Note that some
* MIME types map to multiple extensions. This call will return the most
* common extension for the given MIME type.
* @param mimeType A MIME type (i.e. text/plain)
- * @return The extension for the given MIME type or null iff there is none.
+ * @return The extension has been registered for
+ * the given case insensitive MIME type or null if there is none.
*/
public static String guessExtensionFromMimeType(String mimeType) {
if (mimeType == null || mimeType.isEmpty()) {
return null;
}
+ mimeType = mimeType.toLowerCase(Locale.US);
return mimeTypeToExtensionMap.get(mimeType);
}
}
diff --git a/luni/src/main/native/Register.cpp b/luni/src/main/native/Register.cpp
index b099a4e..5fd4a7d 100644
--- a/luni/src/main/native/Register.cpp
+++ b/luni/src/main/native/Register.cpp
@@ -35,6 +35,7 @@
#define REGISTER(FN) extern void FN(JNIEnv*); FN(env)
REGISTER(register_android_system_OsConstants);
// REGISTER(register_java_lang_StringToReal);
+ REGISTER(register_java_lang_invoke_MethodHandle);
REGISTER(register_java_math_NativeBN);
REGISTER(register_java_util_regex_Matcher);
REGISTER(register_java_util_regex_Pattern);
diff --git a/luni/src/main/native/java_lang_invoke_MethodHandle.cpp b/luni/src/main/native/java_lang_invoke_MethodHandle.cpp
new file mode 100644
index 0000000..4596b42
--- /dev/null
+++ b/luni/src/main/native/java_lang_invoke_MethodHandle.cpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include "JniConstants.h"
+#include "JNIHelp.h"
+
+static void MethodHandle_invokeExact(JNIEnv* env, jobject, jobjectArray) {
+ jniThrowException(env, "java/lang/UnsupportedOperationException",
+ "MethodHandle.invokeExact cannot be invoked reflectively.");
+}
+
+static void MethodHandle_invoke(JNIEnv* env, jobject, jobjectArray) {
+ jniThrowException(env, "java/lang/UnsupportedOperationException",
+ "MethodHandle.invoke cannot be invoked reflectively.");
+}
+
+static JNINativeMethod gMethods[] = {
+ NATIVE_METHOD(MethodHandle, invokeExact, "([Ljava/lang/Object;)Ljava/lang/Object;"),
+ NATIVE_METHOD(MethodHandle, invoke, "([Ljava/lang/Object;)Ljava/lang/Object;"),
+};
+
+void register_java_lang_invoke_MethodHandle(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "java/lang/invoke/MethodHandle", gMethods, NELEM(gMethods));
+}
diff --git a/luni/src/main/native/sub.mk b/luni/src/main/native/sub.mk
index 0efbef6..fbba3b6 100644
--- a/luni/src/main/native/sub.mk
+++ b/luni/src/main/native/sub.mk
@@ -14,6 +14,7 @@
canonicalize_path.cpp \
cbigint.cpp \
java_lang_StringToReal.cpp \
+ java_lang_invoke_MethodHandle.cpp \
java_math_NativeBN.cpp \
java_util_regex_Matcher.cpp \
java_util_regex_Pattern.cpp \
diff --git a/luni/src/test/java/libcore/java/security/MessageDigestTest.java b/luni/src/test/java/libcore/java/security/MessageDigestTest.java
index 60dc36a..1a00af4 100644
--- a/luni/src/test/java/libcore/java/security/MessageDigestTest.java
+++ b/luni/src/test/java/libcore/java/security/MessageDigestTest.java
@@ -307,4 +307,10 @@
assertEquals(Collections.EMPTY_LIST, methodsNotOverridden);
}
+
+ public void testIsEqual_nullValues() {
+ assertTrue(MessageDigest.isEqual(null, null));
+ assertFalse(MessageDigest.isEqual(null, new byte[1]));
+ assertFalse(MessageDigest.isEqual(new byte[1], null));
+ }
}
diff --git a/luni/src/test/java/libcore/net/MimeUtilsTest.java b/luni/src/test/java/libcore/net/MimeUtilsTest.java
index ff22632..156c9c4 100644
--- a/luni/src/test/java/libcore/net/MimeUtilsTest.java
+++ b/luni/src/test/java/libcore/net/MimeUtilsTest.java
@@ -52,4 +52,23 @@
public void test_18390752() {
assertEquals("jpg", MimeUtils.guessExtensionFromMimeType("image/jpeg"));
}
+
+ public void test_30207891() {
+ assertTrue(MimeUtils.hasMimeType("IMAGE/PNG"));
+ assertTrue(MimeUtils.hasMimeType("IMAGE/png"));
+ assertFalse(MimeUtils.hasMimeType(""));
+ assertEquals("png", MimeUtils.guessExtensionFromMimeType("IMAGE/PNG"));
+ assertEquals("png", MimeUtils.guessExtensionFromMimeType("IMAGE/png"));
+ assertNull(MimeUtils.guessMimeTypeFromExtension(""));
+ assertNull(MimeUtils.guessMimeTypeFromExtension("doesnotexist"));
+ assertTrue(MimeUtils.hasExtension("PNG"));
+ assertTrue(MimeUtils.hasExtension("PnG"));
+ assertFalse(MimeUtils.hasExtension(""));
+ assertFalse(MimeUtils.hasExtension(".png"));
+ assertEquals("image/png", MimeUtils.guessMimeTypeFromExtension("PNG"));
+ assertEquals("image/png", MimeUtils.guessMimeTypeFromExtension("PnG"));
+ assertNull(MimeUtils.guessMimeTypeFromExtension(".png"));
+ assertNull(MimeUtils.guessMimeTypeFromExtension(""));
+ assertNull(MimeUtils.guessExtensionFromMimeType("doesnotexist"));
+ }
}
diff --git a/luni/src/test/resources/serialization/org/apache/harmony/regex/tests/java/util/regex/PatternSyntaxExceptionTest.golden.ser b/luni/src/test/resources/serialization/org/apache/harmony/regex/tests/java/util/regex/PatternSyntaxExceptionTest.golden.ser
old mode 100755
new mode 100644
Binary files differ
diff --git a/luni/src/test/resources/serialization/org/apache/harmony/regex/tests/java/util/regex/PatternTest.golden.ser b/luni/src/test/resources/serialization/org/apache/harmony/regex/tests/java/util/regex/PatternTest.golden.ser
old mode 100755
new mode 100644
Binary files differ
diff --git a/ojluni/src/lambda/java/java/lang/invoke/LambdaConversionException.java b/ojluni/src/lambda/java/java/lang/invoke/LambdaConversionException.java
new file mode 100644
index 0000000..e1123da
--- /dev/null
+++ b/ojluni/src/lambda/java/java/lang/invoke/LambdaConversionException.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang.invoke;
+
+/**
+ * LambdaConversionException
+ */
+public class LambdaConversionException extends Exception {
+ private static final long serialVersionUID = 292L + 8L;
+
+ /**
+ * Constructs a {@code LambdaConversionException}.
+ */
+ public LambdaConversionException() {
+ }
+
+ /**
+ * Constructs a {@code LambdaConversionException} with a message.
+ * @param message the detail message
+ */
+ public LambdaConversionException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a {@code LambdaConversionException} with a message and cause.
+ * @param message the detail message
+ * @param cause the cause
+ */
+ public LambdaConversionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs a {@code LambdaConversionException} with a cause.
+ * @param cause the cause
+ */
+ public LambdaConversionException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Constructs a {@code LambdaConversionException} with a message,
+ * cause, and other settings.
+ * @param message the detail message
+ * @param cause the cause
+ * @param enableSuppression whether or not suppressed exceptions are enabled
+ * @param writableStackTrace whether or not the stack trace is writable
+ */
+ public LambdaConversionException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+}
diff --git a/ojluni/src/lambda/java/java/lang/invoke/MethodType.java b/ojluni/src/lambda/java/java/lang/invoke/MethodType.java
new file mode 100644
index 0000000..4cb5c22
--- /dev/null
+++ b/ojluni/src/lambda/java/java/lang/invoke/MethodType.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang.invoke;
+
+import java.util.List;
+
+public final
+class MethodType implements java.io.Serializable {
+
+ public static
+ MethodType methodType(Class<?> rtype, Class<?>[] ptypes) {
+ return null;
+ }
+
+ public static
+ MethodType methodType(Class<?> rtype, List<Class<?>> ptypes) {
+ return null;
+ }
+
+ public static
+ MethodType methodType(Class<?> rtype, Class<?> ptype0, Class<?>... ptypes) { return null; }
+
+ public static
+ MethodType methodType(Class<?> rtype) { return null; }
+
+ public static
+ MethodType methodType(Class<?> rtype, Class<?> ptype0) { return null; }
+
+ public static
+ MethodType methodType(Class<?> rtype, MethodType ptypes) { return null; }
+
+ public static
+ MethodType genericMethodType(int objectArgCount, boolean finalArray) { return null; }
+
+ public static
+ MethodType genericMethodType(int objectArgCount) { return null; }
+
+ public MethodType changeParameterType(int num, Class<?> nptype) { return null; }
+
+ public MethodType insertParameterTypes(int num, Class<?>... ptypesToInsert) { return null; }
+
+ public MethodType appendParameterTypes(Class<?>... ptypesToInsert) { return null; }
+
+ public MethodType insertParameterTypes(int num, List<Class<?>> ptypesToInsert) { return null; }
+
+ public MethodType appendParameterTypes(List<Class<?>> ptypesToInsert) { return null; }
+
+ public MethodType dropParameterTypes(int start, int end) { return null; }
+
+ public MethodType changeReturnType(Class<?> nrtype) { return null; }
+
+ public boolean hasPrimitives() { return false; }
+
+ public boolean hasWrappers() { return false; }
+
+ public MethodType erase() { return null; }
+
+ public MethodType generic() { return null; }
+
+ public MethodType wrap() { return null; }
+
+ public MethodType unwrap() { return null; }
+
+ public Class<?> parameterType(int num) { return null; }
+
+ public int parameterCount() { return 0; }
+
+ public Class<?> returnType() { return null; }
+
+ public List<Class<?>> parameterList() { return null; }
+
+ public Class<?>[] parameterArray() { return null; }
+
+ public static MethodType fromMethodDescriptorString(String descriptor, ClassLoader loader)
+ throws IllegalArgumentException, TypeNotPresentException { return null; }
+
+ public String toMethodDescriptorString() { return null; }
+
+}
diff --git a/ojluni/src/main/java/java/io/DataInputStream.java b/ojluni/src/main/java/java/io/DataInputStream.java
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/java/io/package.html b/ojluni/src/main/java/java/io/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/java/lang/Runtime.java b/ojluni/src/main/java/java/lang/Runtime.java
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/java/lang/invoke/MethodHandle.java b/ojluni/src/main/java/java/lang/invoke/MethodHandle.java
new file mode 100644
index 0000000..ffbc401
--- /dev/null
+++ b/ojluni/src/main/java/java/lang/invoke/MethodHandle.java
@@ -0,0 +1,1301 @@
+/*
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang.invoke;
+
+
+import java.util.*;
+
+import static java.lang.invoke.MethodHandleStatics.*;
+
+/**
+ * A method handle is a typed, directly executable reference to an underlying method,
+ * constructor, field, or similar low-level operation, with optional
+ * transformations of arguments or return values.
+ * These transformations are quite general, and include such patterns as
+ * {@linkplain #asType conversion},
+ * {@linkplain #bindTo insertion},
+ * {@code java.lang.invoke.MethodHandles#dropArguments deletion},
+ * and {@code java.lang.invoke.MethodHandles#filterArguments substitution}.
+ *
+ * <h1>Method handle contents</h1>
+ * Method handles are dynamically and strongly typed according to their parameter and return types.
+ * They are not distinguished by the name or the defining class of their underlying methods.
+ * A method handle must be invoked using a symbolic type descriptor which matches
+ * the method handle's own {@linkplain #type type descriptor}.
+ * <p>
+ * Every method handle reports its type descriptor via the {@link #type type} accessor.
+ * This type descriptor is a {@link java.lang.invoke.MethodType MethodType} object,
+ * whose structure is a series of classes, one of which is
+ * the return type of the method (or {@code void.class} if none).
+ * <p>
+ * A method handle's type controls the types of invocations it accepts,
+ * and the kinds of transformations that apply to it.
+ * <p>
+ * A method handle contains a pair of special invoker methods
+ * called {@link #invokeExact invokeExact} and {@link #invoke invoke}.
+ * Both invoker methods provide direct access to the method handle's
+ * underlying method, constructor, field, or other operation,
+ * as modified by transformations of arguments and return values.
+ * Both invokers accept calls which exactly match the method handle's own type.
+ * The plain, inexact invoker also accepts a range of other call types.
+ * <p>
+ * Method handles are immutable and have no visible state.
+ * Of course, they can be bound to underlying methods or data which exhibit state.
+ * With respect to the Java Memory Model, any method handle will behave
+ * as if all of its (internal) fields are final variables. This means that any method
+ * handle made visible to the application will always be fully formed.
+ * This is true even if the method handle is published through a shared
+ * variable in a data race.
+ * <p>
+ * Method handles cannot be subclassed by the user.
+ * Implementations may (or may not) create internal subclasses of {@code MethodHandle}
+ * which may be visible via the {@link java.lang.Object#getClass Object.getClass}
+ * operation. The programmer should not draw conclusions about a method handle
+ * from its specific class, as the method handle class hierarchy (if any)
+ * may change from time to time or across implementations from different vendors.
+ *
+ * <h1>Method handle compilation</h1>
+ * A Java method call expression naming {@code invokeExact} or {@code invoke}
+ * can invoke a method handle from Java source code.
+ * From the viewpoint of source code, these methods can take any arguments
+ * and their result can be cast to any return type.
+ * Formally this is accomplished by giving the invoker methods
+ * {@code Object} return types and variable arity {@code Object} arguments,
+ * but they have an additional quality called <em>signature polymorphism</em>
+ * which connects this freedom of invocation directly to the JVM execution stack.
+ * <p>
+ * As is usual with virtual methods, source-level calls to {@code invokeExact}
+ * and {@code invoke} compile to an {@code invokevirtual} instruction.
+ * More unusually, the compiler must record the actual argument types,
+ * and may not perform method invocation conversions on the arguments.
+ * Instead, it must push them on the stack according to their own unconverted types.
+ * The method handle object itself is pushed on the stack before the arguments.
+ * The compiler then calls the method handle with a symbolic type descriptor which
+ * describes the argument and return types.
+ * <p>
+ * To issue a complete symbolic type descriptor, the compiler must also determine
+ * the return type. This is based on a cast on the method invocation expression,
+ * if there is one, or else {@code Object} if the invocation is an expression
+ * or else {@code void} if the invocation is a statement.
+ * The cast may be to a primitive type (but not {@code void}).
+ * <p>
+ * As a corner case, an uncasted {@code null} argument is given
+ * a symbolic type descriptor of {@code java.lang.Void}.
+ * The ambiguity with the type {@code Void} is harmless, since there are no references of type
+ * {@code Void} except the null reference.
+ *
+ * <h1>Method handle invocation</h1>
+ * The first time a {@code invokevirtual} instruction is executed
+ * it is linked, by symbolically resolving the names in the instruction
+ * and verifying that the method call is statically legal.
+ * This is true of calls to {@code invokeExact} and {@code invoke}.
+ * In this case, the symbolic type descriptor emitted by the compiler is checked for
+ * correct syntax and names it contains are resolved.
+ * Thus, an {@code invokevirtual} instruction which invokes
+ * a method handle will always link, as long
+ * as the symbolic type descriptor is syntactically well-formed
+ * and the types exist.
+ * <p>
+ * When the {@code invokevirtual} is executed after linking,
+ * the receiving method handle's type is first checked by the JVM
+ * to ensure that it matches the symbolic type descriptor.
+ * If the type match fails, it means that the method which the
+ * caller is invoking is not present on the individual
+ * method handle being invoked.
+ * <p>
+ * In the case of {@code invokeExact}, the type descriptor of the invocation
+ * (after resolving symbolic type names) must exactly match the method type
+ * of the receiving method handle.
+ * In the case of plain, inexact {@code invoke}, the resolved type descriptor
+ * must be a valid argument to the receiver's {@link #asType asType} method.
+ * Thus, plain {@code invoke} is more permissive than {@code invokeExact}.
+ * <p>
+ * After type matching, a call to {@code invokeExact} directly
+ * and immediately invoke the method handle's underlying method
+ * (or other behavior, as the case may be).
+ * <p>
+ * A call to plain {@code invoke} works the same as a call to
+ * {@code invokeExact}, if the symbolic type descriptor specified by the caller
+ * exactly matches the method handle's own type.
+ * If there is a type mismatch, {@code invoke} attempts
+ * to adjust the type of the receiving method handle,
+ * as if by a call to {@link #asType asType},
+ * to obtain an exactly invokable method handle {@code M2}.
+ * This allows a more powerful negotiation of method type
+ * between caller and callee.
+ * <p>
+ * (<em>Note:</em> The adjusted method handle {@code M2} is not directly observable,
+ * and implementations are therefore not required to materialize it.)
+ *
+ * <h1>Invocation checking</h1>
+ * In typical programs, method handle type matching will usually succeed.
+ * But if a match fails, the JVM will throw a {@link WrongMethodTypeException},
+ * either directly (in the case of {@code invokeExact}) or indirectly as if
+ * by a failed call to {@code asType} (in the case of {@code invoke}).
+ * <p>
+ * Thus, a method type mismatch which might show up as a linkage error
+ * in a statically typed program can show up as
+ * a dynamic {@code WrongMethodTypeException}
+ * in a program which uses method handles.
+ * <p>
+ * Because method types contain "live" {@code Class} objects,
+ * method type matching takes into account both types names and class loaders.
+ * Thus, even if a method handle {@code M} is created in one
+ * class loader {@code L1} and used in another {@code L2},
+ * method handle calls are type-safe, because the caller's symbolic type
+ * descriptor, as resolved in {@code L2},
+ * is matched against the original callee method's symbolic type descriptor,
+ * as resolved in {@code L1}.
+ * The resolution in {@code L1} happens when {@code M} is created
+ * and its type is assigned, while the resolution in {@code L2} happens
+ * when the {@code invokevirtual} instruction is linked.
+ * <p>
+ * Apart from the checking of type descriptors,
+ * a method handle's capability to call its underlying method is unrestricted.
+ * If a method handle is formed on a non-public method by a class
+ * that has access to that method, the resulting handle can be used
+ * in any place by any caller who receives a reference to it.
+ * <p>
+ * Unlike with the Core Reflection API, where access is checked every time
+ * a reflective method is invoked,
+ * method handle access checking is performed
+ * <a href="MethodHandles.Lookup.html#access">when the method handle is created</a>.
+ * In the case of {@code ldc} (see below), access checking is performed as part of linking
+ * the constant pool entry underlying the constant method handle.
+ * <p>
+ * Thus, handles to non-public methods, or to methods in non-public classes,
+ * should generally be kept secret.
+ * They should not be passed to untrusted code unless their use from
+ * the untrusted code would be harmless.
+ *
+ * <h1>Method handle creation</h1>
+ * Java code can create a method handle that directly accesses
+ * any method, constructor, or field that is accessible to that code.
+ * This is done via a reflective, capability-based API called
+ * {@code java.lang.invoke.MethodHandles.Lookup MethodHandles.Lookup}
+ * For example, a static method handle can be obtained
+ * from {@code java.lang.invoke.MethodHandles.Lookup#findStatic Lookup.findStatic}.
+ * There are also conversion methods from Core Reflection API objects,
+ * such as {@code java.lang.invoke.MethodHandles.Lookup#unreflect Lookup.unreflect}.
+ * <p>
+ * Like classes and strings, method handles that correspond to accessible
+ * fields, methods, and constructors can also be represented directly
+ * in a class file's constant pool as constants to be loaded by {@code ldc} bytecodes.
+ * A new type of constant pool entry, {@code CONSTANT_MethodHandle},
+ * refers directly to an associated {@code CONSTANT_Methodref},
+ * {@code CONSTANT_InterfaceMethodref}, or {@code CONSTANT_Fieldref}
+ * constant pool entry.
+ * (For full details on method handle constants,
+ * see sections 4.4.8 and 5.4.3.5 of the Java Virtual Machine Specification.)
+ * <p>
+ * Method handles produced by lookups or constant loads from methods or
+ * constructors with the variable arity modifier bit ({@code 0x0080})
+ * have a corresponding variable arity, as if they were defined with
+ * the help of {@link #asVarargsCollector asVarargsCollector}.
+ * <p>
+ * A method reference may refer either to a static or non-static method.
+ * In the non-static case, the method handle type includes an explicit
+ * receiver argument, prepended before any other arguments.
+ * In the method handle's type, the initial receiver argument is typed
+ * according to the class under which the method was initially requested.
+ * (E.g., if a non-static method handle is obtained via {@code ldc},
+ * the type of the receiver is the class named in the constant pool entry.)
+ * <p>
+ * Method handle constants are subject to the same link-time access checks
+ * their corresponding bytecode instructions, and the {@code ldc} instruction
+ * will throw corresponding linkage errors if the bytecode behaviors would
+ * throw such errors.
+ * <p>
+ * As a corollary of this, access to protected members is restricted
+ * to receivers only of the accessing class, or one of its subclasses,
+ * and the accessing class must in turn be a subclass (or package sibling)
+ * of the protected member's defining class.
+ * If a method reference refers to a protected non-static method or field
+ * of a class outside the current package, the receiver argument will
+ * be narrowed to the type of the accessing class.
+ * <p>
+ * When a method handle to a virtual method is invoked, the method is
+ * always looked up in the receiver (that is, the first argument).
+ * <p>
+ * A non-virtual method handle to a specific virtual method implementation
+ * can also be created. These do not perform virtual lookup based on
+ * receiver type. Such a method handle simulates the effect of
+ * an {@code invokespecial} instruction to the same method.
+ *
+ * <h1>Usage examples</h1>
+ * Here are some examples of usage:
+ * <blockquote><pre>{@code
+Object x, y; String s; int i;
+MethodType mt; MethodHandle mh;
+MethodHandles.Lookup lookup = MethodHandles.lookup();
+// mt is (char,char)String
+mt = MethodType.methodType(String.class, char.class, char.class);
+mh = lookup.findVirtual(String.class, "replace", mt);
+s = (String) mh.invokeExact("daddy",'d','n');
+// invokeExact(Ljava/lang/String;CC)Ljava/lang/String;
+assertEquals(s, "nanny");
+// weakly typed invocation (using MHs.invoke)
+s = (String) mh.invokeWithArguments("sappy", 'p', 'v');
+assertEquals(s, "savvy");
+// mt is (Object[])List
+mt = MethodType.methodType(java.util.List.class, Object[].class);
+mh = lookup.findStatic(java.util.Arrays.class, "asList", mt);
+assert(mh.isVarargsCollector());
+x = mh.invoke("one", "two");
+// invoke(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;
+assertEquals(x, java.util.Arrays.asList("one","two"));
+// mt is (Object,Object,Object)Object
+mt = MethodType.genericMethodType(3);
+mh = mh.asType(mt);
+x = mh.invokeExact((Object)1, (Object)2, (Object)3);
+// invokeExact(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+assertEquals(x, java.util.Arrays.asList(1,2,3));
+// mt is ()int
+mt = MethodType.methodType(int.class);
+mh = lookup.findVirtual(java.util.List.class, "size", mt);
+i = (int) mh.invokeExact(java.util.Arrays.asList(1,2,3));
+// invokeExact(Ljava/util/List;)I
+assert(i == 3);
+mt = MethodType.methodType(void.class, String.class);
+mh = lookup.findVirtual(java.io.PrintStream.class, "println", mt);
+mh.invokeExact(System.out, "Hello, world.");
+// invokeExact(Ljava/io/PrintStream;Ljava/lang/String;)V
+ * }</pre></blockquote>
+ * Each of the above calls to {@code invokeExact} or plain {@code invoke}
+ * generates a single invokevirtual instruction with
+ * the symbolic type descriptor indicated in the following comment.
+ * In these examples, the helper method {@code assertEquals} is assumed to
+ * be a method which calls {@link java.util.Objects#equals(Object,Object) Objects.equals}
+ * on its arguments, and asserts that the result is true.
+ *
+ * <h1>Exceptions</h1>
+ * The methods {@code invokeExact} and {@code invoke} are declared
+ * to throw {@link java.lang.Throwable Throwable},
+ * which is to say that there is no static restriction on what a method handle
+ * can throw. Since the JVM does not distinguish between checked
+ * and unchecked exceptions (other than by their class, of course),
+ * there is no particular effect on bytecode shape from ascribing
+ * checked exceptions to method handle invocations. But in Java source
+ * code, methods which perform method handle calls must either explicitly
+ * throw {@code Throwable}, or else must catch all
+ * throwables locally, rethrowing only those which are legal in the context,
+ * and wrapping ones which are illegal.
+ *
+ * <h1><a name="sigpoly"></a>Signature polymorphism</h1>
+ * The unusual compilation and linkage behavior of
+ * {@code invokeExact} and plain {@code invoke}
+ * is referenced by the term <em>signature polymorphism</em>.
+ * As defined in the Java Language Specification,
+ * a signature polymorphic method is one which can operate with
+ * any of a wide range of call signatures and return types.
+ * <p>
+ * In source code, a call to a signature polymorphic method will
+ * compile, regardless of the requested symbolic type descriptor.
+ * As usual, the Java compiler emits an {@code invokevirtual}
+ * instruction with the given symbolic type descriptor against the named method.
+ * The unusual part is that the symbolic type descriptor is derived from
+ * the actual argument and return types, not from the method declaration.
+ * <p>
+ * When the JVM processes bytecode containing signature polymorphic calls,
+ * it will successfully link any such call, regardless of its symbolic type descriptor.
+ * (In order to retain type safety, the JVM will guard such calls with suitable
+ * dynamic type checks, as described elsewhere.)
+ * <p>
+ * Bytecode generators, including the compiler back end, are required to emit
+ * untransformed symbolic type descriptors for these methods.
+ * Tools which determine symbolic linkage are required to accept such
+ * untransformed descriptors, without reporting linkage errors.
+ *
+ * <h1>Interoperation between method handles and the Core Reflection API</h1>
+ * Using factory methods in the {@code java.lang.invoke.MethodHandles.Lookup Lookup} API,
+ * any class member represented by a Core Reflection API object
+ * can be converted to a behaviorally equivalent method handle.
+ * For example, a reflective {@link java.lang.reflect.Method Method} can
+ * be converted to a method handle using
+ * {@code java.lang.invoke.MethodHandles.Lookup#unreflect Lookup.unreflect}.
+ * The resulting method handles generally provide more direct and efficient
+ * access to the underlying class members.
+ * <p>
+ * As a special case,
+ * when the Core Reflection API is used to view the signature polymorphic
+ * methods {@code invokeExact} or plain {@code invoke} in this class,
+ * they appear as ordinary non-polymorphic methods.
+ * Their reflective appearance, as viewed by
+ * {@link java.lang.Class#getDeclaredMethod Class.getDeclaredMethod},
+ * is unaffected by their special status in this API.
+ * For example, {@link java.lang.reflect.Method#getModifiers Method.getModifiers}
+ * will report exactly those modifier bits required for any similarly
+ * declared method, including in this case {@code native} and {@code varargs} bits.
+ * <p>
+ * As with any reflected method, these methods (when reflected) may be
+ * invoked via {@link java.lang.reflect.Method#invoke java.lang.reflect.Method.invoke}.
+ * However, such reflective calls do not result in method handle invocations.
+ * Such a call, if passed the required argument
+ * (a single one, of type {@code Object[]}), will ignore the argument and
+ * will throw an {@code UnsupportedOperationException}.
+ * <p>
+ * Since {@code invokevirtual} instructions can natively
+ * invoke method handles under any symbolic type descriptor, this reflective view conflicts
+ * with the normal presentation of these methods via bytecodes.
+ * Thus, these two native methods, when reflectively viewed by
+ * {@code Class.getDeclaredMethod}, may be regarded as placeholders only.
+ * <p>
+ * In order to obtain an invoker method for a particular type descriptor,
+ * use {@code java.lang.invoke.MethodHandles#exactInvoker MethodHandles.exactInvoker},
+ * or {@code java.lang.invoke.MethodHandles#invoker MethodHandles.invoker}.
+ * The {@code java.lang.invoke.MethodHandles.Lookup#findVirtual Lookup.findVirtual}
+ * API is also able to return a method handle
+ * to call {@code invokeExact} or plain {@code invoke},
+ * for any specified type descriptor .
+ *
+ * <h1>Interoperation between method handles and Java generics</h1>
+ * A method handle can be obtained on a method, constructor, or field
+ * which is declared with Java generic types.
+ * As with the Core Reflection API, the type of the method handle
+ * will constructed from the erasure of the source-level type.
+ * When a method handle is invoked, the types of its arguments
+ * or the return value cast type may be generic types or type instances.
+ * If this occurs, the compiler will replace those
+ * types by their erasures when it constructs the symbolic type descriptor
+ * for the {@code invokevirtual} instruction.
+ * <p>
+ * Method handles do not represent
+ * their function-like types in terms of Java parameterized (generic) types,
+ * because there are three mismatches between function-like types and parameterized
+ * Java types.
+ * <ul>
+ * <li>Method types range over all possible arities,
+ * from no arguments to up to the <a href="MethodHandle.html#maxarity">maximum number</a> of allowed arguments.
+ * Generics are not variadic, and so cannot represent this.</li>
+ * <li>Method types can specify arguments of primitive types,
+ * which Java generic types cannot range over.</li>
+ * <li>Higher order functions over method handles (combinators) are
+ * often generic across a wide range of function types, including
+ * those of multiple arities. It is impossible to represent such
+ * genericity with a Java type parameter.</li>
+ * </ul>
+ *
+ * <h1><a name="maxarity"></a>Arity limits</h1>
+ * The JVM imposes on all methods and constructors of any kind an absolute
+ * limit of 255 stacked arguments. This limit can appear more restrictive
+ * in certain cases:
+ * <ul>
+ * <li>A {@code long} or {@code double} argument counts (for purposes of arity limits) as two argument slots.
+ * <li>A non-static method consumes an extra argument for the object on which the method is called.
+ * <li>A constructor consumes an extra argument for the object which is being constructed.
+ * <li>Since a method handle’s {@code invoke} method (or other signature-polymorphic method) is non-virtual,
+ * it consumes an extra argument for the method handle itself, in addition to any non-virtual receiver object.
+ * </ul>
+ * These limits imply that certain method handles cannot be created, solely because of the JVM limit on stacked arguments.
+ * For example, if a static JVM method accepts exactly 255 arguments, a method handle cannot be created for it.
+ * Attempts to create method handles with impossible method types lead to an {@link IllegalArgumentException}.
+ * In particular, a method handle’s type must not have an arity of the exact maximum 255.
+ *
+ * @see MethodType
+ * @author John Rose, JSR 292 EG
+ */
+// Android-changed, TODO(narayan): Replace @code with @linkplain once MethodHandles
+// is ready for use.
+// @see MethodHandles
+// Android-changed, TODO(narayan): Bring back @see once the MethodHandles class is ready for use..
+public abstract class MethodHandle {
+ // Android-changed:
+ //
+ // static { MethodHandleImpl.initStatics(); }
+ //
+ // LambdaForm and customizationCount are currently unused in our implementation
+ // and will be substituted with appropriate implementation / delegate classes.
+ //
+ // /*private*/ final LambdaForm form;
+ // form is not private so that invokers can easily fetch it
+ // /*non-public*/ byte customizationCount;
+ // customizationCount should be accessible from invokers
+
+
+ /**
+ * Internal marker interface which distinguishes (to the Java compiler)
+ * those methods which are <a href="MethodHandle.html#sigpoly">signature polymorphic</a>.
+ */
+ @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD})
+ @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
+ @interface PolymorphicSignature { }
+
+ private final MethodType type;
+ /*private*/ MethodHandle asTypeCache;
+ // asTypeCache is not private so that invokers can easily fetch it
+
+ /**
+ * Reports the type of this method handle.
+ * Every invocation of this method handle via {@code invokeExact} must exactly match this type.
+ * @return the method handle type
+ */
+ public MethodType type() {
+ return type;
+ }
+
+ /**
+ * Package-private constructor for the method handle implementation hierarchy.
+ * Method handle inheritance will be contained completely within
+ * the {@code java.lang.invoke} package.
+ */
+ // @param type type (permanently assigned) of the new method handle
+ /*non-public*/ MethodHandle(MethodType type) {
+ type.getClass(); // explicit NPE
+ this.type = type;
+
+ // Android-changed: No LambdaForms associated with this MH.
+ }
+
+ /**
+ * Invokes the method handle, allowing any caller type descriptor, but requiring an exact type match.
+ * The symbolic type descriptor at the call site of {@code invokeExact} must
+ * exactly match this method handle's {@link #type type}.
+ * No conversions are allowed on arguments or return values.
+ * <p>
+ * When this method is observed via the Core Reflection API,
+ * it will appear as a single native method, taking an object array and returning an object.
+ * If this native method is invoked directly via
+ * {@link java.lang.reflect.Method#invoke java.lang.reflect.Method.invoke}, via JNI,
+ * or indirectly via {@code java.lang.invoke.MethodHandles.Lookup#unreflect Lookup.unreflect},
+ * it will throw an {@code UnsupportedOperationException}.
+ * @param args the signature-polymorphic parameter list, statically represented using varargs
+ * @return the signature-polymorphic result, statically represented using {@code Object}
+ * @throws WrongMethodTypeException if the target's type is not identical with the caller's symbolic type descriptor
+ * @throws Throwable anything thrown by the underlying method propagates unchanged through the method handle call
+ */
+ // Android-changed, TODO(narayan): Replace @code with @linkplain once MethodHandles
+ // is ready for use.
+ public final native @PolymorphicSignature Object invokeExact(Object... args) throws Throwable;
+
+ /**
+ * Invokes the method handle, allowing any caller type descriptor,
+ * and optionally performing conversions on arguments and return values.
+ * <p>
+ * If the call site's symbolic type descriptor exactly matches this method handle's {@link #type type},
+ * the call proceeds as if by {@link #invokeExact invokeExact}.
+ * <p>
+ * Otherwise, the call proceeds as if this method handle were first
+ * adjusted by calling {@link #asType asType} to adjust this method handle
+ * to the required type, and then the call proceeds as if by
+ * {@link #invokeExact invokeExact} on the adjusted method handle.
+ * <p>
+ * There is no guarantee that the {@code asType} call is actually made.
+ * If the JVM can predict the results of making the call, it may perform
+ * adaptations directly on the caller's arguments,
+ * and call the target method handle according to its own exact type.
+ * <p>
+ * The resolved type descriptor at the call site of {@code invoke} must
+ * be a valid argument to the receivers {@code asType} method.
+ * In particular, the caller must specify the same argument arity
+ * as the callee's type,
+ * if the callee is not a {@linkplain #asVarargsCollector variable arity collector}.
+ * <p>
+ * When this method is observed via the Core Reflection API,
+ * it will appear as a single native method, taking an object array and returning an object.
+ * If this native method is invoked directly via
+ * {@link java.lang.reflect.Method#invoke java.lang.reflect.Method.invoke}, via JNI,
+ * or indirectly via {@code java.lang.invoke.MethodHandles.Lookup#unreflect Lookup.unreflect},
+ * it will throw an {@code UnsupportedOperationException}.
+ * @param args the signature-polymorphic parameter list, statically represented using varargs
+ * @return the signature-polymorphic result, statically represented using {@code Object}
+ * @throws WrongMethodTypeException if the target's type cannot be adjusted to the caller's symbolic type descriptor
+ * @throws ClassCastException if the target's type can be adjusted to the caller, but a reference cast fails
+ * @throws Throwable anything thrown by the underlying method propagates unchanged through the method handle call
+ */
+ // Android-changed, TODO(narayan): Replace @code with @link once MethodHandles
+ // is ready for use.
+ public final native @PolymorphicSignature Object invoke(Object... args) throws Throwable;
+
+ // Android-changed: Removed implementation details.
+ //
+ // /*non-public*/ final native @PolymorphicSignature Object invokeBasic(Object... args)
+ // /*non-public*/ static native @PolymorphicSignature Object linkToVirtual(Object... args)
+ // /*non-public*/ static native @PolymorphicSignature Object linkToStatic(Object... args)
+ // /*non-public*/ static native @PolymorphicSignature Object linkToSpecial(Object... args)
+ // /*non-public*/ static native @PolymorphicSignature Object linkToInterface(Object... args)
+
+ /**
+ * Performs a variable arity invocation, passing the arguments in the given list
+ * to the method handle, as if via an inexact {@link #invoke invoke} from a call site
+ * which mentions only the type {@code Object}, and whose arity is the length
+ * of the argument list.
+ * <p>
+ * Specifically, execution proceeds as if by the following steps,
+ * although the methods are not guaranteed to be called if the JVM
+ * can predict their effects.
+ * <ul>
+ * <li>Determine the length of the argument array as {@code N}.
+ * For a null reference, {@code N=0}. </li>
+ * <li>Determine the general type {@code TN} of {@code N} arguments as
+ * as {@code TN=MethodType.genericMethodType(N)}.</li>
+ * <li>Force the original target method handle {@code MH0} to the
+ * required type, as {@code MH1 = MH0.asType(TN)}. </li>
+ * <li>Spread the array into {@code N} separate arguments {@code A0, ...}. </li>
+ * <li>Invoke the type-adjusted method handle on the unpacked arguments:
+ * MH1.invokeExact(A0, ...). </li>
+ * <li>Take the return value as an {@code Object} reference. </li>
+ * </ul>
+ * <p>
+ * Because of the action of the {@code asType} step, the following argument
+ * conversions are applied as necessary:
+ * <ul>
+ * <li>reference casting
+ * <li>unboxing
+ * <li>widening primitive conversions
+ * </ul>
+ * <p>
+ * The result returned by the call is boxed if it is a primitive,
+ * or forced to null if the return type is void.
+ * <p>
+ * This call is equivalent to the following code:
+ * <blockquote><pre>{@code
+ * MethodHandle invoker = MethodHandles.spreadInvoker(this.type(), 0);
+ * Object result = invoker.invokeExact(this, arguments);
+ * }</pre></blockquote>
+ * <p>
+ * Unlike the signature polymorphic methods {@code invokeExact} and {@code invoke},
+ * {@code invokeWithArguments} can be accessed normally via the Core Reflection API and JNI.
+ * It can therefore be used as a bridge between native or reflective code and method handles.
+ *
+ * @param arguments the arguments to pass to the target
+ * @return the result returned by the target
+ * @throws ClassCastException if an argument cannot be converted by reference casting
+ * @throws WrongMethodTypeException if the target's type cannot be adjusted to take the given number of {@code Object} arguments
+ * @throws Throwable anything thrown by the target method invocation
+ */
+ // @see MethodHandles#spreadInvoker
+ // Android-changed, TODO(narayan): Bring back @see once the MethodHandles class is ready for use.
+ public Object invokeWithArguments(Object... arguments) throws Throwable {
+ // TODO(narayan): Implement invokeWithArguments.
+ throw new UnsupportedOperationException("invokeWithArguments(Object...)");
+ }
+
+ /**
+ * Performs a variable arity invocation, passing the arguments in the given array
+ * to the method handle, as if via an inexact {@link #invoke invoke} from a call site
+ * which mentions only the type {@code Object}, and whose arity is the length
+ * of the argument array.
+ * <p>
+ * This method is also equivalent to the following code:
+ * <blockquote><pre>{@code
+ * invokeWithArguments(arguments.toArray()
+ * }</pre></blockquote>
+ *
+ * @param arguments the arguments to pass to the target
+ * @return the result returned by the target
+ * @throws NullPointerException if {@code arguments} is a null reference
+ * @throws ClassCastException if an argument cannot be converted by reference casting
+ * @throws WrongMethodTypeException if the target's type cannot be adjusted to take the given number of {@code Object} arguments
+ * @throws Throwable anything thrown by the target method invocation
+ */
+ public Object invokeWithArguments(java.util.List<?> arguments) throws Throwable {
+ return invokeWithArguments(arguments.toArray());
+ }
+
+ /**
+ * Produces an adapter method handle which adapts the type of the
+ * current method handle to a new type.
+ * The resulting method handle is guaranteed to report a type
+ * which is equal to the desired new type.
+ * <p>
+ * If the original type and new type are equal, returns {@code this}.
+ * <p>
+ * The new method handle, when invoked, will perform the following
+ * steps:
+ * <ul>
+ * <li>Convert the incoming argument list to match the original
+ * method handle's argument list.
+ * <li>Invoke the original method handle on the converted argument list.
+ * <li>Convert any result returned by the original method handle
+ * to the return type of new method handle.
+ * </ul>
+ * <p>
+ * This method provides the crucial behavioral difference between
+ * {@link #invokeExact invokeExact} and plain, inexact {@link #invoke invoke}.
+ * The two methods
+ * perform the same steps when the caller's type descriptor exactly m atches
+ * the callee's, but when the types differ, plain {@link #invoke invoke}
+ * also calls {@code asType} (or some internal equivalent) in order
+ * to match up the caller's and callee's types.
+ * <p>
+ * If the current method is a variable arity method handle
+ * argument list conversion may involve the conversion and collection
+ * of several arguments into an array, as
+ * {@linkplain #asVarargsCollector described elsewhere}.
+ * In every other case, all conversions are applied <em>pairwise</em>,
+ * which means that each argument or return value is converted to
+ * exactly one argument or return value (or no return value).
+ * The applied conversions are defined by consulting the
+ * the corresponding component types of the old and new
+ * method handle types.
+ * <p>
+ * Let <em>T0</em> and <em>T1</em> be corresponding new and old parameter types,
+ * or old and new return types. Specifically, for some valid index {@code i}, let
+ * <em>T0</em>{@code =newType.parameterType(i)} and <em>T1</em>{@code =this.type().parameterType(i)}.
+ * Or else, going the other way for return values, let
+ * <em>T0</em>{@code =this.type().returnType()} and <em>T1</em>{@code =newType.returnType()}.
+ * If the types are the same, the new method handle makes no change
+ * to the corresponding argument or return value (if any).
+ * Otherwise, one of the following conversions is applied
+ * if possible:
+ * <ul>
+ * <li>If <em>T0</em> and <em>T1</em> are references, then a cast to <em>T1</em> is applied.
+ * (The types do not need to be related in any particular way.
+ * This is because a dynamic value of null can convert to any reference type.)
+ * <li>If <em>T0</em> and <em>T1</em> are primitives, then a Java method invocation
+ * conversion (JLS 5.3) is applied, if one exists.
+ * (Specifically, <em>T0</em> must convert to <em>T1</em> by a widening primitive conversion.)
+ * <li>If <em>T0</em> is a primitive and <em>T1</em> a reference,
+ * a Java casting conversion (JLS 5.5) is applied if one exists.
+ * (Specifically, the value is boxed from <em>T0</em> to its wrapper class,
+ * which is then widened as needed to <em>T1</em>.)
+ * <li>If <em>T0</em> is a reference and <em>T1</em> a primitive, an unboxing
+ * conversion will be applied at runtime, possibly followed
+ * by a Java method invocation conversion (JLS 5.3)
+ * on the primitive value. (These are the primitive widening conversions.)
+ * <em>T0</em> must be a wrapper class or a supertype of one.
+ * (In the case where <em>T0</em> is Object, these are the conversions
+ * allowed by {@link java.lang.reflect.Method#invoke java.lang.reflect.Method.invoke}.)
+ * The unboxing conversion must have a possibility of success, which means that
+ * if <em>T0</em> is not itself a wrapper class, there must exist at least one
+ * wrapper class <em>TW</em> which is a subtype of <em>T0</em> and whose unboxed
+ * primitive value can be widened to <em>T1</em>.
+ * <li>If the return type <em>T1</em> is marked as void, any returned value is discarded
+ * <li>If the return type <em>T0</em> is void and <em>T1</em> a reference, a null value is introduced.
+ * <li>If the return type <em>T0</em> is void and <em>T1</em> a primitive,
+ * a zero value is introduced.
+ * </ul>
+ * (<em>Note:</em> Both <em>T0</em> and <em>T1</em> may be regarded as static types,
+ * because neither corresponds specifically to the <em>dynamic type</em> of any
+ * actual argument or return value.)
+ * <p>
+ * The method handle conversion cannot be made if any one of the required
+ * pairwise conversions cannot be made.
+ * <p>
+ * At runtime, the conversions applied to reference arguments
+ * or return values may require additional runtime checks which can fail.
+ * An unboxing operation may fail because the original reference is null,
+ * causing a {@link java.lang.NullPointerException NullPointerException}.
+ * An unboxing operation or a reference cast may also fail on a reference
+ * to an object of the wrong type,
+ * causing a {@link java.lang.ClassCastException ClassCastException}.
+ * Although an unboxing operation may accept several kinds of wrappers,
+ * if none are available, a {@code ClassCastException} will be thrown.
+ *
+ * @param newType the expected type of the new method handle
+ * @return a method handle which delegates to {@code this} after performing
+ * any necessary argument conversions, and arranges for any
+ * necessary return value conversions
+ * @throws NullPointerException if {@code newType} is a null reference
+ * @throws WrongMethodTypeException if the conversion cannot be made
+ */
+ // @see MethodHandles#explicitCastArguments
+ // Android-changed, TODO(narayan): Bring back @see once the MethodHandles class is ready for use.
+ public MethodHandle asType(MethodType newType) {
+ // Fast path alternative to a heavyweight {@code asType} call.
+ // Return 'this' if the conversion will be a no-op.
+ if (newType == type) {
+ return this;
+ }
+ // Return 'this.asTypeCache' if the conversion is already memoized.
+ MethodHandle atc = asTypeCached(newType);
+ if (atc != null) {
+ return atc;
+ }
+ return asTypeUncached(newType);
+ }
+
+ private MethodHandle asTypeCached(MethodType newType) {
+ MethodHandle atc = asTypeCache;
+ if (atc != null && newType == atc.type) {
+ return atc;
+ }
+ return null;
+ }
+
+ /** Override this to change asType behavior. */
+ /*non-public*/ MethodHandle asTypeUncached(MethodType newType) {
+ if (!type.isConvertibleTo(newType))
+ throw new WrongMethodTypeException("cannot convert "+this+" to "+newType);
+ // Android-changed, TODO(narayan): Not implemented yet.
+ throw new UnsupportedOperationException("asTypeUncached(MethodType)");
+ }
+
+ /**
+ * Makes an <em>array-spreading</em> method handle, which accepts a trailing array argument
+ * and spreads its elements as positional arguments.
+ * The new method handle adapts, as its <i>target</i>,
+ * the current method handle. The type of the adapter will be
+ * the same as the type of the target, except that the final
+ * {@code arrayLength} parameters of the target's type are replaced
+ * by a single array parameter of type {@code arrayType}.
+ * <p>
+ * If the array element type differs from any of the corresponding
+ * argument types on the original target,
+ * the original target is adapted to take the array elements directly,
+ * as if by a call to {@link #asType asType}.
+ * <p>
+ * When called, the adapter replaces a trailing array argument
+ * by the array's elements, each as its own argument to the target.
+ * (The order of the arguments is preserved.)
+ * They are converted pairwise by casting and/or unboxing
+ * to the types of the trailing parameters of the target.
+ * Finally the target is called.
+ * What the target eventually returns is returned unchanged by the adapter.
+ * <p>
+ * Before calling the target, the adapter verifies that the array
+ * contains exactly enough elements to provide a correct argument count
+ * to the target method handle.
+ * (The array may also be null when zero elements are required.)
+ * <p>
+ * If, when the adapter is called, the supplied array argument does
+ * not have the correct number of elements, the adapter will throw
+ * an {@link IllegalArgumentException} instead of invoking the target.
+ * <p>
+ * Here are some simple examples of array-spreading method handles:
+ * <blockquote><pre>{@code
+MethodHandle equals = publicLookup()
+ .findVirtual(String.class, "equals", methodType(boolean.class, Object.class));
+assert( (boolean) equals.invokeExact("me", (Object)"me"));
+assert(!(boolean) equals.invokeExact("me", (Object)"thee"));
+// spread both arguments from a 2-array:
+MethodHandle eq2 = equals.asSpreader(Object[].class, 2);
+assert( (boolean) eq2.invokeExact(new Object[]{ "me", "me" }));
+assert(!(boolean) eq2.invokeExact(new Object[]{ "me", "thee" }));
+// try to spread from anything but a 2-array:
+for (int n = 0; n <= 10; n++) {
+ Object[] badArityArgs = (n == 2 ? null : new Object[n]);
+ try { assert((boolean) eq2.invokeExact(badArityArgs) && false); }
+ catch (IllegalArgumentException ex) { } // OK
+}
+// spread both arguments from a String array:
+MethodHandle eq2s = equals.asSpreader(String[].class, 2);
+assert( (boolean) eq2s.invokeExact(new String[]{ "me", "me" }));
+assert(!(boolean) eq2s.invokeExact(new String[]{ "me", "thee" }));
+// spread second arguments from a 1-array:
+MethodHandle eq1 = equals.asSpreader(Object[].class, 1);
+assert( (boolean) eq1.invokeExact("me", new Object[]{ "me" }));
+assert(!(boolean) eq1.invokeExact("me", new Object[]{ "thee" }));
+// spread no arguments from a 0-array or null:
+MethodHandle eq0 = equals.asSpreader(Object[].class, 0);
+assert( (boolean) eq0.invokeExact("me", (Object)"me", new Object[0]));
+assert(!(boolean) eq0.invokeExact("me", (Object)"thee", (Object[])null));
+// asSpreader and asCollector are approximate inverses:
+for (int n = 0; n <= 2; n++) {
+ for (Class<?> a : new Class<?>[]{Object[].class, String[].class, CharSequence[].class}) {
+ MethodHandle equals2 = equals.asSpreader(a, n).asCollector(a, n);
+ assert( (boolean) equals2.invokeWithArguments("me", "me"));
+ assert(!(boolean) equals2.invokeWithArguments("me", "thee"));
+ }
+}
+MethodHandle caToString = publicLookup()
+ .findStatic(Arrays.class, "toString", methodType(String.class, char[].class));
+assertEquals("[A, B, C]", (String) caToString.invokeExact("ABC".toCharArray()));
+MethodHandle caString3 = caToString.asCollector(char[].class, 3);
+assertEquals("[A, B, C]", (String) caString3.invokeExact('A', 'B', 'C'));
+MethodHandle caToString2 = caString3.asSpreader(char[].class, 2);
+assertEquals("[A, B, C]", (String) caToString2.invokeExact('A', "BC".toCharArray()));
+ * }</pre></blockquote>
+ * @param arrayType usually {@code Object[]}, the type of the array argument from which to extract the spread arguments
+ * @param arrayLength the number of arguments to spread from an incoming array argument
+ * @return a new method handle which spreads its final array argument,
+ * before calling the original method handle
+ * @throws NullPointerException if {@code arrayType} is a null reference
+ * @throws IllegalArgumentException if {@code arrayType} is not an array type,
+ * or if target does not have at least
+ * {@code arrayLength} parameter types,
+ * or if {@code arrayLength} is negative,
+ * or if the resulting method handle's type would have
+ * <a href="MethodHandle.html#maxarity">too many parameters</a>
+ * @throws WrongMethodTypeException if the implied {@code asType} call fails
+ * @see #asCollector
+ */
+ public MethodHandle asSpreader(Class<?> arrayType, int arrayLength) {
+ MethodType postSpreadType = asSpreaderChecks(arrayType, arrayLength);
+
+ // Android-changed, TODO(narayan): Not implemented yet.
+ throw new UnsupportedOperationException("asSpreader(Class<?>, int)");
+ }
+
+ /**
+ * See if {@code asSpreader} can be validly called with the given arguments.
+ * Return the type of the method handle call after spreading but before conversions.
+ */
+ private MethodType asSpreaderChecks(Class<?> arrayType, int arrayLength) {
+ spreadArrayChecks(arrayType, arrayLength);
+ int nargs = type().parameterCount();
+ if (nargs < arrayLength || arrayLength < 0)
+ throw newIllegalArgumentException("bad spread array length");
+ Class<?> arrayElement = arrayType.getComponentType();
+ MethodType mtype = type();
+ boolean match = true, fail = false;
+ for (int i = nargs - arrayLength; i < nargs; i++) {
+ Class<?> ptype = mtype.parameterType(i);
+ if (ptype != arrayElement) {
+ match = false;
+ if (!MethodType.canConvert(arrayElement, ptype)) {
+ fail = true;
+ break;
+ }
+ }
+ }
+ if (match) return mtype;
+ MethodType needType = mtype.asSpreaderType(arrayType, arrayLength);
+ if (!fail) return needType;
+ // elicit an error:
+ this.asType(needType);
+ throw newInternalError("should not return", null);
+ }
+
+ private void spreadArrayChecks(Class<?> arrayType, int arrayLength) {
+ Class<?> arrayElement = arrayType.getComponentType();
+ if (arrayElement == null)
+ throw newIllegalArgumentException("not an array type", arrayType);
+ if ((arrayLength & 0x7F) != arrayLength) {
+ if ((arrayLength & 0xFF) != arrayLength)
+ throw newIllegalArgumentException("array length is not legal", arrayLength);
+ assert(arrayLength >= 128);
+ if (arrayElement == long.class ||
+ arrayElement == double.class)
+ throw newIllegalArgumentException("array length is not legal for long[] or double[]", arrayLength);
+ }
+ }
+
+ /**
+ * Makes an <em>array-collecting</em> method handle, which accepts a given number of trailing
+ * positional arguments and collects them into an array argument.
+ * The new method handle adapts, as its <i>target</i>,
+ * the current method handle. The type of the adapter will be
+ * the same as the type of the target, except that a single trailing
+ * parameter (usually of type {@code arrayType}) is replaced by
+ * {@code arrayLength} parameters whose type is element type of {@code arrayType}.
+ * <p>
+ * If the array type differs from the final argument type on the original target,
+ * the original target is adapted to take the array type directly,
+ * as if by a call to {@link #asType asType}.
+ * <p>
+ * When called, the adapter replaces its trailing {@code arrayLength}
+ * arguments by a single new array of type {@code arrayType}, whose elements
+ * comprise (in order) the replaced arguments.
+ * Finally the target is called.
+ * What the target eventually returns is returned unchanged by the adapter.
+ * <p>
+ * (The array may also be a shared constant when {@code arrayLength} is zero.)
+ * <p>
+ * (<em>Note:</em> The {@code arrayType} is often identical to the last
+ * parameter type of the original target.
+ * It is an explicit argument for symmetry with {@code asSpreader}, and also
+ * to allow the target to use a simple {@code Object} as its last parameter type.)
+ * <p>
+ * In order to create a collecting adapter which is not restricted to a particular
+ * number of collected arguments, use {@link #asVarargsCollector asVarargsCollector} instead.
+ * <p>
+ * Here are some examples of array-collecting method handles:
+ * <blockquote><pre>{@code
+MethodHandle deepToString = publicLookup()
+ .findStatic(Arrays.class, "deepToString", methodType(String.class, Object[].class));
+assertEquals("[won]", (String) deepToString.invokeExact(new Object[]{"won"}));
+MethodHandle ts1 = deepToString.asCollector(Object[].class, 1);
+assertEquals(methodType(String.class, Object.class), ts1.type());
+//assertEquals("[won]", (String) ts1.invokeExact( new Object[]{"won"})); //FAIL
+assertEquals("[[won]]", (String) ts1.invokeExact((Object) new Object[]{"won"}));
+// arrayType can be a subtype of Object[]
+MethodHandle ts2 = deepToString.asCollector(String[].class, 2);
+assertEquals(methodType(String.class, String.class, String.class), ts2.type());
+assertEquals("[two, too]", (String) ts2.invokeExact("two", "too"));
+MethodHandle ts0 = deepToString.asCollector(Object[].class, 0);
+assertEquals("[]", (String) ts0.invokeExact());
+// collectors can be nested, Lisp-style
+MethodHandle ts22 = deepToString.asCollector(Object[].class, 3).asCollector(String[].class, 2);
+assertEquals("[A, B, [C, D]]", ((String) ts22.invokeExact((Object)'A', (Object)"B", "C", "D")));
+// arrayType can be any primitive array type
+MethodHandle bytesToString = publicLookup()
+ .findStatic(Arrays.class, "toString", methodType(String.class, byte[].class))
+ .asCollector(byte[].class, 3);
+assertEquals("[1, 2, 3]", (String) bytesToString.invokeExact((byte)1, (byte)2, (byte)3));
+MethodHandle longsToString = publicLookup()
+ .findStatic(Arrays.class, "toString", methodType(String.class, long[].class))
+ .asCollector(long[].class, 1);
+assertEquals("[123]", (String) longsToString.invokeExact((long)123));
+ * }</pre></blockquote>
+ * @param arrayType often {@code Object[]}, the type of the array argument which will collect the arguments
+ * @param arrayLength the number of arguments to collect into a new array argument
+ * @return a new method handle which collects some trailing argument
+ * into an array, before calling the original method handle
+ * @throws NullPointerException if {@code arrayType} is a null reference
+ * @throws IllegalArgumentException if {@code arrayType} is not an array type
+ * or {@code arrayType} is not assignable to this method handle's trailing parameter type,
+ * or {@code arrayLength} is not a legal array size,
+ * or the resulting method handle's type would have
+ * <a href="MethodHandle.html#maxarity">too many parameters</a>
+ * @throws WrongMethodTypeException if the implied {@code asType} call fails
+ * @see #asSpreader
+ * @see #asVarargsCollector
+ */
+ public MethodHandle asCollector(Class<?> arrayType, int arrayLength) {
+ asCollectorChecks(arrayType, arrayLength);
+
+ // Android-changed, TODO(narayan): Not implemented yet.
+ throw new UnsupportedOperationException("asCollector(Class<?>, int)");
+ }
+
+ /**
+ * See if {@code asCollector} can be validly called with the given arguments.
+ * Return false if the last parameter is not an exact match to arrayType.
+ */
+ /*non-public*/ boolean asCollectorChecks(Class<?> arrayType, int arrayLength) {
+ spreadArrayChecks(arrayType, arrayLength);
+ int nargs = type().parameterCount();
+ if (nargs != 0) {
+ Class<?> lastParam = type().parameterType(nargs-1);
+ if (lastParam == arrayType) return true;
+ if (lastParam.isAssignableFrom(arrayType)) return false;
+ }
+ throw newIllegalArgumentException("array type not assignable to trailing argument", this, arrayType);
+ }
+
+ /**
+ * Makes a <em>variable arity</em> adapter which is able to accept
+ * any number of trailing positional arguments and collect them
+ * into an array argument.
+ * <p>
+ * The type and behavior of the adapter will be the same as
+ * the type and behavior of the target, except that certain
+ * {@code invoke} and {@code asType} requests can lead to
+ * trailing positional arguments being collected into target's
+ * trailing parameter.
+ * Also, the last parameter type of the adapter will be
+ * {@code arrayType}, even if the target has a different
+ * last parameter type.
+ * <p>
+ * This transformation may return {@code this} if the method handle is
+ * already of variable arity and its trailing parameter type
+ * is identical to {@code arrayType}.
+ * <p>
+ * When called with {@link #invokeExact invokeExact}, the adapter invokes
+ * the target with no argument changes.
+ * (<em>Note:</em> This behavior is different from a
+ * {@linkplain #asCollector fixed arity collector},
+ * since it accepts a whole array of indeterminate length,
+ * rather than a fixed number of arguments.)
+ * <p>
+ * When called with plain, inexact {@link #invoke invoke}, if the caller
+ * type is the same as the adapter, the adapter invokes the target as with
+ * {@code invokeExact}.
+ * (This is the normal behavior for {@code invoke} when types match.)
+ * <p>
+ * Otherwise, if the caller and adapter arity are the same, and the
+ * trailing parameter type of the caller is a reference type identical to
+ * or assignable to the trailing parameter type of the adapter,
+ * the arguments and return values are converted pairwise,
+ * as if by {@link #asType asType} on a fixed arity
+ * method handle.
+ * <p>
+ * Otherwise, the arities differ, or the adapter's trailing parameter
+ * type is not assignable from the corresponding caller type.
+ * In this case, the adapter replaces all trailing arguments from
+ * the original trailing argument position onward, by
+ * a new array of type {@code arrayType}, whose elements
+ * comprise (in order) the replaced arguments.
+ * <p>
+ * The caller type must provides as least enough arguments,
+ * and of the correct type, to satisfy the target's requirement for
+ * positional arguments before the trailing array argument.
+ * Thus, the caller must supply, at a minimum, {@code N-1} arguments,
+ * where {@code N} is the arity of the target.
+ * Also, there must exist conversions from the incoming arguments
+ * to the target's arguments.
+ * As with other uses of plain {@code invoke}, if these basic
+ * requirements are not fulfilled, a {@code WrongMethodTypeException}
+ * may be thrown.
+ * <p>
+ * In all cases, what the target eventually returns is returned unchanged by the adapter.
+ * <p>
+ * In the final case, it is exactly as if the target method handle were
+ * temporarily adapted with a {@linkplain #asCollector fixed arity collector}
+ * to the arity required by the caller type.
+ * (As with {@code asCollector}, if the array length is zero,
+ * a shared constant may be used instead of a new array.
+ * If the implied call to {@code asCollector} would throw
+ * an {@code IllegalArgumentException} or {@code WrongMethodTypeException},
+ * the call to the variable arity adapter must throw
+ * {@code WrongMethodTypeException}.)
+ * <p>
+ * The behavior of {@link #asType asType} is also specialized for
+ * variable arity adapters, to maintain the invariant that
+ * plain, inexact {@code invoke} is always equivalent to an {@code asType}
+ * call to adjust the target type, followed by {@code invokeExact}.
+ * Therefore, a variable arity adapter responds
+ * to an {@code asType} request by building a fixed arity collector,
+ * if and only if the adapter and requested type differ either
+ * in arity or trailing argument type.
+ * The resulting fixed arity collector has its type further adjusted
+ * (if necessary) to the requested type by pairwise conversion,
+ * as if by another application of {@code asType}.
+ * <p>
+ * When a method handle is obtained by executing an {@code ldc} instruction
+ * of a {@code CONSTANT_MethodHandle} constant, and the target method is marked
+ * as a variable arity method (with the modifier bit {@code 0x0080}),
+ * the method handle will accept multiple arities, as if the method handle
+ * constant were created by means of a call to {@code asVarargsCollector}.
+ * <p>
+ * In order to create a collecting adapter which collects a predetermined
+ * number of arguments, and whose type reflects this predetermined number,
+ * use {@link #asCollector asCollector} instead.
+ * <p>
+ * No method handle transformations produce new method handles with
+ * variable arity, unless they are documented as doing so.
+ * Therefore, besides {@code asVarargsCollector},
+ * all methods in {@code MethodHandle} and {@code MethodHandles}
+ * will return a method handle with fixed arity,
+ * except in the cases where they are specified to return their original
+ * operand (e.g., {@code asType} of the method handle's own type).
+ * <p>
+ * Calling {@code asVarargsCollector} on a method handle which is already
+ * of variable arity will produce a method handle with the same type and behavior.
+ * It may (or may not) return the original variable arity method handle.
+ * <p>
+ * Here is an example, of a list-making variable arity method handle:
+ * <blockquote><pre>{@code
+MethodHandle deepToString = publicLookup()
+ .findStatic(Arrays.class, "deepToString", methodType(String.class, Object[].class));
+MethodHandle ts1 = deepToString.asVarargsCollector(Object[].class);
+assertEquals("[won]", (String) ts1.invokeExact( new Object[]{"won"}));
+assertEquals("[won]", (String) ts1.invoke( new Object[]{"won"}));
+assertEquals("[won]", (String) ts1.invoke( "won" ));
+assertEquals("[[won]]", (String) ts1.invoke((Object) new Object[]{"won"}));
+// findStatic of Arrays.asList(...) produces a variable arity method handle:
+MethodHandle asList = publicLookup()
+ .findStatic(Arrays.class, "asList", methodType(List.class, Object[].class));
+assertEquals(methodType(List.class, Object[].class), asList.type());
+assert(asList.isVarargsCollector());
+assertEquals("[]", asList.invoke().toString());
+assertEquals("[1]", asList.invoke(1).toString());
+assertEquals("[two, too]", asList.invoke("two", "too").toString());
+String[] argv = { "three", "thee", "tee" };
+assertEquals("[three, thee, tee]", asList.invoke(argv).toString());
+assertEquals("[three, thee, tee]", asList.invoke((Object[])argv).toString());
+List ls = (List) asList.invoke((Object)argv);
+assertEquals(1, ls.size());
+assertEquals("[three, thee, tee]", Arrays.toString((Object[])ls.get(0)));
+ * }</pre></blockquote>
+ * <p style="font-size:smaller;">
+ * <em>Discussion:</em>
+ * These rules are designed as a dynamically-typed variation
+ * of the Java rules for variable arity methods.
+ * In both cases, callers to a variable arity method or method handle
+ * can either pass zero or more positional arguments, or else pass
+ * pre-collected arrays of any length. Users should be aware of the
+ * special role of the final argument, and of the effect of a
+ * type match on that final argument, which determines whether
+ * or not a single trailing argument is interpreted as a whole
+ * array or a single element of an array to be collected.
+ * Note that the dynamic type of the trailing argument has no
+ * effect on this decision, only a comparison between the symbolic
+ * type descriptor of the call site and the type descriptor of the method handle.)
+ *
+ * @param arrayType often {@code Object[]}, the type of the array argument which will collect the arguments
+ * @return a new method handle which can collect any number of trailing arguments
+ * into an array, before calling the original method handle
+ * @throws NullPointerException if {@code arrayType} is a null reference
+ * @throws IllegalArgumentException if {@code arrayType} is not an array type
+ * or {@code arrayType} is not assignable to this method handle's trailing parameter type
+ * @see #asCollector
+ * @see #isVarargsCollector
+ * @see #asFixedArity
+ */
+ public MethodHandle asVarargsCollector(Class<?> arrayType) {
+ arrayType.getClass(); // explicit NPE
+ boolean lastMatch = asCollectorChecks(arrayType, 0);
+ if (isVarargsCollector() && lastMatch)
+ return this;
+
+ // Android-changed, TODO(narayan): Not implemented yet.
+ throw new UnsupportedOperationException("asVarargsCollector(Class<?>)");
+ }
+
+ /**
+ * Determines if this method handle
+ * supports {@linkplain #asVarargsCollector variable arity} calls.
+ * Such method handles arise from the following sources:
+ * <ul>
+ * <li>a call to {@linkplain #asVarargsCollector asVarargsCollector}
+ * <li>a call to a {@code java.lang.invoke.MethodHandles.Lookup lookup method}
+ * which resolves to a variable arity Java method or constructor
+ * <li>an {@code ldc} instruction of a {@code CONSTANT_MethodHandle}
+ * which resolves to a variable arity Java method or constructor
+ * </ul>
+ * @return true if this method handle accepts more than one arity of plain, inexact {@code invoke} calls
+ * @see #asVarargsCollector
+ * @see #asFixedArity
+ */
+ // Android-changed, TODO(narayan): Replace @code with @linkplain once MethodHandles
+ // is ready for use.
+ public boolean isVarargsCollector() {
+ return false;
+ }
+
+ /**
+ * Makes a <em>fixed arity</em> method handle which is otherwise
+ * equivalent to the current method handle.
+ * <p>
+ * If the current method handle is not of
+ * {@linkplain #asVarargsCollector variable arity},
+ * the current method handle is returned.
+ * This is true even if the current method handle
+ * could not be a valid input to {@code asVarargsCollector}.
+ * <p>
+ * Otherwise, the resulting fixed-arity method handle has the same
+ * type and behavior of the current method handle,
+ * except that {@link #isVarargsCollector isVarargsCollector}
+ * will be false.
+ * The fixed-arity method handle may (or may not) be the
+ * a previous argument to {@code asVarargsCollector}.
+ * <p>
+ * Here is an example, of a list-making variable arity method handle:
+ * <blockquote><pre>{@code
+MethodHandle asListVar = publicLookup()
+ .findStatic(Arrays.class, "asList", methodType(List.class, Object[].class))
+ .asVarargsCollector(Object[].class);
+MethodHandle asListFix = asListVar.asFixedArity();
+assertEquals("[1]", asListVar.invoke(1).toString());
+Exception caught = null;
+try { asListFix.invoke((Object)1); }
+catch (Exception ex) { caught = ex; }
+assert(caught instanceof ClassCastException);
+assertEquals("[two, too]", asListVar.invoke("two", "too").toString());
+try { asListFix.invoke("two", "too"); }
+catch (Exception ex) { caught = ex; }
+assert(caught instanceof WrongMethodTypeException);
+Object[] argv = { "three", "thee", "tee" };
+assertEquals("[three, thee, tee]", asListVar.invoke(argv).toString());
+assertEquals("[three, thee, tee]", asListFix.invoke(argv).toString());
+assertEquals(1, ((List) asListVar.invoke((Object)argv)).size());
+assertEquals("[three, thee, tee]", asListFix.invoke((Object)argv).toString());
+ * }</pre></blockquote>
+ *
+ * @return a new method handle which accepts only a fixed number of arguments
+ * @see #asVarargsCollector
+ * @see #isVarargsCollector
+ */
+ public MethodHandle asFixedArity() {
+ assert(!isVarargsCollector());
+ return this;
+ }
+
+ /**
+ * Binds a value {@code x} to the first argument of a method handle, without invoking it.
+ * The new method handle adapts, as its <i>target</i>,
+ * the current method handle by binding it to the given argument.
+ * The type of the bound handle will be
+ * the same as the type of the target, except that a single leading
+ * reference parameter will be omitted.
+ * <p>
+ * When called, the bound handle inserts the given value {@code x}
+ * as a new leading argument to the target. The other arguments are
+ * also passed unchanged.
+ * What the target eventually returns is returned unchanged by the bound handle.
+ * <p>
+ * The reference {@code x} must be convertible to the first parameter
+ * type of the target.
+ * <p>
+ * (<em>Note:</em> Because method handles are immutable, the target method handle
+ * retains its original type and behavior.)
+ * @param x the value to bind to the first argument of the target
+ * @return a new method handle which prepends the given value to the incoming
+ * argument list, before calling the original method handle
+ * @throws IllegalArgumentException if the target does not have a
+ * leading parameter type that is a reference type
+ * @throws ClassCastException if {@code x} cannot be converted
+ * to the leading parameter type of the target
+ */
+ // @see MethodHandles#insertArguments
+ // Android-changed, TODO(narayan): Bring back @see once the MethodHandles class is ready for use.
+ public MethodHandle bindTo(Object x) {
+ x = type.leadingReferenceParameter().cast(x); // throw CCE if needed
+
+ // Android-changed, TODO(narayan): Not implemented yet.
+ throw new UnsupportedOperationException("bindTo(Object)");
+ }
+
+ /**
+ * Returns a string representation of the method handle,
+ * starting with the string {@code "MethodHandle"} and
+ * ending with the string representation of the method handle's type.
+ * In other words, this method returns a string equal to the value of:
+ * <blockquote><pre>{@code
+ * "MethodHandle" + type().toString()
+ * }</pre></blockquote>
+ * <p>
+ * (<em>Note:</em> Future releases of this API may add further information
+ * to the string representation.
+ * Therefore, the present syntax should not be parsed by applications.)
+ *
+ * @return a string representation of the method handle
+ */
+ @Override
+ public String toString() {
+ // Android-changed: Removed debugging support.
+ return "MethodHandle"+type;
+ }
+
+ // Android-changed: Removed implementation details :
+ //
+ // String standardString();
+ // String debugString();
+ //
+ //// Implementation methods.
+ //// Sub-classes can override these default implementations.
+ //// All these methods assume arguments are already validated.
+ //
+ // Other transforms to do: convert, explicitCast, permute, drop, filter, fold, GWT, catch
+ //
+ // BoundMethodHandle bindArgumentL(int pos, Object value);
+ // /*non-public*/ MethodHandle setVarargs(MemberName member);
+ // /*non-public*/ MethodHandle viewAsType(MethodType newType, boolean strict);
+ // /*non-public*/ boolean viewAsTypeChecks(MethodType newType, boolean strict);
+ //
+ // Decoding
+ //
+ // /*non-public*/ LambdaForm internalForm();
+ // /*non-public*/ MemberName internalMemberName();
+ // /*non-public*/ Class<?> internalCallerClass();
+ // /*non-public*/ MethodHandleImpl.Intrinsic intrinsicName();
+ // /*non-public*/ MethodHandle withInternalMemberName(MemberName member, boolean isInvokeSpecial);
+ // /*non-public*/ boolean isInvokeSpecial();
+ // /*non-public*/ Object internalValues();
+ // /*non-public*/ Object internalProperties();
+ //
+ //// Method handle implementation methods.
+ //// Sub-classes can override these default implementations.
+ //// All these methods assume arguments are already validated.
+ //
+ // /*non-public*/ abstract MethodHandle copyWith(MethodType mt, LambdaForm lf);
+ // abstract BoundMethodHandle rebind();
+ // /*non-public*/ void updateForm(LambdaForm newForm);
+ // /*non-public*/ void customize();
+ // private static final long FORM_OFFSET;
+}
diff --git a/ojluni/src/main/java/java/lang/invoke/MethodType.java b/ojluni/src/main/java/java/lang/invoke/MethodType.java
index 3cafe89..38c781f 100644
--- a/ojluni/src/main/java/java/lang/invoke/MethodType.java
+++ b/ojluni/src/main/java/java/lang/invoke/MethodType.java
@@ -44,8 +44,8 @@
* and expected by a method handle caller. Method types must be properly
* matched between a method handle and all its callers,
* and the JVM's operations enforce this matching at, specifically
- * during calls to {@code MethodHandle#invokeExact MethodHandle.invokeExact}
- * and {@code MethodHandle#invoke MethodHandle.invoke}, and during execution
+ * during calls to {@link MethodHandle#invokeExact MethodHandle.invokeExact}
+ * and {@link MethodHandle#invoke MethodHandle.invoke}, and during execution
* of {@code invokedynamic} instructions.
* <p>
* The structure is a return type accompanied by any number of parameter types.
@@ -86,7 +86,6 @@
* This loading may occur at any time before the {@code MethodType} object is first derived.
* @author John Rose, JSR 292 EG
*/
-// Android-changed, TODO(narayan): Temporarily changed links to MethodHandle API to @code.
public final
class MethodType implements java.io.Serializable {
private static final long serialVersionUID = 292L; // {rtype, {ptype...}}
@@ -622,10 +621,9 @@
/**
* Erases all reference types to {@code Object}, and all subword types to {@code int}.
* This is the reduced type polymorphism used by private methods
- * such as {@code MethodHandle#invokeBasic invokeBasic}.
+ * such as {@link MethodHandle#invokeBasic invokeBasic}.
* @return a version of the original type with all reference and subword types replaced
*/
- // Android-changed, TODO(narayan): Temporarily changed links to MethodHandle API to @code.
/*non-public*/ MethodType basicType() {
return form.basicType();
}
@@ -634,10 +632,7 @@
* @return a version of the original type with MethodHandle prepended as the first argument
*/
/*non-public*/ MethodType invokerType() {
- // Android-changed, TODO(narayan): Temporarily disabled until MethodHandle.class is
- // available.
- // return insertParameterTypes(0, MethodHandle.class);
- throw new UnsupportedOperationException();
+ return insertParameterTypes(0, MethodHandle.class);
}
/**
diff --git a/ojluni/src/main/java/java/nio/channels/spi/package.html b/ojluni/src/main/java/java/nio/channels/spi/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/java/nio/charset/spi/package.html b/ojluni/src/main/java/java/nio/charset/spi/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/java/security/AccessControlException.java b/ojluni/src/main/java/java/security/AccessControlException.java
index baab01b..a4f2a78 100644
--- a/ojluni/src/main/java/java/security/AccessControlException.java
+++ b/ojluni/src/main/java/java/security/AccessControlException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -44,11 +44,11 @@
private static final long serialVersionUID = 5138225684096988535L;
- // the permission that caused the exeception to be thrown.
+ // the permission that caused the exception to be thrown.
private Permission perm;
/**
- * Constructs an <code>AccessControlException</code> with the
+ * Constructs an {@code AccessControlException} with the
* specified, detailed message.
*
* @param s the detail message.
@@ -58,7 +58,7 @@
}
/**
- * Constructs an <code>AccessControlException</code> with the
+ * Constructs an {@code AccessControlException} with the
* specified, detailed message, and the requested permission that caused
* the exception.
*
@@ -71,7 +71,7 @@
}
/**
- * Gets the Permission object associated with this exeception, or
+ * Gets the Permission object associated with this exception, or
* null if there was no corresponding Permission object.
*
* @return the Permission object.
diff --git a/ojluni/src/main/java/java/security/AlgorithmParameterGenerator.java b/ojluni/src/main/java/java/security/AlgorithmParameterGenerator.java
index 9e0bc55..5224158 100644
--- a/ojluni/src/main/java/java/security/AlgorithmParameterGenerator.java
+++ b/ojluni/src/main/java/java/security/AlgorithmParameterGenerator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,10 +28,10 @@
import java.security.spec.AlgorithmParameterSpec;
/**
- * The <code>AlgorithmParameterGenerator</code> class is used to generate a
+ * The {@code AlgorithmParameterGenerator} class is used to generate a
* set of
* parameters to be used with a certain algorithm. Parameter generators
- * are constructed using the <code>getInstance</code> factory methods
+ * are constructed using the {@code getInstance} factory methods
* (static methods that return instances of a given class).
*
* <P>The object that will generate the parameters can be initialized
@@ -48,7 +48,7 @@
* of the prime modulus (in bits).
* When using this approach, algorithm-specific parameter generation
* values - if any - default to some standard values, unless they can be
- * derived from the specified size.<P>
+ * derived from the specified size.
*
* <li>The other approach initializes a parameter generator object
* using algorithm-specific semantics, which are represented by a set of
@@ -61,7 +61,7 @@
*
* <P>In case the client does not explicitly initialize the
* AlgorithmParameterGenerator
- * (via a call to an <code>init</code> method), each provider must supply (and
+ * (via a call to an {@code init} method), each provider must supply (and
* document) a default initialization. For example, the Sun provider uses a
* default modulus prime size of 1024 bits for the generation of DSA
* parameters.
@@ -295,11 +295,11 @@
/**
* Initializes this parameter generator for a certain size.
- * To create the parameters, the <code>SecureRandom</code>
+ * To create the parameters, the {@code SecureRandom}
* implementation of the highest-priority installed provider is used as
* the source of randomness.
* (If none of the installed providers supply an implementation of
- * <code>SecureRandom</code>, a system-provided source of randomness is
+ * {@code SecureRandom}, a system-provided source of randomness is
* used.)
*
* @param size the size (number of bits).
@@ -322,11 +322,11 @@
/**
* Initializes this parameter generator with a set of algorithm-specific
* parameter generation values.
- * To generate the parameters, the <code>SecureRandom</code>
+ * To generate the parameters, the {@code SecureRandom}
* implementation of the highest-priority installed provider is used as
* the source of randomness.
* (If none of the installed providers supply an implementation of
- * <code>SecureRandom</code>, a system-provided source of randomness is
+ * {@code SecureRandom}, a system-provided source of randomness is
* used.)
*
* @param genParamSpec the set of algorithm-specific parameter generation values.
diff --git a/ojluni/src/main/java/java/security/AlgorithmParameterGeneratorSpi.java b/ojluni/src/main/java/java/security/AlgorithmParameterGeneratorSpi.java
index 729470a..721fb52 100644
--- a/ojluni/src/main/java/java/security/AlgorithmParameterGeneratorSpi.java
+++ b/ojluni/src/main/java/java/security/AlgorithmParameterGeneratorSpi.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>AlgorithmParameterGenerator</code> class, which
+ * for the {@code AlgorithmParameterGenerator} class, which
* is used to generate a set of parameters to be used with a certain algorithm.
*
* <p> All the abstract methods in this class must be implemented by each
@@ -37,7 +37,7 @@
* of a parameter generator for a particular algorithm.
*
* <p> In case the client does not explicitly initialize the
- * AlgorithmParameterGenerator (via a call to an <code>engineInit</code>
+ * AlgorithmParameterGenerator (via a call to an {@code engineInit}
* method), each provider must supply (and document) a default initialization.
* For example, the Sun provider uses a default modulus prime size of 1024
* bits for the generation of DSA parameters.
diff --git a/ojluni/src/main/java/java/security/AlgorithmParameters.java b/ojluni/src/main/java/java/security/AlgorithmParameters.java
index a090ece..af5ed7e 100644
--- a/ojluni/src/main/java/java/security/AlgorithmParameters.java
+++ b/ojluni/src/main/java/java/security/AlgorithmParameters.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,19 +32,19 @@
/**
* This class is used as an opaque representation of cryptographic parameters.
*
- * <p>An <code>AlgorithmParameters</code> object for managing the parameters
+ * <p>An {@code AlgorithmParameters} object for managing the parameters
* for a particular algorithm can be obtained by
- * calling one of the <code>getInstance</code> factory methods
+ * calling one of the {@code getInstance} factory methods
* (static methods that return instances of a given class).
*
- * <p>Once an <code>AlgorithmParameters</code> object is obtained, it must be
- * initialized via a call to <code>init</code>, using an appropriate parameter
+ * <p>Once an {@code AlgorithmParameters} object is obtained, it must be
+ * initialized via a call to {@code init}, using an appropriate parameter
* specification or parameter encoding.
*
* <p>A transparent parameter specification is obtained from an
- * <code>AlgorithmParameters</code> object via a call to
- * <code>getParameterSpec</code>, and a byte encoding of the parameters is
- * obtained via a call to <code>getEncoded</code>.
+ * {@code AlgorithmParameters} object via a call to
+ * {@code getParameterSpec}, and a byte encoding of the parameters is
+ * obtained via a call to {@code getEncoded}.
*
* <p> Android provides the following <code>AlgorithmParameters</code> algorithms:
* <table>
@@ -168,7 +168,7 @@
* the {@link Security#getProviders() Security.getProviders()} method.
*
* <p> The returned parameter object must be initialized via a call to
- * <code>init</code>, using an appropriate parameter specification or
+ * {@code init}, using an appropriate parameter specification or
* parameter encoding.
*
* @param algorithm the name of the algorithm requested.
@@ -210,7 +210,7 @@
* the {@link Security#getProviders() Security.getProviders()} method.
*
* <p>The returned parameter object must be initialized via a call to
- * <code>init</code>, using an appropriate parameter specification or
+ * {@code init}, using an appropriate parameter specification or
* parameter encoding.
*
* @param algorithm the name of the algorithm requested.
@@ -257,7 +257,7 @@
* does not have to be registered in the provider list.
*
* <p>The returned parameter object must be initialized via a call to
- * <code>init</code>, using an appropriate parameter specification or
+ * {@code init}, using an appropriate parameter specification or
* parameter encoding.
*
* @param algorithm the name of the algorithm requested.
@@ -304,7 +304,7 @@
/**
* Initializes this parameter object using the parameters
- * specified in <code>paramSpec</code>.
+ * specified in {@code paramSpec}.
*
* @param paramSpec the parameter specification.
*
@@ -340,9 +340,9 @@
}
/**
- * Imports the parameters from <code>params</code> and decodes them
+ * Imports the parameters from {@code params} and decodes them
* according to the specified decoding scheme.
- * If <code>format</code> is null, the
+ * If {@code format} is null, the
* primary decoding format for parameters is used. The primary decoding
* format is ASN.1, if an ASN.1 specification for these parameters
* exists.
@@ -363,12 +363,13 @@
/**
* Returns a (transparent) specification of this parameter object.
- * <code>paramSpec</code> identifies the specification class in which
+ * {@code paramSpec} identifies the specification class in which
* the parameters should be returned. It could, for example, be
- * <code>DSAParameterSpec.class</code>, to indicate that the
+ * {@code DSAParameterSpec.class}, to indicate that the
* parameters should be returned in an instance of the
- * <code>DSAParameterSpec</code> class.
+ * {@code DSAParameterSpec} class.
*
+ * @param <T> the type of the parameter specification to be returrned
* @param paramSpec the specification class in which
* the parameters should be returned.
*
@@ -408,7 +409,7 @@
/**
* Returns the parameters encoded in the specified scheme.
- * If <code>format</code> is null, the
+ * If {@code format} is null, the
* primary encoding format for parameters is used. The primary encoding
* format is ASN.1, if an ASN.1 specification for these parameters
* exists.
diff --git a/ojluni/src/main/java/java/security/AlgorithmParametersSpi.java b/ojluni/src/main/java/java/security/AlgorithmParametersSpi.java
index 17db77e..282493b 100644
--- a/ojluni/src/main/java/java/security/AlgorithmParametersSpi.java
+++ b/ojluni/src/main/java/java/security/AlgorithmParametersSpi.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>AlgorithmParameters</code> class, which is used to manage
+ * for the {@code AlgorithmParameters} class, which is used to manage
* algorithm parameters.
*
* <p> All the abstract methods in this class must be implemented by each
@@ -52,7 +52,7 @@
/**
* Initializes this parameters object using the parameters
- * specified in <code>paramSpec</code>.
+ * specified in {@code paramSpec}.
*
* @param paramSpec the parameter specification.
*
@@ -77,9 +77,9 @@
throws IOException;
/**
- * Imports the parameters from <code>params</code> and
+ * Imports the parameters from {@code params} and
* decodes them according to the specified decoding format.
- * If <code>format</code> is null, the
+ * If {@code format} is null, the
* primary decoding format for parameters is used. The primary decoding
* format is ASN.1, if an ASN.1 specification for these parameters
* exists.
@@ -96,11 +96,13 @@
/**
* Returns a (transparent) specification of this parameters
* object.
- * <code>paramSpec</code> identifies the specification class in which
+ * {@code paramSpec} identifies the specification class in which
* the parameters should be returned. It could, for example, be
- * <code>DSAParameterSpec.class</code>, to indicate that the
+ * {@code DSAParameterSpec.class}, to indicate that the
* parameters should be returned in an instance of the
- * <code>DSAParameterSpec</code> class.
+ * {@code DSAParameterSpec} class.
+ *
+ * @param <T> the type of the parameter specification to be returned
*
* @param paramSpec the specification class in which
* the parameters should be returned.
@@ -128,7 +130,7 @@
/**
* Returns the parameters encoded in the specified format.
- * If <code>format</code> is null, the
+ * If {@code format} is null, the
* primary encoding format for parameters is used. The primary encoding
* format is ASN.1, if an ASN.1 specification for these parameters
* exists.
diff --git a/ojluni/src/main/java/java/security/Certificate.java b/ojluni/src/main/java/java/security/Certificate.java
index 000a5e0..489c6d6 100644
--- a/ojluni/src/main/java/java/security/Certificate.java
+++ b/ojluni/src/main/java/java/security/Certificate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -96,7 +96,7 @@
/**
* Encodes the certificate to an output stream in a format that can
- * be decoded by the <code>decode</code> method.
+ * be decoded by the {@code decode} method.
*
* @param stream the output stream to which to encode the
* certificate.
@@ -115,8 +115,8 @@
/**
* Decodes a certificate from an input stream. The format should be
- * that returned by <code>getFormat</code> and produced by
- * <code>encode</code>.
+ * that returned by {@code getFormat} and produced by
+ * {@code encode}.
*
* @param stream the input stream from which to fetch the data
* being decoded.
@@ -137,8 +137,8 @@
/**
* Returns the name of the coding format. This is used as a hint to find
* an appropriate parser. It could be "X.509", "PGP", etc. This is
- * the format produced and understood by the <code>encode</code>
- * and <code>decode</code> methods.
+ * the format produced and understood by the {@code encode}
+ * and {@code decode} methods.
*
* @return the name of the coding format.
*/
diff --git a/ojluni/src/main/java/java/security/CodeSigner.java b/ojluni/src/main/java/java/security/CodeSigner.java
index 0b233d3..37c12b1 100644
--- a/ojluni/src/main/java/java/security/CodeSigner.java
+++ b/ojluni/src/main/java/java/security/CodeSigner.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -63,12 +63,12 @@
* Constructs a CodeSigner object.
*
* @param signerCertPath The signer's certificate path.
- * It must not be <code>null</code>.
+ * It must not be {@code null}.
* @param timestamp A signature timestamp.
- * If <code>null</code> then no timestamp was generated
+ * If {@code null} then no timestamp was generated
* for the signature.
- * @throws NullPointerException if <code>signerCertPath</code> is
- * <code>null</code>.
+ * @throws NullPointerException if {@code signerCertPath} is
+ * {@code null}.
*/
public CodeSigner(CertPath signerCertPath, Timestamp timestamp) {
if (signerCertPath == null) {
@@ -90,7 +90,7 @@
/**
* Returns the signature timestamp.
*
- * @return The timestamp or <code>null</code> if none is present.
+ * @return The timestamp or {@code null} if none is present.
*/
public Timestamp getTimestamp() {
return timestamp;
diff --git a/ojluni/src/main/java/java/security/DigestException.java b/ojluni/src/main/java/java/security/DigestException.java
index 9d44750..2327c98 100644
--- a/ojluni/src/main/java/java/security/DigestException.java
+++ b/ojluni/src/main/java/java/security/DigestException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -55,13 +55,13 @@
}
/**
- * Creates a <code>DigestException</code> with the specified
+ * Creates a {@code DigestException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -70,13 +70,13 @@
}
/**
- * Creates a <code>DigestException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code DigestException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
diff --git a/ojluni/src/main/java/java/security/DigestInputStream.java b/ojluni/src/main/java/java/security/DigestInputStream.java
index 8aa16dc..a1bf55a 100644
--- a/ojluni/src/main/java/java/security/DigestInputStream.java
+++ b/ojluni/src/main/java/java/security/DigestInputStream.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,13 +37,13 @@
* the bits going through the stream.
*
* <p>To complete the message digest computation, call one of the
- * <code>digest</code> methods on the associated message
+ * {@code digest} methods on the associated message
* digest after your calls to one of this digest input stream's
* {@link #read() read} methods.
*
* <p>It is possible to turn this stream on or off (see
* {@link #on(boolean) on}). When it is on, a call to one of the
- * <code>read</code> methods
+ * {@code read} methods
* results in an update on the message digest. But when it is off,
* the message digest is not updated. The default is for the stream
* to be on.
@@ -111,7 +111,7 @@
* function is on). That is, this method reads a byte from the
* input stream, blocking until the byte is actually read. If the
* digest function is on (see {@link #on(boolean) on}), this method
- * will then call <code>update</code> on the message digest associated
+ * will then call {@code update} on the message digest associated
* with this stream, passing it the byte read.
*
* @return the byte read.
@@ -131,25 +131,25 @@
/**
* Reads into a byte array, and updates the message digest (if the
* digest function is on). That is, this method reads up to
- * <code>len</code> bytes from the input stream into the array
- * <code>b</code>, starting at offset <code>off</code>. This method
+ * {@code len} bytes from the input stream into the array
+ * {@code b}, starting at offset {@code off}. This method
* blocks until the data is actually
* read. If the digest function is on (see
- * {@link #on(boolean) on}), this method will then call <code>update</code>
+ * {@link #on(boolean) on}), this method will then call {@code update}
* on the message digest associated with this stream, passing it
* the data.
*
* @param b the array into which the data is read.
*
- * @param off the starting offset into <code>b</code> of where the
+ * @param off the starting offset into {@code b} of where the
* data should be placed.
*
* @param len the maximum number of bytes to be read from the input
- * stream into b, starting at offset <code>off</code>.
+ * stream into b, starting at offset {@code off}.
*
* @return the actual number of bytes read. This is less than
- * <code>len</code> if the end of the stream is reached prior to
- * reading <code>len</code> bytes. -1 is returned if no bytes were
+ * {@code len} if the end of the stream is reached prior to
+ * reading {@code len} bytes. -1 is returned if no bytes were
* read because the end of the stream had already been reached when
* the call was made.
*
@@ -167,7 +167,7 @@
/**
* Turns the digest function on or off. The default is on. When
- * it is on, a call to one of the <code>read</code> methods results in an
+ * it is on, a call to one of the {@code read} methods results in an
* update on the message digest. But when it is off, the message
* digest is not updated.
*
diff --git a/ojluni/src/main/java/java/security/GeneralSecurityException.java b/ojluni/src/main/java/java/security/GeneralSecurityException.java
index 60b5688..dc9ea06 100644
--- a/ojluni/src/main/java/java/security/GeneralSecurityException.java
+++ b/ojluni/src/main/java/java/security/GeneralSecurityException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
package java.security;
/**
- * The <code>GeneralSecurityException</code> class is a generic
+ * The {@code GeneralSecurityException} class is a generic
* security exception class that provides type safety for all the
* security-related exception classes that extend from it.
*
@@ -57,13 +57,13 @@
}
/**
- * Creates a <code>GeneralSecurityException</code> with the specified
+ * Creates a {@code GeneralSecurityException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -72,13 +72,13 @@
}
/**
- * Creates a <code>GeneralSecurityException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code GeneralSecurityException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
diff --git a/ojluni/src/main/java/java/security/Guard.java b/ojluni/src/main/java/java/security/Guard.java
index 7cfd25b..abafb58 100644
--- a/ojluni/src/main/java/java/security/Guard.java
+++ b/ojluni/src/main/java/java/security/Guard.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,9 +29,9 @@
* <p> This interface represents a guard, which is an object that is used
* to protect access to another object.
*
- * <p>This interface contains a single method, <code>checkGuard</code>,
- * with a single <code>object</code> argument. <code>checkGuard</code> is
- * invoked (by the GuardedObject <code>getObject</code> method)
+ * <p>This interface contains a single method, {@code checkGuard},
+ * with a single {@code object} argument. {@code checkGuard} is
+ * invoked (by the GuardedObject {@code getObject} method)
* to determine whether or not to allow access to the object.
*
* @see GuardedObject
@@ -44,7 +44,7 @@
/**
* Determines whether or not to allow access to the guarded object
- * <code>object</code>. Returns silently if access is allowed.
+ * {@code object}. Returns silently if access is allowed.
* Otherwise, throws a SecurityException.
*
* @param object the object being protected by the guard.
diff --git a/ojluni/src/main/java/java/security/GuardedObject.java b/ojluni/src/main/java/java/security/GuardedObject.java
index c4edb23..a275ddf 100644
--- a/ojluni/src/main/java/java/security/GuardedObject.java
+++ b/ojluni/src/main/java/java/security/GuardedObject.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,9 +33,9 @@
* such that access to the target object is possible
* only if the Guard object allows it.
* Once an object is encapsulated by a GuardedObject,
- * access to that object is controlled by the <code>getObject</code>
+ * access to that object is controlled by the {@code getObject}
* method, which invokes the
- * <code>checkGuard</code> method on the Guard object that is
+ * {@code checkGuard} method on the Guard object that is
* guarding access. If access is not allowed,
* an exception is thrown.
*
diff --git a/ojluni/src/main/java/java/security/Identity.java b/ojluni/src/main/java/java/security/Identity.java
index 06446b8..e63131e 100644
--- a/ojluni/src/main/java/java/security/Identity.java
+++ b/ojluni/src/main/java/java/security/Identity.java
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -53,9 +53,9 @@
*
* @author Benjamin Renaud
* @deprecated This class is no longer used. Its functionality has been
- * replaced by <code>java.security.KeyStore</code>, the
- * <code>java.security.cert</code> package, and
- * <code>java.security.Principal</code>.
+ * replaced by {@code java.security.KeyStore}, the
+ * {@code java.security.cert} package, and
+ * {@code java.security.Principal}.
*/
@Deprecated
public abstract class Identity implements Principal, Serializable {
@@ -165,8 +165,8 @@
* Sets this identity's public key. The old key and all of this
* identity's certificates are removed by this operation.
*
- * <p>First, if there is a security manager, its <code>checkSecurityAccess</code>
- * method is called with <code>"setIdentityPublicKey"</code>
+ * <p>First, if there is a security manager, its {@code checkSecurityAccess}
+ * method is called with {@code "setIdentityPublicKey"}
* as its argument to see if it's ok to set the public key.
*
* @param key the public key for this identity.
@@ -175,7 +175,7 @@
* identity's scope has the same public key, or if another exception occurs.
*
* @exception SecurityException if a security manager exists and its
- * <code>checkSecurityAccess</code> method doesn't allow
+ * {@code checkSecurityAccess} method doesn't allow
* setting the public key.
*
* @see #getPublicKey
@@ -192,14 +192,14 @@
/**
* Specifies a general information string for this identity.
*
- * <p>First, if there is a security manager, its <code>checkSecurityAccess</code>
- * method is called with <code>"setIdentityInfo"</code>
+ * <p>First, if there is a security manager, its {@code checkSecurityAccess}
+ * method is called with {@code "setIdentityInfo"}
* as its argument to see if it's ok to specify the information string.
*
* @param info the information string.
*
* @exception SecurityException if a security manager exists and its
- * <code>checkSecurityAccess</code> method doesn't allow
+ * {@code checkSecurityAccess} method doesn't allow
* setting the information string.
*
* @see #getInfo
@@ -227,8 +227,8 @@
* the identity does not have a public key, the identity's
* public key is set to be that specified in the certificate.
*
- * <p>First, if there is a security manager, its <code>checkSecurityAccess</code>
- * method is called with <code>"addIdentityCertificate"</code>
+ * <p>First, if there is a security manager, its {@code checkSecurityAccess}
+ * method is called with {@code "addIdentityCertificate"}
* as its argument to see if it's ok to add a certificate.
*
* @param certificate the certificate to be added.
@@ -238,7 +238,7 @@
* this identity's public key, or if another exception occurs.
*
* @exception SecurityException if a security manager exists and its
- * <code>checkSecurityAccess</code> method doesn't allow
+ * {@code checkSecurityAccess} method doesn't allow
* adding a certificate.
*
* @see SecurityManager#checkSecurityAccess
@@ -262,7 +262,7 @@
certificates.addElement(certificate);
}
- private boolean keyEquals(Key aKey, Key anotherKey) {
+ private boolean keyEquals(PublicKey aKey, PublicKey anotherKey) {
String aKeyFormat = aKey.getFormat();
String anotherKeyFormat = anotherKey.getFormat();
if ((aKeyFormat == null) ^ (anotherKeyFormat == null))
@@ -278,8 +278,8 @@
/**
* Removes a certificate from this identity.
*
- * <p>First, if there is a security manager, its <code>checkSecurityAccess</code>
- * method is called with <code>"removeIdentityCertificate"</code>
+ * <p>First, if there is a security manager, its {@code checkSecurityAccess}
+ * method is called with {@code "removeIdentityCertificate"}
* as its argument to see if it's ok to remove a certificate.
*
* @param certificate the certificate to be removed.
@@ -288,7 +288,7 @@
* missing, or if another exception occurs.
*
* @exception SecurityException if a security manager exists and its
- * <code>checkSecurityAccess</code> method doesn't allow
+ * {@code checkSecurityAccess} method doesn't allow
* removing a certificate.
*
* @see SecurityManager#checkSecurityAccess
@@ -396,15 +396,15 @@
* Returns a short string describing this identity, telling its
* name and its scope (if any).
*
- * <p>First, if there is a security manager, its <code>checkSecurityAccess</code>
- * method is called with <code>"printIdentity"</code>
+ * <p>First, if there is a security manager, its {@code checkSecurityAccess}
+ * method is called with {@code "printIdentity"}
* as its argument to see if it's ok to return the string.
*
* @return information about this identity, such as its name and the
* name of its scope (if any).
*
* @exception SecurityException if a security manager exists and its
- * <code>checkSecurityAccess</code> method doesn't allow
+ * {@code checkSecurityAccess} method doesn't allow
* returning a string describing this identity.
*
* @see SecurityManager#checkSecurityAccess
@@ -421,20 +421,20 @@
/**
* Returns a string representation of this identity, with
* optionally more details than that provided by the
- * <code>toString</code> method without any arguments.
+ * {@code toString} method without any arguments.
*
- * <p>First, if there is a security manager, its <code>checkSecurityAccess</code>
- * method is called with <code>"printIdentity"</code>
+ * <p>First, if there is a security manager, its {@code checkSecurityAccess}
+ * method is called with {@code "printIdentity"}
* as its argument to see if it's ok to return the string.
*
* @param detailed whether or not to provide detailed information.
*
- * @return information about this identity. If <code>detailed</code>
+ * @return information about this identity. If {@code detailed}
* is true, then this method returns more information than that
- * provided by the <code>toString</code> method without any arguments.
+ * provided by the {@code toString} method without any arguments.
*
* @exception SecurityException if a security manager exists and its
- * <code>checkSecurityAccess</code> method doesn't allow
+ * {@code checkSecurityAccess} method doesn't allow
* returning a string describing this identity.
*
* @see #toString
diff --git a/ojluni/src/main/java/java/security/IdentityScope.java b/ojluni/src/main/java/java/security/IdentityScope.java
index b1789a8..65f4e98 100644
--- a/ojluni/src/main/java/java/security/IdentityScope.java
+++ b/ojluni/src/main/java/java/security/IdentityScope.java
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -58,9 +58,9 @@
* @author Benjamin Renaud
*
* @deprecated This class is no longer used. Its functionality has been
- * replaced by <code>java.security.KeyStore</code>, the
- * <code>java.security.cert</code> package, and
- * <code>java.security.Principal</code>.
+ * replaced by {@code java.security.KeyStore}, the
+ * {@code java.security.cert} package, and
+ * {@code java.security.Principal}.
*/
@Deprecated
public abstract
@@ -147,14 +147,14 @@
* Sets the system's identity scope.
*
* <p>First, if there is a security manager, its
- * <code>checkSecurityAccess</code>
- * method is called with <code>"setSystemScope"</code>
+ * {@code checkSecurityAccess}
+ * method is called with {@code "setSystemScope"}
* as its argument to see if it's ok to set the identity scope.
*
* @param scope the scope to set.
*
* @exception SecurityException if a security manager exists and its
- * <code>checkSecurityAccess</code> method doesn't allow
+ * {@code checkSecurityAccess} method doesn't allow
* setting the identity scope.
*
* @see #getSystemScope
@@ -177,8 +177,8 @@
*
* @param name the name of the identity to be retrieved.
*
- * @return the identity named <code>name</code>, or null if there are
- * no identities named <code>name</code> in this scope.
+ * @return the identity named {@code name}, or null if there are
+ * no identities named {@code name} in this scope.
*/
public abstract Identity getIdentity(String name);
diff --git a/ojluni/src/main/java/java/security/InvalidAlgorithmParameterException.java b/ojluni/src/main/java/java/security/InvalidAlgorithmParameterException.java
index b4f1a08..559a8be 100644
--- a/ojluni/src/main/java/java/security/InvalidAlgorithmParameterException.java
+++ b/ojluni/src/main/java/java/security/InvalidAlgorithmParameterException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -65,13 +65,13 @@
}
/**
- * Creates a <code>InvalidAlgorithmParameterException</code> with the
+ * Creates a {@code InvalidAlgorithmParameterException} with the
* specified detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -80,14 +80,14 @@
}
/**
- * Creates a <code>InvalidAlgorithmParameterException</code> with the
+ * Creates a {@code InvalidAlgorithmParameterException} with the
* specified cause and a detail message of
- * <tt>(cause==null ? null : cause.toString())</tt>
+ * {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
diff --git a/ojluni/src/main/java/java/security/InvalidKeyException.java b/ojluni/src/main/java/java/security/InvalidKeyException.java
index e9130f7..35fc64c 100644
--- a/ojluni/src/main/java/java/security/InvalidKeyException.java
+++ b/ojluni/src/main/java/java/security/InvalidKeyException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -58,13 +58,13 @@
}
/**
- * Creates a <code>InvalidKeyException</code> with the specified
+ * Creates a {@code InvalidKeyException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -73,13 +73,13 @@
}
/**
- * Creates a <code>InvalidKeyException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code InvalidKeyException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
diff --git a/ojluni/src/main/java/java/security/Key.java b/ojluni/src/main/java/java/security/Key.java
index e346b10..c8132f4 100644
--- a/ojluni/src/main/java/java/security/Key.java
+++ b/ojluni/src/main/java/java/security/Key.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
* RSA), which will work with those algorithms and with related
* algorithms (such as MD5 with RSA, SHA-1 with RSA, Raw DSA, etc.)
* The name of the algorithm of a key is obtained using the
- * {@link #getAlgorithm() getAlgorithm} method.<P>
+ * {@link #getAlgorithm() getAlgorithm} method.
*
* <LI>An Encoded Form
*
@@ -47,9 +47,9 @@
* representation of the key is needed outside the Java Virtual Machine,
* as when transmitting the key to some other party. The key
* is encoded according to a standard format (such as
- * X.509 <code>SubjectPublicKeyInfo</code> or PKCS#8), and
+ * X.509 {@code SubjectPublicKeyInfo} or PKCS#8), and
* is returned using the {@link #getEncoded() getEncoded} method.
- * Note: The syntax of the ASN.1 type <code>SubjectPublicKeyInfo</code>
+ * Note: The syntax of the ASN.1 type {@code SubjectPublicKeyInfo}
* is defined as follows:
*
* <pre>
@@ -65,12 +65,11 @@
* For more information, see
* <a href="http://www.ietf.org/rfc/rfc3280.txt">RFC 3280:
* Internet X.509 Public Key Infrastructure Certificate and CRL Profile</a>.
- * <P>
*
* <LI>A Format
*
* <P>This is the name of the format of the encoded key. It is returned
- * by the {@link #getFormat() getFormat} method.<P>
+ * by the {@link #getFormat() getFormat} method.
*
* </UL>
*
@@ -132,11 +131,11 @@
* For example, the name of the ASN.1 data format for public
* keys is <I>SubjectPublicKeyInfo</I>, as
* defined by the X.509 standard; in this case, the returned format is
- * <code>"X.509"</code>. Similarly,
+ * {@code "X.509"}. Similarly,
* the name of the ASN.1 data format for private keys is
* <I>PrivateKeyInfo</I>,
* as defined by the PKCS #8 standard; in this case, the returned format is
- * <code>"PKCS#8"</code>.
+ * {@code "PKCS#8"}.
*
* @return the primary encoding format of the key.
*/
diff --git a/ojluni/src/main/java/java/security/KeyException.java b/ojluni/src/main/java/java/security/KeyException.java
index cd79fcb..59cdd6f 100644
--- a/ojluni/src/main/java/java/security/KeyException.java
+++ b/ojluni/src/main/java/java/security/KeyException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -59,13 +59,13 @@
}
/**
- * Creates a <code>KeyException</code> with the specified
+ * Creates a {@code KeyException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -74,13 +74,13 @@
}
/**
- * Creates a <code>KeyException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code KeyException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
diff --git a/ojluni/src/main/java/java/security/KeyFactory.java b/ojluni/src/main/java/java/security/KeyFactory.java
index 865d553..92149ae 100644
--- a/ojluni/src/main/java/java/security/KeyFactory.java
+++ b/ojluni/src/main/java/java/security/KeyFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
/**
* Key factories are used to convert <I>keys</I> (opaque
- * cryptographic keys of type <code>Key</code>) into <I>key specifications</I>
+ * cryptographic keys of type {@code Key}) into <I>key specifications</I>
* (transparent representations of the underlying key material), and vice
* versa.
*
@@ -47,8 +47,8 @@
*
* <P> Multiple compatible key specifications may exist for the same key.
* For example, a DSA public key may be specified using
- * <code>DSAPublicKeySpec</code> or
- * <code>X509EncodedKeySpec</code>. A key factory can be used to translate
+ * {@code DSAPublicKeySpec} or
+ * {@code X509EncodedKeySpec}. A key factory can be used to translate
* between compatible key specifications.
*
* <P> The following is an example of how to use a key factory in order to
@@ -143,7 +143,7 @@
* @param keyFacSpi the delegate
* @param provider the provider
* @param algorithm the name of the algorithm
- * to associate with this <tt>KeyFactory</tt>
+ * to associate with this {@code KeyFactory}
*/
protected KeyFactory(KeyFactorySpi keyFacSpi, Provider provider,
String algorithm) {
@@ -289,10 +289,10 @@
/**
* Gets the name of the algorithm
- * associated with this <tt>KeyFactory</tt>.
+ * associated with this {@code KeyFactory}.
*
* @return the name of the algorithm associated with this
- * <tt>KeyFactory</tt>
+ * {@code KeyFactory}
*/
public final String getAlgorithm() {
return this.algorithm;
@@ -412,11 +412,13 @@
/**
* Returns a specification (key material) of the given key object.
- * <code>keySpec</code> identifies the specification class in which
+ * {@code keySpec} identifies the specification class in which
* the key material should be returned. It could, for example, be
- * <code>DSAPublicKeySpec.class</code>, to indicate that the
+ * {@code DSAPublicKeySpec.class}, to indicate that the
* key material should be returned in an instance of the
- * <code>DSAPublicKeySpec</code> class.
+ * {@code DSAPublicKeySpec} class.
+ *
+ * @param <T> the type of the key specification to be returned
*
* @param key the key.
*
diff --git a/ojluni/src/main/java/java/security/KeyFactorySpi.java b/ojluni/src/main/java/java/security/KeyFactorySpi.java
index f1f4d4a..5ee7f45 100644
--- a/ojluni/src/main/java/java/security/KeyFactorySpi.java
+++ b/ojluni/src/main/java/java/security/KeyFactorySpi.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,13 +30,13 @@
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>KeyFactory</code> class.
+ * for the {@code KeyFactory} class.
* All the abstract methods in this class must be implemented by each
* cryptographic service provider who wishes to supply the implementation
* of a key factory for a particular algorithm.
*
* <P> Key factories are used to convert <I>keys</I> (opaque
- * cryptographic keys of type <code>Key</code>) into <I>key specifications</I>
+ * cryptographic keys of type {@code Key}) into <I>key specifications</I>
* (transparent representations of the underlying key material), and vice
* versa.
*
@@ -46,8 +46,8 @@
*
* <P> Multiple compatible key specifications may exist for the same key.
* For example, a DSA public key may be specified using
- * <code>DSAPublicKeySpec</code> or
- * <code>X509EncodedKeySpec</code>. A key factory can be used to translate
+ * {@code DSAPublicKeySpec} or
+ * {@code X509EncodedKeySpec}. A key factory can be used to translate
* between compatible key specifications.
*
* <P> A provider should document all the key specifications supported by its
@@ -100,11 +100,13 @@
/**
* Returns a specification (key material) of the given key
* object.
- * <code>keySpec</code> identifies the specification class in which
+ * {@code keySpec} identifies the specification class in which
* the key material should be returned. It could, for example, be
- * <code>DSAPublicKeySpec.class</code>, to indicate that the
+ * {@code DSAPublicKeySpec.class}, to indicate that the
* key material should be returned in an instance of the
- * <code>DSAPublicKeySpec</code> class.
+ * {@code DSAPublicKeySpec} class.
+ *
+ * @param <T> the type of the key specification to be returned
*
* @param key the key.
*
diff --git a/ojluni/src/main/java/java/security/KeyManagementException.java b/ojluni/src/main/java/java/security/KeyManagementException.java
index 403e36a..be212b9 100644
--- a/ojluni/src/main/java/java/security/KeyManagementException.java
+++ b/ojluni/src/main/java/java/security/KeyManagementException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -68,13 +68,13 @@
}
/**
- * Creates a <code>KeyManagementException</code> with the specified
+ * Creates a {@code KeyManagementException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -83,13 +83,13 @@
}
/**
- * Creates a <code>KeyManagementException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code KeyManagementException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
diff --git a/ojluni/src/main/java/java/security/KeyPair.java b/ojluni/src/main/java/java/security/KeyPair.java
index 1681553..6147a16 100644
--- a/ojluni/src/main/java/java/security/KeyPair.java
+++ b/ojluni/src/main/java/java/security/KeyPair.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
*
* <p>Note that this constructor only stores references to the public
* and private key components in the generated key pair. This is safe,
- * because <code>Key</code> objects are immutable.
+ * because {@code Key} objects are immutable.
*
* @param publicKey the public key.
*
diff --git a/ojluni/src/main/java/java/security/KeyPairGenerator.java b/ojluni/src/main/java/java/security/KeyPairGenerator.java
index 9413d11..cbdaf3e 100644
--- a/ojluni/src/main/java/java/security/KeyPairGenerator.java
+++ b/ojluni/src/main/java/java/security/KeyPairGenerator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,10 +34,15 @@
import sun.security.jca.*;
import sun.security.jca.GetInstance.Instance;
+/*
+ANDROID-REMOVED: this debugging mechanism is not supported in Android.
+import sun.security.util.Debug;
+*/
+
/**
* The KeyPairGenerator class is used to generate pairs of
* public and private keys. Key pair generators are constructed using the
- * <code>getInstance</code> factory methods (static methods that
+ * {@code getInstance} factory methods (static methods that
* return instances of a given class).
*
* <p>A Key pair generator for a particular algorithm creates a public/private
@@ -58,50 +63,49 @@
* {@link #initialize(int, java.security.SecureRandom) initialize}
* method in this KeyPairGenerator class that takes these two universally
* shared types of arguments. There is also one that takes just a
- * <code>keysize</code> argument, and uses the <code>SecureRandom</code>
+ * {@code keysize} argument, and uses the {@code SecureRandom}
* implementation of the highest-priority installed provider as the source
* of randomness. (If none of the installed providers supply an implementation
- * of <code>SecureRandom</code>, a system-provided source of randomness is
+ * of {@code SecureRandom}, a system-provided source of randomness is
* used.)
*
* <p>Since no other parameters are specified when you call the above
- * algorithm-independent <code>initialize</code> methods, it is up to the
+ * algorithm-independent {@code initialize} methods, it is up to the
* provider what to do about the algorithm-specific parameters (if any) to be
* associated with each of the keys.
*
* <p>If the algorithm is the <i>DSA</i> algorithm, and the keysize (modulus
* size) is 512, 768, or 1024, then the <i>Sun</i> provider uses a set of
- * precomputed values for the <code>p</code>, <code>q</code>, and
- * <code>g</code> parameters. If the modulus size is not one of the above
+ * precomputed values for the {@code p}, {@code q}, and
+ * {@code g} parameters. If the modulus size is not one of the above
* values, the <i>Sun</i> provider creates a new set of parameters. Other
* providers might have precomputed parameter sets for more than just the
* three modulus sizes mentioned above. Still others might not have a list of
* precomputed parameters at all and instead always create new parameter sets.
- * <p>
*
* <li><b>Algorithm-Specific Initialization</b>
* <p>For situations where a set of algorithm-specific parameters already
* exists (e.g., so-called <i>community parameters</i> in DSA), there are two
* {@link #initialize(java.security.spec.AlgorithmParameterSpec)
- * initialize} methods that have an <code>AlgorithmParameterSpec</code>
- * argument. One also has a <code>SecureRandom</code> argument, while the
- * the other uses the <code>SecureRandom</code>
+ * initialize} methods that have an {@code AlgorithmParameterSpec}
+ * argument. One also has a {@code SecureRandom} argument, while the
+ * the other uses the {@code SecureRandom}
* implementation of the highest-priority installed provider as the source
* of randomness. (If none of the installed providers supply an implementation
- * of <code>SecureRandom</code>, a system-provided source of randomness is
+ * of {@code SecureRandom}, a system-provided source of randomness is
* used.)
* </ul>
*
* <p>In case the client does not explicitly initialize the KeyPairGenerator
- * (via a call to an <code>initialize</code> method), each provider must
+ * (via a call to an {@code initialize} method), each provider must
* supply (and document) a default initialization.
* For example, the <i>Sun</i> provider uses a default modulus size (keysize)
* of 1024 bits.
*
* <p>Note that this class is abstract and extends from
- * <code>KeyPairGeneratorSpi</code> for historical reasons.
+ * {@code KeyPairGeneratorSpi} for historical reasons.
* Application developers should only take notice of the methods defined in
- * this <code>KeyPairGenerator</code> class; all the methods in
+ * this {@code KeyPairGenerator} class; all the methods in
* the superclass are intended for cryptographic service providers who wish to
* supply their own implementations of key pair generators.
*
@@ -145,6 +149,14 @@
public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
+ /*
+ ANDROID-REMOVED: this debugging mechanism is not supported in Android.
+ private static final Debug pdebug =
+ Debug.getInstance("provider", "Provider");
+ private static final boolean skipDebug =
+ Debug.isOn("engine=") && !Debug.isOn("keypairgenerator");
+ */
+
private final String algorithm;
// The provider
@@ -186,6 +198,15 @@
kpg = new Delegate(spi, algorithm);
}
kpg.provider = instance.provider;
+
+ /*
+ ANDROID-REMOVED: this debugging mechanism is not supported in Android.
+ if (!skipDebug && pdebug != null) {
+ pdebug.println("KeyPairGenerator." + algorithm +
+ " algorithm from: " + kpg.provider.getName());
+ }
+ */
+
return kpg;
}
@@ -340,18 +361,18 @@
/**
* Initializes the key pair generator for a certain keysize using
- * a default parameter set and the <code>SecureRandom</code>
+ * a default parameter set and the {@code SecureRandom}
* implementation of the highest-priority installed provider as the source
* of randomness.
* (If none of the installed providers supply an implementation of
- * <code>SecureRandom</code>, a system-provided source of randomness is
+ * {@code SecureRandom}, a system-provided source of randomness is
* used.)
*
* @param keysize the keysize. This is an
* algorithm-specific metric, such as modulus length, specified in
* number of bits.
*
- * @exception InvalidParameterException if the <code>keysize</code> is not
+ * @exception InvalidParameterException if the {@code keysize} is not
* supported by this KeyPairGenerator object.
*/
public void initialize(int keysize) {
@@ -367,7 +388,7 @@
* number of bits.
* @param random the source of randomness.
*
- * @exception InvalidParameterException if the <code>keysize</code> is not
+ * @exception InvalidParameterException if the {@code keysize} is not
* supported by this KeyPairGenerator object.
*
* @since 1.2
@@ -387,11 +408,11 @@
/**
* Initializes the key pair generator using the specified parameter
- * set and the <code>SecureRandom</code>
+ * set and the {@code SecureRandom}
* implementation of the highest-priority installed provider as the source
* of randomness.
* (If none of the installed providers supply an implementation of
- * <code>SecureRandom</code>, a system-provided source of randomness is
+ * {@code SecureRandom}, a system-provided source of randomness is
* used.).
*
* <p>This concrete method has been added to this previously-defined
@@ -400,10 +421,10 @@
* {@link KeyPairGeneratorSpi#initialize(
* java.security.spec.AlgorithmParameterSpec,
* java.security.SecureRandom) initialize} method,
- * passing it <code>params</code> and a source of randomness (obtained
+ * passing it {@code params} and a source of randomness (obtained
* from the highest-priority installed provider or system-provided if none
* of the installed providers supply one).
- * That <code>initialize</code> method always throws an
+ * That {@code initialize} method always throws an
* UnsupportedOperationException if it is not overridden by the provider.
*
* @param params the parameter set used to generate the keys.
@@ -428,8 +449,8 @@
* KeyPairGeneratorSpi#initialize(
* java.security.spec.AlgorithmParameterSpec,
* java.security.SecureRandom) initialize} method,
- * passing it <code>params</code> and <code>random</code>.
- * That <code>initialize</code>
+ * passing it {@code params} and {@code random}.
+ * That {@code initialize}
* method always throws an
* UnsupportedOperationException if it is not overridden by the provider.
*
@@ -576,6 +597,14 @@
provider = instance.provider;
this.serviceIterator = serviceIterator;
initType = I_NONE;
+
+ /*
+ ANDROID-REMOVED: this debugging mechanism is not supported in Android.
+ if (!skipDebug && pdebug != null) {
+ pdebug.println("KeyPairGenerator." + algorithm +
+ " algorithm from: " + provider.getName());
+ }
+ */
}
/**
diff --git a/ojluni/src/main/java/java/security/KeyPairGeneratorSpi.java b/ojluni/src/main/java/java/security/KeyPairGeneratorSpi.java
index 28139ad..dfe8c04 100644
--- a/ojluni/src/main/java/java/security/KeyPairGeneratorSpi.java
+++ b/ojluni/src/main/java/java/security/KeyPairGeneratorSpi.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
/**
* <p> This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>KeyPairGenerator</code> class, which is used to generate
+ * for the {@code KeyPairGenerator} class, which is used to generate
* pairs of public and private keys.
*
* <p> All the abstract methods in this class must be implemented by each
@@ -37,7 +37,7 @@
* of a key pair generator for a particular algorithm.
*
* <p> In case the client does not explicitly initialize the KeyPairGenerator
- * (via a call to an <code>initialize</code> method), each provider must
+ * (via a call to an {@code initialize} method), each provider must
* supply (and document) a default initialization.
* For example, the <i>Sun</i> provider uses a default modulus size (keysize)
* of 1024 bits.
@@ -61,7 +61,7 @@
*
* @param random the source of randomness for this generator.
*
- * @exception InvalidParameterException if the <code>keysize</code> is not
+ * @exception InvalidParameterException if the {@code keysize} is not
* supported by this KeyPairGeneratorSpi object.
*/
public abstract void initialize(int keysize, SecureRandom random);
@@ -100,7 +100,7 @@
* will be used. This will generate a new key pair every time it
* is called.
*
- * @return the newly generated <tt>KeyPair</tt>
+ * @return the newly generated {@code KeyPair}
*/
public abstract KeyPair generateKeyPair();
}
diff --git a/ojluni/src/main/java/java/security/KeyRep.java b/ojluni/src/main/java/java/security/KeyRep.java
index 80a9b03..97a6c16 100644
--- a/ojluni/src/main/java/java/security/KeyRep.java
+++ b/ojluni/src/main/java/java/security/KeyRep.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
package java.security;
import java.io.*;
+import java.util.Locale;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
@@ -115,17 +116,17 @@
*
* @param type either one of Type.SECRET, Type.PUBLIC, or Type.PRIVATE
* @param algorithm the algorithm returned from
- * <code>Key.getAlgorithm()</code>
+ * {@code Key.getAlgorithm()}
* @param format the encoding format returned from
- * <code>Key.getFormat()</code>
+ * {@code Key.getFormat()}
* @param encoded the encoded bytes returned from
- * <code>Key.getEncoded()</code>
+ * {@code Key.getEncoded()}
*
* @exception NullPointerException
- * if type is <code>null</code>,
- * if algorithm is <code>null</code>,
- * if format is <code>null</code>,
- * or if encoded is <code>null</code>
+ * if type is {@code null},
+ * if algorithm is {@code null},
+ * if format is {@code null},
+ * or if encoded is {@code null}
*/
public KeyRep(Type type, String algorithm,
String format, byte[] encoded) {
@@ -137,7 +138,7 @@
this.type = type;
this.algorithm = algorithm;
- this.format = format.toUpperCase();
+ this.format = format.toUpperCase(Locale.ENGLISH);
this.encoded = encoded.clone();
}
diff --git a/ojluni/src/main/java/java/security/KeyStoreException.java b/ojluni/src/main/java/java/security/KeyStoreException.java
index 707a558..cf56d6a 100644
--- a/ojluni/src/main/java/java/security/KeyStoreException.java
+++ b/ojluni/src/main/java/java/security/KeyStoreException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -59,13 +59,13 @@
}
/**
- * Creates a <code>KeyStoreException</code> with the specified
+ * Creates a {@code KeyStoreException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -74,13 +74,13 @@
}
/**
- * Creates a <code>KeyStoreException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code KeyStoreException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
diff --git a/ojluni/src/main/java/java/security/KeyStoreSpi.java b/ojluni/src/main/java/java/security/KeyStoreSpi.java
index 4035782..4caa59c 100644
--- a/ojluni/src/main/java/java/security/KeyStoreSpi.java
+++ b/ojluni/src/main/java/java/security/KeyStoreSpi.java
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>KeyStore</code> class.
+ * for the {@code KeyStore} class.
* All the abstract methods in this class must be implemented by each
* cryptographic service provider who wishes to supply the implementation
* of a keystore for a particular keystore type.
@@ -56,9 +56,9 @@
/**
* Returns the key associated with the given alias, using the given
* password to recover it. The key must have been associated with
- * the alias by a call to <code>setKeyEntry</code>,
- * or by a call to <code>setEntry</code> with a
- * <code>PrivateKeyEntry</code> or <code>SecretKeyEntry</code>.
+ * the alias by a call to {@code setKeyEntry},
+ * or by a call to {@code setEntry} with a
+ * {@code PrivateKeyEntry} or {@code SecretKeyEntry}.
*
* @param alias the alias name
* @param password the password for recovering the key
@@ -77,9 +77,9 @@
/**
* Returns the certificate chain associated with the given alias.
* The certificate chain must have been associated with the alias
- * by a call to <code>setKeyEntry</code>,
- * or by a call to <code>setEntry</code> with a
- * <code>PrivateKeyEntry</code>.
+ * by a call to {@code setKeyEntry},
+ * or by a call to {@code setEntry} with a
+ * {@code PrivateKeyEntry}.
*
* @param alias the alias name
*
@@ -93,15 +93,15 @@
* Returns the certificate associated with the given alias.
*
* <p> If the given alias name identifies an entry
- * created by a call to <code>setCertificateEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>TrustedCertificateEntry</code>,
+ * created by a call to {@code setCertificateEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code TrustedCertificateEntry},
* then the trusted certificate contained in that entry is returned.
*
* <p> If the given alias name identifies an entry
- * created by a call to <code>setKeyEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>PrivateKeyEntry</code>,
+ * created by a call to {@code setKeyEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code PrivateKeyEntry},
* then the first element of the certificate chain in that entry
* (if a chain exists) is returned.
*
@@ -126,7 +126,7 @@
* Assigns the given key to the given alias, protecting it with the given
* password.
*
- * <p>If the given key is of type <code>java.security.PrivateKey</code>,
+ * <p>If the given key is of type {@code java.security.PrivateKey},
* it must be accompanied by a certificate chain certifying the
* corresponding public key.
*
@@ -139,7 +139,7 @@
* @param password the password to protect the key
* @param chain the certificate chain for the corresponding public
* key (only required if the given key is of type
- * <code>java.security.PrivateKey</code>).
+ * {@code java.security.PrivateKey}).
*
* @exception KeyStoreException if the given key cannot be protected, or
* this operation fails for some other reason
@@ -154,7 +154,7 @@
* alias.
*
* <p>If the protected key is of type
- * <code>java.security.PrivateKey</code>,
+ * {@code java.security.PrivateKey},
* it must be accompanied by a certificate chain certifying the
* corresponding public key.
*
@@ -166,7 +166,7 @@
* @param key the key (in protected format) to be associated with the alias
* @param chain the certificate chain for the corresponding public
* key (only useful if the protected key is of type
- * <code>java.security.PrivateKey</code>).
+ * {@code java.security.PrivateKey}).
*
* @exception KeyStoreException if this operation fails.
*/
@@ -178,9 +178,9 @@
* Assigns the given certificate to the given alias.
*
* <p> If the given alias identifies an existing entry
- * created by a call to <code>setCertificateEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>TrustedCertificateEntry</code>,
+ * created by a call to {@code setCertificateEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code TrustedCertificateEntry},
* the trusted certificate in the existing entry
* is overridden by the given certificate.
*
@@ -230,9 +230,9 @@
/**
* Returns true if the entry identified by the given alias
- * was created by a call to <code>setKeyEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>PrivateKeyEntry</code> or a <code>SecretKeyEntry</code>.
+ * was created by a call to {@code setKeyEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code PrivateKeyEntry} or a {@code SecretKeyEntry}.
*
* @param alias the alias for the keystore entry to be checked
*
@@ -243,9 +243,9 @@
/**
* Returns true if the entry identified by the given alias
- * was created by a call to <code>setCertificateEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>TrustedCertificateEntry</code>.
+ * was created by a call to {@code setCertificateEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code TrustedCertificateEntry}.
*
* @param alias the alias for the keystore entry to be checked
*
@@ -260,15 +260,15 @@
*
* <p>This method attempts to match the given certificate with each
* keystore entry. If the entry being considered was
- * created by a call to <code>setCertificateEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>TrustedCertificateEntry</code>,
+ * created by a call to {@code setCertificateEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code TrustedCertificateEntry},
* then the given certificate is compared to that entry's certificate.
*
* <p> If the entry being considered was
- * created by a call to <code>setKeyEntry</code>,
- * or created by a call to <code>setEntry</code> with a
- * <code>PrivateKeyEntry</code>,
+ * created by a call to {@code setKeyEntry},
+ * or created by a call to {@code setEntry} with a
+ * {@code PrivateKeyEntry},
* then the given certificate is compared to the first
* element of that entry's certificate chain.
*
@@ -297,14 +297,14 @@
/**
* Stores this keystore using the given
- * <code>KeyStore.LoadStoreParmeter</code>.
+ * {@code KeyStore.LoadStoreParmeter}.
*
- * @param param the <code>KeyStore.LoadStoreParmeter</code>
+ * @param param the {@code KeyStore.LoadStoreParmeter}
* that specifies how to store the keystore,
- * which may be <code>null</code>
+ * which may be {@code null}
*
* @exception IllegalArgumentException if the given
- * <code>KeyStore.LoadStoreParmeter</code>
+ * {@code KeyStore.LoadStoreParmeter}
* input is not recognized
* @exception IOException if there was an I/O problem with data
* @exception NoSuchAlgorithmException if the appropriate data integrity
@@ -330,17 +330,17 @@
* then integrity checking is not performed.
*
* @param stream the input stream from which the keystore is loaded,
- * or <code>null</code>
+ * or {@code null}
* @param password the password used to check the integrity of
* the keystore, the password used to unlock the keystore,
- * or <code>null</code>
+ * or {@code null}
*
* @exception IOException if there is an I/O or format problem with the
* keystore data, if a password is required but not given,
* or if the given password was incorrect. If the error is due to a
* wrong password, the {@link Throwable#getCause cause} of the
- * <code>IOException</code> should be an
- * <code>UnrecoverableKeyException</code>
+ * {@code IOException} should be an
+ * {@code UnrecoverableKeyException}
* @exception NoSuchAlgorithmException if the algorithm used to check
* the integrity of the keystore cannot be found
* @exception CertificateException if any of the certificates in the
@@ -351,24 +351,24 @@
/**
* Loads the keystore using the given
- * <code>KeyStore.LoadStoreParameter</code>.
+ * {@code KeyStore.LoadStoreParameter}.
*
* <p> Note that if this KeyStore has already been loaded, it is
* reinitialized and loaded again from the given parameter.
*
- * @param param the <code>KeyStore.LoadStoreParameter</code>
+ * @param param the {@code KeyStore.LoadStoreParameter}
* that specifies how to load the keystore,
- * which may be <code>null</code>
+ * which may be {@code null}
*
* @exception IllegalArgumentException if the given
- * <code>KeyStore.LoadStoreParameter</code>
+ * {@code KeyStore.LoadStoreParameter}
* input is not recognized
* @exception IOException if there is an I/O or format problem with the
* keystore data. If the error is due to an incorrect
- * <code>ProtectionParameter</code> (e.g. wrong password)
+ * {@code ProtectionParameter} (e.g. wrong password)
* the {@link Throwable#getCause cause} of the
- * <code>IOException</code> should be an
- * <code>UnrecoverableKeyException</code>
+ * {@code IOException} should be an
+ * {@code UnrecoverableKeyException}
* @exception NoSuchAlgorithmException if the algorithm used to check
* the integrity of the keystore cannot be found
* @exception CertificateException if any of the certificates in the
@@ -419,25 +419,25 @@
}
/**
- * Gets a <code>KeyStore.Entry</code> for the specified alias
+ * Gets a {@code KeyStore.Entry} for the specified alias
* with the specified protection parameter.
*
- * @param alias get the <code>KeyStore.Entry</code> for this alias
- * @param protParam the <code>ProtectionParameter</code>
- * used to protect the <code>Entry</code>,
- * which may be <code>null</code>
+ * @param alias get the {@code KeyStore.Entry} for this alias
+ * @param protParam the {@code ProtectionParameter}
+ * used to protect the {@code Entry},
+ * which may be {@code null}
*
- * @return the <code>KeyStore.Entry</code> for the specified alias,
- * or <code>null</code> if there is no such entry
+ * @return the {@code KeyStore.Entry} for the specified alias,
+ * or {@code null} if there is no such entry
*
* @exception KeyStoreException if the operation failed
* @exception NoSuchAlgorithmException if the algorithm for recovering the
* entry cannot be found
* @exception UnrecoverableEntryException if the specified
- * <code>protParam</code> were insufficient or invalid
+ * {@code protParam} were insufficient or invalid
* @exception UnrecoverableKeyException if the entry is a
- * <code>PrivateKeyEntry</code> or <code>SecretKeyEntry</code>
- * and the specified <code>protParam</code> does not contain
+ * {@code PrivateKeyEntry} or {@code SecretKeyEntry}
+ * and the specified {@code protParam} does not contain
* the information needed to recover the key (e.g. wrong password)
*
* @since 1.5
@@ -483,18 +483,18 @@
}
/**
- * Saves a <code>KeyStore.Entry</code> under the specified alias.
+ * Saves a {@code KeyStore.Entry} under the specified alias.
* The specified protection parameter is used to protect the
- * <code>Entry</code>.
+ * {@code Entry}.
*
* <p> If an entry already exists for the specified alias,
* it is overridden.
*
- * @param alias save the <code>KeyStore.Entry</code> under this alias
- * @param entry the <code>Entry</code> to save
- * @param protParam the <code>ProtectionParameter</code>
- * used to protect the <code>Entry</code>,
- * which may be <code>null</code>
+ * @param alias save the {@code KeyStore.Entry} under this alias
+ * @param entry the {@code Entry} to save
+ * @param protParam the {@code ProtectionParameter}
+ * used to protect the {@code Entry},
+ * which may be {@code null}
*
* @exception KeyStoreException if this operation fails
*
@@ -542,16 +542,16 @@
}
/**
- * Determines if the keystore <code>Entry</code> for the specified
- * <code>alias</code> is an instance or subclass of the specified
- * <code>entryClass</code>.
+ * Determines if the keystore {@code Entry} for the specified
+ * {@code alias} is an instance or subclass of the specified
+ * {@code entryClass}.
*
* @param alias the alias name
* @param entryClass the entry class
*
- * @return true if the keystore <code>Entry</code> for the specified
- * <code>alias</code> is an instance or subclass of the
- * specified <code>entryClass</code>, false otherwise
+ * @return true if the keystore {@code Entry} for the specified
+ * {@code alias} is an instance or subclass of the
+ * specified {@code entryClass}, false otherwise
*
* @since 1.5
*/
diff --git a/ojluni/src/main/java/java/security/MessageDigest.java b/ojluni/src/main/java/java/security/MessageDigest.java
index ff7f544..11dae4b 100644
--- a/ojluni/src/main/java/java/security/MessageDigest.java
+++ b/ojluni/src/main/java/java/security/MessageDigest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,10 @@
import java.nio.ByteBuffer;
+/*
+ANDROID-REMOVED: this debugging mechanism is not available in Android.
+import sun.security.util.Debug;
+*/
/**
* This MessageDigest class provides applications the functionality of a
* message digest algorithm, such as SHA-1 or SHA-256.
@@ -48,36 +52,36 @@
* updated, one of the {@link #digest() digest} methods should
* be called to complete the hash computation.
*
- * <p>The <code>digest</code> method can be called once for a given number
- * of updates. After <code>digest</code> has been called, the MessageDigest
+ * <p>The {@code digest} method can be called once for a given number
+ * of updates. After {@code digest} has been called, the MessageDigest
* object is reset to its initialized state.
*
* <p>Implementations are free to implement the Cloneable interface.
* Client applications can test cloneability by attempting cloning
- * and catching the CloneNotSupportedException: <p>
+ * and catching the CloneNotSupportedException:
*
-* <pre>
-* MessageDigest md = MessageDigest.getInstance("SHA");
-*
-* try {
-* md.update(toChapter1);
-* MessageDigest tc1 = md.clone();
-* byte[] toChapter1Digest = tc1.digest();
-* md.update(toChapter2);
-* ...etc.
-* } catch (CloneNotSupportedException cnse) {
-* throw new DigestException("couldn't make digest of partial content");
-* }
-* </pre>
+ * <pre>{@code
+ * MessageDigest md = MessageDigest.getInstance("SHA");
+ *
+ * try {
+ * md.update(toChapter1);
+ * MessageDigest tc1 = md.clone();
+ * byte[] toChapter1Digest = tc1.digest();
+ * md.update(toChapter2);
+ * ...etc.
+ * } catch (CloneNotSupportedException cnse) {
+ * throw new DigestException("couldn't make digest of partial content");
+ * }
+ * }</pre>
*
* <p>Note that if a given implementation is not cloneable, it is
* still possible to compute intermediate digests by instantiating
* several instances, if the number of digests is known in advance.
*
* <p>Note that this class is abstract and extends from
- * <code>MessageDigestSpi</code> for historical reasons.
+ * {@code MessageDigestSpi} for historical reasons.
* Application developers should only take notice of the methods defined in
- * this <code>MessageDigest</code> class; all the methods in
+ * this {@code MessageDigest} class; all the methods in
* the superclass are intended for cryptographic service providers who wish to
* supply their own implementations of message digest algorithms.
*
@@ -130,6 +134,14 @@
public abstract class MessageDigest extends MessageDigestSpi {
+ /*
+ ANDROID-REMOVED: this debugging mechanism is not available in Android.
+ private static final Debug pdebug =
+ Debug.getInstance("provider", "Provider");
+ private static final boolean skipDebug =
+ Debug.isOn("engine=") && !Debug.isOn("messagedigest");
+ */
+
private String algorithm;
// The state of this digest
@@ -183,18 +195,26 @@
public static MessageDigest getInstance(String algorithm)
throws NoSuchAlgorithmException {
try {
+ MessageDigest md;
Object[] objs = Security.getImpl(algorithm, "MessageDigest",
(String)null);
if (objs[0] instanceof MessageDigest) {
- MessageDigest md = (MessageDigest)objs[0];
- md.provider = (Provider)objs[1];
- return md;
+ md = (MessageDigest)objs[0];
} else {
- MessageDigest delegate =
- new Delegate((MessageDigestSpi)objs[0], algorithm);
- delegate.provider = (Provider)objs[1];
- return delegate;
+ md = new Delegate((MessageDigestSpi)objs[0], algorithm);
}
+ md.provider = (Provider)objs[1];
+
+ /*
+ ANDROID-REMOVED: this debugging mechanism is not available in Android.
+ if (!skipDebug && pdebug != null) {
+ pdebug.println("MessageDigest." + algorithm +
+ " algorithm from: " + md.provider.getName());
+ }
+ */
+
+ return md;
+
} catch(NoSuchProviderException e) {
throw new NoSuchAlgorithmException(algorithm + " not found");
}
@@ -328,7 +348,7 @@
* @param offset the offset to start from in the array of bytes.
*
* @param len the number of bytes to use, starting at
- * <code>offset</code>.
+ * {@code offset}.
*/
public void update(byte[] input, int offset, int len) {
if (input == null) {
@@ -353,8 +373,8 @@
/**
* Update the digest using the specified ByteBuffer. The digest is
- * updated using the <code>input.remaining()</code> bytes starting
- * at <code>input.position()</code>.
+ * updated using the {@code input.remaining()} bytes starting
+ * at {@code input.position()}.
* Upon return, the buffer's position will be equal to its limit;
* its limit will not have changed.
*
@@ -392,7 +412,7 @@
*
* @param len number of bytes within buf allotted for the digest
*
- * @return the number of bytes placed into <code>buf</code>
+ * @return the number of bytes placed into {@code buf}
*
* @exception DigestException if an error occurs.
*/
@@ -413,7 +433,7 @@
* Performs a final update on the digest using the specified array
* of bytes, then completes the digest computation. That is, this
* method first calls {@link #update(byte[]) update(input)},
- * passing the <i>input</i> array to the <code>update</code> method,
+ * passing the <i>input</i> array to the {@code update} method,
* then calls {@link #digest() digest()}.
*
* @param input the input to be updated before the digest is
@@ -458,6 +478,10 @@
* @return true if the digests are equal, false otherwise.
*/
public static boolean isEqual(byte[] digesta, byte[] digestb) {
+ if (digesta == digestb) return true;
+ if (digesta == null || digestb == null) {
+ return false;
+ }
if (digesta.length != digestb.length) {
return false;
}
@@ -522,7 +546,7 @@
* @return a clone if the implementation is cloneable.
*
* @exception CloneNotSupportedException if this is called on an
- * implementation that does not support <code>Cloneable</code>.
+ * implementation that does not support {@code Cloneable}.
*/
public Object clone() throws CloneNotSupportedException {
if (this instanceof Cloneable) {
@@ -566,7 +590,7 @@
* @return a clone if the delegate is cloneable.
*
* @exception CloneNotSupportedException if this is called on a
- * delegate that does not support <code>Cloneable</code>.
+ * delegate that does not support {@code Cloneable}.
*/
public Object clone() throws CloneNotSupportedException {
if (digestSpi instanceof Cloneable) {
diff --git a/ojluni/src/main/java/java/security/MessageDigestSpi.java b/ojluni/src/main/java/java/security/MessageDigestSpi.java
index 700d725..0d5ace1 100644
--- a/ojluni/src/main/java/java/security/MessageDigestSpi.java
+++ b/ojluni/src/main/java/java/security/MessageDigestSpi.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>MessageDigest</code> class, which provides the functionality
+ * for the {@code MessageDigest} class, which provides the functionality
* of a message digest algorithm, such as MD5 or SHA. Message digests are
* secure one-way hash functions that take arbitrary-sized data and output a
* fixed-length hash value.
@@ -88,14 +88,14 @@
* @param offset the offset to start from in the array of bytes.
*
* @param len the number of bytes to use, starting at
- * <code>offset</code>.
+ * {@code offset}.
*/
protected abstract void engineUpdate(byte[] input, int offset, int len);
/**
* Update the digest using the specified ByteBuffer. The digest is
- * updated using the <code>input.remaining()</code> bytes starting
- * at <code>input.position()</code>.
+ * updated using the {@code input.remaining()} bytes starting
+ * at {@code input.position()}.
* Upon return, the buffer's position will be equal to its limit;
* its limit will not have changed.
*
@@ -130,7 +130,7 @@
/**
* Completes the hash computation by performing final
- * operations such as padding. Once <code>engineDigest</code> has
+ * operations such as padding. Once {@code engineDigest} has
* been called, the engine should be reset (see
* {@link #engineReset() engineReset}).
* Resetting is the responsibility of the
@@ -142,7 +142,7 @@
/**
* Completes the hash computation by performing final
- * operations such as padding. Once <code>engineDigest</code> has
+ * operations such as padding. Once {@code engineDigest} has
* been called, the engine should be reset (see
* {@link #engineReset() engineReset}).
* Resetting is the responsibility of the
@@ -194,7 +194,7 @@
* @return a clone if the implementation is cloneable.
*
* @exception CloneNotSupportedException if this is called on an
- * implementation that does not support <code>Cloneable</code>.
+ * implementation that does not support {@code Cloneable}.
*/
public Object clone() throws CloneNotSupportedException {
if (this instanceof Cloneable) {
diff --git a/ojluni/src/main/java/java/security/PolicySpi.java b/ojluni/src/main/java/java/security/PolicySpi.java
index aa66ba8..608ce1f 100644
--- a/ojluni/src/main/java/java/security/PolicySpi.java
+++ b/ojluni/src/main/java/java/security/PolicySpi.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,15 +28,15 @@
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>Policy</code> class.
+ * for the {@code Policy} class.
* All the abstract methods in this class must be implemented by each
* service provider who wishes to supply a Policy implementation.
*
* <p> Subclass implementations of this abstract class must provide
- * a public constructor that takes a <code>Policy.Parameters</code>
+ * a public constructor that takes a {@code Policy.Parameters}
* object as an input parameter. This constructor also must throw
* an IllegalArgumentException if it does not understand the
- * <code>Policy.Parameters</code> input.
+ * {@code Policy.Parameters} input.
*
*
* @since 1.6
@@ -59,7 +59,7 @@
/**
* Refreshes/reloads the policy configuration. The behavior of this method
- * depends on the implementation. For example, calling <code>refresh</code>
+ * depends on the implementation. For example, calling {@code refresh}
* on a file-based policy will cause the file to be re-read.
*
* <p> The default implementation of this method does nothing.
diff --git a/ojluni/src/main/java/java/security/ProviderException.java b/ojluni/src/main/java/java/security/ProviderException.java
index 449c8c3..b372ee7 100644
--- a/ojluni/src/main/java/java/security/ProviderException.java
+++ b/ojluni/src/main/java/java/security/ProviderException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -58,13 +58,13 @@
}
/**
- * Creates a <code>ProviderException</code> with the specified
+ * Creates a {@code ProviderException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -73,13 +73,13 @@
}
/**
- * Creates a <code>ProviderException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code ProviderException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
diff --git a/ojluni/src/main/java/java/security/PublicKey.java b/ojluni/src/main/java/java/security/PublicKey.java
index c983ff6..df49807 100644
--- a/ojluni/src/main/java/java/security/PublicKey.java
+++ b/ojluni/src/main/java/java/security/PublicKey.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
*
* Note: The specialized public key interfaces extend this interface.
* See, for example, the DSAPublicKey interface in
- * <code>java.security.interfaces</code>.
+ * {@code java.security.interfaces}.
*
* @see Key
* @see PrivateKey
diff --git a/ojluni/src/main/java/java/security/SecureClassLoader.java b/ojluni/src/main/java/java/security/SecureClassLoader.java
index ffcd1a7..145f4fc 100644
--- a/ojluni/src/main/java/java/security/SecureClassLoader.java
+++ b/ojluni/src/main/java/java/security/SecureClassLoader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -63,12 +63,12 @@
* class loader for delegation.
*
* <p>If there is a security manager, this method first
- * calls the security manager's <code>checkCreateClassLoader</code>
+ * calls the security manager's {@code checkCreateClassLoader}
* method to ensure creation of a class loader is allowed.
* <p>
* @param parent the parent ClassLoader
* @exception SecurityException if a security manager exists and its
- * <code>checkCreateClassLoader</code> method doesn't allow
+ * {@code checkCreateClassLoader} method doesn't allow
* creation of a class loader.
* @see SecurityManager#checkCreateClassLoader
*/
@@ -87,11 +87,11 @@
* loader for delegation.
*
* <p>If there is a security manager, this method first
- * calls the security manager's <code>checkCreateClassLoader</code>
+ * calls the security manager's {@code checkCreateClassLoader}
* method to ensure creation of a class loader is allowed.
*
* @exception SecurityException if a security manager exists and its
- * <code>checkCreateClassLoader</code> method doesn't allow
+ * {@code checkCreateClassLoader} method doesn't allow
* creation of a class loader.
* @see SecurityManager#checkCreateClassLoader
*/
@@ -113,22 +113,22 @@
* If a non-null CodeSource is supplied a ProtectionDomain is
* constructed and associated with the class being defined.
* <p>
- * @param name the expected name of the class, or <code>null</code>
+ * @param name the expected name of the class, or {@code null}
* if not known, using '.' and not '/' as the separator
* and without a trailing ".class" suffix.
* @param b the bytes that make up the class data. The bytes in
- * positions <code>off</code> through <code>off+len-1</code>
+ * positions {@code off} through {@code off+len-1}
* should have the format of a valid class file as defined by
* <cite>The Java™ Virtual Machine Specification</cite>.
- * @param off the start offset in <code>b</code> of the class data
+ * @param off the start offset in {@code b} of the class data
* @param len the length of the class data
- * @param cs the associated CodeSource, or <code>null</code> if none
- * @return the <code>Class</code> object created from the data,
+ * @param cs the associated CodeSource, or {@code null} if none
+ * @return the {@code Class} object created from the data,
* and optional CodeSource.
* @exception ClassFormatError if the data did not contain a valid class
- * @exception IndexOutOfBoundsException if either <code>off</code> or
- * <code>len</code> is negative, or if
- * <code>off+len</code> is greater than <code>b.length</code>.
+ * @exception IndexOutOfBoundsException if either {@code off} or
+ * {@code len} is negative, or if
+ * {@code off+len} is greater than {@code b.length}.
*
* @exception SecurityException if an attempt is made to add this class
* to a package that contains classes that were signed by
@@ -143,22 +143,22 @@
}
/**
- * Converts a {@link java.nio.ByteBuffer <tt>ByteBuffer</tt>}
- * into an instance of class <tt>Class</tt>, with an optional CodeSource.
+ * Converts a {@link java.nio.ByteBuffer ByteBuffer}
+ * into an instance of class {@code Class}, with an optional CodeSource.
* Before the class can be used it must be resolved.
* <p>
* If a non-null CodeSource is supplied a ProtectionDomain is
* constructed and associated with the class being defined.
* <p>
- * @param name the expected name of the class, or <code>null</code>
+ * @param name the expected name of the class, or {@code null}
* if not known, using '.' and not '/' as the separator
* and without a trailing ".class" suffix.
* @param b the bytes that make up the class data. The bytes from positions
- * <tt>b.position()</tt> through <tt>b.position() + b.limit() -1</tt>
+ * {@code b.position()} through {@code b.position() + b.limit() -1}
* should have the format of a valid class file as defined by
* <cite>The Java™ Virtual Machine Specification</cite>.
- * @param cs the associated CodeSource, or <code>null</code> if none
- * @return the <code>Class</code> object created from the data,
+ * @param cs the associated CodeSource, or {@code null} if none
+ * @return the {@code Class} object created from the data,
* and optional CodeSource.
* @exception ClassFormatError if the data did not contain a valid class
* @exception SecurityException if an attempt is made to add this class
diff --git a/ojluni/src/main/java/java/security/SecureRandomSpi.java b/ojluni/src/main/java/java/security/SecureRandomSpi.java
index 12652e9..ef6c243 100644
--- a/ojluni/src/main/java/java/security/SecureRandomSpi.java
+++ b/ojluni/src/main/java/java/security/SecureRandomSpi.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>SecureRandom</code> class.
+ * for the {@code SecureRandom} class.
* All the abstract methods in this class must be implemented by each
* service provider who wishes to supply the implementation
* of a cryptographically strong pseudo-random number generator.
@@ -53,10 +53,10 @@
/**
* Generates a user-specified number of random bytes.
*
- * <p> If a call to <code>engineSetSeed</code> had not occurred previously,
+ * <p> If a call to {@code engineSetSeed} had not occurred previously,
* the first call to this method forces this SecureRandom implementation
* to seed itself. This self-seeding will not occur if
- * <code>engineSetSeed</code> was previously called.
+ * {@code engineSetSeed} was previously called.
*
* @param bytes the array to be filled in with random bytes.
*/
diff --git a/ojluni/src/main/java/java/security/Security.java b/ojluni/src/main/java/java/security/Security.java
index 003fb81..99d5526 100644
--- a/ojluni/src/main/java/java/security/Security.java
+++ b/ojluni/src/main/java/java/security/Security.java
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,6 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.io.*;
-
import sun.security.jca.GetInstance;
import sun.security.jca.ProviderList;
import sun.security.jca.Providers;
@@ -40,6 +39,10 @@
* <p>This class centralizes all security properties and common security
* methods. One of its primary uses is to manage providers.
*
+ * <p>The default values of security properties are read from an
+ * implementation-specific location, which is typically the properties file
+ * {@code lib/security/java.security} in the Java installation directory.
+ *
* @author Benjamin Renaud
*/
@@ -186,7 +189,7 @@
* property in the master file of the "SUN" Cryptographic Service
* Provider in order to determine how to parse algorithm-specific
* parameters. Use the new provider-based and algorithm-independent
- * <code>AlgorithmParameters</code> and <code>KeyFactory</code> engine
+ * {@code AlgorithmParameters} and {@code KeyFactory} engine
* classes (introduced in the J2SE version 1.2 platform) instead.
*/
@Deprecated
@@ -209,22 +212,18 @@
*
* <p>If the given provider is installed at the requested position,
* the provider that used to be at that position, and all providers
- * with a position greater than <code>position</code>, are shifted up
+ * with a position greater than {@code position}, are shifted up
* one position (towards the end of the list of installed providers).
*
* <p>A provider cannot be added if it is already installed.
*
- * <p>First, if there is a security manager, its
- * <code>checkSecurityAccess</code>
- * method is called with the string
- * <code>"insertProvider."+provider.getName()</code>
- * to see if it's ok to add a new provider.
- * If the default implementation of <code>checkSecurityAccess</code>
- * is used (i.e., that method is not overriden), then this will result in
- * a call to the security manager's <code>checkPermission</code> method
- * with a
- * <code>SecurityPermission("insertProvider."+provider.getName())</code>
- * permission.
+ * <p>If there is a security manager, the
+ * {@link java.lang.SecurityManager#checkSecurityAccess} method is called
+ * with the {@code "insertProvider"} permission target name to see if
+ * it's ok to add a new provider. If this permission check is denied,
+ * {@code checkSecurityAccess} is called again with the
+ * {@code "insertProvider."+provider.getName()} permission target name. If
+ * both checks are denied, a {@code SecurityException} is thrown.
*
* @param provider the provider to be added.
*
@@ -237,8 +236,8 @@
*
* @throws NullPointerException if provider is null
* @throws SecurityException
- * if a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkSecurityAccess}</code> method
+ * if a security manager exists and its {@link
+ * java.lang.SecurityManager#checkSecurityAccess} method
* denies access to add a new provider
*
* @see #getProvider
@@ -248,7 +247,10 @@
public static synchronized int insertProviderAt(Provider provider,
int position) {
String providerName = provider.getName();
- check("insertProvider." + providerName);
+ // ANDROID-REMOVED
+ // Checks using SecurityManager, which is not functional in Android.
+ // checkInsertProvider(providerName);
+ // ANDROID-REMOVED
ProviderList list = Providers.getFullProviderList();
ProviderList newList = ProviderList.insertAt(list, provider, position - 1);
if (list == newList) {
@@ -262,17 +264,13 @@
/**
* Adds a provider to the next position available.
*
- * <p>First, if there is a security manager, its
- * <code>checkSecurityAccess</code>
- * method is called with the string
- * <code>"insertProvider."+provider.getName()</code>
- * to see if it's ok to add a new provider.
- * If the default implementation of <code>checkSecurityAccess</code>
- * is used (i.e., that method is not overriden), then this will result in
- * a call to the security manager's <code>checkPermission</code> method
- * with a
- * <code>SecurityPermission("insertProvider."+provider.getName())</code>
- * permission.
+ * <p>If there is a security manager, the
+ * {@link java.lang.SecurityManager#checkSecurityAccess} method is called
+ * with the {@code "insertProvider"} permission target name to see if
+ * it's ok to add a new provider. If this permission check is denied,
+ * {@code checkSecurityAccess} is called again with the
+ * {@code "insertProvider."+provider.getName()} permission target name. If
+ * both checks are denied, a {@code SecurityException} is thrown.
*
* @param provider the provider to be added.
*
@@ -282,8 +280,8 @@
*
* @throws NullPointerException if provider is null
* @throws SecurityException
- * if a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkSecurityAccess}</code> method
+ * if a security manager exists and its {@link
+ * java.lang.SecurityManager#checkSecurityAccess} method
* denies access to add a new provider
*
* @see #getProvider
@@ -312,20 +310,20 @@
* if name is null.
*
* <p>First, if there is a security manager, its
- * <code>checkSecurityAccess</code>
- * method is called with the string <code>"removeProvider."+name</code>
+ * {@code checkSecurityAccess}
+ * method is called with the string {@code "removeProvider."+name}
* to see if it's ok to remove the provider.
- * If the default implementation of <code>checkSecurityAccess</code>
+ * If the default implementation of {@code checkSecurityAccess}
* is used (i.e., that method is not overriden), then this will result in
- * a call to the security manager's <code>checkPermission</code> method
- * with a <code>SecurityPermission("removeProvider."+name)</code>
+ * a call to the security manager's {@code checkPermission} method
+ * with a {@code SecurityPermission("removeProvider."+name)}
* permission.
*
* @param name the name of the provider to remove.
*
* @throws SecurityException
- * if a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkSecurityAccess}</code> method
+ * if a security manager exists and its {@link
+ * java.lang.SecurityManager#checkSecurityAccess} method
* denies
* access to remove the provider
*
@@ -370,8 +368,8 @@
* Returns an array containing all installed providers that satisfy the
* specified selection criterion, or null if no such providers have been
* installed. The returned providers are ordered
- * according to their <a href=
- * "#insertProviderAt(java.security.Provider, int)">preference order</a>.
+ * according to their
+ * {@linkplain #insertProviderAt(java.security.Provider, int) preference order}.
*
* <p> A cryptographic service is always associated with a particular
* algorithm or type. For example, a digital signature service is
@@ -382,8 +380,8 @@
* <p>The selection criterion must be specified in one of the following two
* formats:
* <ul>
- * <li> <i><crypto_service>.<algorithm_or_type></i> <p> The
- * cryptographic service name must not contain any dots.
+ * <li> <i>{@literal <crypto_service>.<algorithm_or_type>}</i>
+ * <p> The cryptographic service name must not contain any dots.
* <p> A
* provider satisfies the specified selection criterion iff the provider
* implements the
@@ -391,11 +389,12 @@
* <p> For example, "CertificateFactory.X.509"
* would be satisfied by any provider that supplied
* a CertificateFactory implementation for X.509 certificates.
- * <li> <i><crypto_service>.<algorithm_or_type>
- * <attribute_name>:< attribute_value></i>
+ * <li> <i>{@literal <crypto_service>.<algorithm_or_type>
+ * <attribute_name>:<attribute_value>}</i>
* <p> The cryptographic service name must not contain any dots. There
- * must be one or more space charaters between the
- * <i><algorithm_or_type></i> and the <i><attribute_name></i>.
+ * must be one or more space characters between the
+ * <i>{@literal <algorithm_or_type>}</i> and the
+ * <i>{@literal <attribute_name>}</i>.
* <p> A provider satisfies this selection criterion iff the
* provider implements the specified algorithm or type for the specified
* cryptographic service and its implementation meets the
@@ -448,8 +447,9 @@
* Returns an array containing all installed providers that satisfy the
* specified* selection criteria, or null if no such providers have been
* installed. The returned providers are ordered
- * according to their <a href=
- * "#insertProviderAt(java.security.Provider, int)">preference order</a>.
+ * according to their
+ * {@linkplain #insertProviderAt(java.security.Provider, int)
+ * preference order}.
*
* <p>The selection criteria are represented by a map.
* Each map entry represents a selection criterion.
@@ -457,16 +457,18 @@
* criteria. The key for any entry in such a map must be in one of the
* following two formats:
* <ul>
- * <li> <i><crypto_service>.<algorithm_or_type></i>
+ * <li> <i>{@literal <crypto_service>.<algorithm_or_type>}</i>
* <p> The cryptographic service name must not contain any dots.
* <p> The value associated with the key must be an empty string.
* <p> A provider
* satisfies this selection criterion iff the provider implements the
* specified algorithm or type for the specified cryptographic service.
- * <li> <i><crypto_service>.<algorithm_or_type> <attribute_name></i>
+ * <li> <i>{@literal <crypto_service>}.
+ * {@literal <algorithm_or_type> <attribute_name>}</i>
* <p> The cryptographic service name must not contain any dots. There
- * must be one or more space charaters between the <i><algorithm_or_type></i>
- * and the <i><attribute_name></i>.
+ * must be one or more space characters between the
+ * <i>{@literal <algorithm_or_type>}</i>
+ * and the <i>{@literal <attribute_name>}</i>.
* <p> The value associated with the key must be a non-empty string.
* A provider satisfies this selection criterion iff the
* provider implements the specified algorithm or type for the specified
@@ -552,15 +554,16 @@
}
// Map containing cached Spi Class objects of the specified type
- private static final Map<String, Class> spiMap = new ConcurrentHashMap<>();
+ private static final Map<String, Class<?>> spiMap =
+ new ConcurrentHashMap<>();
/**
* Return the Class object for the given engine type
* (e.g. "MessageDigest"). Works for Spis in the java.security package
* only.
*/
- private static Class getSpiClass(String type) {
- Class clazz = spiMap.get(type);
+ private static Class<?> getSpiClass(String type) {
+ Class<?> clazz = spiMap.get(type);
if (clazz != null) {
return clazz;
}
@@ -578,7 +581,7 @@
* an instance of an implementation of the requested algorithm
* and type, and the second object in the array identifies the provider
* of that implementation.
- * The <code>provider</code> argument can be null, in which case all
+ * The {@code provider} argument can be null, in which case all
* configured providers will be searched in order of preference.
*/
static Object[] getImpl(String algorithm, String type, String provider)
@@ -609,7 +612,7 @@
* an instance of an implementation of the requested algorithm
* and type, and the second object in the array identifies the provider
* of that implementation.
- * The <code>provider</code> argument cannot be null.
+ * The {@code provider} argument cannot be null.
*/
static Object[] getImpl(String algorithm, String type, Provider provider)
throws NoSuchAlgorithmException {
@@ -628,8 +631,8 @@
* Gets a security property value.
*
* <p>First, if there is a security manager, its
- * <code>checkPermission</code> method is called with a
- * <code>java.security.SecurityPermission("getProperty."+key)</code>
+ * {@code checkPermission} method is called with a
+ * {@code java.security.SecurityPermission("getProperty."+key)}
* permission to see if it's ok to retrieve the specified
* security property value..
*
@@ -638,8 +641,8 @@
* @return the value of the security property corresponding to key.
*
* @throws SecurityException
- * if a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkPermission}</code> method
+ * if a security manager exists and its {@link
+ * java.lang.SecurityManager#checkPermission} method
* denies
* access to retrieve the specified security property value
* @throws NullPointerException is key is null
@@ -663,8 +666,8 @@
* Sets a security property value.
*
* <p>First, if there is a security manager, its
- * <code>checkPermission</code> method is called with a
- * <code>java.security.SecurityPermission("setProperty."+key)</code>
+ * {@code checkPermission} method is called with a
+ * {@code java.security.SecurityPermission("setProperty."+key)}
* permission to see if it's ok to set the specified
* security property value.
*
@@ -673,8 +676,8 @@
* @param datum the value of the property to be set.
*
* @throws SecurityException
- * if a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkPermission}</code> method
+ * if a security manager exists and its {@link
+ * java.lang.SecurityManager#checkPermission} method
* denies access to set the specified security property value
* @throws NullPointerException if key or datum is null
*
@@ -708,7 +711,7 @@
public Void run() {
try {
/* Get the class via the bootstrap class loader. */
- Class cl = Class.forName(
+ Class<?> cl = Class.forName(
"java.lang.SecurityManager", false, null);
Field f = null;
boolean accessible = false;
@@ -971,7 +974,7 @@
if ((serviceName == null) || (serviceName.length() == 0) ||
(serviceName.endsWith("."))) {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
HashSet<String> result = new HashSet<>();
@@ -981,8 +984,10 @@
// Check the keys for each provider.
for (Enumeration<Object> e = providers[i].keys();
e.hasMoreElements(); ) {
- String currentKey = ((String)e.nextElement()).toUpperCase();
- if (currentKey.startsWith(serviceName.toUpperCase())) {
+ String currentKey =
+ ((String)e.nextElement()).toUpperCase(Locale.ENGLISH);
+ if (currentKey.startsWith(
+ serviceName.toUpperCase(Locale.ENGLISH))) {
// We should skip the currentKey if it contains a
// whitespace. The reason is: such an entry in the
// provider property contains attributes for the
@@ -990,7 +995,8 @@
// in entries which lead to the implementation
// classes.
if (currentKey.indexOf(" ") < 0) {
- result.add(currentKey.substring(serviceName.length() + 1));
+ result.add(currentKey.substring(
+ serviceName.length() + 1));
}
}
}
diff --git a/ojluni/src/main/java/java/security/SignatureException.java b/ojluni/src/main/java/java/security/SignatureException.java
index c47de31..2e1fa59 100644
--- a/ojluni/src/main/java/java/security/SignatureException.java
+++ b/ojluni/src/main/java/java/security/SignatureException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -56,13 +56,13 @@
}
/**
- * Creates a <code>SignatureException</code> with the specified
+ * Creates a {@code SignatureException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -71,13 +71,13 @@
}
/**
- * Creates a <code>SignatureException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code SignatureException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
diff --git a/ojluni/src/main/java/java/security/SignatureSpi.java b/ojluni/src/main/java/java/security/SignatureSpi.java
index d18b361..8a10af9 100644
--- a/ojluni/src/main/java/java/security/SignatureSpi.java
+++ b/ojluni/src/main/java/java/security/SignatureSpi.java
@@ -36,7 +36,7 @@
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the <code>Signature</code> class, which is used to provide the
+ * for the {@code Signature} class, which is used to provide the
* functionality of a digital signature algorithm. Digital signatures are used
* for authentication and integrity assurance of digital data.
*.
@@ -131,8 +131,8 @@
/**
* Updates the data to be signed or verified using the specified
- * ByteBuffer. Processes the <code>data.remaining()</code> bytes
- * starting at at <code>data.position()</code>.
+ * ByteBuffer. Processes the {@code data.remaining()} bytes
+ * starting at at {@code data.position()}.
* Upon return, the buffer's position will be equal to its limit;
* its limit will not have changed.
*
@@ -184,14 +184,14 @@
/**
* Finishes this signature operation and stores the resulting signature
- * bytes in the provided buffer <code>outbuf</code>, starting at
- * <code>offset</code>.
+ * bytes in the provided buffer {@code outbuf}, starting at
+ * {@code offset}.
* The format of the signature depends on the underlying
* signature scheme.
*
* <p>The signature implementation is reset to its initial state
* (the state it was in after a call to one of the
- * <code>engineInitSign</code> methods)
+ * {@code engineInitSign} methods)
* and can be reused to generate further signatures with the same private
* key.
*
@@ -201,10 +201,10 @@
*
* @param outbuf buffer for the signature result.
*
- * @param offset offset into <code>outbuf</code> where the signature is
+ * @param offset offset into {@code outbuf} where the signature is
* stored.
*
- * @param len number of bytes within <code>outbuf</code> allotted for the
+ * @param len number of bytes within {@code outbuf} allotted for the
* signature.
* Both this default implementation and the SUN provider do not
* return partial digests. If the value of this parameter is less
@@ -213,11 +213,11 @@
* This parameter is ignored if its value is greater than or equal to
* the actual signature length.
*
- * @return the number of bytes placed into <code>outbuf</code>
+ * @return the number of bytes placed into {@code outbuf}
*
* @exception SignatureException if the engine is not
* initialized properly, if this signature algorithm is unable to
- * process the input data provided, or if <code>len</code> is less
+ * process the input data provided, or if {@code len} is less
* than the actual signature length.
*
* @since 1.2
@@ -294,7 +294,7 @@
*
* @param value the parameter value.
*
- * @exception InvalidParameterException if <code>param</code> is an
+ * @exception InvalidParameterException if {@code param} is an
* invalid parameter for this signature algorithm engine,
* the parameter is already set
* and cannot be set again, a security exception occurs, and so on.
@@ -363,7 +363,7 @@
* @return the object that represents the parameter value, or null if
* there is none.
*
- * @exception InvalidParameterException if <code>param</code> is an
+ * @exception InvalidParameterException if {@code param} is an
* invalid parameter for this engine, or another exception occurs while
* trying to get this parameter.
*
@@ -380,7 +380,7 @@
* @return a clone if the implementation is cloneable.
*
* @exception CloneNotSupportedException if this is called
- * on an implementation that does not support <code>Cloneable</code>.
+ * on an implementation that does not support {@code Cloneable}.
*/
public Object clone() throws CloneNotSupportedException {
if (this instanceof Cloneable) {
diff --git a/ojluni/src/main/java/java/security/SignedObject.java b/ojluni/src/main/java/java/security/SignedObject.java
index 1f901fa..9ac864e 100644
--- a/ojluni/src/main/java/java/security/SignedObject.java
+++ b/ojluni/src/main/java/java/security/SignedObject.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,44 +40,44 @@
* the original object has no side effect on the copy.
*
* <p> The underlying signing algorithm is designated by the Signature
- * object passed to the constructor and the <code>verify</code> method.
+ * object passed to the constructor and the {@code verify} method.
* A typical usage for signing is the following:
*
- * <p> <code> <pre>
+ * <pre>{@code
* Signature signingEngine = Signature.getInstance(algorithm,
* provider);
* SignedObject so = new SignedObject(myobject, signingKey,
* signingEngine);
- * </pre> </code>
+ * }</pre>
*
* <p> A typical usage for verification is the following (having
- * received SignedObject <code>so</code>):
+ * received SignedObject {@code so}):
*
- * <p> <code> <pre>
+ * <pre>{@code
* Signature verificationEngine =
* Signature.getInstance(algorithm, provider);
* if (so.verify(publickey, verificationEngine))
* try {
* Object myobj = so.getObject();
* } catch (java.lang.ClassNotFoundException e) {};
- * </pre> </code>
+ * }</pre>
*
* <p> Several points are worth noting. First, there is no need to
* initialize the signing or verification engine, as it will be
- * re-initialized inside the constructor and the <code>verify</code>
+ * re-initialized inside the constructor and the {@code verify}
* method. Secondly, for verification to succeed, the specified
* public key must be the public key corresponding to the private key
* used to generate the SignedObject.
*
* <p> More importantly, for flexibility reasons, the
- * constructor and <code>verify</code> method allow for
+ * constructor and {@code verify} method allow for
* customized signature engines, which can implement signature
* algorithms that are not installed formally as part of a crypto
* provider. However, it is crucial that the programmer writing the
- * verifier code be aware what <code>Signature</code> engine is being
- * used, as its own implementation of the <code>verify</code> method
+ * verifier code be aware what {@code Signature} engine is being
+ * used, as its own implementation of the {@code verify} method
* is invoked to verify a signature. In other words, a malicious
- * <code>Signature</code> may choose to always return true on
+ * {@code Signature} may choose to always return true on
* verification in an attempt to bypass a security check.
*
* <p> The signature algorithm can be, among others, the NIST standard
@@ -92,7 +92,7 @@
*
* <p> The name of the Cryptography Package Provider is designated
* also by the Signature parameter to the constructor and the
- * <code>verify</code> method. If the provider is not
+ * {@code verify} method. If the provider is not
* specified, the default provider is used. Each installation can
* be configured to use a particular provider as default.
*
@@ -214,8 +214,8 @@
* @exception SignatureException if signature verification failed.
* @exception InvalidKeyException if the verification key is invalid.
*
- * @return <tt>true</tt> if the signature
- * is valid, <tt>false</tt> otherwise
+ * @return {@code true} if the signature
+ * is valid, {@code false} otherwise
*/
public boolean verify(PublicKey verificationKey,
Signature verificationEngine)
diff --git a/ojluni/src/main/java/java/security/Signer.java b/ojluni/src/main/java/java/security/Signer.java
index 9224780..077538d 100644
--- a/ojluni/src/main/java/java/security/Signer.java
+++ b/ojluni/src/main/java/java/security/Signer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,9 +40,9 @@
* @author Benjamin Renaud
*
* @deprecated This class is no longer used. Its functionality has been
- * replaced by <code>java.security.KeyStore</code>, the
- * <code>java.security.cert</code> package, and
- * <code>java.security.Principal</code>.
+ * replaced by {@code java.security.KeyStore}, the
+ * {@code java.security.cert} package, and
+ * {@code java.security.Principal}.
*/
@Deprecated
public abstract class Signer extends Identity {
@@ -92,15 +92,15 @@
/**
* Returns this signer's private key.
*
- * <p>First, if there is a security manager, its <code>checkSecurityAccess</code>
- * method is called with <code>"getSignerPrivateKey"</code>
+ * <p>First, if there is a security manager, its {@code checkSecurityAccess}
+ * method is called with {@code "getSignerPrivateKey"}
* as its argument to see if it's ok to return the private key.
*
* @return this signer's private key, or null if the private key has
* not yet been set.
*
* @exception SecurityException if a security manager exists and its
- * <code>checkSecurityAccess</code> method doesn't allow
+ * {@code checkSecurityAccess} method doesn't allow
* returning the private key.
*
* @see SecurityManager#checkSecurityAccess
@@ -113,8 +113,8 @@
/**
* Sets the key pair (public key and private key) for this signer.
*
- * <p>First, if there is a security manager, its <code>checkSecurityAccess</code>
- * method is called with <code>"setSignerKeyPair"</code>
+ * <p>First, if there is a security manager, its {@code checkSecurityAccess}
+ * method is called with {@code "setSignerKeyPair"}
* as its argument to see if it's ok to set the key pair.
*
* @param pair an initialized key pair.
@@ -124,7 +124,7 @@
* @exception KeyException if the key pair cannot be set for any
* other reason.
* @exception SecurityException if a security manager exists and its
- * <code>checkSecurityAccess</code> method doesn't allow
+ * {@code checkSecurityAccess} method doesn't allow
* setting the key pair.
*
* @see SecurityManager#checkSecurityAccess
diff --git a/ojluni/src/main/java/java/security/UnresolvedPermissionCollection.java b/ojluni/src/main/java/java/security/UnresolvedPermissionCollection.java
index 69f6e60..7633648 100644
--- a/ojluni/src/main/java/java/security/UnresolvedPermissionCollection.java
+++ b/ojluni/src/main/java/java/security/UnresolvedPermissionCollection.java
@@ -197,8 +197,12 @@
ObjectInputStream.GetField gfields = in.readFields();
// Get permissions
+ @SuppressWarnings("unchecked")
+ // writeObject writes a Hashtable<String, Vector<UnresolvedPermission>>
+ // for the permissions key, so this cast is safe, unless the data is corrupt.
Hashtable<String, Vector<UnresolvedPermission>> permissions =
- (Hashtable<String, Vector<UnresolvedPermission>>)gfields.get("permissions", null);
+ (Hashtable<String, Vector<UnresolvedPermission>>)
+ gfields.get("permissions", null);
perms = new HashMap<String, List<UnresolvedPermission>>(permissions.size()*2);
// Convert each entry (Vector) into a List
diff --git a/ojluni/src/main/java/java/security/acl/Acl.java b/ojluni/src/main/java/java/security/acl/Acl.java
index e90f740..b9cf004 100644
--- a/ojluni/src/main/java/java/security/acl/Acl.java
+++ b/ojluni/src/main/java/java/security/acl/Acl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,43 +42,43 @@
* granted to the associated principal. If negative, the permissions
* are to be denied.<p>
*
- * The ACL Entries in each ACL observe the following rules:<p>
+ * The ACL Entries in each ACL observe the following rules:
*
* <ul> <li>Each principal can have at most one positive ACL entry and
* one negative entry; that is, multiple positive or negative ACL
* entries are not allowed for any principal. Each entry specifies
* the set of permissions that are to be granted (if positive) or
- * denied (if negative). <p>
+ * denied (if negative).
*
* <li>If there is no entry for a particular principal, then the
- * principal is considered to have a null (empty) permission set.<p>
+ * principal is considered to have a null (empty) permission set.
*
* <li>If there is a positive entry that grants a principal a
* particular permission, and a negative entry that denies the
* principal the same permission, the result is as though the
- * permission was never granted or denied. <p>
+ * permission was never granted or denied.
*
* <li>Individual permissions always override permissions of the
* group(s) to which the individual belongs. That is, individual
* negative permissions (specific denial of permissions) override the
* groups' positive permissions. And individual positive permissions
- * override the groups' negative permissions.<p>
+ * override the groups' negative permissions.
*
* </ul>
*
- * The <code> java.security.acl </code> package provides the
+ * The {@code java.security.acl } package provides the
* interfaces to the ACL and related data structures (ACL entries,
- * groups, permissions, etc.), and the <code> sun.security.acl </code>
+ * groups, permissions, etc.), and the {@code sun.security.acl }
* classes provide a default implementation of the interfaces. For
- * example, <code> java.security.acl.Acl </code> provides the
- * interface to an ACL and the <code> sun.security.acl.AclImpl </code>
+ * example, {@code java.security.acl.Acl } provides the
+ * interface to an ACL and the {@code sun.security.acl.AclImpl }
* class provides the default implementation of the interface.<p>
*
- * The <code> java.security.acl.Acl </code> interface extends the
- * <code> java.security.acl.Owner </code> interface. The Owner
+ * The {@code java.security.acl.Acl } interface extends the
+ * {@code java.security.acl.Owner } interface. The Owner
* interface is used to maintain a list of owners for each ACL. Only
* owners are allowed to modify an ACL. For example, only an owner can
- * call the ACL's <code>addEntry</code> method to add a new ACL entry
+ * call the ACL's {@code addEntry} method to add a new ACL entry
* to the ACL.
*
* @see java.security.acl.AclEntry
@@ -159,12 +159,12 @@
* Returns an enumeration for the set of allowed permissions for the
* specified principal (representing an entity such as an individual or
* a group). This set of allowed permissions is calculated as
- * follows:<p>
+ * follows:
*
* <ul>
*
* <li>If there is no entry in this Access Control List for the
- * specified principal, an empty permission set is returned.<p>
+ * specified principal, an empty permission set is returned.
*
* <li>Otherwise, the principal's group permission sets are determined.
* (A principal can belong to one or more groups, where a group is a
@@ -217,7 +217,7 @@
* More specifically, this method checks whether the passed permission
* is a member of the allowed permission set of the specified principal.
* The allowed permission set is determined by the same algorithm as is
- * used by the <code>getPermissions</code> method.
+ * used by the {@code getPermissions} method.
*
* @param principal the principal, assumed to be a valid authenticated
* Principal.
diff --git a/ojluni/src/main/java/java/security/acl/AclEntry.java b/ojluni/src/main/java/java/security/acl/AclEntry.java
index f8dd3a7..cd9675f 100644
--- a/ojluni/src/main/java/java/security/acl/AclEntry.java
+++ b/ojluni/src/main/java/java/security/acl/AclEntry.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -84,7 +84,7 @@
* specified in the entry.
*
* Note: ACL entries are by default positive. An entry becomes a
- * negative entry only if this <code>setNegativePermissions</code>
+ * negative entry only if this {@code setNegativePermissions}
* method is called on it.
*/
public void setNegativePermissions();
diff --git a/ojluni/src/main/java/java/security/acl/Group.java b/ojluni/src/main/java/java/security/acl/Group.java
index be3578b..ebd9c44 100644
--- a/ojluni/src/main/java/java/security/acl/Group.java
+++ b/ojluni/src/main/java/java/security/acl/Group.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,7 @@
* Note that Group extends Principal. Thus, either a Principal or a Group can
* be passed as an argument to methods containing a Principal parameter. For
* example, you can add either a Principal or a Group to a Group object by
- * calling the object's <code>addMember</code> method, passing it the
+ * calling the object's {@code addMember} method, passing it the
* Principal or Group.
*
* @author Satish Dharmaraj
diff --git a/ojluni/src/main/java/java/security/acl/Owner.java b/ojluni/src/main/java/java/security/acl/Owner.java
index 3138895..2f649d4 100644
--- a/ojluni/src/main/java/java/security/acl/Owner.java
+++ b/ojluni/src/main/java/java/security/acl/Owner.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 1997, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
/**
* Interface for managing owners of Access Control Lists (ACLs) or ACL
* configurations. (Note that the Acl interface in the
- * <code> java.security.acl </code> package extends this Owner
+ * {@code java.security.acl} package extends this Owner
* interface.) The initial owner Principal should be specified as an
* argument to the constructor of the class implementing this interface.
*
diff --git a/ojluni/src/main/java/java/security/acl/package-info.java b/ojluni/src/main/java/java/security/acl/package-info.java
new file mode 100644
index 0000000..356c102
--- /dev/null
+++ b/ojluni/src/main/java/java/security/acl/package-info.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * The classes and interfaces in this package have been
+ * superseded by classes in the java.security package.
+ * See that package and, for example, java.security.Permission for details.
+ *
+ * @since JDK1.1
+ */
+package java.security.acl;
diff --git a/ojluni/src/main/java/java/security/acl/package.html b/ojluni/src/main/java/java/security/acl/package.html
deleted file mode 100755
index 497dfe8..0000000
--- a/ojluni/src/main/java/java/security/acl/package.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation. Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
--->
-
-</head>
-<body bgcolor="white">
-
-The classes and interfaces in this package have been
-superseded by classes in the java.security package.
-See that package and, for example, java.security.Permission for details.
-
-<!--
-<h2>Package Specification</h2>
-
-##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
-<ul>
- <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
- <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
-</ul>
--->
-
-@since JDK1.1
-</body>
-</html>
diff --git a/ojluni/src/main/java/java/security/cert/package.html b/ojluni/src/main/java/java/security/cert/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/java/security/interfaces/package.html b/ojluni/src/main/java/java/security/interfaces/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/java/security/package-info.java b/ojluni/src/main/java/java/security/package-info.java
new file mode 100644
index 0000000..376aa9d
--- /dev/null
+++ b/ojluni/src/main/java/java/security/package-info.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Provides the classes and interfaces for the security framework.
+ * This includes classes that implement an easily configurable,
+ * fine-grained access control security architecture.
+ * This package also supports
+ * the generation and storage of cryptographic public key pairs,
+ * as well as a number of exportable cryptographic operations
+ * including those for message digest and signature generation. Finally,
+ * this package provides classes that support signed/guarded objects
+ * and secure random number generation.
+ *
+ * Many of the classes provided in this package (the cryptographic
+ * and secure random number generator classes in particular) are
+ * provider-based. The class itself defines a programming interface
+ * to which applications may write. The implementations themselves may
+ * then be written by independent third-party vendors and plugged
+ * in seamlessly as needed. Therefore application developers may
+ * take advantage of any number of provider-based implementations
+ * without having to add or rewrite code.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ * <li><a href="{@docRoot}openjdk-redirect.html?v=8&path=/../technotes/guides/security/crypto/CryptoSpec.html">
+ * <b>Java™
+ * Cryptography Architecture (JCA) Reference Guide</b></a></li>
+ *
+ * <li>PKCS #8: Private-Key Information Syntax Standard, Version 1.2,
+ * November 1993</li>
+ *
+ * <li><a href="{@docRoot}openjdk-redirect.html?v=8&path=/../technotes/guides/security/StandardNames.html">
+ * <b>Java™
+ * Cryptography Architecture Standard Algorithm Name
+ * Documentation</b></a></li>
+ * </ul>
+ *
+ * <h2>Related Documentation</h2>
+ *
+ * For further documentation, please see:
+ * <ul>
+ * <li><a href=
+ * "{@docRoot}openjdk-redirect.html?v=8&path=/../technotes/guides/security/spec/security-spec.doc.html">
+ * <b>Java™
+ * SE Platform Security Architecture</b></a></li>
+ *
+ * <li><a href=
+ * "{@docRoot}openjdk-redirect.html?v=8&path=/../technotes/guides/security/crypto/HowToImplAProvider.html">
+ * <b>How to Implement a Provider in the
+ * Java™ Cryptography Architecture
+ * </b></a></li>
+ *
+ * <li><a href=
+ * "{@docRoot}openjdk-redirect.html?v=8&path=/../technotes/guides/security/PolicyFiles.html"><b>
+ * Default Policy Implementation and Policy File Syntax
+ * </b></a></li>
+ *
+ * <li><a href=
+ * "{@docRoot}openjdk-redirect.html?v=8&path=/../technotes/guides/security/permissions.html"><b>
+ * Permissions in the
+ * Java™ SE Development Kit (JDK)
+ * </b></a></li>
+ *
+ * <li><a href=
+ * "{@docRoot}openjdk-redirect.html?v=8&path=/../technotes/guides/security/SecurityToolsSummary.html"><b>
+ * Summary of Tools for
+ * Java™ Platform Security
+ * </b></a></li>
+ *
+ * <li><b>keytool</b>
+ * (<a href="{@docRoot}openjdk-redirect.html?v=8&path=/../technotes/tools/unix/keytool.html">
+ * for Solaris/Linux</a>)
+ * (<a href="{@docRoot}openjdk-redirect.html?v=8&path=/../technotes/tools/windows/keytool.html">
+ * for Windows</a>)
+ * </li>
+ *
+ * <li><b>jarsigner</b>
+ * (<a href="{@docRoot}openjdk-redirect.html?v=8&path=/../technotes/tools/unix/jarsigner.html">
+ * for Solaris/Linux</a>)
+ * (<a href="{@docRoot}openjdk-redirect.html?v=8&path=/../technotes/tools/windows/jarsigner.html">
+ * for Windows</a>)
+ * </li>
+ *
+ * </ul>
+ *
+ * @since 1.1
+ */
+package java.security;
diff --git a/ojluni/src/main/java/java/security/package.html b/ojluni/src/main/java/java/security/package.html
deleted file mode 100755
index 52d427a..0000000
--- a/ojluni/src/main/java/java/security/package.html
+++ /dev/null
@@ -1,117 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation. Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
--->
-
-</head>
-<body bgcolor="white">
-
-Provides the classes and interfaces for the security framework.
-This includes classes that implement an easily configurable,
-fine-grained access control security architecture.
-This package also supports
-the generation and storage of cryptographic public key pairs,
-as well as a number of exportable cryptographic operations
-including those for message digest and signature generation. Finally,
-this package provides classes that support signed/guarded objects
-and secure random number generation.
-
-Many of the classes provided in this package (the cryptographic
-and secure random number generator classes in particular) are
-provider-based. The class itself defines a programming interface
-to which applications may write. The implementations themselves may
-then be written by independent third-party vendors and plugged
-in seamlessly as needed. Therefore application developers may
-take advantage of any number of provider-based implementations
-without having to add or rewrite code.
-
-<h2>Package Specification</h2>
-
-<ul>
- <li><a href="{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/crypto/CryptoSpec.html">
- <b>Java<FONT SIZE=-2><SUP>TM</SUP></FONT>
- Cryptography Architecture (JCA) Reference Guide</b></a></li>
-
- <li>PKCS #8: Private-Key Information Syntax Standard, Version 1.2,
- November 1993</li>
-
- <li><a href="{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html">
- <b>Java<FONT SIZE=-2><SUP>TM</SUP></FONT>
- Cryptography Architecture Standard Algorithm Name
- Documentation</b></a></li>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For further documentation, please see:
-<ul>
- <li><a href=
- "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/spec/security-spec.doc.html">
- <b>Java<FONT SIZE=-2><SUP>TM</SUP></FONT>
- SE Platform Security Architecture</b></a></li>
-
- <li><a href=
- "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/crypto/HowToImplAProvider.html">
- <b>How to Implement a Provider in the
- Java<FONT SIZE=-2><SUP>TM</SUP></FONT> Cryptography Architecture
- </b></a></li>
-
- <li><a href=
- "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/PolicyFiles.html"><b>
- Default Policy Implementation and Policy File Syntax
- </b></a></li>
-
- <li><a href=
- "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/permissions.html"><b>
- Permissions in the
- Java<FONT SIZE=-2><SUP>TM</SUP></FONT> SE Development Kit (JDK)
- </b></a></li>
-
- <li><a href=
- "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/SecurityToolsSummary.html"><b>
- Summary of Tools for
- Java<FONT SIZE=-2><SUP>TM</SUP></FONT> Platform Security
- </b></a></li>
-
- <li><b>keytool</b>
- (<a href="{@docRoot}openjdk-redirect.html?v=8&path=/technotes/tools/solaris/keytool.html">
- for Solaris/Linux</a>)
- (<a href="{@docRoot}openjdk-redirect.html?v=8&path=/technotes/tools/windows/keytool.html">
- for Windows</a>)
- </li>
-
- <li><b>jarsigner</b>
- (<a href="{@docRoot}openjdk-redirect.html?v=8&path=/technotes/tools/solaris/jarsigner.html">
- for Solaris/Linux</a>)
- (<a href="{@docRoot}openjdk-redirect.html?v=8&path=/technotes/tools/windows/jarsigner.html">
- for Windows</a>)
- </li>
-
-</ul>
-
-@since 1.1
-</body>
-</html>
diff --git a/ojluni/src/main/java/java/security/spec/package.html b/ojluni/src/main/java/java/security/spec/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/java/sql/package.html b/ojluni/src/main/java/java/sql/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/java/text/package.html b/ojluni/src/main/java/java/text/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/java/text/spi/package.html b/ojluni/src/main/java/java/text/spi/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/java/util/jar/package.html b/ojluni/src/main/java/java/util/jar/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/java/util/logging/package.html b/ojluni/src/main/java/java/util/logging/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/java/util/package.html b/ojluni/src/main/java/java/util/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/java/util/prefs/package.html b/ojluni/src/main/java/java/util/prefs/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/java/util/regex/package.html b/ojluni/src/main/java/java/util/regex/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/java/util/spi/package.html b/ojluni/src/main/java/java/util/spi/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/java/util/zip/package.html b/ojluni/src/main/java/java/util/zip/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/javax/crypto/interfaces/package.html b/ojluni/src/main/java/javax/crypto/interfaces/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/javax/crypto/package.html b/ojluni/src/main/java/javax/crypto/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/javax/crypto/spec/package.html b/ojluni/src/main/java/javax/crypto/spec/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/javax/net/package.html b/ojluni/src/main/java/javax/net/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/javax/net/ssl/package.html b/ojluni/src/main/java/javax/net/ssl/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/javax/sql/package.html b/ojluni/src/main/java/javax/sql/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/javax/sql/rowset/package.html b/ojluni/src/main/java/javax/sql/rowset/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/sun/reflect/package.html b/ojluni/src/main/java/sun/reflect/package.html
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/sun/security/pkcs/PKCS7.java b/ojluni/src/main/java/sun/security/pkcs/PKCS7.java
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/sun/security/util/DerInputBuffer.java b/ojluni/src/main/java/sun/security/util/DerInputBuffer.java
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/sun/security/util/DerInputStream.java b/ojluni/src/main/java/sun/security/util/DerInputStream.java
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/sun/security/util/DerValue.java b/ojluni/src/main/java/sun/security/util/DerValue.java
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/java/sun/security/x509/X509CertImpl.java b/ojluni/src/main/java/sun/security/x509/X509CertImpl.java
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/Adler32.c b/ojluni/src/main/native/Adler32.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/DatagramPacket.c b/ojluni/src/main/native/DatagramPacket.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/Double.c b/ojluni/src/main/native/Double.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/FileChannelImpl.c b/ojluni/src/main/native/FileChannelImpl.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/FileDescriptor_md.c b/ojluni/src/main/native/FileDescriptor_md.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/FileDispatcherImpl.c b/ojluni/src/main/native/FileDispatcherImpl.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/FileInputStream.c b/ojluni/src/main/native/FileInputStream.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/FileKey.c b/ojluni/src/main/native/FileKey.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/FileOutputStream_md.c b/ojluni/src/main/native/FileOutputStream_md.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/FileSystem_md.c b/ojluni/src/main/native/FileSystem_md.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/Float.c b/ojluni/src/main/native/Float.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/IOUtil.c b/ojluni/src/main/native/IOUtil.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/Inet4Address.c b/ojluni/src/main/native/Inet4Address.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/Inet4AddressImpl.c b/ojluni/src/main/native/Inet4AddressImpl.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/Inet6Address.c b/ojluni/src/main/native/Inet6Address.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/Inet6AddressImpl.c b/ojluni/src/main/native/Inet6AddressImpl.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/InetAddress.c b/ojluni/src/main/native/InetAddress.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/NativeThread.c b/ojluni/src/main/native/NativeThread.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/NetworkInterface.c b/ojluni/src/main/native/NetworkInterface.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/ObjectStreamClass.c b/ojluni/src/main/native/ObjectStreamClass.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/PlainDatagramSocketImpl.c b/ojluni/src/main/native/PlainDatagramSocketImpl.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/PlainSocketImpl.c b/ojluni/src/main/native/PlainSocketImpl.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/ProcessEnvironment_md.c b/ojluni/src/main/native/ProcessEnvironment_md.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/Runtime.c b/ojluni/src/main/native/Runtime.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/SocketInputStream.c b/ojluni/src/main/native/SocketInputStream.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/SocketOutputStream.c b/ojluni/src/main/native/SocketOutputStream.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/StrictMath.c b/ojluni/src/main/native/StrictMath.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/String.c b/ojluni/src/main/native/String.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/System.c b/ojluni/src/main/native/System.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/Thread.c b/ojluni/src/main/native/Thread.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/Throwable.c b/ojluni/src/main/native/Throwable.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/UNIXProcess_md.c b/ojluni/src/main/native/UNIXProcess_md.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/UnixFileSystem_md.c b/ojluni/src/main/native/UnixFileSystem_md.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/canonicalize_md.c b/ojluni/src/main/native/canonicalize_md.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/classfile_constants.h b/ojluni/src/main/native/classfile_constants.h
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/fdlibm.h b/ojluni/src/main/native/fdlibm.h
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/io_util.h b/ojluni/src/main/native/io_util.h
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/io_util_md.c b/ojluni/src/main/native/io_util_md.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/io_util_md.h b/ojluni/src/main/native/io_util_md.h
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/java_net_Inet4AddressImpl.h b/ojluni/src/main/native/java_net_Inet4AddressImpl.h
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/java_props_md.c b/ojluni/src/main/native/java_props_md.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/jfdlibm.h b/ojluni/src/main/native/jfdlibm.h
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/jlong.h b/ojluni/src/main/native/jlong.h
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/jlong_md.h b/ojluni/src/main/native/jlong_md.h
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/jni_util.h b/ojluni/src/main/native/jni_util.h
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/jni_util_md.c b/ojluni/src/main/native/jni_util_md.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/jvm_md.h b/ojluni/src/main/native/jvm_md.h
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/linux_close.cpp b/ojluni/src/main/native/linux_close.cpp
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/net_util.c b/ojluni/src/main/native/net_util.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/net_util.h b/ojluni/src/main/native/net_util.h
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/net_util_md.c b/ojluni/src/main/native/net_util_md.c
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/net_util_md.h b/ojluni/src/main/native/net_util_md.h
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/nio.h b/ojluni/src/main/native/nio.h
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/nio_util.h b/ojluni/src/main/native/nio_util.h
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/native/zip_util.h b/ojluni/src/main/native/zip_util.h
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/resources/sun/nio/cs/standard-charsets b/ojluni/src/main/resources/sun/nio/cs/standard-charsets
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/resources/sun/util/logging/resources/logging.properties b/ojluni/src/main/resources/sun/util/logging/resources/logging.properties
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/resources/sun/util/logging/resources/logging_de.properties b/ojluni/src/main/resources/sun/util/logging/resources/logging_de.properties
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/resources/sun/util/logging/resources/logging_es.properties b/ojluni/src/main/resources/sun/util/logging/resources/logging_es.properties
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/resources/sun/util/logging/resources/logging_fr.properties b/ojluni/src/main/resources/sun/util/logging/resources/logging_fr.properties
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/resources/sun/util/logging/resources/logging_it.properties b/ojluni/src/main/resources/sun/util/logging/resources/logging_it.properties
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/resources/sun/util/logging/resources/logging_ja.properties b/ojluni/src/main/resources/sun/util/logging/resources/logging_ja.properties
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/resources/sun/util/logging/resources/logging_ko.properties b/ojluni/src/main/resources/sun/util/logging/resources/logging_ko.properties
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/resources/sun/util/logging/resources/logging_pt_BR.properties b/ojluni/src/main/resources/sun/util/logging/resources/logging_pt_BR.properties
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/resources/sun/util/logging/resources/logging_sv.properties b/ojluni/src/main/resources/sun/util/logging/resources/logging_sv.properties
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/resources/sun/util/logging/resources/logging_zh_CN.properties b/ojluni/src/main/resources/sun/util/logging/resources/logging_zh_CN.properties
old mode 100755
new mode 100644
diff --git a/ojluni/src/main/resources/sun/util/logging/resources/logging_zh_TW.properties b/ojluni/src/main/resources/sun/util/logging/resources/logging_zh_TW.properties
old mode 100755
new mode 100644
diff --git a/openjdk_java_files.mk b/openjdk_java_files.mk
index b7592fb..1fc510b 100644
--- a/openjdk_java_files.mk
+++ b/openjdk_java_files.mk
@@ -493,6 +493,7 @@
ojluni/src/main/java/java/nio/file/spi/FileSystemProvider.java \
ojluni/src/main/java/java/nio/file/spi/FileTypeDetector.java \
ojluni/src/main/java/java/nio/package-info.java \
+ ojluni/src/main/java/java/security/package-info.java \
ojluni/src/main/java/java/security/AccessControlContext.java \
ojluni/src/main/java/java/security/AccessControlException.java \
ojluni/src/main/java/java/security/AccessController.java \
@@ -504,6 +505,7 @@
ojluni/src/main/java/java/security/acl/NotOwnerException.java \
ojluni/src/main/java/java/security/acl/Owner.java \
ojluni/src/main/java/java/security/acl/Permission.java \
+ ojluni/src/main/java/java/security/acl/package-info.java \
ojluni/src/main/java/java/security/AlgorithmConstraints.java \
ojluni/src/main/java/java/security/AlgorithmParameterGenerator.java \
ojluni/src/main/java/java/security/AlgorithmParameterGeneratorSpi.java \
@@ -1152,6 +1154,7 @@
ojluni/src/main/java/sun/misc/FDBigInteger.java \
ojluni/src/main/java/sun/misc/FloatingDecimal.java \
ojluni/src/main/java/java/lang/invoke/LambdaConversionException.java \
+ ojluni/src/main/java/java/lang/invoke/MethodHandle.java \
ojluni/src/main/java/java/lang/invoke/MethodHandleStatics.java \
ojluni/src/main/java/java/lang/invoke/MethodType.java \
ojluni/src/main/java/java/lang/invoke/MethodTypeForm.java \
@@ -1603,15 +1606,21 @@
ojluni/src/main/java/sun/util/resources/OpenListResourceBundle.java \
$(openjdk_javadoc_files)
-# javac requires sections of java.lang.invoke.* to be available in the boot
-# classpath in order to compile a lambda expression in Java source. Some of
-# the classes it needs are present in core-oj, and those that aren't are
-# stubbed here. In the long term, core-oj will contain a complete
-# java.lang.invoke implementation and this list can be removed.
+# Stubs needed to satisfy javac's dependencies when compiling lambda code. These are
+# not used on Android devices or required by the Jack compiler.
+#
+# The stub files in openjdk_lambda_duplicate_stub_files are present in core-oj as
+# well, and need to be included here to support compiling against older SDKs and the
+# like. This additional bit of ugliness if required to avoid a circular dependency
+# between core-all and these stubs. Eventually, all of these stubs will become
+# "duplicates" and then that list can be renamed to "openjdk_lambda_stub_files".
openjdk_lambda_stub_files := \
ojluni/src/lambda/java/java/lang/invoke/CallSite.java \
ojluni/src/lambda/java/java/lang/invoke/LambdaMetafactory.java \
- ojluni/src/lambda/java/java/lang/invoke/MethodHandle.java \
ojluni/src/lambda/java/java/lang/invoke/MethodHandleInfo.java \
ojluni/src/lambda/java/java/lang/invoke/MethodHandles.java \
- ojluni/src/lambda/java/java/lang/invoke/SerializedLambda.java \
+ ojluni/src/lambda/java/java/lang/invoke/SerializedLambda.java
+openjdk_lambda_duplicate_stub_files := \
+ ojluni/src/lambda/java/java/lang/invoke/LambdaConversionException.java \
+ ojluni/src/lambda/java/java/lang/invoke/MethodHandle.java \
+ ojluni/src/lambda/java/java/lang/invoke/MethodType.java \