Rename Apache class names to avoid conflicts
We add a gradle task to rename class names in the Apache library
This commit is contained in:
parent
f1f0b42c70
commit
8fb6afb84e
|
|
@ -1,3 +1,4 @@
|
||||||
|
apache/local/generated
|
||||||
.project
|
.project
|
||||||
.settings
|
.settings
|
||||||
.cache
|
.cache
|
||||||
|
|
|
||||||
|
|
@ -14,3 +14,25 @@ java {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val lang3Src = "commons-lang/src/main/java/org/apache/commons/lang3"
|
||||||
|
val localDir = "local/generated"
|
||||||
|
|
||||||
|
task<Copy>("ClassUtilsX") {
|
||||||
|
from("$lang3Src/ClassUtils.java")
|
||||||
|
into(localDir)
|
||||||
|
filter { line: String -> line.replace("ClassUtils", "ClassUtilsX") }
|
||||||
|
rename("(.+).java", "$1X.java")
|
||||||
|
}
|
||||||
|
|
||||||
|
task<Copy>("SerializationUtilsX") {
|
||||||
|
from("$lang3Src/SerializationUtils.java")
|
||||||
|
into(localDir)
|
||||||
|
filter { line: String -> line.replace("SerializationUtils", "SerializationUtilsX") }
|
||||||
|
rename("(.+).java", "$1X.java")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.compileJava {
|
||||||
|
dependsOn("ClassUtilsX")
|
||||||
|
dependsOn("SerializationUtilsX")
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import android.content.res.Resources;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import org.apache.commons.lang3.ClassUtils;
|
import org.apache.commons.lang3.ClassUtilsX;
|
||||||
import org.apache.commons.lang3.reflect.MemberUtilsX;
|
import org.apache.commons.lang3.reflect.MemberUtilsX;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
|
@ -202,7 +202,7 @@ public final class XposedHelpers {
|
||||||
if (classLoader == null)
|
if (classLoader == null)
|
||||||
classLoader = XposedBridge.BOOTCLASSLOADER;
|
classLoader = XposedBridge.BOOTCLASSLOADER;
|
||||||
try {
|
try {
|
||||||
return ClassUtils.getClass(classLoader, className, false);
|
return ClassUtilsX.getClass(classLoader, className, false);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new ClassNotFoundError(e);
|
throw new ClassNotFoundError(e);
|
||||||
}
|
}
|
||||||
|
|
@ -540,7 +540,7 @@ public final class XposedHelpers {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// compare name and parameters
|
// compare name and parameters
|
||||||
if (method.getName().equals(k.name) && ClassUtils.isAssignable(
|
if (method.getName().equals(k.name) && ClassUtilsX.isAssignable(
|
||||||
k.parameters,
|
k.parameters,
|
||||||
method.getParameterTypes(),
|
method.getParameterTypes(),
|
||||||
true)) {
|
true)) {
|
||||||
|
|
@ -763,7 +763,7 @@ public final class XposedHelpers {
|
||||||
Constructor<?>[] constructors = k.clazz.getDeclaredConstructors();
|
Constructor<?>[] constructors = k.clazz.getDeclaredConstructors();
|
||||||
for (Constructor<?> constructor : constructors) {
|
for (Constructor<?> constructor : constructors) {
|
||||||
// compare name and parameters
|
// compare name and parameters
|
||||||
if (ClassUtils.isAssignable(
|
if (ClassUtilsX.isAssignable(
|
||||||
k.parameters,
|
k.parameters,
|
||||||
constructor.getParameterTypes(),
|
constructor.getParameterTypes(),
|
||||||
true)) {
|
true)) {
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ import android.util.Pair;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import org.apache.commons.lang3.SerializationUtils;
|
import org.apache.commons.lang3.SerializationUtilsX;
|
||||||
import org.lsposed.daemon.BuildConfig;
|
import org.lsposed.daemon.BuildConfig;
|
||||||
import org.lsposed.lspd.models.Application;
|
import org.lsposed.lspd.models.Application;
|
||||||
import org.lsposed.lspd.models.Module;
|
import org.lsposed.lspd.models.Module;
|
||||||
|
|
@ -464,7 +464,7 @@ public class ConfigManager {
|
||||||
var group = cursor.getString(groupIdx);
|
var group = cursor.getString(groupIdx);
|
||||||
var key = cursor.getString(keyIdx);
|
var key = cursor.getString(keyIdx);
|
||||||
var data = cursor.getBlob(dataIdx);
|
var data = cursor.getBlob(dataIdx);
|
||||||
var object = SerializationUtils.deserialize(data);
|
var object = SerializationUtilsX.deserialize(data);
|
||||||
if (object == null) continue;
|
if (object == null) continue;
|
||||||
config.computeIfAbsent(group, g -> new HashMap<>()).put(key, object);
|
config.computeIfAbsent(group, g -> new HashMap<>()).put(key, object);
|
||||||
}
|
}
|
||||||
|
|
@ -491,7 +491,7 @@ public class ConfigManager {
|
||||||
var contents = new ContentValues();
|
var contents = new ContentValues();
|
||||||
contents.put("`group`", group);
|
contents.put("`group`", group);
|
||||||
contents.put("`key`", key);
|
contents.put("`key`", key);
|
||||||
contents.put("data", SerializationUtils.serialize((Serializable) value));
|
contents.put("data", SerializationUtilsX.serialize((Serializable) value));
|
||||||
contents.put("module_pkg_name", moduleName);
|
contents.put("module_pkg_name", moduleName);
|
||||||
contents.put("user_id", String.valueOf(userId));
|
contents.put("user_id", String.valueOf(userId));
|
||||||
db.insertWithOnConflict("configs", null, contents, SQLiteDatabase.CONFLICT_REPLACE);
|
db.insertWithOnConflict("configs", null, contents, SQLiteDatabase.CONFLICT_REPLACE);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue