Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

10
  • 1
    You cannot call classToRun.someStaticMethod(); anyways if classToRun is a Class. You need reflection code to call that function. Commented Jan 6, 2022 at 12:37
  • Also, please read: What is a raw type and why shouldn't we use it? Commented Jan 6, 2022 at 12:39
  • @Turing85 You are free to put down a better working solution instead of a non working frame of idea, if you can. Commented Jan 6, 2022 at 12:43
  • 1
    WebComer without putting some type of limitation on the classes, how would you assume you can guarantee that method is there? Commented Jan 6, 2022 at 12:44
  • 2
    @WebComer The current design is broken. There is no proper (i.e. clean) solution to the problem since - 1. there is no common superclass of those classes and - 2. even if there were, static methods are not inherited. I recommend to reevaluate the overall design. Commented Jan 6, 2022 at 12:48