• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PsiMethodImpl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.psi.impl.source.PsiMethodImpl的典型用法代码示例。如果您正苦于以下问题:Java PsiMethodImpl类的具体用法?Java PsiMethodImpl怎么用?Java PsiMethodImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PsiMethodImpl类属于com.intellij.psi.impl.source包,在下文中一共展示了PsiMethodImpl类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: inferContracts

import com.intellij.psi.impl.source.PsiMethodImpl; //导入依赖的package包/类
@NotNull
public static List<StandardMethodContract> inferContracts(@NotNull PsiMethodImpl method)
{
	if(!InferenceFromSourceUtil.shouldInferFromSource(method))
	{
		return Collections.emptyList();
	}

	return CachedValuesManager.getCachedValue(method, () ->
	{
		MethodData data = ContractInferenceIndexKt.getIndexedData(method);
		List<PreContract> preContracts = data == null ? Collections.emptyList() : data.getContracts();
		List<StandardMethodContract> result = RecursionManager.doPreventingRecursion(method, true, () -> postProcessContracts(method, data, preContracts));
		if(result == null)
		{
			result = Collections.emptyList();
		}
		return CachedValueProvider.Result.create(result, method, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
	});
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:21,代码来源:ContractInference.java


示例2: postProcessContracts

import com.intellij.psi.impl.source.PsiMethodImpl; //导入依赖的package包/类
@NotNull
private static List<StandardMethodContract> postProcessContracts(@NotNull PsiMethodImpl method, MethodData data, List<PreContract> rawContracts)
{
	List<StandardMethodContract> contracts = ContainerUtil.concat(rawContracts, c -> c.toContracts(method, data.methodBody(method)));
	if(contracts.isEmpty())
	{
		return Collections.emptyList();
	}

	final PsiType returnType = method.getReturnType();
	if(returnType != null && !(returnType instanceof PsiPrimitiveType))
	{
		contracts = boxReturnValues(contracts);
	}
	List<StandardMethodContract> compatible = ContainerUtil.filter(contracts, contract -> isContractCompatibleWithMethod(method, returnType, contract));
	if(compatible.size() > MAX_CONTRACT_COUNT)
	{
		LOG.debug("Too many contracts for " + PsiUtil.getMemberQualifiedName(method) + ", shrinking the list");
		return compatible.subList(0, MAX_CONTRACT_COUNT);
	}
	return compatible;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:23,代码来源:ContractInference.java


示例3: inferNullity

import com.intellij.psi.impl.source.PsiMethodImpl; //导入依赖的package包/类
public static Nullness inferNullity(PsiMethodImpl method)
{
	if(!InferenceFromSourceUtil.shouldInferFromSource(method))
	{
		return Nullness.UNKNOWN;
	}

	PsiType type = method.getReturnType();
	if(type == null || type instanceof PsiPrimitiveType)
	{
		return Nullness.UNKNOWN;
	}

	return CachedValuesManager.getCachedValue(method, () ->
	{
		MethodData data = ContractInferenceIndexKt.getIndexedData(method);
		NullityInferenceResult result = data == null ? null : data.getNullity();
		Nullness nullness = result == null ? null : RecursionManager.doPreventingRecursion(method, true, () -> result.getNullness(method, data.methodBody(method)));
		if(nullness == null)
		{
			nullness = Nullness.UNKNOWN;
		}
		return CachedValueProvider.Result.create(nullness, method, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
	});
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:26,代码来源:NullityInference.java


示例4: getInferredNullityAnnotation

import com.intellij.psi.impl.source.PsiMethodImpl; //导入依赖的package包/类
@Nullable
private PsiAnnotation getInferredNullityAnnotation(PsiMethodImpl method)
{
	NullableNotNullManager manager = NullableNotNullManager.getInstance(myProject);
	if(AnnotationUtil.findAnnotation(method, manager.getNotNulls(), true) != null || AnnotationUtil.findAnnotation(method, manager.getNullables(), true) != null)
	{
		return null;
	}

	if(NullableNotNullManager.findNullabilityDefaultInHierarchy(method, true) != null || NullableNotNullManager.findNullabilityDefaultInHierarchy(method, false) != null)
	{
		return null;
	}

	Nullness nullness = NullityInference.inferNullity(method);
	if(nullness == Nullness.NOT_NULL)
	{
		return ProjectBytecodeAnalysis.getInstance(myProject).getNotNullAnnotation();
	}
	if(nullness == Nullness.NULLABLE)
	{
		return ProjectBytecodeAnalysis.getInstance(myProject).getNullableAnnotation();
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:26,代码来源:InferredAnnotationsManagerImpl.java


示例5: createPsi

import com.intellij.psi.impl.source.PsiMethodImpl; //导入依赖的package包/类
@Override
public PsiMethod createPsi(@NotNull final ASTNode node) {
  if (node instanceof AnnotationMethodElement) {
    return new PsiAnnotationMethodImpl(node);
  }
  else {
    return new PsiMethodImpl(node);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JavaMethodElementType.java


示例6: getPsiElements

import com.intellij.psi.impl.source.PsiMethodImpl; //导入依赖的package包/类
@NotNull
public List<PsiElement> getPsiElements(StepCollector collector, PsiElement element) {
    List<PsiElement> elements = new ArrayList<>();
    if (element instanceof ConceptStepImpl)
        elements = collector.get(getConceptStepText((ConceptStepImpl) element));
    else if (element instanceof PsiMethodImpl)
        for (String alias : StepUtil.getGaugeStepAnnotationValues((PsiMethod) element))
            elements.addAll(collector.get(getStepText(alias, element)));
    else if (element instanceof SpecStepImpl) {
        elements = collector.get(getStepText((SpecStepImpl) element));
        elements.addAll(collector.get(((SpecStepImpl) element).getName()));
    }
    return elements;
}
 
开发者ID:getgauge,项目名称:Intellij-Plugin,代码行数:15,代码来源:ReferenceSearchHelper.java


示例7: createPsi

import com.intellij.psi.impl.source.PsiMethodImpl; //导入依赖的package包/类
@Override
public PsiMethod createPsi(@NotNull final ASTNode node)
{
	if(node instanceof AnnotationMethodElement)
	{
		return new PsiAnnotationMethodImpl(node);
	}
	else
	{
		return new PsiMethodImpl(node);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:13,代码来源:JavaMethodElementType.java


示例8: inferPurity

import com.intellij.psi.impl.source.PsiMethodImpl; //导入依赖的package包/类
public static boolean inferPurity(@NotNull PsiMethodImpl method)
{
	if(!InferenceFromSourceUtil.shouldInferFromSource(method) || PsiType.VOID.equals(method.getReturnType()) || method.isConstructor())
	{
		return false;
	}

	return CachedValuesManager.getCachedValue(method, () ->
	{
		MethodData data = ContractInferenceIndexKt.getIndexedData(method);
		PurityInferenceResult result = data == null ? null : data.getPurity();
		Boolean pure = RecursionManager.doPreventingRecursion(method, true, () -> result != null && result.isPure(method, data.methodBody(method)));
		return CachedValueProvider.Result.create(pure == Boolean.TRUE, method);
	});
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:16,代码来源:PurityInference.java


示例9: methodBody

import com.intellij.psi.impl.source.PsiMethodImpl; //导入依赖的package包/类
public Supplier<PsiCodeBlock> methodBody(PsiMethodImpl method)
{
	return () ->
	{
		PsiMethodStub stub = method.getStub();
		if(stub != null)
		{
			return CachedValuesManager.getCachedValue(method, () -> new CachedValueProvider.Result<>(getDetachedBody(method), method));
		}
		else
		{
			return method.getBody();
		}
	};
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:16,代码来源:MethodData.java


示例10: getInferredContractAnnotation

import com.intellij.psi.impl.source.PsiMethodImpl; //导入依赖的package包/类
@Nullable
private PsiAnnotation getInferredContractAnnotation(PsiMethodImpl method)
{
	if(method.getModifierList().findAnnotation(ORG_JETBRAINS_ANNOTATIONS_CONTRACT) != null)
	{
		return null;
	}

	return createContractAnnotation(ContractInference.inferContracts(method), PurityInference.inferPurity(method));
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:11,代码来源:InferredAnnotationsManagerImpl.java


示例11: shouldInferFromSource

import com.intellij.psi.impl.source.PsiMethodImpl; //导入依赖的package包/类
static boolean shouldInferFromSource(@NotNull PsiMethodImpl method)
{
	return CachedValuesManager.getCachedValue(method, () -> CachedValueProvider.Result.create(calcShouldInferFromSource(method), method, PsiModificationTracker
			.JAVA_STRUCTURE_MODIFICATION_COUNT));
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:6,代码来源:InferenceFromSourceUtil.java


示例12: getIndexedData

import com.intellij.psi.impl.source.PsiMethodImpl; //导入依赖的package包/类
public static MethodData getIndexedData(PsiMethodImpl method)
{
	Map<Integer, MethodData> map = ourMethodDataPsiFileGist.getFileData(method.getContainingFile());
	return map == null ? null : map.get(methodIndex(method));
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:6,代码来源:ContractInferenceIndexKt.java



注:本文中的com.intellij.psi.impl.source.PsiMethodImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RenderOption类代码示例发布时间:2022-05-23
下一篇:
Java VertexBufferObjectAttributes类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap