paul-bennett / juggle

A declarative search tool for Java APIs
Apache License 2.0
5 stars 0 forks source link

Handle nested classes in queries #85

Closed paul-bennett closed 1 year ago

paul-bennett commented 1 year ago

It looks like Juggle has problems with nested classes.

$ juggle -i java.net 'PasswordAuthentication (Authenticator,String,InetAddress,int,String,String,String,URL,Authenticator.RequestorType)'         
*** Couldn't find type: Authenticator.RequestorType; using class java.lang.Object instead
$

Specifying the full type with package also didn't help.

paul-bennett commented 1 year ago

The problem is that ClassLoader.loadClass(String,boolean) requires the "binary name" of the class, i.e. Authenticator$RequestorType (see JLS 13.1).

The answer's not quite as simple as replacing all dots for dollars though -- some of those dots will be separating components of the class's package identifier.