001/* 002 * Licensed under the Apache License, Version 2.0 (the "License"); 003 * you may not use this file except in compliance with the License. 004 * You may obtain a copy of the License at 005 * 006 * http://www.apache.org/licenses/LICENSE-2.0 007 * 008 * Unless required by applicable law or agreed to in writing, software 009 * distributed under the License is distributed on an "AS IS" BASIS, 010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 011 * See the License for the specific language governing permissions and 012 * limitations under the License. 013 */ 014 015package com.google.j2objc.annotations; 016 017import static java.lang.annotation.ElementType.LOCAL_VARIABLE; 018import static java.lang.annotation.ElementType.TYPE; 019import static java.lang.annotation.ElementType.TYPE_USE; 020import static java.lang.annotation.RetentionPolicy.SOURCE; 021 022import java.lang.annotation.Retention; 023import java.lang.annotation.Target; 024 025/** 026 * Annotation that indicates an inner class has a weak relationship to its owning class. 027 * 028 * <p>Lambdas can be given a weak outer reference by declaring a local variable with this annotation 029 * and assigning the lambda expression directly to the local variable. WeakOuter is only allowed on 030 * local variables, not fields, to encourage the annotation to be used where the lambda is declared. 031 * 032 * @author Tom Ball 033 */ 034@Target({TYPE, TYPE_USE, LOCAL_VARIABLE}) 035@Retention(SOURCE) 036public @interface WeakOuter {}