Skip to content
Advertisement

Tag: package-private

Accessing non-visible classes with reflection

I am trying to get an instance of a non-visible class, AKA package private class, using reflection. I was wondering if there was a way to switch the modifiers to make it public and then access it using Class.forName. When I try that now it stops me saying I can’t do it. Unfortunately there is no setAccesible method of the

Advertisement