lundi 23 juillet 2018

Why doesn't Java Core Reflection open any factory to allow creation of reflective objects for java generics?

Java 10 has a special sun.reflect.generics.reflectiveObjects package containing classes such as GenericArrayTypeImpl, ParameterizedTypeImpl and others. Also, the sun.reflect.generics.factory.GenericsFactory can be used to instantiate classes implementing GenericArrayType, ParameterizedType, ...

There are many libraries (guava, apache, guice, spring, ...) with their own hierarchy of classes implementing these interfaces to deal with custom generic types. What's the reason to not open a generics factory infrastructure to creators of libraries dealing with generics objects?

Adding an 'Add-Opens' manifest entry to the library jar doesn't solve the problem due to this mechanism is designed to be used only with executable JARs.





Aucun commentaire:

Enregistrer un commentaire