Add the JNINativeMethod table constification patchsets from GrapheneOS

11 63b9f96a12
11 d8a62b5156
11 e3a4d64f29
11 e41f1d7f8e
11 c34b037486
11 dce2d0f64f
11 c99c35cb2a
10 07071814db
10 a48ba29b98
10 157fa78115
10 b914409e05
10 20a51f508b
10 b8afb8af37
10 e1b6653db7
9 ff688b68a7
9 866f0df315
9 77c9fa981a
9 fbf620e59c
9 ceaf63c790
9 253247fc39
9 76bf4c46f0

Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
Tad 2022-03-15 14:57:53 -04:00
parent ad579b6681
commit f015dd348f
25 changed files with 5585 additions and 0 deletions

View File

@ -0,0 +1,469 @@
From 76bf4c46f0090423ead013f02c6b0b4e58b33c95 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Sun, 17 Mar 2019 21:05:42 -0400
Subject: [PATCH] constify JNINativeMethod tables
---
benchmark/micro-native/micro_native.cc | 8 ++++----
runtime/native/dalvik_system_DexFile.cc | 2 +-
runtime/native/dalvik_system_VMDebug.cc | 2 +-
runtime/native/dalvik_system_VMRuntime.cc | 2 +-
runtime/native/dalvik_system_VMStack.cc | 2 +-
runtime/native/dalvik_system_ZygoteHooks.cc | 2 +-
runtime/native/java_lang_Class.cc | 2 +-
runtime/native/java_lang_Object.cc | 2 +-
runtime/native/java_lang_String.cc | 2 +-
runtime/native/java_lang_StringFactory.cc | 2 +-
runtime/native/java_lang_System.cc | 2 +-
runtime/native/java_lang_Thread.cc | 2 +-
runtime/native/java_lang_Throwable.cc | 2 +-
runtime/native/java_lang_VMClassLoader.cc | 2 +-
runtime/native/java_lang_invoke_MethodHandleImpl.cc | 2 +-
runtime/native/java_lang_ref_FinalizerReference.cc | 2 +-
runtime/native/java_lang_ref_Reference.cc | 2 +-
runtime/native/java_lang_reflect_Array.cc | 2 +-
runtime/native/java_lang_reflect_Constructor.cc | 2 +-
runtime/native/java_lang_reflect_Executable.cc | 2 +-
runtime/native/java_lang_reflect_Field.cc | 2 +-
runtime/native/java_lang_reflect_Method.cc | 2 +-
runtime/native/java_lang_reflect_Parameter.cc | 2 +-
runtime/native/java_lang_reflect_Proxy.cc | 2 +-
runtime/native/java_util_concurrent_atomic_AtomicLong.cc | 2 +-
runtime/native/libcore_util_CharsetUtils.cc | 2 +-
.../native/org_apache_harmony_dalvik_ddmc_DdmServer.cc | 2 +-
.../org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc | 2 +-
runtime/native/sun_misc_Unsafe.cc | 2 +-
test/004-JniTest/jni_test.cc | 2 +-
test/139-register-natives/regnative.cc | 2 +-
31 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/benchmark/micro-native/micro_native.cc b/benchmark/micro-native/micro_native.cc
index dffbf3b11d..e70366cc48 100644
--- a/benchmark/micro-native/micro_native.cc
+++ b/benchmark/micro-native/micro_native.cc
@@ -38,7 +38,7 @@
static void NativeMethods_emptyJniStaticSynchronizedMethod0(JNIEnv*, jclass) { }
static void NativeMethods_emptyJniSynchronizedMethod0(JNIEnv*, jclass) { }
-static JNINativeMethod gMethods_NormalOnly[] = {
+static const JNINativeMethod gMethods_NormalOnly[] = {
NATIVE_METHOD(NativeMethods, emptyJniStaticSynchronizedMethod0, "()V"),
NATIVE_METHOD(NativeMethods, emptyJniSynchronizedMethod0, "()V"),
};
@@ -53,7 +53,7 @@ static void NativeMethods_emptyJniStaticMethod6L(JNIEnv*, jclass, jobject, jarra
static void NativeMethods_emptyJniStaticMethod0(JNIEnv*, jclass) { }
static void NativeMethods_emptyJniStaticMethod6(JNIEnv*, jclass, int, int, int, int, int, int) { }
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeMethods, emptyJniMethod0, "()V"),
NATIVE_METHOD(NativeMethods, emptyJniMethod6, "(IIIIII)V"),
NATIVE_METHOD(NativeMethods, emptyJniMethod6L, "(Ljava/lang/String;[Ljava/lang/String;[[ILjava/lang/Object;[Ljava/lang/Object;[[[[Ljava/lang/Object;)V"),
@@ -72,7 +72,7 @@ static void NativeMethods_emptyJniStaticMethod6L_Fast(JNIEnv*, jclass, jobject,
static void NativeMethods_emptyJniStaticMethod0_Fast(JNIEnv*, jclass) { }
static void NativeMethods_emptyJniStaticMethod6_Fast(JNIEnv*, jclass, int, int, int, int, int, int) { }
-static JNINativeMethod gMethods_Fast[] = {
+static const JNINativeMethod gMethods_Fast[] = {
NATIVE_METHOD(NativeMethods, emptyJniMethod0_Fast, "()V"),
NATIVE_METHOD(NativeMethods, emptyJniMethod6_Fast, "(IIIIII)V"),
NATIVE_METHOD(NativeMethods, emptyJniMethod6L_Fast, "(Ljava/lang/String;[Ljava/lang/String;[[ILjava/lang/Object;[Ljava/lang/Object;[[[[Ljava/lang/Object;)V"),
@@ -88,7 +88,7 @@ DEFINE_CRITICAL_JNI_METHOD(void, emptyJniStaticMethod0_1Critical)() { }
DEFINE_NORMAL_JNI_METHOD(void, emptyJniStaticMethod6_1Critical)(JNIEnv*, jclass, int, int, int, int, int, int) { }
DEFINE_CRITICAL_JNI_METHOD(void, emptyJniStaticMethod6_1Critical)(int, int, int, int, int, int) { }
-static JNINativeMethod gMethods_Critical[] = {
+static const JNINativeMethod gMethods_Critical[] = {
// Don't use NATIVE_METHOD because the name is mangled differently.
{ "emptyJniStaticMethod0_Critical", "()V",
reinterpret_cast<void*>(NAME_CRITICAL_JNI_METHOD(emptyJniStaticMethod0_1Critical)) },
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc
index 637e7facaf..19fd16c398 100644
--- a/runtime/native/dalvik_system_DexFile.cc
+++ b/runtime/native/dalvik_system_DexFile.cc
@@ -838,7 +838,7 @@ static void DexFile_setTrusted(JNIEnv* env, jclass, jobject j_cookie) {
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(DexFile, closeDexFile, "(Ljava/lang/Object;)Z"),
NATIVE_METHOD(DexFile,
defineClassNative,
diff --git a/runtime/native/dalvik_system_VMDebug.cc b/runtime/native/dalvik_system_VMDebug.cc
index 0955e86c4a..b55e687e31 100644
--- a/runtime/native/dalvik_system_VMDebug.cc
+++ b/runtime/native/dalvik_system_VMDebug.cc
@@ -592,7 +592,7 @@ static void VMDebug_allowHiddenApiReflectionFrom(JNIEnv* env, jclass, jclass j_c
h_caller->SetSkipHiddenApiChecks();
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(VMDebug, countInstancesOfClass, "(Ljava/lang/Class;Z)J"),
NATIVE_METHOD(VMDebug, countInstancesOfClasses, "([Ljava/lang/Class;Z)[J"),
NATIVE_METHOD(VMDebug, crash, "()V"),
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc
index 12332d2c59..4f51567c8d 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -699,7 +699,7 @@ static void VMRuntime_setProcessPackageName(JNIEnv* env,
Runtime::Current()->SetProcessPackageName(package_name.c_str());
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(VMRuntime, addressOf, "(Ljava/lang/Object;)J"),
NATIVE_METHOD(VMRuntime, bootClassPath, "()Ljava/lang/String;"),
NATIVE_METHOD(VMRuntime, clampGrowthLimit, "()V"),
diff --git a/runtime/native/dalvik_system_VMStack.cc b/runtime/native/dalvik_system_VMStack.cc
index ed0eb97da1..57439fe5e0 100644
--- a/runtime/native/dalvik_system_VMStack.cc
+++ b/runtime/native/dalvik_system_VMStack.cc
@@ -169,7 +169,7 @@ static jobjectArray VMStack_getAnnotatedThreadStackTrace(JNIEnv* env, jclass, jo
return GetThreadStack(soa, javaThread, fn);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(VMStack, fillStackTraceElements, "(Ljava/lang/Thread;[Ljava/lang/StackTraceElement;)I"),
FAST_NATIVE_METHOD(VMStack, getCallingClassLoader, "()Ljava/lang/ClassLoader;"),
FAST_NATIVE_METHOD(VMStack, getClosestUserClassLoader, "()Ljava/lang/ClassLoader;"),
diff --git a/runtime/native/dalvik_system_ZygoteHooks.cc b/runtime/native/dalvik_system_ZygoteHooks.cc
index 891cdfab1a..7cbca8d75f 100644
--- a/runtime/native/dalvik_system_ZygoteHooks.cc
+++ b/runtime/native/dalvik_system_ZygoteHooks.cc
@@ -413,7 +413,7 @@ static void ZygoteHooks_stopZygoteNoThreadCreation(JNIEnv* env ATTRIBUTE_UNUSED,
Runtime::Current()->SetZygoteNoThreadSection(false);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ZygoteHooks, nativePreFork, "()J"),
NATIVE_METHOD(ZygoteHooks, nativePostForkChild, "(JIZZLjava/lang/String;)V"),
NATIVE_METHOD(ZygoteHooks, startZygoteNoThreadCreation, "()V"),
diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc
index c07c32ad1c..b9ee535618 100644
--- a/runtime/native/java_lang_Class.cc
+++ b/runtime/native/java_lang_Class.cc
@@ -880,7 +880,7 @@ static jobject Class_newInstance(JNIEnv* env, jobject javaThis) {
return soa.AddLocalReference<jobject>(receiver.Get());
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Class, classForName,
"(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;"),
FAST_NATIVE_METHOD(Class, getDeclaredAnnotation,
diff --git a/runtime/native/java_lang_Object.cc b/runtime/native/java_lang_Object.cc
index d52bf0490b..a603d80841 100644
--- a/runtime/native/java_lang_Object.cc
+++ b/runtime/native/java_lang_Object.cc
@@ -57,7 +57,7 @@ static jint Object_identityHashCodeNative(JNIEnv* env, jclass, jobject javaObjec
return static_cast<jint>(o->IdentityHashCode());
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Object, internalClone, "()Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Object, notify, "()V"),
FAST_NATIVE_METHOD(Object, notifyAll, "()V"),
diff --git a/runtime/native/java_lang_String.cc b/runtime/native/java_lang_String.cc
index b5aea7ca7c..4ecf5e0c64 100644
--- a/runtime/native/java_lang_String.cc
+++ b/runtime/native/java_lang_String.cc
@@ -109,7 +109,7 @@ static jcharArray String_toCharArray(JNIEnv* env, jobject java_this) {
return soa.AddLocalReference<jcharArray>(s->ToCharArray(soa.Self()));
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(String, charAt, "(I)C"),
FAST_NATIVE_METHOD(String, compareTo, "(Ljava/lang/String;)I"),
FAST_NATIVE_METHOD(String, concat, "(Ljava/lang/String;)Ljava/lang/String;"),
diff --git a/runtime/native/java_lang_StringFactory.cc b/runtime/native/java_lang_StringFactory.cc
index 136a02f8f6..0d2dd653e9 100644
--- a/runtime/native/java_lang_StringFactory.cc
+++ b/runtime/native/java_lang_StringFactory.cc
@@ -88,7 +88,7 @@ static jstring StringFactory_newStringFromString(JNIEnv* env, jclass, jstring to
return soa.AddLocalReference<jstring>(result);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(StringFactory, newStringFromBytes, "([BIII)Ljava/lang/String;"),
FAST_NATIVE_METHOD(StringFactory, newStringFromChars, "(II[C)Ljava/lang/String;"),
FAST_NATIVE_METHOD(StringFactory, newStringFromString, "(Ljava/lang/String;)Ljava/lang/String;"),
diff --git a/runtime/native/java_lang_System.cc b/runtime/native/java_lang_System.cc
index 390f026588..ebcbf7b687 100644
--- a/runtime/native/java_lang_System.cc
+++ b/runtime/native/java_lang_System.cc
@@ -235,7 +235,7 @@ static void System_arraycopyBooleanUnchecked(JNIEnv* env,
javaDst, dstPos, count);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(System, arraycopy, "(Ljava/lang/Object;ILjava/lang/Object;II)V"),
FAST_NATIVE_METHOD(System, arraycopyCharUnchecked, "([CI[CII)V"),
FAST_NATIVE_METHOD(System, arraycopyByteUnchecked, "([BI[BII)V"),
diff --git a/runtime/native/java_lang_Thread.cc b/runtime/native/java_lang_Thread.cc
index 9a52f7002b..c2fc4ceb45 100644
--- a/runtime/native/java_lang_Thread.cc
+++ b/runtime/native/java_lang_Thread.cc
@@ -194,7 +194,7 @@ static void Thread_yield(JNIEnv*, jobject) {
sched_yield();
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Thread, currentThread, "()Ljava/lang/Thread;"),
FAST_NATIVE_METHOD(Thread, interrupted, "()Z"),
FAST_NATIVE_METHOD(Thread, isInterrupted, "()Z"),
diff --git a/runtime/native/java_lang_Throwable.cc b/runtime/native/java_lang_Throwable.cc
index 03b7f9dfba..fc8d438146 100644
--- a/runtime/native/java_lang_Throwable.cc
+++ b/runtime/native/java_lang_Throwable.cc
@@ -38,7 +38,7 @@ static jobjectArray Throwable_nativeGetStackTrace(JNIEnv* env, jclass, jobject j
return Thread::InternalStackTraceToStackTraceElementArray(soa, javaStackState);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Throwable, nativeFillInStackTrace, "()Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Throwable, nativeGetStackTrace, "(Ljava/lang/Object;)[Ljava/lang/StackTraceElement;"),
};
diff --git a/runtime/native/java_lang_VMClassLoader.cc b/runtime/native/java_lang_VMClassLoader.cc
index 3a0d76032e..493aed9a18 100644
--- a/runtime/native/java_lang_VMClassLoader.cc
+++ b/runtime/native/java_lang_VMClassLoader.cc
@@ -149,7 +149,7 @@ static jobjectArray VMClassLoader_getBootClassPathEntries(JNIEnv* env, jclass) {
return array;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(VMClassLoader, findLoadedClass, "(Ljava/lang/ClassLoader;Ljava/lang/String;)Ljava/lang/Class;"),
NATIVE_METHOD(VMClassLoader, getBootClassPathEntries, "()[Ljava/lang/String;"),
};
diff --git a/runtime/native/java_lang_invoke_MethodHandleImpl.cc b/runtime/native/java_lang_invoke_MethodHandleImpl.cc
index 2e3b4d41ef..7e602e34f2 100644
--- a/runtime/native/java_lang_invoke_MethodHandleImpl.cc
+++ b/runtime/native/java_lang_invoke_MethodHandleImpl.cc
@@ -68,7 +68,7 @@ static jobject MethodHandleImpl_getMemberInternal(JNIEnv* env, jobject thiz) {
return soa.AddLocalReference<jobject>(h_object.Get());
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(MethodHandleImpl, getMemberInternal, "()Ljava/lang/reflect/Member;"),
};
diff --git a/runtime/native/java_lang_ref_FinalizerReference.cc b/runtime/native/java_lang_ref_FinalizerReference.cc
index 72af5f7ea7..cfdae81933 100644
--- a/runtime/native/java_lang_ref_FinalizerReference.cc
+++ b/runtime/native/java_lang_ref_FinalizerReference.cc
@@ -42,7 +42,7 @@ static jobject FinalizerReference_getReferent(JNIEnv* env, jobject javaThis) {
return soa.AddLocalReference<jobject>(referent);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(FinalizerReference, makeCircularListIfUnenqueued, "()Z"),
FAST_NATIVE_METHOD(FinalizerReference, getReferent, "()Ljava/lang/Object;"),
};
diff --git a/runtime/native/java_lang_ref_Reference.cc b/runtime/native/java_lang_ref_Reference.cc
index 524a18ca20..2aa7bf64e2 100644
--- a/runtime/native/java_lang_ref_Reference.cc
+++ b/runtime/native/java_lang_ref_Reference.cc
@@ -42,7 +42,7 @@ static void Reference_clearReferent(JNIEnv* env, jobject javaThis) {
Runtime::Current()->GetHeap()->GetReferenceProcessor()->ClearReferent(ref);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Reference, getReferent, "()Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Reference, clearReferent, "()V"),
};
diff --git a/runtime/native/java_lang_reflect_Array.cc b/runtime/native/java_lang_reflect_Array.cc
index d28f74158e..e1af26c618 100644
--- a/runtime/native/java_lang_reflect_Array.cc
+++ b/runtime/native/java_lang_reflect_Array.cc
@@ -74,7 +74,7 @@ static jobject Array_createObjectArray(JNIEnv* env, jclass, jclass javaElementCl
return soa.AddLocalReference<jobject>(new_array);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Array, createMultiArray, "(Ljava/lang/Class;[I)Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Array, createObjectArray, "(Ljava/lang/Class;I)Ljava/lang/Object;"),
};
diff --git a/runtime/native/java_lang_reflect_Constructor.cc b/runtime/native/java_lang_reflect_Constructor.cc
index 86124388bc..9b3c74d05c 100644
--- a/runtime/native/java_lang_reflect_Constructor.cc
+++ b/runtime/native/java_lang_reflect_Constructor.cc
@@ -126,7 +126,7 @@ static jobject Constructor_newInstanceFromSerialization(JNIEnv* env, jclass unus
return env->NewObject(allocClass, ctor);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Constructor, getExceptionTypes, "()[Ljava/lang/Class;"),
FAST_NATIVE_METHOD(Constructor, newInstance0, "([Ljava/lang/Object;)Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Constructor, newInstanceFromSerialization, "(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/Object;"),
diff --git a/runtime/native/java_lang_reflect_Executable.cc b/runtime/native/java_lang_reflect_Executable.cc
index b129c66759..83719da085 100644
--- a/runtime/native/java_lang_reflect_Executable.cc
+++ b/runtime/native/java_lang_reflect_Executable.cc
@@ -389,7 +389,7 @@ static jint Executable_getParameterCountInternal(JNIEnv* env, jobject javaMethod
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Executable, compareMethodParametersInternal,
"(Ljava/lang/reflect/Method;)I"),
FAST_NATIVE_METHOD(Executable, getAnnotationNative,
diff --git a/runtime/native/java_lang_reflect_Field.cc b/runtime/native/java_lang_reflect_Field.cc
index 13275d92e4..f81c2da89f 100644
--- a/runtime/native/java_lang_reflect_Field.cc
+++ b/runtime/native/java_lang_reflect_Field.cc
@@ -503,7 +503,7 @@ static jboolean Field_isAnnotationPresentNative(JNIEnv* env,
return annotations::IsFieldAnnotationPresent(field, klass);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Field, get, "(Ljava/lang/Object;)Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Field, getBoolean, "(Ljava/lang/Object;)Z"),
FAST_NATIVE_METHOD(Field, getByte, "(Ljava/lang/Object;)B"),
diff --git a/runtime/native/java_lang_reflect_Method.cc b/runtime/native/java_lang_reflect_Method.cc
index 4355c06acd..a924be1be6 100644
--- a/runtime/native/java_lang_reflect_Method.cc
+++ b/runtime/native/java_lang_reflect_Method.cc
@@ -87,7 +87,7 @@ static jobject Method_invoke(JNIEnv* env, jobject javaMethod, jobject javaReceiv
return InvokeMethod(soa, javaMethod, javaReceiver, javaArgs);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Method, getDefaultValue, "()Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Method, getExceptionTypes, "()[Ljava/lang/Class;"),
FAST_NATIVE_METHOD(Method, invoke, "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;"),
diff --git a/runtime/native/java_lang_reflect_Parameter.cc b/runtime/native/java_lang_reflect_Parameter.cc
index b80b20cd8d..c5d320c1bd 100644
--- a/runtime/native/java_lang_reflect_Parameter.cc
+++ b/runtime/native/java_lang_reflect_Parameter.cc
@@ -98,7 +98,7 @@ static jobject Parameter_getAnnotationNative(JNIEnv* env,
annotations::GetAnnotationForMethodParameter(method, parameterIndex, klass));
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(
Parameter,
getAnnotationNative,
diff --git a/runtime/native/java_lang_reflect_Proxy.cc b/runtime/native/java_lang_reflect_Proxy.cc
index 691ed28b0b..85e31f6c8c 100644
--- a/runtime/native/java_lang_reflect_Proxy.cc
+++ b/runtime/native/java_lang_reflect_Proxy.cc
@@ -37,7 +37,7 @@ static jclass Proxy_generateProxy(JNIEnv* env, jclass, jstring name, jobjectArra
soa, name, interfaces, loader, methods, throws));
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Proxy, generateProxy, "(Ljava/lang/String;[Ljava/lang/Class;Ljava/lang/ClassLoader;[Ljava/lang/reflect/Method;[[Ljava/lang/Class;)Ljava/lang/Class;"),
};
diff --git a/runtime/native/java_util_concurrent_atomic_AtomicLong.cc b/runtime/native/java_util_concurrent_atomic_AtomicLong.cc
index c0032975ce..1ee6d1414c 100644
--- a/runtime/native/java_util_concurrent_atomic_AtomicLong.cc
+++ b/runtime/native/java_util_concurrent_atomic_AtomicLong.cc
@@ -30,7 +30,7 @@ static jboolean AtomicLong_VMSupportsCS8(JNIEnv*, jclass) {
return QuasiAtomic::LongAtomicsUseMutexes(kRuntimeISA) ? JNI_FALSE : JNI_TRUE;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(AtomicLong, VMSupportsCS8, "()Z"),
};
diff --git a/runtime/native/libcore_util_CharsetUtils.cc b/runtime/native/libcore_util_CharsetUtils.cc
index f3aba2575b..42f0caaf66 100644
--- a/runtime/native/libcore_util_CharsetUtils.cc
+++ b/runtime/native/libcore_util_CharsetUtils.cc
@@ -251,7 +251,7 @@ static jbyteArray CharsetUtils_toUtf8Bytes(JNIEnv* env, jclass, jstring java_str
return out.toByteArray();
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(CharsetUtils, asciiBytesToChars, "([BII[C)V"),
FAST_NATIVE_METHOD(CharsetUtils, isoLatin1BytesToChars, "([BII[C)V"),
FAST_NATIVE_METHOD(CharsetUtils, toAsciiBytes, "(Ljava/lang/String;II)[B"),
diff --git a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
index 8f8fd71727..7f239fab8b 100644
--- a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
+++ b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
@@ -38,7 +38,7 @@ static void DdmServer_nativeSendChunk(JNIEnv* env, jclass, jint type,
Runtime::Current()->GetRuntimeCallbacks()->DdmPublishChunk(static_cast<uint32_t>(type), chunk);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(DdmServer, nativeSendChunk, "(I[BII)V"),
};
diff --git a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
index fbee7b31a3..aefafc307c 100644
--- a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
+++ b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
@@ -175,7 +175,7 @@ static void DdmVmInternal_threadNotify(JNIEnv*, jclass, jboolean enable) {
Dbg::DdmSetThreadNotification(enable);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(DdmVmInternal, enableRecentAllocations, "(Z)V"),
FAST_NATIVE_METHOD(DdmVmInternal, getRecentAllocations, "()[B"),
FAST_NATIVE_METHOD(DdmVmInternal, getRecentAllocationStatus, "()Z"),
diff --git a/runtime/native/sun_misc_Unsafe.cc b/runtime/native/sun_misc_Unsafe.cc
index 25f984f6be..fa0ee784af 100644
--- a/runtime/native/sun_misc_Unsafe.cc
+++ b/runtime/native/sun_misc_Unsafe.cc
@@ -500,7 +500,7 @@ static void Unsafe_fullFence(JNIEnv*, jobject) {
std::atomic_thread_fence(std::memory_order_seq_cst);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Unsafe, compareAndSwapInt, "(Ljava/lang/Object;JII)Z"),
FAST_NATIVE_METHOD(Unsafe, compareAndSwapLong, "(Ljava/lang/Object;JJJ)Z"),
FAST_NATIVE_METHOD(Unsafe, compareAndSwapObject, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z"),
diff --git a/test/004-JniTest/jni_test.cc b/test/004-JniTest/jni_test.cc
index 33a8f5bba2..f2d189bced 100644
--- a/test/004-JniTest/jni_test.cc
+++ b/test/004-JniTest/jni_test.cc
@@ -33,7 +33,7 @@ static JavaVM* jvm = nullptr;
static jint Java_Main_intFastNativeMethod(JNIEnv*, jclass, jint a, jint b, jint c);
static jint Java_Main_intCriticalNativeMethod(jint a, jint b, jint c);
-static JNINativeMethod sMainMethods[] = {
+static const JNINativeMethod sMainMethods[] = {
{"intFastNativeMethod", "(III)I", reinterpret_cast<void*>(Java_Main_intFastNativeMethod) },
{"intCriticalNativeMethod", "(III)I", reinterpret_cast<void*>(Java_Main_intCriticalNativeMethod) },
};
diff --git a/test/139-register-natives/regnative.cc b/test/139-register-natives/regnative.cc
index d9c8b31ac7..083c14c1ec 100644
--- a/test/139-register-natives/regnative.cc
+++ b/test/139-register-natives/regnative.cc
@@ -22,7 +22,7 @@ namespace art {
static void foo(JNIEnv*, jclass) {
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "foo", "()V", reinterpret_cast<void*>(foo) }
};

View File

@ -0,0 +1,22 @@
From 253247fc3955ecf18ff42bf8b73d075134e8f1f2 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Sun, 17 Mar 2019 21:11:48 -0400
Subject: [PATCH] constify JNINativeMethod table
---
common/src/jni/main/cpp/conscrypt/native_crypto.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/src/jni/main/cpp/conscrypt/native_crypto.cc b/common/src/jni/main/cpp/conscrypt/native_crypto.cc
index 61ec8153..865edabd 100644
--- a/common/src/jni/main/cpp/conscrypt/native_crypto.cc
+++ b/common/src/jni/main/cpp/conscrypt/native_crypto.cc
@@ -9742,7 +9742,7 @@ static jlong NativeCrypto_SSL_get1_session(JNIEnv* env, jclass, jlong ssl_addres
#define REF_X509_CRL "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/OpenSSLX509CRL;"
#define REF_SSL "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeSsl;"
#define REF_SSL_CTX "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/AbstractSessionContext;"
-static JNINativeMethod sNativeCryptoMethods[] = {
+static const JNINativeMethod sNativeCryptoMethods[] = {
CONSCRYPT_NATIVE_METHOD(clinit, "()V"),
CONSCRYPT_NATIVE_METHOD(EVP_PKEY_new_RSA, "([B[B[B[B[B[B[B[B)J"),
CONSCRYPT_NATIVE_METHOD(EVP_PKEY_new_EC_KEY, "(" REF_EC_GROUP REF_EC_POINT "[B)J"),

View File

@ -0,0 +1,213 @@
From ff688b68a7df485c5628bda976bc5cc84999e81b Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Sun, 17 Mar 2019 20:12:52 -0400
Subject: [PATCH] constify JNINativeMethod tables
---
cmds/hid/jni/com_android_commands_hid_Device.cpp | 2 +-
core/jni/android_app_ActivityThread.cpp | 2 +-
core/jni/android_os_HwBinder.cpp | 2 +-
core/jni/android_os_HwBlob.cpp | 2 +-
core/jni/android_os_HwParcel.cpp | 2 +-
core/jni/android_os_HwRemoteBinder.cpp | 2 +-
core/jni/android_util_jar_StrictJarFile.cpp | 2 +-
core/jni/android_view_DisplayListCanvas.cpp | 2 +-
media/jni/android_media_ImageWriter.cpp | 4 ++--
media/jni/android_media_MediaSync.cpp | 2 +-
media/jni/soundpool/android_media_SoundPool.cpp | 2 +-
services/core/jni/com_android_server_UsbMidiDevice.cpp | 2 +-
services/core/jni/com_android_server_tv_TvUinputBridge.cpp | 2 +-
tests/net/jni/apf_jni.cpp | 2 +-
14 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/cmds/hid/jni/com_android_commands_hid_Device.cpp b/cmds/hid/jni/com_android_commands_hid_Device.cpp
index 5cc4fc4c16b2..cbe454290048 100644
--- a/cmds/hid/jni/com_android_commands_hid_Device.cpp
+++ b/cmds/hid/jni/com_android_commands_hid_Device.cpp
@@ -237,7 +237,7 @@ static void closeDevice(JNIEnv* /* env */, jclass /* clazz */, jlong ptr) {
}
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{ "nativeOpenDevice",
"(Ljava/lang/String;III[B"
"Lcom/android/commands/hid/Device$DeviceCallback;)J",
diff --git a/core/jni/android_app_ActivityThread.cpp b/core/jni/android_app_ActivityThread.cpp
index d56e4c51124d..693c4a27a0c0 100644
--- a/core/jni/android_app_ActivityThread.cpp
+++ b/core/jni/android_app_ActivityThread.cpp
@@ -39,7 +39,7 @@ android_app_ActivityThread_dumpGraphics(JNIEnv* env, jobject clazz, jobject java
}
-static JNINativeMethod gActivityThreadMethods[] = {
+static const JNINativeMethod gActivityThreadMethods[] = {
// ------------ Regular JNI ------------------
{ "nPurgePendingResources", "()V",
(void*) android_app_ActivityThread_purgePendingResources },
diff --git a/core/jni/android_os_HwBinder.cpp b/core/jni/android_os_HwBinder.cpp
index 08d952791ef6..cbcb95e454be 100644
--- a/core/jni/android_os_HwBinder.cpp
+++ b/core/jni/android_os_HwBinder.cpp
@@ -349,7 +349,7 @@ static void JHwBinder_report_sysprop_change(JNIEnv * /*env*/, jclass /*clazz*/)
report_sysprop_change();
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "native_init", "()J", (void *)JHwBinder_native_init },
{ "native_setup", "()V", (void *)JHwBinder_native_setup },
diff --git a/core/jni/android_os_HwBlob.cpp b/core/jni/android_os_HwBlob.cpp
index 09589cdb0801..8d281d5b3470 100644
--- a/core/jni/android_os_HwBlob.cpp
+++ b/core/jni/android_os_HwBlob.cpp
@@ -534,7 +534,7 @@ static jlong JHwBlob_native_handle(JNIEnv *env, jobject thiz) {
return handle;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "native_init", "()J", (void *)JHwBlob_native_init },
{ "native_setup", "(I)V", (void *)JHwBlob_native_setup },
diff --git a/core/jni/android_os_HwParcel.cpp b/core/jni/android_os_HwParcel.cpp
index 061349aee96f..5d570054952f 100644
--- a/core/jni/android_os_HwParcel.cpp
+++ b/core/jni/android_os_HwParcel.cpp
@@ -872,7 +872,7 @@ static void JHwParcel_native_writeBuffer(
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "native_init", "()J", (void *)JHwParcel_native_init },
{ "native_setup", "(Z)V", (void *)JHwParcel_native_setup },
diff --git a/core/jni/android_os_HwRemoteBinder.cpp b/core/jni/android_os_HwRemoteBinder.cpp
index ca5e1e45dcdc..344c904d89f4 100644
--- a/core/jni/android_os_HwRemoteBinder.cpp
+++ b/core/jni/android_os_HwRemoteBinder.cpp
@@ -455,7 +455,7 @@ static jint JHwRemoteBinder_hashCode(JNIEnv* env, jobject thiz) {
return static_cast<jint>(longHash ^ (longHash >> 32)); // See Long.hashCode()
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "native_init", "()J", (void *)JHwRemoteBinder_native_init },
{ "native_setup_empty", "()V",
diff --git a/core/jni/android_util_jar_StrictJarFile.cpp b/core/jni/android_util_jar_StrictJarFile.cpp
index 4ab8db4395f6..3de94cd34e78 100644
--- a/core/jni/android_util_jar_StrictJarFile.cpp
+++ b/core/jni/android_util_jar_StrictJarFile.cpp
@@ -156,7 +156,7 @@ static void StrictJarFile_nativeClose(JNIEnv*, jobject, jlong nativeHandle) {
CloseArchive(reinterpret_cast<ZipArchiveHandle>(nativeHandle));
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(StrictJarFile, nativeOpenJarFile, "(Ljava/lang/String;I)J"),
NATIVE_METHOD(StrictJarFile, nativeStartIteration, "(JLjava/lang/String;)J"),
NATIVE_METHOD(StrictJarFile, nativeNextEntry, "(J)Ljava/util/zip/ZipEntry;"),
diff --git a/core/jni/android_view_DisplayListCanvas.cpp b/core/jni/android_view_DisplayListCanvas.cpp
index 5197e7d481eb..d594f188eae3 100644
--- a/core/jni/android_view_DisplayListCanvas.cpp
+++ b/core/jni/android_view_DisplayListCanvas.cpp
@@ -184,7 +184,7 @@ static void android_view_DisplayListCanvas_drawCircleProps(jlong canvasPtr,
const char* const kClassPathName = "android/view/DisplayListCanvas";
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
// ------------ @FastNative ------------------
diff --git a/media/jni/android_media_ImageWriter.cpp b/media/jni/android_media_ImageWriter.cpp
index 031e373241cb..2ad9dbe458ae 100644
--- a/media/jni/android_media_ImageWriter.cpp
+++ b/media/jni/android_media_ImageWriter.cpp
@@ -829,7 +829,7 @@ static jobjectArray Image_createSurfacePlanes(JNIEnv* env, jobject thiz,
// ----------------------------------------------------------------------------
-static JNINativeMethod gImageWriterMethods[] = {
+static const JNINativeMethod gImageWriterMethods[] = {
{"nativeClassInit", "()V", (void*)ImageWriter_classInit },
{"nativeInit", "(Ljava/lang/Object;Landroid/view/Surface;II)J",
(void*)ImageWriter_init },
@@ -840,7 +840,7 @@ static JNINativeMethod gImageWriterMethods[] = {
{"cancelImage", "(JLandroid/media/Image;)V", (void*)ImageWriter_cancelImage },
};
-static JNINativeMethod gImageMethods[] = {
+static const JNINativeMethod gImageMethods[] = {
{"nativeCreatePlanes", "(II)[Landroid/media/ImageWriter$WriterSurfaceImage$SurfacePlane;",
(void*)Image_createSurfacePlanes },
{"nativeGetWidth", "()I", (void*)Image_getWidth },
diff --git a/media/jni/android_media_MediaSync.cpp b/media/jni/android_media_MediaSync.cpp
index f75200868a0d..994997f7c132 100644
--- a/media/jni/android_media_MediaSync.cpp
+++ b/media/jni/android_media_MediaSync.cpp
@@ -514,7 +514,7 @@ static void android_media_MediaSync_native_finalize(JNIEnv *env, jobject thiz) {
android_media_MediaSync_release(env, thiz);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "native_setSurface",
"(Landroid/view/Surface;)V",
(void *)android_media_MediaSync_native_setSurface },
diff --git a/media/jni/soundpool/android_media_SoundPool.cpp b/media/jni/soundpool/android_media_SoundPool.cpp
index f6706369f379..7032b4bf7ef9 100644
--- a/media/jni/soundpool/android_media_SoundPool.cpp
+++ b/media/jni/soundpool/android_media_SoundPool.cpp
@@ -242,7 +242,7 @@ android_media_SoundPool_release(JNIEnv *env, jobject thiz)
// ----------------------------------------------------------------------------
// Dalvik VM type signatures
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "_load",
"(Ljava/io/FileDescriptor;JJI)I",
(void *)android_media_SoundPool_load_FD
diff --git a/services/core/jni/com_android_server_UsbMidiDevice.cpp b/services/core/jni/com_android_server_UsbMidiDevice.cpp
index 79d935fe610c..86b43fcae705 100644
--- a/services/core/jni/com_android_server_UsbMidiDevice.cpp
+++ b/services/core/jni/com_android_server_UsbMidiDevice.cpp
@@ -135,7 +135,7 @@ android_server_UsbMidiDevice_close(JNIEnv *env, jobject thiz, jobjectArray fds)
}
}
-static JNINativeMethod method_table[] = {
+static const JNINativeMethod method_table[] = {
{ "nativeGetSubdeviceCount", "(II)I", (void*)android_server_UsbMidiDevice_get_subdevice_count },
{ "nativeOpen", "(III)[Ljava/io/FileDescriptor;", (void*)android_server_UsbMidiDevice_open },
{ "nativeClose", "([Ljava/io/FileDescriptor;)V", (void*)android_server_UsbMidiDevice_close },
diff --git a/services/core/jni/com_android_server_tv_TvUinputBridge.cpp b/services/core/jni/com_android_server_tv_TvUinputBridge.cpp
index 980922a806f5..84d6f3d83156 100644
--- a/services/core/jni/com_android_server_tv_TvUinputBridge.cpp
+++ b/services/core/jni/com_android_server_tv_TvUinputBridge.cpp
@@ -276,7 +276,7 @@ static void nativeClear(JNIEnv* env, jclass clazz, jlong ptr) {
* JNI registration
*/
-static JNINativeMethod gUinputBridgeMethods[] = {
+static const JNINativeMethod gUinputBridgeMethods[] = {
{ "nativeOpen", "(Ljava/lang/String;Ljava/lang/String;III)J",
(void*)nativeOpen },
{ "nativeClose", "(J)V",
diff --git a/tests/net/jni/apf_jni.cpp b/tests/net/jni/apf_jni.cpp
index 1ea9e274ab9e..f4b61a7ca80a 100644
--- a/tests/net/jni/apf_jni.cpp
+++ b/tests/net/jni/apf_jni.cpp
@@ -185,7 +185,7 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void*) {
return -1;
}
- static JNINativeMethod gMethods[] = {
+ static const JNINativeMethod gMethods[] = {
{ "apfSimulate", "([B[B[BI)I",
(void*)com_android_server_ApfTest_apfSimulate },
{ "compileToBpf", "(Ljava/lang/String;)Ljava/lang/String;",

View File

@ -0,0 +1,22 @@
From fbf620e59c16915a2a277ed934bc9a77fbcce4ac Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Sun, 31 Mar 2019 00:10:48 -0400
Subject: [PATCH] constify JNINativeMethod table
---
service/jni/com_android_server_wifi_WifiNative.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/service/jni/com_android_server_wifi_WifiNative.cpp b/service/jni/com_android_server_wifi_WifiNative.cpp
index 09a5ebf7cf..18ff875173 100644
--- a/service/jni/com_android_server_wifi_WifiNative.cpp
+++ b/service/jni/com_android_server_wifi_WifiNative.cpp
@@ -77,7 +77,7 @@ static jbyteArray android_net_wifi_readKernelLog(JNIEnv *env, jclass cls) {
/*
* JNI registration.
*/
-static JNINativeMethod gWifiMethods[] = {
+static const JNINativeMethod gWifiMethods[] = {
/* name, signature, funcPtr */
{"readKernelLogNative", "()[B", (void*)android_net_wifi_readKernelLog},
};

View File

@ -0,0 +1,851 @@
From 77c9fa981a7b058ff66f5d19929c54ca7d298e4e Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Sun, 17 Mar 2019 20:56:50 -0400
Subject: [PATCH] constify JNINativeMethod tables
---
.../native/org_apache_harmony_dalvik_NativeTestTarget.cpp | 8 ++++----
luni/src/main/native/android_system_OsConstants.cpp | 2 +-
luni/src/main/native/java_lang_StringToReal.cpp | 2 +-
luni/src/main/native/java_lang_invoke_MethodHandle.cpp | 2 +-
luni/src/main/native/java_lang_invoke_VarHandle.cpp | 2 +-
luni/src/main/native/java_math_NativeBN.cpp | 2 +-
luni/src/main/native/java_util_regex_Matcher.cpp | 2 +-
luni/src/main/native/java_util_regex_Pattern.cpp | 2 +-
luni/src/main/native/libcore_icu_ICU.cpp | 2 +-
luni/src/main/native/libcore_icu_NativeConverter.cpp | 2 +-
luni/src/main/native/libcore_icu_TimeZoneNames.cpp | 2 +-
.../main/native/libcore_io_AsynchronousCloseMonitor.cpp | 2 +-
luni/src/main/native/libcore_io_Linux.cpp | 2 +-
luni/src/main/native/libcore_io_Memory.cpp | 2 +-
.../main/native/libcore_util_NativeAllocationRegistry.cpp | 2 +-
.../main/native/org_apache_harmony_xml_ExpatParser.cpp | 4 ++--
luni/src/main/native/sun_misc_Unsafe.cpp | 2 +-
ojluni/src/main/native/Adler32.c | 2 +-
ojluni/src/main/native/Bits.c | 2 +-
ojluni/src/main/native/Character.cpp | 2 +-
ojluni/src/main/native/Console_md.c | 2 +-
ojluni/src/main/native/DatagramChannelImpl.c | 2 +-
ojluni/src/main/native/DatagramDispatcher.c | 2 +-
ojluni/src/main/native/Double.c | 2 +-
ojluni/src/main/native/FileChannelImpl.c | 2 +-
ojluni/src/main/native/FileDescriptor_md.c | 2 +-
ojluni/src/main/native/FileDispatcherImpl.c | 2 +-
ojluni/src/main/native/FileInputStream.c | 2 +-
ojluni/src/main/native/FileKey.c | 2 +-
ojluni/src/main/native/FileOutputStream_md.c | 2 +-
ojluni/src/main/native/FileSystemPreferences.c | 2 +-
ojluni/src/main/native/Float.c | 2 +-
ojluni/src/main/native/IOUtil.c | 2 +-
ojluni/src/main/native/MappedByteBuffer.c | 2 +-
ojluni/src/main/native/Math.c | 2 +-
ojluni/src/main/native/NativeThread.c | 2 +-
ojluni/src/main/native/Net.c | 2 +-
ojluni/src/main/native/ObjectInputStream.c | 2 +-
ojluni/src/main/native/ObjectOutputStream.c | 2 +-
ojluni/src/main/native/ObjectStreamClass.c | 2 +-
ojluni/src/main/native/ProcessEnvironment_md.c | 2 +-
ojluni/src/main/native/Runtime.c | 2 +-
ojluni/src/main/native/ServerSocketChannelImpl.c | 2 +-
ojluni/src/main/native/SocketChannelImpl.c | 2 +-
ojluni/src/main/native/SocketInputStream.c | 2 +-
ojluni/src/main/native/SocketOutputStream.c | 2 +-
ojluni/src/main/native/StrictMath.c | 2 +-
ojluni/src/main/native/String.c | 2 +-
ojluni/src/main/native/System.c | 2 +-
ojluni/src/main/native/Thread.c | 2 +-
ojluni/src/main/native/Throwable.c | 2 +-
ojluni/src/main/native/UNIXProcess_md.c | 2 +-
ojluni/src/main/native/UnixFileSystem_md.c | 2 +-
ojluni/src/main/native/java_util_zip_CRC32.c | 2 +-
ojluni/src/main/native/java_util_zip_Deflater.c | 2 +-
ojluni/src/main/native/java_util_zip_Inflater.c | 2 +-
ojluni/src/main/native/java_util_zip_ZipFile.c | 4 ++--
57 files changed, 62 insertions(+), 62 deletions(-)
diff --git a/dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp b/dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp
index f3c552f880..b0955bb794 100644
--- a/dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp
+++ b/dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp
@@ -22,7 +22,7 @@
static void NativeTestTarget_emptyJniStaticSynchronizedMethod0(JNIEnv*, jclass) { }
static void NativeTestTarget_emptyJniSynchronizedMethod0(JNIEnv*, jclass) { }
-static JNINativeMethod gMethods_NormalOnly[] = {
+static const JNINativeMethod gMethods_NormalOnly[] = {
NATIVE_METHOD(NativeTestTarget, emptyJniStaticSynchronizedMethod0, "()V"),
NATIVE_METHOD(NativeTestTarget, emptyJniSynchronizedMethod0, "()V"),
};
@@ -36,7 +36,7 @@ static void NativeTestTarget_emptyJniStaticMethod6L(JNIEnv*, jclass, jobject, ja
static void NativeTestTarget_emptyJniStaticMethod0(JNIEnv*, jclass) { }
static void NativeTestTarget_emptyJniStaticMethod6(JNIEnv*, jclass, int, int, int, int, int, int) { }
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeTestTarget, emptyJniMethod0, "()V"),
NATIVE_METHOD(NativeTestTarget, emptyJniMethod6, "(IIIIII)V"),
NATIVE_METHOD(NativeTestTarget, emptyJniMethod6L, "(Ljava/lang/String;[Ljava/lang/String;[[ILjava/lang/Object;[Ljava/lang/Object;[[[[Ljava/lang/Object;)V"),
@@ -53,7 +53,7 @@ static void NativeTestTarget_emptyJniStaticMethod6L_Fast(JNIEnv*, jclass, jobjec
static void NativeTestTarget_emptyJniStaticMethod0_Fast(JNIEnv*, jclass) { }
static void NativeTestTarget_emptyJniStaticMethod6_Fast(JNIEnv*, jclass, int, int, int, int, int, int) { }
-static JNINativeMethod gMethods_Fast[] = {
+static const JNINativeMethod gMethods_Fast[] = {
NATIVE_METHOD(NativeTestTarget, emptyJniMethod0_Fast, "()V"),
NATIVE_METHOD(NativeTestTarget, emptyJniMethod6_Fast, "(IIIIII)V"),
NATIVE_METHOD(NativeTestTarget, emptyJniMethod6L_Fast, "(Ljava/lang/String;[Ljava/lang/String;[[ILjava/lang/Object;[Ljava/lang/Object;[[[[Ljava/lang/Object;)V"),
@@ -66,7 +66,7 @@ static JNINativeMethod gMethods_Fast[] = {
static void NativeTestTarget_emptyJniStaticMethod0_Critical() { }
static void NativeTestTarget_emptyJniStaticMethod6_Critical( int, int, int, int, int, int) { }
-static JNINativeMethod gMethods_Critical[] = {
+static const JNINativeMethod gMethods_Critical[] = {
NATIVE_METHOD(NativeTestTarget, emptyJniStaticMethod0_Critical, "()V"),
NATIVE_METHOD(NativeTestTarget, emptyJniStaticMethod6_Critical, "(IIIIII)V"),
};
diff --git a/luni/src/main/native/android_system_OsConstants.cpp b/luni/src/main/native/android_system_OsConstants.cpp
index e373a12653..e612df2174 100644
--- a/luni/src/main/native/android_system_OsConstants.cpp
+++ b/luni/src/main/native/android_system_OsConstants.cpp
@@ -700,7 +700,7 @@ static void OsConstants_initConstants(JNIEnv* env, jclass c) {
initConstant(env, c, "_SC_XOPEN_XCU_VERSION", _SC_XOPEN_XCU_VERSION);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(OsConstants, initConstants, "()V"),
};
void register_android_system_OsConstants(JNIEnv* env) {
diff --git a/luni/src/main/native/java_lang_StringToReal.cpp b/luni/src/main/native/java_lang_StringToReal.cpp
index 7f368b15f6..c4f8855677 100644
--- a/luni/src/main/native/java_lang_StringToReal.cpp
+++ b/luni/src/main/native/java_lang_StringToReal.cpp
@@ -889,7 +889,7 @@ static jdouble StringToReal_parseDblImpl(JNIEnv* env, jclass, jstring s, jint e)
return createDouble(env, str.c_str(), e);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(StringToReal, parseFltImpl, "(Ljava/lang/String;I)F"),
NATIVE_METHOD(StringToReal, parseDblImpl, "(Ljava/lang/String;I)D"),
};
diff --git a/luni/src/main/native/java_lang_invoke_MethodHandle.cpp b/luni/src/main/native/java_lang_invoke_MethodHandle.cpp
index 4574f59636..a9c3c910a1 100644
--- a/luni/src/main/native/java_lang_invoke_MethodHandle.cpp
+++ b/luni/src/main/native/java_lang_invoke_MethodHandle.cpp
@@ -27,7 +27,7 @@ static void MethodHandle_invoke(JNIEnv* env, jobject, jobjectArray) {
"MethodHandle.invoke cannot be invoked reflectively.");
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(MethodHandle, invokeExact, "([Ljava/lang/Object;)Ljava/lang/Object;"),
NATIVE_METHOD(MethodHandle, invoke, "([Ljava/lang/Object;)Ljava/lang/Object;"),
};
diff --git a/luni/src/main/native/java_lang_invoke_VarHandle.cpp b/luni/src/main/native/java_lang_invoke_VarHandle.cpp
index 46ea8ff8a3..794d16e5ab 100644
--- a/luni/src/main/native/java_lang_invoke_VarHandle.cpp
+++ b/luni/src/main/native/java_lang_invoke_VarHandle.cpp
@@ -193,7 +193,7 @@ static void VarHandle_weakCompareAndSetRelease(JNIEnv* env, jobject, jobjectArra
ThrowUnsupportedOperationForAccessMode(env, "weakCompareAndSetRelease");
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(VarHandle, compareAndExchange, kVarHandleObjectSignature),
NATIVE_METHOD(VarHandle, compareAndExchangeAcquire, kVarHandleObjectSignature),
NATIVE_METHOD(VarHandle, compareAndExchangeRelease, kVarHandleObjectSignature),
diff --git a/luni/src/main/native/java_math_NativeBN.cpp b/luni/src/main/native/java_math_NativeBN.cpp
index 066f77e4ab..6c9d869f8d 100644
--- a/luni/src/main/native/java_math_NativeBN.cpp
+++ b/luni/src/main/native/java_math_NativeBN.cpp
@@ -524,7 +524,7 @@ static jboolean NativeBN_BN_primality_test(JNIEnv* env, jclass, jlong candidate,
return is_probably_prime ? JNI_TRUE : JNI_FALSE;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeBN, BN_add, "(JJJ)V"),
NATIVE_METHOD(NativeBN, BN_add_word, "(JI)V"),
NATIVE_METHOD(NativeBN, BN_bin2bn, "([BIZJ)V"),
diff --git a/luni/src/main/native/java_util_regex_Matcher.cpp b/luni/src/main/native/java_util_regex_Matcher.cpp
index 11af4bd610..b3515ae27b 100644
--- a/luni/src/main/native/java_util_regex_Matcher.cpp
+++ b/luni/src/main/native/java_util_regex_Matcher.cpp
@@ -260,7 +260,7 @@ static jint Matcher_getMatchedGroupIndex0(JNIEnv* env, jclass, jlong patternAddr
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Matcher, getMatchedGroupIndex0, "(JLjava/lang/String;)I"),
NATIVE_METHOD(Matcher, findImpl, "(JI[I)Z"),
NATIVE_METHOD(Matcher, findNextImpl, "(J[I)Z"),
diff --git a/luni/src/main/native/java_util_regex_Pattern.cpp b/luni/src/main/native/java_util_regex_Pattern.cpp
index f4d23cb77d..b436606fe7 100644
--- a/luni/src/main/native/java_util_regex_Pattern.cpp
+++ b/luni/src/main/native/java_util_regex_Pattern.cpp
@@ -100,7 +100,7 @@ static jlong Pattern_compileImpl(JNIEnv* env, jclass, jstring javaRegex, jint fl
return static_cast<jlong>(reinterpret_cast<uintptr_t>(result));
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Pattern, compileImpl, "(Ljava/lang/String;I)J"),
NATIVE_METHOD(Pattern, getNativeFinalizer, "()J"),
NATIVE_METHOD(Pattern, nativeSize, "()I"),
diff --git a/luni/src/main/native/libcore_icu_ICU.cpp b/luni/src/main/native/libcore_icu_ICU.cpp
index 48f1ba28cd..b97d5d6d0b 100644
--- a/luni/src/main/native/libcore_icu_ICU.cpp
+++ b/luni/src/main/native/libcore_icu_ICU.cpp
@@ -806,7 +806,7 @@ static jstring ICU_getDefaultLocale(JNIEnv* env, jclass) {
return env->NewStringUTF(icu::Locale::getDefault().getName());
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ICU, addLikelySubtags, "(Ljava/lang/String;)Ljava/lang/String;"),
NATIVE_METHOD(ICU, getAvailableBreakIteratorLocalesNative, "()[Ljava/lang/String;"),
NATIVE_METHOD(ICU, getAvailableCalendarLocalesNative, "()[Ljava/lang/String;"),
diff --git a/luni/src/main/native/libcore_icu_NativeConverter.cpp b/luni/src/main/native/libcore_icu_NativeConverter.cpp
index b98c79c474..31a01d5508 100644
--- a/luni/src/main/native/libcore_icu_NativeConverter.cpp
+++ b/luni/src/main/native/libcore_icu_NativeConverter.cpp
@@ -675,7 +675,7 @@ static jlong NativeConverter_getNativeSize(JNIEnv*, jclass, jstring) {
return 200;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeConverter, charsetForName, "(Ljava/lang/String;)Ljava/nio/charset/Charset;"),
NATIVE_METHOD(NativeConverter, closeConverter, "(J)V"),
NATIVE_METHOD(NativeConverter, contains, "(Ljava/lang/String;Ljava/lang/String;)Z"),
diff --git a/luni/src/main/native/libcore_icu_TimeZoneNames.cpp b/luni/src/main/native/libcore_icu_TimeZoneNames.cpp
index cea595d888..13027f8d4c 100644
--- a/luni/src/main/native/libcore_icu_TimeZoneNames.cpp
+++ b/luni/src/main/native/libcore_icu_TimeZoneNames.cpp
@@ -97,7 +97,7 @@ static void TimeZoneNames_fillZoneStrings(JNIEnv* env, jclass, jstring javaLocal
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(TimeZoneNames, fillZoneStrings, "(Ljava/lang/String;[[Ljava/lang/String;)V"),
};
void register_libcore_icu_TimeZoneNames(JNIEnv* env) {
diff --git a/luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp b/luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp
index bf2d3a8772..1f25262588 100644
--- a/luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp
+++ b/luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp
@@ -27,7 +27,7 @@ static void AsynchronousCloseMonitor_signalBlockedThreads(JNIEnv* env, jclass, j
AsynchronousCloseMonitor::signalBlockedThreads(fd);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(AsynchronousCloseMonitor, signalBlockedThreads, "(Ljava/io/FileDescriptor;)V"),
};
void register_libcore_io_AsynchronousCloseMonitor(JNIEnv* env) {
diff --git a/luni/src/main/native/libcore_io_Linux.cpp b/luni/src/main/native/libcore_io_Linux.cpp
index 30da35c2c0..67d17e70ec 100644
--- a/luni/src/main/native/libcore_io_Linux.cpp
+++ b/luni/src/main/native/libcore_io_Linux.cpp
@@ -2464,7 +2464,7 @@ static jint Linux_writev(JNIEnv* env, jobject, jobject javaFd, jobjectArray buff
#define NATIVE_METHOD_OVERLOAD(className, functionName, signature, variant) \
{ #functionName, signature, reinterpret_cast<void*>(className ## _ ## functionName ## variant) }
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Linux, accept, "(Ljava/io/FileDescriptor;Ljava/net/SocketAddress;)Ljava/io/FileDescriptor;"),
NATIVE_METHOD(Linux, access, "(Ljava/lang/String;I)Z"),
NATIVE_METHOD(Linux, android_getaddrinfo, "(Ljava/lang/String;Landroid/system/StructAddrinfo;I)[Ljava/net/InetAddress;"),
diff --git a/luni/src/main/native/libcore_io_Memory.cpp b/luni/src/main/native/libcore_io_Memory.cpp
index 5f50751d22..b96ee532f3 100644
--- a/luni/src/main/native/libcore_io_Memory.cpp
+++ b/luni/src/main/native/libcore_io_Memory.cpp
@@ -289,7 +289,7 @@ static void Memory_unsafeBulkPut(JNIEnv* env, jclass, jbyteArray dstArray, jint
env->ReleasePrimitiveArrayCritical(srcArray, srcBytes, 0);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Memory, memmove, "(Ljava/lang/Object;ILjava/lang/Object;IJ)V"),
FAST_NATIVE_METHOD(Memory, peekByte, "(J)B"),
NATIVE_METHOD(Memory, peekByteArray, "(J[BII)V"),
diff --git a/luni/src/main/native/libcore_util_NativeAllocationRegistry.cpp b/luni/src/main/native/libcore_util_NativeAllocationRegistry.cpp
index 59bed741c4..f55c15eca4 100644
--- a/luni/src/main/native/libcore_util_NativeAllocationRegistry.cpp
+++ b/luni/src/main/native/libcore_util_NativeAllocationRegistry.cpp
@@ -28,7 +28,7 @@ static void NativeAllocationRegistry_applyFreeFunction(JNIEnv*,
nativeFreeFunction(nativePtr);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeAllocationRegistry, applyFreeFunction, "(JJ)V"),
};
diff --git a/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp b/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
index 22496bf7a1..cf86957a7b 100644
--- a/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
+++ b/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
@@ -1353,7 +1353,7 @@ static void ExpatParser_staticInitialize(JNIEnv* env, jobject classObject, jstri
emptyString = reinterpret_cast<jstring>(env->NewGlobalRef(empty));
}
-static JNINativeMethod parserMethods[] = {
+static const JNINativeMethod parserMethods[] = {
NATIVE_METHOD(ExpatParser, appendString, "(JLjava/lang/String;Z)V"),
NATIVE_METHOD(ExpatParser, appendBytes, "(J[BII)V"),
NATIVE_METHOD(ExpatParser, appendChars, "(J[CII)V"),
@@ -1367,7 +1367,7 @@ static JNINativeMethod parserMethods[] = {
NATIVE_METHOD(ExpatParser, staticInitialize, "(Ljava/lang/String;)V"),
};
-static JNINativeMethod attributeMethods[] = {
+static const JNINativeMethod attributeMethods[] = {
NATIVE_METHOD(ExpatAttributes, freeAttributes, "(J)V"),
NATIVE_METHOD(ExpatAttributes, getIndexForQName, "(JLjava/lang/String;)I"),
NATIVE_METHOD(ExpatAttributes, getIndex, "(JLjava/lang/String;Ljava/lang/String;)I"),
diff --git a/luni/src/main/native/sun_misc_Unsafe.cpp b/luni/src/main/native/sun_misc_Unsafe.cpp
index 67925b0847..482e2ada4b 100644
--- a/luni/src/main/native/sun_misc_Unsafe.cpp
+++ b/luni/src/main/native/sun_misc_Unsafe.cpp
@@ -23,7 +23,7 @@ static jobject Unsafe_allocateInstance(JNIEnv* env, jclass, jclass c) {
return env->AllocObject(c);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Unsafe, allocateInstance, "(Ljava/lang/Class;)Ljava/lang/Object;"),
};
void register_sun_misc_Unsafe(JNIEnv* env) {
diff --git a/ojluni/src/main/native/Adler32.c b/ojluni/src/main/native/Adler32.c
index 11ef08d4c9..849df61067 100644
--- a/ojluni/src/main/native/Adler32.c
+++ b/ojluni/src/main/native/Adler32.c
@@ -70,7 +70,7 @@ Java_java_util_zip_Adler32_updateByteBuffer(JNIEnv *env, jclass cls, jint adler,
return adler;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Adler32, update, "(II)I"),
NATIVE_METHOD(Adler32, updateBytes, "(I[BII)I"),
NATIVE_METHOD(Adler32, updateByteBuffer, "(IJII)I"),
diff --git a/ojluni/src/main/native/Bits.c b/ojluni/src/main/native/Bits.c
index 50caf36e81..c0b0c91d20 100644
--- a/ojluni/src/main/native/Bits.c
+++ b/ojluni/src/main/native/Bits.c
@@ -282,7 +282,7 @@ Java_java_nio_Bits_copyToLongArray(JNIEnv *env, jobject this, jlong srcAddr,
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Bits, copyFromShortArray, "(Ljava/lang/Object;JJJ)V"),
NATIVE_METHOD(Bits, copyToShortArray, "(JLjava/lang/Object;JJ)V"),
NATIVE_METHOD(Bits, copyFromIntArray, "(Ljava/lang/Object;JJJ)V"),
diff --git a/ojluni/src/main/native/Character.cpp b/ojluni/src/main/native/Character.cpp
index 666184f816..9f6ec2e960 100644
--- a/ojluni/src/main/native/Character.cpp
+++ b/ojluni/src/main/native/Character.cpp
@@ -158,7 +158,7 @@ Character_getNameImpl(JNIEnv* env, jclass, jint codePoint) {
return (U_FAILURE(status) || byteCount == 0) ? NULL : env->NewStringUTF(buf);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Character, digitImpl, "(II)I"),
FAST_NATIVE_METHOD(Character, getDirectionalityImpl, "(I)B"),
NATIVE_METHOD(Character, getNameImpl, "(I)Ljava/lang/String;"),
diff --git a/ojluni/src/main/native/Console_md.c b/ojluni/src/main/native/Console_md.c
index 13437be314..f87bd168b1 100644
--- a/ojluni/src/main/native/Console_md.c
+++ b/ojluni/src/main/native/Console_md.c
@@ -72,7 +72,7 @@ Java_java_io_Console_echo(JNIEnv *env,
return old;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Console, istty, "()Z"),
NATIVE_METHOD(Console, encoding, "()Ljava/lang/String;"),
NATIVE_METHOD(Console, echo, "(Z)Z"),
diff --git a/ojluni/src/main/native/DatagramChannelImpl.c b/ojluni/src/main/native/DatagramChannelImpl.c
index 925064f404..835b9f01c3 100644
--- a/ojluni/src/main/native/DatagramChannelImpl.c
+++ b/ojluni/src/main/native/DatagramChannelImpl.c
@@ -274,7 +274,7 @@ Java_sun_nio_ch_DatagramChannelImpl_send0(JNIEnv *env, jobject this,
return n;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(DatagramChannelImpl, initIDs, "()V"),
NATIVE_METHOD(DatagramChannelImpl, disconnect0, "(Ljava/io/FileDescriptor;Z)V"),
NATIVE_METHOD(DatagramChannelImpl, receive0, "(Ljava/io/FileDescriptor;JIZ)I"),
diff --git a/ojluni/src/main/native/DatagramDispatcher.c b/ojluni/src/main/native/DatagramDispatcher.c
index 36cc6cf4bc..39ff924179 100644
--- a/ojluni/src/main/native/DatagramDispatcher.c
+++ b/ojluni/src/main/native/DatagramDispatcher.c
@@ -139,7 +139,7 @@ Java_sun_nio_ch_DatagramDispatcher_writev0(JNIEnv *env, jclass clazz,
return convertLongReturnVal(env, (jlong)result, JNI_FALSE);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(DatagramDispatcher, read0, "(Ljava/io/FileDescriptor;JI)I"),
NATIVE_METHOD(DatagramDispatcher, readv0, "(Ljava/io/FileDescriptor;JI)J"),
NATIVE_METHOD(DatagramDispatcher, write0, "(Ljava/io/FileDescriptor;JI)I"),
diff --git a/ojluni/src/main/native/Double.c b/ojluni/src/main/native/Double.c
index 8382b88994..2bcb97a653 100644
--- a/ojluni/src/main/native/Double.c
+++ b/ojluni/src/main/native/Double.c
@@ -63,7 +63,7 @@ Double_doubleToRawLongBits(JNIEnv *env, jclass unused, jdouble v)
u.d = (double)v;
return u.l;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Double, longBitsToDouble, "(J)D"),
NATIVE_METHOD(Double, doubleToRawLongBits, "(D)J"),
};
diff --git a/ojluni/src/main/native/FileChannelImpl.c b/ojluni/src/main/native/FileChannelImpl.c
index 5b428e9866..bf0be0bf73 100644
--- a/ojluni/src/main/native/FileChannelImpl.c
+++ b/ojluni/src/main/native/FileChannelImpl.c
@@ -279,7 +279,7 @@ FileChannelImpl_transferTo0(JNIEnv *env, jobject this,
#endif
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileChannelImpl, initIDs, "()J"),
NATIVE_METHOD(FileChannelImpl, map0, "(IJJ)J"),
NATIVE_METHOD(FileChannelImpl, unmap0, "(JJ)I"),
diff --git a/ojluni/src/main/native/FileDescriptor_md.c b/ojluni/src/main/native/FileDescriptor_md.c
index 0404263787..a00d799045 100644
--- a/ojluni/src/main/native/FileDescriptor_md.c
+++ b/ojluni/src/main/native/FileDescriptor_md.c
@@ -68,7 +68,7 @@ JNIEXPORT jboolean JNICALL FileDescriptor_isSocket(JNIEnv *env, jclass ignored,
return TEMP_FAILURE_RETRY(getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &error_length)) == 0;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileDescriptor, sync, "()V"),
NATIVE_METHOD(FileDescriptor, isSocket, "(I)Z"),
};
diff --git a/ojluni/src/main/native/FileDispatcherImpl.c b/ojluni/src/main/native/FileDispatcherImpl.c
index 5a49a601ad..0113690d7a 100644
--- a/ojluni/src/main/native/FileDispatcherImpl.c
+++ b/ojluni/src/main/native/FileDispatcherImpl.c
@@ -285,7 +285,7 @@ FileDispatcherImpl_closeIntFD(JNIEnv *env, jclass clazz, jint fd)
closeFileDescriptor(env, fd);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileDispatcherImpl, closeIntFD, "(I)V"),
NATIVE_METHOD(FileDispatcherImpl, preClose0, "(Ljava/io/FileDescriptor;)V"),
NATIVE_METHOD(FileDispatcherImpl, close0, "(Ljava/io/FileDescriptor;)V"),
diff --git a/ojluni/src/main/native/FileInputStream.c b/ojluni/src/main/native/FileInputStream.c
index 2418c5da27..6fd86d5010 100644
--- a/ojluni/src/main/native/FileInputStream.c
+++ b/ojluni/src/main/native/FileInputStream.c
@@ -132,7 +132,7 @@ FileInputStream_available0(JNIEnv *env, jobject this) {
return 0;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileInputStream, open0, "(Ljava/lang/String;)V"),
NATIVE_METHOD(FileInputStream, skip0, "(J)J"),
NATIVE_METHOD(FileInputStream, available0, "()I"),
diff --git a/ojluni/src/main/native/FileKey.c b/ojluni/src/main/native/FileKey.c
index b28fb564a2..4688bb3c65 100644
--- a/ojluni/src/main/native/FileKey.c
+++ b/ojluni/src/main/native/FileKey.c
@@ -66,7 +66,7 @@ FileKey_init(JNIEnv *env, jobject this, jobject fdo)
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileKey, init, "(Ljava/io/FileDescriptor;)V"),
};
diff --git a/ojluni/src/main/native/FileOutputStream_md.c b/ojluni/src/main/native/FileOutputStream_md.c
index 73218d482e..5bac6129ef 100644
--- a/ojluni/src/main/native/FileOutputStream_md.c
+++ b/ojluni/src/main/native/FileOutputStream_md.c
@@ -58,7 +58,7 @@ FileOutputStream_open0(JNIEnv *env, jobject this,
O_WRONLY | O_CREAT | (append ? O_APPEND : O_TRUNC));
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileOutputStream, open0, "(Ljava/lang/String;Z)V"),
};
diff --git a/ojluni/src/main/native/FileSystemPreferences.c b/ojluni/src/main/native/FileSystemPreferences.c
index 8ab516a7db..5af1980f44 100644
--- a/ojluni/src/main/native/FileSystemPreferences.c
+++ b/ojluni/src/main/native/FileSystemPreferences.c
@@ -145,7 +145,7 @@ Java_java_util_prefs_FileSystemPreferences_unlockFile0(JNIEnv *env,
return 0;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileSystemPreferences, lockFile0, "(Ljava/lang/String;IZ)[I"),
NATIVE_METHOD(FileSystemPreferences, unlockFile0, "(I)I"),
NATIVE_METHOD(FileSystemPreferences, chmod, "(Ljava/lang/String;I)I"),
diff --git a/ojluni/src/main/native/Float.c b/ojluni/src/main/native/Float.c
index 956048d6b8..5bfdf58245 100644
--- a/ojluni/src/main/native/Float.c
+++ b/ojluni/src/main/native/Float.c
@@ -59,7 +59,7 @@ Float_floatToRawIntBits(JNIEnv *env, jclass unused, jfloat v)
u.f = (float)v;
return (jint)u.i;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Float, intBitsToFloat, "(I)F"),
NATIVE_METHOD(Float, floatToRawIntBits, "(F)I"),
};
diff --git a/ojluni/src/main/native/IOUtil.c b/ojluni/src/main/native/IOUtil.c
index 05949dab16..2ccb8795e4 100644
--- a/ojluni/src/main/native/IOUtil.c
+++ b/ojluni/src/main/native/IOUtil.c
@@ -206,7 +206,7 @@ fdval(JNIEnv *env, jobject fdo)
return (*env)->GetIntField(env, fdo, fd_fdID);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(IOUtil, iovMax, "()I"),
NATIVE_METHOD(IOUtil, fdLimit, "()I"),
NATIVE_METHOD(IOUtil, drain, "(I)Z"),
diff --git a/ojluni/src/main/native/MappedByteBuffer.c b/ojluni/src/main/native/MappedByteBuffer.c
index a5b0b046cd..555f64227e 100644
--- a/ojluni/src/main/native/MappedByteBuffer.c
+++ b/ojluni/src/main/native/MappedByteBuffer.c
@@ -97,7 +97,7 @@ Java_java_nio_MappedByteBuffer_force0(JNIEnv *env, jobject obj, jobject fdo,
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(MappedByteBuffer, isLoaded0, "(JJI)Z"),
NATIVE_METHOD(MappedByteBuffer, load0, "(JJ)V"),
NATIVE_METHOD(MappedByteBuffer, force0, "(Ljava/io/FileDescriptor;JJ)V"),
diff --git a/ojluni/src/main/native/Math.c b/ojluni/src/main/native/Math.c
index 64f361ae16..d4727fe246 100644
--- a/ojluni/src/main/native/Math.c
+++ b/ojluni/src/main/native/Math.c
@@ -140,7 +140,7 @@ Math_rint(jdouble d) {
return rint(d);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Math, IEEEremainder, "(DD)D"),
FAST_NATIVE_METHOD(Math, acos, "(D)D"),
FAST_NATIVE_METHOD(Math, asin, "(D)D"),
diff --git a/ojluni/src/main/native/NativeThread.c b/ojluni/src/main/native/NativeThread.c
index 3a1c5c1b9a..1e225368af 100644
--- a/ojluni/src/main/native/NativeThread.c
+++ b/ojluni/src/main/native/NativeThread.c
@@ -101,7 +101,7 @@ NativeThread_signal(JNIEnv *env, jclass cl, jlong thread)
JNU_ThrowIOExceptionWithLastError(env, "Thread signal failed");
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeThread, current, "()J"),
NATIVE_METHOD(NativeThread, signal, "(J)V"),
};
diff --git a/ojluni/src/main/native/Net.c b/ojluni/src/main/native/Net.c
index 462830dab4..8a14e3c5b2 100644
--- a/ojluni/src/main/native/Net.c
+++ b/ojluni/src/main/native/Net.c
@@ -850,7 +850,7 @@ handleSocketError(JNIEnv *env, jint errorValue) {
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Net, isIPv6Available0, "()Z"),
NATIVE_METHOD(Net, isExclusiveBindAvailable, "()I"),
NATIVE_METHOD(Net, canIPv6SocketJoinIPv4Group0, "()Z"),
diff --git a/ojluni/src/main/native/ObjectInputStream.c b/ojluni/src/main/native/ObjectInputStream.c
index 6f65dca5a5..6ba47e31dc 100644
--- a/ojluni/src/main/native/ObjectInputStream.c
+++ b/ojluni/src/main/native/ObjectInputStream.c
@@ -175,7 +175,7 @@ Java_java_io_ObjectInputStream_bytesToDoubles(JNIEnv *env,
(*env)->ReleasePrimitiveArrayCritical(env, dst, doubles, 0);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ObjectInputStream, bytesToFloats, "([BI[FII)V"),
NATIVE_METHOD(ObjectInputStream, bytesToDoubles, "([BI[DII)V"),
};
diff --git a/ojluni/src/main/native/ObjectOutputStream.c b/ojluni/src/main/native/ObjectOutputStream.c
index 169a83f3f8..0e1479d6df 100644
--- a/ojluni/src/main/native/ObjectOutputStream.c
+++ b/ojluni/src/main/native/ObjectOutputStream.c
@@ -184,7 +184,7 @@ Java_java_io_ObjectOutputStream_doublesToBytes(JNIEnv *env,
(*env)->ReleasePrimitiveArrayCritical(env, dst, bytes, 0);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ObjectOutputStream, floatsToBytes, "([FI[BII)V"),
NATIVE_METHOD(ObjectOutputStream, doublesToBytes, "([DI[BII)V"),
};
diff --git a/ojluni/src/main/native/ObjectStreamClass.c b/ojluni/src/main/native/ObjectStreamClass.c
index 95cd4f0247..6e97d293f4 100644
--- a/ojluni/src/main/native/ObjectStreamClass.c
+++ b/ojluni/src/main/native/ObjectStreamClass.c
@@ -100,7 +100,7 @@ ObjectStreamClass_hasStaticInitializer(JNIEnv *env, jclass this,
return (clinitId != superClinitId);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ObjectStreamClass, hasStaticInitializer, "(Ljava/lang/Class;Z)Z"),
};
diff --git a/ojluni/src/main/native/ProcessEnvironment_md.c b/ojluni/src/main/native/ProcessEnvironment_md.c
index a59410badc..a3f46a4d4f 100644
--- a/ojluni/src/main/native/ProcessEnvironment_md.c
+++ b/ojluni/src/main/native/ProcessEnvironment_md.c
@@ -91,7 +91,7 @@ ProcessEnvironment_environ(JNIEnv *env, jclass ign)
return result;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ProcessEnvironment, environ, "()[[B"),
};
diff --git a/ojluni/src/main/native/Runtime.c b/ojluni/src/main/native/Runtime.c
index 4c023b520e..e2fa8f7950 100644
--- a/ojluni/src/main/native/Runtime.c
+++ b/ojluni/src/main/native/Runtime.c
@@ -80,7 +80,7 @@ Runtime_nativeLoad(JNIEnv* env, jclass ignored, jstring javaFilename,
return JVM_NativeLoad(env, javaFilename, javaLoader);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Runtime, freeMemory, "()J"),
FAST_NATIVE_METHOD(Runtime, totalMemory, "()J"),
FAST_NATIVE_METHOD(Runtime, maxMemory, "()J"),
diff --git a/ojluni/src/main/native/ServerSocketChannelImpl.c b/ojluni/src/main/native/ServerSocketChannelImpl.c
index 679811f96a..83a94f9b8e 100644
--- a/ojluni/src/main/native/ServerSocketChannelImpl.c
+++ b/ojluni/src/main/native/ServerSocketChannelImpl.c
@@ -137,7 +137,7 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this,
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Java_sun_nio_ch_ServerSocketChannelImpl, initIDs, "()V"),
NATIVE_METHOD(Java_sun_nio_ch_ServerSocketChannelImpl, accept0,
"(Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;[Ljava/net/InetSocketAddress;)I"),
diff --git a/ojluni/src/main/native/SocketChannelImpl.c b/ojluni/src/main/native/SocketChannelImpl.c
index 94291659cf..9e54369054 100644
--- a/ojluni/src/main/native/SocketChannelImpl.c
+++ b/ojluni/src/main/native/SocketChannelImpl.c
@@ -96,7 +96,7 @@ Java_sun_nio_ch_SocketChannelImpl_sendOutOfBandData(JNIEnv* env, jclass this,
return convertReturnVal(env, n, JNI_FALSE);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(SocketChannelImpl, checkConnect, "(Ljava/io/FileDescriptor;ZZ)I"),
NATIVE_METHOD(SocketChannelImpl, sendOutOfBandData, "(Ljava/io/FileDescriptor;B)I"),
};
diff --git a/ojluni/src/main/native/SocketInputStream.c b/ojluni/src/main/native/SocketInputStream.c
index dcea334fd1..aa10f4e9c1 100644
--- a/ojluni/src/main/native/SocketInputStream.c
+++ b/ojluni/src/main/native/SocketInputStream.c
@@ -153,7 +153,7 @@ SocketInputStream_socketRead0(JNIEnv *env, jobject this,
return nread;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(SocketInputStream, socketRead0, "(Ljava/io/FileDescriptor;[BIII)I"),
};
diff --git a/ojluni/src/main/native/SocketOutputStream.c b/ojluni/src/main/native/SocketOutputStream.c
index bc3522bee3..d72fd1108b 100644
--- a/ojluni/src/main/native/SocketOutputStream.c
+++ b/ojluni/src/main/native/SocketOutputStream.c
@@ -128,7 +128,7 @@ SocketOutputStream_socketWrite0(JNIEnv *env, jobject this,
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(SocketOutputStream, socketWrite0, "(Ljava/io/FileDescriptor;[BII)V"),
};
diff --git a/ojluni/src/main/native/StrictMath.c b/ojluni/src/main/native/StrictMath.c
index 7f9bbebcdf..24b29228a4 100644
--- a/ojluni/src/main/native/StrictMath.c
+++ b/ojluni/src/main/native/StrictMath.c
@@ -156,7 +156,7 @@ StrictMath_expm1(JNIEnv *env, jclass unused, jdouble d)
return (jdouble) ieee_expm1((double)d);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(StrictMath, cos, "(D)D"),
NATIVE_METHOD(StrictMath, sin, "(D)D"),
NATIVE_METHOD(StrictMath, tan, "(D)D"),
diff --git a/ojluni/src/main/native/String.c b/ojluni/src/main/native/String.c
index 011089de08..da24b3c805 100644
--- a/ojluni/src/main/native/String.c
+++ b/ojluni/src/main/native/String.c
@@ -35,7 +35,7 @@ String_intern(JNIEnv *env, jobject this)
{
return JVM_InternString(env, this);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(String, intern, "()Ljava/lang/String;"),
};
diff --git a/ojluni/src/main/native/System.c b/ojluni/src/main/native/System.c
index 6cfee92e5a..6948219544 100644
--- a/ojluni/src/main/native/System.c
+++ b/ojluni/src/main/native/System.c
@@ -262,7 +262,7 @@ static jlong System_currentTimeMillis(JNIEnv* env, jclass unused) {
return JVM_CurrentTimeMillis(NULL, NULL);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(System, mapLibraryName, "(Ljava/lang/String;)Ljava/lang/String;"),
NATIVE_METHOD(System, setErr0, "(Ljava/io/PrintStream;)V"),
NATIVE_METHOD(System, setOut0, "(Ljava/io/PrintStream;)V"),
diff --git a/ojluni/src/main/native/Thread.c b/ojluni/src/main/native/Thread.c
index 83b448f87f..f647c66887 100644
--- a/ojluni/src/main/native/Thread.c
+++ b/ojluni/src/main/native/Thread.c
@@ -40,7 +40,7 @@
#define ARRAY_LENGTH(a) (sizeof(a)/sizeof(a[0]))
-static JNINativeMethod methods[] = {
+static const JNINativeMethod methods[] = {
{"start0", "(JZ)V", (void *)&JVM_StartThread},
{"setPriority0", "(I)V", (void *)&JVM_SetThreadPriority},
{"yield", "()V", (void *)&JVM_Yield},
diff --git a/ojluni/src/main/native/Throwable.c b/ojluni/src/main/native/Throwable.c
index 805c80a3ac..24575d819e 100644
--- a/ojluni/src/main/native/Throwable.c
+++ b/ojluni/src/main/native/Throwable.c
@@ -65,7 +65,7 @@ Throwable_getStackTraceElement(JNIEnv *env,
{
return JVM_GetStackTraceElement(env, throwable, index);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Throwable, fillInStackTrace, "(I)Ljava/lang/Throwable;"),
NATIVE_METHOD(Throwable, getStackTraceDepth, "()I"),
NATIVE_METHOD(Throwable, getStackTraceElement, "(I)Ljava/lang/StackTraceElement;"),
diff --git a/ojluni/src/main/native/UNIXProcess_md.c b/ojluni/src/main/native/UNIXProcess_md.c
index 550a5c5932..c651413924 100644
--- a/ojluni/src/main/native/UNIXProcess_md.c
+++ b/ojluni/src/main/native/UNIXProcess_md.c
@@ -974,7 +974,7 @@ UNIXProcess_destroyProcess(JNIEnv *env, jobject junk, jint pid)
kill(pid, SIGTERM);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(UNIXProcess, destroyProcess, "(I)V"),
NATIVE_METHOD(UNIXProcess, forkAndExec, "([B[BI[BI[B[IZ)I"),
NATIVE_METHOD(UNIXProcess, waitForProcessExit, "(I)I"),
diff --git a/ojluni/src/main/native/UnixFileSystem_md.c b/ojluni/src/main/native/UnixFileSystem_md.c
index 0c53f095eb..3cedc77190 100644
--- a/ojluni/src/main/native/UnixFileSystem_md.c
+++ b/ojluni/src/main/native/UnixFileSystem_md.c
@@ -473,7 +473,7 @@ Java_java_io_UnixFileSystem_getSpace0(JNIEnv *env, jobject this,
return rv;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(UnixFileSystem, initIDs, "()V"),
NATIVE_METHOD(UnixFileSystem, canonicalize0, "(Ljava/lang/String;)Ljava/lang/String;"),
NATIVE_METHOD(UnixFileSystem, getBooleanAttributes0, "(Ljava/lang/String;)I"),
diff --git a/ojluni/src/main/native/java_util_zip_CRC32.c b/ojluni/src/main/native/java_util_zip_CRC32.c
index cec99de0eb..cb17feec59 100644
--- a/ojluni/src/main/native/java_util_zip_CRC32.c
+++ b/ojluni/src/main/native/java_util_zip_CRC32.c
@@ -74,7 +74,7 @@ CRC32_updateByteBuffer(JNIEnv *env, jclass cls, jint crc,
return crc;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(CRC32, update, "(II)I"),
NATIVE_METHOD(CRC32, updateBytes, "(I[BII)I"),
NATIVE_METHOD(CRC32, updateByteBuffer, "(IJII)I"),
diff --git a/ojluni/src/main/native/java_util_zip_Deflater.c b/ojluni/src/main/native/java_util_zip_Deflater.c
index 9ee032619d..2230f8c951 100644
--- a/ojluni/src/main/native/java_util_zip_Deflater.c
+++ b/ojluni/src/main/native/java_util_zip_Deflater.c
@@ -240,7 +240,7 @@ Deflater_end(JNIEnv *env, jclass cls, jlong addr)
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Deflater, init, "(IIZ)J"),
NATIVE_METHOD(Deflater, setDictionary, "(J[BII)V"),
NATIVE_METHOD(Deflater, deflateBytes, "(J[BIII)I"),
diff --git a/ojluni/src/main/native/java_util_zip_Inflater.c b/ojluni/src/main/native/java_util_zip_Inflater.c
index c4c24f0fed..23b107426d 100644
--- a/ojluni/src/main/native/java_util_zip_Inflater.c
+++ b/ojluni/src/main/native/java_util_zip_Inflater.c
@@ -201,7 +201,7 @@ Inflater_end(JNIEnv *env, jclass cls, jlong addr)
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Inflater, init, "(Z)J"),
NATIVE_METHOD(Inflater, setDictionary, "(J[BII)V"),
NATIVE_METHOD(Inflater, inflateBytes, "(J[BII)I"),
diff --git a/ojluni/src/main/native/java_util_zip_ZipFile.c b/ojluni/src/main/native/java_util_zip_ZipFile.c
index daf5d8efff..78b26fdfa5 100644
--- a/ojluni/src/main/native/java_util_zip_ZipFile.c
+++ b/ojluni/src/main/native/java_util_zip_ZipFile.c
@@ -393,7 +393,7 @@ JarFile_getMetaInfEntryNames(JNIEnv *env, jobject obj)
return result;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ZipFile, getFileDescriptor, "(J)I"),
NATIVE_METHOD(ZipFile, getEntry, "(J[BZ)J"),
NATIVE_METHOD(ZipFile, freeEntry, "(JJ)V"),
@@ -414,7 +414,7 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(ZipFile, getZipMessage, "(J)Ljava/lang/String;"),
};
-static JNINativeMethod gJarFileMethods[] = {
+static const JNINativeMethod gJarFileMethods[] = {
NATIVE_METHOD(JarFile, getMetaInfEntryNames, "()[Ljava/lang/String;"),
};

View File

@ -0,0 +1,245 @@
From 866f0df315bb1172d73648b61999af01a1130971 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Sun, 17 Mar 2019 21:19:00 -0400
Subject: [PATCH] constify JNINativeMethod tables
---
jni/com_android_bluetooth_a2dp.cpp | 2 +-
jni/com_android_bluetooth_a2dp_sink.cpp | 2 +-
jni/com_android_bluetooth_avrcp.cpp | 2 +-
jni/com_android_bluetooth_avrcp_controller.cpp | 2 +-
jni/com_android_bluetooth_avrcp_target.cpp | 2 +-
jni/com_android_bluetooth_btservice_AdapterService.cpp | 2 +-
jni/com_android_bluetooth_gatt.cpp | 8 ++++----
jni/com_android_bluetooth_hdp.cpp | 2 +-
jni/com_android_bluetooth_hearing_aid.cpp | 2 +-
jni/com_android_bluetooth_hfp.cpp | 2 +-
jni/com_android_bluetooth_hfpclient.cpp | 2 +-
jni/com_android_bluetooth_hid_device.cpp | 2 +-
jni/com_android_bluetooth_hid_host.cpp | 2 +-
jni/com_android_bluetooth_pan.cpp | 2 +-
jni/com_android_bluetooth_sdp.cpp | 2 +-
15 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/jni/com_android_bluetooth_a2dp.cpp b/jni/com_android_bluetooth_a2dp.cpp
index 126405a3b..15be176b6 100644
--- a/jni/com_android_bluetooth_a2dp.cpp
+++ b/jni/com_android_bluetooth_a2dp.cpp
@@ -443,7 +443,7 @@ static jboolean setCodecConfigPreferenceNative(JNIEnv* env, jobject object,
return (status == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "(I[Landroid/bluetooth/BluetoothCodecConfig;)V",
(void*)initNative},
diff --git a/jni/com_android_bluetooth_a2dp_sink.cpp b/jni/com_android_bluetooth_a2dp_sink.cpp
index 50c5087de..1ef93b9bc 100644
--- a/jni/com_android_bluetooth_a2dp_sink.cpp
+++ b/jni/com_android_bluetooth_a2dp_sink.cpp
@@ -219,7 +219,7 @@ static void informAudioTrackGainNative(JNIEnv* env, jobject object,
sBluetoothA2dpInterface->set_audio_track_gain((float)gain);
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "()V", (void*)initNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_avrcp.cpp b/jni/com_android_bluetooth_avrcp.cpp
index 1eb3553ee..7d9a81dcc 100644
--- a/jni/com_android_bluetooth_avrcp.cpp
+++ b/jni/com_android_bluetooth_avrcp.cpp
@@ -1400,7 +1400,7 @@ static jboolean addToNowPlayingRspNative(JNIEnv* env, jobject object,
return (status == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "()V", (void*)initNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_avrcp_controller.cpp b/jni/com_android_bluetooth_avrcp_controller.cpp
index 7710a91e5..90d56972b 100644
--- a/jni/com_android_bluetooth_avrcp_controller.cpp
+++ b/jni/com_android_bluetooth_avrcp_controller.cpp
@@ -1054,7 +1054,7 @@ static void playItemNative(JNIEnv* env, jobject object, jbyteArray address,
env->ReleaseByteArrayElements(address, addr, 0);
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "()V", (void*)initNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_avrcp_target.cpp b/jni/com_android_bluetooth_avrcp_target.cpp
index 8ac04e4f3..e55c13f50 100644
--- a/jni/com_android_bluetooth_avrcp_target.cpp
+++ b/jni/com_android_bluetooth_avrcp_target.cpp
@@ -800,7 +800,7 @@ static void setVolume(int8_t volume) {
sCallbackEnv->CallVoidMethod(mJavaInterface, method_setVolume, volume);
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "()V", (void*)initNative},
{"sendMediaUpdateNative", "(ZZZ)V", (void*)sendMediaUpdateNative},
diff --git a/jni/com_android_bluetooth_btservice_AdapterService.cpp b/jni/com_android_bluetooth_btservice_AdapterService.cpp
index 976e388e4..a3babf11a 100644
--- a/jni/com_android_bluetooth_btservice_AdapterService.cpp
+++ b/jni/com_android_bluetooth_btservice_AdapterService.cpp
@@ -1217,7 +1217,7 @@ static void interopDatabaseAddNative(JNIEnv* env, jobject obj, int feature,
env->ReleaseByteArrayElements(address, addr, 0);
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
/* name, signature, funcPtr */
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "()Z", (void*)initNative},
diff --git a/jni/com_android_bluetooth_gatt.cpp b/jni/com_android_bluetooth_gatt.cpp
index 86e667b4a..da573543a 100644
--- a/jni/com_android_bluetooth_gatt.cpp
+++ b/jni/com_android_bluetooth_gatt.cpp
@@ -2064,7 +2064,7 @@ static void gattTestNative(JNIEnv* env, jobject object, jint command,
*/
// JNI functions defined in AdvertiseManager class.
-static JNINativeMethod sAdvertiseMethods[] = {
+static const JNINativeMethod sAdvertiseMethods[] = {
{"classInitNative", "()V", (void*)advertiseClassInitNative},
{"initializeNative", "()V", (void*)advertiseInitializeNative},
{"cleanupNative", "()V", (void*)advertiseCleanupNative},
@@ -2091,7 +2091,7 @@ static JNINativeMethod sAdvertiseMethods[] = {
};
// JNI functions defined in PeriodicScanManager class.
-static JNINativeMethod sPeriodicScanMethods[] = {
+static const JNINativeMethod sPeriodicScanMethods[] = {
{"classInitNative", "()V", (void*)periodicScanClassInitNative},
{"initializeNative", "()V", (void*)periodicScanInitializeNative},
{"cleanupNative", "()V", (void*)periodicScanCleanupNative},
@@ -2100,7 +2100,7 @@ static JNINativeMethod sPeriodicScanMethods[] = {
};
// JNI functions defined in ScanManager class.
-static JNINativeMethod sScanMethods[] = {
+static const JNINativeMethod sScanMethods[] = {
{"registerScannerNative", "(JJ)V", (void*)registerScannerNative},
{"unregisterScannerNative", "(I)V", (void*)unregisterScannerNative},
{"gattClientScanNative", "(Z)V", (void*)gattClientScanNative},
@@ -2133,7 +2133,7 @@ static JNINativeMethod sScanMethods[] = {
};
// JNI functions defined in GattService class.
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initializeNative", "()V", (void*)initializeNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_hdp.cpp b/jni/com_android_bluetooth_hdp.cpp
index 3abc24352..27615a943 100644
--- a/jni/com_android_bluetooth_hdp.cpp
+++ b/jni/com_android_bluetooth_hdp.cpp
@@ -225,7 +225,7 @@ static jboolean disconnectChannelNative(JNIEnv* env, jobject object,
return JNI_TRUE;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initializeNative", "()V", (void*)initializeNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_hearing_aid.cpp b/jni/com_android_bluetooth_hearing_aid.cpp
index 1602aacbe..76f3e5f71 100644
--- a/jni/com_android_bluetooth_hearing_aid.cpp
+++ b/jni/com_android_bluetooth_hearing_aid.cpp
@@ -237,7 +237,7 @@ static void setVolumeNative(JNIEnv* env, jclass clazz, jint volume) {
sHearingAidInterface->SetVolume(volume);
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "()V", (void*)initNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_hfp.cpp b/jni/com_android_bluetooth_hfp.cpp
index 8547aa69b..daaed30f8 100644
--- a/jni/com_android_bluetooth_hfp.cpp
+++ b/jni/com_android_bluetooth_hfp.cpp
@@ -887,7 +887,7 @@ static jboolean setActiveDeviceNative(JNIEnv* env, jobject object,
return (status == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initializeNative", "(IZ)V", (void*)initializeNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_hfpclient.cpp b/jni/com_android_bluetooth_hfpclient.cpp
index 3dfc86e93..7ad893ce9 100644
--- a/jni/com_android_bluetooth_hfpclient.cpp
+++ b/jni/com_android_bluetooth_hfpclient.cpp
@@ -773,7 +773,7 @@ static jboolean sendATCmdNative(JNIEnv* env, jobject object, jbyteArray address,
return (status == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initializeNative", "()V", (void*)initializeNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_hid_device.cpp b/jni/com_android_bluetooth_hid_device.cpp
index 403e90403..0b792c974 100644
--- a/jni/com_android_bluetooth_hid_device.cpp
+++ b/jni/com_android_bluetooth_hid_device.cpp
@@ -498,7 +498,7 @@ static jboolean disconnectNative(JNIEnv* env, jobject thiz) {
return result;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "()V", (void*)initNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_hid_host.cpp b/jni/com_android_bluetooth_hid_host.cpp
index 7838ff6ce..9b233c654 100644
--- a/jni/com_android_bluetooth_hid_host.cpp
+++ b/jni/com_android_bluetooth_hid_host.cpp
@@ -498,7 +498,7 @@ static jboolean setIdleTimeNative(JNIEnv* env, jobject object,
return status == BT_STATUS_SUCCESS ? JNI_TRUE : JNI_FALSE;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initializeNative", "()V", (void*)initializeNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_pan.cpp b/jni/com_android_bluetooth_pan.cpp
index 85107a003..1857ff88d 100644
--- a/jni/com_android_bluetooth_pan.cpp
+++ b/jni/com_android_bluetooth_pan.cpp
@@ -231,7 +231,7 @@ static jboolean disconnectPanNative(JNIEnv* env, jobject object,
return ret;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initializeNative", "()V", (void*)initializeNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_sdp.cpp b/jni/com_android_bluetooth_sdp.cpp
index c2eb5ce78..a8fa5f5c1 100644
--- a/jni/com_android_bluetooth_sdp.cpp
+++ b/jni/com_android_bluetooth_sdp.cpp
@@ -464,7 +464,7 @@ static void cleanupNative(JNIEnv* env, jobject object) {
}
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
/* name, signature, funcPtr */
{"classInitNative", "()V", (void*)classInitNative},
{"initializeNative", "()V", (void*)initializeNative},

View File

@ -0,0 +1,92 @@
From ceaf63c790b0ef23cf5f25d1b5c361aafd2925b5 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Sun, 17 Mar 2019 20:58:37 -0400
Subject: [PATCH] constify JNINativeMethod tables
---
nci/jni/NativeLlcpConnectionlessSocket.cpp | 2 +-
nci/jni/NativeLlcpServiceSocket.cpp | 2 +-
nci/jni/NativeLlcpSocket.cpp | 2 +-
nci/jni/NativeNfcManager.cpp | 2 +-
nci/jni/NativeNfcTag.cpp | 2 +-
nci/jni/NativeP2pDevice.cpp | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/nci/jni/NativeLlcpConnectionlessSocket.cpp b/nci/jni/NativeLlcpConnectionlessSocket.cpp
index e43dbff3..78e33285 100644
--- a/nci/jni/NativeLlcpConnectionlessSocket.cpp
+++ b/nci/jni/NativeLlcpConnectionlessSocket.cpp
@@ -280,7 +280,7 @@ static jboolean nativeLlcpConnectionlessSocket_doClose(JNIEnv* e, jobject o) {
** Description: JNI functions
**
*****************************************************************************/
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{"doSendTo", "(I[B)Z", (void*)nativeLlcpConnectionlessSocket_doSendTo},
{"doReceiveFrom", "(I)Lcom/android/nfc/LlcpPacket;",
(void*)nativeLlcpConnectionlessSocket_doReceiveFrom},
diff --git a/nci/jni/NativeLlcpServiceSocket.cpp b/nci/jni/NativeLlcpServiceSocket.cpp
index 76ffeea5..4d2297c4 100644
--- a/nci/jni/NativeLlcpServiceSocket.cpp
+++ b/nci/jni/NativeLlcpServiceSocket.cpp
@@ -128,7 +128,7 @@ static jboolean nativeLlcpServiceSocket_doClose(JNIEnv* e, jobject o) {
** Description: JNI functions
**
*****************************************************************************/
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{"doAccept", "(III)Lcom/android/nfc/dhimpl/NativeLlcpSocket;",
(void*)nativeLlcpServiceSocket_doAccept},
{"doClose", "()Z", (void*)nativeLlcpServiceSocket_doClose},
diff --git a/nci/jni/NativeLlcpSocket.cpp b/nci/jni/NativeLlcpSocket.cpp
index 0ee0d248..fa49ec94 100644
--- a/nci/jni/NativeLlcpSocket.cpp
+++ b/nci/jni/NativeLlcpSocket.cpp
@@ -214,7 +214,7 @@ static jint nativeLlcpSocket_doGetRemoteSocketRW(JNIEnv* e, jobject o) {
** Description: JNI functions
**
*****************************************************************************/
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{"doConnect", "(I)Z", (void*)nativeLlcpSocket_doConnect},
{"doConnectBy", "(Ljava/lang/String;)Z",
(void*)nativeLlcpSocket_doConnectBy},
diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp
index 6f3c5695..df76790a 100755
--- a/nci/jni/NativeNfcManager.cpp
+++ b/nci/jni/NativeNfcManager.cpp
@@ -1914,7 +1914,7 @@ static jint nfcManager_getIsoDepMaxTransceiveLength(JNIEnv*, jobject) {
** JNI functions for android-4.0.1_r1
**
*****************************************************************************/
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{"doDownload", "()Z", (void*)nfcManager_doDownload},
{"initializeNativeStructure", "()Z", (void*)nfcManager_initNativeStruc},
diff --git a/nci/jni/NativeNfcTag.cpp b/nci/jni/NativeNfcTag.cpp
index 4b815aa5..b5ed47f0 100644
--- a/nci/jni/NativeNfcTag.cpp
+++ b/nci/jni/NativeNfcTag.cpp
@@ -1777,7 +1777,7 @@ void nativeNfcTag_releaseRfInterfaceMutexLock() {
** JNI functions for Android 4.0.3
**
*****************************************************************************/
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{"doConnect", "(I)I", (void*)nativeNfcTag_doConnect},
{"doDisconnect", "()Z", (void*)nativeNfcTag_doDisconnect},
{"doReconnect", "()I", (void*)nativeNfcTag_doReconnect},
diff --git a/nci/jni/NativeP2pDevice.cpp b/nci/jni/NativeP2pDevice.cpp
index 23f5db41..396c6d0c 100644
--- a/nci/jni/NativeP2pDevice.cpp
+++ b/nci/jni/NativeP2pDevice.cpp
@@ -58,7 +58,7 @@ static jboolean nativeP2pDeviceDoSend(JNIEnv*, jobject, jbyteArray) {
** Description: JNI functions
**
*****************************************************************************/
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{"doConnect", "()Z", (void*)nativeP2pDeviceDoConnect},
{"doDisconnect", "()Z", (void*)nativeP2pDeviceDoDisconnect},
{"doTransceive", "([B)[B", (void*)nativeP2pDeviceDoTransceive},

View File

@ -0,0 +1,469 @@
From e1b6653db794da9beaa0ea1f23ced5306e887fa9 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Sun, 17 Mar 2019 21:05:42 -0400
Subject: [PATCH] constify JNINativeMethod tables
---
benchmark/micro-native/micro_native.cc | 8 ++++----
runtime/native/dalvik_system_DexFile.cc | 2 +-
runtime/native/dalvik_system_VMDebug.cc | 2 +-
runtime/native/dalvik_system_VMRuntime.cc | 2 +-
runtime/native/dalvik_system_VMStack.cc | 2 +-
runtime/native/dalvik_system_ZygoteHooks.cc | 2 +-
runtime/native/java_lang_Class.cc | 2 +-
runtime/native/java_lang_Object.cc | 2 +-
runtime/native/java_lang_String.cc | 2 +-
runtime/native/java_lang_StringFactory.cc | 2 +-
runtime/native/java_lang_System.cc | 2 +-
runtime/native/java_lang_Thread.cc | 2 +-
runtime/native/java_lang_Throwable.cc | 2 +-
runtime/native/java_lang_VMClassLoader.cc | 2 +-
runtime/native/java_lang_invoke_MethodHandleImpl.cc | 2 +-
runtime/native/java_lang_ref_FinalizerReference.cc | 2 +-
runtime/native/java_lang_ref_Reference.cc | 2 +-
runtime/native/java_lang_reflect_Array.cc | 2 +-
runtime/native/java_lang_reflect_Constructor.cc | 2 +-
runtime/native/java_lang_reflect_Executable.cc | 2 +-
runtime/native/java_lang_reflect_Field.cc | 2 +-
runtime/native/java_lang_reflect_Method.cc | 2 +-
runtime/native/java_lang_reflect_Parameter.cc | 2 +-
runtime/native/java_lang_reflect_Proxy.cc | 2 +-
runtime/native/java_util_concurrent_atomic_AtomicLong.cc | 2 +-
runtime/native/libcore_util_CharsetUtils.cc | 2 +-
.../native/org_apache_harmony_dalvik_ddmc_DdmServer.cc | 2 +-
.../org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc | 2 +-
runtime/native/sun_misc_Unsafe.cc | 2 +-
test/004-JniTest/jni_test.cc | 2 +-
test/139-register-natives/regnative.cc | 2 +-
31 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/benchmark/micro-native/micro_native.cc b/benchmark/micro-native/micro_native.cc
index dffbf3b11d..e70366cc48 100644
--- a/benchmark/micro-native/micro_native.cc
+++ b/benchmark/micro-native/micro_native.cc
@@ -38,7 +38,7 @@
static void NativeMethods_emptyJniStaticSynchronizedMethod0(JNIEnv*, jclass) { }
static void NativeMethods_emptyJniSynchronizedMethod0(JNIEnv*, jclass) { }
-static JNINativeMethod gMethods_NormalOnly[] = {
+static const JNINativeMethod gMethods_NormalOnly[] = {
NATIVE_METHOD(NativeMethods, emptyJniStaticSynchronizedMethod0, "()V"),
NATIVE_METHOD(NativeMethods, emptyJniSynchronizedMethod0, "()V"),
};
@@ -53,7 +53,7 @@ static void NativeMethods_emptyJniStaticMethod6L(JNIEnv*, jclass, jobject, jarra
static void NativeMethods_emptyJniStaticMethod0(JNIEnv*, jclass) { }
static void NativeMethods_emptyJniStaticMethod6(JNIEnv*, jclass, int, int, int, int, int, int) { }
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeMethods, emptyJniMethod0, "()V"),
NATIVE_METHOD(NativeMethods, emptyJniMethod6, "(IIIIII)V"),
NATIVE_METHOD(NativeMethods, emptyJniMethod6L, "(Ljava/lang/String;[Ljava/lang/String;[[ILjava/lang/Object;[Ljava/lang/Object;[[[[Ljava/lang/Object;)V"),
@@ -72,7 +72,7 @@ static void NativeMethods_emptyJniStaticMethod6L_Fast(JNIEnv*, jclass, jobject,
static void NativeMethods_emptyJniStaticMethod0_Fast(JNIEnv*, jclass) { }
static void NativeMethods_emptyJniStaticMethod6_Fast(JNIEnv*, jclass, int, int, int, int, int, int) { }
-static JNINativeMethod gMethods_Fast[] = {
+static const JNINativeMethod gMethods_Fast[] = {
NATIVE_METHOD(NativeMethods, emptyJniMethod0_Fast, "()V"),
NATIVE_METHOD(NativeMethods, emptyJniMethod6_Fast, "(IIIIII)V"),
NATIVE_METHOD(NativeMethods, emptyJniMethod6L_Fast, "(Ljava/lang/String;[Ljava/lang/String;[[ILjava/lang/Object;[Ljava/lang/Object;[[[[Ljava/lang/Object;)V"),
@@ -88,7 +88,7 @@ DEFINE_CRITICAL_JNI_METHOD(void, emptyJniStaticMethod0_1Critical)() { }
DEFINE_NORMAL_JNI_METHOD(void, emptyJniStaticMethod6_1Critical)(JNIEnv*, jclass, int, int, int, int, int, int) { }
DEFINE_CRITICAL_JNI_METHOD(void, emptyJniStaticMethod6_1Critical)(int, int, int, int, int, int) { }
-static JNINativeMethod gMethods_Critical[] = {
+static const JNINativeMethod gMethods_Critical[] = {
// Don't use NATIVE_METHOD because the name is mangled differently.
{ "emptyJniStaticMethod0_Critical", "()V",
reinterpret_cast<void*>(NAME_CRITICAL_JNI_METHOD(emptyJniStaticMethod0_1Critical)) },
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc
index eee8cfc620..6dfe62e146 100644
--- a/runtime/native/dalvik_system_DexFile.cc
+++ b/runtime/native/dalvik_system_DexFile.cc
@@ -897,7 +897,7 @@ static void DexFile_setTrusted(JNIEnv* env, jclass, jobject j_cookie) {
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(DexFile, closeDexFile, "(Ljava/lang/Object;)Z"),
NATIVE_METHOD(DexFile,
defineClassNative,
diff --git a/runtime/native/dalvik_system_VMDebug.cc b/runtime/native/dalvik_system_VMDebug.cc
index 83398ecfeb..5b08fa7c44 100644
--- a/runtime/native/dalvik_system_VMDebug.cc
+++ b/runtime/native/dalvik_system_VMDebug.cc
@@ -623,7 +623,7 @@ static void VMDebug_setAllocTrackerStackDepth(JNIEnv* env, jclass, jint stack_de
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(VMDebug, countInstancesOfClass, "(Ljava/lang/Class;Z)J"),
NATIVE_METHOD(VMDebug, countInstancesOfClasses, "([Ljava/lang/Class;Z)[J"),
NATIVE_METHOD(VMDebug, crash, "()V"),
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc
index 399813c60e..36569c1679 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -723,7 +723,7 @@ static jboolean VMRuntime_hasBootImageSpaces(JNIEnv* env ATTRIBUTE_UNUSED,
return Runtime::Current()->GetHeap()->HasBootImageSpace() ? JNI_TRUE : JNI_FALSE;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(VMRuntime, addressOf, "(Ljava/lang/Object;)J"),
NATIVE_METHOD(VMRuntime, bootClassPath, "()Ljava/lang/String;"),
NATIVE_METHOD(VMRuntime, clampGrowthLimit, "()V"),
diff --git a/runtime/native/dalvik_system_VMStack.cc b/runtime/native/dalvik_system_VMStack.cc
index 32733a8409..33d352f572 100644
--- a/runtime/native/dalvik_system_VMStack.cc
+++ b/runtime/native/dalvik_system_VMStack.cc
@@ -169,7 +169,7 @@ static jobjectArray VMStack_getAnnotatedThreadStackTrace(JNIEnv* env, jclass, jo
return GetThreadStack(soa, javaThread, fn);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(VMStack, fillStackTraceElements, "(Ljava/lang/Thread;[Ljava/lang/StackTraceElement;)I"),
FAST_NATIVE_METHOD(VMStack, getCallingClassLoader, "()Ljava/lang/ClassLoader;"),
FAST_NATIVE_METHOD(VMStack, getClosestUserClassLoader, "()Ljava/lang/ClassLoader;"),
diff --git a/runtime/native/dalvik_system_ZygoteHooks.cc b/runtime/native/dalvik_system_ZygoteHooks.cc
index de28c28851..1334df7f74 100644
--- a/runtime/native/dalvik_system_ZygoteHooks.cc
+++ b/runtime/native/dalvik_system_ZygoteHooks.cc
@@ -420,7 +420,7 @@ static void ZygoteHooks_stopZygoteNoThreadCreation(JNIEnv* env ATTRIBUTE_UNUSED,
Runtime::Current()->SetZygoteNoThreadSection(false);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ZygoteHooks, nativePreFork, "()J"),
NATIVE_METHOD(ZygoteHooks, nativePostZygoteFork, "()V"),
NATIVE_METHOD(ZygoteHooks, nativePostForkSystemServer, "()V"),
diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc
index 2b75c59c2a..05118751dc 100644
--- a/runtime/native/java_lang_Class.cc
+++ b/runtime/native/java_lang_Class.cc
@@ -870,7 +870,7 @@ static jobject Class_newInstance(JNIEnv* env, jobject javaThis) {
return soa.AddLocalReference<jobject>(receiver.Get());
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Class, classForName,
"(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;"),
FAST_NATIVE_METHOD(Class, getDeclaredAnnotation,
diff --git a/runtime/native/java_lang_Object.cc b/runtime/native/java_lang_Object.cc
index 48540f877d..aaf934ed6d 100644
--- a/runtime/native/java_lang_Object.cc
+++ b/runtime/native/java_lang_Object.cc
@@ -52,7 +52,7 @@ static jint Object_identityHashCodeNative(JNIEnv* env, jclass, jobject javaObjec
return static_cast<jint>(o->IdentityHashCode());
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Object, internalClone, "()Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Object, notify, "()V"),
FAST_NATIVE_METHOD(Object, notifyAll, "()V"),
diff --git a/runtime/native/java_lang_String.cc b/runtime/native/java_lang_String.cc
index 83498f6eb0..80c8dbc3e3 100644
--- a/runtime/native/java_lang_String.cc
+++ b/runtime/native/java_lang_String.cc
@@ -109,7 +109,7 @@ static jcharArray String_toCharArray(JNIEnv* env, jobject java_this) {
return soa.AddLocalReference<jcharArray>(s->ToCharArray(soa.Self()));
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(String, charAt, "(I)C"),
FAST_NATIVE_METHOD(String, compareTo, "(Ljava/lang/String;)I"),
FAST_NATIVE_METHOD(String, concat, "(Ljava/lang/String;)Ljava/lang/String;"),
diff --git a/runtime/native/java_lang_StringFactory.cc b/runtime/native/java_lang_StringFactory.cc
index 13f8d5be8e..8e59466239 100644
--- a/runtime/native/java_lang_StringFactory.cc
+++ b/runtime/native/java_lang_StringFactory.cc
@@ -89,7 +89,7 @@ static jstring StringFactory_newStringFromString(JNIEnv* env, jclass, jstring to
return soa.AddLocalReference<jstring>(result);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(StringFactory, newStringFromBytes, "([BIII)Ljava/lang/String;"),
FAST_NATIVE_METHOD(StringFactory, newStringFromChars, "(II[C)Ljava/lang/String;"),
FAST_NATIVE_METHOD(StringFactory, newStringFromString, "(Ljava/lang/String;)Ljava/lang/String;"),
diff --git a/runtime/native/java_lang_System.cc b/runtime/native/java_lang_System.cc
index 63cbd2c815..e7b3894aad 100644
--- a/runtime/native/java_lang_System.cc
+++ b/runtime/native/java_lang_System.cc
@@ -239,7 +239,7 @@ static void System_arraycopyBooleanUnchecked(JNIEnv* env,
javaDst, dstPos, count);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(System, arraycopy, "(Ljava/lang/Object;ILjava/lang/Object;II)V"),
FAST_NATIVE_METHOD(System, arraycopyCharUnchecked, "([CI[CII)V"),
FAST_NATIVE_METHOD(System, arraycopyByteUnchecked, "([BI[BII)V"),
diff --git a/runtime/native/java_lang_Thread.cc b/runtime/native/java_lang_Thread.cc
index 37b3fe642e..5f3f54a85f 100644
--- a/runtime/native/java_lang_Thread.cc
+++ b/runtime/native/java_lang_Thread.cc
@@ -194,7 +194,7 @@ static void Thread_yield(JNIEnv*, jobject) {
sched_yield();
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Thread, currentThread, "()Ljava/lang/Thread;"),
FAST_NATIVE_METHOD(Thread, interrupted, "()Z"),
FAST_NATIVE_METHOD(Thread, isInterrupted, "()Z"),
diff --git a/runtime/native/java_lang_Throwable.cc b/runtime/native/java_lang_Throwable.cc
index b5ef7d807b..7a6a44baa5 100644
--- a/runtime/native/java_lang_Throwable.cc
+++ b/runtime/native/java_lang_Throwable.cc
@@ -38,7 +38,7 @@ static jobjectArray Throwable_nativeGetStackTrace(JNIEnv* env, jclass, jobject j
return Thread::InternalStackTraceToStackTraceElementArray(soa, javaStackState);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Throwable, nativeFillInStackTrace, "()Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Throwable, nativeGetStackTrace, "(Ljava/lang/Object;)[Ljava/lang/StackTraceElement;"),
};
diff --git a/runtime/native/java_lang_VMClassLoader.cc b/runtime/native/java_lang_VMClassLoader.cc
index 11e02a2ce4..ce37a33086 100644
--- a/runtime/native/java_lang_VMClassLoader.cc
+++ b/runtime/native/java_lang_VMClassLoader.cc
@@ -155,7 +155,7 @@ static jobjectArray VMClassLoader_getBootClassPathEntries(JNIEnv* env, jclass) {
return array;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(VMClassLoader, findLoadedClass, "(Ljava/lang/ClassLoader;Ljava/lang/String;)Ljava/lang/Class;"),
NATIVE_METHOD(VMClassLoader, getBootClassPathEntries, "()[Ljava/lang/String;"),
};
diff --git a/runtime/native/java_lang_invoke_MethodHandleImpl.cc b/runtime/native/java_lang_invoke_MethodHandleImpl.cc
index 0b26bd7c4a..6662fe49a2 100644
--- a/runtime/native/java_lang_invoke_MethodHandleImpl.cc
+++ b/runtime/native/java_lang_invoke_MethodHandleImpl.cc
@@ -68,7 +68,7 @@ static jobject MethodHandleImpl_getMemberInternal(JNIEnv* env, jobject thiz) {
return soa.AddLocalReference<jobject>(h_object.Get());
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(MethodHandleImpl, getMemberInternal, "()Ljava/lang/reflect/Member;"),
};
diff --git a/runtime/native/java_lang_ref_FinalizerReference.cc b/runtime/native/java_lang_ref_FinalizerReference.cc
index 535b243411..0a8dfb6c09 100644
--- a/runtime/native/java_lang_ref_FinalizerReference.cc
+++ b/runtime/native/java_lang_ref_FinalizerReference.cc
@@ -42,7 +42,7 @@ static jobject FinalizerReference_getReferent(JNIEnv* env, jobject javaThis) {
return soa.AddLocalReference<jobject>(referent);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(FinalizerReference, makeCircularListIfUnenqueued, "()Z"),
FAST_NATIVE_METHOD(FinalizerReference, getReferent, "()Ljava/lang/Object;"),
};
diff --git a/runtime/native/java_lang_ref_Reference.cc b/runtime/native/java_lang_ref_Reference.cc
index b241b1de25..89a381878c 100644
--- a/runtime/native/java_lang_ref_Reference.cc
+++ b/runtime/native/java_lang_ref_Reference.cc
@@ -42,7 +42,7 @@ static void Reference_clearReferent(JNIEnv* env, jobject javaThis) {
Runtime::Current()->GetHeap()->GetReferenceProcessor()->ClearReferent(ref);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Reference, getReferent, "()Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Reference, clearReferent, "()V"),
};
diff --git a/runtime/native/java_lang_reflect_Array.cc b/runtime/native/java_lang_reflect_Array.cc
index ff94593cdf..e359e7d8a8 100644
--- a/runtime/native/java_lang_reflect_Array.cc
+++ b/runtime/native/java_lang_reflect_Array.cc
@@ -74,7 +74,7 @@ static jobject Array_createObjectArray(JNIEnv* env, jclass, jclass javaElementCl
return soa.AddLocalReference<jobject>(new_array);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Array, createMultiArray, "(Ljava/lang/Class;[I)Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Array, createObjectArray, "(Ljava/lang/Class;I)Ljava/lang/Object;"),
};
diff --git a/runtime/native/java_lang_reflect_Constructor.cc b/runtime/native/java_lang_reflect_Constructor.cc
index f9cdc360bc..bc8c38d246 100644
--- a/runtime/native/java_lang_reflect_Constructor.cc
+++ b/runtime/native/java_lang_reflect_Constructor.cc
@@ -128,7 +128,7 @@ static jobject Constructor_newInstanceFromSerialization(JNIEnv* env, jclass unus
return env->NewObject(allocClass, ctor);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Constructor, getExceptionTypes, "()[Ljava/lang/Class;"),
FAST_NATIVE_METHOD(Constructor, newInstance0, "([Ljava/lang/Object;)Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Constructor, newInstanceFromSerialization, "(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/Object;"),
diff --git a/runtime/native/java_lang_reflect_Executable.cc b/runtime/native/java_lang_reflect_Executable.cc
index 2ce56b5153..4ba93e3dde 100644
--- a/runtime/native/java_lang_reflect_Executable.cc
+++ b/runtime/native/java_lang_reflect_Executable.cc
@@ -383,7 +383,7 @@ static jint Executable_getParameterCountInternal(JNIEnv* env, jobject javaMethod
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Executable, compareMethodParametersInternal,
"(Ljava/lang/reflect/Method;)I"),
FAST_NATIVE_METHOD(Executable, getAnnotationNative,
diff --git a/runtime/native/java_lang_reflect_Field.cc b/runtime/native/java_lang_reflect_Field.cc
index f21ded9c23..eefb3cc5f6 100644
--- a/runtime/native/java_lang_reflect_Field.cc
+++ b/runtime/native/java_lang_reflect_Field.cc
@@ -505,7 +505,7 @@ static jboolean Field_isAnnotationPresentNative(JNIEnv* env,
return annotations::IsFieldAnnotationPresent(field, klass);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Field, get, "(Ljava/lang/Object;)Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Field, getBoolean, "(Ljava/lang/Object;)Z"),
FAST_NATIVE_METHOD(Field, getByte, "(Ljava/lang/Object;)B"),
diff --git a/runtime/native/java_lang_reflect_Method.cc b/runtime/native/java_lang_reflect_Method.cc
index 4525157d6e..e435ee7d3d 100644
--- a/runtime/native/java_lang_reflect_Method.cc
+++ b/runtime/native/java_lang_reflect_Method.cc
@@ -84,7 +84,7 @@ static jobject Method_invoke(JNIEnv* env, jobject javaMethod, jobject javaReceiv
return InvokeMethod(soa, javaMethod, javaReceiver, javaArgs);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Method, getDefaultValue, "()Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Method, getExceptionTypes, "()[Ljava/lang/Class;"),
FAST_NATIVE_METHOD(Method, invoke, "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;"),
diff --git a/runtime/native/java_lang_reflect_Parameter.cc b/runtime/native/java_lang_reflect_Parameter.cc
index 263a56796f..92bf9078a4 100644
--- a/runtime/native/java_lang_reflect_Parameter.cc
+++ b/runtime/native/java_lang_reflect_Parameter.cc
@@ -98,7 +98,7 @@ static jobject Parameter_getAnnotationNative(JNIEnv* env,
annotations::GetAnnotationForMethodParameter(method, parameterIndex, klass));
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(
Parameter,
getAnnotationNative,
diff --git a/runtime/native/java_lang_reflect_Proxy.cc b/runtime/native/java_lang_reflect_Proxy.cc
index f723ed223d..c2b533de5d 100644
--- a/runtime/native/java_lang_reflect_Proxy.cc
+++ b/runtime/native/java_lang_reflect_Proxy.cc
@@ -37,7 +37,7 @@ static jclass Proxy_generateProxy(JNIEnv* env, jclass, jstring name, jobjectArra
soa, name, interfaces, loader, methods, throws));
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Proxy, generateProxy, "(Ljava/lang/String;[Ljava/lang/Class;Ljava/lang/ClassLoader;[Ljava/lang/reflect/Method;[[Ljava/lang/Class;)Ljava/lang/Class;"),
};
diff --git a/runtime/native/java_util_concurrent_atomic_AtomicLong.cc b/runtime/native/java_util_concurrent_atomic_AtomicLong.cc
index fa288edcb8..299ac5a61d 100644
--- a/runtime/native/java_util_concurrent_atomic_AtomicLong.cc
+++ b/runtime/native/java_util_concurrent_atomic_AtomicLong.cc
@@ -30,7 +30,7 @@ static jboolean AtomicLong_VMSupportsCS8(JNIEnv*, jclass) {
return QuasiAtomic::LongAtomicsUseMutexes(kRuntimeISA) ? JNI_FALSE : JNI_TRUE;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(AtomicLong, VMSupportsCS8, "()Z"),
};
diff --git a/runtime/native/libcore_util_CharsetUtils.cc b/runtime/native/libcore_util_CharsetUtils.cc
index 95e0d79cd9..b86bda4672 100644
--- a/runtime/native/libcore_util_CharsetUtils.cc
+++ b/runtime/native/libcore_util_CharsetUtils.cc
@@ -252,7 +252,7 @@ static jbyteArray CharsetUtils_toUtf8Bytes(JNIEnv* env, jclass, jstring java_str
return out.toByteArray();
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(CharsetUtils, asciiBytesToChars, "([BII[C)V"),
FAST_NATIVE_METHOD(CharsetUtils, isoLatin1BytesToChars, "([BII[C)V"),
FAST_NATIVE_METHOD(CharsetUtils, toAsciiBytes, "(Ljava/lang/String;II)[B"),
diff --git a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
index 419aed8578..ccbef4f3f4 100644
--- a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
+++ b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
@@ -38,7 +38,7 @@ static void DdmServer_nativeSendChunk(JNIEnv* env, jclass, jint type,
Runtime::Current()->GetRuntimeCallbacks()->DdmPublishChunk(static_cast<uint32_t>(type), chunk);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(DdmServer, nativeSendChunk, "(I[BII)V"),
};
diff --git a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
index 028675d448..2ca9089e72 100644
--- a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
+++ b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
@@ -175,7 +175,7 @@ static void DdmVmInternal_threadNotify(JNIEnv*, jclass, jboolean enable) {
Dbg::DdmSetThreadNotification(enable);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(DdmVmInternal, enableRecentAllocations, "(Z)V"),
FAST_NATIVE_METHOD(DdmVmInternal, getRecentAllocations, "()[B"),
FAST_NATIVE_METHOD(DdmVmInternal, getRecentAllocationStatus, "()Z"),
diff --git a/runtime/native/sun_misc_Unsafe.cc b/runtime/native/sun_misc_Unsafe.cc
index 5014f340cd..bb9226d1fa 100644
--- a/runtime/native/sun_misc_Unsafe.cc
+++ b/runtime/native/sun_misc_Unsafe.cc
@@ -541,7 +541,7 @@ static void Unsafe_unpark(JNIEnv* env, jobject, jobject jthread) {
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Unsafe, compareAndSwapInt, "(Ljava/lang/Object;JII)Z"),
FAST_NATIVE_METHOD(Unsafe, compareAndSwapLong, "(Ljava/lang/Object;JJJ)Z"),
FAST_NATIVE_METHOD(Unsafe, compareAndSwapObject, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z"),
diff --git a/test/004-JniTest/jni_test.cc b/test/004-JniTest/jni_test.cc
index 540e6ce357..405ccd45c1 100644
--- a/test/004-JniTest/jni_test.cc
+++ b/test/004-JniTest/jni_test.cc
@@ -33,7 +33,7 @@ static JavaVM* jvm = nullptr;
static jint Java_Main_intFastNativeMethod(JNIEnv*, jclass, jint a, jint b, jint c);
static jint Java_Main_intCriticalNativeMethod(jint a, jint b, jint c);
-static JNINativeMethod sMainMethods[] = {
+static const JNINativeMethod sMainMethods[] = {
{"intFastNativeMethod", "(III)I", reinterpret_cast<void*>(Java_Main_intFastNativeMethod) },
{"intCriticalNativeMethod", "(III)I", reinterpret_cast<void*>(Java_Main_intCriticalNativeMethod) },
};
diff --git a/test/139-register-natives/regnative.cc b/test/139-register-natives/regnative.cc
index d9c8b31ac7..083c14c1ec 100644
--- a/test/139-register-natives/regnative.cc
+++ b/test/139-register-natives/regnative.cc
@@ -22,7 +22,7 @@ namespace art {
static void foo(JNIEnv*, jclass) {
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "foo", "()V", reinterpret_cast<void*>(foo) }
};

View File

@ -0,0 +1,22 @@
From b8afb8af3773d630550354bd3da95da947fbb81e Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Sun, 17 Mar 2019 21:11:48 -0400
Subject: [PATCH] constify JNINativeMethod table
---
common/src/jni/main/cpp/conscrypt/native_crypto.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/src/jni/main/cpp/conscrypt/native_crypto.cc b/common/src/jni/main/cpp/conscrypt/native_crypto.cc
index 1a0679c3..d838e9ab 100644
--- a/common/src/jni/main/cpp/conscrypt/native_crypto.cc
+++ b/common/src/jni/main/cpp/conscrypt/native_crypto.cc
@@ -9917,7 +9917,7 @@ static jlong NativeCrypto_SSL_get1_session(JNIEnv* env, jclass, jlong ssl_addres
#define REF_X509_CRL "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/OpenSSLX509CRL;"
#define REF_SSL "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeSsl;"
#define REF_SSL_CTX "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/AbstractSessionContext;"
-static JNINativeMethod sNativeCryptoMethods[] = {
+static const JNINativeMethod sNativeCryptoMethods[] = {
CONSCRYPT_NATIVE_METHOD(clinit, "()V"),
CONSCRYPT_NATIVE_METHOD(EVP_PKEY_new_RSA, "([B[B[B[B[B[B[B[B)J"),
CONSCRYPT_NATIVE_METHOD(EVP_PKEY_new_EC_KEY, "(" REF_EC_GROUP REF_EC_POINT "[B)J"),

View File

@ -0,0 +1,199 @@
From 07071814db0786252ddcb6149c61ea78be22f858 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Sun, 17 Mar 2019 20:12:52 -0400
Subject: [PATCH] constify JNINativeMethod tables
---
cmds/hid/jni/com_android_commands_hid_Device.cpp | 2 +-
core/jni/android_app_ActivityThread.cpp | 2 +-
core/jni/android_os_HwBinder.cpp | 2 +-
core/jni/android_os_HwBlob.cpp | 2 +-
core/jni/android_os_HwParcel.cpp | 2 +-
core/jni/android_os_HwRemoteBinder.cpp | 2 +-
core/jni/android_util_jar_StrictJarFile.cpp | 2 +-
core/jni/android_view_DisplayListCanvas.cpp | 2 +-
media/jni/android_media_ImageWriter.cpp | 4 ++--
media/jni/android_media_MediaSync.cpp | 2 +-
media/jni/soundpool/android_media_SoundPool.cpp | 2 +-
services/core/jni/com_android_server_UsbMidiDevice.cpp | 2 +-
services/core/jni/com_android_server_tv_TvUinputBridge.cpp | 2 +-
13 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/cmds/hid/jni/com_android_commands_hid_Device.cpp b/cmds/hid/jni/com_android_commands_hid_Device.cpp
index d4fdf85491d3..e18b4f9927cb 100644
--- a/cmds/hid/jni/com_android_commands_hid_Device.cpp
+++ b/cmds/hid/jni/com_android_commands_hid_Device.cpp
@@ -283,7 +283,7 @@ static void closeDevice(JNIEnv* /* env */, jclass /* clazz */, jlong ptr) {
}
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{ "nativeOpenDevice",
"(Ljava/lang/String;III[B"
"Lcom/android/commands/hid/Device$DeviceCallback;)J",
diff --git a/core/jni/android_app_ActivityThread.cpp b/core/jni/android_app_ActivityThread.cpp
index 93f2525eb29d..fa0eed3e232e 100644
--- a/core/jni/android_app_ActivityThread.cpp
+++ b/core/jni/android_app_ActivityThread.cpp
@@ -44,7 +44,7 @@ static void android_app_ActivityThread_initZygoteChildHeapProfiling(JNIEnv* env,
android_mallopt(M_INIT_ZYGOTE_CHILD_PROFILING, nullptr, 0);
}
-static JNINativeMethod gActivityThreadMethods[] = {
+static const JNINativeMethod gActivityThreadMethods[] = {
// ------------ Regular JNI ------------------
{ "nPurgePendingResources", "()V",
(void*) android_app_ActivityThread_purgePendingResources },
diff --git a/core/jni/android_os_HwBinder.cpp b/core/jni/android_os_HwBinder.cpp
index 42e3942eb350..907c9ac27fc7 100644
--- a/core/jni/android_os_HwBinder.cpp
+++ b/core/jni/android_os_HwBinder.cpp
@@ -350,7 +350,7 @@ static void JHwBinder_report_sysprop_change(JNIEnv * /*env*/, jclass /*clazz*/)
report_sysprop_change();
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "native_init", "()J", (void *)JHwBinder_native_init },
{ "native_setup", "()V", (void *)JHwBinder_native_setup },
diff --git a/core/jni/android_os_HwBlob.cpp b/core/jni/android_os_HwBlob.cpp
index e5b72caf2792..84877da5dbb3 100644
--- a/core/jni/android_os_HwBlob.cpp
+++ b/core/jni/android_os_HwBlob.cpp
@@ -581,7 +581,7 @@ static jlong JHwBlob_native_handle(JNIEnv *env, jobject thiz) {
return handle;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "native_init", "()J", (void *)JHwBlob_native_init },
{ "native_setup", "(I)V", (void *)JHwBlob_native_setup },
diff --git a/core/jni/android_os_HwParcel.cpp b/core/jni/android_os_HwParcel.cpp
index 7221ca11cc00..08f16f607367 100644
--- a/core/jni/android_os_HwParcel.cpp
+++ b/core/jni/android_os_HwParcel.cpp
@@ -960,7 +960,7 @@ static void JHwParcel_native_writeBuffer(
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "native_init", "()J", (void *)JHwParcel_native_init },
{ "native_setup", "(Z)V", (void *)JHwParcel_native_setup },
diff --git a/core/jni/android_os_HwRemoteBinder.cpp b/core/jni/android_os_HwRemoteBinder.cpp
index f8f841c6fd26..45c7dbf77404 100644
--- a/core/jni/android_os_HwRemoteBinder.cpp
+++ b/core/jni/android_os_HwRemoteBinder.cpp
@@ -455,7 +455,7 @@ static jint JHwRemoteBinder_hashCode(JNIEnv* env, jobject thiz) {
return static_cast<jint>(longHash ^ (longHash >> 32)); // See Long.hashCode()
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "native_init", "()J", (void *)JHwRemoteBinder_native_init },
{ "native_setup_empty", "()V",
diff --git a/core/jni/android_util_jar_StrictJarFile.cpp b/core/jni/android_util_jar_StrictJarFile.cpp
index 182a621c6978..71054e1e96dc 100644
--- a/core/jni/android_util_jar_StrictJarFile.cpp
+++ b/core/jni/android_util_jar_StrictJarFile.cpp
@@ -158,7 +158,7 @@ void StrictJarFile_nativeClose(JNIEnv*, jobject, jlong nativeHandle) {
CloseArchive(reinterpret_cast<ZipArchiveHandle>(nativeHandle));
}
-JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(StrictJarFile, nativeOpenJarFile, "(Ljava/lang/String;I)J"),
NATIVE_METHOD(StrictJarFile, nativeStartIteration, "(JLjava/lang/String;)J"),
NATIVE_METHOD(StrictJarFile, nativeNextEntry, "(J)Ljava/util/zip/ZipEntry;"),
diff --git a/core/jni/android_view_DisplayListCanvas.cpp b/core/jni/android_view_DisplayListCanvas.cpp
index 40a133b9383b..693d61c1bccc 100644
--- a/core/jni/android_view_DisplayListCanvas.cpp
+++ b/core/jni/android_view_DisplayListCanvas.cpp
@@ -179,7 +179,7 @@ static void android_view_DisplayListCanvas_drawWebViewFunctor(jlong canvasPtr, j
const char* const kClassPathName = "android/graphics/RecordingCanvas";
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
// ------------ @FastNative ------------------
diff --git a/media/jni/android_media_ImageWriter.cpp b/media/jni/android_media_ImageWriter.cpp
index 7a0eeee17b0d..2d69be305a6f 100644
--- a/media/jni/android_media_ImageWriter.cpp
+++ b/media/jni/android_media_ImageWriter.cpp
@@ -963,7 +963,7 @@ static jobjectArray Image_createSurfacePlanes(JNIEnv* env, jobject thiz,
// ----------------------------------------------------------------------------
-static JNINativeMethod gImageWriterMethods[] = {
+static const JNINativeMethod gImageWriterMethods[] = {
{"nativeClassInit", "()V", (void*)ImageWriter_classInit },
{"nativeInit", "(Ljava/lang/Object;Landroid/view/Surface;II)J",
(void*)ImageWriter_init },
@@ -974,7 +974,7 @@ static JNINativeMethod gImageWriterMethods[] = {
{"cancelImage", "(JLandroid/media/Image;)V", (void*)ImageWriter_cancelImage },
};
-static JNINativeMethod gImageMethods[] = {
+static const JNINativeMethod gImageMethods[] = {
{"nativeCreatePlanes", "(II)[Landroid/media/ImageWriter$WriterSurfaceImage$SurfacePlane;",
(void*)Image_createSurfacePlanes },
{"nativeGetWidth", "()I", (void*)Image_getWidth },
diff --git a/media/jni/android_media_MediaSync.cpp b/media/jni/android_media_MediaSync.cpp
index f75200868a0d..994997f7c132 100644
--- a/media/jni/android_media_MediaSync.cpp
+++ b/media/jni/android_media_MediaSync.cpp
@@ -514,7 +514,7 @@ static void android_media_MediaSync_native_finalize(JNIEnv *env, jobject thiz) {
android_media_MediaSync_release(env, thiz);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "native_setSurface",
"(Landroid/view/Surface;)V",
(void *)android_media_MediaSync_native_setSurface },
diff --git a/media/jni/soundpool/android_media_SoundPool.cpp b/media/jni/soundpool/android_media_SoundPool.cpp
index f6706369f379..7032b4bf7ef9 100644
--- a/media/jni/soundpool/android_media_SoundPool.cpp
+++ b/media/jni/soundpool/android_media_SoundPool.cpp
@@ -242,7 +242,7 @@ android_media_SoundPool_release(JNIEnv *env, jobject thiz)
// ----------------------------------------------------------------------------
// Dalvik VM type signatures
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "_load",
"(Ljava/io/FileDescriptor;JJI)I",
(void *)android_media_SoundPool_load_FD
diff --git a/services/core/jni/com_android_server_UsbMidiDevice.cpp b/services/core/jni/com_android_server_UsbMidiDevice.cpp
index 79d935fe610c..86b43fcae705 100644
--- a/services/core/jni/com_android_server_UsbMidiDevice.cpp
+++ b/services/core/jni/com_android_server_UsbMidiDevice.cpp
@@ -135,7 +135,7 @@ android_server_UsbMidiDevice_close(JNIEnv *env, jobject thiz, jobjectArray fds)
}
}
-static JNINativeMethod method_table[] = {
+static const JNINativeMethod method_table[] = {
{ "nativeGetSubdeviceCount", "(II)I", (void*)android_server_UsbMidiDevice_get_subdevice_count },
{ "nativeOpen", "(III)[Ljava/io/FileDescriptor;", (void*)android_server_UsbMidiDevice_open },
{ "nativeClose", "([Ljava/io/FileDescriptor;)V", (void*)android_server_UsbMidiDevice_close },
diff --git a/services/core/jni/com_android_server_tv_TvUinputBridge.cpp b/services/core/jni/com_android_server_tv_TvUinputBridge.cpp
index 980922a806f5..84d6f3d83156 100644
--- a/services/core/jni/com_android_server_tv_TvUinputBridge.cpp
+++ b/services/core/jni/com_android_server_tv_TvUinputBridge.cpp
@@ -276,7 +276,7 @@ static void nativeClear(JNIEnv* env, jclass clazz, jlong ptr) {
* JNI registration
*/
-static JNINativeMethod gUinputBridgeMethods[] = {
+static const JNINativeMethod gUinputBridgeMethods[] = {
{ "nativeOpen", "(Ljava/lang/String;Ljava/lang/String;III)J",
(void*)nativeOpen },
{ "nativeClose", "(J)V",

View File

@ -0,0 +1,22 @@
From b914409e0582f093957b3f9f1d151fffdecc5136 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Sun, 31 Mar 2019 00:10:48 -0400
Subject: [PATCH] constify JNINativeMethod table
---
service/jni/com_android_server_wifi_WifiNative.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/service/jni/com_android_server_wifi_WifiNative.cpp b/service/jni/com_android_server_wifi_WifiNative.cpp
index 262357ac65..90fd2d2cf7 100644
--- a/service/jni/com_android_server_wifi_WifiNative.cpp
+++ b/service/jni/com_android_server_wifi_WifiNative.cpp
@@ -76,7 +76,7 @@ static jbyteArray android_net_wifi_readKernelLogNative(JNIEnv *env, jclass cls)
/*
* JNI registration.
*/
-static JNINativeMethod gWifiMethods[] = {
+static const JNINativeMethod gWifiMethods[] = {
NATIVE_METHOD(android_net_wifi, readKernelLogNative, "()[B"),
};

View File

@ -0,0 +1,795 @@
From 157fa7811544321cc61b9aae0218aaa5f13d4f6f Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Sun, 17 Mar 2019 20:56:50 -0400
Subject: [PATCH] constify JNINativeMethod tables
---
.../native/org_apache_harmony_dalvik_NativeTestTarget.cpp | 8 ++++----
luni/src/main/native/android_system_OsConstants.cpp | 2 +-
luni/src/main/native/java_lang_StringToReal.cpp | 2 +-
luni/src/main/native/java_lang_invoke_MethodHandle.cpp | 2 +-
luni/src/main/native/java_lang_invoke_VarHandle.cpp | 2 +-
luni/src/main/native/java_math_NativeBN.cpp | 2 +-
luni/src/main/native/java_util_regex_Matcher.cpp | 2 +-
luni/src/main/native/java_util_regex_Pattern.cpp | 2 +-
luni/src/main/native/libcore_icu_ICU.cpp | 2 +-
luni/src/main/native/libcore_icu_NativeConverter.cpp | 2 +-
luni/src/main/native/libcore_icu_TimeZoneNames.cpp | 2 +-
.../main/native/libcore_io_AsynchronousCloseMonitor.cpp | 2 +-
luni/src/main/native/libcore_io_Linux.cpp | 2 +-
luni/src/main/native/libcore_io_Memory.cpp | 2 +-
.../main/native/libcore_util_NativeAllocationRegistry.cpp | 2 +-
.../main/native/org_apache_harmony_xml_ExpatParser.cpp | 4 ++--
luni/src/main/native/sun_misc_Unsafe.cpp | 2 +-
ojluni/src/main/native/Adler32.c | 2 +-
ojluni/src/main/native/CRC32.c | 2 +-
ojluni/src/main/native/Character.cpp | 2 +-
ojluni/src/main/native/Console_md.c | 2 +-
ojluni/src/main/native/DatagramChannelImpl.c | 2 +-
ojluni/src/main/native/DatagramDispatcher.c | 2 +-
ojluni/src/main/native/Deflater.c | 2 +-
ojluni/src/main/native/Double.c | 2 +-
ojluni/src/main/native/FileChannelImpl.c | 2 +-
ojluni/src/main/native/FileDescriptor_md.c | 2 +-
ojluni/src/main/native/FileDispatcherImpl.c | 2 +-
ojluni/src/main/native/FileInputStream.c | 2 +-
ojluni/src/main/native/FileKey.c | 2 +-
ojluni/src/main/native/FileOutputStream_md.c | 2 +-
ojluni/src/main/native/FileSystemPreferences.c | 2 +-
ojluni/src/main/native/Float.c | 2 +-
ojluni/src/main/native/IOUtil.c | 2 +-
ojluni/src/main/native/Inflater.c | 2 +-
ojluni/src/main/native/MappedByteBuffer.c | 2 +-
ojluni/src/main/native/Math.c | 2 +-
ojluni/src/main/native/NativeThread.c | 2 +-
ojluni/src/main/native/Net.c | 2 +-
ojluni/src/main/native/ObjectInputStream.c | 2 +-
ojluni/src/main/native/ObjectOutputStream.c | 2 +-
ojluni/src/main/native/ObjectStreamClass.c | 2 +-
ojluni/src/main/native/ProcessEnvironment_md.c | 2 +-
ojluni/src/main/native/Runtime.c | 2 +-
ojluni/src/main/native/ServerSocketChannelImpl.c | 2 +-
ojluni/src/main/native/SocketChannelImpl.c | 2 +-
ojluni/src/main/native/SocketInputStream.c | 2 +-
ojluni/src/main/native/SocketOutputStream.c | 2 +-
ojluni/src/main/native/StrictMath.c | 2 +-
ojluni/src/main/native/System.c | 2 +-
ojluni/src/main/native/UNIXProcess_md.c | 2 +-
ojluni/src/main/native/UnixFileSystem_md.c | 2 +-
ojluni/src/main/native/ZipFile.c | 4 ++--
53 files changed, 58 insertions(+), 58 deletions(-)
diff --git a/dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp b/dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp
index 9f2b429374..06d05f3b71 100644
--- a/dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp
+++ b/dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp
@@ -24,7 +24,7 @@
static void NativeTestTarget_emptyJniStaticSynchronizedMethod0(JNIEnv*, jclass) { }
static void NativeTestTarget_emptyJniSynchronizedMethod0(JNIEnv*, jclass) { }
-static JNINativeMethod gMethods_NormalOnly[] = {
+static const JNINativeMethod gMethods_NormalOnly[] = {
NATIVE_METHOD(NativeTestTarget, emptyJniStaticSynchronizedMethod0, "()V"),
NATIVE_METHOD(NativeTestTarget, emptyJniSynchronizedMethod0, "()V"),
};
@@ -38,7 +38,7 @@ static void NativeTestTarget_emptyJniStaticMethod6L(JNIEnv*, jclass, jobject, ja
static void NativeTestTarget_emptyJniStaticMethod0(JNIEnv*, jclass) { }
static void NativeTestTarget_emptyJniStaticMethod6(JNIEnv*, jclass, int, int, int, int, int, int) { }
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeTestTarget, emptyJniMethod0, "()V"),
NATIVE_METHOD(NativeTestTarget, emptyJniMethod6, "(IIIIII)V"),
NATIVE_METHOD(NativeTestTarget, emptyJniMethod6L, "(Ljava/lang/String;[Ljava/lang/String;[[ILjava/lang/Object;[Ljava/lang/Object;[[[[Ljava/lang/Object;)V"),
@@ -55,7 +55,7 @@ static void NativeTestTarget_emptyJniStaticMethod6L_Fast(JNIEnv*, jclass, jobjec
static void NativeTestTarget_emptyJniStaticMethod0_Fast(JNIEnv*, jclass) { }
static void NativeTestTarget_emptyJniStaticMethod6_Fast(JNIEnv*, jclass, int, int, int, int, int, int) { }
-static JNINativeMethod gMethods_Fast[] = {
+static const JNINativeMethod gMethods_Fast[] = {
NATIVE_METHOD(NativeTestTarget, emptyJniMethod0_Fast, "()V"),
NATIVE_METHOD(NativeTestTarget, emptyJniMethod6_Fast, "(IIIIII)V"),
NATIVE_METHOD(NativeTestTarget, emptyJniMethod6L_Fast, "(Ljava/lang/String;[Ljava/lang/String;[[ILjava/lang/Object;[Ljava/lang/Object;[[[[Ljava/lang/Object;)V"),
@@ -68,7 +68,7 @@ static JNINativeMethod gMethods_Fast[] = {
static void NativeTestTarget_emptyJniStaticMethod0_Critical() { }
static void NativeTestTarget_emptyJniStaticMethod6_Critical( int, int, int, int, int, int) { }
-static JNINativeMethod gMethods_Critical[] = {
+static const JNINativeMethod gMethods_Critical[] = {
NATIVE_METHOD(NativeTestTarget, emptyJniStaticMethod0_Critical, "()V"),
NATIVE_METHOD(NativeTestTarget, emptyJniStaticMethod6_Critical, "(IIIIII)V"),
};
diff --git a/luni/src/main/native/android_system_OsConstants.cpp b/luni/src/main/native/android_system_OsConstants.cpp
index bb19f6e04f..4fbedc1117 100644
--- a/luni/src/main/native/android_system_OsConstants.cpp
+++ b/luni/src/main/native/android_system_OsConstants.cpp
@@ -704,7 +704,7 @@ static void OsConstants_initConstants(JNIEnv* env, jclass c) {
initConstant(env, c, "_SC_XOPEN_XCU_VERSION", _SC_XOPEN_XCU_VERSION);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(OsConstants, initConstants, "()V"),
};
void register_android_system_OsConstants(JNIEnv* env) {
diff --git a/luni/src/main/native/java_lang_StringToReal.cpp b/luni/src/main/native/java_lang_StringToReal.cpp
index 7a49285639..edd71fad70 100644
--- a/luni/src/main/native/java_lang_StringToReal.cpp
+++ b/luni/src/main/native/java_lang_StringToReal.cpp
@@ -892,7 +892,7 @@ static jdouble StringToReal_parseDblImpl(JNIEnv* env, jclass, jstring s, jint e)
return createDouble(env, str.c_str(), e);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(StringToReal, parseFltImpl, "(Ljava/lang/String;I)F"),
NATIVE_METHOD(StringToReal, parseDblImpl, "(Ljava/lang/String;I)D"),
};
diff --git a/luni/src/main/native/java_lang_invoke_MethodHandle.cpp b/luni/src/main/native/java_lang_invoke_MethodHandle.cpp
index 0441d4552d..3335c6de9a 100644
--- a/luni/src/main/native/java_lang_invoke_MethodHandle.cpp
+++ b/luni/src/main/native/java_lang_invoke_MethodHandle.cpp
@@ -29,7 +29,7 @@ static jobject MethodHandle_invoke(JNIEnv* env, jobject, jobjectArray) {
return nullptr;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(MethodHandle, invokeExact, "([Ljava/lang/Object;)Ljava/lang/Object;"),
NATIVE_METHOD(MethodHandle, invoke, "([Ljava/lang/Object;)Ljava/lang/Object;"),
};
diff --git a/luni/src/main/native/java_lang_invoke_VarHandle.cpp b/luni/src/main/native/java_lang_invoke_VarHandle.cpp
index e1cc1c7f8b..9f5215a520 100644
--- a/luni/src/main/native/java_lang_invoke_VarHandle.cpp
+++ b/luni/src/main/native/java_lang_invoke_VarHandle.cpp
@@ -210,7 +210,7 @@ static jboolean VarHandle_weakCompareAndSetRelease(JNIEnv* env, jobject, jobject
return JNI_FALSE;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(VarHandle, compareAndExchange, "([Ljava/lang/Object;)Ljava/lang/Object;"),
NATIVE_METHOD(VarHandle, compareAndExchangeAcquire, "([Ljava/lang/Object;)Ljava/lang/Object;"),
NATIVE_METHOD(VarHandle, compareAndExchangeRelease, "([Ljava/lang/Object;)Ljava/lang/Object;"),
diff --git a/luni/src/main/native/java_math_NativeBN.cpp b/luni/src/main/native/java_math_NativeBN.cpp
index 5d085ec9ec..b8c46e6681 100644
--- a/luni/src/main/native/java_math_NativeBN.cpp
+++ b/luni/src/main/native/java_math_NativeBN.cpp
@@ -526,7 +526,7 @@ static jboolean NativeBN_BN_primality_test(JNIEnv* env, jclass, jlong candidate,
return is_probably_prime ? JNI_TRUE : JNI_FALSE;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeBN, BN_add, "(JJJ)V"),
NATIVE_METHOD(NativeBN, BN_add_word, "(JI)V"),
NATIVE_METHOD(NativeBN, BN_bin2bn, "([BIZJ)V"),
diff --git a/luni/src/main/native/java_util_regex_Matcher.cpp b/luni/src/main/native/java_util_regex_Matcher.cpp
index 12fb764c6e..01751e11bc 100644
--- a/luni/src/main/native/java_util_regex_Matcher.cpp
+++ b/luni/src/main/native/java_util_regex_Matcher.cpp
@@ -269,7 +269,7 @@ static jint Matcher_getMatchedGroupIndex0(JNIEnv* env, jclass, jlong patternAddr
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Matcher, getMatchedGroupIndex0, "(JLjava/lang/String;)I"),
NATIVE_METHOD(Matcher, findImpl, "(JI[I)Z"),
NATIVE_METHOD(Matcher, findNextImpl, "(J[I)Z"),
diff --git a/luni/src/main/native/java_util_regex_Pattern.cpp b/luni/src/main/native/java_util_regex_Pattern.cpp
index a893bab9f3..4053ace294 100644
--- a/luni/src/main/native/java_util_regex_Pattern.cpp
+++ b/luni/src/main/native/java_util_regex_Pattern.cpp
@@ -96,7 +96,7 @@ static jlong Pattern_compileImpl(JNIEnv* env, jclass, jstring javaRegex, jint fl
return static_cast<jlong>(reinterpret_cast<uintptr_t>(result));
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Pattern, compileImpl, "(Ljava/lang/String;I)J"),
NATIVE_METHOD(Pattern, getNativeFinalizer, "()J"),
};
diff --git a/luni/src/main/native/libcore_icu_ICU.cpp b/luni/src/main/native/libcore_icu_ICU.cpp
index 8a571fddd8..fac0c24e96 100644
--- a/luni/src/main/native/libcore_icu_ICU.cpp
+++ b/luni/src/main/native/libcore_icu_ICU.cpp
@@ -807,7 +807,7 @@ static jstring ICU_getDefaultLocale(JNIEnv* env, jclass) {
return env->NewStringUTF(icu::Locale::getDefault().getName());
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ICU, addLikelySubtags, "(Ljava/lang/String;)Ljava/lang/String;"),
NATIVE_METHOD(ICU, getAvailableBreakIteratorLocalesNative, "()[Ljava/lang/String;"),
NATIVE_METHOD(ICU, getAvailableCalendarLocalesNative, "()[Ljava/lang/String;"),
diff --git a/luni/src/main/native/libcore_icu_NativeConverter.cpp b/luni/src/main/native/libcore_icu_NativeConverter.cpp
index 9ccfabd119..05677f70cc 100644
--- a/luni/src/main/native/libcore_icu_NativeConverter.cpp
+++ b/luni/src/main/native/libcore_icu_NativeConverter.cpp
@@ -675,7 +675,7 @@ static jlong NativeConverter_getNativeSize(JNIEnv*, jclass) {
return 200;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeConverter, charsetForName, "(Ljava/lang/String;)Ljava/nio/charset/Charset;"),
NATIVE_METHOD(NativeConverter, closeConverter, "(J)V"),
NATIVE_METHOD(NativeConverter, contains, "(Ljava/lang/String;Ljava/lang/String;)Z"),
diff --git a/luni/src/main/native/libcore_icu_TimeZoneNames.cpp b/luni/src/main/native/libcore_icu_TimeZoneNames.cpp
index db4c6f219f..f51ae12cd1 100644
--- a/luni/src/main/native/libcore_icu_TimeZoneNames.cpp
+++ b/luni/src/main/native/libcore_icu_TimeZoneNames.cpp
@@ -97,7 +97,7 @@ static void TimeZoneNames_fillZoneStrings(JNIEnv* env, jclass, jstring javaLocal
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(TimeZoneNames, fillZoneStrings, "(Ljava/lang/String;[[Ljava/lang/String;)V"),
};
void register_libcore_icu_TimeZoneNames(JNIEnv* env) {
diff --git a/luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp b/luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp
index 55803b8d8d..5b2627140b 100644
--- a/luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp
+++ b/luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp
@@ -26,7 +26,7 @@ static void AsynchronousCloseMonitor_signalBlockedThreads(JNIEnv* env, jclass, j
AsynchronousCloseMonitor::signalBlockedThreads(fd);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(AsynchronousCloseMonitor, signalBlockedThreads, "(Ljava/io/FileDescriptor;)V"),
};
void register_libcore_io_AsynchronousCloseMonitor(JNIEnv* env) {
diff --git a/luni/src/main/native/libcore_io_Linux.cpp b/luni/src/main/native/libcore_io_Linux.cpp
index 6b8ee085df..f80b83985b 100644
--- a/luni/src/main/native/libcore_io_Linux.cpp
+++ b/luni/src/main/native/libcore_io_Linux.cpp
@@ -2577,7 +2577,7 @@ static jint Linux_writev(JNIEnv* env, jobject, jobject javaFd, jobjectArray buff
#define NATIVE_METHOD_OVERLOAD(className, functionName, signature, variant) \
{ #functionName, signature, reinterpret_cast<void*>(className ## _ ## functionName ## variant) }
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Linux, accept, "(Ljava/io/FileDescriptor;Ljava/net/SocketAddress;)Ljava/io/FileDescriptor;"),
NATIVE_METHOD(Linux, access, "(Ljava/lang/String;I)Z"),
NATIVE_METHOD(Linux, android_fdsan_exchange_owner_tag, "(Ljava/io/FileDescriptor;JJ)V"),
diff --git a/luni/src/main/native/libcore_io_Memory.cpp b/luni/src/main/native/libcore_io_Memory.cpp
index a5b7b72a98..8400c5462d 100644
--- a/luni/src/main/native/libcore_io_Memory.cpp
+++ b/luni/src/main/native/libcore_io_Memory.cpp
@@ -289,7 +289,7 @@ static void Memory_unsafeBulkPut(JNIEnv* env, jclass, jbyteArray dstArray, jint
env->ReleasePrimitiveArrayCritical(srcArray, srcBytes, 0);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Memory, memmove, "(Ljava/lang/Object;ILjava/lang/Object;IJ)V"),
FAST_NATIVE_METHOD(Memory, peekByte, "(J)B"),
NATIVE_METHOD(Memory, peekByteArray, "(J[BII)V"),
diff --git a/luni/src/main/native/libcore_util_NativeAllocationRegistry.cpp b/luni/src/main/native/libcore_util_NativeAllocationRegistry.cpp
index ded578a958..faaa5c7a7c 100644
--- a/luni/src/main/native/libcore_util_NativeAllocationRegistry.cpp
+++ b/luni/src/main/native/libcore_util_NativeAllocationRegistry.cpp
@@ -29,7 +29,7 @@ static void NativeAllocationRegistry_applyFreeFunction(JNIEnv*,
nativeFreeFunction(nativePtr);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeAllocationRegistry, applyFreeFunction, "(JJ)V"),
};
diff --git a/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp b/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
index 9d23837a5b..404f897140 100644
--- a/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
+++ b/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
@@ -1353,7 +1353,7 @@ static void ExpatParser_staticInitialize(JNIEnv* env, jobject classObject, jstri
emptyString = reinterpret_cast<jstring>(env->NewGlobalRef(empty));
}
-static JNINativeMethod parserMethods[] = {
+static const JNINativeMethod parserMethods[] = {
NATIVE_METHOD(ExpatParser, appendString, "(JLjava/lang/String;Z)V"),
NATIVE_METHOD(ExpatParser, appendBytes, "(J[BII)V"),
NATIVE_METHOD(ExpatParser, appendChars, "(J[CII)V"),
@@ -1367,7 +1367,7 @@ static JNINativeMethod parserMethods[] = {
NATIVE_METHOD(ExpatParser, staticInitialize, "(Ljava/lang/String;)V"),
};
-static JNINativeMethod attributeMethods[] = {
+static const JNINativeMethod attributeMethods[] = {
NATIVE_METHOD(ExpatAttributes, freeAttributes, "(J)V"),
NATIVE_METHOD(ExpatAttributes, getIndexForQName, "(JLjava/lang/String;)I"),
NATIVE_METHOD(ExpatAttributes, getIndex, "(JLjava/lang/String;Ljava/lang/String;)I"),
diff --git a/luni/src/main/native/sun_misc_Unsafe.cpp b/luni/src/main/native/sun_misc_Unsafe.cpp
index 49848a2db2..87b2feac80 100644
--- a/luni/src/main/native/sun_misc_Unsafe.cpp
+++ b/luni/src/main/native/sun_misc_Unsafe.cpp
@@ -23,7 +23,7 @@ static jobject Unsafe_allocateInstance(JNIEnv* env, jclass, jclass c) {
return env->AllocObject(c);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Unsafe, allocateInstance, "(Ljava/lang/Class;)Ljava/lang/Object;"),
};
void register_sun_misc_Unsafe(JNIEnv* env) {
diff --git a/ojluni/src/main/native/Adler32.c b/ojluni/src/main/native/Adler32.c
index 11ef08d4c9..849df61067 100644
--- a/ojluni/src/main/native/Adler32.c
+++ b/ojluni/src/main/native/Adler32.c
@@ -70,7 +70,7 @@ Java_java_util_zip_Adler32_updateByteBuffer(JNIEnv *env, jclass cls, jint adler,
return adler;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Adler32, update, "(II)I"),
NATIVE_METHOD(Adler32, updateBytes, "(I[BII)I"),
NATIVE_METHOD(Adler32, updateByteBuffer, "(IJII)I"),
diff --git a/ojluni/src/main/native/CRC32.c b/ojluni/src/main/native/CRC32.c
index cec99de0eb..cb17feec59 100644
--- a/ojluni/src/main/native/CRC32.c
+++ b/ojluni/src/main/native/CRC32.c
@@ -74,7 +74,7 @@ CRC32_updateByteBuffer(JNIEnv *env, jclass cls, jint crc,
return crc;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(CRC32, update, "(II)I"),
NATIVE_METHOD(CRC32, updateBytes, "(I[BII)I"),
NATIVE_METHOD(CRC32, updateByteBuffer, "(IJII)I"),
diff --git a/ojluni/src/main/native/Character.cpp b/ojluni/src/main/native/Character.cpp
index 9fb24c372c..a12ae6bd17 100644
--- a/ojluni/src/main/native/Character.cpp
+++ b/ojluni/src/main/native/Character.cpp
@@ -159,7 +159,7 @@ Character_getNameImpl(JNIEnv* env, jclass, jint codePoint) {
return (U_FAILURE(status) || byteCount == 0) ? NULL : env->NewStringUTF(buf);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Character, digitImpl, "(II)I"),
FAST_NATIVE_METHOD(Character, getDirectionalityImpl, "(I)B"),
NATIVE_METHOD(Character, getNameImpl, "(I)Ljava/lang/String;"),
diff --git a/ojluni/src/main/native/Console_md.c b/ojluni/src/main/native/Console_md.c
index 13437be314..f87bd168b1 100644
--- a/ojluni/src/main/native/Console_md.c
+++ b/ojluni/src/main/native/Console_md.c
@@ -72,7 +72,7 @@ Java_java_io_Console_echo(JNIEnv *env,
return old;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Console, istty, "()Z"),
NATIVE_METHOD(Console, encoding, "()Ljava/lang/String;"),
NATIVE_METHOD(Console, echo, "(Z)Z"),
diff --git a/ojluni/src/main/native/DatagramChannelImpl.c b/ojluni/src/main/native/DatagramChannelImpl.c
index 11d149ddcf..8a8444c8a2 100644
--- a/ojluni/src/main/native/DatagramChannelImpl.c
+++ b/ojluni/src/main/native/DatagramChannelImpl.c
@@ -276,7 +276,7 @@ Java_sun_nio_ch_DatagramChannelImpl_send0(JNIEnv *env, jobject this,
return n;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(DatagramChannelImpl, initIDs, "()V"),
NATIVE_METHOD(DatagramChannelImpl, disconnect0, "(Ljava/io/FileDescriptor;Z)V"),
NATIVE_METHOD(DatagramChannelImpl, receive0, "(Ljava/io/FileDescriptor;JIZ)I"),
diff --git a/ojluni/src/main/native/DatagramDispatcher.c b/ojluni/src/main/native/DatagramDispatcher.c
index 36cc6cf4bc..39ff924179 100644
--- a/ojluni/src/main/native/DatagramDispatcher.c
+++ b/ojluni/src/main/native/DatagramDispatcher.c
@@ -139,7 +139,7 @@ Java_sun_nio_ch_DatagramDispatcher_writev0(JNIEnv *env, jclass clazz,
return convertLongReturnVal(env, (jlong)result, JNI_FALSE);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(DatagramDispatcher, read0, "(Ljava/io/FileDescriptor;JI)I"),
NATIVE_METHOD(DatagramDispatcher, readv0, "(Ljava/io/FileDescriptor;JI)J"),
NATIVE_METHOD(DatagramDispatcher, write0, "(Ljava/io/FileDescriptor;JI)I"),
diff --git a/ojluni/src/main/native/Deflater.c b/ojluni/src/main/native/Deflater.c
index 9ee032619d..2230f8c951 100644
--- a/ojluni/src/main/native/Deflater.c
+++ b/ojluni/src/main/native/Deflater.c
@@ -240,7 +240,7 @@ Deflater_end(JNIEnv *env, jclass cls, jlong addr)
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Deflater, init, "(IIZ)J"),
NATIVE_METHOD(Deflater, setDictionary, "(J[BII)V"),
NATIVE_METHOD(Deflater, deflateBytes, "(J[BIII)I"),
diff --git a/ojluni/src/main/native/Double.c b/ojluni/src/main/native/Double.c
index 8382b88994..2bcb97a653 100644
--- a/ojluni/src/main/native/Double.c
+++ b/ojluni/src/main/native/Double.c
@@ -63,7 +63,7 @@ Double_doubleToRawLongBits(JNIEnv *env, jclass unused, jdouble v)
u.d = (double)v;
return u.l;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Double, longBitsToDouble, "(J)D"),
NATIVE_METHOD(Double, doubleToRawLongBits, "(D)J"),
};
diff --git a/ojluni/src/main/native/FileChannelImpl.c b/ojluni/src/main/native/FileChannelImpl.c
index 51339dff9c..6d5c075e83 100644
--- a/ojluni/src/main/native/FileChannelImpl.c
+++ b/ojluni/src/main/native/FileChannelImpl.c
@@ -284,7 +284,7 @@ FileChannelImpl_transferTo0(JNIEnv *env, jobject this,
#endif
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileChannelImpl, initIDs, "()J"),
NATIVE_METHOD(FileChannelImpl, map0, "(IJJ)J"),
NATIVE_METHOD(FileChannelImpl, unmap0, "(JJ)I"),
diff --git a/ojluni/src/main/native/FileDescriptor_md.c b/ojluni/src/main/native/FileDescriptor_md.c
index 0404263787..a00d799045 100644
--- a/ojluni/src/main/native/FileDescriptor_md.c
+++ b/ojluni/src/main/native/FileDescriptor_md.c
@@ -68,7 +68,7 @@ JNIEXPORT jboolean JNICALL FileDescriptor_isSocket(JNIEnv *env, jclass ignored,
return TEMP_FAILURE_RETRY(getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &error_length)) == 0;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileDescriptor, sync, "()V"),
NATIVE_METHOD(FileDescriptor, isSocket, "(I)Z"),
};
diff --git a/ojluni/src/main/native/FileDispatcherImpl.c b/ojluni/src/main/native/FileDispatcherImpl.c
index 3e8e4f3e0f..facede4cf1 100644
--- a/ojluni/src/main/native/FileDispatcherImpl.c
+++ b/ojluni/src/main/native/FileDispatcherImpl.c
@@ -287,7 +287,7 @@ FileDispatcherImpl_closeIntFD(JNIEnv *env, jclass clazz, jint fd)
closeFileDescriptor(env, fd);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileDispatcherImpl, closeIntFD, "(I)V"),
NATIVE_METHOD(FileDispatcherImpl, preClose0, "(Ljava/io/FileDescriptor;)V"),
NATIVE_METHOD(FileDispatcherImpl, close0, "(Ljava/io/FileDescriptor;)V"),
diff --git a/ojluni/src/main/native/FileInputStream.c b/ojluni/src/main/native/FileInputStream.c
index 58664a1f1d..b388a72eb2 100644
--- a/ojluni/src/main/native/FileInputStream.c
+++ b/ojluni/src/main/native/FileInputStream.c
@@ -140,7 +140,7 @@ FileInputStream_available0(JNIEnv *env, jobject this) {
return 0;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileInputStream, open0, "(Ljava/lang/String;)V"),
NATIVE_METHOD(FileInputStream, skip0, "(J)J"),
NATIVE_METHOD(FileInputStream, available0, "()I"),
diff --git a/ojluni/src/main/native/FileKey.c b/ojluni/src/main/native/FileKey.c
index c3b5d2a00f..61d3c2ae89 100644
--- a/ojluni/src/main/native/FileKey.c
+++ b/ojluni/src/main/native/FileKey.c
@@ -68,7 +68,7 @@ FileKey_init(JNIEnv *env, jobject this, jobject fdo)
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileKey, init, "(Ljava/io/FileDescriptor;)V"),
};
diff --git a/ojluni/src/main/native/FileOutputStream_md.c b/ojluni/src/main/native/FileOutputStream_md.c
index 73218d482e..5bac6129ef 100644
--- a/ojluni/src/main/native/FileOutputStream_md.c
+++ b/ojluni/src/main/native/FileOutputStream_md.c
@@ -58,7 +58,7 @@ FileOutputStream_open0(JNIEnv *env, jobject this,
O_WRONLY | O_CREAT | (append ? O_APPEND : O_TRUNC));
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileOutputStream, open0, "(Ljava/lang/String;Z)V"),
};
diff --git a/ojluni/src/main/native/FileSystemPreferences.c b/ojluni/src/main/native/FileSystemPreferences.c
index 9a73150428..d49de07b61 100644
--- a/ojluni/src/main/native/FileSystemPreferences.c
+++ b/ojluni/src/main/native/FileSystemPreferences.c
@@ -150,7 +150,7 @@ Java_java_util_prefs_FileSystemPreferences_unlockFile0(JNIEnv *env,
return 0;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileSystemPreferences, lockFile0, "(Ljava/lang/String;IZ)[I"),
NATIVE_METHOD(FileSystemPreferences, unlockFile0, "(I)I"),
NATIVE_METHOD(FileSystemPreferences, chmod, "(Ljava/lang/String;I)I"),
diff --git a/ojluni/src/main/native/Float.c b/ojluni/src/main/native/Float.c
index 956048d6b8..5bfdf58245 100644
--- a/ojluni/src/main/native/Float.c
+++ b/ojluni/src/main/native/Float.c
@@ -59,7 +59,7 @@ Float_floatToRawIntBits(JNIEnv *env, jclass unused, jfloat v)
u.f = (float)v;
return (jint)u.i;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Float, intBitsToFloat, "(I)F"),
NATIVE_METHOD(Float, floatToRawIntBits, "(F)I"),
};
diff --git a/ojluni/src/main/native/IOUtil.c b/ojluni/src/main/native/IOUtil.c
index 05949dab16..2ccb8795e4 100644
--- a/ojluni/src/main/native/IOUtil.c
+++ b/ojluni/src/main/native/IOUtil.c
@@ -206,7 +206,7 @@ fdval(JNIEnv *env, jobject fdo)
return (*env)->GetIntField(env, fdo, fd_fdID);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(IOUtil, iovMax, "()I"),
NATIVE_METHOD(IOUtil, fdLimit, "()I"),
NATIVE_METHOD(IOUtil, drain, "(I)Z"),
diff --git a/ojluni/src/main/native/Inflater.c b/ojluni/src/main/native/Inflater.c
index c4c24f0fed..23b107426d 100644
--- a/ojluni/src/main/native/Inflater.c
+++ b/ojluni/src/main/native/Inflater.c
@@ -201,7 +201,7 @@ Inflater_end(JNIEnv *env, jclass cls, jlong addr)
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Inflater, init, "(Z)J"),
NATIVE_METHOD(Inflater, setDictionary, "(J[BII)V"),
NATIVE_METHOD(Inflater, inflateBytes, "(J[BII)I"),
diff --git a/ojluni/src/main/native/MappedByteBuffer.c b/ojluni/src/main/native/MappedByteBuffer.c
index 72e840a5c1..24bf6973c3 100644
--- a/ojluni/src/main/native/MappedByteBuffer.c
+++ b/ojluni/src/main/native/MappedByteBuffer.c
@@ -104,7 +104,7 @@ Java_java_nio_MappedByteBuffer_force0(JNIEnv *env, jobject obj, jobject fdo,
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(MappedByteBuffer, isLoaded0, "(JJI)Z"),
NATIVE_METHOD(MappedByteBuffer, load0, "(JJ)V"),
NATIVE_METHOD(MappedByteBuffer, force0, "(Ljava/io/FileDescriptor;JJ)V"),
diff --git a/ojluni/src/main/native/Math.c b/ojluni/src/main/native/Math.c
index 4bbcd1d0f1..f3423328d0 100644
--- a/ojluni/src/main/native/Math.c
+++ b/ojluni/src/main/native/Math.c
@@ -141,7 +141,7 @@ Math_rint(jdouble d) {
return rint(d);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Math, IEEEremainder, "(DD)D"),
FAST_NATIVE_METHOD(Math, acos, "(D)D"),
FAST_NATIVE_METHOD(Math, asin, "(D)D"),
diff --git a/ojluni/src/main/native/NativeThread.c b/ojluni/src/main/native/NativeThread.c
index dc21e5dbc9..312b160a99 100644
--- a/ojluni/src/main/native/NativeThread.c
+++ b/ojluni/src/main/native/NativeThread.c
@@ -108,7 +108,7 @@ NativeThread_signal(JNIEnv *env, jclass cl, jlong thread)
JNU_ThrowIOExceptionWithLastError(env, "Thread signal failed");
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeThread, current, "()J"),
NATIVE_METHOD(NativeThread, signal, "(J)V"),
};
diff --git a/ojluni/src/main/native/Net.c b/ojluni/src/main/native/Net.c
index bcf984e957..9b43e521b7 100644
--- a/ojluni/src/main/native/Net.c
+++ b/ojluni/src/main/native/Net.c
@@ -868,7 +868,7 @@ handleSocketError(JNIEnv *env, jint errorValue) {
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Net, isIPv6Available0, "()Z"),
NATIVE_METHOD(Net, isExclusiveBindAvailable, "()I"),
NATIVE_METHOD(Net, canIPv6SocketJoinIPv4Group0, "()Z"),
diff --git a/ojluni/src/main/native/ObjectInputStream.c b/ojluni/src/main/native/ObjectInputStream.c
index 6f65dca5a5..6ba47e31dc 100644
--- a/ojluni/src/main/native/ObjectInputStream.c
+++ b/ojluni/src/main/native/ObjectInputStream.c
@@ -175,7 +175,7 @@ Java_java_io_ObjectInputStream_bytesToDoubles(JNIEnv *env,
(*env)->ReleasePrimitiveArrayCritical(env, dst, doubles, 0);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ObjectInputStream, bytesToFloats, "([BI[FII)V"),
NATIVE_METHOD(ObjectInputStream, bytesToDoubles, "([BI[DII)V"),
};
diff --git a/ojluni/src/main/native/ObjectOutputStream.c b/ojluni/src/main/native/ObjectOutputStream.c
index 169a83f3f8..0e1479d6df 100644
--- a/ojluni/src/main/native/ObjectOutputStream.c
+++ b/ojluni/src/main/native/ObjectOutputStream.c
@@ -184,7 +184,7 @@ Java_java_io_ObjectOutputStream_doublesToBytes(JNIEnv *env,
(*env)->ReleasePrimitiveArrayCritical(env, dst, bytes, 0);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ObjectOutputStream, floatsToBytes, "([FI[BII)V"),
NATIVE_METHOD(ObjectOutputStream, doublesToBytes, "([DI[BII)V"),
};
diff --git a/ojluni/src/main/native/ObjectStreamClass.c b/ojluni/src/main/native/ObjectStreamClass.c
index 3d3fdefa33..84cfcc43d3 100644
--- a/ojluni/src/main/native/ObjectStreamClass.c
+++ b/ojluni/src/main/native/ObjectStreamClass.c
@@ -110,7 +110,7 @@ ObjectStreamClass_hasStaticInitializer(JNIEnv *env, jclass this,
return (clinitId != superClinitId);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ObjectStreamClass, hasStaticInitializer, "(Ljava/lang/Class;Z)Z"),
};
diff --git a/ojluni/src/main/native/ProcessEnvironment_md.c b/ojluni/src/main/native/ProcessEnvironment_md.c
index a59410badc..a3f46a4d4f 100644
--- a/ojluni/src/main/native/ProcessEnvironment_md.c
+++ b/ojluni/src/main/native/ProcessEnvironment_md.c
@@ -91,7 +91,7 @@ ProcessEnvironment_environ(JNIEnv *env, jclass ign)
return result;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ProcessEnvironment, environ, "()[[B"),
};
diff --git a/ojluni/src/main/native/Runtime.c b/ojluni/src/main/native/Runtime.c
index 749511eb08..5e8a2916f6 100644
--- a/ojluni/src/main/native/Runtime.c
+++ b/ojluni/src/main/native/Runtime.c
@@ -80,7 +80,7 @@ Runtime_nativeLoad(JNIEnv* env, jclass ignored, jstring javaFilename,
return JVM_NativeLoad(env, javaFilename, javaLoader, caller);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Runtime, freeMemory, "()J"),
FAST_NATIVE_METHOD(Runtime, totalMemory, "()J"),
FAST_NATIVE_METHOD(Runtime, maxMemory, "()J"),
diff --git a/ojluni/src/main/native/ServerSocketChannelImpl.c b/ojluni/src/main/native/ServerSocketChannelImpl.c
index 679811f96a..83a94f9b8e 100644
--- a/ojluni/src/main/native/ServerSocketChannelImpl.c
+++ b/ojluni/src/main/native/ServerSocketChannelImpl.c
@@ -137,7 +137,7 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this,
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Java_sun_nio_ch_ServerSocketChannelImpl, initIDs, "()V"),
NATIVE_METHOD(Java_sun_nio_ch_ServerSocketChannelImpl, accept0,
"(Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;[Ljava/net/InetSocketAddress;)I"),
diff --git a/ojluni/src/main/native/SocketChannelImpl.c b/ojluni/src/main/native/SocketChannelImpl.c
index 94291659cf..9e54369054 100644
--- a/ojluni/src/main/native/SocketChannelImpl.c
+++ b/ojluni/src/main/native/SocketChannelImpl.c
@@ -96,7 +96,7 @@ Java_sun_nio_ch_SocketChannelImpl_sendOutOfBandData(JNIEnv* env, jclass this,
return convertReturnVal(env, n, JNI_FALSE);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(SocketChannelImpl, checkConnect, "(Ljava/io/FileDescriptor;ZZ)I"),
NATIVE_METHOD(SocketChannelImpl, sendOutOfBandData, "(Ljava/io/FileDescriptor;B)I"),
};
diff --git a/ojluni/src/main/native/SocketInputStream.c b/ojluni/src/main/native/SocketInputStream.c
index dcea334fd1..aa10f4e9c1 100644
--- a/ojluni/src/main/native/SocketInputStream.c
+++ b/ojluni/src/main/native/SocketInputStream.c
@@ -153,7 +153,7 @@ SocketInputStream_socketRead0(JNIEnv *env, jobject this,
return nread;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(SocketInputStream, socketRead0, "(Ljava/io/FileDescriptor;[BIII)I"),
};
diff --git a/ojluni/src/main/native/SocketOutputStream.c b/ojluni/src/main/native/SocketOutputStream.c
index bc3522bee3..d72fd1108b 100644
--- a/ojluni/src/main/native/SocketOutputStream.c
+++ b/ojluni/src/main/native/SocketOutputStream.c
@@ -128,7 +128,7 @@ SocketOutputStream_socketWrite0(JNIEnv *env, jobject this,
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(SocketOutputStream, socketWrite0, "(Ljava/io/FileDescriptor;[BII)V"),
};
diff --git a/ojluni/src/main/native/StrictMath.c b/ojluni/src/main/native/StrictMath.c
index 7f9bbebcdf..24b29228a4 100644
--- a/ojluni/src/main/native/StrictMath.c
+++ b/ojluni/src/main/native/StrictMath.c
@@ -156,7 +156,7 @@ StrictMath_expm1(JNIEnv *env, jclass unused, jdouble d)
return (jdouble) ieee_expm1((double)d);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(StrictMath, cos, "(D)D"),
NATIVE_METHOD(StrictMath, sin, "(D)D"),
NATIVE_METHOD(StrictMath, tan, "(D)D"),
diff --git a/ojluni/src/main/native/System.c b/ojluni/src/main/native/System.c
index 6cfee92e5a..6948219544 100644
--- a/ojluni/src/main/native/System.c
+++ b/ojluni/src/main/native/System.c
@@ -262,7 +262,7 @@ static jlong System_currentTimeMillis(JNIEnv* env, jclass unused) {
return JVM_CurrentTimeMillis(NULL, NULL);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(System, mapLibraryName, "(Ljava/lang/String;)Ljava/lang/String;"),
NATIVE_METHOD(System, setErr0, "(Ljava/io/PrintStream;)V"),
NATIVE_METHOD(System, setOut0, "(Ljava/io/PrintStream;)V"),
diff --git a/ojluni/src/main/native/UNIXProcess_md.c b/ojluni/src/main/native/UNIXProcess_md.c
index 40fdc18fb8..87ceaac4fe 100644
--- a/ojluni/src/main/native/UNIXProcess_md.c
+++ b/ojluni/src/main/native/UNIXProcess_md.c
@@ -991,7 +991,7 @@ UNIXProcess_destroyProcess(JNIEnv *env, jobject junk, jint pid)
kill(pid, SIGTERM);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(UNIXProcess, destroyProcess, "(I)V"),
NATIVE_METHOD(UNIXProcess, forkAndExec, "([B[BI[BI[B[IZ)I"),
NATIVE_METHOD(UNIXProcess, waitForProcessExit, "(I)I"),
diff --git a/ojluni/src/main/native/UnixFileSystem_md.c b/ojluni/src/main/native/UnixFileSystem_md.c
index 9c1ca05052..bc7ee22d57 100644
--- a/ojluni/src/main/native/UnixFileSystem_md.c
+++ b/ojluni/src/main/native/UnixFileSystem_md.c
@@ -497,7 +497,7 @@ Java_java_io_UnixFileSystem_getSpace0(JNIEnv *env, jobject this,
return rv;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(UnixFileSystem, initIDs, "()V"),
NATIVE_METHOD(UnixFileSystem, canonicalize0, "(Ljava/lang/String;)Ljava/lang/String;"),
NATIVE_METHOD(UnixFileSystem, getBooleanAttributes0, "(Ljava/lang/String;)I"),
diff --git a/ojluni/src/main/native/ZipFile.c b/ojluni/src/main/native/ZipFile.c
index daf5d8efff..78b26fdfa5 100644
--- a/ojluni/src/main/native/ZipFile.c
+++ b/ojluni/src/main/native/ZipFile.c
@@ -393,7 +393,7 @@ JarFile_getMetaInfEntryNames(JNIEnv *env, jobject obj)
return result;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ZipFile, getFileDescriptor, "(J)I"),
NATIVE_METHOD(ZipFile, getEntry, "(J[BZ)J"),
NATIVE_METHOD(ZipFile, freeEntry, "(JJ)V"),
@@ -414,7 +414,7 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(ZipFile, getZipMessage, "(J)Ljava/lang/String;"),
};
-static JNINativeMethod gJarFileMethods[] = {
+static const JNINativeMethod gJarFileMethods[] = {
NATIVE_METHOD(JarFile, getMetaInfEntryNames, "()[Ljava/lang/String;"),
};

View File

@ -0,0 +1,217 @@
From a48ba29b986ad67a5388f4a053080263ac4a438b Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Sun, 17 Mar 2019 21:19:00 -0400
Subject: [PATCH] constify JNINativeMethod tables
---
jni/com_android_bluetooth_a2dp.cpp | 2 +-
jni/com_android_bluetooth_a2dp_sink.cpp | 2 +-
jni/com_android_bluetooth_avrcp_controller.cpp | 2 +-
jni/com_android_bluetooth_avrcp_target.cpp | 2 +-
jni/com_android_bluetooth_btservice_AdapterService.cpp | 2 +-
jni/com_android_bluetooth_gatt.cpp | 8 ++++----
jni/com_android_bluetooth_hearing_aid.cpp | 2 +-
jni/com_android_bluetooth_hfp.cpp | 2 +-
jni/com_android_bluetooth_hfpclient.cpp | 2 +-
jni/com_android_bluetooth_hid_device.cpp | 2 +-
jni/com_android_bluetooth_hid_host.cpp | 2 +-
jni/com_android_bluetooth_pan.cpp | 2 +-
jni/com_android_bluetooth_sdp.cpp | 2 +-
13 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/jni/com_android_bluetooth_a2dp.cpp b/jni/com_android_bluetooth_a2dp.cpp
index af125bda7..9d1426378 100644
--- a/jni/com_android_bluetooth_a2dp.cpp
+++ b/jni/com_android_bluetooth_a2dp.cpp
@@ -473,7 +473,7 @@ static jboolean setCodecConfigPreferenceNative(JNIEnv* env, jobject object,
return (status == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "(I[Landroid/bluetooth/BluetoothCodecConfig;)V",
(void*)initNative},
diff --git a/jni/com_android_bluetooth_a2dp_sink.cpp b/jni/com_android_bluetooth_a2dp_sink.cpp
index 91de5af07..3bb20e3ae 100644
--- a/jni/com_android_bluetooth_a2dp_sink.cpp
+++ b/jni/com_android_bluetooth_a2dp_sink.cpp
@@ -219,7 +219,7 @@ static void informAudioTrackGainNative(JNIEnv* env, jobject object,
sBluetoothA2dpInterface->set_audio_track_gain((float)gain);
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "()V", (void*)initNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_avrcp_controller.cpp b/jni/com_android_bluetooth_avrcp_controller.cpp
index 2d9e87bcb..5703a8bfb 100644
--- a/jni/com_android_bluetooth_avrcp_controller.cpp
+++ b/jni/com_android_bluetooth_avrcp_controller.cpp
@@ -1206,7 +1206,7 @@ static void playItemNative(JNIEnv* env, jobject object, jbyteArray address,
env->ReleaseByteArrayElements(address, addr, 0);
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "()V", (void*)initNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_avrcp_target.cpp b/jni/com_android_bluetooth_avrcp_target.cpp
index 214feebcb..9bd85aa13 100644
--- a/jni/com_android_bluetooth_avrcp_target.cpp
+++ b/jni/com_android_bluetooth_avrcp_target.cpp
@@ -801,7 +801,7 @@ static void setVolume(int8_t volume) {
sCallbackEnv->CallVoidMethod(mJavaInterface, method_setVolume, volume);
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "()V", (void*)initNative},
{"sendMediaUpdateNative", "(ZZZ)V", (void*)sendMediaUpdateNative},
diff --git a/jni/com_android_bluetooth_btservice_AdapterService.cpp b/jni/com_android_bluetooth_btservice_AdapterService.cpp
index 06914e1e7..93d87afcc 100644
--- a/jni/com_android_bluetooth_btservice_AdapterService.cpp
+++ b/jni/com_android_bluetooth_btservice_AdapterService.cpp
@@ -1237,7 +1237,7 @@ static jbyteArray obfuscateAddressNative(JNIEnv* env, jobject obj,
return output_bytes;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
/* name, signature, funcPtr */
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "(ZZ)Z", (void*)initNative},
diff --git a/jni/com_android_bluetooth_gatt.cpp b/jni/com_android_bluetooth_gatt.cpp
index 452151547..3bf3201fc 100644
--- a/jni/com_android_bluetooth_gatt.cpp
+++ b/jni/com_android_bluetooth_gatt.cpp
@@ -2065,7 +2065,7 @@ static void gattTestNative(JNIEnv* env, jobject object, jint command,
*/
// JNI functions defined in AdvertiseManager class.
-static JNINativeMethod sAdvertiseMethods[] = {
+static const JNINativeMethod sAdvertiseMethods[] = {
{"classInitNative", "()V", (void*)advertiseClassInitNative},
{"initializeNative", "()V", (void*)advertiseInitializeNative},
{"cleanupNative", "()V", (void*)advertiseCleanupNative},
@@ -2092,7 +2092,7 @@ static JNINativeMethod sAdvertiseMethods[] = {
};
// JNI functions defined in PeriodicScanManager class.
-static JNINativeMethod sPeriodicScanMethods[] = {
+static const JNINativeMethod sPeriodicScanMethods[] = {
{"classInitNative", "()V", (void*)periodicScanClassInitNative},
{"initializeNative", "()V", (void*)periodicScanInitializeNative},
{"cleanupNative", "()V", (void*)periodicScanCleanupNative},
@@ -2101,7 +2101,7 @@ static JNINativeMethod sPeriodicScanMethods[] = {
};
// JNI functions defined in ScanManager class.
-static JNINativeMethod sScanMethods[] = {
+static const JNINativeMethod sScanMethods[] = {
{"registerScannerNative", "(JJ)V", (void*)registerScannerNative},
{"unregisterScannerNative", "(I)V", (void*)unregisterScannerNative},
{"gattClientScanNative", "(Z)V", (void*)gattClientScanNative},
@@ -2134,7 +2134,7 @@ static JNINativeMethod sScanMethods[] = {
};
// JNI functions defined in GattService class.
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initializeNative", "()V", (void*)initializeNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_hearing_aid.cpp b/jni/com_android_bluetooth_hearing_aid.cpp
index f93a42a76..78dc96863 100644
--- a/jni/com_android_bluetooth_hearing_aid.cpp
+++ b/jni/com_android_bluetooth_hearing_aid.cpp
@@ -219,7 +219,7 @@ static void setVolumeNative(JNIEnv* env, jclass clazz, jint volume) {
sHearingAidInterface->SetVolume(volume);
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "()V", (void*)initNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_hfp.cpp b/jni/com_android_bluetooth_hfp.cpp
index 16bf961cf..50b38ff90 100644
--- a/jni/com_android_bluetooth_hfp.cpp
+++ b/jni/com_android_bluetooth_hfp.cpp
@@ -917,7 +917,7 @@ static jboolean setActiveDeviceNative(JNIEnv* env, jobject object,
return (status == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initializeNative", "(IZ)V", (void*)initializeNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_hfpclient.cpp b/jni/com_android_bluetooth_hfpclient.cpp
index f3adba21f..27d075dd5 100644
--- a/jni/com_android_bluetooth_hfpclient.cpp
+++ b/jni/com_android_bluetooth_hfpclient.cpp
@@ -819,7 +819,7 @@ static jboolean sendATCmdNative(JNIEnv* env, jobject object, jbyteArray address,
return (status == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initializeNative", "()V", (void*)initializeNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_hid_device.cpp b/jni/com_android_bluetooth_hid_device.cpp
index 403e90403..0b792c974 100644
--- a/jni/com_android_bluetooth_hid_device.cpp
+++ b/jni/com_android_bluetooth_hid_device.cpp
@@ -498,7 +498,7 @@ static jboolean disconnectNative(JNIEnv* env, jobject thiz) {
return result;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "()V", (void*)initNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_hid_host.cpp b/jni/com_android_bluetooth_hid_host.cpp
index 7838ff6ce..9b233c654 100644
--- a/jni/com_android_bluetooth_hid_host.cpp
+++ b/jni/com_android_bluetooth_hid_host.cpp
@@ -498,7 +498,7 @@ static jboolean setIdleTimeNative(JNIEnv* env, jobject object,
return status == BT_STATUS_SUCCESS ? JNI_TRUE : JNI_FALSE;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initializeNative", "()V", (void*)initializeNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_pan.cpp b/jni/com_android_bluetooth_pan.cpp
index 85107a003..1857ff88d 100644
--- a/jni/com_android_bluetooth_pan.cpp
+++ b/jni/com_android_bluetooth_pan.cpp
@@ -231,7 +231,7 @@ static jboolean disconnectPanNative(JNIEnv* env, jobject object,
return ret;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initializeNative", "()V", (void*)initializeNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_sdp.cpp b/jni/com_android_bluetooth_sdp.cpp
index 827db71e9..879de1725 100644
--- a/jni/com_android_bluetooth_sdp.cpp
+++ b/jni/com_android_bluetooth_sdp.cpp
@@ -495,7 +495,7 @@ static void cleanupNative(JNIEnv* env, jobject object) {
}
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
/* name, signature, funcPtr */
{"classInitNative", "()V", (void*)classInitNative},
{"initializeNative", "()V", (void*)initializeNative},

View File

@ -0,0 +1,92 @@
From 20a51f508b32b64cc60f2fc300372442a4ce0dc2 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Sun, 17 Mar 2019 20:58:37 -0400
Subject: [PATCH] constify JNINativeMethod tables
---
nci/jni/NativeLlcpConnectionlessSocket.cpp | 2 +-
nci/jni/NativeLlcpServiceSocket.cpp | 2 +-
nci/jni/NativeLlcpSocket.cpp | 2 +-
nci/jni/NativeNfcManager.cpp | 2 +-
nci/jni/NativeNfcTag.cpp | 2 +-
nci/jni/NativeP2pDevice.cpp | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/nci/jni/NativeLlcpConnectionlessSocket.cpp b/nci/jni/NativeLlcpConnectionlessSocket.cpp
index e43dbff3..78e33285 100644
--- a/nci/jni/NativeLlcpConnectionlessSocket.cpp
+++ b/nci/jni/NativeLlcpConnectionlessSocket.cpp
@@ -280,7 +280,7 @@ static jboolean nativeLlcpConnectionlessSocket_doClose(JNIEnv* e, jobject o) {
** Description: JNI functions
**
*****************************************************************************/
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{"doSendTo", "(I[B)Z", (void*)nativeLlcpConnectionlessSocket_doSendTo},
{"doReceiveFrom", "(I)Lcom/android/nfc/LlcpPacket;",
(void*)nativeLlcpConnectionlessSocket_doReceiveFrom},
diff --git a/nci/jni/NativeLlcpServiceSocket.cpp b/nci/jni/NativeLlcpServiceSocket.cpp
index 76ffeea5..4d2297c4 100644
--- a/nci/jni/NativeLlcpServiceSocket.cpp
+++ b/nci/jni/NativeLlcpServiceSocket.cpp
@@ -128,7 +128,7 @@ static jboolean nativeLlcpServiceSocket_doClose(JNIEnv* e, jobject o) {
** Description: JNI functions
**
*****************************************************************************/
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{"doAccept", "(III)Lcom/android/nfc/dhimpl/NativeLlcpSocket;",
(void*)nativeLlcpServiceSocket_doAccept},
{"doClose", "()Z", (void*)nativeLlcpServiceSocket_doClose},
diff --git a/nci/jni/NativeLlcpSocket.cpp b/nci/jni/NativeLlcpSocket.cpp
index 0ee0d248..fa49ec94 100644
--- a/nci/jni/NativeLlcpSocket.cpp
+++ b/nci/jni/NativeLlcpSocket.cpp
@@ -214,7 +214,7 @@ static jint nativeLlcpSocket_doGetRemoteSocketRW(JNIEnv* e, jobject o) {
** Description: JNI functions
**
*****************************************************************************/
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{"doConnect", "(I)Z", (void*)nativeLlcpSocket_doConnect},
{"doConnectBy", "(Ljava/lang/String;)Z",
(void*)nativeLlcpSocket_doConnectBy},
diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp
index 65f006f6..0ac30607 100644
--- a/nci/jni/NativeNfcManager.cpp
+++ b/nci/jni/NativeNfcManager.cpp
@@ -1964,7 +1964,7 @@ static jboolean nfcManager_doSetNfcSecure(JNIEnv* e, jobject o,
** JNI functions for android-4.0.1_r1
**
*****************************************************************************/
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{"doDownload", "()Z", (void*)nfcManager_doDownload},
{"initializeNativeStructure", "()Z", (void*)nfcManager_initNativeStruc},
diff --git a/nci/jni/NativeNfcTag.cpp b/nci/jni/NativeNfcTag.cpp
index cd9f2327..d9038952 100644
--- a/nci/jni/NativeNfcTag.cpp
+++ b/nci/jni/NativeNfcTag.cpp
@@ -1804,7 +1804,7 @@ void nativeNfcTag_releaseRfInterfaceMutexLock() {
** JNI functions for Android 4.0.3
**
*****************************************************************************/
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{"doConnect", "(I)I", (void*)nativeNfcTag_doConnect},
{"doDisconnect", "()Z", (void*)nativeNfcTag_doDisconnect},
{"doReconnect", "()I", (void*)nativeNfcTag_doReconnect},
diff --git a/nci/jni/NativeP2pDevice.cpp b/nci/jni/NativeP2pDevice.cpp
index 23f5db41..396c6d0c 100644
--- a/nci/jni/NativeP2pDevice.cpp
+++ b/nci/jni/NativeP2pDevice.cpp
@@ -58,7 +58,7 @@ static jboolean nativeP2pDeviceDoSend(JNIEnv*, jobject, jbyteArray) {
** Description: JNI functions
**
*****************************************************************************/
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{"doConnect", "()Z", (void*)nativeP2pDeviceDoConnect},
{"doDisconnect", "()Z", (void*)nativeP2pDeviceDoDisconnect},
{"doTransceive", "([B)[B", (void*)nativeP2pDeviceDoTransceive},

View File

@ -0,0 +1,483 @@
From c99c35cb2a323896d64708fcae5d01f83f937d1e Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Wed, 9 Sep 2020 12:28:42 -0400
Subject: [PATCH] constify JNINativeMethod tables
---
benchmark/micro-native/micro_native.cc | 8 ++++----
runtime/native/dalvik_system_BaseDexClassLoader.cc | 2 +-
runtime/native/dalvik_system_DexFile.cc | 2 +-
runtime/native/dalvik_system_VMDebug.cc | 2 +-
runtime/native/dalvik_system_VMRuntime.cc | 2 +-
runtime/native/dalvik_system_VMStack.cc | 2 +-
runtime/native/dalvik_system_ZygoteHooks.cc | 2 +-
runtime/native/java_lang_Class.cc | 2 +-
runtime/native/java_lang_Object.cc | 2 +-
runtime/native/java_lang_String.cc | 2 +-
runtime/native/java_lang_StringFactory.cc | 2 +-
runtime/native/java_lang_System.cc | 2 +-
runtime/native/java_lang_Thread.cc | 2 +-
runtime/native/java_lang_Throwable.cc | 2 +-
runtime/native/java_lang_VMClassLoader.cc | 2 +-
runtime/native/java_lang_invoke_MethodHandleImpl.cc | 2 +-
runtime/native/java_lang_ref_FinalizerReference.cc | 2 +-
runtime/native/java_lang_ref_Reference.cc | 2 +-
runtime/native/java_lang_reflect_Array.cc | 2 +-
runtime/native/java_lang_reflect_Constructor.cc | 2 +-
runtime/native/java_lang_reflect_Executable.cc | 2 +-
runtime/native/java_lang_reflect_Field.cc | 2 +-
runtime/native/java_lang_reflect_Method.cc | 2 +-
runtime/native/java_lang_reflect_Parameter.cc | 2 +-
runtime/native/java_lang_reflect_Proxy.cc | 2 +-
runtime/native/java_util_concurrent_atomic_AtomicLong.cc | 2 +-
runtime/native/libcore_util_CharsetUtils.cc | 2 +-
.../native/org_apache_harmony_dalvik_ddmc_DdmServer.cc | 2 +-
.../org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc | 2 +-
runtime/native/sun_misc_Unsafe.cc | 2 +-
test/004-JniTest/jni_test.cc | 2 +-
test/139-register-natives/regnative.cc | 2 +-
32 files changed, 35 insertions(+), 35 deletions(-)
diff --git a/benchmark/micro-native/micro_native.cc b/benchmark/micro-native/micro_native.cc
index dffbf3b11d..e70366cc48 100644
--- a/benchmark/micro-native/micro_native.cc
+++ b/benchmark/micro-native/micro_native.cc
@@ -38,7 +38,7 @@
static void NativeMethods_emptyJniStaticSynchronizedMethod0(JNIEnv*, jclass) { }
static void NativeMethods_emptyJniSynchronizedMethod0(JNIEnv*, jclass) { }
-static JNINativeMethod gMethods_NormalOnly[] = {
+static const JNINativeMethod gMethods_NormalOnly[] = {
NATIVE_METHOD(NativeMethods, emptyJniStaticSynchronizedMethod0, "()V"),
NATIVE_METHOD(NativeMethods, emptyJniSynchronizedMethod0, "()V"),
};
@@ -53,7 +53,7 @@ static void NativeMethods_emptyJniStaticMethod6L(JNIEnv*, jclass, jobject, jarra
static void NativeMethods_emptyJniStaticMethod0(JNIEnv*, jclass) { }
static void NativeMethods_emptyJniStaticMethod6(JNIEnv*, jclass, int, int, int, int, int, int) { }
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeMethods, emptyJniMethod0, "()V"),
NATIVE_METHOD(NativeMethods, emptyJniMethod6, "(IIIIII)V"),
NATIVE_METHOD(NativeMethods, emptyJniMethod6L, "(Ljava/lang/String;[Ljava/lang/String;[[ILjava/lang/Object;[Ljava/lang/Object;[[[[Ljava/lang/Object;)V"),
@@ -72,7 +72,7 @@ static void NativeMethods_emptyJniStaticMethod6L_Fast(JNIEnv*, jclass, jobject,
static void NativeMethods_emptyJniStaticMethod0_Fast(JNIEnv*, jclass) { }
static void NativeMethods_emptyJniStaticMethod6_Fast(JNIEnv*, jclass, int, int, int, int, int, int) { }
-static JNINativeMethod gMethods_Fast[] = {
+static const JNINativeMethod gMethods_Fast[] = {
NATIVE_METHOD(NativeMethods, emptyJniMethod0_Fast, "()V"),
NATIVE_METHOD(NativeMethods, emptyJniMethod6_Fast, "(IIIIII)V"),
NATIVE_METHOD(NativeMethods, emptyJniMethod6L_Fast, "(Ljava/lang/String;[Ljava/lang/String;[[ILjava/lang/Object;[Ljava/lang/Object;[[[[Ljava/lang/Object;)V"),
@@ -88,7 +88,7 @@ DEFINE_CRITICAL_JNI_METHOD(void, emptyJniStaticMethod0_1Critical)() { }
DEFINE_NORMAL_JNI_METHOD(void, emptyJniStaticMethod6_1Critical)(JNIEnv*, jclass, int, int, int, int, int, int) { }
DEFINE_CRITICAL_JNI_METHOD(void, emptyJniStaticMethod6_1Critical)(int, int, int, int, int, int) { }
-static JNINativeMethod gMethods_Critical[] = {
+static const JNINativeMethod gMethods_Critical[] = {
// Don't use NATIVE_METHOD because the name is mangled differently.
{ "emptyJniStaticMethod0_Critical", "()V",
reinterpret_cast<void*>(NAME_CRITICAL_JNI_METHOD(emptyJniStaticMethod0_1Critical)) },
diff --git a/runtime/native/dalvik_system_BaseDexClassLoader.cc b/runtime/native/dalvik_system_BaseDexClassLoader.cc
index 607395d308..f3d84e57a8 100644
--- a/runtime/native/dalvik_system_BaseDexClassLoader.cc
+++ b/runtime/native/dalvik_system_BaseDexClassLoader.cc
@@ -58,7 +58,7 @@ static jobjectArray BaseDexClassLoader_computeClassLoaderContextsNative(JNIEnv*
return result;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(BaseDexClassLoader, computeClassLoaderContextsNative,
"()[Ljava/lang/String;"),
};
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc
index d2b5edf333..cfeb9b62e5 100644
--- a/runtime/native/dalvik_system_DexFile.cc
+++ b/runtime/native/dalvik_system_DexFile.cc
@@ -900,7 +900,7 @@ static void DexFile_setTrusted(JNIEnv* env, jclass, jobject j_cookie) {
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(DexFile, closeDexFile, "(Ljava/lang/Object;)Z"),
NATIVE_METHOD(DexFile,
defineClassNative,
diff --git a/runtime/native/dalvik_system_VMDebug.cc b/runtime/native/dalvik_system_VMDebug.cc
index de43c4f384..df7e2ddbcf 100644
--- a/runtime/native/dalvik_system_VMDebug.cc
+++ b/runtime/native/dalvik_system_VMDebug.cc
@@ -627,7 +627,7 @@ static void VMDebug_setAllocTrackerStackDepth(JNIEnv* env, jclass, jint stack_de
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(VMDebug, countInstancesOfClass, "(Ljava/lang/Class;Z)J"),
NATIVE_METHOD(VMDebug, countInstancesOfClasses, "([Ljava/lang/Class;Z)[J"),
NATIVE_METHOD(VMDebug, crash, "()V"),
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc
index efaa3d938a..39757f8dc2 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -775,7 +775,7 @@ static jboolean VMRuntime_isValidClassLoaderContext(JNIEnv* env,
return ClassLoaderContext::IsValidEncoding(encoded_class_loader_context.c_str());
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(VMRuntime, addressOf, "(Ljava/lang/Object;)J"),
NATIVE_METHOD(VMRuntime, bootClassPath, "()Ljava/lang/String;"),
NATIVE_METHOD(VMRuntime, clampGrowthLimit, "()V"),
diff --git a/runtime/native/dalvik_system_VMStack.cc b/runtime/native/dalvik_system_VMStack.cc
index 32733a8409..33d352f572 100644
--- a/runtime/native/dalvik_system_VMStack.cc
+++ b/runtime/native/dalvik_system_VMStack.cc
@@ -169,7 +169,7 @@ static jobjectArray VMStack_getAnnotatedThreadStackTrace(JNIEnv* env, jclass, jo
return GetThreadStack(soa, javaThread, fn);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(VMStack, fillStackTraceElements, "(Ljava/lang/Thread;[Ljava/lang/StackTraceElement;)I"),
FAST_NATIVE_METHOD(VMStack, getCallingClassLoader, "()Ljava/lang/ClassLoader;"),
FAST_NATIVE_METHOD(VMStack, getClosestUserClassLoader, "()Ljava/lang/ClassLoader;"),
diff --git a/runtime/native/dalvik_system_ZygoteHooks.cc b/runtime/native/dalvik_system_ZygoteHooks.cc
index c37b8bb51c..114d83842b 100644
--- a/runtime/native/dalvik_system_ZygoteHooks.cc
+++ b/runtime/native/dalvik_system_ZygoteHooks.cc
@@ -434,7 +434,7 @@ static void ZygoteHooks_stopZygoteNoThreadCreation(JNIEnv* env ATTRIBUTE_UNUSED,
Runtime::Current()->SetZygoteNoThreadSection(false);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ZygoteHooks, nativePreFork, "()J"),
NATIVE_METHOD(ZygoteHooks, nativePostZygoteFork, "()V"),
NATIVE_METHOD(ZygoteHooks, nativePostForkSystemServer, "(I)V"),
diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc
index 2c537c6626..297a8d09f5 100644
--- a/runtime/native/java_lang_Class.cc
+++ b/runtime/native/java_lang_Class.cc
@@ -979,7 +979,7 @@ static jobject Class_newInstance(JNIEnv* env, jobject javaThis) {
return soa.AddLocalReference<jobject>(receiver.Get());
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Class, classForName,
"(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;"),
FAST_NATIVE_METHOD(Class, getDeclaredAnnotation,
diff --git a/runtime/native/java_lang_Object.cc b/runtime/native/java_lang_Object.cc
index 8fc10d1114..8740755199 100644
--- a/runtime/native/java_lang_Object.cc
+++ b/runtime/native/java_lang_Object.cc
@@ -54,7 +54,7 @@ static jint Object_identityHashCodeNative(JNIEnv* env, jclass, jobject javaObjec
return static_cast<jint>(o->IdentityHashCode());
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Object, internalClone, "()Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Object, notify, "()V"),
FAST_NATIVE_METHOD(Object, notifyAll, "()V"),
diff --git a/runtime/native/java_lang_String.cc b/runtime/native/java_lang_String.cc
index 7c7c5537fb..53fbcccc9b 100644
--- a/runtime/native/java_lang_String.cc
+++ b/runtime/native/java_lang_String.cc
@@ -110,7 +110,7 @@ static jcharArray String_toCharArray(JNIEnv* env, jobject java_this) {
return soa.AddLocalReference<jcharArray>(mirror::String::ToCharArray(s, soa.Self()));
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(String, charAt, "(I)C"),
FAST_NATIVE_METHOD(String, compareTo, "(Ljava/lang/String;)I"),
FAST_NATIVE_METHOD(String, concat, "(Ljava/lang/String;)Ljava/lang/String;"),
diff --git a/runtime/native/java_lang_StringFactory.cc b/runtime/native/java_lang_StringFactory.cc
index 178d5dabbd..c993714818 100644
--- a/runtime/native/java_lang_StringFactory.cc
+++ b/runtime/native/java_lang_StringFactory.cc
@@ -89,7 +89,7 @@ static jstring StringFactory_newStringFromString(JNIEnv* env, jclass, jstring to
return soa.AddLocalReference<jstring>(result);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(StringFactory, newStringFromBytes, "([BIII)Ljava/lang/String;"),
FAST_NATIVE_METHOD(StringFactory, newStringFromChars, "(II[C)Ljava/lang/String;"),
FAST_NATIVE_METHOD(StringFactory, newStringFromString, "(Ljava/lang/String;)Ljava/lang/String;"),
diff --git a/runtime/native/java_lang_System.cc b/runtime/native/java_lang_System.cc
index 63cbd2c815..e7b3894aad 100644
--- a/runtime/native/java_lang_System.cc
+++ b/runtime/native/java_lang_System.cc
@@ -239,7 +239,7 @@ static void System_arraycopyBooleanUnchecked(JNIEnv* env,
javaDst, dstPos, count);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(System, arraycopy, "(Ljava/lang/Object;ILjava/lang/Object;II)V"),
FAST_NATIVE_METHOD(System, arraycopyCharUnchecked, "([CI[CII)V"),
FAST_NATIVE_METHOD(System, arraycopyByteUnchecked, "([BI[BII)V"),
diff --git a/runtime/native/java_lang_Thread.cc b/runtime/native/java_lang_Thread.cc
index 5f21998998..f18979740e 100644
--- a/runtime/native/java_lang_Thread.cc
+++ b/runtime/native/java_lang_Thread.cc
@@ -201,7 +201,7 @@ static void Thread_yield(JNIEnv*, jobject) {
sched_yield();
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Thread, currentThread, "()Ljava/lang/Thread;"),
FAST_NATIVE_METHOD(Thread, interrupted, "()Z"),
FAST_NATIVE_METHOD(Thread, isInterrupted, "()Z"),
diff --git a/runtime/native/java_lang_Throwable.cc b/runtime/native/java_lang_Throwable.cc
index b5ef7d807b..7a6a44baa5 100644
--- a/runtime/native/java_lang_Throwable.cc
+++ b/runtime/native/java_lang_Throwable.cc
@@ -38,7 +38,7 @@ static jobjectArray Throwable_nativeGetStackTrace(JNIEnv* env, jclass, jobject j
return Thread::InternalStackTraceToStackTraceElementArray(soa, javaStackState);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Throwable, nativeFillInStackTrace, "()Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Throwable, nativeGetStackTrace, "(Ljava/lang/Object;)[Ljava/lang/StackTraceElement;"),
};
diff --git a/runtime/native/java_lang_VMClassLoader.cc b/runtime/native/java_lang_VMClassLoader.cc
index 11e02a2ce4..ce37a33086 100644
--- a/runtime/native/java_lang_VMClassLoader.cc
+++ b/runtime/native/java_lang_VMClassLoader.cc
@@ -155,7 +155,7 @@ static jobjectArray VMClassLoader_getBootClassPathEntries(JNIEnv* env, jclass) {
return array;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(VMClassLoader, findLoadedClass, "(Ljava/lang/ClassLoader;Ljava/lang/String;)Ljava/lang/Class;"),
NATIVE_METHOD(VMClassLoader, getBootClassPathEntries, "()[Ljava/lang/String;"),
};
diff --git a/runtime/native/java_lang_invoke_MethodHandleImpl.cc b/runtime/native/java_lang_invoke_MethodHandleImpl.cc
index 0b26bd7c4a..6662fe49a2 100644
--- a/runtime/native/java_lang_invoke_MethodHandleImpl.cc
+++ b/runtime/native/java_lang_invoke_MethodHandleImpl.cc
@@ -68,7 +68,7 @@ static jobject MethodHandleImpl_getMemberInternal(JNIEnv* env, jobject thiz) {
return soa.AddLocalReference<jobject>(h_object.Get());
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(MethodHandleImpl, getMemberInternal, "()Ljava/lang/reflect/Member;"),
};
diff --git a/runtime/native/java_lang_ref_FinalizerReference.cc b/runtime/native/java_lang_ref_FinalizerReference.cc
index 535b243411..0a8dfb6c09 100644
--- a/runtime/native/java_lang_ref_FinalizerReference.cc
+++ b/runtime/native/java_lang_ref_FinalizerReference.cc
@@ -42,7 +42,7 @@ static jobject FinalizerReference_getReferent(JNIEnv* env, jobject javaThis) {
return soa.AddLocalReference<jobject>(referent);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(FinalizerReference, makeCircularListIfUnenqueued, "()Z"),
FAST_NATIVE_METHOD(FinalizerReference, getReferent, "()Ljava/lang/Object;"),
};
diff --git a/runtime/native/java_lang_ref_Reference.cc b/runtime/native/java_lang_ref_Reference.cc
index b241b1de25..89a381878c 100644
--- a/runtime/native/java_lang_ref_Reference.cc
+++ b/runtime/native/java_lang_ref_Reference.cc
@@ -42,7 +42,7 @@ static void Reference_clearReferent(JNIEnv* env, jobject javaThis) {
Runtime::Current()->GetHeap()->GetReferenceProcessor()->ClearReferent(ref);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Reference, getReferent, "()Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Reference, clearReferent, "()V"),
};
diff --git a/runtime/native/java_lang_reflect_Array.cc b/runtime/native/java_lang_reflect_Array.cc
index ff94593cdf..e359e7d8a8 100644
--- a/runtime/native/java_lang_reflect_Array.cc
+++ b/runtime/native/java_lang_reflect_Array.cc
@@ -74,7 +74,7 @@ static jobject Array_createObjectArray(JNIEnv* env, jclass, jclass javaElementCl
return soa.AddLocalReference<jobject>(new_array);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Array, createMultiArray, "(Ljava/lang/Class;[I)Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Array, createObjectArray, "(Ljava/lang/Class;I)Ljava/lang/Object;"),
};
diff --git a/runtime/native/java_lang_reflect_Constructor.cc b/runtime/native/java_lang_reflect_Constructor.cc
index f9cdc360bc..bc8c38d246 100644
--- a/runtime/native/java_lang_reflect_Constructor.cc
+++ b/runtime/native/java_lang_reflect_Constructor.cc
@@ -128,7 +128,7 @@ static jobject Constructor_newInstanceFromSerialization(JNIEnv* env, jclass unus
return env->NewObject(allocClass, ctor);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Constructor, getExceptionTypes, "()[Ljava/lang/Class;"),
FAST_NATIVE_METHOD(Constructor, newInstance0, "([Ljava/lang/Object;)Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Constructor, newInstanceFromSerialization, "(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/Object;"),
diff --git a/runtime/native/java_lang_reflect_Executable.cc b/runtime/native/java_lang_reflect_Executable.cc
index 2ce56b5153..4ba93e3dde 100644
--- a/runtime/native/java_lang_reflect_Executable.cc
+++ b/runtime/native/java_lang_reflect_Executable.cc
@@ -383,7 +383,7 @@ static jint Executable_getParameterCountInternal(JNIEnv* env, jobject javaMethod
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Executable, compareMethodParametersInternal,
"(Ljava/lang/reflect/Method;)I"),
FAST_NATIVE_METHOD(Executable, getAnnotationNative,
diff --git a/runtime/native/java_lang_reflect_Field.cc b/runtime/native/java_lang_reflect_Field.cc
index 42b6c2244f..0bd2344c03 100644
--- a/runtime/native/java_lang_reflect_Field.cc
+++ b/runtime/native/java_lang_reflect_Field.cc
@@ -507,7 +507,7 @@ static jboolean Field_isAnnotationPresentNative(JNIEnv* env,
return annotations::IsFieldAnnotationPresent(field, klass);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Field, get, "(Ljava/lang/Object;)Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Field, getBoolean, "(Ljava/lang/Object;)Z"),
FAST_NATIVE_METHOD(Field, getByte, "(Ljava/lang/Object;)B"),
diff --git a/runtime/native/java_lang_reflect_Method.cc b/runtime/native/java_lang_reflect_Method.cc
index 0d9a2570b4..cddfd4ff6a 100644
--- a/runtime/native/java_lang_reflect_Method.cc
+++ b/runtime/native/java_lang_reflect_Method.cc
@@ -86,7 +86,7 @@ static jobject Method_invoke(JNIEnv* env, jobject javaMethod, jobject javaReceiv
return InvokeMethod(soa, javaMethod, javaReceiver, javaArgs);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Method, getDefaultValue, "()Ljava/lang/Object;"),
FAST_NATIVE_METHOD(Method, getExceptionTypes, "()[Ljava/lang/Class;"),
FAST_NATIVE_METHOD(Method, invoke, "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;"),
diff --git a/runtime/native/java_lang_reflect_Parameter.cc b/runtime/native/java_lang_reflect_Parameter.cc
index 263a56796f..92bf9078a4 100644
--- a/runtime/native/java_lang_reflect_Parameter.cc
+++ b/runtime/native/java_lang_reflect_Parameter.cc
@@ -98,7 +98,7 @@ static jobject Parameter_getAnnotationNative(JNIEnv* env,
annotations::GetAnnotationForMethodParameter(method, parameterIndex, klass));
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(
Parameter,
getAnnotationNative,
diff --git a/runtime/native/java_lang_reflect_Proxy.cc b/runtime/native/java_lang_reflect_Proxy.cc
index f723ed223d..c2b533de5d 100644
--- a/runtime/native/java_lang_reflect_Proxy.cc
+++ b/runtime/native/java_lang_reflect_Proxy.cc
@@ -37,7 +37,7 @@ static jclass Proxy_generateProxy(JNIEnv* env, jclass, jstring name, jobjectArra
soa, name, interfaces, loader, methods, throws));
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Proxy, generateProxy, "(Ljava/lang/String;[Ljava/lang/Class;Ljava/lang/ClassLoader;[Ljava/lang/reflect/Method;[[Ljava/lang/Class;)Ljava/lang/Class;"),
};
diff --git a/runtime/native/java_util_concurrent_atomic_AtomicLong.cc b/runtime/native/java_util_concurrent_atomic_AtomicLong.cc
index fa288edcb8..299ac5a61d 100644
--- a/runtime/native/java_util_concurrent_atomic_AtomicLong.cc
+++ b/runtime/native/java_util_concurrent_atomic_AtomicLong.cc
@@ -30,7 +30,7 @@ static jboolean AtomicLong_VMSupportsCS8(JNIEnv*, jclass) {
return QuasiAtomic::LongAtomicsUseMutexes(kRuntimeISA) ? JNI_FALSE : JNI_TRUE;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(AtomicLong, VMSupportsCS8, "()Z"),
};
diff --git a/runtime/native/libcore_util_CharsetUtils.cc b/runtime/native/libcore_util_CharsetUtils.cc
index 95e0d79cd9..b86bda4672 100644
--- a/runtime/native/libcore_util_CharsetUtils.cc
+++ b/runtime/native/libcore_util_CharsetUtils.cc
@@ -252,7 +252,7 @@ static jbyteArray CharsetUtils_toUtf8Bytes(JNIEnv* env, jclass, jstring java_str
return out.toByteArray();
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(CharsetUtils, asciiBytesToChars, "([BII[C)V"),
FAST_NATIVE_METHOD(CharsetUtils, isoLatin1BytesToChars, "([BII[C)V"),
FAST_NATIVE_METHOD(CharsetUtils, toAsciiBytes, "(Ljava/lang/String;II)[B"),
diff --git a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
index 419aed8578..ccbef4f3f4 100644
--- a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
+++ b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
@@ -38,7 +38,7 @@ static void DdmServer_nativeSendChunk(JNIEnv* env, jclass, jint type,
Runtime::Current()->GetRuntimeCallbacks()->DdmPublishChunk(static_cast<uint32_t>(type), chunk);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(DdmServer, nativeSendChunk, "(I[BII)V"),
};
diff --git a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
index d405735f19..1c92bc75db 100644
--- a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
+++ b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
@@ -227,7 +227,7 @@ static void DdmVmInternal_threadNotify(JNIEnv*, jclass, jboolean enable) {
Dbg::DdmSetThreadNotification(enable);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(DdmVmInternal, enableRecentAllocations, "(Z)V"),
FAST_NATIVE_METHOD(DdmVmInternal, getRecentAllocations, "()[B"),
FAST_NATIVE_METHOD(DdmVmInternal, getRecentAllocationStatus, "()Z"),
diff --git a/runtime/native/sun_misc_Unsafe.cc b/runtime/native/sun_misc_Unsafe.cc
index 5014f340cd..bb9226d1fa 100644
--- a/runtime/native/sun_misc_Unsafe.cc
+++ b/runtime/native/sun_misc_Unsafe.cc
@@ -541,7 +541,7 @@ static void Unsafe_unpark(JNIEnv* env, jobject, jobject jthread) {
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Unsafe, compareAndSwapInt, "(Ljava/lang/Object;JII)Z"),
FAST_NATIVE_METHOD(Unsafe, compareAndSwapLong, "(Ljava/lang/Object;JJJ)Z"),
FAST_NATIVE_METHOD(Unsafe, compareAndSwapObject, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z"),
diff --git a/test/004-JniTest/jni_test.cc b/test/004-JniTest/jni_test.cc
index 540e6ce357..405ccd45c1 100644
--- a/test/004-JniTest/jni_test.cc
+++ b/test/004-JniTest/jni_test.cc
@@ -33,7 +33,7 @@ static JavaVM* jvm = nullptr;
static jint Java_Main_intFastNativeMethod(JNIEnv*, jclass, jint a, jint b, jint c);
static jint Java_Main_intCriticalNativeMethod(jint a, jint b, jint c);
-static JNINativeMethod sMainMethods[] = {
+static const JNINativeMethod sMainMethods[] = {
{"intFastNativeMethod", "(III)I", reinterpret_cast<void*>(Java_Main_intFastNativeMethod) },
{"intCriticalNativeMethod", "(III)I", reinterpret_cast<void*>(Java_Main_intCriticalNativeMethod) },
};
diff --git a/test/139-register-natives/regnative.cc b/test/139-register-natives/regnative.cc
index d9c8b31ac7..083c14c1ec 100644
--- a/test/139-register-natives/regnative.cc
+++ b/test/139-register-natives/regnative.cc
@@ -22,7 +22,7 @@ namespace art {
static void foo(JNIEnv*, jclass) {
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "foo", "()V", reinterpret_cast<void*>(foo) }
};

View File

@ -0,0 +1,22 @@
From dce2d0f64f68739fed38483948095621506ca244 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Wed, 18 Nov 2020 14:28:24 -0500
Subject: [PATCH] constify JNINativeMethod table
---
common/src/jni/main/cpp/conscrypt/native_crypto.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/src/jni/main/cpp/conscrypt/native_crypto.cc b/common/src/jni/main/cpp/conscrypt/native_crypto.cc
index c739546e..8325707e 100644
--- a/common/src/jni/main/cpp/conscrypt/native_crypto.cc
+++ b/common/src/jni/main/cpp/conscrypt/native_crypto.cc
@@ -10078,7 +10078,7 @@ static jlong NativeCrypto_SSL_get1_session(JNIEnv* env, jclass, jlong ssl_addres
#define REF_X509_CRL "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/OpenSSLX509CRL;"
#define REF_SSL "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeSsl;"
#define REF_SSL_CTX "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/AbstractSessionContext;"
-static JNINativeMethod sNativeCryptoMethods[] = {
+static const JNINativeMethod sNativeCryptoMethods[] = {
CONSCRYPT_NATIVE_METHOD(clinit, "()V"),
CONSCRYPT_NATIVE_METHOD(EVP_PKEY_new_RSA, "([B[B[B[B[B[B[B[B)J"),
CONSCRYPT_NATIVE_METHOD(EVP_PKEY_new_EC_KEY, "(" REF_EC_GROUP REF_EC_POINT "[B)J"),

View File

@ -0,0 +1,199 @@
From 63b9f96a121648ce0815b4ff21a670af9d643203 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Wed, 9 Sep 2020 12:04:55 -0400
Subject: [PATCH] constify JNINativeMethod tables
---
cmds/hid/jni/com_android_commands_hid_Device.cpp | 2 +-
core/jni/android_app_ActivityThread.cpp | 2 +-
core/jni/android_os_HidlMemory.cpp | 2 +-
core/jni/android_os_HwBinder.cpp | 2 +-
core/jni/android_os_HwBlob.cpp | 2 +-
core/jni/android_os_HwParcel.cpp | 2 +-
core/jni/android_os_HwRemoteBinder.cpp | 2 +-
libs/hwui/jni/android_graphics_DisplayListCanvas.cpp | 2 +-
media/jni/android_media_ImageWriter.cpp | 4 ++--
media/jni/android_media_MediaSync.cpp | 2 +-
media/jni/soundpool/android_media_SoundPool.cpp | 2 +-
services/core/jni/com_android_server_UsbMidiDevice.cpp | 2 +-
services/core/jni/com_android_server_tv_TvUinputBridge.cpp | 2 +-
13 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/cmds/hid/jni/com_android_commands_hid_Device.cpp b/cmds/hid/jni/com_android_commands_hid_Device.cpp
index 1e200c52a207..011e1ed9d80e 100644
--- a/cmds/hid/jni/com_android_commands_hid_Device.cpp
+++ b/cmds/hid/jni/com_android_commands_hid_Device.cpp
@@ -340,7 +340,7 @@ static void closeDevice(JNIEnv* /* env */, jclass /* clazz */, jlong ptr) {
}
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"nativeOpenDevice",
"(Ljava/lang/String;IIII[B"
"Lcom/android/commands/hid/Device$DeviceCallback;)J",
diff --git a/core/jni/android_app_ActivityThread.cpp b/core/jni/android_app_ActivityThread.cpp
index 5aa684d51a01..564328d641d3 100644
--- a/core/jni/android_app_ActivityThread.cpp
+++ b/core/jni/android_app_ActivityThread.cpp
@@ -40,7 +40,7 @@ static void android_app_ActivityThread_initZygoteChildHeapProfiling(JNIEnv* env,
android_mallopt(M_INIT_ZYGOTE_CHILD_PROFILING, nullptr, 0);
}
-static JNINativeMethod gActivityThreadMethods[] = {
+static const JNINativeMethod gActivityThreadMethods[] = {
// ------------ Regular JNI ------------------
{ "nPurgePendingResources", "()V",
(void*) android_app_ActivityThread_purgePendingResources },
diff --git a/core/jni/android_os_HidlMemory.cpp b/core/jni/android_os_HidlMemory.cpp
index 69e48184c0ad..612fc95776a5 100644
--- a/core/jni/android_os_HidlMemory.cpp
+++ b/core/jni/android_os_HidlMemory.cpp
@@ -50,7 +50,7 @@ static void nativeFinalize(JNIEnv* env, jobject jobj) {
delete native;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{"nativeFinalize", "()V", (void*) nativeFinalize},
};
diff --git a/core/jni/android_os_HwBinder.cpp b/core/jni/android_os_HwBinder.cpp
index b6427c9aa01c..7d1889fae82b 100644
--- a/core/jni/android_os_HwBinder.cpp
+++ b/core/jni/android_os_HwBinder.cpp
@@ -354,7 +354,7 @@ static void JHwBinder_report_sysprop_change(JNIEnv * /*env*/, jclass /*clazz*/)
report_sysprop_change();
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "native_init", "()J", (void *)JHwBinder_native_init },
{ "native_setup", "()V", (void *)JHwBinder_native_setup },
diff --git a/core/jni/android_os_HwBlob.cpp b/core/jni/android_os_HwBlob.cpp
index 0fb29111d043..7fdc4c7526bf 100644
--- a/core/jni/android_os_HwBlob.cpp
+++ b/core/jni/android_os_HwBlob.cpp
@@ -589,7 +589,7 @@ static jlong JHwBlob_native_handle(JNIEnv *env, jobject thiz) {
return handle;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "native_init", "()J", (void *)JHwBlob_native_init },
{ "native_setup", "(I)V", (void *)JHwBlob_native_setup },
diff --git a/core/jni/android_os_HwParcel.cpp b/core/jni/android_os_HwParcel.cpp
index 151dbfce7af3..4869c2d68b95 100644
--- a/core/jni/android_os_HwParcel.cpp
+++ b/core/jni/android_os_HwParcel.cpp
@@ -1065,7 +1065,7 @@ static void JHwParcel_native_writeBuffer(
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "native_init", "()J", (void *)JHwParcel_native_init },
{ "native_setup", "(Z)V", (void *)JHwParcel_native_setup },
diff --git a/core/jni/android_os_HwRemoteBinder.cpp b/core/jni/android_os_HwRemoteBinder.cpp
index f8f841c6fd26..45c7dbf77404 100644
--- a/core/jni/android_os_HwRemoteBinder.cpp
+++ b/core/jni/android_os_HwRemoteBinder.cpp
@@ -455,7 +455,7 @@ static jint JHwRemoteBinder_hashCode(JNIEnv* env, jobject thiz) {
return static_cast<jint>(longHash ^ (longHash >> 32)); // See Long.hashCode()
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "native_init", "()J", (void *)JHwRemoteBinder_native_init },
{ "native_setup_empty", "()V",
diff --git a/libs/hwui/jni/android_graphics_DisplayListCanvas.cpp b/libs/hwui/jni/android_graphics_DisplayListCanvas.cpp
index 54822f1f07e2..8b3fc9861b50 100644
--- a/libs/hwui/jni/android_graphics_DisplayListCanvas.cpp
+++ b/libs/hwui/jni/android_graphics_DisplayListCanvas.cpp
@@ -182,7 +182,7 @@ static void android_view_DisplayListCanvas_drawWebViewFunctor(CRITICAL_JNI_PARAM
const char* const kClassPathName = "android/graphics/RecordingCanvas";
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
// ------------ @FastNative ------------------
diff --git a/media/jni/android_media_ImageWriter.cpp b/media/jni/android_media_ImageWriter.cpp
index 936edb3fb005..347e34e773dd 100644
--- a/media/jni/android_media_ImageWriter.cpp
+++ b/media/jni/android_media_ImageWriter.cpp
@@ -1005,7 +1005,7 @@ static jobjectArray Image_createSurfacePlanes(JNIEnv* env, jobject thiz,
// ----------------------------------------------------------------------------
-static JNINativeMethod gImageWriterMethods[] = {
+static const JNINativeMethod gImageWriterMethods[] = {
{"nativeClassInit", "()V", (void*)ImageWriter_classInit },
{"nativeInit", "(Ljava/lang/Object;Landroid/view/Surface;II)J",
(void*)ImageWriter_init },
@@ -1016,7 +1016,7 @@ static JNINativeMethod gImageWriterMethods[] = {
{"cancelImage", "(JLandroid/media/Image;)V", (void*)ImageWriter_cancelImage },
};
-static JNINativeMethod gImageMethods[] = {
+static const JNINativeMethod gImageMethods[] = {
{"nativeCreatePlanes", "(II)[Landroid/media/ImageWriter$WriterSurfaceImage$SurfacePlane;",
(void*)Image_createSurfacePlanes },
{"nativeGetWidth", "()I", (void*)Image_getWidth },
diff --git a/media/jni/android_media_MediaSync.cpp b/media/jni/android_media_MediaSync.cpp
index f75200868a0d..994997f7c132 100644
--- a/media/jni/android_media_MediaSync.cpp
+++ b/media/jni/android_media_MediaSync.cpp
@@ -514,7 +514,7 @@ static void android_media_MediaSync_native_finalize(JNIEnv *env, jobject thiz) {
android_media_MediaSync_release(env, thiz);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "native_setSurface",
"(Landroid/view/Surface;)V",
(void *)android_media_MediaSync_native_setSurface },
diff --git a/media/jni/soundpool/android_media_SoundPool.cpp b/media/jni/soundpool/android_media_SoundPool.cpp
index de96737d4034..160f7128d896 100644
--- a/media/jni/soundpool/android_media_SoundPool.cpp
+++ b/media/jni/soundpool/android_media_SoundPool.cpp
@@ -246,7 +246,7 @@ android_media_SoundPool_release(JNIEnv *env, jobject thiz)
// ----------------------------------------------------------------------------
// Dalvik VM type signatures
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "_load",
"(Ljava/io/FileDescriptor;JJI)I",
(void *)android_media_SoundPool_load_FD
diff --git a/services/core/jni/com_android_server_UsbMidiDevice.cpp b/services/core/jni/com_android_server_UsbMidiDevice.cpp
index 79d935fe610c..86b43fcae705 100644
--- a/services/core/jni/com_android_server_UsbMidiDevice.cpp
+++ b/services/core/jni/com_android_server_UsbMidiDevice.cpp
@@ -135,7 +135,7 @@ android_server_UsbMidiDevice_close(JNIEnv *env, jobject thiz, jobjectArray fds)
}
}
-static JNINativeMethod method_table[] = {
+static const JNINativeMethod method_table[] = {
{ "nativeGetSubdeviceCount", "(II)I", (void*)android_server_UsbMidiDevice_get_subdevice_count },
{ "nativeOpen", "(III)[Ljava/io/FileDescriptor;", (void*)android_server_UsbMidiDevice_open },
{ "nativeClose", "([Ljava/io/FileDescriptor;)V", (void*)android_server_UsbMidiDevice_close },
diff --git a/services/core/jni/com_android_server_tv_TvUinputBridge.cpp b/services/core/jni/com_android_server_tv_TvUinputBridge.cpp
index 99deab4fd652..2cb1aaef13fa 100644
--- a/services/core/jni/com_android_server_tv_TvUinputBridge.cpp
+++ b/services/core/jni/com_android_server_tv_TvUinputBridge.cpp
@@ -534,7 +534,7 @@ static void nativeClear(JNIEnv* env, jclass clazz, jlong ptr) {
* JNI registration
*/
-static JNINativeMethod gUinputBridgeMethods[] = {
+static const JNINativeMethod gUinputBridgeMethods[] = {
{"nativeOpen", "(Ljava/lang/String;Ljava/lang/String;III)J", (void*)nativeOpen},
{"nativeGamepadOpen", "(Ljava/lang/String;Ljava/lang/String;)J", (void*)nativeGamepadOpen},
{"nativeClose", "(J)V", (void*)nativeClose},

View File

@ -0,0 +1,22 @@
From c34b037486b38bed7a45b26f736e9fe4a8c931f2 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Mon, 4 Jan 2021 19:56:14 -0500
Subject: [PATCH] constify JNINativeMethod table
---
framesequence/jni/FrameSequenceJNI.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/framesequence/jni/FrameSequenceJNI.cpp b/framesequence/jni/FrameSequenceJNI.cpp
index c701f03..4041733 100644
--- a/framesequence/jni/FrameSequenceJNI.cpp
+++ b/framesequence/jni/FrameSequenceJNI.cpp
@@ -141,7 +141,7 @@ static jlong JNICALL nativeGetFrame(
return delayMs;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{ "nativeDecodeByteArray",
"([BII)L" JNI_PACKAGE "/FrameSequence;",
(void*) nativeDecodeByteArray

View File

@ -0,0 +1,739 @@
From e3a4d64f29c9a0cad11fe06af6ff378c9ea9dbea Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Wed, 9 Sep 2020 12:10:23 -0400
Subject: [PATCH] constify JNINativeMethod tables
---
.../native/org_apache_harmony_dalvik_NativeTestTarget.cpp | 8 ++++----
luni/src/main/native/android_system_OsConstants.cpp | 2 +-
luni/src/main/native/java_lang_StringToReal.cpp | 2 +-
luni/src/main/native/java_lang_invoke_MethodHandle.cpp | 2 +-
luni/src/main/native/java_lang_invoke_VarHandle.cpp | 2 +-
luni/src/main/native/java_math_NativeBN.cpp | 2 +-
luni/src/main/native/libcore_icu_ICU.cpp | 2 +-
luni/src/main/native/libcore_icu_TimeZoneNames.cpp | 2 +-
.../main/native/libcore_io_AsynchronousCloseMonitor.cpp | 2 +-
luni/src/main/native/libcore_io_Linux.cpp | 2 +-
luni/src/main/native/libcore_io_Memory.cpp | 2 +-
.../main/native/libcore_util_NativeAllocationRegistry.cpp | 2 +-
.../main/native/org_apache_harmony_xml_ExpatParser.cpp | 4 ++--
luni/src/main/native/sun_misc_Unsafe.cpp | 2 +-
ojluni/src/main/native/Adler32.c | 2 +-
ojluni/src/main/native/CRC32.c | 2 +-
ojluni/src/main/native/Character.cpp | 2 +-
ojluni/src/main/native/Console_md.c | 2 +-
ojluni/src/main/native/DatagramChannelImpl.c | 2 +-
ojluni/src/main/native/DatagramDispatcher.c | 2 +-
ojluni/src/main/native/Deflater.c | 2 +-
ojluni/src/main/native/Double.c | 2 +-
ojluni/src/main/native/FileChannelImpl.c | 2 +-
ojluni/src/main/native/FileDescriptor_md.c | 2 +-
ojluni/src/main/native/FileDispatcherImpl.c | 2 +-
ojluni/src/main/native/FileInputStream.c | 2 +-
ojluni/src/main/native/FileKey.c | 2 +-
ojluni/src/main/native/FileSystemPreferences.c | 2 +-
ojluni/src/main/native/Float.c | 2 +-
ojluni/src/main/native/IOUtil.c | 2 +-
ojluni/src/main/native/Inflater.c | 2 +-
ojluni/src/main/native/MappedByteBuffer.c | 2 +-
ojluni/src/main/native/Math.c | 2 +-
ojluni/src/main/native/NativeThread.c | 2 +-
ojluni/src/main/native/Net.c | 2 +-
ojluni/src/main/native/ObjectInputStream.c | 2 +-
ojluni/src/main/native/ObjectOutputStream.c | 2 +-
ojluni/src/main/native/ObjectStreamClass.c | 2 +-
ojluni/src/main/native/ProcessEnvironment_md.c | 2 +-
ojluni/src/main/native/Runtime.c | 2 +-
ojluni/src/main/native/ServerSocketChannelImpl.c | 2 +-
ojluni/src/main/native/SocketChannelImpl.c | 2 +-
ojluni/src/main/native/SocketInputStream.c | 2 +-
ojluni/src/main/native/SocketOutputStream.c | 2 +-
ojluni/src/main/native/StrictMath.c | 2 +-
ojluni/src/main/native/System.c | 2 +-
ojluni/src/main/native/UNIXProcess_md.c | 2 +-
ojluni/src/main/native/UnixFileSystem_md.c | 2 +-
ojluni/src/main/native/ZipFile.c | 4 ++--
49 files changed, 54 insertions(+), 54 deletions(-)
diff --git a/dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp b/dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp
index 9f2b429374..06d05f3b71 100644
--- a/dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp
+++ b/dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp
@@ -24,7 +24,7 @@
static void NativeTestTarget_emptyJniStaticSynchronizedMethod0(JNIEnv*, jclass) { }
static void NativeTestTarget_emptyJniSynchronizedMethod0(JNIEnv*, jclass) { }
-static JNINativeMethod gMethods_NormalOnly[] = {
+static const JNINativeMethod gMethods_NormalOnly[] = {
NATIVE_METHOD(NativeTestTarget, emptyJniStaticSynchronizedMethod0, "()V"),
NATIVE_METHOD(NativeTestTarget, emptyJniSynchronizedMethod0, "()V"),
};
@@ -38,7 +38,7 @@ static void NativeTestTarget_emptyJniStaticMethod6L(JNIEnv*, jclass, jobject, ja
static void NativeTestTarget_emptyJniStaticMethod0(JNIEnv*, jclass) { }
static void NativeTestTarget_emptyJniStaticMethod6(JNIEnv*, jclass, int, int, int, int, int, int) { }
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeTestTarget, emptyJniMethod0, "()V"),
NATIVE_METHOD(NativeTestTarget, emptyJniMethod6, "(IIIIII)V"),
NATIVE_METHOD(NativeTestTarget, emptyJniMethod6L, "(Ljava/lang/String;[Ljava/lang/String;[[ILjava/lang/Object;[Ljava/lang/Object;[[[[Ljava/lang/Object;)V"),
@@ -55,7 +55,7 @@ static void NativeTestTarget_emptyJniStaticMethod6L_Fast(JNIEnv*, jclass, jobjec
static void NativeTestTarget_emptyJniStaticMethod0_Fast(JNIEnv*, jclass) { }
static void NativeTestTarget_emptyJniStaticMethod6_Fast(JNIEnv*, jclass, int, int, int, int, int, int) { }
-static JNINativeMethod gMethods_Fast[] = {
+static const JNINativeMethod gMethods_Fast[] = {
NATIVE_METHOD(NativeTestTarget, emptyJniMethod0_Fast, "()V"),
NATIVE_METHOD(NativeTestTarget, emptyJniMethod6_Fast, "(IIIIII)V"),
NATIVE_METHOD(NativeTestTarget, emptyJniMethod6L_Fast, "(Ljava/lang/String;[Ljava/lang/String;[[ILjava/lang/Object;[Ljava/lang/Object;[[[[Ljava/lang/Object;)V"),
@@ -68,7 +68,7 @@ static JNINativeMethod gMethods_Fast[] = {
static void NativeTestTarget_emptyJniStaticMethod0_Critical() { }
static void NativeTestTarget_emptyJniStaticMethod6_Critical( int, int, int, int, int, int) { }
-static JNINativeMethod gMethods_Critical[] = {
+static const JNINativeMethod gMethods_Critical[] = {
NATIVE_METHOD(NativeTestTarget, emptyJniStaticMethod0_Critical, "()V"),
NATIVE_METHOD(NativeTestTarget, emptyJniStaticMethod6_Critical, "(IIIIII)V"),
};
diff --git a/luni/src/main/native/android_system_OsConstants.cpp b/luni/src/main/native/android_system_OsConstants.cpp
index 6cf2c8b30b..f22e1cb1d1 100644
--- a/luni/src/main/native/android_system_OsConstants.cpp
+++ b/luni/src/main/native/android_system_OsConstants.cpp
@@ -708,7 +708,7 @@ static void OsConstants_initConstants(JNIEnv* env, jclass c) {
initConstant(env, c, "_SC_XOPEN_XCU_VERSION", _SC_XOPEN_XCU_VERSION);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(OsConstants, initConstants, "()V"),
};
void register_android_system_OsConstants(JNIEnv* env) {
diff --git a/luni/src/main/native/java_lang_StringToReal.cpp b/luni/src/main/native/java_lang_StringToReal.cpp
index 7a49285639..edd71fad70 100644
--- a/luni/src/main/native/java_lang_StringToReal.cpp
+++ b/luni/src/main/native/java_lang_StringToReal.cpp
@@ -892,7 +892,7 @@ static jdouble StringToReal_parseDblImpl(JNIEnv* env, jclass, jstring s, jint e)
return createDouble(env, str.c_str(), e);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(StringToReal, parseFltImpl, "(Ljava/lang/String;I)F"),
NATIVE_METHOD(StringToReal, parseDblImpl, "(Ljava/lang/String;I)D"),
};
diff --git a/luni/src/main/native/java_lang_invoke_MethodHandle.cpp b/luni/src/main/native/java_lang_invoke_MethodHandle.cpp
index 0441d4552d..3335c6de9a 100644
--- a/luni/src/main/native/java_lang_invoke_MethodHandle.cpp
+++ b/luni/src/main/native/java_lang_invoke_MethodHandle.cpp
@@ -29,7 +29,7 @@ static jobject MethodHandle_invoke(JNIEnv* env, jobject, jobjectArray) {
return nullptr;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(MethodHandle, invokeExact, "([Ljava/lang/Object;)Ljava/lang/Object;"),
NATIVE_METHOD(MethodHandle, invoke, "([Ljava/lang/Object;)Ljava/lang/Object;"),
};
diff --git a/luni/src/main/native/java_lang_invoke_VarHandle.cpp b/luni/src/main/native/java_lang_invoke_VarHandle.cpp
index e1cc1c7f8b..9f5215a520 100644
--- a/luni/src/main/native/java_lang_invoke_VarHandle.cpp
+++ b/luni/src/main/native/java_lang_invoke_VarHandle.cpp
@@ -210,7 +210,7 @@ static jboolean VarHandle_weakCompareAndSetRelease(JNIEnv* env, jobject, jobject
return JNI_FALSE;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(VarHandle, compareAndExchange, "([Ljava/lang/Object;)Ljava/lang/Object;"),
NATIVE_METHOD(VarHandle, compareAndExchangeAcquire, "([Ljava/lang/Object;)Ljava/lang/Object;"),
NATIVE_METHOD(VarHandle, compareAndExchangeRelease, "([Ljava/lang/Object;)Ljava/lang/Object;"),
diff --git a/luni/src/main/native/java_math_NativeBN.cpp b/luni/src/main/native/java_math_NativeBN.cpp
index 5d085ec9ec..b8c46e6681 100644
--- a/luni/src/main/native/java_math_NativeBN.cpp
+++ b/luni/src/main/native/java_math_NativeBN.cpp
@@ -526,7 +526,7 @@ static jboolean NativeBN_BN_primality_test(JNIEnv* env, jclass, jlong candidate,
return is_probably_prime ? JNI_TRUE : JNI_FALSE;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeBN, BN_add, "(JJJ)V"),
NATIVE_METHOD(NativeBN, BN_add_word, "(JI)V"),
NATIVE_METHOD(NativeBN, BN_bin2bn, "([BIZJ)V"),
diff --git a/luni/src/main/native/libcore_icu_ICU.cpp b/luni/src/main/native/libcore_icu_ICU.cpp
index 9879761e80..e8cbe0ab6f 100644
--- a/luni/src/main/native/libcore_icu_ICU.cpp
+++ b/luni/src/main/native/libcore_icu_ICU.cpp
@@ -651,7 +651,7 @@ static jstring ICU_getDefaultLocale(JNIEnv* env, jclass) {
return env->NewStringUTF(uloc_getDefault());
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ICU, getAvailableLocalesNative, "()[Ljava/lang/String;"),
NATIVE_METHOD(ICU, getBestDateTimePatternNative, "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"),
NATIVE_METHOD(ICU, getCurrencyCode, "(Ljava/lang/String;)Ljava/lang/String;"),
diff --git a/luni/src/main/native/libcore_icu_TimeZoneNames.cpp b/luni/src/main/native/libcore_icu_TimeZoneNames.cpp
index db4c6f219f..f51ae12cd1 100644
--- a/luni/src/main/native/libcore_icu_TimeZoneNames.cpp
+++ b/luni/src/main/native/libcore_icu_TimeZoneNames.cpp
@@ -97,7 +97,7 @@ static void TimeZoneNames_fillZoneStrings(JNIEnv* env, jclass, jstring javaLocal
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(TimeZoneNames, fillZoneStrings, "(Ljava/lang/String;[[Ljava/lang/String;)V"),
};
void register_libcore_icu_TimeZoneNames(JNIEnv* env) {
diff --git a/luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp b/luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp
index 55803b8d8d..5b2627140b 100644
--- a/luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp
+++ b/luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp
@@ -26,7 +26,7 @@ static void AsynchronousCloseMonitor_signalBlockedThreads(JNIEnv* env, jclass, j
AsynchronousCloseMonitor::signalBlockedThreads(fd);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(AsynchronousCloseMonitor, signalBlockedThreads, "(Ljava/io/FileDescriptor;)V"),
};
void register_libcore_io_AsynchronousCloseMonitor(JNIEnv* env) {
diff --git a/luni/src/main/native/libcore_io_Linux.cpp b/luni/src/main/native/libcore_io_Linux.cpp
index 9e44e63fe4..8fb6b56ac8 100644
--- a/luni/src/main/native/libcore_io_Linux.cpp
+++ b/luni/src/main/native/libcore_io_Linux.cpp
@@ -2566,7 +2566,7 @@ static jint Linux_writev(JNIEnv* env, jobject, jobject javaFd, jobjectArray buff
#define NATIVE_METHOD_OVERLOAD(className, functionName, signature, variant) \
{ #functionName, signature, reinterpret_cast<void*>(className ## _ ## functionName ## variant) }
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Linux, accept, "(Ljava/io/FileDescriptor;Ljava/net/SocketAddress;)Ljava/io/FileDescriptor;"),
NATIVE_METHOD(Linux, access, "(Ljava/lang/String;I)Z"),
NATIVE_METHOD(Linux, android_fdsan_exchange_owner_tag, "(Ljava/io/FileDescriptor;JJ)V"),
diff --git a/luni/src/main/native/libcore_io_Memory.cpp b/luni/src/main/native/libcore_io_Memory.cpp
index a5b7b72a98..8400c5462d 100644
--- a/luni/src/main/native/libcore_io_Memory.cpp
+++ b/luni/src/main/native/libcore_io_Memory.cpp
@@ -289,7 +289,7 @@ static void Memory_unsafeBulkPut(JNIEnv* env, jclass, jbyteArray dstArray, jint
env->ReleasePrimitiveArrayCritical(srcArray, srcBytes, 0);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Memory, memmove, "(Ljava/lang/Object;ILjava/lang/Object;IJ)V"),
FAST_NATIVE_METHOD(Memory, peekByte, "(J)B"),
NATIVE_METHOD(Memory, peekByteArray, "(J[BII)V"),
diff --git a/luni/src/main/native/libcore_util_NativeAllocationRegistry.cpp b/luni/src/main/native/libcore_util_NativeAllocationRegistry.cpp
index ded578a958..faaa5c7a7c 100644
--- a/luni/src/main/native/libcore_util_NativeAllocationRegistry.cpp
+++ b/luni/src/main/native/libcore_util_NativeAllocationRegistry.cpp
@@ -29,7 +29,7 @@ static void NativeAllocationRegistry_applyFreeFunction(JNIEnv*,
nativeFreeFunction(nativePtr);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeAllocationRegistry, applyFreeFunction, "(JJ)V"),
};
diff --git a/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp b/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
index 6df5bddf3b..68e19613b6 100644
--- a/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
+++ b/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
@@ -1365,7 +1365,7 @@ static void ExpatParser_staticInitialize(JNIEnv* env, jobject classObject, jstri
emptyString = reinterpret_cast<jstring>(env->NewGlobalRef(empty));
}
-static JNINativeMethod parserMethods[] = {
+static const JNINativeMethod parserMethods[] = {
NATIVE_METHOD(ExpatParser, appendString, "(JLjava/lang/String;Z)V"),
NATIVE_METHOD(ExpatParser, appendBytes, "(J[BII)V"),
NATIVE_METHOD(ExpatParser, appendChars, "(J[CII)V"),
@@ -1379,7 +1379,7 @@ static JNINativeMethod parserMethods[] = {
NATIVE_METHOD(ExpatParser, staticInitialize, "(Ljava/lang/String;)V"),
};
-static JNINativeMethod attributeMethods[] = {
+static const JNINativeMethod attributeMethods[] = {
NATIVE_METHOD(ExpatAttributes, freeAttributes, "(J)V"),
NATIVE_METHOD(ExpatAttributes, getIndexForQName, "(JLjava/lang/String;)I"),
NATIVE_METHOD(ExpatAttributes, getIndex, "(JLjava/lang/String;Ljava/lang/String;)I"),
diff --git a/luni/src/main/native/sun_misc_Unsafe.cpp b/luni/src/main/native/sun_misc_Unsafe.cpp
index 49848a2db2..87b2feac80 100644
--- a/luni/src/main/native/sun_misc_Unsafe.cpp
+++ b/luni/src/main/native/sun_misc_Unsafe.cpp
@@ -23,7 +23,7 @@ static jobject Unsafe_allocateInstance(JNIEnv* env, jclass, jclass c) {
return env->AllocObject(c);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Unsafe, allocateInstance, "(Ljava/lang/Class;)Ljava/lang/Object;"),
};
void register_sun_misc_Unsafe(JNIEnv* env) {
diff --git a/ojluni/src/main/native/Adler32.c b/ojluni/src/main/native/Adler32.c
index 11ef08d4c9..849df61067 100644
--- a/ojluni/src/main/native/Adler32.c
+++ b/ojluni/src/main/native/Adler32.c
@@ -70,7 +70,7 @@ Java_java_util_zip_Adler32_updateByteBuffer(JNIEnv *env, jclass cls, jint adler,
return adler;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Adler32, update, "(II)I"),
NATIVE_METHOD(Adler32, updateBytes, "(I[BII)I"),
NATIVE_METHOD(Adler32, updateByteBuffer, "(IJII)I"),
diff --git a/ojluni/src/main/native/CRC32.c b/ojluni/src/main/native/CRC32.c
index cec99de0eb..cb17feec59 100644
--- a/ojluni/src/main/native/CRC32.c
+++ b/ojluni/src/main/native/CRC32.c
@@ -74,7 +74,7 @@ CRC32_updateByteBuffer(JNIEnv *env, jclass cls, jint crc,
return crc;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(CRC32, update, "(II)I"),
NATIVE_METHOD(CRC32, updateBytes, "(I[BII)I"),
NATIVE_METHOD(CRC32, updateByteBuffer, "(IJII)I"),
diff --git a/ojluni/src/main/native/Character.cpp b/ojluni/src/main/native/Character.cpp
index 9fb24c372c..a12ae6bd17 100644
--- a/ojluni/src/main/native/Character.cpp
+++ b/ojluni/src/main/native/Character.cpp
@@ -159,7 +159,7 @@ Character_getNameImpl(JNIEnv* env, jclass, jint codePoint) {
return (U_FAILURE(status) || byteCount == 0) ? NULL : env->NewStringUTF(buf);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Character, digitImpl, "(II)I"),
FAST_NATIVE_METHOD(Character, getDirectionalityImpl, "(I)B"),
NATIVE_METHOD(Character, getNameImpl, "(I)Ljava/lang/String;"),
diff --git a/ojluni/src/main/native/Console_md.c b/ojluni/src/main/native/Console_md.c
index 13437be314..f87bd168b1 100644
--- a/ojluni/src/main/native/Console_md.c
+++ b/ojluni/src/main/native/Console_md.c
@@ -72,7 +72,7 @@ Java_java_io_Console_echo(JNIEnv *env,
return old;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Console, istty, "()Z"),
NATIVE_METHOD(Console, encoding, "()Ljava/lang/String;"),
NATIVE_METHOD(Console, echo, "(Z)Z"),
diff --git a/ojluni/src/main/native/DatagramChannelImpl.c b/ojluni/src/main/native/DatagramChannelImpl.c
index 11d149ddcf..8a8444c8a2 100644
--- a/ojluni/src/main/native/DatagramChannelImpl.c
+++ b/ojluni/src/main/native/DatagramChannelImpl.c
@@ -276,7 +276,7 @@ Java_sun_nio_ch_DatagramChannelImpl_send0(JNIEnv *env, jobject this,
return n;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(DatagramChannelImpl, initIDs, "()V"),
NATIVE_METHOD(DatagramChannelImpl, disconnect0, "(Ljava/io/FileDescriptor;Z)V"),
NATIVE_METHOD(DatagramChannelImpl, receive0, "(Ljava/io/FileDescriptor;JIZ)I"),
diff --git a/ojluni/src/main/native/DatagramDispatcher.c b/ojluni/src/main/native/DatagramDispatcher.c
index 36cc6cf4bc..39ff924179 100644
--- a/ojluni/src/main/native/DatagramDispatcher.c
+++ b/ojluni/src/main/native/DatagramDispatcher.c
@@ -139,7 +139,7 @@ Java_sun_nio_ch_DatagramDispatcher_writev0(JNIEnv *env, jclass clazz,
return convertLongReturnVal(env, (jlong)result, JNI_FALSE);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(DatagramDispatcher, read0, "(Ljava/io/FileDescriptor;JI)I"),
NATIVE_METHOD(DatagramDispatcher, readv0, "(Ljava/io/FileDescriptor;JI)J"),
NATIVE_METHOD(DatagramDispatcher, write0, "(Ljava/io/FileDescriptor;JI)I"),
diff --git a/ojluni/src/main/native/Deflater.c b/ojluni/src/main/native/Deflater.c
index 9ee032619d..2230f8c951 100644
--- a/ojluni/src/main/native/Deflater.c
+++ b/ojluni/src/main/native/Deflater.c
@@ -240,7 +240,7 @@ Deflater_end(JNIEnv *env, jclass cls, jlong addr)
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Deflater, init, "(IIZ)J"),
NATIVE_METHOD(Deflater, setDictionary, "(J[BII)V"),
NATIVE_METHOD(Deflater, deflateBytes, "(J[BIII)I"),
diff --git a/ojluni/src/main/native/Double.c b/ojluni/src/main/native/Double.c
index 8382b88994..2bcb97a653 100644
--- a/ojluni/src/main/native/Double.c
+++ b/ojluni/src/main/native/Double.c
@@ -63,7 +63,7 @@ Double_doubleToRawLongBits(JNIEnv *env, jclass unused, jdouble v)
u.d = (double)v;
return u.l;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Double, longBitsToDouble, "(J)D"),
NATIVE_METHOD(Double, doubleToRawLongBits, "(D)J"),
};
diff --git a/ojluni/src/main/native/FileChannelImpl.c b/ojluni/src/main/native/FileChannelImpl.c
index 51339dff9c..6d5c075e83 100644
--- a/ojluni/src/main/native/FileChannelImpl.c
+++ b/ojluni/src/main/native/FileChannelImpl.c
@@ -284,7 +284,7 @@ FileChannelImpl_transferTo0(JNIEnv *env, jobject this,
#endif
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileChannelImpl, initIDs, "()J"),
NATIVE_METHOD(FileChannelImpl, map0, "(IJJ)J"),
NATIVE_METHOD(FileChannelImpl, unmap0, "(JJ)I"),
diff --git a/ojluni/src/main/native/FileDescriptor_md.c b/ojluni/src/main/native/FileDescriptor_md.c
index 0404263787..a00d799045 100644
--- a/ojluni/src/main/native/FileDescriptor_md.c
+++ b/ojluni/src/main/native/FileDescriptor_md.c
@@ -68,7 +68,7 @@ JNIEXPORT jboolean JNICALL FileDescriptor_isSocket(JNIEnv *env, jclass ignored,
return TEMP_FAILURE_RETRY(getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &error_length)) == 0;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileDescriptor, sync, "()V"),
NATIVE_METHOD(FileDescriptor, isSocket, "(I)Z"),
};
diff --git a/ojluni/src/main/native/FileDispatcherImpl.c b/ojluni/src/main/native/FileDispatcherImpl.c
index 3e8e4f3e0f..facede4cf1 100644
--- a/ojluni/src/main/native/FileDispatcherImpl.c
+++ b/ojluni/src/main/native/FileDispatcherImpl.c
@@ -287,7 +287,7 @@ FileDispatcherImpl_closeIntFD(JNIEnv *env, jclass clazz, jint fd)
closeFileDescriptor(env, fd);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileDispatcherImpl, closeIntFD, "(I)V"),
NATIVE_METHOD(FileDispatcherImpl, preClose0, "(Ljava/io/FileDescriptor;)V"),
NATIVE_METHOD(FileDispatcherImpl, close0, "(Ljava/io/FileDescriptor;)V"),
diff --git a/ojluni/src/main/native/FileInputStream.c b/ojluni/src/main/native/FileInputStream.c
index 650cb6c904..bd2f64e68f 100644
--- a/ojluni/src/main/native/FileInputStream.c
+++ b/ojluni/src/main/native/FileInputStream.c
@@ -145,7 +145,7 @@ FileInputStream_available0(JNIEnv *env, jobject this) {
return 0;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileInputStream, skip0, "(J)J"),
NATIVE_METHOD(FileInputStream, available0, "()I"),
};
diff --git a/ojluni/src/main/native/FileKey.c b/ojluni/src/main/native/FileKey.c
index c3b5d2a00f..61d3c2ae89 100644
--- a/ojluni/src/main/native/FileKey.c
+++ b/ojluni/src/main/native/FileKey.c
@@ -68,7 +68,7 @@ FileKey_init(JNIEnv *env, jobject this, jobject fdo)
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileKey, init, "(Ljava/io/FileDescriptor;)V"),
};
diff --git a/ojluni/src/main/native/FileSystemPreferences.c b/ojluni/src/main/native/FileSystemPreferences.c
index 9a73150428..d49de07b61 100644
--- a/ojluni/src/main/native/FileSystemPreferences.c
+++ b/ojluni/src/main/native/FileSystemPreferences.c
@@ -150,7 +150,7 @@ Java_java_util_prefs_FileSystemPreferences_unlockFile0(JNIEnv *env,
return 0;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(FileSystemPreferences, lockFile0, "(Ljava/lang/String;IZ)[I"),
NATIVE_METHOD(FileSystemPreferences, unlockFile0, "(I)I"),
NATIVE_METHOD(FileSystemPreferences, chmod, "(Ljava/lang/String;I)I"),
diff --git a/ojluni/src/main/native/Float.c b/ojluni/src/main/native/Float.c
index 956048d6b8..5bfdf58245 100644
--- a/ojluni/src/main/native/Float.c
+++ b/ojluni/src/main/native/Float.c
@@ -59,7 +59,7 @@ Float_floatToRawIntBits(JNIEnv *env, jclass unused, jfloat v)
u.f = (float)v;
return (jint)u.i;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Float, intBitsToFloat, "(I)F"),
NATIVE_METHOD(Float, floatToRawIntBits, "(F)I"),
};
diff --git a/ojluni/src/main/native/IOUtil.c b/ojluni/src/main/native/IOUtil.c
index 05949dab16..2ccb8795e4 100644
--- a/ojluni/src/main/native/IOUtil.c
+++ b/ojluni/src/main/native/IOUtil.c
@@ -206,7 +206,7 @@ fdval(JNIEnv *env, jobject fdo)
return (*env)->GetIntField(env, fdo, fd_fdID);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(IOUtil, iovMax, "()I"),
NATIVE_METHOD(IOUtil, fdLimit, "()I"),
NATIVE_METHOD(IOUtil, drain, "(I)Z"),
diff --git a/ojluni/src/main/native/Inflater.c b/ojluni/src/main/native/Inflater.c
index c4c24f0fed..23b107426d 100644
--- a/ojluni/src/main/native/Inflater.c
+++ b/ojluni/src/main/native/Inflater.c
@@ -201,7 +201,7 @@ Inflater_end(JNIEnv *env, jclass cls, jlong addr)
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Inflater, init, "(Z)J"),
NATIVE_METHOD(Inflater, setDictionary, "(J[BII)V"),
NATIVE_METHOD(Inflater, inflateBytes, "(J[BII)I"),
diff --git a/ojluni/src/main/native/MappedByteBuffer.c b/ojluni/src/main/native/MappedByteBuffer.c
index 72e840a5c1..24bf6973c3 100644
--- a/ojluni/src/main/native/MappedByteBuffer.c
+++ b/ojluni/src/main/native/MappedByteBuffer.c
@@ -104,7 +104,7 @@ Java_java_nio_MappedByteBuffer_force0(JNIEnv *env, jobject obj, jobject fdo,
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(MappedByteBuffer, isLoaded0, "(JJI)Z"),
NATIVE_METHOD(MappedByteBuffer, load0, "(JJ)V"),
NATIVE_METHOD(MappedByteBuffer, force0, "(Ljava/io/FileDescriptor;JJ)V"),
diff --git a/ojluni/src/main/native/Math.c b/ojluni/src/main/native/Math.c
index 4bbcd1d0f1..f3423328d0 100644
--- a/ojluni/src/main/native/Math.c
+++ b/ojluni/src/main/native/Math.c
@@ -141,7 +141,7 @@ Math_rint(jdouble d) {
return rint(d);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Math, IEEEremainder, "(DD)D"),
FAST_NATIVE_METHOD(Math, acos, "(D)D"),
FAST_NATIVE_METHOD(Math, asin, "(D)D"),
diff --git a/ojluni/src/main/native/NativeThread.c b/ojluni/src/main/native/NativeThread.c
index dc21e5dbc9..312b160a99 100644
--- a/ojluni/src/main/native/NativeThread.c
+++ b/ojluni/src/main/native/NativeThread.c
@@ -108,7 +108,7 @@ NativeThread_signal(JNIEnv *env, jclass cl, jlong thread)
JNU_ThrowIOExceptionWithLastError(env, "Thread signal failed");
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(NativeThread, current, "()J"),
NATIVE_METHOD(NativeThread, signal, "(J)V"),
};
diff --git a/ojluni/src/main/native/Net.c b/ojluni/src/main/native/Net.c
index bcf984e957..9b43e521b7 100644
--- a/ojluni/src/main/native/Net.c
+++ b/ojluni/src/main/native/Net.c
@@ -868,7 +868,7 @@ handleSocketError(JNIEnv *env, jint errorValue) {
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Net, isIPv6Available0, "()Z"),
NATIVE_METHOD(Net, isExclusiveBindAvailable, "()I"),
NATIVE_METHOD(Net, canIPv6SocketJoinIPv4Group0, "()Z"),
diff --git a/ojluni/src/main/native/ObjectInputStream.c b/ojluni/src/main/native/ObjectInputStream.c
index 6f65dca5a5..6ba47e31dc 100644
--- a/ojluni/src/main/native/ObjectInputStream.c
+++ b/ojluni/src/main/native/ObjectInputStream.c
@@ -175,7 +175,7 @@ Java_java_io_ObjectInputStream_bytesToDoubles(JNIEnv *env,
(*env)->ReleasePrimitiveArrayCritical(env, dst, doubles, 0);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ObjectInputStream, bytesToFloats, "([BI[FII)V"),
NATIVE_METHOD(ObjectInputStream, bytesToDoubles, "([BI[DII)V"),
};
diff --git a/ojluni/src/main/native/ObjectOutputStream.c b/ojluni/src/main/native/ObjectOutputStream.c
index 169a83f3f8..0e1479d6df 100644
--- a/ojluni/src/main/native/ObjectOutputStream.c
+++ b/ojluni/src/main/native/ObjectOutputStream.c
@@ -184,7 +184,7 @@ Java_java_io_ObjectOutputStream_doublesToBytes(JNIEnv *env,
(*env)->ReleasePrimitiveArrayCritical(env, dst, bytes, 0);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ObjectOutputStream, floatsToBytes, "([FI[BII)V"),
NATIVE_METHOD(ObjectOutputStream, doublesToBytes, "([DI[BII)V"),
};
diff --git a/ojluni/src/main/native/ObjectStreamClass.c b/ojluni/src/main/native/ObjectStreamClass.c
index 3d3fdefa33..84cfcc43d3 100644
--- a/ojluni/src/main/native/ObjectStreamClass.c
+++ b/ojluni/src/main/native/ObjectStreamClass.c
@@ -110,7 +110,7 @@ ObjectStreamClass_hasStaticInitializer(JNIEnv *env, jclass this,
return (clinitId != superClinitId);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ObjectStreamClass, hasStaticInitializer, "(Ljava/lang/Class;Z)Z"),
};
diff --git a/ojluni/src/main/native/ProcessEnvironment_md.c b/ojluni/src/main/native/ProcessEnvironment_md.c
index a59410badc..a3f46a4d4f 100644
--- a/ojluni/src/main/native/ProcessEnvironment_md.c
+++ b/ojluni/src/main/native/ProcessEnvironment_md.c
@@ -91,7 +91,7 @@ ProcessEnvironment_environ(JNIEnv *env, jclass ign)
return result;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ProcessEnvironment, environ, "()[[B"),
};
diff --git a/ojluni/src/main/native/Runtime.c b/ojluni/src/main/native/Runtime.c
index 749511eb08..5e8a2916f6 100644
--- a/ojluni/src/main/native/Runtime.c
+++ b/ojluni/src/main/native/Runtime.c
@@ -80,7 +80,7 @@ Runtime_nativeLoad(JNIEnv* env, jclass ignored, jstring javaFilename,
return JVM_NativeLoad(env, javaFilename, javaLoader, caller);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
FAST_NATIVE_METHOD(Runtime, freeMemory, "()J"),
FAST_NATIVE_METHOD(Runtime, totalMemory, "()J"),
FAST_NATIVE_METHOD(Runtime, maxMemory, "()J"),
diff --git a/ojluni/src/main/native/ServerSocketChannelImpl.c b/ojluni/src/main/native/ServerSocketChannelImpl.c
index 679811f96a..83a94f9b8e 100644
--- a/ojluni/src/main/native/ServerSocketChannelImpl.c
+++ b/ojluni/src/main/native/ServerSocketChannelImpl.c
@@ -137,7 +137,7 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this,
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(Java_sun_nio_ch_ServerSocketChannelImpl, initIDs, "()V"),
NATIVE_METHOD(Java_sun_nio_ch_ServerSocketChannelImpl, accept0,
"(Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;[Ljava/net/InetSocketAddress;)I"),
diff --git a/ojluni/src/main/native/SocketChannelImpl.c b/ojluni/src/main/native/SocketChannelImpl.c
index 94291659cf..9e54369054 100644
--- a/ojluni/src/main/native/SocketChannelImpl.c
+++ b/ojluni/src/main/native/SocketChannelImpl.c
@@ -96,7 +96,7 @@ Java_sun_nio_ch_SocketChannelImpl_sendOutOfBandData(JNIEnv* env, jclass this,
return convertReturnVal(env, n, JNI_FALSE);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(SocketChannelImpl, checkConnect, "(Ljava/io/FileDescriptor;ZZ)I"),
NATIVE_METHOD(SocketChannelImpl, sendOutOfBandData, "(Ljava/io/FileDescriptor;B)I"),
};
diff --git a/ojluni/src/main/native/SocketInputStream.c b/ojluni/src/main/native/SocketInputStream.c
index dcea334fd1..aa10f4e9c1 100644
--- a/ojluni/src/main/native/SocketInputStream.c
+++ b/ojluni/src/main/native/SocketInputStream.c
@@ -153,7 +153,7 @@ SocketInputStream_socketRead0(JNIEnv *env, jobject this,
return nread;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(SocketInputStream, socketRead0, "(Ljava/io/FileDescriptor;[BIII)I"),
};
diff --git a/ojluni/src/main/native/SocketOutputStream.c b/ojluni/src/main/native/SocketOutputStream.c
index bc3522bee3..d72fd1108b 100644
--- a/ojluni/src/main/native/SocketOutputStream.c
+++ b/ojluni/src/main/native/SocketOutputStream.c
@@ -128,7 +128,7 @@ SocketOutputStream_socketWrite0(JNIEnv *env, jobject this,
}
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(SocketOutputStream, socketWrite0, "(Ljava/io/FileDescriptor;[BII)V"),
};
diff --git a/ojluni/src/main/native/StrictMath.c b/ojluni/src/main/native/StrictMath.c
index 7f9bbebcdf..24b29228a4 100644
--- a/ojluni/src/main/native/StrictMath.c
+++ b/ojluni/src/main/native/StrictMath.c
@@ -156,7 +156,7 @@ StrictMath_expm1(JNIEnv *env, jclass unused, jdouble d)
return (jdouble) ieee_expm1((double)d);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(StrictMath, cos, "(D)D"),
NATIVE_METHOD(StrictMath, sin, "(D)D"),
NATIVE_METHOD(StrictMath, tan, "(D)D"),
diff --git a/ojluni/src/main/native/System.c b/ojluni/src/main/native/System.c
index 39332ce5ed..582e06d1e0 100644
--- a/ojluni/src/main/native/System.c
+++ b/ojluni/src/main/native/System.c
@@ -261,7 +261,7 @@ static jlong System_currentTimeMillis() {
return JVM_CurrentTimeMillis(NULL, NULL);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(System, mapLibraryName, "(Ljava/lang/String;)Ljava/lang/String;"),
NATIVE_METHOD(System, setErr0, "(Ljava/io/PrintStream;)V"),
NATIVE_METHOD(System, setOut0, "(Ljava/io/PrintStream;)V"),
diff --git a/ojluni/src/main/native/UNIXProcess_md.c b/ojluni/src/main/native/UNIXProcess_md.c
index 40fdc18fb8..87ceaac4fe 100644
--- a/ojluni/src/main/native/UNIXProcess_md.c
+++ b/ojluni/src/main/native/UNIXProcess_md.c
@@ -991,7 +991,7 @@ UNIXProcess_destroyProcess(JNIEnv *env, jobject junk, jint pid)
kill(pid, SIGTERM);
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(UNIXProcess, destroyProcess, "(I)V"),
NATIVE_METHOD(UNIXProcess, forkAndExec, "([B[BI[BI[B[IZ)I"),
NATIVE_METHOD(UNIXProcess, waitForProcessExit, "(I)I"),
diff --git a/ojluni/src/main/native/UnixFileSystem_md.c b/ojluni/src/main/native/UnixFileSystem_md.c
index 9c1ca05052..bc7ee22d57 100644
--- a/ojluni/src/main/native/UnixFileSystem_md.c
+++ b/ojluni/src/main/native/UnixFileSystem_md.c
@@ -497,7 +497,7 @@ Java_java_io_UnixFileSystem_getSpace0(JNIEnv *env, jobject this,
return rv;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(UnixFileSystem, initIDs, "()V"),
NATIVE_METHOD(UnixFileSystem, canonicalize0, "(Ljava/lang/String;)Ljava/lang/String;"),
NATIVE_METHOD(UnixFileSystem, getBooleanAttributes0, "(Ljava/lang/String;)I"),
diff --git a/ojluni/src/main/native/ZipFile.c b/ojluni/src/main/native/ZipFile.c
index daf5d8efff..78b26fdfa5 100644
--- a/ojluni/src/main/native/ZipFile.c
+++ b/ojluni/src/main/native/ZipFile.c
@@ -393,7 +393,7 @@ JarFile_getMetaInfEntryNames(JNIEnv *env, jobject obj)
return result;
}
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
NATIVE_METHOD(ZipFile, getFileDescriptor, "(J)I"),
NATIVE_METHOD(ZipFile, getEntry, "(J[BZ)J"),
NATIVE_METHOD(ZipFile, freeEntry, "(JJ)V"),
@@ -414,7 +414,7 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(ZipFile, getZipMessage, "(J)Ljava/lang/String;"),
};
-static JNINativeMethod gJarFileMethods[] = {
+static const JNINativeMethod gJarFileMethods[] = {
NATIVE_METHOD(JarFile, getMetaInfEntryNames, "()[Ljava/lang/String;"),
};

View File

@ -0,0 +1,231 @@
From d8a62b5156007c507e6de4ced1e0db8c271504ee Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Wed, 9 Sep 2020 01:00:19 -0400
Subject: [PATCH] constify JNINativeMethod tables
---
jni/com_android_bluetooth_a2dp.cpp | 2 +-
jni/com_android_bluetooth_a2dp_sink.cpp | 2 +-
jni/com_android_bluetooth_avrcp_controller.cpp | 2 +-
jni/com_android_bluetooth_avrcp_target.cpp | 2 +-
jni/com_android_bluetooth_btservice_AdapterService.cpp | 2 +-
jni/com_android_bluetooth_btservice_BluetoothKeystore.cpp | 2 +-
jni/com_android_bluetooth_gatt.cpp | 8 ++++----
jni/com_android_bluetooth_hearing_aid.cpp | 2 +-
jni/com_android_bluetooth_hfp.cpp | 2 +-
jni/com_android_bluetooth_hfpclient.cpp | 2 +-
jni/com_android_bluetooth_hid_device.cpp | 2 +-
jni/com_android_bluetooth_hid_host.cpp | 2 +-
jni/com_android_bluetooth_pan.cpp | 2 +-
jni/com_android_bluetooth_sdp.cpp | 2 +-
14 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/jni/com_android_bluetooth_a2dp.cpp b/jni/com_android_bluetooth_a2dp.cpp
index a94990437..1f0560860 100644
--- a/jni/com_android_bluetooth_a2dp.cpp
+++ b/jni/com_android_bluetooth_a2dp.cpp
@@ -505,7 +505,7 @@ static jboolean setCodecConfigPreferenceNative(JNIEnv* env, jobject object,
return (status == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative",
"(I[Landroid/bluetooth/BluetoothCodecConfig;[Landroid/bluetooth/BluetoothCodecConfig;)V",
diff --git a/jni/com_android_bluetooth_a2dp_sink.cpp b/jni/com_android_bluetooth_a2dp_sink.cpp
index 87668ff1f..8a2332ba5 100644
--- a/jni/com_android_bluetooth_a2dp_sink.cpp
+++ b/jni/com_android_bluetooth_a2dp_sink.cpp
@@ -241,7 +241,7 @@ static jboolean setActiveDeviceNative(JNIEnv* env, jobject object,
return (status == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "()V", (void*)initNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_avrcp_controller.cpp b/jni/com_android_bluetooth_avrcp_controller.cpp
index 86bf06879..642f73ea3 100755
--- a/jni/com_android_bluetooth_avrcp_controller.cpp
+++ b/jni/com_android_bluetooth_avrcp_controller.cpp
@@ -1284,7 +1284,7 @@ static void playItemNative(JNIEnv* env, jobject object, jbyteArray address,
env->ReleaseByteArrayElements(address, addr, 0);
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "()V", (void*)initNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_avrcp_target.cpp b/jni/com_android_bluetooth_avrcp_target.cpp
index 22c954c63..d566efcbc 100644
--- a/jni/com_android_bluetooth_avrcp_target.cpp
+++ b/jni/com_android_bluetooth_avrcp_target.cpp
@@ -808,7 +808,7 @@ static void setVolume(int8_t volume) {
sCallbackEnv->CallVoidMethod(mJavaInterface, method_setVolume, volume);
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "()V", (void*)initNative},
{"sendMediaUpdateNative", "(ZZZ)V", (void*)sendMediaUpdateNative},
diff --git a/jni/com_android_bluetooth_btservice_AdapterService.cpp b/jni/com_android_bluetooth_btservice_AdapterService.cpp
index 3e4d27289..6c7c51457 100644
--- a/jni/com_android_bluetooth_btservice_AdapterService.cpp
+++ b/jni/com_android_bluetooth_btservice_AdapterService.cpp
@@ -1308,7 +1308,7 @@ static int getMetricIdNative(JNIEnv* env, jobject obj, jbyteArray address) {
return sBluetoothInterface->get_metric_id(addr_obj);
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
/* name, signature, funcPtr */
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "(ZZIZ)Z", (void*)initNative},
diff --git a/jni/com_android_bluetooth_btservice_BluetoothKeystore.cpp b/jni/com_android_bluetooth_btservice_BluetoothKeystore.cpp
index bceea1d73..6b8a317bc 100644
--- a/jni/com_android_bluetooth_btservice_BluetoothKeystore.cpp
+++ b/jni/com_android_bluetooth_btservice_BluetoothKeystore.cpp
@@ -155,7 +155,7 @@ static void cleanupNative(JNIEnv* env, jobject object) {
}
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "()V", (void*)initNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_gatt.cpp b/jni/com_android_bluetooth_gatt.cpp
index 64db277f0..0aa06af5e 100644
--- a/jni/com_android_bluetooth_gatt.cpp
+++ b/jni/com_android_bluetooth_gatt.cpp
@@ -2064,7 +2064,7 @@ static void gattTestNative(JNIEnv* env, jobject object, jint command,
*/
// JNI functions defined in AdvertiseManager class.
-static JNINativeMethod sAdvertiseMethods[] = {
+static const JNINativeMethod sAdvertiseMethods[] = {
{"classInitNative", "()V", (void*)advertiseClassInitNative},
{"initializeNative", "()V", (void*)advertiseInitializeNative},
{"cleanupNative", "()V", (void*)advertiseCleanupNative},
@@ -2091,7 +2091,7 @@ static JNINativeMethod sAdvertiseMethods[] = {
};
// JNI functions defined in PeriodicScanManager class.
-static JNINativeMethod sPeriodicScanMethods[] = {
+static const JNINativeMethod sPeriodicScanMethods[] = {
{"classInitNative", "()V", (void*)periodicScanClassInitNative},
{"initializeNative", "()V", (void*)periodicScanInitializeNative},
{"cleanupNative", "()V", (void*)periodicScanCleanupNative},
@@ -2100,7 +2100,7 @@ static JNINativeMethod sPeriodicScanMethods[] = {
};
// JNI functions defined in ScanManager class.
-static JNINativeMethod sScanMethods[] = {
+static const JNINativeMethod sScanMethods[] = {
{"registerScannerNative", "(JJ)V", (void*)registerScannerNative},
{"unregisterScannerNative", "(I)V", (void*)unregisterScannerNative},
{"gattClientScanNative", "(Z)V", (void*)gattClientScanNative},
@@ -2133,7 +2133,7 @@ static JNINativeMethod sScanMethods[] = {
};
// JNI functions defined in GattService class.
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initializeNative", "()V", (void*)initializeNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_hearing_aid.cpp b/jni/com_android_bluetooth_hearing_aid.cpp
index b459ae227..6860ab719 100644
--- a/jni/com_android_bluetooth_hearing_aid.cpp
+++ b/jni/com_android_bluetooth_hearing_aid.cpp
@@ -218,7 +218,7 @@ static void setVolumeNative(JNIEnv* env, jclass clazz, jint volume) {
sHearingAidInterface->SetVolume(volume);
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "()V", (void*)initNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_hfp.cpp b/jni/com_android_bluetooth_hfp.cpp
index 9918c870f..aee327c14 100644
--- a/jni/com_android_bluetooth_hfp.cpp
+++ b/jni/com_android_bluetooth_hfp.cpp
@@ -916,7 +916,7 @@ static jboolean setActiveDeviceNative(JNIEnv* env, jobject object,
return (status == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initializeNative", "(IZ)V", (void*)initializeNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_hfpclient.cpp b/jni/com_android_bluetooth_hfpclient.cpp
index 83c6b20f3..5534b00ff 100644
--- a/jni/com_android_bluetooth_hfpclient.cpp
+++ b/jni/com_android_bluetooth_hfpclient.cpp
@@ -836,7 +836,7 @@ static jboolean sendATCmdNative(JNIEnv* env, jobject object, jbyteArray address,
return (status == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initializeNative", "()V", (void*)initializeNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_hid_device.cpp b/jni/com_android_bluetooth_hid_device.cpp
index 17b6e97c0..c3a00d5d2 100644
--- a/jni/com_android_bluetooth_hid_device.cpp
+++ b/jni/com_android_bluetooth_hid_device.cpp
@@ -497,7 +497,7 @@ static jboolean disconnectNative(JNIEnv* env, jobject thiz) {
return result;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initNative", "()V", (void*)initNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_hid_host.cpp b/jni/com_android_bluetooth_hid_host.cpp
index cab5e3361..cc242e811 100644
--- a/jni/com_android_bluetooth_hid_host.cpp
+++ b/jni/com_android_bluetooth_hid_host.cpp
@@ -506,7 +506,7 @@ static jboolean setIdleTimeNative(JNIEnv* env, jobject object,
return status == BT_STATUS_SUCCESS ? JNI_TRUE : JNI_FALSE;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initializeNative", "()V", (void*)initializeNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_pan.cpp b/jni/com_android_bluetooth_pan.cpp
index d423eab64..06b8a0d4a 100644
--- a/jni/com_android_bluetooth_pan.cpp
+++ b/jni/com_android_bluetooth_pan.cpp
@@ -230,7 +230,7 @@ static jboolean disconnectPanNative(JNIEnv* env, jobject object,
return ret;
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
{"classInitNative", "()V", (void*)classInitNative},
{"initializeNative", "()V", (void*)initializeNative},
{"cleanupNative", "()V", (void*)cleanupNative},
diff --git a/jni/com_android_bluetooth_sdp.cpp b/jni/com_android_bluetooth_sdp.cpp
index 90e3fc1e6..d829541a3 100644
--- a/jni/com_android_bluetooth_sdp.cpp
+++ b/jni/com_android_bluetooth_sdp.cpp
@@ -494,7 +494,7 @@ static void cleanupNative(JNIEnv* env, jobject object) {
}
}
-static JNINativeMethod sMethods[] = {
+static const JNINativeMethod sMethods[] = {
/* name, signature, funcPtr */
{"classInitNative", "()V", (void*)classInitNative},
{"initializeNative", "()V", (void*)initializeNative},

View File

@ -0,0 +1,92 @@
From e41f1d7f8eee4f6af7ad1f9c0b6cbf1aef94f3cd Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Sun, 17 Mar 2019 20:58:37 -0400
Subject: [PATCH] constify JNINativeMethod tables
---
nci/jni/NativeLlcpConnectionlessSocket.cpp | 2 +-
nci/jni/NativeLlcpServiceSocket.cpp | 2 +-
nci/jni/NativeLlcpSocket.cpp | 2 +-
nci/jni/NativeNfcManager.cpp | 2 +-
nci/jni/NativeNfcTag.cpp | 2 +-
nci/jni/NativeP2pDevice.cpp | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/nci/jni/NativeLlcpConnectionlessSocket.cpp b/nci/jni/NativeLlcpConnectionlessSocket.cpp
index e43dbff3..78e33285 100644
--- a/nci/jni/NativeLlcpConnectionlessSocket.cpp
+++ b/nci/jni/NativeLlcpConnectionlessSocket.cpp
@@ -280,7 +280,7 @@ static jboolean nativeLlcpConnectionlessSocket_doClose(JNIEnv* e, jobject o) {
** Description: JNI functions
**
*****************************************************************************/
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{"doSendTo", "(I[B)Z", (void*)nativeLlcpConnectionlessSocket_doSendTo},
{"doReceiveFrom", "(I)Lcom/android/nfc/LlcpPacket;",
(void*)nativeLlcpConnectionlessSocket_doReceiveFrom},
diff --git a/nci/jni/NativeLlcpServiceSocket.cpp b/nci/jni/NativeLlcpServiceSocket.cpp
index 76ffeea5..4d2297c4 100644
--- a/nci/jni/NativeLlcpServiceSocket.cpp
+++ b/nci/jni/NativeLlcpServiceSocket.cpp
@@ -128,7 +128,7 @@ static jboolean nativeLlcpServiceSocket_doClose(JNIEnv* e, jobject o) {
** Description: JNI functions
**
*****************************************************************************/
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{"doAccept", "(III)Lcom/android/nfc/dhimpl/NativeLlcpSocket;",
(void*)nativeLlcpServiceSocket_doAccept},
{"doClose", "()Z", (void*)nativeLlcpServiceSocket_doClose},
diff --git a/nci/jni/NativeLlcpSocket.cpp b/nci/jni/NativeLlcpSocket.cpp
index 0ee0d248..fa49ec94 100644
--- a/nci/jni/NativeLlcpSocket.cpp
+++ b/nci/jni/NativeLlcpSocket.cpp
@@ -214,7 +214,7 @@ static jint nativeLlcpSocket_doGetRemoteSocketRW(JNIEnv* e, jobject o) {
** Description: JNI functions
**
*****************************************************************************/
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{"doConnect", "(I)Z", (void*)nativeLlcpSocket_doConnect},
{"doConnectBy", "(Ljava/lang/String;)Z",
(void*)nativeLlcpSocket_doConnectBy},
diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp
index 5048262c..7d8d90a9 100644
--- a/nci/jni/NativeNfcManager.cpp
+++ b/nci/jni/NativeNfcManager.cpp
@@ -2001,7 +2001,7 @@ static jstring nfcManager_doGetNfaStorageDir(JNIEnv* e, jobject o) {
** JNI functions for android-4.0.1_r1
**
*****************************************************************************/
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{"doDownload", "()Z", (void*)nfcManager_doDownload},
{"initializeNativeStructure", "()Z", (void*)nfcManager_initNativeStruc},
diff --git a/nci/jni/NativeNfcTag.cpp b/nci/jni/NativeNfcTag.cpp
index ddae94e9..c51dc138 100644
--- a/nci/jni/NativeNfcTag.cpp
+++ b/nci/jni/NativeNfcTag.cpp
@@ -1850,7 +1850,7 @@ void nativeNfcTag_releaseRfInterfaceMutexLock() {
** JNI functions for Android 4.0.3
**
*****************************************************************************/
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{"doConnect", "(I)I", (void*)nativeNfcTag_doConnect},
{"doDisconnect", "()Z", (void*)nativeNfcTag_doDisconnect},
{"doReconnect", "()I", (void*)nativeNfcTag_doReconnect},
diff --git a/nci/jni/NativeP2pDevice.cpp b/nci/jni/NativeP2pDevice.cpp
index 23f5db41..396c6d0c 100644
--- a/nci/jni/NativeP2pDevice.cpp
+++ b/nci/jni/NativeP2pDevice.cpp
@@ -58,7 +58,7 @@ static jboolean nativeP2pDeviceDoSend(JNIEnv*, jobject, jbyteArray) {
** Description: JNI functions
**
*****************************************************************************/
-static JNINativeMethod gMethods[] = {
+static const JNINativeMethod gMethods[] = {
{"doConnect", "()Z", (void*)nativeP2pDeviceDoConnect},
{"doDisconnect", "()Z", (void*)nativeP2pDeviceDoDisconnect},
{"doTransceive", "([B)[B", (void*)nativeP2pDeviceDoTransceive},

View File

@ -55,6 +55,10 @@ gpgVerifyDirectory "$DOS_PREBUILT_APPS""android_vendor_FDroid_PrebuiltApps/packa
cp -r "$DOS_PREBUILT_APPS""android_vendor_FDroid_PrebuiltApps/." "$DOS_BUILD_BASE""vendor/fdroid_prebuilt/"; #Add the prebuilt apps
cp -r "$DOS_PATCHES_COMMON""android_vendor_divested/." "$DOS_BUILD_BASE""vendor/divested/"; #Add our vendor files
if enterAndClear "art"; then
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_art/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
fi;
if enterAndClear "bionic"; then
if [ "$DOS_GRAPHENE_MALLOC" = true ]; then applyPatch "$DOS_PATCHES/android_bionic/0001-HM-Use_HM.patch"; fi; #(GrapheneOS)
fi;
@ -94,6 +98,10 @@ if [ "$(type -t DOS_WEBVIEW_CHERRYPICK)" = "alias" ] ; then DOS_WEBVIEW_CHERRYPI
if [ "$DOS_WEBVIEW_LFS" = true ]; then git lfs pull; fi; #Ensure the objects are available
fi;
if enterAndClear "external/conscrypt"; then
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_external_conscrypt/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
fi;
if enterAndClear "external/svox"; then
git revert --no-edit 1419d63b4889a26d22443fd8df1f9073bf229d3d; #Add back Makefiles
sed -i '12iLOCAL_SDK_VERSION := current' pico/Android.mk; #Fix build under Pie
@ -122,6 +130,7 @@ applyPatch "$DOS_PATCHES/android_frameworks_base/0013-Network_Permission-1.patch
applyPatch "$DOS_PATCHES/android_frameworks_base/0013-Network_Permission-2.patch";
applyPatch "$DOS_PATCHES/android_frameworks_base/0013-Network_Permission-3.patch";
fi;
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0014-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0002-Signature_Spoofing.patch"; fi; #Allow packages to spoof their signature (microG)
if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0003-Harden_Sig_Spoofing.patch"; fi; #Restrict signature spoofing to system apps signed with the platform key
sed -i 's/DEFAULT_MAX_FILES = 1000;/DEFAULT_MAX_FILES = 0;/' services/core/java/com/android/server/DropBoxManagerService.java; #Disable DropBox internal logging service
@ -147,6 +156,10 @@ applyPatch "$DOS_PATCHES/android_frameworks_opt_net_ims/0001-Fix_Calling.patch";
fi;
fi;
if enterAndClear "frameworks/opt/net/wifi"; then
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_frameworks_opt_net_wifi/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
fi;
if enterAndClear "hardware/qcom/display"; then
applyPatch "$DOS_PATCHES_COMMON/android_hardware_qcom_display/CVE-2019-2306-msm8084.patch" --directory="msm8084";
applyPatch "$DOS_PATCHES_COMMON/android_hardware_qcom_display/CVE-2019-2306-msm8916.patch" --directory="msm8226";
@ -190,6 +203,7 @@ fi;
if enterAndClear "libcore"; then
if [ "$DOS_GRAPHENE_NETWORK_PERM" = true ]; then applyPatch "$DOS_PATCHES/android_libcore/0001-Network_Permission.patch"; fi; #Expose the NETWORK permission (GrapheneOS)
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_libcore/0002-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
fi;
if enterAndClear "lineage-sdk"; then
@ -197,6 +211,10 @@ awk -i inplace '!/LineageWeatherManagerService/' lineage/res/res/values/config.x
if [ "$DOS_DEBLOBBER_REMOVE_AUDIOFX" = true ]; then awk -i inplace '!/LineageAudioService/' lineage/res/res/values/config.xml; fi; #Remove AudioFX
fi;
if enterAndClear "packages/apps/Bluetooth"; then
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_packages_apps_Bluetooth/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
fi;
if enterAndClear "packages/apps/Contacts"; then
applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0001-No_Google_Links.patch"; #Remove Privacy Policy and Terms of Service links (GrapheneOS)
fi;
@ -210,6 +228,10 @@ rm -rf src/org/lineageos/lineageparts/lineagestats/ res/xml/anonymous_stats.xml
applyPatch "$DOS_PATCHES/android_packages_apps_LineageParts/0001-Remove_Analytics.patch"; #Remove analytics
fi;
if enterAndClear "packages/apps/Nfc"; then
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_packages_apps_Nfc/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
fi;
if enterAndClear "packages/apps/PackageInstaller"; then
if [ "$DOS_GRAPHENE_NETWORK_PERM" = true ]; then
applyPatch "$DOS_PATCHES/android_packages_apps_PackageInstaller/0001-Network_Permission-1.patch"; #Expose the NETWORK permission (GrapheneOS)

View File

@ -55,6 +55,10 @@ gpgVerifyDirectory "$DOS_PREBUILT_APPS""android_vendor_FDroid_PrebuiltApps/packa
cp -r "$DOS_PREBUILT_APPS""android_vendor_FDroid_PrebuiltApps/." "$DOS_BUILD_BASE""vendor/fdroid_prebuilt/"; #Add the prebuilt apps
cp -r "$DOS_PATCHES_COMMON""android_vendor_divested/." "$DOS_BUILD_BASE""vendor/divested/"; #Add our vendor files
if enterAndClear "art"; then
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_art/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
fi;
if enterAndClear "bootable/recovery"; then
applyPatch "$DOS_PATCHES/android_bootable_recovery/0001-No_SerialNum_Restrictions.patch"; #Abort package installs if they are specific to a serial number (GrapheneOS)
fi;
@ -89,6 +93,10 @@ if [ "$(type -t DOS_WEBVIEW_CHERRYPICK)" = "alias" ] ; then DOS_WEBVIEW_CHERRYPI
if [ "$DOS_WEBVIEW_LFS" = true ]; then git lfs pull; fi; #Ensure the objects are available
fi;
if enterAndClear "external/conscrypt"; then
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_external_conscrypt/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
fi;
if enterAndClear "external/svox"; then
git revert --no-edit 1419d63b4889a26d22443fd8df1f9073bf229d3d; #Add back Makefiles
sed -i '12iLOCAL_SDK_VERSION := current' pico/Android.mk; #Fix build under Pie
@ -121,6 +129,7 @@ applyPatch "$DOS_PATCHES/android_frameworks_base/0014-Network_Permission-5.patch
applyPatch "$DOS_PATCHES/android_frameworks_base/0014-Network_Permission-6.patch";
applyPatch "$DOS_PATCHES/android_frameworks_base/0014-Network_Permission-7.patch";
fi;
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0018-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
applyPatch "$DOS_PATCHES_COMMON/android_frameworks_base/0006-Do-not-throw-in-setAppOnInterfaceLocked.patch"; #Fix random reboots on broken kernels when an app has data restricted XXX: ugly
if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0002-Signature_Spoofing.patch"; fi; #Allow packages to spoof their signature (microG)
if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0003-Harden_Sig_Spoofing.patch"; fi; #Restrict signature spoofing to system apps signed with the platform key
@ -148,6 +157,10 @@ applyPatch "$DOS_PATCHES/android_frameworks_opt_net_ims/0001-Fix_Calling.patch";
fi;
fi;
if enterAndClear "frameworks/opt/net/wifi"; then
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_frameworks_opt_net_wifi/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
fi;
if enterAndClear "hardware/qcom/display"; then
applyPatch "$DOS_PATCHES_COMMON/android_hardware_qcom_display/CVE-2019-2306-msm8084.patch" --directory="msm8084";
applyPatch "$DOS_PATCHES_COMMON/android_hardware_qcom_display/CVE-2019-2306-msm8916.patch" --directory="msm8226";
@ -193,6 +206,7 @@ if enterAndClear "libcore"; then
if [ "$DOS_GRAPHENE_EXEC" = true ]; then applyPatch "$DOS_PATCHES/android_libcore/0001-Exec_Preload.patch"; fi; #Add exec-based spawning support (GrapheneOS)
if [ "$DOS_GRAPHENE_EXEC" = true ]; then applyPatch "$DOS_PATCHES/android_libcore/0002-Exec_Based_Spawning.patch"; fi;
if [ "$DOS_GRAPHENE_NETWORK_PERM" = true ]; then applyPatch "$DOS_PATCHES/android_libcore/0003-Network_Permission.patch"; fi; #Expose the NETWORK permission (GrapheneOS)
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_libcore/0004-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
fi;
if enterAndClear "lineage-sdk"; then
@ -200,6 +214,10 @@ awk -i inplace '!/LineageWeatherManagerService/' lineage/res/res/values/config.x
if [ "$DOS_DEBLOBBER_REMOVE_AUDIOFX" = true ]; then awk -i inplace '!/LineageAudioService/' lineage/res/res/values/config.xml; fi; #Remove AudioFX
fi;
if enterAndClear "packages/apps/Bluetooth"; then
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_packages_apps_Bluetooth/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
fi;
if enterAndClear "packages/apps/Contacts"; then
applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0001-No_Google_Links.patch"; #Remove Privacy Policy and Terms of Service links (GrapheneOS)
applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0002-No_Google_Backup.patch"; #Backups are not sent to Google (GrapheneOS)
@ -214,6 +232,10 @@ rm -rf src/org/lineageos/lineageparts/lineagestats/ res/xml/anonymous_stats.xml
applyPatch "$DOS_PATCHES/android_packages_apps_LineageParts/0001-Remove_Analytics.patch"; #Remove analytics
fi;
if enterAndClear "packages/apps/Nfc"; then
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_packages_apps_Nfc/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
fi;
if enterAndClear "packages/apps/PermissionController"; then
if [ "$DOS_GRAPHENE_NETWORK_PERM" = true ]; then
applyPatch "$DOS_PATCHES/android_packages_apps_PermissionController/0001-Network_Permission-1.patch"; #Expose the NETWORK permission (GrapheneOS)

View File

@ -55,6 +55,10 @@ gpgVerifyDirectory "$DOS_PREBUILT_APPS""android_vendor_FDroid_PrebuiltApps/packa
cp -r "$DOS_PREBUILT_APPS""android_vendor_FDroid_PrebuiltApps/." "$DOS_BUILD_BASE""vendor/fdroid_prebuilt/"; #Add the prebuilt apps
cp -r "$DOS_PATCHES_COMMON""android_vendor_divested/." "$DOS_BUILD_BASE""vendor/divested/"; #Add our vendor files
if enterAndClear "art"; then
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_art/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
fi;
if enterAndClear "bootable/recovery"; then
applyPatch "$DOS_PATCHES/android_bootable_recovery/0001-No_SerialNum_Restrictions.patch"; #Abort package installs if they are specific to a serial number (GrapheneOS)
fi;
@ -83,6 +87,10 @@ if [ "$(type -t DOS_WEBVIEW_CHERRYPICK)" = "alias" ] ; then DOS_WEBVIEW_CHERRYPI
if [ "$DOS_WEBVIEW_LFS" = true ]; then git lfs pull; fi; #Ensure the objects are available
fi;
if enterAndClear "external/conscrypt"; then
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_external_conscrypt/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
fi;
if enterAndClear "frameworks/base"; then
#applyPatch "$DOS_PATCHES/android_frameworks_base/0006-Disable_Analytics.patch"; #Disable/reduce functionality of various ad/analytics libraries
applyPatch "$DOS_PATCHES/android_frameworks_base/0007-Always_Restict_Serial.patch"; #Always restrict access to Build.SERIAL (GrapheneOS)
@ -106,6 +114,7 @@ fi;
applyPatch "$DOS_PATCHES/android_frameworks_base/0014-Automatic_Reboot.patch"; #Timeout for reboot (GrapheneOS)
applyPatch "$DOS_PATCHES/android_frameworks_base/0015-Bluetooth_Timeout.patch"; #Timeout for Bluetooth (GrapheneOS)
applyPatch "$DOS_PATCHES/android_frameworks_base/0016-WiFi_Timeout.patch"; #Timeout for Wi-Fi (GrapheneOS)
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0017-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
applyPatch "$DOS_PATCHES_COMMON/android_frameworks_base/0006-Do-not-throw-in-setAppOnInterfaceLocked.patch"; #Fix random reboots on broken kernels when an app has data restricted XXX: ugly
if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0002-Signature_Spoofing.patch"; fi; #Allow packages to spoof their signature (microG)
if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_frameworks_base/0003-Harden_Sig_Spoofing.patch"; fi; #Restrict signature spoofing to system apps signed with the platform key
@ -124,6 +133,10 @@ if [ "$DOS_MICROG_INCLUDED" != "FULL" ]; then rm -rf packages/CompanionDeviceMan
rm -rf packages/PrintRecommendationService; #Creates popups to install proprietary print apps
fi;
if enterAndClear "frameworks/ex"; then
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_frameworks_ex/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
fi;
if enterAndClear "frameworks/native"; then
if [ "$DOS_SENSORS_PERM_NEW" = true ]; then applyPatch "$DOS_PATCHES/android_frameworks_native/0001-Sensors.patch"; fi; #Permission for sensors access (MSe1969)
applyPatch "$DOS_PATCHES/android_frameworks_native/0002-fix-uaf.patch"; #Fix use-after-free in adbd_auth (GrapheneOS)
@ -186,6 +199,7 @@ fi;
if enterAndClear "libcore"; then
if [ "$DOS_GRAPHENE_NETWORK_PERM" = true ]; then applyPatch "$DOS_PATCHES/android_libcore/0001-Network_Permission.patch"; fi; #Expose the NETWORK permission (GrapheneOS)
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_libcore/0002-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
fi;
if enterAndClear "lineage-sdk"; then
@ -193,6 +207,10 @@ awk -i inplace '!/LineageWeatherManagerService/' lineage/res/res/values/config.x
if [ "$DOS_DEBLOBBER_REMOVE_AUDIOFX" = true ]; then awk -i inplace '!/LineageAudioService/' lineage/res/res/values/config.xml; fi; #Remove AudioFX
fi;
if enterAndClear "packages/apps/Bluetooth"; then
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_packages_apps_Bluetooth/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
fi;
if enterAndClear "packages/apps/Contacts"; then
applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0001-No_Google_Links.patch"; #Remove Privacy Policy and Terms of Service links (GrapheneOS)
applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Contacts/0002-No_Google_Backup.patch"; #Backups are not sent to Google (GrapheneOS)
@ -207,6 +225,10 @@ rm -rf src/org/lineageos/lineageparts/lineagestats/ res/xml/anonymous_stats.xml
applyPatch "$DOS_PATCHES/android_packages_apps_LineageParts/0001-Remove_Analytics.patch"; #Remove analytics
fi;
if enterAndClear "packages/apps/Nfc"; then
if [ "$DOS_GRAPHENE_CONSTIFY" = true ]; then applyPatch "$DOS_PATCHES/android_packages_apps_Nfc/0001-constify_JNINativeMethod.patch"; fi; #Constify JNINativeMethod tables (GrapheneOS)
fi;
if enterAndClear "packages/apps/PermissionController"; then
if [ "$DOS_MICROG_INCLUDED" = "FULL" ]; then applyPatch "$DOS_PATCHES/android_packages_apps_PermissionController/0001-Signature_Spoofing.patch"; fi; #Allow packages to spoof their signature (microG)
if [ "$DOS_GRAPHENE_NETWORK_PERM" = true ]; then

View File

@ -57,6 +57,7 @@ export DOS_DEBLOBBER_REPLACE_TIME=false; #Set true to replace Qualcomm Time Serv
#Features
export DOS_GPS_GLONASS_FORCED=false; #Enables GLONASS on all devices
export DOS_GRAPHENE_CONSTIFY=true; #Enables 'Constify JNINativeMethod tables' patchset on 16.0+17.1+18.1
export DOS_GRAPHENE_MALLOC=true; #Enables use of GrapheneOS' hardened memory allocator on 64-bit platforms on 16.0+17.1
export DOS_GRAPHENE_EXEC=false; #Enables use of GrapheneOS' exec spawning feature on 16.0+17.1 XXX: broken (just on 17.1?)
export DOS_GRAPHENE_PTRACE_SCOPE=true; #Enables the ptrace_scope toggle patchset on 18.1