/* * Copyright 2000-2014 JetBrains s.r.o. * * 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 org.intellij.lang.annotations; import org.jetbrains.annotations.NonNls; import java.lang.annotation.*; /** * This annotation assists the 'Data flow to this' feature by describing data flow * from the method parameter to the corresponding container (e.g. ArrayList.add(item)) * or from the container to the method return value (e.g. Set.toArray()) * or between method parameters (e.g. System.arraycopy(array1, 0, array2, length)) */ @Retention(RetentionPolicy.CLASS) @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface Flow { /** * Denotes the source of the data flow.
* Allowed values are:
* * * By default, the source() value is:
* */ String source() default org.intellij.lang.annotations.Flow.DEFAULT_SOURCE; @NonNls String DEFAULT_SOURCE = "The method argument (if parameter was annotated) or this container (if instance method was annotated)"; @NonNls String THIS_SOURCE = "this"; /** * true if the data source is container and we should track not the expression but its contents.
* E.g. the java.util.ArrayList constructor takes the collection and stores its contents:
* ArrayList(
{@code @Flow(sourceIsContainer=true, targetIsContainer=true) Collection collection }
)
* By default it's false. */ boolean sourceIsContainer() default false; /** * Denotes the destination of the data flow.
* Allowed values are:
* * * By default, the target() value is:
* */ String target() default org.intellij.lang.annotations.Flow.DEFAULT_TARGET; @NonNls String DEFAULT_TARGET = "This container (if the parameter was annotated) or the return value (if instance method was annotated)"; @NonNls String RETURN_METHOD_TARGET = "The return value of this method"; @NonNls String THIS_TARGET = "this"; /** * true if the data target is container and we should track not the expression but its contents.
* E.g. the java.lang.System.arraycopy() method parameter 'dest' is actually an array:
* {@code void arraycopy(@Flow(sourceIsContainer=true, target="dest", targetIsContainer=true) Object src, int srcPos, Object dest, int destPos, int length)}
* By default it's false. */ boolean targetIsContainer() default false; }