Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An internal error occurred when clicking "测试导航功能" on the demo app #53

Closed
rayworks opened this issue Feb 6, 2023 · 2 comments
Labels
wontfix This will not be worked on

Comments

@rayworks
Copy link

rayworks commented Feb 6, 2023

2023-02-06 15:12:55.838 16780-16780 TheRouter::RouterInject com.therouter.app                    D  class java.lang.Long do not have @ServiceProvider class. And constructor error::java.lang.Long.<init> []
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  java.lang.NoSuchMethodException: java.lang.Long.<init> []
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at java.lang.Class.getConstructor0(Class.java:2332)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at java.lang.Class.getDeclaredConstructor(Class.java:2170)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at com.therouter.inject.RouterInject.createDI(RouterInject.kt:101)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at com.therouter.inject.RouterInject.get(RouterInject.kt:54)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at com.therouter.TheRouter.get(TheRouter.kt:169)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at com.therouter.router.autowired.DefaultServiceParser.parse(DefaultServiceParser.kt:11)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at com.therouter.app.navigator.NavigatorTargetActivity__TheRouter__Autowired.autowiredInject(NavigatorTargetActivity__TheRouter__Autowired.java:43)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at a.TheRouterServiceProvideInjecter.autowiredInject(Unknown Source:19)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at com.therouter.TheRouter.inject(TheRouter.kt:193)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at com.therouter.app.navigator.NavigatorTargetActivity.onCreate(NavigatorTargetActivity.java:79)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at android.app.Activity.performCreate(Activity.java:8006)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at android.app.Activity.performCreate(Activity.java:7990)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3584)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3775)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2246)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at android.os.Handler.dispatchMessage(Handler.java:106)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at android.os.Looper.loop(Looper.java:233)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at android.app.ActivityThread.main(ActivityThread.java:8010)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at java.lang.reflect.Method.invoke(Native Method)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
2023-02-06 15:12:55.838 16780-16780 System.err              com.therouter.app                    W  	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)

RouteInject 方法中,"paramsClass" fallback的值在此处 对于Long类型并不适用。

if (!tClass.isInterface) {
      val paramsClass = if (params.isNotEmpty()) {
          val temp = arrayOfNulls<Class<*>?>(params.size)
          for (i in params.indices) {
              temp[i] = params[i]?.javaClass
          }
          temp
      } else arrayOfNulls<Class<*>?>(0)
      try {
          val constructor: Constructor<*> = tClass.getDeclaredConstructor(*paramsClass)
          if (!constructor.isAccessible) {
              constructor.isAccessible = true
          }
          t = constructor.newInstance(*params) as T
      } catch (e: Exception) {
          debugLog(tClass.toString() + " do not have @ServiceProvider class. And constructor error::" + e.message)
          e.printStackTrace()
      }
  } else {
      debugLog("$tClass is interface, but do not have @ServiceProvider")
  }
@kymjs kymjs added the wontfix This will not be worked on label Feb 7, 2023
@kymjs
Copy link
Collaborator

kymjs commented Feb 7, 2023

确实,应该所有封装类都不支持。

@kymjs kymjs added bug bug and removed wontfix This will not be worked on labels Feb 7, 2023
@kymjs
Copy link
Collaborator

kymjs commented Feb 7, 2023

此处不支持属于正常逻辑,不影响实际使用

@kymjs kymjs added wontfix This will not be worked on and removed bug bug labels Feb 7, 2023
@rayworks rayworks closed this as completed Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants