Added KotlinSignatureAnnotation wrapper class, and added it into PsiMethodWrapper.

This commit is contained in:
Evgeny Gerashchenko
2012-06-01 21:41:29 +04:00
parent 43e83956cc
commit 08b19a72ab
2 changed files with 57 additions and 0 deletions
@@ -24,6 +24,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.resolve.java.kt.JetConstructorAnnotation;
import org.jetbrains.jet.lang.resolve.java.kt.JetMethodAnnotation;
import org.jetbrains.jet.lang.resolve.java.kt.KotlinSignatureAnnotation;
import java.util.ArrayList;
import java.util.List;
@@ -73,6 +74,15 @@ public class PsiMethodWrapper extends PsiMemberWrapper {
return jetConstructor;
}
private KotlinSignatureAnnotation signatureAnnotation;
@NotNull
public KotlinSignatureAnnotation getSignatureAnnotation() {
if (signatureAnnotation == null) {
signatureAnnotation = KotlinSignatureAnnotation.get(getPsiMethod());
}
return signatureAnnotation;
}
public boolean isAbstract() {
return psiMember.hasModifierProperty(PsiModifier.ABSTRACT);
}
@@ -0,0 +1,47 @@
/*
* Copyright 2010-2012 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.jetbrains.jet.lang.resolve.java.kt;
import com.intellij.psi.PsiAnnotation;
import com.intellij.psi.PsiMethod;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
/**
* @author Evgeny Gerashchenko
* @since 6/1/12
*/
public class KotlinSignatureAnnotation extends PsiAnnotationWrapper {
public KotlinSignatureAnnotation(@Nullable PsiAnnotation psiAnnotation) {
super(psiAnnotation);
}
private String signature;
public String signature() {
if (signature == null) {
signature = getStringAttribute(JvmStdlibNames.KOTLIN_SIGNATURE_VALUE_METHOD, "");
}
return signature;
}
@NotNull
public static KotlinSignatureAnnotation get(PsiMethod psiClass) {
return new KotlinSignatureAnnotation(psiClass.getModifierList().findAnnotation(JvmStdlibNames.KOTLIN_SIGNATURE.getFqName().getFqName()));
}
}