/** * Returns the complete listing of supported tags for the given type and * member * * @param type * @param member * @return the list of supported tag names or the * {@link Collections#EMPTY_SET}, never <code>null</code> * @since 1.0.400 */ Set<String> getSupportedTagNames(int type, int member) { IApiJavadocTag[] tags = ApiPlugin.getJavadocTagManager().getTagsForType(type, member); if (tags.length > 0) { HashSet<String> valid = new HashSet<>(tags.length, 1); for (IApiJavadocTag tag : tags) { valid.add(tag.getTagName()); } return valid; } return Collections.EMPTY_SET; }
public boolean visit(Javadoc node) { Set tagnames = ApiPlugin.getJavadocTagManager().getAllTagNames(); List tags = node.tags(); if(fExistingTags == null) { fExistingTags = new HashMap(tags.size()); } TagElement tag = null; String name = null; for(Iterator iter = tags.iterator(); iter.hasNext();) { tag = (TagElement) iter.next(); name = tag.getTagName(); if(name == null) { continue; } if(tagnames.contains(name)) { //only add existing API tools tags fExistingTags.put(name, Boolean.valueOf(tag.fragments().isEmpty())); } } return false; } }
@Override public boolean visit(Javadoc node) { Set<String> tagnames = ApiPlugin.getJavadocTagManager().getAllTagNames(); List<TagElement> tags = node.tags(); if (fExistingTags == null) { fExistingTags = new HashMap<>(tags.size()); } String name = null; for (TagElement tag : tags) { name = tag.getTagName(); if (name == null) { continue; } if (tagnames.contains(name)) { // only add existing API tools tags fExistingTags.put(name, Boolean.valueOf(tag.fragments().isEmpty())); } } return false; } }
/** * Checks the annotation that appears on the given parent * * @param node the annotation * @param type the parent */ void checkEnum(MarkerAnnotation node, EnumDeclaration type) { String name = node.getTypeName().getFullyQualifiedName(); Item item = getItem(); if (fProcessedAnnotations.contains(name)) { createAnnotationProblem(item.typename, node, IElementDescriptor.TYPE, IApiProblem.DUPLICATE_ANNOTATION_USE, IApiMarkerConstants.DUPLICATE_ANNOTATION_MARKER_ID, null); } else { Set<String> supported = ApiPlugin.getJavadocTagManager().getAnntationsForType(IApiJavadocTag.TYPE_ENUM, IApiJavadocTag.MEMBER_NONE); if (!supported.contains(name)) { createAnnotationProblem(item.typename, node, IElementDescriptor.TYPE, IApiProblem.UNSUPPORTED_ANNOTATION_USE, IApiMarkerConstants.UNSUPPORTED_ANNOTATION_MARKER_ID, BuilderMessages.TagValidator_an_enum); } else if (!item.visible) { createAnnotationProblem(item.typename, node, IElementDescriptor.TYPE, IApiProblem.UNSUPPORTED_ANNOTATION_USE, IApiMarkerConstants.UNSUPPORTED_ANNOTATION_MARKER_ID, BuilderMessages.TagValidator_enum_not_visible); } } fProcessedAnnotations.add(name); }
/** * Checks the annotation that appears on the given parent * * @param node the annotation * @param type the parent */ void checkAnnotation(MarkerAnnotation node, AnnotationTypeDeclaration type) { String name = node.getTypeName().getFullyQualifiedName(); Item item = getItem(); if (fProcessedAnnotations.contains(name)) { createAnnotationProblem(item.typename, node, IElementDescriptor.TYPE, IApiProblem.DUPLICATE_ANNOTATION_USE, IApiMarkerConstants.DUPLICATE_ANNOTATION_MARKER_ID, null); } else { Set<String> supported = ApiPlugin.getJavadocTagManager().getAnntationsForType(IApiJavadocTag.TYPE_ANNOTATION, IApiJavadocTag.MEMBER_NONE); if (!supported.contains(name)) { createAnnotationProblem(item.typename, node, IElementDescriptor.TYPE, IApiProblem.UNSUPPORTED_ANNOTATION_USE, IApiMarkerConstants.UNSUPPORTED_ANNOTATION_MARKER_ID, BuilderMessages.TagValidator_an_annotation); } else if (!item.visible) { createAnnotationProblem(item.typename, node, IElementDescriptor.TYPE, IApiProblem.UNSUPPORTED_ANNOTATION_USE, IApiMarkerConstants.UNSUPPORTED_ANNOTATION_MARKER_ID, BuilderMessages.TagValidator_annotation_not_visible); } } }
@Override public IJavaCompletionProposal[] getCorrections(IInvocationContext context, IProblemLocation[] locations) throws CoreException { List<IJavaCompletionProposal> proposals = new ArrayList<>(); ICompilationUnit unit = context.getCompilationUnit(); IProject project = unit.getJavaProject().getProject(); if (!project.hasNature(ApiPlugin.NATURE_ID)) { return new IJavaCompletionProposal[0]; } IFile build = project.getFile("build.properties"); //$NON-NLS-1$ if (needsBuildPropertiesChange(build)) { for (IProblemLocation location : locations) { if (location.getProblemId() == IProblem.UndefinedType) { String[] args = location.getProblemArguments(); if (args.length == 1) { // only one argument in the missing annotation problem for (String arg : args) { String name = ApiPlugin.getJavadocTagManager().getQualifiedNameForAnnotation(arg); if (name != null) { proposals.add(new UnknownAnnotationQuickFix(unit, name)); } } } } } } return proposals.toArray(new IJavaCompletionProposal[proposals.size()]); }
} else { if (type.isInterface()) { Set<String> supported = ApiPlugin.getJavadocTagManager().getAnntationsForType(IApiJavadocTag.TYPE_INTERFACE, IApiJavadocTag.MEMBER_NONE); if (!supported.contains(name)) { createAnnotationProblem(item.typename, node, IElementDescriptor.TYPE, IApiProblem.UNSUPPORTED_ANNOTATION_USE, IApiMarkerConstants.UNSUPPORTED_ANNOTATION_MARKER_ID, BuilderMessages.TagValidator_an_interface); Set<String> supported = ApiPlugin.getJavadocTagManager().getAnntationsForType(IApiJavadocTag.TYPE_CLASS, IApiJavadocTag.MEMBER_NONE); if (!supported.contains(name)) { createAnnotationProblem(item.typename, node, IElementDescriptor.TYPE, IApiProblem.UNSUPPORTED_ANNOTATION_USE, IApiMarkerConstants.UNSUPPORTED_ANNOTATION_MARKER_ID, BuilderMessages.TagValidator_a_class);
int res = api.getRestrictions(); ArrayList<String> missing = new ArrayList<>(); JavadocTagManager jtm = ApiPlugin.getJavadocTagManager(); switch (member) { case IApiJavadocTag.MEMBER_FIELD:
boolean isprivate = Flags.isPrivate(flags); boolean ispackage = Flags.isPackageDefault(flags); Set<String> supportedtags = ApiPlugin.getJavadocTagManager().getAnntationsForType(pkind, IApiJavadocTag.MEMBER_FIELD); switch (pkind) { case IApiJavadocTag.TYPE_ANNOTATION: {
boolean isstatic = Flags.isStatic(flags); Item item = getItem(); Set<String> supportedtags = ApiPlugin.getJavadocTagManager().getAnntationsForType(pkind, isconstructor ? IApiJavadocTag.MEMBER_CONSTRUCTOR : IApiJavadocTag.MEMBER_METHOD); if (fProcessedAnnotations.contains(name)) { createAnnotationProblem(item.typename, node, IElementDescriptor.METHOD, IApiProblem.DUPLICATE_ANNOTATION_USE, IApiMarkerConstants.DUPLICATE_ANNOTATION_MARKER_ID, null);
break; IApiJavadocTag[] tags = ApiPlugin.getJavadocTagManager().getTagsForType(type, member); int tagcount = tags.length; if (tagcount > 0) {
IApiJavadocTag[] tags = ApiPlugin.getJavadocTagManager().getTagsForType(type, member); int tagcount = tags.length; if(tagcount > 0) {