diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/PsiMethodWrapper.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/PsiMethodWrapper.java index 4c2efede873..5f6df150934 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/PsiMethodWrapper.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/PsiMethodWrapper.java @@ -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); } diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/KotlinSignatureAnnotation.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/KotlinSignatureAnnotation.java new file mode 100644 index 00000000000..8586093e3e0 --- /dev/null +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/KotlinSignatureAnnotation.java @@ -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())); + } +}