File tree Expand file tree Collapse file tree
java-language-api/src/main/java/com/intellij/java/language/psi Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 .java .language .psi ;
3+
4+ import com .intellij .java .language .jvm .annotation .JvmAnnotationArrayValue ;
5+ import com .intellij .java .language .jvm .annotation .JvmAnnotationAttributeValue ;
6+ import consulo .util .collection .ContainerUtil ;
7+ import jakarta .annotation .Nonnull ;
8+
9+ import java .util .List ;
10+
11+ class PsiAnnotationArrayValue extends PsiAnnotationAttributeValue <PsiArrayInitializerMemberValue > implements JvmAnnotationArrayValue {
12+ PsiAnnotationArrayValue (@ Nonnull PsiArrayInitializerMemberValue value ) {
13+ super (value );
14+ }
15+
16+ @ Nonnull
17+ @ Override
18+ public List <JvmAnnotationAttributeValue > getValues () {
19+ return ContainerUtil .map (myElement .getInitializers (), PsiJvmConversionHelper ::getAnnotationAttributeValue );
20+ }
21+ }
Original file line number Diff line number Diff line change 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 .java .language .psi ;
3+
4+ import com .intellij .java .language .jvm .annotation .JvmAnnotationAttributeValue ;
5+ import jakarta .annotation .Nonnull ;
6+
7+ abstract class PsiAnnotationAttributeValue <T extends PsiAnnotationMemberValue > implements JvmAnnotationAttributeValue {
8+ protected final T myElement ;
9+
10+ protected PsiAnnotationAttributeValue (@ Nonnull T value ) {
11+ myElement = value ;
12+ }
13+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 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 .java .language .psi ;
3+
4+ import com .intellij .java .language .jvm .JvmClass ;
5+ import com .intellij .java .language .jvm .annotation .JvmAnnotationClassValue ;
6+ import consulo .annotation .access .RequiredReadAction ;
7+ import consulo .language .psi .PsiElement ;
8+ import jakarta .annotation .Nonnull ;
9+ import jakarta .annotation .Nullable ;
10+
11+ class PsiAnnotationClassValue extends PsiAnnotationAttributeValue <PsiClassObjectAccessExpression > implements JvmAnnotationClassValue {
12+ PsiAnnotationClassValue (@ Nonnull PsiClassObjectAccessExpression value ) {
13+ super (value );
14+ }
15+
16+ private PsiJavaCodeReferenceElement getReferenceElement () {
17+ return myElement .getOperand ().getInnermostComponentReferenceElement ();
18+ }
19+
20+ @ Nullable
21+ @ Override
22+ public String getQualifiedName () {
23+ PsiJavaCodeReferenceElement referenceElement = getReferenceElement ();
24+ return referenceElement == null ? null : referenceElement .getQualifiedName ();
25+ }
26+
27+ @ Nullable
28+ @ Override
29+ @ RequiredReadAction
30+ public JvmClass getClazz () {
31+ PsiJavaCodeReferenceElement referenceElement = getReferenceElement ();
32+ if (referenceElement == null ) {
33+ return null ;
34+ }
35+ PsiElement resolved = referenceElement .resolve ();
36+ return resolved instanceof JvmClass jvmClass ? jvmClass : null ;
37+ }
38+ }
Original file line number Diff line number Diff line change 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 .java .language .psi ;
3+
4+ import com .intellij .java .language .jvm .annotation .JvmAnnotationConstantValue ;
5+ import jakarta .annotation .Nonnull ;
6+ import jakarta .annotation .Nullable ;
7+
8+ class PsiAnnotationConstantValue extends PsiAnnotationAttributeValue <PsiExpression > implements JvmAnnotationConstantValue {
9+ PsiAnnotationConstantValue (@ Nonnull PsiExpression value ) {
10+ super (value );
11+ }
12+
13+ @ Nullable
14+ @ Override
15+ public Object getConstantValue () {
16+ PsiConstantEvaluationHelper evaluationHelper = JavaPsiFacade .getInstance (myElement .getProject ()).getConstantEvaluationHelper ();
17+ return evaluationHelper .computeConstantExpression (myElement );
18+ }
19+ }
Original file line number Diff line number Diff line change 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 .java .language .psi ;
3+
4+ import com .intellij .java .language .jvm .JvmEnumField ;
5+ import com .intellij .java .language .jvm .annotation .JvmAnnotationEnumFieldValue ;
6+ import jakarta .annotation .Nonnull ;
7+ import jakarta .annotation .Nullable ;
8+
9+ class PsiAnnotationEnumFieldValue extends PsiAnnotationAttributeValue <PsiReferenceExpression > implements JvmAnnotationEnumFieldValue {
10+ private final JvmEnumField myEnumField ;
11+
12+ PsiAnnotationEnumFieldValue (@ Nonnull PsiReferenceExpression value , @ Nonnull JvmEnumField field ) {
13+ super (value );
14+ myEnumField = field ;
15+ }
16+
17+ @ Nullable
18+ @ Override
19+ public JvmEnumField getField () {
20+ return myEnumField ;
21+ }
22+ }
Original file line number Diff line number Diff line change 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 .java .language .psi ;
3+
4+ import com .intellij .java .language .jvm .JvmAnnotation ;
5+ import com .intellij .java .language .jvm .annotation .JvmNestedAnnotationValue ;
6+ import jakarta .annotation .Nonnull ;
7+
8+ class PsiNestedAnnotationValue extends PsiAnnotationAttributeValue <PsiAnnotation > implements JvmNestedAnnotationValue {
9+ PsiNestedAnnotationValue (@ Nonnull PsiAnnotation value ) {
10+ super (value );
11+ }
12+
13+ @ Nonnull
14+ @ Override
15+ public JvmAnnotation getValue () {
16+ return myElement ;
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments