本文整理汇总了Java中com.intellij.psi.HierarchicalMethodSignature类的典型用法代码示例。如果您正苦于以下问题:Java HierarchicalMethodSignature类的具体用法?Java HierarchicalMethodSignature怎么用?Java HierarchicalMethodSignature使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HierarchicalMethodSignature类属于com.intellij.psi包,在下文中一共展示了HierarchicalMethodSignature类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: collectClassingMethods
import com.intellij.psi.HierarchicalMethodSignature; //导入依赖的package包/类
@NotNull
protected static List<ClashingMethod> collectClassingMethods(@NotNull GrTypeDefinition typeDefinition) {
Collection<HierarchicalMethodSignature> visibleSignatures = typeDefinition.getVisibleSignatures();
List<ClashingMethod> clashingMethods = ContainerUtil.newArrayList();
for (HierarchicalMethodSignature signature : visibleSignatures) {
PsiMethod method = signature.getMethod();
if (method instanceof GrTraitMethod && method.getContainingClass() == typeDefinition) {
List<HierarchicalMethodSignature> superSignatures = signature.getSuperSignatures();
if (superSignatures.size() > 1) {
List<GrTypeDefinition> traits = ContainerUtil.newArrayList();
for (HierarchicalMethodSignature superSignature : superSignatures) {
PsiMethod superMethod = superSignature.getMethod();
PsiClass superClass = superMethod.getContainingClass();
if (GrTraitUtil.isTrait(superClass) &&
!superMethod.getModifierList().hasExplicitModifier(PsiModifier.ABSTRACT)) {
traits.add((GrTypeDefinition)superClass);
}
}
if (traits.size() > 1) {
clashingMethods.add(new ClashingMethod(signature, traits));
}
}
}
}
return clashingMethods;
}
示例2: execute
import com.intellij.psi.HierarchicalMethodSignature; //导入依赖的package包/类
@Override
public boolean execute(@NotNull final SuperMethodsSearch.SearchParameters queryParameters, @NotNull final Processor<MethodSignatureBackedByPsiMethod> consumer)
{
final PsiClass parentClass = queryParameters.getPsiClass();
final PsiMethod method = queryParameters.getMethod();
return ApplicationManager.getApplication().runReadAction(new Computable<Boolean>()
{
@Override
public Boolean compute()
{
HierarchicalMethodSignature signature = method.getHierarchicalMethodSignature();
final boolean checkBases = queryParameters.isCheckBases();
final boolean allowStaticMethod = queryParameters.isAllowStaticMethod();
final List<HierarchicalMethodSignature> supers = signature.getSuperSignatures();
for(HierarchicalMethodSignature superSignature : supers)
{
if(MethodSignatureUtil.isSubsignature(superSignature, signature))
{
if(!addSuperMethods(superSignature, method, parentClass, allowStaticMethod, checkBases, consumer))
{
return false;
}
}
}
return true;
}
});
}
示例3: addSuperMethods
import com.intellij.psi.HierarchicalMethodSignature; //导入依赖的package包/类
private static boolean addSuperMethods(final HierarchicalMethodSignature signature,
final PsiMethod method,
final PsiClass parentClass,
final boolean allowStaticMethod,
final boolean checkBases,
final Processor<MethodSignatureBackedByPsiMethod> consumer)
{
PsiMethod signatureMethod = signature.getMethod();
PsiClass hisClass = signatureMethod.getContainingClass();
if(parentClass == null || InheritanceUtil.isInheritorOrSelf(parentClass, hisClass, true))
{
if(isAcceptable(signatureMethod, method, allowStaticMethod))
{
if(parentClass != null && !parentClass.equals(hisClass) && !checkBases)
{
return true;
}
LOG.assertTrue(signatureMethod != method, method); // method != method.getsuper()
return consumer.process(signature); //no need to check super classes
}
}
for(HierarchicalMethodSignature superSignature : signature.getSuperSignatures())
{
if(MethodSignatureUtil.isSubsignature(superSignature, signature))
{
addSuperMethods(superSignature, method, parentClass, allowStaticMethod, checkBases, consumer);
}
}
return true;
}
示例4: checkPackageLocalInSuperClass
import com.intellij.psi.HierarchicalMethodSignature; //导入依赖的package包/类
@Nullable
private static PsiMethod checkPackageLocalInSuperClass(@NotNull PsiClass aClass) {
// super class can have package local abstract methods not accessible for overriding
PsiClass superClass = aClass.getSuperClass();
if (superClass == null) return null;
if (CommonClassNames.JAVA_LANG_OBJECT.equals(aClass.getQualifiedName())) return null;
if (JavaPsiFacade.getInstance(aClass.getProject()).arePackagesTheSame(aClass, superClass)) return null;
for (HierarchicalMethodSignature methodSignature : superClass.getVisibleSignatures()) {
PsiMethod method = methodSignature.getMethod();
if (method.hasModifierProperty(PsiModifier.ABSTRACT) && method.hasModifierProperty(PsiModifier.PACKAGE_LOCAL)) return method;
}
return null;
}
示例5: addSuperSignature
import com.intellij.psi.HierarchicalMethodSignature; //导入依赖的package包/类
public void addSuperSignature(@NotNull HierarchicalMethodSignature superSignatureHierarchical) {
if (mySupers == null) mySupers = new SmartList<HierarchicalMethodSignature>();
mySupers.add(superSignatureHierarchical);
}
示例6: getSuperSignatures
import com.intellij.psi.HierarchicalMethodSignature; //导入依赖的package包/类
@Override
@NotNull
public List<HierarchicalMethodSignature> getSuperSignatures() {
return mySupers == null ? Collections.<HierarchicalMethodSignature>emptyList() : mySupers;
}
示例7: ClashingMethod
import com.intellij.psi.HierarchicalMethodSignature; //导入依赖的package包/类
public ClashingMethod(@NotNull HierarchicalMethodSignature signature, @NotNull List<GrTypeDefinition> superTraits) {
mySignature = signature;
mySuperTraits = superTraits;
}
示例8: getSignature
import com.intellij.psi.HierarchicalMethodSignature; //导入依赖的package包/类
@NotNull
public HierarchicalMethodSignature getSignature() {
return mySignature;
}