/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * This annotation can be set on method to specify that if this method is called then it must be
 * called by an invokedynamic instruction.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface CalledByIndy {
    /** Resolver metadata for bootstrapping */
    BootstrapMethod[] bootstrapMethod() default {};

    /** Field or method name. */
    String fieldOrMethodName();

    /** Return type of method() or field getter() */
    Class<?> returnType() default void.class;

    /** Types of parameters for method or field setter() */
    Class<?>[] parameterTypes() default {};

    Constant[] constantArgumentsForBootstrapMethod() default {};
}
