当前位置: 首页>>代码示例>>Java>>正文


Java VariableAccessUtils.variableIsReturned方法代码示例

本文整理汇总了Java中com.siyeh.ig.psiutils.VariableAccessUtils.variableIsReturned方法的典型用法代码示例。如果您正苦于以下问题:Java VariableAccessUtils.variableIsReturned方法的具体用法?Java VariableAccessUtils.variableIsReturned怎么用?Java VariableAccessUtils.variableIsReturned使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.siyeh.ig.psiutils.VariableAccessUtils的用法示例。


在下文中一共展示了VariableAccessUtils.variableIsReturned方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkVariable

import com.siyeh.ig.psiutils.VariableAccessUtils; //导入方法依赖的package包/类
private static boolean checkVariable(PsiVariable variable,
                                     PsiElement context) {
  if (context == null) {
    return false;
  }
  final PsiType type = variable.getType();
  if (type.getArrayDimensions() == 0) {
    return false;
  }
  if (VariableAccessUtils.variableIsAssigned(variable, context)) {
    return false;
  }
  if (VariableAccessUtils.variableIsAssignedFrom(variable, context)) {
    return false;
  }
  if (VariableAccessUtils.variableIsReturned(variable, context)) {
    return false;
  }
  return !VariableAccessUtils.variableIsUsedInArrayInitializer(variable, context);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:MismatchedArrayReadWriteInspection.java

示例2: checkVariable

import com.siyeh.ig.psiutils.VariableAccessUtils; //导入方法依赖的package包/类
private boolean checkVariable(PsiVariable variable, PsiElement context) {
  if (context == null) {
    return false;
  }
  final PsiType type = variable.getType();
  if (!CollectionUtils.isCollectionClassOrInterface(type)) {
    return false;
  }
  if (VariableAccessUtils.variableIsAssignedFrom(variable, context)) {
    return false;
  }
  if (VariableAccessUtils.variableIsReturned(variable, context)) {
    return false;
  }
  return !VariableAccessUtils.variableIsUsedInArrayInitializer(variable, context);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:MismatchedCollectionQueryUpdateInspectionBase.java

示例3: checkVariable

import com.siyeh.ig.psiutils.VariableAccessUtils; //导入方法依赖的package包/类
private static boolean checkVariable(PsiVariable variable, PsiElement context) {
  if (context == null) {
    return false;
  }
  if (!TypeUtils.variableHasTypeOrSubtype(variable, CommonClassNames.JAVA_LANG_ABSTRACT_STRING_BUILDER)) {
    return false;
  }
  if (VariableAccessUtils.variableIsAssigned(variable, context)) {
    return false;
  }
  if (VariableAccessUtils.variableIsAssignedFrom(variable, context)) {
    return false;
  }
  if (VariableAccessUtils.variableIsReturned(variable, context)) {
    return false;
  }
  if (VariableAccessUtils.variableIsPassedAsMethodArgument(variable, context)) {
    return false;
  }
  return !VariableAccessUtils.variableIsUsedInArrayInitializer(variable, context);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:MismatchedStringBuilderQueryUpdateInspection.java

示例4: checkVariable

import com.siyeh.ig.psiutils.VariableAccessUtils; //导入方法依赖的package包/类
private static boolean checkVariable(PsiVariable variable,
                                     PsiElement context) {
  if (context == null) {
    return false;
  }
  final PsiType type = variable.getType();
  if (type.getArrayDimensions() == 0) {
    return false;
  }
  if (VariableAccessUtils.variableIsAssigned(variable, context)) {
    return false;
  }
  if (VariableAccessUtils.variableIsAssignedFrom(variable, context)) {
    return false;
  }
  if (VariableAccessUtils.variableIsReturned(variable, context)) {
    return false;
  }
  return !VariableAccessUtils.variableIsUsedInArrayInitializer(
    variable, context);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:MismatchedArrayReadWriteInspection.java

示例5: checkVariable

import com.siyeh.ig.psiutils.VariableAccessUtils; //导入方法依赖的package包/类
private boolean checkVariable(PsiVariable variable, PsiElement context) {
  if (context == null) {
    return false;
  }
  final PsiType type = variable.getType();
  if (!CollectionUtils.isCollectionClassOrInterface(type)) {
    return false;
  }
  if (VariableAccessUtils.variableIsAssignedFrom(variable, context)) {
    return false;
  }
  if (VariableAccessUtils.variableIsReturned(variable, context)) {
    return false;
  }
  if (VariableAccessUtils.variableIsPassedAsMethodArgument(variable, context)) {
    return false;
  }
  return !VariableAccessUtils.variableIsUsedInArrayInitializer(variable, context);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:MismatchedCollectionQueryUpdateInspectionBase.java

示例6: isReplaceableStringBuffer

import com.siyeh.ig.psiutils.VariableAccessUtils; //导入方法依赖的package包/类
private static boolean isReplaceableStringBuffer(PsiVariable variable, PsiElement context) {
  if (context == null) {
    return false;
  }
  final PsiType type = variable.getType();
  if (!TypeUtils.typeEquals(CommonClassNames.JAVA_LANG_STRING_BUFFER, type)) {
    return false;
  }
  final PsiExpression initializer = variable.getInitializer();
  if (initializer == null) {
    return false;
  }
  if (getNewStringBuffer(initializer) == null) {
    return false;
  }
  if (VariableAccessUtils.variableIsAssigned(variable, context)) {
    return false;
  }
  if (VariableAccessUtils.variableIsAssignedFrom(variable, context)) {
    return false;
  }
  if (VariableAccessUtils.variableIsReturned(variable, context, true)) {
    return false;
  }
  if (VariableAccessUtils.variableIsPassedAsMethodArgument(variable, excludes, context, true)) {
    return false;
  }
  if (VariableAccessUtils.variableIsUsedInInnerClass(variable, context)) {
    return false;
  }
  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:33,代码来源:StringBufferReplaceableByStringBuilderInspection.java

示例7: visitLocalVariable

import com.siyeh.ig.psiutils.VariableAccessUtils; //导入方法依赖的package包/类
@Override
public void visitLocalVariable(@NotNull PsiLocalVariable variable) {
  super.visitLocalVariable(variable);
  final PsiCodeBlock codeBlock = PsiTreeUtil.getParentOfType(variable, PsiCodeBlock.class);
  if (codeBlock == null) {
    return;
  }
  final PsiType type = variable.getType();
  if (!TypeUtils.typeEquals(CommonClassNames.JAVA_LANG_STRING_BUFFER, type) &&
      !TypeUtils.typeEquals(CommonClassNames.JAVA_LANG_STRING_BUILDER, type)) {
    return;
  }
  final PsiExpression initializer = variable.getInitializer();
  if (initializer == null) {
    return;
  }
  if (!isNewStringBufferOrStringBuilder(initializer)) {
    return;
  }
  if (VariableAccessUtils.variableIsAssigned(variable, codeBlock)) {
    return;
  }
  if (VariableAccessUtils.variableIsAssignedFrom(variable, codeBlock)) {
    return;
  }
  if (VariableAccessUtils.variableIsReturned(variable, codeBlock)) {
    return;
  }
  if (VariableAccessUtils.variableIsPassedAsMethodArgument(variable, codeBlock)) {
    return;
  }
  if (variableIsModified(variable, codeBlock)) {
    return;
  }
  registerVariableError(variable, variable, type);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:37,代码来源:StringBufferReplaceableByStringInspection.java

示例8: isReplaceableStringBuffer

import com.siyeh.ig.psiutils.VariableAccessUtils; //导入方法依赖的package包/类
private static boolean isReplaceableStringBuffer(PsiVariable variable, PsiElement context) {
  if (context == null) {
    return false;
  }
  final PsiType type = variable.getType();
  if (!TypeUtils.typeEquals(CommonClassNames.JAVA_LANG_STRING_BUFFER, type)) {
    return false;
  }
  final PsiExpression initializer = variable.getInitializer();
  if (initializer == null) {
    return false;
  }
  if (getNewStringBuffer(initializer) == null) {
    return false;
  }
  if (VariableAccessUtils.variableIsAssigned(variable, context)) {
    return false;
  }
  if (VariableAccessUtils.variableIsAssignedFrom(variable, context)) {
    return false;
  }
  if (VariableAccessUtils.variableIsReturned(variable, context, true)) {
    return false;
  }
  if (VariableAccessUtils.variableIsUsedInInnerClass(variable, context)) {
    return false;
  }
  if (VariableAccessUtils.variableIsPassedAsMethodArgument(variable, context, true, new Processor<PsiCall>() {
    @Override
    public boolean process(PsiCall call) {
      final PsiMethod method = call.resolveMethod();
      if (method == null) {
        return false;
      }
      final PsiClass aClass = method.getContainingClass();
      return aClass != null && excludes.contains(aClass.getQualifiedName());
    }
  })) {
    return false;
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:43,代码来源:StringBufferReplaceableByStringBuilderInspection.java


注:本文中的com.siyeh.ig.psiutils.VariableAccessUtils.variableIsReturned方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。