RFR: 8304425: ClassHierarchyResolver from Reflection [v6]

Adam Sotona asotona at openjdk.org
Wed Apr 26 10:00:23 UTC 2023


On Mon, 20 Mar 2023 15:21:57 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> Marked as reviewed by asotona (Committer).
>
>> @asotona So should I simply throw an `IllegalAccessError` when the Lookup encounters a `IllegalAccessException`, or should I return null? I favor throwing an `IllegalAccessError` as the lookup represents bytecode accessibility, and shall it fail to access, the generated bytecode will fail to access the specified superclass as well.
> 
> Yes, I also prefer throwing `IllegalAccessError` to directly indicate what is wrong instead of later indirect exceptions. I think `IllegalAccessError` is not a case for fallback resolver, so it should not be masked.

> @asotona Just curious, what's the current state of our new API model of caching class hierarchy info in a Classfile context object as we've discussed on the mailing list? Will you create a patch, or should I update this patch to that model?

In the discussion I tried to fine-tune exact naming of the factory methods and the default. Mainly to differentiate when the class is parsed as a resource `ofResourceParsing(ClassLoader loader)` and  when it is loaded `ofClassLoading(ClassLoader loader)`

Otherwise this patch looks good.

The other part of the discussion with proposed `ClassfileReaderWriter` model is out of the scope of this topic, it has much bigger impact on all existing code and I would deferred it at least until this and other open PRs are merged.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/13082#issuecomment-1523118391


More information about the core-libs-dev mailing list