On Thu, 19 Nov 2020 16:09:41 GMT, Claes Redestad <[email protected]> wrote:
>> Hi Claes,
>>
>> Thanks for taking a look.
>>
>> So should I keep the following `!initialize` check in
>> LambdaProxyClassArchive?
>> 109 if (!loadedByBuiltinLoader(caller) || !initialize ||
>> 110 !CDS.isSharingEnabled() || isSerializable ||
>> markerInterfaces.length > 0 || additionalBridges.length > 0)
>> 111 return null;
>> If we keep the above code, I think we don't need to pass the `initialize` to
>> `findFromArchive` and eventually to `JVM_LookupLambdaProxyClassFromArchive`.
>>
>> Let me know if the above is what you have in mind?
>>
>> thanks,
>> Calvin
>
> Right, I'd drop that argument - I would go further and suggest making calls
> to both `LambdaProxyClassArchive.register` and `LambdaProxyClassArchive.find`
> conditional on `disableEagerInitialization` being `false` to avoid any
> accidental mix-up and reduce complexity of these orthogonal features/concerns.
I agree with Claes that this is a wrong move to archive lambda proxies even if
`disableEagerInitialization` is set. A simple fix would be:
private Class<?> spinInnerClass() throws LambdaConversionException {
if (!disableEagerInitialization) {
if (LambdaProxyClassArchive.isDumpArchive()) {
...
}
// load from CDS archive if present
Class<?> archiveClass = LambdaProxyClassArchive.find(targetClass,
samMethodName,
invokedType,
samMethodType,
implMethod,
instantiatedMethodType,
isSerializable,
markerInterfaces,
additionalBridges,
true);
if (archiveClass != null) return archiveClass;
}
return generateInnerClass();
}
-------------
PR: https://git.openjdk.java.net/jdk/pull/1301