Java-style lambda class merging.

Adds support for Kotlin java-style lambda class merging implemented in
the same way and scope as similar merging of kotlin-style lambda classes.

Actually, there are just few differences between kotlin- and java-style
lambdas synthesized by Kotlin compiler and most of the implementation
is shared.

As before, the scope of the merging depends on proguard rules, on
tachiyomi with most optimistic expectetions (assuming no lambda classes
are pinned by blanket keep rules, allowaccessmodification is specified,
and none of [Signature, InnerClasses, EnclosingMethod] is kept) we get:

K-STYLE LAMBDAS:
  422 lambda classes total
  303 lambda classes in 81 groups after invalid and non-grouped lambdas removed
  222 lambda classes removed

J-STYLE LAMBDA CLASSES:
  503 lambda classes total
  310 lambda classes in 83 groups after invalid and non-grouped lambdas removed
  227 lambda classes removed

DEX size w/o optimization : 4865332 bytes
DEX size with optimization: 4774368 bytes (-91K, -1.87%)

Bug:72858983
Change-Id: I86602f8ef2a1e452bb5e320a9af4b39a7958ca06
diff --git a/build.gradle b/build.gradle
index 2cf3fe1..e0c50ee 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1190,12 +1190,30 @@
             def name = dir.getName()
             def taskName = "jar_kotlinR8TestResources_${name}_${kotlinTargetVersion}"
             def outputFile = "build/test/kotlinR8TestResources/${kotlinTargetVersion}/${name}.jar"
-            task "${taskName}"(type: kotlin.Kotlinc) {
-                source = fileTree(dir: file("${examplesDir}/${name}"), include: '**/*.kt')
+            def javaOutput = "build/test/kotlinR8TestResources/${kotlinTargetVersion}/${name}/java"
+            def javaOutputJarName = "${name}.java.jar"
+            def javaOutputJarDir = "build/test/kotlinR8TestResources/${kotlinTargetVersion}"
+            task "${taskName}Kotlin"(type: kotlin.Kotlinc) {
+                source = fileTree(dir: file("${examplesDir}/${name}"),
+                        include: ['**/*.kt', '**/*.java'])
                 destination = file(outputFile)
                 targetVersion = kotlinTargetVersion
             }
-            dependsOn taskName
+            task "${taskName}Java"(type: JavaCompile) {
+                source = fileTree(dir: file("${examplesDir}/${name}"), include: '**/*.java')
+                destinationDir = file(javaOutput)
+                classpath = sourceSets.main.compileClasspath
+                sourceCompatibility = JavaVersion.VERSION_1_6
+                targetCompatibility = JavaVersion.VERSION_1_6
+                options.compilerArgs += ["-g", "-Xlint:-options"]
+            }
+            task "${taskName}JavaJar"(type: Jar, dependsOn: "${taskName}Java") {
+                archiveName = javaOutputJarName
+                destinationDir = file(javaOutputJarDir)
+                from javaOutput
+                include "**/*.class"
+            }
+            dependsOn "${taskName}Kotlin", "${taskName}JavaJar"
         }
     }
 }