Merge "Expose rethrow* methods in the public SDK API"
diff --git a/luni/src/main/java/android/system/ErrnoException.java b/luni/src/main/java/android/system/ErrnoException.java
index 02a529f..a5edf47 100644
--- a/luni/src/main/java/android/system/ErrnoException.java
+++ b/luni/src/main/java/android/system/ErrnoException.java
@@ -19,6 +19,7 @@
import java.io.IOException;
import java.net.SocketException;
import libcore.io.Libcore;
+import libcore.util.NonNull;
/**
* A checked exception thrown when {@link Os} methods fail. This exception contains the native
@@ -65,21 +66,26 @@
}
/**
- * @hide - internal use only.
+ * Throws an {@link IOException} with a message based on {@link #getMessage()} and with this
+ * instance as the cause.
+ *
+ * <p>This method always terminates by throwing the exception. Callers can write
+ * {@code throw e.rethrowAsIOException()} to make that clear to the compiler.
*/
- @libcore.api.CorePlatformApi
- public IOException rethrowAsIOException() throws IOException {
+ public @NonNull IOException rethrowAsIOException() throws IOException {
IOException newException = new IOException(getMessage());
newException.initCause(this);
throw newException;
}
/**
- * @hide - internal use only.
+ * Throws a {@link SocketException} with a message based on {@link #getMessage()} and with this
+ * instance as the cause.
+ *
+ * <p>This method always terminates by throwing the exception. Callers can write
+ * {@code throw e.rethrowAsIOException()} to make that clear to the compiler.
*/
- @libcore.api.CorePlatformApi
- @libcore.api.IntraCoreApi
- public SocketException rethrowAsSocketException() throws SocketException {
+ public @NonNull SocketException rethrowAsSocketException() throws SocketException {
throw new SocketException(getMessage(), this);
}
}
diff --git a/mmodules/core_platform_api/api/platform/current-api.txt b/mmodules/core_platform_api/api/platform/current-api.txt
index c0c2c74..ec28ddf 100644
--- a/mmodules/core_platform_api/api/platform/current-api.txt
+++ b/mmodules/core_platform_api/api/platform/current-api.txt
@@ -71,11 +71,6 @@
package android.system {
- public final class ErrnoException extends java.lang.Exception {
- method public java.io.IOException rethrowAsIOException() throws java.io.IOException;
- method public java.net.SocketException rethrowAsSocketException() throws java.net.SocketException;
- }
-
public class Int32Ref {
ctor public Int32Ref(int);
field @dalvik.annotation.compat.UnsupportedAppUsage public int value;
diff --git a/mmodules/intracoreapi/api/intra/current-api.txt b/mmodules/intracoreapi/api/intra/current-api.txt
index a7a2fdc..9780457 100644
--- a/mmodules/intracoreapi/api/intra/current-api.txt
+++ b/mmodules/intracoreapi/api/intra/current-api.txt
@@ -1,12 +1,4 @@
// Signature format: 2.0
-package android.system {
-
- public final class ErrnoException extends java.lang.Exception {
- method @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public java.net.SocketException rethrowAsSocketException() throws java.net.SocketException;
- }
-
-}
-
package com.android.org.conscrypt {
@libcore.api.IntraCoreApi public class DESEDESecretKeyFactory extends javax.crypto.SecretKeyFactorySpi {