优化
This commit is contained in:
@@ -6,7 +6,7 @@ import org.mozilla.javascript.Scriptable
|
||||
class ProtectedNativeJavaClass(
|
||||
scope: Scriptable,
|
||||
javaClass: Class<*>,
|
||||
private val protectedName: Set<String>
|
||||
private val protectedName: Set<String> = emptySet()
|
||||
) : NativeJavaClass(scope, javaClass) {
|
||||
|
||||
override fun has(
|
||||
@@ -37,4 +37,8 @@ class ProtectedNativeJavaClass(
|
||||
super.put(name, start, value)
|
||||
}
|
||||
|
||||
override fun unwrap(): Any? {
|
||||
return null
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ package com.script.rhino
|
||||
import android.os.Build
|
||||
import org.mozilla.javascript.ClassShutter
|
||||
import org.mozilla.javascript.Context
|
||||
import org.mozilla.javascript.NativeJavaClass
|
||||
import org.mozilla.javascript.Scriptable
|
||||
import java.io.ObjectInputStream
|
||||
import java.io.ObjectOutputStream
|
||||
@@ -52,10 +51,12 @@ object RhinoClassShutter : ClassShutter {
|
||||
"java.lang.ClassLoader",
|
||||
"java.net.URLClassLoader",
|
||||
"cn.hutool.core.lang.JarClassLoader",
|
||||
"cn.hutool.core.lang.Singleton",
|
||||
"cn.hutool.core.util.RuntimeUtil",
|
||||
"cn.hutool.core.util.ClassLoaderUtil",
|
||||
"cn.hutool.core.util.ReflectUtil",
|
||||
"cn.hutool.core.util.SerializeUtil",
|
||||
"cn.hutool.core.util.ClassUtil",
|
||||
"org.mozilla.javascript.DefiningClassLoader",
|
||||
"java.lang.Runtime",
|
||||
"java.lang.ProcessBuilder",
|
||||
@@ -95,6 +96,7 @@ object RhinoClassShutter : ClassShutter {
|
||||
"androidx.sqlite.db",
|
||||
"androidx.room",
|
||||
"cn.hutool.core.io",
|
||||
"cn.hutool.core.bean",
|
||||
"cn.hutool.core.lang.reflect",
|
||||
"dalvik.system",
|
||||
"java.nio.file",
|
||||
@@ -138,7 +140,7 @@ object RhinoClassShutter : ClassShutter {
|
||||
ProtectedNativeJavaClass(scope, javaClass, systemClassProtectedName)
|
||||
}
|
||||
|
||||
else -> NativeJavaClass(scope, javaClass)
|
||||
else -> ProtectedNativeJavaClass(scope, javaClass)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user