< prev index next >

src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java

Print this page
rev 59477 : [mq]: cds_lambda

*** 242,251 **** --- 242,289 ---- throw new LambdaConversionException("Exception finding constructor", e); } } } + /** Use the LambdaProxyClassArchive for including the lambda proxy class + * in CDS archive and retrieving the class from the archive. If the class + * is not found in the archive, it calls generatesInnerClass to create + * the class. + */ + private Class<?> spinInnerClass() throws LambdaConversionException { + // include lambda proxy class in CDS archive at dump time + if (LambdaProxyClassArchive.isDumpArchive()) { + Class<?> innerClass = generateInnerClass(); + LambdaProxyClassArchive.register(targetClass, + samMethodName, + invokedType, + samMethodType, + implMethod, + instantiatedMethodType, + isSerializable, + markerInterfaces, + additionalBridges, + innerClass); + return innerClass; + } + + // load from CDS archive if present + Class<?> innerClass = LambdaProxyClassArchive.find(targetClass, + samMethodName, + invokedType, + samMethodType, + implMethod, + instantiatedMethodType, + isSerializable, + markerInterfaces, + additionalBridges); + if (innerClass == null) { + innerClass = generateInnerClass(); + } + return innerClass; + } + /** * Generate a class file which implements the functional * interface, define and return the class. * * @implNote The class that is generated does not include signature
*** 257,267 **** * * @return a Class which implements the functional interface * @throws LambdaConversionException If properly formed functional interface * is not found */ ! private Class<?> spinInnerClass() throws LambdaConversionException { String[] interfaces; String samIntf = samBase.getName().replace('.', '/'); boolean accidentallySerializable = !isSerializable && Serializable.class.isAssignableFrom(samBase); if (markerInterfaces.length == 0) { interfaces = new String[]{samIntf}; --- 295,305 ---- * * @return a Class which implements the functional interface * @throws LambdaConversionException If properly formed functional interface * is not found */ ! private Class<?> generateInnerClass() throws LambdaConversionException { String[] interfaces; String samIntf = samBase.getName().replace('.', '/'); boolean accidentallySerializable = !isSerializable && Serializable.class.isAssignableFrom(samBase); if (markerInterfaces.length == 0) { interfaces = new String[]{samIntf};
< prev index next >