/** * {@inheritDoc} */ public boolean requireAST(ICompilationUnit unit) throws CoreException { return isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS); }
public Map getRequiredOptions() { Map options= new Hashtable(); if (isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS)) options.put(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK, JavaCore.WARNING); return options; }
private Map<String, String> getRequiredOptions() { Map<String, String> result= new Hashtable<>(); if (isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS)) result.put(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK, JavaCore.WARNING); return result; }
private Map<String, String> getRequiredOptions() { Map<String, String> result= new Hashtable<>(); if (isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS)) result.put(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK, JavaCore.WARNING); return result; }
@Override public String[] getStepDescriptions() { List<String> result= new ArrayList<>(); if (isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS)) result.add(MultiFixMessages.UnusedCodeCleanUp_RemoveUnusedCasts_description); return result.toArray(new String[result.size()]); }
@Override public String getPreview() { StringBuilder buf= new StringBuilder(); if (isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS)) { buf.append("Boolean b= Boolean.TRUE;\n"); //$NON-NLS-1$ } else { buf.append("Boolean b= (Boolean) Boolean.TRUE;\n"); //$NON-NLS-1$ } return buf.toString(); }
@Override public String[] getStepDescriptions() { List<String> result= new ArrayList<>(); if (isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS)) result.add(MultiFixMessages.UnusedCodeCleanUp_RemoveUnusedCasts_description); return result.toArray(new String[result.size()]); }
@Override public String getPreview() { StringBuffer buf= new StringBuffer(); if (isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS)) { buf.append("Boolean b= Boolean.TRUE;\n"); //$NON-NLS-1$ } else { buf.append("Boolean b= (Boolean) Boolean.TRUE;\n"); //$NON-NLS-1$ } return buf.toString(); }
/** * {@inheritDoc} */ public String[] getDescriptions() { List result= new ArrayList(); if (isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS)) result.add(MultiFixMessages.UnusedCodeCleanUp_RemoveUnusedCasts_description); return (String[])result.toArray(new String[result.size()]); }
@Override protected ICleanUpFix createFix(CompilationUnit compilationUnit) throws CoreException { return UnusedCodeFix.createCleanUp(compilationUnit, false, false, false, false, false, false, isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS)); }
@Override public boolean canFix(ICompilationUnit compilationUnit, IProblemLocation problem) { if (problem.getProblemId() == IProblem.UnnecessaryCast) return isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS); return false; }
public IFix createFix(CompilationUnit compilationUnit) throws CoreException { if (compilationUnit == null) return null; return UnusedCodeFix.createCleanUp(compilationUnit, false, false, false, false, false, false, isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS)); }
@Override protected ICleanUpFix createFix(CompilationUnit compilationUnit, IProblemLocation[] problems) throws CoreException { return UnusedCodeFix.createCleanUp(compilationUnit, problems, false, false, false, false, false, false, isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS)); }
@Override protected ICleanUpFix createFix(CompilationUnit compilationUnit, IProblemLocation[] problems) throws CoreException { return UnusedCodeFix.createCleanUp(compilationUnit, problems, false, false, false, false, false, false, isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS)); }
/** * {@inheritDoc} */ public boolean canFix(CompilationUnit compilationUnit, IProblemLocation problem) throws CoreException { if (isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS)) { IFix fix= UnusedCodeFix.createRemoveUnusedCastFix(compilationUnit, problem); if (fix != null) return true; } return false; }
@Override public CleanUpRequirements getRequirements() { boolean requireAST= isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS); Map<String, String> requiredOptions= requireAST ? getRequiredOptions() : null; return new CleanUpRequirements(requireAST, false, false, requiredOptions); }
@Override public int computeNumberOfFixes(CompilationUnit compilationUnit) { int result= 0; IProblem[] problems= compilationUnit.getProblems(); if (isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS)) result+= getNumberOfProblems(problems, IProblem.UnnecessaryCast); return result; } }
/** * {@inheritDoc} */ public int maximalNumberOfFixes(CompilationUnit compilationUnit) { int result= 0; IProblem[] problems= compilationUnit.getProblems(); if (isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS)) result+= getNumberOfProblems(problems, IProblem.UnnecessaryCast); return result; } }
@Override public CleanUpRequirements getRequirements() { boolean requireAST= isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS); Map<String, String> requiredOptions= requireAST ? getRequiredOptions() : null; return new CleanUpRequirements(requireAST, false, false, requiredOptions); }
@Override public int computeNumberOfFixes(CompilationUnit compilationUnit) { int result= 0; IProblem[] problems= compilationUnit.getProblems(); if (isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_CASTS)) result+= getNumberOfProblems(problems, IProblem.UnnecessaryCast); return result; } }