com.sun.javadoc.ClassDoc Java Examples
The following examples show how to use
com.sun.javadoc.ClassDoc.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RemoteClass.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Returns a new Method object that is a legal combination of * this Method object and another one. * * Doing this requires determining the exceptions declared by * the combined method, which must be (only) all of the * exceptions declared in both old Methods that may thrown in * either of them. **/ Method mergeWith(Method other) { if (!nameAndDescriptor().equals(other.nameAndDescriptor())) { throw new AssertionError( "attempt to merge method \"" + other.nameAndDescriptor() + "\" with \"" + nameAndDescriptor()); } List<ClassDoc> legalExceptions = new ArrayList<ClassDoc>(); collectCompatibleExceptions( other.exceptionTypes, exceptionTypes, legalExceptions); collectCompatibleExceptions( exceptionTypes, other.exceptionTypes, legalExceptions); Method merged = clone(); merged.exceptionTypes = legalExceptions.toArray(new ClassDoc[legalExceptions.size()]); return merged; }
Example #2
Source File: RemoteClass.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Adds to the supplied list all exceptions in the "froms" * array that are subclasses of an exception in the "withs" * array. **/ private void collectCompatibleExceptions(ClassDoc[] froms, ClassDoc[] withs, List<ClassDoc> list) { for (ClassDoc from : froms) { if (!list.contains(from)) { for (ClassDoc with : withs) { if (from.subclassOf(with)) { list.add(from); break; } } } } }
Example #3
Source File: RemoteClass.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Returns a new Method object that is a legal combination of * this Method object and another one. * * Doing this requires determining the exceptions declared by * the combined method, which must be (only) all of the * exceptions declared in both old Methods that may thrown in * either of them. **/ Method mergeWith(Method other) { if (!nameAndDescriptor().equals(other.nameAndDescriptor())) { throw new AssertionError( "attempt to merge method \"" + other.nameAndDescriptor() + "\" with \"" + nameAndDescriptor()); } List<ClassDoc> legalExceptions = new ArrayList<ClassDoc>(); collectCompatibleExceptions( other.exceptionTypes, exceptionTypes, legalExceptions); collectCompatibleExceptions( exceptionTypes, other.exceptionTypes, legalExceptions); Method merged = clone(); merged.exceptionTypes = legalExceptions.toArray(new ClassDoc[legalExceptions.size()]); return merged; }
Example #4
Source File: SarlLinkFactory.java From sarl with Apache License 2.0 | 6 votes |
/** Update the label of the given link with the SARL notation for lambdas. * * @param linkInfo the link information to update. */ protected void updateLinkLabel(LinkInfo linkInfo) { if (linkInfo.type != null && linkInfo instanceof LinkInfoImpl) { final LinkInfoImpl impl = (LinkInfoImpl) linkInfo; final ClassDoc classdoc = linkInfo.type.asClassDoc(); if (classdoc != null) { final SARLFeatureAccess kw = Utils.getKeywords(); final String name = classdoc.qualifiedName(); if (isPrefix(name, kw.getProceduresName())) { linkInfo.label = createProcedureLambdaLabel(impl); } else if (isPrefix(name, kw.getFunctionsName())) { linkInfo.label = createFunctionLambdaLabel(impl); } } } }
Example #5
Source File: RemoteClass.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Adds to the supplied list all exceptions in the "froms" * array that are subclasses of an exception in the "withs" * array. **/ private void collectCompatibleExceptions(ClassDoc[] froms, ClassDoc[] withs, List<ClassDoc> list) { for (ClassDoc from : froms) { if (!list.contains(from)) { for (ClassDoc with : withs) { if (from.subclassOf(with)) { list.add(from); break; } } } } }
Example #6
Source File: RemoteClass.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
/** * Adds to the supplied list all exceptions in the "froms" * array that are subclasses of an exception in the "withs" * array. **/ private void collectCompatibleExceptions(ClassDoc[] froms, ClassDoc[] withs, List<ClassDoc> list) { for (ClassDoc from : froms) { if (!list.contains(from)) { for (ClassDoc with : withs) { if (from.subclassOf(with)) { list.add(from); break; } } } } }
Example #7
Source File: RemoteClass.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Adds to the supplied list all exceptions in the "froms" * array that are subclasses of an exception in the "withs" * array. **/ private void collectCompatibleExceptions(ClassDoc[] froms, ClassDoc[] withs, List<ClassDoc> list) { for (ClassDoc from : froms) { if (!list.contains(from)) { for (ClassDoc with : withs) { if (from.subclassOf(with)) { list.add(from); break; } } } } }
Example #8
Source File: RemoteClass.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Adds to the supplied list all exceptions in the "froms" * array that are subclasses of an exception in the "withs" * array. **/ private void collectCompatibleExceptions(ClassDoc[] froms, ClassDoc[] withs, List<ClassDoc> list) { for (ClassDoc from : froms) { if (!list.contains(from)) { for (ClassDoc with : withs) { if (from.subclassOf(with)) { list.add(from); break; } } } } }
Example #9
Source File: BaleenJavadoc.java From baleen with Apache License 2.0 | 5 votes |
@Override public String toString(Tag[] tags) { if (tags.length == 0) { return null; } ClassDoc classDoc = (ClassDoc) tags[0].holder(); return processExternalResources(classDoc) + processConfigurationParameters(classDoc); }
Example #10
Source File: SarlConfiguration.java From sarl with Apache License 2.0 | 5 votes |
/** Reset the list of packages for avoiding duplicates. * * <p>The inherited implementation uses a HashSet that allow * the same package to be stored multiple times. Here, * we uses a TreeSet for using the "compareTo" mechanism. */ private void resetPackageList() { final Set<PackageDoc> set = new TreeSet<>(); for (final PackageDoc pack : this.root.specifiedPackages()) { set.add(pack); } for (final ClassDoc clazz : this.root.specifiedClasses()) { set.add(clazz.containingPackage()); } this.packages = Utils.toArray(this.packages, set); }
Example #11
Source File: Main.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static boolean start(RootDoc root) { for (ClassDoc d : root.classes()) { for (AnnotationDesc a : d.annotations()) { System.out.println(a.annotationType()); } } return true; }
Example #12
Source File: Utils.java From PrivacyStreams with Apache License 2.0 | 5 votes |
public static boolean instanceOf(ClassDoc classDoc, String superClassName) { if (classDoc == null || superClassName == null) return false; String className = classDoc.containingPackage().name() + "." + classDoc.name(); // System.out.println(className + " " + superClassName); if (className.startsWith(superClassName)) { return true; } return instanceOf(classDoc.superclass(), superClassName); }
Example #13
Source File: Main.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static boolean start(RootDoc root) { for (ClassDoc d : root.classes()) { for (AnnotationDesc a : d.annotations()) { System.out.println(a.annotationType()); } } return true; }
Example #14
Source File: PSItemDoc.java From PrivacyStreams with Apache License 2.0 | 5 votes |
private void getAllFieldDocs(ClassDoc classDoc, List<FieldDoc> fieldDocs) { if (classDoc.superclass() != null) { this.getAllFieldDocs(classDoc.superclass(), fieldDocs); } if (isValidPSItem(classDoc)) { fieldDocs.addAll(Arrays.asList(classDoc.fields())); } }
Example #15
Source File: FlowDocumentation.java From nomulus with Apache License 2.0 | 5 votes |
/** Iterates through javadoc tags on the underlying class and calls specific parsing methods. */ private void parseTags(ClassDoc flowDoc) { for (Tag tag : flowDoc.tags()) { // Everything else is not a relevant tag. if ("@error".equals(tag.name())) { parseErrorTag(tag); } } }
Example #16
Source File: PicardHelpDoclet.java From picard with MIT License | 5 votes |
/** * @return Create and return a DocWorkUnit-derived object to handle documentation * for the target feature(s) represented by documentedFeature. * * @param documentedFeature DocumentedFeature annotation for the target feature * @param classDoc javadoc classDoc for the target feature * @param clazz class of the target feature * @return DocWorkUnit to be used for this feature */ @Override protected DocWorkUnit createWorkUnit( final DocumentedFeature documentedFeature, final ClassDoc classDoc, final Class<?> clazz) { return new DocWorkUnit( new PicardHelpDocWorkUnitHandler(this), documentedFeature, classDoc, clazz); }
Example #17
Source File: T8147801.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
void dump(PrintWriter out, String prefix, ClassDoc cd) { out.println(prefix + "class: " + cd); for (FieldDoc fd: cd.fields()) { out.println(prefix + " " + fd); if (fd.type().asClassDoc() != null) { dump(out, prefix + " ", fd.type().asClassDoc()); } } }
Example #18
Source File: ProgrammaticWrappingProxyInstaller.java From sarl with Apache License 2.0 | 4 votes |
@Override public ClassDoc overriddenClass() { return wrap(this.delegate.overriddenClass()); }
Example #19
Source File: Util.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Returns the binary name of the class or interface represented * by the specified ClassDoc. **/ static String binaryNameOf(ClassDoc cl) { String flat = cl.name().replace('.', '$'); String packageName = cl.containingPackage().name(); return packageName.equals("") ? flat : packageName + "." + flat; }
Example #20
Source File: Util.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Returns the binary name of the class or interface represented * by the specified ClassDoc. **/ static String binaryNameOf(ClassDoc cl) { String flat = cl.name().replace('.', '$'); String packageName = cl.containingPackage().name(); return packageName.equals("") ? flat : packageName + "." + flat; }
Example #21
Source File: ProgrammaticWrappingProxyInstaller.java From sarl with Apache License 2.0 | 4 votes |
@Override public ClassDoc[] enums() { return wrap(this.delegate.enums()); }
Example #22
Source File: StubSkeletonWriter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Computes the exceptions that need to be caught and rethrown in * a stub method before wrapping Exceptions in * UnexpectedExceptions, given the exceptions declared in the * throws clause of the method. Returns a list containing the * exception to catch. Each exception is guaranteed to be unique, * i.e. not a subclass of any of the other exceptions in the list, * so the catch blocks for these exceptions may be generated in * any order relative to each other. * * RemoteException and RuntimeException are each automatically * placed in the returned list (unless any of their superclasses * are already present), since those exceptions should always be * directly rethrown by a stub method. * * The returned list will be empty if java.lang.Exception or one * of its superclasses is in the throws clause of the method, * indicating that no exceptions need to be caught. **/ private List<ClassDoc> computeUniqueCatchList(ClassDoc[] exceptions) { List<ClassDoc> uniqueList = new ArrayList<ClassDoc>(); uniqueList.add(env.docRuntimeException()); uniqueList.add(env.docRemoteException()); // always catch/rethrow these /* For each exception declared by the stub method's throws clause: */ nextException: for (ClassDoc ex : exceptions) { if (env.docException().subclassOf(ex)) { /* * If java.lang.Exception (or a superclass) was declared * in the throws clause of this stub method, then we don't * have to bother catching anything; clear the list and * return. */ uniqueList.clear(); break; } else if (!ex.subclassOf(env.docException())) { /* * Ignore other Throwables that do not extend Exception, * because they cannot be thrown by the invoke methods. */ continue; } /* * Compare this exception against the current list of * exceptions that need to be caught: */ for (Iterator<ClassDoc> i = uniqueList.iterator(); i.hasNext();) { ClassDoc ex2 = i.next(); if (ex.subclassOf(ex2)) { /* * If a superclass of this exception is already on * the list to catch, then ignore this one and continue; */ continue nextException; } else if (ex2.subclassOf(ex)) { /* * If a subclass of this exception is on the list * to catch, then remove it; */ i.remove(); } } /* This exception is unique: add it to the list to catch. */ uniqueList.add(ex); } return uniqueList; }
Example #23
Source File: StubSkeletonWriter.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * Computes the exceptions that need to be caught and rethrown in * a stub method before wrapping Exceptions in * UnexpectedExceptions, given the exceptions declared in the * throws clause of the method. Returns a list containing the * exception to catch. Each exception is guaranteed to be unique, * i.e. not a subclass of any of the other exceptions in the list, * so the catch blocks for these exceptions may be generated in * any order relative to each other. * * RemoteException and RuntimeException are each automatically * placed in the returned list (unless any of their superclasses * are already present), since those exceptions should always be * directly rethrown by a stub method. * * The returned list will be empty if java.lang.Exception or one * of its superclasses is in the throws clause of the method, * indicating that no exceptions need to be caught. **/ private List<ClassDoc> computeUniqueCatchList(ClassDoc[] exceptions) { List<ClassDoc> uniqueList = new ArrayList<ClassDoc>(); uniqueList.add(env.docRuntimeException()); uniqueList.add(env.docRemoteException()); // always catch/rethrow these /* For each exception declared by the stub method's throws clause: */ nextException: for (ClassDoc ex : exceptions) { if (env.docException().subclassOf(ex)) { /* * If java.lang.Exception (or a superclass) was declared * in the throws clause of this stub method, then we don't * have to bother catching anything; clear the list and * return. */ uniqueList.clear(); break; } else if (!ex.subclassOf(env.docException())) { /* * Ignore other Throwables that do not extend Exception, * because they cannot be thrown by the invoke methods. */ continue; } /* * Compare this exception against the current list of * exceptions that need to be caught: */ for (Iterator<ClassDoc> i = uniqueList.iterator(); i.hasNext();) { ClassDoc ex2 = i.next(); if (ex.subclassOf(ex2)) { /* * If a superclass of this exception is already on * the list to catch, then ignore this one and continue; */ continue nextException; } else if (ex2.subclassOf(ex)) { /* * If a subclass of this exception is on the list * to catch, then remove it; */ i.remove(); } } /* This exception is unique: add it to the list to catch. */ uniqueList.add(ex); } return uniqueList; }
Example #24
Source File: Utils.java From sarl with Apache License 2.0 | 4 votes |
/** Replies the default value of the given parameter. * * @param member the member * @param param the parameter. * @param configuration the configuration. * @return the default value or {@code null}. */ @SuppressWarnings("checkstyle:nestedifdepth") public static String getParameterDefaultValue(ExecutableMemberDoc member, Parameter param, SarlConfiguration configuration) { final AnnotationDesc annotation = Utils.findFirst(param.annotations(), it -> qualifiedNameEquals(it.annotationType().qualifiedTypeName(), getKeywords().getDefaultValueAnnnotationName())); if (annotation != null) { final ElementValuePair[] pairs = annotation.elementValues(); if (pairs != null && pairs.length > 0) { final String fieldId = pairs[0].value().value().toString(); final int index = fieldId.indexOf('#'); ClassDoc fieldContainer; final String fieldName; if (index > 0) { final String referenceName = fieldId.substring(0, index); if (qualifiedNameEquals(referenceName, member.containingClass().qualifiedName())) { fieldContainer = member.containingClass(); } else { fieldContainer = findFirst(configuration.classDocCatalog.allClasses(getPackageName(referenceName)), false, it -> false); if (fieldContainer == null) { fieldContainer = member.containingClass(); } } fieldName = createNameForHiddenDefaultValueAttribute(fieldId.substring(index + 1)); } else { fieldContainer = member.containingClass(); fieldName = createNameForHiddenDefaultValueAttribute(fieldId); } final FieldDoc field = Utils.findFirst(fieldContainer.fields(), false, it -> simpleNameEquals(it.name(), fieldName)); if (field != null) { final AnnotationDesc valueAnnotation = Utils.findFirst(field.annotations(), it -> qualifiedNameEquals(it.annotationType().qualifiedTypeName(), getKeywords().getSarlSourceCodeAnnotationName())); if (valueAnnotation != null) { return valueAnnotation.elementValues()[0].value().value().toString(); } } } } return null; }
Example #25
Source File: StubSkeletonWriter.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Computes the exceptions that need to be caught and rethrown in * a stub method before wrapping Exceptions in * UnexpectedExceptions, given the exceptions declared in the * throws clause of the method. Returns a list containing the * exception to catch. Each exception is guaranteed to be unique, * i.e. not a subclass of any of the other exceptions in the list, * so the catch blocks for these exceptions may be generated in * any order relative to each other. * * RemoteException and RuntimeException are each automatically * placed in the returned list (unless any of their superclasses * are already present), since those exceptions should always be * directly rethrown by a stub method. * * The returned list will be empty if java.lang.Exception or one * of its superclasses is in the throws clause of the method, * indicating that no exceptions need to be caught. **/ private List<ClassDoc> computeUniqueCatchList(ClassDoc[] exceptions) { List<ClassDoc> uniqueList = new ArrayList<ClassDoc>(); uniqueList.add(env.docRuntimeException()); uniqueList.add(env.docRemoteException()); // always catch/rethrow these /* For each exception declared by the stub method's throws clause: */ nextException: for (ClassDoc ex : exceptions) { if (env.docException().subclassOf(ex)) { /* * If java.lang.Exception (or a superclass) was declared * in the throws clause of this stub method, then we don't * have to bother catching anything; clear the list and * return. */ uniqueList.clear(); break; } else if (!ex.subclassOf(env.docException())) { /* * Ignore other Throwables that do not extend Exception, * because they cannot be thrown by the invoke methods. */ continue; } /* * Compare this exception against the current list of * exceptions that need to be caught: */ for (Iterator<ClassDoc> i = uniqueList.iterator(); i.hasNext();) { ClassDoc ex2 = i.next(); if (ex.subclassOf(ex2)) { /* * If a superclass of this exception is already on * the list to catch, then ignore this one and continue; */ continue nextException; } else if (ex2.subclassOf(ex)) { /* * If a subclass of this exception is on the list * to catch, then remove it; */ i.remove(); } } /* This exception is unique: add it to the list to catch. */ uniqueList.add(ex); } return uniqueList; }
Example #26
Source File: RemoteClass.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public int compare(ClassDoc o1, ClassDoc o2) { return Util.binaryNameOf(o1).compareTo(Util.binaryNameOf(o2)); }
Example #27
Source File: ProgrammaticWrappingProxyInstaller.java From sarl with Apache License 2.0 | 4 votes |
@Override public ClassDoc asClassDoc() { return wrap(this.delegate.asClassDoc()); }
Example #28
Source File: RemoteClass.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Creates a RemoteClass instance for the specified class. The * resulting object is not yet initialized. **/ private RemoteClass(BatchEnvironment env, ClassDoc implClass) { this.env = env; this.implClass = implClass; }
Example #29
Source File: Util.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Returns the binary name of the class or interface represented * by the specified ClassDoc. **/ static String binaryNameOf(ClassDoc cl) { String flat = cl.name().replace('.', '$'); String packageName = cl.containingPackage().name(); return packageName.equals("") ? flat : packageName + "." + flat; }
Example #30
Source File: ProgrammaticWrappingProxyInstaller.java From sarl with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override public ClassDoc[] innerClasses() { return wrap(this.delegate.innerClasses()); }