diff options
-rw-r--r-- | NativeCode.mk | 2 | ||||
-rw-r--r-- | luni/src/test/java/libcore/java/lang/OldRuntimeTest.java | 76 | ||||
-rw-r--r--[-rwxr-xr-x] | ojluni/src/main/java/java/lang/Runtime.java | 12 |
3 files changed, 1 insertions, 89 deletions
diff --git a/NativeCode.mk b/NativeCode.mk index e06b3ab184..72557a84da 100644 --- a/NativeCode.mk +++ b/NativeCode.mk @@ -229,7 +229,7 @@ endif LOCAL_MODULE_TAGS := optional LOCAL_MODULE := libjavacore LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/NativeCode.mk -LOCAL_SHARED_LIBRARIES += $(core_shared_libraries) libexpat-host libicuuc-host libicui18n-host libcrypto libz-host libziparchive-host +LOCAL_SHARED_LIBRARIES += $(core_shared_libraries) libexpat libicuuc-host libicui18n-host libcrypto libz-host libziparchive-host LOCAL_STATIC_LIBRARIES += $(core_static_libraries) LOCAL_MULTILIB := both LOCAL_CXX_STL := libc++ diff --git a/luni/src/test/java/libcore/java/lang/OldRuntimeTest.java b/luni/src/test/java/libcore/java/lang/OldRuntimeTest.java index 5c4d1c69d5..294cea2edb 100644 --- a/luni/src/test/java/libcore/java/lang/OldRuntimeTest.java +++ b/luni/src/test/java/libcore/java/lang/OldRuntimeTest.java @@ -27,9 +27,6 @@ import java.security.Permission; import java.util.Arrays; import java.util.Vector; import tests.support.resource.Support_Resources; -import dalvik.system.VMRuntime; -import java.lang.reflect.Method; -import java.lang.reflect.InvocationTargetException; public class OldRuntimeTest extends junit.framework.TestCase { @@ -522,77 +519,4 @@ public class OldRuntimeTest extends junit.framework.TestCase { //expected } } - // b/25859957 - public void test_loadDeprecated() throws Exception { - final int savedTargetSdkVersion = VMRuntime.getRuntime().getTargetSdkVersion(); - try { - try { - // Call Runtime#load(String, ClassLoader) at API level 24 (N). It will fail - // with a UnsatisfiedLinkError because requested library doesn't exits. - VMRuntime.getRuntime() - .setTargetSdkVersion(24); - Method loadMethod = Runtime.class.getDeclaredMethod("load", String.class, - ClassLoader.class); - loadMethod.setAccessible(true); - loadMethod.invoke(Runtime.getRuntime(), "nonExistentLibrary", null); - fail(); - } catch(InvocationTargetException expected) { - assertTrue(expected.getCause() instanceof UnsatisfiedLinkError); - } - - try { - // Call Runtime#load(String, ClassLoader) at API level 25. It will fail - // with a IllegalStateException because it's deprecated. - VMRuntime.getRuntime() - .setTargetSdkVersion(25); - Method loadMethod = Runtime.class.getDeclaredMethod("load", String.class, - ClassLoader.class); - loadMethod.setAccessible(true); - loadMethod.invoke(Runtime.getRuntime(), "nonExistentLibrary", null); - fail(); - } catch(InvocationTargetException expected) { - assertTrue(expected.getCause() instanceof IllegalStateException); - } - } finally { - VMRuntime.getRuntime().setTargetSdkVersion(savedTargetSdkVersion); - } - } - - // b/25859957 - public void test_loadLibraryDeprecated() throws Exception { - final int savedTargetSdkVersion = VMRuntime.getRuntime().getTargetSdkVersion(); - try { - try { - // Call Runtime#loadLibrary(String, ClassLoader) at API level 24 (N). It will fail - // with a UnsatisfiedLinkError because requested library doesn't exits. - VMRuntime.getRuntime() - .setTargetSdkVersion(24); - Method loadMethod = Runtime.class.getDeclaredMethod("loadLibrary", String.class, - ClassLoader.class); - loadMethod.setAccessible(true); - loadMethod.invoke(Runtime.getRuntime(), "nonExistentLibrary", null); - fail(); - } catch(InvocationTargetException expected) { - assertTrue(expected.getCause() instanceof UnsatisfiedLinkError); - } - - try { - // Call Runtime#load(String, ClassLoader) at API level 25. It will fail - // with a IllegalStateException because it's deprecated. - - VMRuntime.getRuntime() - .setTargetSdkVersion(25); - Method loadMethod = Runtime.class.getDeclaredMethod("loadLibrary", String.class, - ClassLoader.class); - loadMethod.setAccessible(true); - loadMethod.invoke(Runtime.getRuntime(), "nonExistentLibrary", null); - fail(); - } catch(InvocationTargetException expected) { - assertTrue(expected.getCause() instanceof IllegalStateException); - } - } finally { - VMRuntime.getRuntime().setTargetSdkVersion(savedTargetSdkVersion); - } - } - } diff --git a/ojluni/src/main/java/java/lang/Runtime.java b/ojluni/src/main/java/java/lang/Runtime.java index da01dcdbe9..fa0adbe8d1 100755..100644 --- a/ojluni/src/main/java/java/lang/Runtime.java +++ b/ojluni/src/main/java/java/lang/Runtime.java @@ -883,19 +883,8 @@ public class Runtime { load0(VMStack.getStackClass1(), filename); } - /** Check target sdk, if it's higher than N, we throw an UnsupportedOperationException */ - void checkTargetSdkVersionForLoad(String methodName) { - final int targetSdkVersion = VMRuntime.getRuntime().getTargetSdkVersion(); - if (targetSdkVersion > 24) { - throw new UnsupportedOperationException(methodName + " is not supported on SDK " + - targetSdkVersion); - } - } - // Fixes b/25859957 regression. Depending on private methods is bad, mkay. void load(String absolutePath, ClassLoader loader) { - checkTargetSdkVersionForLoad("java.lang.Runtime#load(String, ClassLoader)"); - java.lang.System.logE("java.lang.Runtime#load(String, ClassLoader)" + " is private and will be removed in a future Android release"); if (absolutePath == null) { @@ -981,7 +970,6 @@ public class Runtime { * @hide */ public void loadLibrary(String libname, ClassLoader classLoader) { - checkTargetSdkVersionForLoad("java.lang.Runtime#loadLibrary(String, ClassLoader)"); java.lang.System.logE("java.lang.Runtime#loadLibrary(String, ClassLoader)" + " is private and will be removed in a future Android release"); loadLibrary0(classLoader, libname); |