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