Using java.awt.Toolkit.getDefaultToolkit().getScreenSize() reflectively causes InaccessibleObjectException
Alan.Bateman at oracle.com
Fri Jan 6 08:24:15 UTC 2017
On 05/01/2017 20:07, Phil Race wrote:
> Sort of .. it depends whether you could use getDeclaredMethod instead.
> One question I have is, how would you update the code if you
> were given the instance "foo", and need to programmatically
> work out what is the correct super-type of Foo that exports
> the interface method "bar" ?
> i.e you don't have the string "java.awt.Toolkit" handy and
> need to infer it from the instance class.
There have been a couple of threads here (going back to 2015) on this
topic. Peter included a method  in one threads to walk the
superclasses and directly implemented interface of each class to find
the accessible method. Rony's example might need someone like this if
the reference to java.awt.Toolkit is not available.
More information about the jigsaw-dev