dimanche 31 décembre 2017

Determine base classes not in standard lib (Java or Scala) with runtime reflection

I'm generating GraphQL definitions from Scala types but can't find anything in the runtime reflection API to only get base classes that are "user defined" i.e. not part of the Scala or Java standard library.

As of right now I just have a set of the ones I know pops up e.g. Any, Object and about 8 others. Those are only in the list because they're what showed up when I was writing unit tests. Ideally I don't want a manual list, seems brittle as new types are added it'll probably break.

I don't know if this is possible with macros but that's not an option. After experimenting with macros there were too many bugs around it, including it causing the compiler to crash and the fix for that bug is suppose to be in the latest zinc but I can't use it because I'm using Gradle which can only use the 0.x.x zinc series due to namespace changes in the 1.x series.

So all that being said, does anyone know if there's a means of determining baseclasses of a type that are not from the standard libraries?





Aucun commentaire:

Enregistrer un commentaire