diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrClassReferenceType.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrClassReferenceType.java index 61907d144f84..af76105d9f49 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrClassReferenceType.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrClassReferenceType.java @@ -7,8 +7,8 @@ import com.intellij.psi.*; import com.intellij.psi.search.GlobalSearchScope; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement; import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult; +import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement; import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeArgumentList; /** @@ -16,13 +16,13 @@ import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeArgumentList; */ public final class GrClassReferenceType extends PsiClassType { - private final @NotNull GrReferenceElement myReferenceElement; + private final @NotNull GrCodeReferenceElement myReferenceElement; - public GrClassReferenceType(@NotNull GrReferenceElement referenceElement) { + public GrClassReferenceType(@NotNull GrCodeReferenceElement referenceElement) { this(referenceElement, LanguageLevel.JDK_1_5); } - public GrClassReferenceType(@NotNull GrReferenceElement referenceElement, @NotNull LanguageLevel languageLevel) { + private GrClassReferenceType(@NotNull GrCodeReferenceElement referenceElement, @NotNull LanguageLevel languageLevel) { super(languageLevel); myReferenceElement = referenceElement; } @@ -154,7 +154,8 @@ public final class GrClassReferenceType extends PsiClassType { return new GrClassReferenceType(myReferenceElement, languageLevel); } - public GrReferenceElement getReference() { + @NotNull + public GrCodeReferenceElement getReference() { return myReferenceElement; } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyPsiElementFactoryImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyPsiElementFactoryImpl.java index b8ae95d24b78..93c0fb831104 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyPsiElementFactoryImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyPsiElementFactoryImpl.java @@ -25,7 +25,10 @@ import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocComment; import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocMemberReference; import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocReferenceElement; import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocTag; -import org.jetbrains.plugins.groovy.lang.psi.*; +import org.jetbrains.plugins.groovy.lang.psi.GroovyFile; +import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase; +import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement; +import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory; import org.jetbrains.plugins.groovy.lang.psi.api.GrLambdaExpression; import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.GrModifier; import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.GrModifierList; @@ -175,10 +178,7 @@ public class GroovyPsiElementFactoryImpl extends GroovyPsiElementFactory { @Override public GrCodeReferenceElement createReferenceElementByType(PsiClassType type) { if (type instanceof GrClassReferenceType) { - GrReferenceElement reference = ((GrClassReferenceType)type).getReference(); - if (reference instanceof GrCodeReferenceElement) { - return (GrCodeReferenceElement)reference; - } + return ((GrClassReferenceType)type).getReference(); } final PsiClassType.ClassResolveResult resolveResult = type.resolveGenerics(); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/smartPointers/GrClassReferenceTypePointer.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/smartPointers/GrClassReferenceTypePointer.java index 7cab1b27c324..3d9dbfd7dc94 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/smartPointers/GrClassReferenceTypePointer.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/smartPointers/GrClassReferenceTypePointer.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// 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. package org.jetbrains.plugins.groovy.lang.psi.impl.smartPointers; import com.intellij.openapi.diagnostic.Logger; @@ -23,15 +9,15 @@ import com.intellij.psi.SmartTypePointer; import com.intellij.psi.impl.smartPointers.TypePointerBase; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.Nullable; -import org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement; import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory; +import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement; import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeElement; import org.jetbrains.plugins.groovy.lang.psi.impl.GrClassReferenceType; public class GrClassReferenceTypePointer extends TypePointerBase implements SmartTypePointer { private static final Logger LOG = Logger.getInstance(GrClassReferenceTypePointer.class); - private final SmartPsiElementPointer mySmartPsiElementPointer; + private final SmartPsiElementPointer mySmartPsiElementPointer; private final String myReferenceText; private final Project myProject; @@ -39,7 +25,7 @@ public class GrClassReferenceTypePointer extends TypePointerBase