當前位置: 首頁>>代碼示例>>Java>>正文


Java IProblem.ArgumentHidingField方法代碼示例

本文整理匯總了Java中org.eclipse.jdt.core.compiler.IProblem.ArgumentHidingField方法的典型用法代碼示例。如果您正苦於以下問題:Java IProblem.ArgumentHidingField方法的具體用法?Java IProblem.ArgumentHidingField怎麽用?Java IProblem.ArgumentHidingField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jdt.core.compiler.IProblem的用法示例。


在下文中一共展示了IProblem.ArgumentHidingField方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: containsQuickFixableRenameLocal

import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
private static boolean containsQuickFixableRenameLocal(IProblemLocation[] locations) {
  if (locations != null) {
    for (int i = 0; i < locations.length; i++) {
      IProblemLocation location = locations[i];
      if (IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER.equals(location.getMarkerType())) {
        switch (location.getProblemId()) {
          case IProblem.LocalVariableHidingLocalVariable:
          case IProblem.LocalVariableHidingField:
          case IProblem.FieldHidingLocalVariable:
          case IProblem.FieldHidingField:
          case IProblem.ArgumentHidingLocalVariable:
          case IProblem.ArgumentHidingField:
            return true;
        }
      }
    }
  }
  return false;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:20,代碼來源:QuickAssistProcessor.java

示例2: addInvalidVariableNameProposals

import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
public static void addInvalidVariableNameProposals(
    IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {
  // hiding, redefined or future keyword

  CompilationUnit root = context.getASTRoot();
  ASTNode selectedNode = problem.getCoveringNode(root);
  if (selectedNode instanceof MethodDeclaration) {
    selectedNode = ((MethodDeclaration) selectedNode).getName();
  }
  if (!(selectedNode instanceof SimpleName)) {
    return;
  }
  SimpleName nameNode = (SimpleName) selectedNode;
  String valueSuggestion = null;

  String name;
  switch (problem.getProblemId()) {
    case IProblem.LocalVariableHidingLocalVariable:
    case IProblem.LocalVariableHidingField:
      name =
          Messages.format(
              CorrectionMessages.LocalCorrectionsSubProcessor_hiding_local_label,
              BasicElementLabels.getJavaElementName(nameNode.getIdentifier()));
      break;
    case IProblem.FieldHidingLocalVariable:
    case IProblem.FieldHidingField:
    case IProblem.DuplicateField:
      name =
          Messages.format(
              CorrectionMessages.LocalCorrectionsSubProcessor_hiding_field_label,
              BasicElementLabels.getJavaElementName(nameNode.getIdentifier()));
      break;
    case IProblem.ArgumentHidingLocalVariable:
    case IProblem.ArgumentHidingField:
      name =
          Messages.format(
              CorrectionMessages.LocalCorrectionsSubProcessor_hiding_argument_label,
              BasicElementLabels.getJavaElementName(nameNode.getIdentifier()));
      break;
    case IProblem.DuplicateMethod:
      name =
          Messages.format(
              CorrectionMessages.LocalCorrectionsSubProcessor_renaming_duplicate_method,
              BasicElementLabels.getJavaElementName(nameNode.getIdentifier()));
      break;

    default:
      name =
          Messages.format(
              CorrectionMessages.LocalCorrectionsSubProcessor_rename_var_label,
              BasicElementLabels.getJavaElementName(nameNode.getIdentifier()));
  }

  if (problem.getProblemId() == IProblem.UseEnumAsAnIdentifier) {
    valueSuggestion = "enumeration"; // $NON-NLS-1$
  } else {
    valueSuggestion = nameNode.getIdentifier() + '1';
  }

  LinkedNamesAssistProposal proposal =
      new LinkedNamesAssistProposal(name, context, nameNode, valueSuggestion);
  proposals.add(proposal);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:64,代碼來源:LocalCorrectionsSubProcessor.java


注:本文中的org.eclipse.jdt.core.compiler.IProblem.ArgumentHidingField方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。