-
1. Re: Finding Superclasses and Interfaces: An Idea
adinn Aug 2, 2016 6:39 AM (in response to bluegol)Hi Jahwan,
That's a very interesting idea. Off the top of my head I can't see any reason why delaying a potential the transform to <clinit> time is going to cause major problems. It's certainly worth investigating to see what happens.
I would very much like to avoid using getResourceAsStream because there are certain class loader setups where this cheat will fail or be quite expensive. Also, I am concerned that Jigsaw may make such failures much more common.
One caveat is that I don't just use this resource lookup trick when chasing superclasses in the Transformer. There are also occasions where the type checker needs to attempt to find a highest common superclass for two classes (when exceptions shadow other exceptions or when a local slot populated with two different subtypes in alternative paths needs to be retyped at a control flow merge point). So, even if this works to eliminate the resource lookup during super-chasing it may not remove the need for it in those other cases.
regards,
Andrew Dinn
-
2. Re: Finding Superclasses and Interfaces: An Idea
bluegol Aug 2, 2016 9:00 PM (in response to adinn)Hi Andrew,
OK, I'll definitely run some experiments on this.
One caveat is that I don't just use this resource lookup trick when chasing superclasses in the Transformer. There are also occasions where the type checker needs to attempt to find a highest common superclass for two classes (when exceptions shadow other exceptions or when a local slot populated with two different subtypes in alternative paths needs to be retyped at a control flow merge point). So, even if this works to eliminate the resource lookup during super-chasing it may not remove the need for it in those other cases.
I need to think more about this. As far as I can tell, such usage in byteman is via ClassWriter's getCommonSuperClass method.
It is required for ASM's stack map frame computation. And the reason for that is what you just explained: subtypes in one local slot.
It all makes sense.
Thanks for the "to-the-point" answer.
Best,
Jahwan