Source:
public static void main ( java.lang.String [ ] args ) throws java.lang.Exception { java.nio.file.Path dumpDirectory = java.nio.file.Files.createTempDirectory ( "lambdas" ) ; java.lang.System.setProperty ( LambdaClassMaker.LAMBDA_METAFACTORY_DUMPER_PROPERTY , dumpDirectory.toString ( ) ) ; com.google.devtools.build.android.desugar.Desugar.deleteTreeOnExit ( dumpDirectory ) ; if ( ( ( args.length ) == 1 ) && ( args [ 0 ] . startsWith ( "@" ) ) ) { args = java.nio.file.Files.readAllLines ( java.nio.file.Paths.get ( args [ 0 ] . substring ( 1 ) ) , java.nio.charset.StandardCharsets.ISO_8859_1 ) . toArray ( new java.lang.String [ 0 ] ) ; } com.google.devtools.common.options.OptionsParser optionsParser = com.google.devtools.common.options.OptionsParser.newOptionsParser ( com.google.devtools.build.android.desugar.Desugar.Options.class ) ; optionsParser.parseAndExitUponError ( args ) ; com.google.devtools.build.android.desugar.Desugar.Options options = optionsParser.getOptions ( com.google.devtools.build.android.desugar.Desugar.Options.class ) ; if ( options.verbose ) { java.lang.System.out.printf ( "Lambda classes will be written under %s%n" , dumpDirectory ) ; } boolean allowDefaultMethods = ( options.minSdkVersion ) >= 24 ; java.lang.ClassLoader parent ; if ( ( options.bootclasspath.isEmpty ( ) ) && ( ! ( options.allowEmptyBootclasspath ) ) ) { parent = java.lang.ClassLoader.getSystemClassLoader ( ) ; } else { parent = new com.google.devtools.build.android.desugar.Desugar.ThrowingClassLoader ( ) ; } com.google.devtools.build.android.desugar.CoreLibraryRewriter rewriter = new com.google.devtools.build.android.desugar.CoreLibraryRewriter ( ( options.coreLibrary ? "__desugar__/" : "" ) ) ; com.google.devtools.build.android.desugar.IndexedJars appIndexedJar = new com.google.devtools.build.android.desugar.IndexedJars ( com.google.common.collect.ImmutableList.of ( options.inputJar ) ) ; com.google.devtools.build.android.desugar.IndexedJars appAndClasspathIndexedJars = new com.google.devtools.build.android.desugar.IndexedJars ( options.classpath , appIndexedJar ) ; java.lang.ClassLoader loader = com.google.devtools.build.android.desugar.Desugar.createClassLoader ( rewriter , options.bootclasspath , appAndClasspathIndexedJars , parent ) ; boolean allowCallsToObjectsNonNull = ( options.minSdkVersion ) >= 19 ; try ( java.util.zip.ZipFile in = new java.util.zip.ZipFile ( options.inputJar.toFile ( ) ) ; java.util.zip.ZipOutputStream out = new java.util.zip.ZipOutputStream ( new java.io.BufferedOutputStream ( java.nio.file.Files.newOutputStream ( options.outputJar ) ) ) ) { com.google.devtools.build.android.desugar.LambdaClassMaker lambdas = new com.google.devtools.build.android.desugar.LambdaClassMaker ( dumpDirectory ) ; com.google.devtools.build.android.desugar.ClassReaderFactory readerFactory = new com.google.devtools.build.android.desugar.ClassReaderFactory ( ( ( options.copyBridgesFromClasspath ) && ( ! allowDefaultMethods ) ? appAndClasspathIndexedJars : appIndexedJar ) , rewriter ) ; com.google.common.collect.ImmutableSet.Builder < java.lang.String > interfaceLambdaMethodCollector = com.google.common.collect.ImmutableSet.builder ( ) ; for ( java.util.Enumeration < ? extends java.util.zip.ZipEntry > entries = in.entries ( ) ; entries.hasMoreElements ( ) ; ) { java.util.zip.ZipEntry entry = entries.nextElement ( ) ; try ( java.io.InputStream content = in.getInputStream ( entry ) ) { if ( entry.getName ( ) . endsWith ( ".class" ) ) { org.objectweb.asm.ClassReader reader = rewriter.reader ( content ) ; com.google.devtools.build.android.desugar.CoreLibraryRewriter.UnprefixingClassWriter writer = rewriter.writer ( ClassWriter.COMPUTE_MAXS ) ; org.objectweb.asm.ClassVisitor visitor = writer ; if ( ! allowDefaultMethods ) { visitor = new com.google.devtools.build.android.desugar.Java7Compatibility ( visitor , readerFactory ) ; } visitor = new com.google.devtools.build.android.desugar.LambdaDesugaring ( visitor , loader , lambdas , interfaceLambdaMethodCollector , allowDefaultMethods ) ; if ( ! allowCallsToObjectsNonNull ) { visitor = new com.google.devtools.build.android.desugar.ObjectsRequireNonNullMethodInliner ( visitor ) ; } reader.accept ( visitor , 0 ) ; com.google.devtools.build.android.desugar.Desugar.writeStoredEntry ( out , entry.getName ( ) , writer.toByteArray ( ) ) ; } else { java.util.zip.ZipEntry destEntry = new java.util.zip.ZipEntry ( entry ) ; destEntry.setCompressedSize ( ( - 1 ) ) ; out.putNextEntry ( destEntry ) ; com.google.common.io.ByteStreams.copy ( content , out ) ; out.closeEntry ( ) ; } } } com.google.common.collect.ImmutableSet < java.lang.String > interfaceLambdaMethods = interfaceLambdaMethodCollector.build ( ) ; if ( allowDefaultMethods ) { com.google.common.base.Preconditions.checkState ( interfaceLambdaMethods.isEmpty ( ) , "Desugaring with default methods enabled moved interface lambdas" ) ; } for ( java.util.Map.Entry < java.nio.file.Path , com.google.devtools.build.android.desugar.LambdaInfo > lambdaClass : lambdas.drain ( ) . entrySet ( ) ) { try ( java.io.InputStream bytecode = java.nio.file.Files.newInputStream ( dumpDirectory.resolve ( lambdaClass.getKey ( ) ) ) ) { org.objectweb.asm.ClassReader reader = rewriter.reader ( bytecode ) ; com.google.devtools.build.android.desugar.CoreLibraryRewriter.UnprefixingClassWriter writer = rewriter.writer ( ClassWriter.COMPUTE_MAXS ) ; org.objectweb.asm.ClassVisitor visitor = writer ; if ( ! allowDefaultMethods ) { visitor = new com.google.devtools.build.android.desugar.Java7Compatibility ( visitor , ( ( com.google.devtools.build.android.desugar.ClassReaderFactory ) ( null ) ) ) ; } visitor = new com.google.devtools.build.android.desugar.LambdaClassFixer ( visitor , lambdaClass.getValue ( ) , readerFactory , interfaceLambdaMethods , allowDefaultMethods ) ; visitor = new com.google.devtools.build.android.desugar.LambdaDesugaring ( visitor , loader , lambdas , null , allowDefaultMethods ) ; if ( ! allowCallsToObjectsNonNull ) { visitor = new com.google.devtools.build.android.desugar.ObjectsRequireNonNullMethodInliner ( visitor ) ; } reader.accept ( visitor , 0 ) ; java.lang.String filename = ( rewriter.unprefix ( lambdaClass.getValue ( ) . desiredInternalName ( ) ) ) + ".class" ; com.google.devtools.build.android.desugar.Desugar.writeStoredEntry ( out , filename , writer.toByteArray ( ) ) ; } } java.util.Map < java.nio.file.Path , com.google.devtools.build.android.desugar.LambdaInfo > leftBehind = lambdas.drain ( ) ; com.google.common.base.Preconditions.checkState ( leftBehind.isEmpty ( ) , "Didn't process %s" , leftBehind ) ; } }

