mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 20:39:40 +07:00
[java] adding stub-based "get provided interface" and "get used class" methods
GitOrigin-RevId: 0c7db3ce7ca8f61f05f9004588fb37056da99029
This commit is contained in:
committed by
intellij-monorepo-bot
parent
94e830613c
commit
dbc31144f9
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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 com.intellij.psi;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -24,5 +10,6 @@ public interface PsiProvidesStatement extends PsiStatement {
|
||||
PsiProvidesStatement[] EMPTY_ARRAY = new PsiProvidesStatement[0];
|
||||
|
||||
@Nullable PsiJavaCodeReferenceElement getInterfaceReference();
|
||||
@Nullable PsiClassType getInterfaceType();
|
||||
@Nullable PsiReferenceList getImplementationList();
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2017 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.
|
||||
// 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 com.intellij.psi;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -10,4 +10,5 @@ public interface PsiUsesStatement extends PsiStatement {
|
||||
PsiUsesStatement[] EMPTY_ARRAY = new PsiUsesStatement[0];
|
||||
|
||||
@Nullable PsiJavaCodeReferenceElement getClassReference();
|
||||
@Nullable PsiClassType getClassType();
|
||||
}
|
||||
@@ -1,26 +1,11 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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 com.intellij.psi.impl.compiled;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiJavaCodeReferenceElement;
|
||||
import com.intellij.psi.PsiProvidesStatement;
|
||||
import com.intellij.psi.PsiReferenceList;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.java.stubs.JavaStubElementTypes;
|
||||
import com.intellij.psi.impl.java.stubs.PsiProvidesStatementStub;
|
||||
import com.intellij.psi.impl.source.PsiClassReferenceType;
|
||||
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
|
||||
import com.intellij.psi.impl.source.tree.JavaElementType;
|
||||
import com.intellij.psi.impl.source.tree.TreeElement;
|
||||
@@ -40,6 +25,11 @@ public class ClsProvidesStatementImpl extends ClsRepositoryPsiElement<PsiProvide
|
||||
return myClassReference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiClassType getInterfaceType() {
|
||||
return new PsiClassReferenceType(myClassReference, null, PsiAnnotation.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiReferenceList getImplementationList() {
|
||||
StubElement<PsiReferenceList> stub = getStub().findChildStubByType(JavaStubElementTypes.PROVIDES_WITH_LIST);
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Copyright 2000-2017 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.
|
||||
// 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 com.intellij.psi.impl.compiled;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiAnnotation;
|
||||
import com.intellij.psi.PsiClassType;
|
||||
import com.intellij.psi.PsiJavaCodeReferenceElement;
|
||||
import com.intellij.psi.PsiUsesStatement;
|
||||
import com.intellij.psi.impl.java.stubs.PsiUsesStatementStub;
|
||||
import com.intellij.psi.impl.source.PsiClassReferenceType;
|
||||
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
|
||||
import com.intellij.psi.impl.source.tree.JavaElementType;
|
||||
import com.intellij.psi.impl.source.tree.TreeElement;
|
||||
@@ -23,6 +26,11 @@ public class ClsUsesStatementImpl extends ClsRepositoryPsiElement<PsiUsesStateme
|
||||
return myClassReference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiClassType getClassType() {
|
||||
return new PsiClassReferenceType(myClassReference, null, PsiAnnotation.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendMirrorText(int indentLevel, @NotNull StringBuilder buffer) {
|
||||
StringUtil.repeatSymbol(buffer, ' ', indentLevel);
|
||||
|
||||
@@ -24,6 +24,15 @@ public class PsiProvidesStatementImpl extends JavaStubPsiElement<PsiProvidesStat
|
||||
return PsiTreeUtil.getChildOfType(this, PsiJavaCodeReferenceElement.class);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public PsiClassType getInterfaceType() {
|
||||
PsiProvidesStatementStub stub = getStub();
|
||||
PsiJavaCodeReferenceElement ref =
|
||||
stub != null ? JavaPsiFacade.getElementFactory(getProject()).createReferenceFromText(stub.getInterface(), this) : getInterfaceReference();
|
||||
return ref != null ? new PsiClassReferenceType(ref, null, PsiAnnotation.EMPTY_ARRAY) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public PsiReferenceList getImplementationList() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2017 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.
|
||||
// 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 com.intellij.psi.impl.source;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
@@ -24,6 +24,15 @@ public class PsiUsesStatementImpl extends JavaStubPsiElement<PsiUsesStatementStu
|
||||
return PsiTreeUtil.getChildOfType(this, PsiJavaCodeReferenceElement.class);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public PsiClassType getClassType() {
|
||||
PsiUsesStatementStub stub = getStub();
|
||||
PsiJavaCodeReferenceElement ref =
|
||||
stub != null ? JavaPsiFacade.getElementFactory(getProject()).createReferenceFromText(stub.getClassName(), this) : getClassReference();
|
||||
return ref != null ? new PsiClassReferenceType(ref, null, PsiAnnotation.EMPTY_ARRAY) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
||||
if (visitor instanceof JavaElementVisitor) {
|
||||
|
||||
Reference in New Issue
Block a user