diff --git a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/ClsWrapperStubPsiFactory.java b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/ClsWrapperStubPsiFactory.java index dbe6cb7dbdb..d94a74d0c05 100644 --- a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/ClsWrapperStubPsiFactory.java +++ b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/ClsWrapperStubPsiFactory.java @@ -24,10 +24,10 @@ import com.intellij.psi.*; import com.intellij.psi.impl.compiled.ClsClassImpl; import com.intellij.psi.impl.compiled.ClsEnumConstantImpl; import com.intellij.psi.impl.compiled.ClsFieldImpl; -import com.intellij.psi.impl.compiled.ClsMethodImpl; import com.intellij.psi.impl.java.stubs.*; import com.intellij.psi.stubs.StubBase; import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.asJava.wrappers.JetClsMethodImpl; class ClsWrapperStubPsiFactory extends StubPsiFactory { public static final Key ORIGIN_ELEMENT = Key.create("ORIGIN_ELEMENT"); @@ -99,20 +99,11 @@ class ClsWrapperStubPsiFactory extends StubPsiFactory { @Override public PsiMethod createMethod(PsiMethodStub stub) { final PsiElement origin = ((StubBase) stub).getUserData(ORIGIN_ELEMENT); - if (origin == null) return delegate.createMethod(stub); + if (origin == null) { + return delegate.createMethod(stub); + } - return new ClsMethodImpl(stub) { - @Override - public PsiElement getMirror() { - return origin; - } - - @NotNull - @Override - public PsiElement getNavigationElement() { - return origin; - } - }; + return new JetClsMethodImpl(stub, origin); } @Override diff --git a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/wrappers/JetClsMethodImpl.java b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/wrappers/JetClsMethodImpl.java new file mode 100644 index 00000000000..274470bd981 --- /dev/null +++ b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/wrappers/JetClsMethodImpl.java @@ -0,0 +1,43 @@ +/* + * 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.asJava.wrappers; + +import com.intellij.psi.PsiElement; +import com.intellij.psi.impl.compiled.ClsMethodImpl; +import com.intellij.psi.impl.java.stubs.PsiMethodStub; +import org.jetbrains.annotations.NotNull; + +public class JetClsMethodImpl extends ClsMethodImpl { + @NotNull + private final PsiElement origin; + + public JetClsMethodImpl(@NotNull PsiMethodStub stub, @NotNull PsiElement origin) { + super(stub); + this.origin = origin; + } + + @Override + public PsiElement getMirror() { + return origin; + } + + @NotNull + @Override + public PsiElement getNavigationElement() { + return origin; + } +}