1 // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
2 package com.intellij.psi;
4 import com.intellij.lang.jvm.JvmParameter;
5 import com.intellij.util.ArrayFactory;
6 import org.jetbrains.annotations.NotNull;
7 import org.jetbrains.annotations.Nullable;
10 * Represents the parameter of a Java method, foreach (enhanced for) statement or catch block.
12 public interface PsiParameter extends PsiVariable, JvmParameter, PsiJvmModifiersOwner {
14 * The empty array of PSI parameters which can be reused to avoid unnecessary allocations.
16 PsiParameter[] EMPTY_ARRAY = new PsiParameter[0];
18 ArrayFactory<PsiParameter> ARRAY_FACTORY = count -> count == 0 ? EMPTY_ARRAY : new PsiParameter[count];
21 * Returns the element (method, lambda expression, foreach statement or catch block) in which the
22 * parameter is declared.
24 * @return the declaration scope for the parameter.
27 PsiElement getDeclarationScope();
30 * Checks if the parameter accepts a variable number of arguments.
32 * @return true if the parameter is a vararg, false otherwise
41 PsiTypeElement getTypeElement();
43 /* This explicit declaration is required to force javac generate bridge method 'JvmType getType()'; without it calling
44 JvmParameter#getType() method on instances which weren't recompiled against the new API will cause AbstractMethodError. */
49 // binary compatibility
52 default PsiAnnotation[] getAnnotations() {
53 return PsiJvmModifiersOwner.super.getAnnotations();