/** * Creates a problem id from the composite members of a problem id. * * @param category * @param element * @param kind * @param flags * @return a new problem id */ public static int createProblemId(int category, int element, int kind, int flags) { return category | element << IApiProblem.OFFSET_ELEMENT | kind << IApiProblem.OFFSET_KINDS | flags << IApiProblem.OFFSET_FLAGS | getProblemMessageId(category, element, kind, flags); }
@Override public String getMessage() { if (fMessage == null) { fMessage = ApiProblemFactory.getLocalizedMessage(this); } return fMessage; }
/** * Creates a new {@link IApiProblemFilter} * * @param componentid * @param problem * @param comment * @return the new {@link IApiProblemFilter} * @since 1.1 */ public static IApiProblemFilter newProblemFilter(String componentid, IApiProblem problem, String comment) { return new ApiProblemFilter(componentid, problem, comment); }
/** * Convenience method to get the message id from a problem id * * @param problemid * @return the message id to use for the given problem id */ public static int getProblemMessageId(int problemid) { return getProblemMessageId(getProblemCategory(problemid), getProblemElementKind(problemid), getProblemKind(problemid), getProblemFlags(problemid)); }
/** * Creates a new fatal {@link IApiProblem} * * @param resourcepath the path to the resource this problem was found in * @param messageargs listing of arguments to pass in to the localized * message. The arguments are passed into the string in the order * they appear in the array. * @param kind the kind * @return a new {@link IApiProblem} for API usage */ public static IApiProblem newFatalProblem(String resourcepath, String[] messageargs, int kind) { int id = createProblemId(IApiProblem.CATEGORY_FATAL_PROBLEM, IElementDescriptor.RESOURCE, kind, IApiProblem.NO_FLAGS); return newApiProblem(resourcepath, null, messageargs, null, null, -1, -1, -1, id); }
public static String getComponentResolutionKey(int id) { int problemKind = ApiProblemFactory.getProblemKind(id); switch (problemKind) { case IApiProblem.API_COMPONENT_RESOLUTION: return IApiProblemTypes.REPORT_RESOLUTION_ERRORS_API_COMPONENT; case IApiProblem.UNUSED_PROBLEM_FILTERS: return IApiProblemTypes.UNUSED_PROBLEM_FILTERS; default: break; } return null; }
public static boolean hasExplainProblemResolution(IMarker marker) { int id = ApiProblemFactory.getProblemId(marker); if (id > -1) { if( id == ApiProblemFactory.createProblemId(IApiProblem.CATEGORY_COMPATIBILITY, IDelta.CLASS_ELEMENT_TYPE, IDelta.ADDED, IDelta.FIELD) || id == ApiProblemFactory.createProblemId(IApiProblem.CATEGORY_COMPATIBILITY, IDelta.INTERFACE_ELEMENT_TYPE, IDelta.ADDED, IDelta.FIELD) || id == ApiProblemFactory.createProblemId(IApiProblem.CATEGORY_COMPATIBILITY, IDelta.INTERFACE_ELEMENT_TYPE, IDelta.ADDED, IDelta.DEFAULT_METHOD)) { return true; } } return false; } }
@Override public int hashCode() { return getId() + (fResourcePath != null ? fResourcePath.hashCode() : 0) + argumentsHashcode(fMessageArguments) + (fTypeName != null ? fTypeName.hashCode() : 0); }
/** * Creates a new {@link IApiProblem} * * @param resourcepath the path to the resource this problem was found in * @param typeName the type name this problem was found in * @param messageargs listing of arguments to pass in to the localized * message. The arguments are passed into the string in the order * they appear in the array. * @param argumentids the ids of arguments passed into the problem * @param arguments the arguments that correspond to the listing of ids * @param linenumber the number of the line the problem occurred on * @param charstart the start of a char selection range * @param charend the end of a char selection range * @param id the composite id of the problem * @return a new {@link IApiProblem} */ public static IApiProblem newApiProblem(String resourcepath, String typeName, String[] messageargs, String[] argumentids, Object[] arguments, int linenumber, int charstart, int charend, int id) { return new ApiProblem(resourcepath, typeName, messageargs, argumentids, arguments, linenumber, charstart, charend, id); }
@Override public int getSeverity() { if (ApiPlugin.isRunningInFramework()) { return ApiPlugin.getDefault().getSeverityLevel(ApiProblemFactory.getProblemSeverityId(this), null); } return ApiPlugin.SEVERITY_WARNING; }
/** * Creates a new API baseline {@link IApiProblem} * * @param resourcepath the path to the resource this problem was found in * The arguments are passed into the string in the order they * appear in the array. * @param argumentids the ids of arguments passed into the problem * @param arguments the arguments that correspond to the listing of ids * @param element the element kind * @param kind the kind * @return a new {@link IApiProblem} for API usage */ public static IApiProblem newApiBaselineProblem(String resourcepath, String[] argumentids, Object[] arguments, int element, int kind) { int id = createProblemId(IApiProblem.CATEGORY_API_BASELINE, element, kind, IApiProblem.NO_FLAGS); return newApiProblem(resourcepath, null, null, argumentids, arguments, -1, -1, -1, id); }
public static String getAPIUseScanKey(int id) { int problemKind = ApiProblemFactory.getProblemKind(id); switch (problemKind) { case IApiProblem.API_USE_SCAN_TYPE_PROBLEM: return IApiProblemTypes.API_USE_SCAN_TYPE_SEVERITY; case IApiProblem.API_USE_SCAN_METHOD_PROBLEM: return IApiProblemTypes.API_USE_SCAN_METHOD_SEVERITY; case IApiProblem.API_USE_SCAN_FIELD_PROBLEM: return IApiProblemTypes.API_USE_SCAN_FIELD_SEVERITY; default: break; } return null; }
@Override public Object clone() { return new ApiProblemFilter(this.fComponentId, fProblem, fComment); }
/** * Creates a new API component resolution {@link IApiProblem} * * @param resourcepath the path to the resource this problem was found in * @param messageargs listing of arguments to pass in to the localized * message. The arguments are passed into the string in the order * they appear in the array. * @param argumentids the ids of arguments passed into the problem * @param arguments the arguments that correspond to the listing of ids * @param element the element kind * @param kind the kind * @return a new {@link IApiProblem} for API usage */ public static IApiProblem newApiComponentResolutionProblem(String resourcepath, String[] messageargs, String[] argumentids, Object[] arguments, int element, int kind) { int id = createProblemId(IApiProblem.CATEGORY_API_COMPONENT_RESOLUTION, element, kind, IApiProblem.NO_FLAGS); return newApiProblem(resourcepath, null, messageargs, argumentids, arguments, -1, -1, -1, id); }
public SinceTagResolution(IMarker marker) { this.kind = ApiProblemFactory.getProblemKind(marker.getAttribute(IApiMarkerConstants.MARKER_ATTR_PROBLEM_ID, 0)); this.newVersionValue = (String) marker.getAttribute(IApiMarkerConstants.MARKER_ATTR_VERSION, null); } /* (non-Javadoc)
/** * Creates a new since tag {@link IApiProblem} * * @param resourcepath the path to the resource this problem was found in * @param typeName the type name this problem was found in * @param messageargs listing of arguments to pass in to the localized * message. The arguments are passed into the string in the order * they appear in the array. * @param argumentids the ids of arguments passed into the problem * @param arguments the arguments that correspond to the listing of ids * @param linenumber the number of the line the problem occurred on * @param charstart the start of a char selection range * @param charend the end of a char selection range * @param element the element kind * @param kind the kind * @return a new {@link IApiProblem} for since tags */ public static IApiProblem newApiSinceTagProblem(String resourcepath, String typeName, String[] messageargs, String[] argumentids, Object[] arguments, int linenumber, int charstart, int charend, int element, int kind) { int id = createProblemId(IApiProblem.CATEGORY_SINCETAGS, element, kind, IApiProblem.NO_FLAGS); return newApiProblem(resourcepath, typeName, messageargs, argumentids, arguments, linenumber, charstart, charend, id); }
public SinceTagResolution(IMarker marker) { this.kind = ApiProblemFactory.getProblemKind(marker.getAttribute(IApiMarkerConstants.MARKER_ATTR_PROBLEM_ID, 0)); this.newVersionValue = marker.getAttribute(IApiMarkerConstants.MARKER_ATTR_VERSION, null); }
/** * Creates a new version number {@link IApiProblem} * * @param resourcepath the path to the resource this problem was found in * @param typeName the type name this problem was found in * @param messageargs listing of arguments to pass in to the localized * message. The arguments are passed into the string in the order * they appear in the array. * @param argumentids the ids of arguments passed into the problem * @param arguments the arguments that correspond to the listing of ids * @param linenumber the number of the line the problem occurred on * @param charstart the start of a char selection range * @param charend the end of a char selection range * @param element the element kind * @param kind the kind * @return a new {@link IApiProblem} for version numbers */ public static IApiProblem newApiVersionNumberProblem(String resourcepath, String typeName, String[] messageargs, String[] argumentids, Object[] arguments, int linenumber, int charstart, int charend, int element, int kind) { int id = createProblemId(IApiProblem.CATEGORY_VERSION, element, kind, IApiProblem.NO_FLAGS); return newApiProblem(resourcepath, typeName, messageargs, argumentids, arguments, linenumber, charstart, charend, id); }
public VersionNumberingResolution(IMarker marker) { this.newVersionValue = marker.getAttribute(IApiMarkerConstants.MARKER_ATTR_VERSION, null); this.kind = ApiProblemFactory.getProblemKind(marker.getAttribute(IApiMarkerConstants.MARKER_ATTR_PROBLEM_ID, 0)); this.description = marker.getAttribute(IApiMarkerConstants.VERSION_NUMBERING_ATTR_DESCRIPTION, null); }
public VersionNumberingResolution(IMarker marker) { this.newVersionValue = marker.getAttribute(IApiMarkerConstants.MARKER_ATTR_VERSION, null); this.kind = ApiProblemFactory.getProblemKind(marker.getAttribute(IApiMarkerConstants.MARKER_ATTR_PROBLEM_ID, 0)); this.description = marker.getAttribute(IApiMarkerConstants.VERSION_NUMBERING_ATTR_DESCRIPTION, null); }