summaryrefslogtreecommitdiff
path: root/java/com/google/devtools/build/android/desugar/LambdaInfo.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/google/devtools/build/android/desugar/LambdaInfo.java')
-rw-r--r--java/com/google/devtools/build/android/desugar/LambdaInfo.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/java/com/google/devtools/build/android/desugar/LambdaInfo.java b/java/com/google/devtools/build/android/desugar/LambdaInfo.java
index dad340c..b7e7a3c 100644
--- a/java/com/google/devtools/build/android/desugar/LambdaInfo.java
+++ b/java/com/google/devtools/build/android/desugar/LambdaInfo.java
@@ -13,6 +13,8 @@
// limitations under the License.
package com.google.devtools.build.android.desugar;
+import static com.google.common.base.Preconditions.checkArgument;
+
import com.google.auto.value.AutoValue;
import org.objectweb.asm.Handle;
@@ -21,14 +23,19 @@ abstract class LambdaInfo {
public static LambdaInfo create(
String desiredInternalName,
String factoryMethodDesc,
+ boolean needFactory,
Handle methodReference,
Handle bridgeMethod) {
+ checkArgument(!needFactory || !factoryMethodDesc.startsWith("()"),
+ "Shouldn't need a factory method for %s : %s", desiredInternalName, factoryMethodDesc);
return new AutoValue_LambdaInfo(
- desiredInternalName, factoryMethodDesc, methodReference, bridgeMethod);
+ desiredInternalName, factoryMethodDesc, needFactory, methodReference, bridgeMethod);
}
public abstract String desiredInternalName();
public abstract String factoryMethodDesc();
+ /** Returns {@code true} if we need the generated class to have a factory method. */
+ public abstract boolean needFactory();
public abstract Handle methodReference();
public abstract Handle bridgeMethod();
}