On Wed, 29 Jan 2025 23:33:18 GMT, Karm Michal Babacek <[email protected]> wrote:

>> So this is much better than what was there in the beginning.
>> FindClass failing - for a key API class - is probably a fatal error one way 
>> or another.
>> Although in all (?) other cases, we try to return to Java and let the VM 
>> throw a Java-level error.
>> Note that OnLoad is not the only code path that calls AWTIsHeadless, and 
>> there will be
>> Java code to return to in the other case.
>> However I think that the OnLoad will always be reached first, so maybe it is 
>> OK to do the current fix.
>> Either way, things aren't going to work.
>> 
>> Generally the calls to check and clear exceptions when looking up code are 
>> there
>> to keep 'tools' happy. If these classes aren't found something is badly 
>> wrong.
>> meaning it should NEVER EVER happen.
>> Failing to find java/lang/String for example hardly seems like something it 
>> is worth trying to recover from ..
>> In your case it seems like it does some times happen for GraphicsEnvironment 
>> which still worries me.
>> I don't want to make this fix a precedent for assuming that it is normal for 
>> classes to be missing.
>> So consider it a truly exceptional case.
>
>> So this is much better than what was there in the beginning. FindClass 
>> failing - for a key API class - is probably a fatal error one way or 
>> another. Although in all (?) other cases, we try to return to Java and let 
>> the VM throw a Java-level error. Note that OnLoad is not the only code path 
>> that calls AWTIsHeadless, and there will be Java code to return to in the 
>> other case. However I think that the OnLoad will always be reached first, so 
>> maybe it is OK to do the current fix. Either way, things aren't going to 
>> work.
>> 
>> Generally the calls to check and clear exceptions when looking up code are 
>> there to keep 'tools' happy. If these classes aren't found something is 
>> badly wrong. meaning it should NEVER EVER happen. Failing to find 
>> java/lang/String for example hardly seems like something it is worth trying 
>> to recover from .. In your case it seems like it does some times happen for 
>> GraphicsEnvironment which still worries me. I don't want to make this fix a 
>> precedent for assuming that it is normal for classes to be missing. So 
>> consider it a truly exceptional case.
> 
> Thank you for the review. This is indeed an awkward, yet real-world 
> exceptional case.

> @Karm I've updated the subject of the JBS issue; please update the PR subject.

Thank you @aivanov-jdk . Done.

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

PR Comment: https://git.openjdk.org/jdk/pull/20169#issuecomment-2623169473

Reply via email to