private boolean requireAST() { boolean addAnotations= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS); return addAnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE) || addAnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED) || isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES); }
private boolean requireAST() { boolean addAnotations= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS); return addAnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE) || addAnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED) || isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES); }
/** * {@inheritDoc} */ public boolean requireAST(ICompilationUnit unit) throws CoreException { boolean addAnotations= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS); return addAnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE) || addAnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED) || isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES); }
/** * {@inheritDoc} */ public IFix createFix(CompilationUnit compilationUnit, IProblemLocation[] problems) throws CoreException { if (compilationUnit == null) return null; return Java50Fix.createCleanUp(compilationUnit, problems, isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE), isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED), isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES)); }
@Override protected ICleanUpFix createFix(CompilationUnit compilationUnit, IProblemLocation[] problems) throws CoreException { if (compilationUnit == null) return null; boolean addAnnotations= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS); boolean addOverride= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE); return Java50Fix.createCleanUp(compilationUnit, problems, addAnnotations && addOverride, addAnnotations && addOverride && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION), addAnnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED), isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES)); }
@Override protected ICleanUpFix createFix(CompilationUnit compilationUnit) throws CoreException { boolean addAnotations= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS); boolean addOverride= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE); return Java50Fix.createCleanUp(compilationUnit, addAnotations && addOverride, addAnotations && addOverride && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION), addAnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED), isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES)); }
public IFix createFix(CompilationUnit compilationUnit) throws CoreException { if (compilationUnit == null) return null; boolean addAnotations= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS); return Java50Fix.createCleanUp(compilationUnit, addAnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE), addAnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED), isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES)); }
@Override protected ICleanUpFix createFix(CompilationUnit compilationUnit) throws CoreException { boolean addAnotations= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS); boolean addOverride= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE); return Java50Fix.createCleanUp(compilationUnit, addAnotations && addOverride, addAnotations && addOverride && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION), addAnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED), isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES)); }
@Override protected ICleanUpFix createFix(CompilationUnit compilationUnit, IProblemLocation[] problems) throws CoreException { if (compilationUnit == null) return null; boolean addAnnotations= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS); boolean addOverride= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE); return Java50Fix.createCleanUp(compilationUnit, problems, addAnnotations && addOverride, addAnnotations && addOverride && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION), addAnnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED), isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES)); }
public Map getRequiredOptions() { Map options= new Hashtable(); if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE)) options.put(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION, JavaCore.WARNING); if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED)) options.put(JavaCore.COMPILER_PB_MISSING_DEPRECATED_ANNOTATION, JavaCore.WARNING); if (isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES)) options.put(JavaCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaCore.WARNING); return options; }
private Map<String, String> getRequiredOptions() { Map<String, String> result= new Hashtable<>(); if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE)) { result.put(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION, JavaCore.WARNING); if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION)) { result.put(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION_FOR_INTERFACE_METHOD_IMPLEMENTATION, JavaCore.ENABLED); } } if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED)) result.put(JavaCore.COMPILER_PB_MISSING_DEPRECATED_ANNOTATION, JavaCore.WARNING); if (isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES)) result.put(JavaCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaCore.WARNING); return result; }
/** * {@inheritDoc} */ public String[] getDescriptions() { List result= new ArrayList(); if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE)) result.add(MultiFixMessages.Java50MultiFix_AddMissingOverride_description); if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED)) result.add(MultiFixMessages.Java50MultiFix_AddMissingDeprecated_description); if (isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES)) result.add(MultiFixMessages.Java50CleanUp_AddTypeParameters_description); return (String[])result.toArray(new String[result.size()]); }
private Map<String, String> getRequiredOptions() { Map<String, String> result= new Hashtable<>(); if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE)) { result.put(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION, JavaCore.WARNING); if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION)) { result.put(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION_FOR_INTERFACE_METHOD_IMPLEMENTATION, JavaCore.ENABLED); } } if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED)) result.put(JavaCore.COMPILER_PB_MISSING_DEPRECATED_ANNOTATION, JavaCore.WARNING); if (isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES)) result.put(JavaCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaCore.WARNING); return result; }
@Override public String[] getStepDescriptions() { List<String> result= new ArrayList<>(); if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE)) { result.add(MultiFixMessages.Java50MultiFix_AddMissingOverride_description); if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION)) { result.add(MultiFixMessages.Java50MultiFix_AddMissingOverride_description2); } } if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED)) result.add(MultiFixMessages.Java50MultiFix_AddMissingDeprecated_description); if (isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES)) result.add(MultiFixMessages.Java50CleanUp_AddTypeParameters_description); return result.toArray(new String[result.size()]); }
@Override public String[] getStepDescriptions() { List<String> result= new ArrayList<>(); if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE)) { result.add(MultiFixMessages.Java50MultiFix_AddMissingOverride_description); if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION)) { result.add(MultiFixMessages.Java50MultiFix_AddMissingOverride_description2); } } if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED)) result.add(MultiFixMessages.Java50MultiFix_AddMissingDeprecated_description); if (isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES)) result.add(MultiFixMessages.Java50CleanUp_AddTypeParameters_description); return result.toArray(new String[result.size()]); }
@Override public boolean canFix(ICompilationUnit compilationUnit, IProblemLocation problem) { int id= problem.getProblemId(); if (Java50Fix.isMissingOverrideAnnotationProblem(id)) { if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE)) { return ! Java50Fix.isMissingOverrideAnnotationInterfaceProblem(id) || isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION); } } else if (Java50Fix.isMissingDeprecationProblem(id)) { return isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED); } else if (Java50Fix.isRawTypeReferenceProblem(id)) { return isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES); } return false; }
@Override public boolean canFix(ICompilationUnit compilationUnit, IProblemLocation problem) { int id= problem.getProblemId(); if (Java50Fix.isMissingOverrideAnnotationProblem(id)) { if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE)) { return ! Java50Fix.isMissingOverrideAnnotationInterfaceProblem(id) || isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION); } } else if (Java50Fix.isMissingDeprecationProblem(id)) { return isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED); } else if (Java50Fix.isRawTypeReferenceProblem(id)) { return isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES); } return false; }
/** * {@inheritDoc} */ public boolean canFix(CompilationUnit compilationUnit, IProblemLocation problem) throws CoreException { if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE)) { Java50Fix fix= Java50Fix.createAddOverrideAnnotationFix(compilationUnit, problem); if (fix != null) return true; } if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED)) { Java50Fix fix= Java50Fix.createAddDeprectatedAnnotation(compilationUnit, problem); if (fix != null) return true; } if (isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES)) { Java50Fix fix= Java50Fix.createRawTypeReferenceFix(compilationUnit, problem); if (fix != null) return true; } return false; }
@Override public int computeNumberOfFixes(CompilationUnit compilationUnit) { int result= 0; boolean addAnnotations= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS); boolean addMissingOverride= addAnnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE); boolean addMissingOverrideInterfaceMethods= addMissingOverride && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION); boolean addMissingDeprecated= addAnnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED); boolean useTypeArgs= isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES); IProblem[] problems= compilationUnit.getProblems(); for (int i= 0; i < problems.length; i++) { int id= problems[i].getID(); if (addMissingOverride && Java50Fix.isMissingOverrideAnnotationProblem(id)) if (! Java50Fix.isMissingOverrideAnnotationInterfaceProblem(id) || addMissingOverrideInterfaceMethods) result++; if (addMissingDeprecated && Java50Fix.isMissingDeprecationProblem(id)) result++; if (useTypeArgs && Java50Fix.isRawTypeReferenceProblem(id)) result++; } return result; }
@Override public int computeNumberOfFixes(CompilationUnit compilationUnit) { int result= 0; boolean addAnnotations= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS); boolean addMissingOverride= addAnnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE); boolean addMissingOverrideInterfaceMethods= addMissingOverride && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION); boolean addMissingDeprecated= addAnnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED); boolean useTypeArgs= isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES); IProblem[] problems= compilationUnit.getProblems(); for (int i= 0; i < problems.length; i++) { int id= problems[i].getID(); if (addMissingOverride && Java50Fix.isMissingOverrideAnnotationProblem(id)) if (! Java50Fix.isMissingOverrideAnnotationInterfaceProblem(id) || addMissingOverrideInterfaceMethods) result++; if (addMissingDeprecated && Java50Fix.isMissingDeprecationProblem(id)) result++; if (useTypeArgs && Java50Fix.isRawTypeReferenceProblem(id)) result++; } return result; }