Merge "Fix @link tags in @ChangeId javadocs."
diff --git a/NativeCode.bp b/NativeCode.bp
index 25c128b..bdf1507 100644
--- a/NativeCode.bp
+++ b/NativeCode.bp
@@ -97,6 +97,10 @@
apex_available: [
"com.android.art.release",
"com.android.art.debug",
+ // TODO(b/147813447) remove this. This is currently due to the 'runtime_libs'
+ // dependency from libjavacrypto in the conscrypt APEX.
+ "com.android.conscrypt",
+ "test_com.android.conscrypt",
],
defaults: [
"core_native_default_flags",
diff --git a/dalvik/src/main/java/dalvik/system/BaseDexClassLoader.java b/dalvik/src/main/java/dalvik/system/BaseDexClassLoader.java
index 1993fd5..f5136a4 100644
--- a/dalvik/src/main/java/dalvik/system/BaseDexClassLoader.java
+++ b/dalvik/src/main/java/dalvik/system/BaseDexClassLoader.java
@@ -330,14 +330,7 @@
}
@Override public String toString() {
- String sharedLibs = "";
- if (sharedLibraryLoaders != null) {
- for (Object obj : sharedLibraryLoaders) {
- sharedLibs += obj + ",";
- }
- }
- return getClass().getName() + "[" + pathList + "; parent=(" + getParent()
- + "), shared-libs=(" + sharedLibs + ")]";
+ return getClass().getName() + "[" + pathList + "]";
}
/**
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/CharacterTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/CharacterTest.java
index a5007f0..2465071 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/CharacterTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/CharacterTest.java
@@ -747,8 +747,13 @@
assertTrue(Character.getType((int) '$') == Character.CURRENCY_SYMBOL);
assertTrue(Character.getType((int) '\u2029') == Character.PARAGRAPH_SEPARATOR);
+ // Unicode 13 defines a new range 0x30000–0x3134A
+ assertTrue(Character.getType(0x30000) == Character.DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR);
+ assertTrue(Character.getType(0x3134A) == Character.DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR);
+ assertTrue(Character.getType(0x2FFFF) == Character.UNASSIGNED);
+ assertTrue(Character.getType(0x3134B) == Character.UNASSIGNED);
+
assertTrue(Character.getType(0x9FFF) == Character.UNASSIGNED);
- assertTrue(Character.getType(0x30000) == Character.UNASSIGNED);
assertTrue(Character.getType(0x110000) == Character.UNASSIGNED);
assertTrue(Character.getType(0x0041) == Character.UPPERCASE_LETTER);
@@ -860,9 +865,14 @@
assertTrue(Character.isDefined((int) '\u6039'));
assertTrue(Character.isDefined(0x10300));
- assertFalse(Character.isDefined(0x30000));
assertFalse(Character.isDefined(0x3FFFF));
assertFalse(Character.isDefined(0x110000));
+
+ // Unicode 13 adds a new range 0x30000–0x3134A
+ assertTrue(Character.isDefined(0x30000));
+ assertTrue(Character.isDefined(0x3134A));
+ assertFalse(Character.isDefined(0x2FFFF));
+ assertFalse(Character.isDefined(0x3134B));
}
/**
@@ -1557,10 +1567,15 @@
*/
public void test_isDirectionaliy_I() {
assertEquals(Character.DIRECTIONALITY_UNDEFINED, Character.getDirectionality(0xFFFE));
- assertEquals(Character.DIRECTIONALITY_UNDEFINED, Character.getDirectionality(0x30000));
assertEquals(Character.DIRECTIONALITY_UNDEFINED, Character.getDirectionality(0x110000));
assertEquals(Character.DIRECTIONALITY_UNDEFINED, Character.getDirectionality(-1));
+ // Unicode 13 adds a new range 0x30000–0x3134A
+ assertEquals(Character.DIRECTIONALITY_LEFT_TO_RIGHT, Character.getDirectionality(0x30000));
+ assertEquals(Character.DIRECTIONALITY_LEFT_TO_RIGHT, Character.getDirectionality(0x3134A));
+ assertEquals(Character.DIRECTIONALITY_UNDEFINED, Character.getDirectionality(0x2FFFF));
+ assertEquals(Character.DIRECTIONALITY_UNDEFINED, Character.getDirectionality(0x3134B));
+
assertEquals(Character.DIRECTIONALITY_LEFT_TO_RIGHT, Character.getDirectionality(0x0041));
assertEquals(Character.DIRECTIONALITY_LEFT_TO_RIGHT, Character.getDirectionality(0x10000));
assertEquals(Character.DIRECTIONALITY_LEFT_TO_RIGHT, Character.getDirectionality(0x104A9));
diff --git a/luni/src/test/java/libcore/android/system/OsTest.java b/luni/src/test/java/libcore/android/system/OsTest.java
index 0c65046..b9ca0bf 100644
--- a/luni/src/test/java/libcore/android/system/OsTest.java
+++ b/luni/src/test/java/libcore/android/system/OsTest.java
@@ -87,7 +87,7 @@
}
}
- public void testFcntlInt_UdpSocket() throws Exception {
+ public void testFcntlInt_udpSocket() throws Exception {
final FileDescriptor fd = Os.socket(AF_INET, SOCK_DGRAM, 0);
try {
assertEquals(0, (Os.fcntlVoid(fd, F_GETFL) & O_NONBLOCK));
@@ -104,7 +104,7 @@
}
}
- public void testFcntlInt_InvalidCmd() throws Exception {
+ public void testFcntlInt_invalidCmd() throws Exception {
final FileDescriptor fd = Os.socket(AF_INET, SOCK_DGRAM, 0);
try {
final int unknownCmd = -1;
@@ -117,7 +117,7 @@
}
}
- public void testFcntlInt_NullFd() throws Exception {
+ public void testFcntlInt_nullFd() throws Exception {
try {
Os.fcntlInt(null, F_SETFL, O_NONBLOCK);
fail("Expected failure due to null file descriptor");
diff --git a/luni/src/test/java/libcore/java/util/ObjectsTest.java b/luni/src/test/java/libcore/java/util/ObjectsTest.java
index 735f6c5..dcaa20c 100644
--- a/luni/src/test/java/libcore/java/util/ObjectsTest.java
+++ b/luni/src/test/java/libcore/java/util/ObjectsTest.java
@@ -121,6 +121,10 @@
} catch (NullPointerException expected) {
}
+ // This does not currently throw. The presence of this test ensures that any
+ // future behavior change is deliberate.
+ assertEquals(h, Objects.requireNonNull(h, (Supplier<String>) null));
+
// The message returned by the supplier is null.
try {
Objects.requireNonNull(null, () -> null);
diff --git a/mmodules/core_platform_api/api/platform/current-api.txt b/mmodules/core_platform_api/api/platform/current-api.txt
index 2823156..9d67dc6 100644
--- a/mmodules/core_platform_api/api/platform/current-api.txt
+++ b/mmodules/core_platform_api/api/platform/current-api.txt
@@ -925,6 +925,14 @@
}
+package javax.net.ssl {
+
+ public abstract class HttpsURLConnection extends java.net.HttpURLConnection {
+ method public static javax.net.ssl.HostnameVerifier getStrictHostnameVerifier();
+ }
+
+}
+
package libcore.content.type {
public final class MimeMap {
diff --git a/mmodules/intracoreapi/api/intra/last-api.txt b/mmodules/intracoreapi/api/intra/last-api.txt
index e69de29..af707b3 100644
--- a/mmodules/intracoreapi/api/intra/last-api.txt
+++ b/mmodules/intracoreapi/api/intra/last-api.txt
@@ -0,0 +1,80 @@
+// Signature format: 2.0
+package dalvik.annotation.compat {
+
+ @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public class VersionCodes {
+ field @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public static final int Q = 29; // 0x1d
+ }
+
+}
+
+package dalvik.system {
+
+ @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public final class BlockGuard {
+ method @NonNull @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public static dalvik.system.BlockGuard.Policy getThreadPolicy();
+ }
+
+ @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public static interface BlockGuard.Policy {
+ method @libcore.api.IntraCoreApi public void onNetwork();
+ }
+
+ @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public final class CloseGuard {
+ method @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public void close();
+ method @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public static dalvik.system.CloseGuard get();
+ method @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public void open(String);
+ method @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public void warnIfOpen();
+ }
+
+}
+
+package java.net {
+
+ public class Socket implements java.io.Closeable {
+ method public java.io.FileDescriptor getFileDescriptor$();
+ }
+
+}
+
+package java.security.spec {
+
+ public class ECParameterSpec implements java.security.spec.AlgorithmParameterSpec {
+ method public String getCurveName();
+ method public void setCurveName(String);
+ }
+
+}
+
+package libcore.api {
+
+ @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.CONSTRUCTOR, java.lang.annotation.ElementType.ANNOTATION_TYPE}) @libcore.api.IntraCoreApi public @interface CorePlatformApi {
+ }
+
+ @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.CONSTRUCTOR, java.lang.annotation.ElementType.ANNOTATION_TYPE}) @libcore.api.IntraCoreApi public @interface IntraCoreApi {
+ }
+
+}
+
+package libcore.net {
+
+ @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public abstract class NetworkSecurityPolicy {
+ method @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public static libcore.net.NetworkSecurityPolicy getInstance();
+ method @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public abstract boolean isCertificateTransparencyVerificationRequired(String);
+ }
+
+}
+
+package libcore.util {
+
+ @java.lang.annotation.Documented @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.TYPE_USE}) @libcore.api.IntraCoreApi public @interface NonNull {
+ }
+
+}
+
+package sun.security.x509 {
+
+ public class AlgorithmId implements java.io.Serializable {
+ method public static sun.security.x509.AlgorithmId get(String) throws java.security.NoSuchAlgorithmException;
+ method public String getName();
+ }
+
+}
+
diff --git a/ojluni/src/main/java/java/util/concurrent/Flow.java b/ojluni/src/main/java/java/util/concurrent/Flow.java
new file mode 100644
index 0000000..0231790
--- /dev/null
+++ b/ojluni/src/main/java/java/util/concurrent/Flow.java
@@ -0,0 +1,319 @@
+/*
+ * 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.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Written by Doug Lea with assistance from members of JCP JSR-166
+ * Expert Group and released to the public domain, as explained at
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+package java.util.concurrent;
+
+// Android-changed: Remove reference to SubmissionPublisher class (not present on Android).
+/**
+ * Interrelated interfaces and static methods for establishing
+ * flow-controlled components in which {@link Publisher Publishers}
+ * produce items consumed by one or more {@link Subscriber
+ * Subscribers}, each managed by a {@link Subscription
+ * Subscription}.
+ *
+ * <p>These interfaces correspond to the <a
+ * href="http://www.reactive-streams.org/"> reactive-streams</a>
+ * specification. They apply in both concurrent and distributed
+ * asynchronous settings: All (seven) methods are defined in {@code
+ * void} "one-way" message style. Communication relies on a simple form
+ * of flow control (method {@link Subscription#request}) that can be
+ * used to avoid resource management problems that may otherwise occur
+ * in "push" based systems.
+ *
+ * <p><b>Examples.</b> A {@link Publisher} usually defines its own
+ * {@link Subscription} implementation; constructing one in method
+ * {@code subscribe} and issuing it to the calling {@link
+ * Subscriber}. It publishes items to the subscriber asynchronously,
+ * normally using an {@link Executor}. For example, here is a very
+ * simple publisher that only issues (when requested) a single {@code
+ * TRUE} item to a single subscriber. Because the subscriber receives
+ * only a single item, this class does not use buffering and ordering
+ * control required in most implementations.
+ *
+ * <pre> {@code
+ * class OneShotPublisher implements Publisher<Boolean> {
+ * private final ExecutorService executor = ForkJoinPool.commonPool(); // daemon-based
+ * private boolean subscribed; // true after first subscribe
+ * public synchronized void subscribe(Subscriber<? super Boolean> subscriber) {
+ * if (subscribed)
+ * subscriber.onError(new IllegalStateException()); // only one allowed
+ * else {
+ * subscribed = true;
+ * subscriber.onSubscribe(new OneShotSubscription(subscriber, executor));
+ * }
+ * }
+ * static class OneShotSubscription implements Subscription {
+ * private final Subscriber<? super Boolean> subscriber;
+ * private final ExecutorService executor;
+ * private Future<?> future; // to allow cancellation
+ * private boolean completed;
+ * OneShotSubscription(Subscriber<? super Boolean> subscriber,
+ * ExecutorService executor) {
+ * this.subscriber = subscriber;
+ * this.executor = executor;
+ * }
+ * public synchronized void request(long n) {
+ * if (n != 0 && !completed) {
+ * completed = true;
+ * if (n < 0) {
+ * IllegalArgumentException ex = new IllegalArgumentException();
+ * executor.execute(() -> subscriber.onError(ex));
+ * } else {
+ * future = executor.submit(() -> {
+ * subscriber.onNext(Boolean.TRUE);
+ * subscriber.onComplete();
+ * });
+ * }
+ * }
+ * }
+ * public synchronized void cancel() {
+ * completed = true;
+ * if (future != null) future.cancel(false);
+ * }
+ * }
+ * }}</pre>
+ *
+ * <p>A {@link Subscriber} arranges that items be requested and
+ * processed. Items (invocations of {@link Subscriber#onNext}) are
+ * not issued unless requested, but multiple items may be requested.
+ * Many Subscriber implementations can arrange this in the style of
+ * the following example, where a buffer size of 1 single-steps, and
+ * larger sizes usually allow for more efficient overlapped processing
+ * with less communication; for example with a value of 64, this keeps
+ * total outstanding requests between 32 and 64.
+ * Because Subscriber method invocations for a given {@link
+ * Subscription} are strictly ordered, there is no need for these
+ * methods to use locks or volatiles unless a Subscriber maintains
+ * multiple Subscriptions (in which case it is better to instead
+ * define multiple Subscribers, each with its own Subscription).
+ *
+ * <pre> {@code
+ * class SampleSubscriber<T> implements Subscriber<T> {
+ * final Consumer<? super T> consumer;
+ * Subscription subscription;
+ * final long bufferSize;
+ * long count;
+ * SampleSubscriber(long bufferSize, Consumer<? super T> consumer) {
+ * this.bufferSize = bufferSize;
+ * this.consumer = consumer;
+ * }
+ * public void onSubscribe(Subscription subscription) {
+ * long initialRequestSize = bufferSize;
+ * count = bufferSize - bufferSize / 2; // re-request when half consumed
+ * (this.subscription = subscription).request(initialRequestSize);
+ * }
+ * public void onNext(T item) {
+ * if (--count <= 0)
+ * subscription.request(count = bufferSize - bufferSize / 2);
+ * consumer.accept(item);
+ * }
+ * public void onError(Throwable ex) { ex.printStackTrace(); }
+ * public void onComplete() {}
+ * }}</pre>
+ *
+ * <p>The default value of {@link #defaultBufferSize} may provide a
+ * useful starting point for choosing request sizes and capacities in
+ * Flow components based on expected rates, resources, and usages.
+ * Or, when flow control is never needed, a subscriber may initially
+ * request an effectively unbounded number of items, as in:
+ *
+ * <pre> {@code
+ * class UnboundedSubscriber<T> implements Subscriber<T> {
+ * public void onSubscribe(Subscription subscription) {
+ * subscription.request(Long.MAX_VALUE); // effectively unbounded
+ * }
+ * public void onNext(T item) { use(item); }
+ * public void onError(Throwable ex) { ex.printStackTrace(); }
+ * public void onComplete() {}
+ * void use(T item) { ... }
+ * }}</pre>
+ *
+ * @author Doug Lea
+ * @since 9
+ */
+public final class Flow {
+
+ private Flow() {} // uninstantiable
+
+ /**
+ * A producer of items (and related control messages) received by
+ * Subscribers. Each current {@link Subscriber} receives the same
+ * items (via method {@code onNext}) in the same order, unless
+ * drops or errors are encountered. If a Publisher encounters an
+ * error that does not allow items to be issued to a Subscriber,
+ * that Subscriber receives {@code onError}, and then receives no
+ * further messages. Otherwise, when it is known that no further
+ * messages will be issued to it, a subscriber receives {@code
+ * onComplete}. Publishers ensure that Subscriber method
+ * invocations for each subscription are strictly ordered in <a
+ * href="package-summary.html#MemoryVisibility"><i>happens-before</i></a>
+ * order.
+ *
+ * <p>Publishers may vary in policy about whether drops (failures
+ * to issue an item because of resource limitations) are treated
+ * as unrecoverable errors. Publishers may also vary about
+ * whether Subscribers receive items that were produced or
+ * available before they subscribed.
+ *
+ * @param <T> the published item type
+ */
+ @FunctionalInterface
+ public static interface Publisher<T> {
+ /**
+ * Adds the given Subscriber if possible. If already
+ * subscribed, or the attempt to subscribe fails due to policy
+ * violations or errors, the Subscriber's {@code onError}
+ * method is invoked with an {@link IllegalStateException}.
+ * Otherwise, the Subscriber's {@code onSubscribe} method is
+ * invoked with a new {@link Subscription}. Subscribers may
+ * enable receiving items by invoking the {@code request}
+ * method of this Subscription, and may unsubscribe by
+ * invoking its {@code cancel} method.
+ *
+ * @param subscriber the subscriber
+ * @throws NullPointerException if subscriber is null
+ */
+ public void subscribe(Subscriber<? super T> subscriber);
+ }
+
+ /**
+ * A receiver of messages. The methods in this interface are
+ * invoked in strict sequential order for each {@link
+ * Subscription}.
+ *
+ * @param <T> the subscribed item type
+ */
+ public static interface Subscriber<T> {
+ /**
+ * Method invoked prior to invoking any other Subscriber
+ * methods for the given Subscription. If this method throws
+ * an exception, resulting behavior is not guaranteed, but may
+ * cause the Subscription not to be established or to be cancelled.
+ *
+ * <p>Typically, implementations of this method invoke {@code
+ * subscription.request} to enable receiving items.
+ *
+ * @param subscription a new subscription
+ */
+ public void onSubscribe(Subscription subscription);
+
+ /**
+ * Method invoked with a Subscription's next item. If this
+ * method throws an exception, resulting behavior is not
+ * guaranteed, but may cause the Subscription to be cancelled.
+ *
+ * @param item the item
+ */
+ public void onNext(T item);
+
+ /**
+ * Method invoked upon an unrecoverable error encountered by a
+ * Publisher or Subscription, after which no other Subscriber
+ * methods are invoked by the Subscription. If this method
+ * itself throws an exception, resulting behavior is
+ * undefined.
+ *
+ * @param throwable the exception
+ */
+ public void onError(Throwable throwable);
+
+ /**
+ * Method invoked when it is known that no additional
+ * Subscriber method invocations will occur for a Subscription
+ * that is not already terminated by error, after which no
+ * other Subscriber methods are invoked by the Subscription.
+ * If this method throws an exception, resulting behavior is
+ * undefined.
+ */
+ public void onComplete();
+ }
+
+ /**
+ * Message control linking a {@link Publisher} and {@link
+ * Subscriber}. Subscribers receive items only when requested,
+ * and may cancel at any time. The methods in this interface are
+ * intended to be invoked only by their Subscribers; usages in
+ * other contexts have undefined effects.
+ */
+ public static interface Subscription {
+ /**
+ * Adds the given number {@code n} of items to the current
+ * unfulfilled demand for this subscription. If {@code n} is
+ * less than or equal to zero, the Subscriber will receive an
+ * {@code onError} signal with an {@link
+ * IllegalArgumentException} argument. Otherwise, the
+ * Subscriber will receive up to {@code n} additional {@code
+ * onNext} invocations (or fewer if terminated).
+ *
+ * @param n the increment of demand; a value of {@code
+ * Long.MAX_VALUE} may be considered as effectively unbounded
+ */
+ public void request(long n);
+
+ /**
+ * Causes the Subscriber to (eventually) stop receiving
+ * messages. Implementation is best-effort -- additional
+ * messages may be received after invoking this method.
+ * A cancelled subscription need not ever receive an
+ * {@code onComplete} or {@code onError} signal.
+ */
+ public void cancel();
+ }
+
+ /**
+ * A component that acts as both a Subscriber and Publisher.
+ *
+ * @param <T> the subscribed item type
+ * @param <R> the published item type
+ */
+ public static interface Processor<T,R> extends Subscriber<T>, Publisher<R> {
+ }
+
+ static final int DEFAULT_BUFFER_SIZE = 256;
+
+ /**
+ * Returns a default value for Publisher or Subscriber buffering,
+ * that may be used in the absence of other constraints.
+ *
+ * @implNote
+ * The current value returned is 256.
+ *
+ * @return the buffer size value
+ */
+ public static int defaultBufferSize() {
+ return DEFAULT_BUFFER_SIZE;
+ }
+
+}
diff --git a/ojluni/src/main/java/javax/net/ssl/HttpsURLConnection.java b/ojluni/src/main/java/javax/net/ssl/HttpsURLConnection.java
index b71d11a..c3e3c30 100644
--- a/ojluni/src/main/java/javax/net/ssl/HttpsURLConnection.java
+++ b/ojluni/src/main/java/javax/net/ssl/HttpsURLConnection.java
@@ -30,6 +30,7 @@
import java.net.HttpURLConnection;
import java.security.Principal;
import java.security.cert.X509Certificate;
+import libcore.api.CorePlatformApi;
/**
* <code>HttpsURLConnection</code> extends <code>HttpURLConnection</code>
@@ -186,6 +187,8 @@
* Holds the default instance so class preloading doesn't create an instance of
* it.
*/
+ private static final String OK_HOSTNAME_VERIFIER_CLASS
+ = "com.android.okhttp.internal.tls.OkHostnameVerifier";
private static class NoPreloadHolder {
public static HostnameVerifier defaultHostnameVerifier;
static {
@@ -197,7 +200,7 @@
* the server name from the certificate mismatch.
*/
defaultHostnameVerifier = (HostnameVerifier)
- Class.forName("com.android.okhttp.internal.tls.OkHostnameVerifier")
+ Class.forName(OK_HOSTNAME_VERIFIER_CLASS)
.getField("INSTANCE").get(null);
} catch (Exception e) {
throw new AssertionError("Failed to obtain okhttp HostnameVerifier", e);
@@ -319,6 +322,30 @@
hostnameVerifier = v;
}
+ // BEGIN Android-added: Core platform API to obtain a strict hostname verifier
+ /**
+ * Obtains a stricter <code>HostnameVerifier</code>.
+ *
+ * The <code>HostnameVerifier</code> returned by this method will reject certificates
+ * with wildcards for top-level domains such "*.com".
+ *
+ * @see com.squareup.okhttp.internal.tls.OkHostnameVerifier
+ *
+ * @hide
+ */
+ @CorePlatformApi
+ public static HostnameVerifier getStrictHostnameVerifier() {
+ try {
+ return (HostnameVerifier) Class
+ .forName(OK_HOSTNAME_VERIFIER_CLASS)
+ .getMethod("strictInstance")
+ .invoke(null);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+ // END Android-added: Core platform API to obtain a strict hostname verifier
+
/**
* Gets the <code>HostnameVerifier</code> in place on this instance.
*
diff --git a/openjdk_java_files.bp b/openjdk_java_files.bp
index 57f6251..0db67c7 100644
--- a/openjdk_java_files.bp
+++ b/openjdk_java_files.bp
@@ -1435,6 +1435,7 @@
"ojluni/src/main/java/java/time/zone/IcuZoneRulesProvider.java",
"ojluni/src/main/java/java/time/zone/ZoneRulesProvider.java",
"ojluni/src/main/java/java/util/JapaneseImperialCalendar.java",
+ "ojluni/src/main/java/java/util/concurrent/Flow.java",
"ojluni/src/main/java/sun/misc/FDBigInteger.java",
"ojluni/src/main/java/sun/misc/FloatingDecimal.java",
"ojluni/src/main/java/jdk/net/ExtendedSocketOptions.java",
diff --git a/tools/upstream/src/main/java/libcore/CompareUpstreams.java b/tools/upstream/src/main/java/libcore/CompareUpstreams.java
index bdd2364..0f4de21 100644
--- a/tools/upstream/src/main/java/libcore/CompareUpstreams.java
+++ b/tools/upstream/src/main/java/libcore/CompareUpstreams.java
@@ -170,8 +170,7 @@
: null;
for (Path relPath : relPaths) {
- Repository expectedUpstream = standardRepositories.referenceUpstreamAsOfAndroidP(
- relPath);
+ Repository expectedUpstream = standardRepositories.referenceUpstream(relPath);
out.print(relPath + "\t");
Path ojluniFile = standardRepositories.ojluni().absolutePath(relPath);
List<String> linesB = Util.readLines(ojluniFile);
diff --git a/tools/upstream/src/main/java/libcore/CopyUpstreamFiles.java b/tools/upstream/src/main/java/libcore/CopyUpstreamFiles.java
index 7137861..807607f 100644
--- a/tools/upstream/src/main/java/libcore/CopyUpstreamFiles.java
+++ b/tools/upstream/src/main/java/libcore/CopyUpstreamFiles.java
@@ -45,8 +45,7 @@
}
}
for (Path relPath : relPaths) {
- Repository expectedUpstream = standardRepositories.referenceUpstreamAsOfAndroidP(
- relPath);
+ Repository expectedUpstream = standardRepositories.referenceUpstream(relPath);
for (Repository upstream : standardRepositories.upstreams()) {
Path upstreamFile = upstream.absolutePath(relPath);
if (upstreamFile != null) {
diff --git a/tools/upstream/src/main/java/libcore/StandardRepositories.java b/tools/upstream/src/main/java/libcore/StandardRepositories.java
index 31efe94..ad0335b 100644
--- a/tools/upstream/src/main/java/libcore/StandardRepositories.java
+++ b/tools/upstream/src/main/java/libcore/StandardRepositories.java
@@ -37,6 +37,7 @@
private final List<Repository> historicUpstreams;
private final Repository openJdk8u121;
private final Repository openJdk9b113;
+ private final Repository openJdk9p181;
private final Repository openJdk7u40;
private final OjluniRepository ojluni;
@@ -46,6 +47,7 @@
allUpstreams.add(openJdk9(upstreamRoot, "9+181"));
this.openJdk9b113 = addAndReturn(allUpstreams, openJdk9(upstreamRoot, "9b113+"));
this.openJdk8u121 = addAndReturn(allUpstreams, openJdkLegacy(upstreamRoot, "8u121-b13"));
+ this.openJdk9p181 = addAndReturn(allUpstreams, openJdk9(upstreamRoot, "9+181"));
Repository openJdk8u60 = addAndReturn(allUpstreams, openJdkLegacy(upstreamRoot, "8u60"));
this.openJdk7u40 = addAndReturn(allUpstreams, openJdkLegacy(upstreamRoot, "7u40"));
this.allUpstreams = Collections.unmodifiableList(new ArrayList<>(allUpstreams));
@@ -109,9 +111,11 @@
return result;
}
- public Repository referenceUpstreamAsOfAndroidP(Path relPath) {
+ public Repository referenceUpstream(Path relPath) {
boolean isJsr166 = isJsr166(relPath);
- if (isJsr166) {
+ if (relPath.toString().equals("java/util/concurrent/Flow.java")) {
+ return openJdk9p181;
+ } else if (isJsr166) {
return openJdk9b113;
} else if (relPath.startsWith("java/sql/") || relPath.startsWith("javax/sql/")) {
return openJdk7u40;