Target:
public static void main ( java.lang.String [ ] args ) throws java.lang.Exception { java.nio.file.Path dumpDirectory = java.nio.file.Files.createTempDirectory ( "lambdas" ) ; java.lang.System.setProperty ( LambdaClassMaker.LAMBDA_METAFACTORY_DUMPER_PROPERTY , dumpDirectory.toString ( ) ) ; com.google.devtools.build.android.desugar.Desugar.deleteTreeOnExit ( dumpDirectory ) ; if ( ( ( args.length ) == 1 ) && ( args [ 0 ] . startsWith ( "@" ) ) ) { args = java.nio.file.Files.readAllLines ( java.nio.file.Paths.get ( args [ 0 ] . substring ( 1 ) ) , java.nio.charset.StandardCharsets.ISO_8859_1 ) . toArray ( new java.lang.String [ 0 ] ) ; } com.google.devtools.common.options.OptionsParser optionsParser = com.google.devtools.common.options.OptionsParser.newOptionsParser ( com.google.devtools.build.android.desugar.Desugar.Options.class ) ; optionsParser.parseAndExitUponError ( args ) ; com.google.devtools.build.android.desugar.Desugar.Options options = optionsParser.getOptions ( com.google.devtools.build.android.desugar.Desugar.Options.class ) ; if ( options.verbose ) { java.lang.System.out.printf ( "Lambda classes will be written under %s%n" , dumpDirectory ) ; } com.google.common.base.Preconditions.checkState ( ( ( ! ( options.bootclasspath.isEmpty ( ) ) ) || ( options.allowEmptyBootclasspath ) ) , "Bootclasspath required to desugar %s" , options.inputJar ) ; com.google.devtools.build.android.desugar.CoreLibraryRewriter rewriter = new com.google.devtools.build.android.desugar.CoreLibraryRewriter ( ( options.coreLibrary ? "__desugar__/" : "" ) ) ; com.google.devtools.build.android.desugar.IndexedJars appIndexedJar = new com.google.devtools.build.android.desugar.IndexedJars ( com.google.common.collect.ImmutableList.of ( options.inputJar ) ) ; com.google.devtools.build.android.desugar.IndexedJars appAndClasspathIndexedJars = new com.google.devtools.build.android.desugar.IndexedJars ( options.classpath , appIndexedJar ) ; java.lang.ClassLoader loader = com.google.devtools.build.android.desugar.Desugar.createClassLoader ( rewriter , options.bootclasspath , appAndClasspathIndexedJars ) ; boolean allowDefaultMethods = ( options.minSdkVersion ) >= 24 ; boolean allowCallsToObjectsNonNull = ( options.minSdkVersion ) >= 19 ; try ( java.util.zip.ZipFile in = new java.util.zip.ZipFile ( options.inputJar.toFile ( ) ) ; java.util.zip.ZipOutputStream out = new java.util.zip.ZipOutputStream ( new java.io.BufferedOutputStream ( java.nio.file.Files.newOutputStream ( options.outputJar ) ) ) ) { com.google.devtools.build.android.desugar.LambdaClassMaker lambdas = new com.google.devtools.build.android.desugar.LambdaClassMaker ( dumpDirectory ) ; com.google.devtools.build.android.desugar.ClassReaderFactory readerFactory = new com.google.devtools.build.android.desugar.ClassReaderFactory ( ( ( options.copyBridgesFromClasspath ) && ( ! allowDefaultMethods ) ? appAndClasspathIndexedJars : appIndexedJar ) , rewriter ) ; com.google.common.collect.ImmutableSet.Builder < java.lang.String > interfaceLambdaMethodCollector = com.google.common.collect.ImmutableSet.builder ( ) ; for ( java.util.Enumeration < ? extends java.util.zip.ZipEntry > entries = in.entries ( ) ; entries.hasMoreElements ( ) ; ) { java.util.zip.ZipEntry entry = entries.nextElement ( ) ; try ( java.io.InputStream content = in.getInputStream ( entry ) ) { if ( entry.getName ( ) . endsWith ( ".class" ) ) { org.objectweb.asm.ClassReader reader = rewriter.reader ( content ) ; com.google.devtools.build.android.desugar.CoreLibraryRewriter.UnprefixingClassWriter writer = rewriter.writer ( ClassWriter.COMPUTE_MAXS ) ; org.objectweb.asm.ClassVisitor visitor = writer ; if ( ! allowDefaultMethods ) { visitor = new com.google.devtools.build.android.desugar.Java7Compatibility ( visitor , readerFactory ) ; } visitor = new com.google.devtools.build.android.desugar.LambdaDesugaring ( visitor , loader , lambdas , interfaceLambdaMethodCollector , allowDefaultMethods ) ; if ( ! allowCallsToObjectsNonNull ) { visitor = new com.google.devtools.build.android.desugar.ObjectsRequireNonNullMethodInliner ( visitor ) ; } reader.accept ( visitor , 0 ) ; com.google.devtools.build.android.desugar.Desugar.writeStoredEntry ( out , entry.getName ( ) , writer.toByteArray ( ) ) ; } else { java.util.zip.ZipEntry destEntry = new java.util.zip.ZipEntry ( entry ) ; destEntry.setCompressedSize ( ( - 1 ) ) ; out.putNextEntry ( destEntry ) ; com.google.common.io.ByteStreams.copy ( content , out ) ; out.closeEntry ( ) ; } } } com.google.common.collect.ImmutableSet < java.lang.String > interfaceLambdaMethods = interfaceLambdaMethodCollector.build ( ) ; if ( allowDefaultMethods ) { com.google.common.base.Preconditions.checkState ( interfaceLambdaMethods.isEmpty ( ) , "Desugaring with default methods enabled moved interface lambdas" ) ; } for ( java.util.Map.Entry < java.nio.file.Path , com.google.devtools.build.android.desugar.LambdaInfo > lambdaClass : lambdas.drain ( ) . entrySet ( ) ) { try ( java.io.InputStream bytecode = java.nio.file.Files.newInputStream ( dumpDirectory.resolve ( lambdaClass.getKey ( ) ) ) ) { org.objectweb.asm.ClassReader reader = rewriter.reader ( bytecode ) ; com.google.devtools.build.android.desugar.CoreLibraryRewriter.UnprefixingClassWriter writer = rewriter.writer ( ClassWriter.COMPUTE_MAXS ) ; org.objectweb.asm.ClassVisitor visitor = writer ; if ( ! allowDefaultMethods ) { visitor = new com.google.devtools.build.android.desugar.Java7Compatibility ( visitor , ( ( com.google.devtools.build.android.desugar.ClassReaderFactory ) ( null ) ) ) ; } visitor = new com.google.devtools.build.android.desugar.LambdaClassFixer ( visitor , lambdaClass.getValue ( ) , readerFactory , interfaceLambdaMethods , allowDefaultMethods ) ; visitor = new com.google.devtools.build.android.desugar.LambdaDesugaring ( visitor , loader , lambdas , null , allowDefaultMethods ) ; if ( ! allowCallsToObjectsNonNull ) { visitor = new com.google.devtools.build.android.desugar.ObjectsRequireNonNullMethodInliner ( visitor ) ; } reader.accept ( visitor , 0 ) ; java.lang.String filename = ( rewriter.unprefix ( lambdaClass.getValue ( ) . desiredInternalName ( ) ) ) + ".class" ; com.google.devtools.build.android.desugar.Desugar.writeStoredEntry ( out , filename , writer.toByteArray ( ) ) ; } } java.util.Map < java.nio.file.Path , com.google.devtools.build.android.desugar.LambdaInfo > leftBehind = lambdas.drain ( ) ; com.google.common.base.Preconditions.checkState ( leftBehind.isEmpty ( ) , "Didn't process %s" , leftBehind ) ; } }