Java: NoSuchMethodException when method clearly exists

前端 未结 4 796
無奈伤痛
無奈伤痛 2020-12-03 04:28

On my current project, I\'ve felt the need to create a sort of simulated callback system in Java using reflection. However, I\'m having issues getting my reflection to actua

4条回答
  •  心在旅途
    2020-12-03 04:56

    Your method is private but getMethod() only returns public method.

    You need to use getDeclaredMethod().

提交回复
热议问题