You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Javadoc14.java 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. /* -*- Mode: JDE; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2. *
  3. * This file is part of the debugger and core tools for the AspectJ(tm)
  4. * programming language; see http://aspectj.org
  5. *
  6. * The contents of this file are subject to the Mozilla Public License
  7. * Version 1.1 (the "License"); you may not use this file except in
  8. * compliance with the License. You may obtain a copy of the License at
  9. * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
  10. *
  11. * Software distributed under the License is distributed on an "AS IS" basis,
  12. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13. * for the specific language governing rights and limitations under the
  14. * License.
  15. *
  16. * The Original Code is AspectJ.
  17. *
  18. * The Initial Developer of the Original Code is Xerox Corporation. Portions
  19. * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
  20. * All Rights Reserved.
  21. */
  22. package org.aspectj.tools.ajdoc.rootmakers;
  23. //import com.sun.javadoc.RootDoc;
  24. //import com.sun.javadoc.DocErrorReporter;
  25. //
  26. //import java.lang.reflect.InvocationTargetException;
  27. //import java.lang.reflect.Constructor;
  28. //import java.lang.reflect.Method;
  29. //import java.util.Iterator;
  30. //import java.util.List;
  31. //
  32. //import org.aspectj.tools.ajdoc.CannotMakeRootDocException;
  33. //import org.aspectj.tools.ajdoc.ErrPrinter;
  34. //import org.aspectj.tools.ajdoc.RootDocMaker;
  35. //import org.aspectj.tools.ajdoc.AccessChecker;
  36. //XXX
  37. //import com.sun.tools.javac.v8.util.Hashtable;
  38. /**
  39. * Makes a RootDoc using javadoc from SDK 1.4 as an example.
  40. *
  41. * @author Jeff Palm
  42. */
  43. //public class Javadoc14 extends Javadoc implements RootDocMaker {
  44. //
  45. // public Javadoc14() {}
  46. //
  47. // public RootDoc makeRootDoc(String sourcepath,
  48. // String classpath,
  49. // String bootclasspath,
  50. // String extdirs,
  51. // long flags,
  52. // String encoding,
  53. // String locale,
  54. // String source,
  55. // List classesAndPackages,
  56. // List options,
  57. // DocErrorReporter docErrorReporter,
  58. // String programName,
  59. // AccessChecker filter)
  60. // throws CannotMakeRootDocException {
  61. // this.err = (ErrPrinter)docErrorReporter;
  62. // Class hashtableClass = null;
  63. // String classname = "com.sun.tools.javac.v8.util.Hashtable";
  64. // try {
  65. // hashtableClass = Class.forName(classname);
  66. // } catch (ClassNotFoundException e) {
  67. // err.ex(e, "class_not_found", "Hashtable", classname);
  68. // return null;
  69. // }
  70. // Object hashtable = null;
  71. // try {
  72. // hashtable = hashtableClass.newInstance();
  73. // Method put = hashtableClass.getMethod("put",
  74. // new Class[]{Object.class,
  75. // Object.class});
  76. // if (sourcepath != null) {
  77. // put.invoke(hashtable, new Object[]{"-sourcepath",
  78. // sourcepath});
  79. // }
  80. // if (classpath != null) {
  81. // put.invoke(hashtable, new Object[]{"-classpath",
  82. // classpath});
  83. // }
  84. // if (bootclasspath != null) {
  85. // put.invoke(hashtable, new Object[]{"-bootclasspath",
  86. // bootclasspath});
  87. // }
  88. // if (extdirs != null) {
  89. // put.invoke(hashtable, new Object[]{"-extdirs",
  90. // extdirs});
  91. // }
  92. // if (encoding != null) {
  93. // put.invoke(hashtable, new Object[]{"-encoding",
  94. // encoding});
  95. // }
  96. // if (true || (flags & 0x1) != 0) {
  97. // put.invoke(hashtable, new Object[]{"-verbose",
  98. // ""});
  99. // }
  100. // if (source != null) {
  101. // put.invoke(hashtable, new Object[]{"-source",
  102. // source});
  103. // }
  104. // if (filter != null) {
  105. // put.invoke(hashtable, new Object[]{"-" + filter.getOption(),
  106. // ""});
  107. // }
  108. // Hashtable h = (Hashtable)hashtable;
  109. //
  110. // } catch (NoSuchMethodException e) {
  111. // err.ex(e, "method_not_found", classname, "put");
  112. // return null;
  113. // } catch (InvocationTargetException e) {
  114. // err.invocationTargetException(e, classname, "put");
  115. // return null;
  116. // } catch (InstantiationException e) {
  117. // err.ex(e, "must_have_default_ctor", classname);
  118. // return null;
  119. // } catch (IllegalAccessException e) {
  120. // err.ex(e, "method_not_accessible", classname, "new()");
  121. // return null;
  122. // }
  123. // Class messagerClass = null;
  124. // classname = "com.sun.tools.javadoc.Messager";
  125. // try {
  126. // messagerClass = Class.forName(classname);
  127. // } catch (ClassNotFoundException e) {
  128. // err.ex(e, "class_not_found", "Messager", classname);
  129. // return null;
  130. // }
  131. // Object messager = null;
  132. // try {
  133. // Constructor ctor =
  134. // messagerClass.getConstructor(new Class[]{String.class});
  135. // messager = ctor.newInstance(new Object[]{programName});
  136. // } catch (InstantiationException e) {
  137. // err.ex(e, "cant_construct_object", classname);
  138. // return null;
  139. // } catch (NoSuchMethodException e) {
  140. // err.ex(e, "method_not_found", classname, "new(String)");
  141. // return null;
  142. // } catch (IllegalAccessException e) {
  143. // err.ex(e, "method_not_accessible", classname, "new(String)");
  144. // return null;
  145. // } catch (InvocationTargetException e) {
  146. // err.invocationTargetException(e, classname, "new(String)");
  147. // return null;
  148. // }
  149. // Class javadocToolClass = null;
  150. // classname = "com.sun.tools.javadoc.JavadocTool";
  151. // try {
  152. // javadocToolClass = Class.forName(classname);
  153. // } catch (ClassNotFoundException e) {
  154. // err.ex(e, "class_not_found", "JavadocTool", classname);
  155. // return null;
  156. // }
  157. // Object javadocTool = null;
  158. // try {
  159. // Method make = javadocToolClass.getMethod("make",
  160. // new Class[]{messagerClass,
  161. // hashtableClass});
  162. // javadocTool = make.invoke(null, new Object[]{messager,
  163. // hashtable});
  164. // } catch (NoSuchMethodException e) {
  165. // err.ex(e, "method_not_found", classname, "make");
  166. // return null;
  167. // } catch (InvocationTargetException e) {
  168. // err.invocationTargetException(e, classname, "make");
  169. // return null;
  170. // } catch (IllegalAccessException e) {
  171. // err.ex(e, "method_not_accessible", classname, "make");
  172. // return null;
  173. // } catch (Exception e) {
  174. // err.ex(e, "exception_thrown", "JavadocTool",
  175. // classname, "make", e != null ? e.getMessage() : e+"");
  176. // return null;
  177. // }
  178. // Class modifierFilterClass = null;
  179. // classname = "com.sun.tools.javadoc.ModifierFilter";
  180. // try {
  181. // modifierFilterClass = Class.forName(classname);
  182. // } catch (ClassNotFoundException e) {
  183. // err.ex(e, "class_not_found", "ModifierFilter", classname);
  184. // return null;
  185. // }
  186. // Object modifierFilter = null;
  187. // classname = "com.sun.tools.javadoc.ModifierFilter";
  188. // try {
  189. // Constructor ctor =
  190. // modifierFilterClass.getConstructor(new Class[]{long.class});
  191. // modifierFilter = ctor.newInstance(new Object[]{new Long(flags)});
  192. // } catch (InstantiationException e) {
  193. // err.ex(e, "cant_construct_object", classname);
  194. // return null;
  195. // } catch (NoSuchMethodException e) {
  196. // err.ex(e, "method_not_found", classname, "new()");
  197. // return null;
  198. // } catch (IllegalAccessException e) {
  199. // err.ex(e, "method_not_accessible", classname, "new()");
  200. // return null;
  201. // } catch (InvocationTargetException e) {
  202. // err.invocationTargetException(e, classname, "new()");
  203. // return null;
  204. // }
  205. // Class listClass = null;
  206. // classname = "com.sun.tools.javac.v8.util.List";
  207. // try {
  208. // listClass = Class.forName(classname);
  209. // } catch (ClassNotFoundException e) {
  210. // err.ex(e, "class_not_found", "List", classname);
  211. // return null;
  212. // }
  213. // RootDoc rootDoc = null;
  214. // classname = "com.sun.tools.javadoc.JavadocTool";
  215. // try {
  216. // Method getRootDocImpl =
  217. // javadocToolClass.getMethod("getRootDocImpl",
  218. // new Class[]{String.class,
  219. // modifierFilterClass,
  220. // listClass,
  221. // listClass});
  222. // Object classesOrPackageList = list(classesAndPackages, listClass);
  223. // Object optionsList = list(options, listClass);
  224. //
  225. // rootDoc =
  226. // (RootDoc)getRootDocImpl.invoke(javadocTool,
  227. // new Object[]{locale,
  228. // modifierFilter,
  229. // classesOrPackageList,
  230. // optionsList});
  231. // } catch (NoSuchMethodException e) {
  232. // err.ex(e, "method_not_found", classname, "getRootDocImpl");
  233. // return null;
  234. // } catch (InvocationTargetException e) {
  235. // err.invocationTargetException(e, classname, "getRootDocImpl");
  236. // return null;
  237. // } catch (IllegalAccessException e) {
  238. // err.ex(e, "method_not_accessible", classname, "getRootDocImpl");
  239. // return null;
  240. // } catch (ClassCastException e) {
  241. // err.ex(e, "class_cast_exception", "getRootDocImpl", classname,
  242. // "com.sun.javadoc.RootDoc",
  243. // rootDoc == null ? "" : rootDoc.getClass().getName());
  244. // return null;
  245. // }
  246. // return rootDoc;
  247. // }
  248. //
  249. //
  250. // private final Object list(List list, Class listClass) {
  251. // if (listClass == null) return null;
  252. // Object newlist = newInstance(listClass);
  253. // if (newlist == null) return null;
  254. // if (list == null) return newlist;
  255. // Class listBufferClass = type("com.sun.tools.javac.v8.util.ListBuffer");
  256. // if (listBufferClass == null) return newlist;
  257. // Object listBuffer = newInstance(listBufferClass);
  258. // if (listBuffer == null) return newlist;
  259. // Method append = method("append", new Class[]{Object.class},listBufferClass);
  260. // if (append == null) return newlist;
  261. // for (Iterator i = list.iterator(); i.hasNext();) {
  262. // invoke(append, listBuffer, new Object[]{i.next()});
  263. // }
  264. //
  265. // Method toList = method("toList", new Class[]{}, listBufferClass);
  266. // if (toList == null) return newlist;
  267. // newlist = invoke(toList, listBuffer, new Object[]{});
  268. // return newlist;
  269. // }
  270. //}