diff --git a/.gitignore b/.gitignore
index 0b7b04c..c791342 100644
--- a/.gitignore
+++ b/.gitignore
@@ -86,4 +86,5 @@ lint/tmp/
# lint/reports/
# Android Profiling
-*.hprof
\ No newline at end of file
+*.hprof
+.idea
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
deleted file mode 100644
index 96cc43e..0000000
--- a/.idea/compiler.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
deleted file mode 100644
index e7bedf3..0000000
--- a/.idea/copyright/profiles_settings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
deleted file mode 100644
index 277e79f..0000000
--- a/.idea/gradle.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 7d34715..a5702ba 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.0.0'
+ classpath 'com.android.tools.build:gradle:8.8.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 30bcc37..9ca160b 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Fri Jul 09 16:28:06 CST 2021
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
+#Wed Jun 11 11:21:45 CST 2025
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/open.netease.com/build.gradle b/open.netease.com/build.gradle
index 2de3370..6601154 100644
--- a/open.netease.com/build.gradle
+++ b/open.netease.com/build.gradle
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'
android {
- compileSdkVersion 24
- buildToolsVersion "26.0.1"
+ compileSdk 35
+ namespace "com.netease.open.pocoservice"
defaultConfig {
- minSdkVersion 19
- targetSdkVersion 29
+ minSdkVersion 21
+ targetSdkVersion 35
versionCode 1
versionName "1.0"
@@ -22,10 +22,9 @@ android {
}
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
- exclude group: 'com.android.support', module: 'support-annotations'
- })
- compile 'com.android.support:appcompat-v7:24.+'
- testCompile 'junit:junit:4.12'
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation 'androidx.test:monitor:1.7.2'
+ implementation 'androidx.test.uiautomator:uiautomator:2.3.0'
+ testImplementation 'junit:junit:4.13.2'
+ androidTestImplementation('androidx.test.espresso:espresso-core:3.6.1')
}
diff --git a/open.netease.com/src/androidTest/java/com/netease/open/libpoco/ExampleInstrumentedTest.java b/open.netease.com/src/androidTest/java/com/netease/open/libpoco/ExampleInstrumentedTest.java
index 56f8271..d8e9359 100644
--- a/open.netease.com/src/androidTest/java/com/netease/open/libpoco/ExampleInstrumentedTest.java
+++ b/open.netease.com/src/androidTest/java/com/netease/open/libpoco/ExampleInstrumentedTest.java
@@ -1,14 +1,15 @@
package com.netease.open.libpoco;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
/**
* Instrumentation test, which will execute on an Android device.
*
diff --git a/open.netease.com/src/main/AndroidManifest.xml b/open.netease.com/src/main/AndroidManifest.xml
index 0408b75..9912c54 100644
--- a/open.netease.com/src/main/AndroidManifest.xml
+++ b/open.netease.com/src/main/AndroidManifest.xml
@@ -1,6 +1,4 @@
-
+
diff --git a/open.netease.com/src/test/java/com/netease/open/libpoco/ExampleUnitTest.java b/open.netease.com/src/test/java/com/netease/open/libpoco/ExampleUnitTest.java
index a51a3a6..052559d 100644
--- a/open.netease.com/src/test/java/com/netease/open/libpoco/ExampleUnitTest.java
+++ b/open.netease.com/src/test/java/com/netease/open/libpoco/ExampleUnitTest.java
@@ -1,8 +1,9 @@
package com.netease.open.libpoco;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
/**
* Example local unit test, which will execute on the development machine (host).
diff --git a/pocoservice/build.gradle b/pocoservice/build.gradle
index 16d2c90..2dd90f4 100644
--- a/pocoservice/build.gradle
+++ b/pocoservice/build.gradle
@@ -4,12 +4,12 @@ android {
def cmd = 'git rev-list HEAD --count'
def gitVersion = cmd.execute().text.trim().toInteger()
- compileSdkVersion 28
- buildToolsVersion "25.0.3"
+ compileSdk 35
+ namespace "com.netease.open.pocoservice"
defaultConfig {
applicationId "com.netease.open.pocoservice"
- minSdkVersion 19
- targetSdkVersion 29
+ minSdkVersion 21
+ targetSdkVersion 35
versionCode gitVersion
versionName "1.0.0." + gitVersion
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -26,20 +26,17 @@ android {
}
dependencies {
- testImplementation 'junit:junit:4.12'
- androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
- exclude group: 'com.android.support', module: 'support-annotations'
- })
- implementation 'androidx.test.uiautomator:uiautomator:2.2.0'
- compile 'com.google.guava:guava:20.0'
- compile fileTree(include: ['*.jar'], dir: 'libs')
- compile 'com.android.support:appcompat-v7:25.3.1'
- testCompile 'junit:junit:4.12'
- compile 'com.nanohttpd:nanohttpd-webserver:2.2.0'
- compile 'com.android.support:support-annotations:25.3.1'
- compile 'com.android.support.test:runner:0.5'
- compile 'com.android.support.test:rules:0.5'
- compile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
- compile 'org.apache.commons:commons-lang3:3.5'
- compile project(':open.netease.com')
+ testImplementation 'junit:junit:4.13.2'
+ implementation 'androidx.test.uiautomator:uiautomator:2.3.0'
+ implementation 'com.google.guava:guava:27.0.1-android'
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ implementation 'androidx.appcompat:appcompat:1.7.1'
+ implementation 'androidx.test:monitor:1.7.2'
+
+ implementation 'androidx.test.ext:junit:1.2.1'
+ implementation 'androidx.test.espresso:espresso-core:3.6.1'
+
+ implementation 'com.nanohttpd:nanohttpd-webserver:2.2.0'
+ implementation 'org.apache.commons:commons-lang3:3.5'
+ implementation project(':open.netease.com')
}
diff --git a/pocoservice/src/main/AndroidManifest.xml b/pocoservice/src/main/AndroidManifest.xml
index 6f10008..5341d1a 100644
--- a/pocoservice/src/main/AndroidManifest.xml
+++ b/pocoservice/src/main/AndroidManifest.xml
@@ -1,6 +1,5 @@
-
+
@@ -21,7 +20,7 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:persistent="true" >
-
+
diff --git a/pocoservice/src/main/java/com/netease/open/hrpc/backend/MethodMatcher.java b/pocoservice/src/main/java/com/netease/open/hrpc/backend/MethodMatcher.java
new file mode 100644
index 0000000..a21adef
--- /dev/null
+++ b/pocoservice/src/main/java/com/netease/open/hrpc/backend/MethodMatcher.java
@@ -0,0 +1,143 @@
+package com.netease.open.hrpc.backend;
+
+import android.util.Log;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MethodMatcher {
+ private static final String TAG = "MethodMatcher-CGM";
+ // 改进的 primitiveTypeAssignableFrom 方法
+ private static boolean primitiveTypeAssignableFrom(Class> parType, Class> argType) {
+ // 如果都不是基本类型或包装类,使用 isAssignableFrom
+ if (!isPrimitiveOrWrapper(parType) && !isPrimitiveOrWrapper(argType)) {
+ return parType.isAssignableFrom(argType);
+ }
+
+ // 将包装类转换为对应的基本类型
+ parType = unwrap(parType);
+ argType = unwrap(argType);
+
+ // 如果目标类型不是基本类型,返回 false
+ if (!parType.isPrimitive()) {
+ return false;
+ }
+
+ // 基本类型宽化转换规则 (JLS §5.1.2)
+ if (parType == double.class) {
+ return argType == double.class || argType == float.class || argType == long.class ||
+ argType == int.class || argType == short.class || argType == byte.class;
+ } else if (parType == float.class) {
+ return argType == float.class || argType == long.class || argType == int.class ||
+ argType == short.class || argType == byte.class;
+ } else if (parType == long.class) {
+ return argType == long.class || argType == int.class || argType == short.class ||
+ argType == byte.class;
+ } else if (parType == int.class) {
+ return argType == int.class || argType == short.class || argType == byte.class;
+ } else if (parType == short.class) {
+ return argType == short.class || argType == byte.class;
+ } else if (parType == byte.class) {
+ return argType == byte.class;
+ } else if (parType == char.class) {
+ return argType == char.class;
+ } else if (parType == boolean.class) {
+ return argType == boolean.class;
+ }
+
+ return false;
+ }
+
+ // 判断是否是基本类型或包装类
+ private static boolean isPrimitiveOrWrapper(Class> type) {
+ return type.isPrimitive() ||
+ type == Integer.class || type == Double.class || type == Float.class ||
+ type == Long.class || type == Short.class || type == Byte.class ||
+ type == Character.class || type == Boolean.class;
+ }
+
+ // 将包装类转换为对应的基本类型
+ private static Class> unwrap(Class> type) {
+ if (type == Integer.class) return int.class;
+ if (type == Double.class) return double.class;
+ if (type == Float.class) return float.class;
+ if (type == Long.class) return long.class;
+ if (type == Short.class) return short.class;
+ if (type == Byte.class) return byte.class;
+ if (type == Character.class) return char.class;
+ if (type == Boolean.class) return boolean.class;
+ return type;
+ }
+
+ // 改进的匹配逻辑
+ public static java.lang.reflect.Method findMatchingMethod(List _overloadMethods,
+ String _overloadMethodName,
+ List