• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 The Bazel Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //    http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 package com.google.devtools.build.android.desugar;
15 
16 import static com.google.common.base.Preconditions.checkArgument;
17 
18 import com.google.auto.value.AutoValue;
19 import org.objectweb.asm.Handle;
20 
21 @AutoValue
22 abstract class LambdaInfo {
create( String desiredInternalName, String factoryMethodDesc, boolean needFactory, Handle methodReference, Handle bridgeMethod)23   public static LambdaInfo create(
24       String desiredInternalName,
25       String factoryMethodDesc,
26       boolean needFactory,
27       Handle methodReference,
28       Handle bridgeMethod) {
29     checkArgument(!needFactory || !factoryMethodDesc.startsWith("()"),
30         "Shouldn't need a factory method for %s : %s", desiredInternalName, factoryMethodDesc);
31     return new AutoValue_LambdaInfo(
32         desiredInternalName, factoryMethodDesc, needFactory, methodReference, bridgeMethod);
33   }
34 
desiredInternalName()35   public abstract String desiredInternalName();
factoryMethodDesc()36   public abstract String factoryMethodDesc();
37   /** Returns {@code true} if we need the generated class to have a factory method. */
needFactory()38   public abstract boolean needFactory();
methodReference()39   public abstract Handle methodReference();
bridgeMethod()40   public abstract Handle bridgeMethod();
41 }
42