123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 |
- /* -*- Mode: JDE; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- *
- * This file is part of the debugger and core tools for the AspectJ(tm)
- * programming language; see http://aspectj.org
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is AspectJ.
- *
- * The Initial Developer of the Original Code is Xerox Corporation. Portions
- * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
- * All Rights Reserved.
- */
- package org.aspectj.tools.ajdoc.rootmakers;
-
- //import com.sun.javadoc.RootDoc;
- //import com.sun.javadoc.DocErrorReporter;
- //
- //import java.lang.reflect.InvocationTargetException;
- //import java.lang.reflect.Constructor;
- //import java.lang.reflect.Method;
- //import java.util.Iterator;
- //import java.util.List;
- //
- //import org.aspectj.tools.ajdoc.CannotMakeRootDocException;
- //import org.aspectj.tools.ajdoc.ErrPrinter;
- //import org.aspectj.tools.ajdoc.RootDocMaker;
- //import org.aspectj.tools.ajdoc.AccessChecker;
-
- //XXX
- //import com.sun.tools.javac.v8.util.Hashtable;
-
- /**
- * Makes a RootDoc using javadoc from SDK 1.4 as an example.
- *
- * @author Jeff Palm
- */
- //public class Javadoc14 extends Javadoc implements RootDocMaker {
- //
- // public Javadoc14() {}
- //
- // public RootDoc makeRootDoc(String sourcepath,
- // String classpath,
- // String bootclasspath,
- // String extdirs,
- // long flags,
- // String encoding,
- // String locale,
- // String source,
- // List classesAndPackages,
- // List options,
- // DocErrorReporter docErrorReporter,
- // String programName,
- // AccessChecker filter)
- // throws CannotMakeRootDocException {
- // this.err = (ErrPrinter)docErrorReporter;
- // Class hashtableClass = null;
- // String classname = "com.sun.tools.javac.v8.util.Hashtable";
- // try {
- // hashtableClass = Class.forName(classname);
- // } catch (ClassNotFoundException e) {
- // err.ex(e, "class_not_found", "Hashtable", classname);
- // return null;
- // }
- // Object hashtable = null;
- // try {
- // hashtable = hashtableClass.newInstance();
- // Method put = hashtableClass.getMethod("put",
- // new Class[]{Object.class,
- // Object.class});
- // if (sourcepath != null) {
- // put.invoke(hashtable, new Object[]{"-sourcepath",
- // sourcepath});
- // }
- // if (classpath != null) {
- // put.invoke(hashtable, new Object[]{"-classpath",
- // classpath});
- // }
- // if (bootclasspath != null) {
- // put.invoke(hashtable, new Object[]{"-bootclasspath",
- // bootclasspath});
- // }
- // if (extdirs != null) {
- // put.invoke(hashtable, new Object[]{"-extdirs",
- // extdirs});
- // }
- // if (encoding != null) {
- // put.invoke(hashtable, new Object[]{"-encoding",
- // encoding});
- // }
- // if (true || (flags & 0x1) != 0) {
- // put.invoke(hashtable, new Object[]{"-verbose",
- // ""});
- // }
- // if (source != null) {
- // put.invoke(hashtable, new Object[]{"-source",
- // source});
- // }
- // if (filter != null) {
- // put.invoke(hashtable, new Object[]{"-" + filter.getOption(),
- // ""});
- // }
- // Hashtable h = (Hashtable)hashtable;
- //
- // } catch (NoSuchMethodException e) {
- // err.ex(e, "method_not_found", classname, "put");
- // return null;
- // } catch (InvocationTargetException e) {
- // err.invocationTargetException(e, classname, "put");
- // return null;
- // } catch (InstantiationException e) {
- // err.ex(e, "must_have_default_ctor", classname);
- // return null;
- // } catch (IllegalAccessException e) {
- // err.ex(e, "method_not_accessible", classname, "new()");
- // return null;
- // }
- // Class messagerClass = null;
- // classname = "com.sun.tools.javadoc.Messager";
- // try {
- // messagerClass = Class.forName(classname);
- // } catch (ClassNotFoundException e) {
- // err.ex(e, "class_not_found", "Messager", classname);
- // return null;
- // }
- // Object messager = null;
- // try {
- // Constructor ctor =
- // messagerClass.getConstructor(new Class[]{String.class});
- // messager = ctor.newInstance(new Object[]{programName});
- // } catch (InstantiationException e) {
- // err.ex(e, "cant_construct_object", classname);
- // return null;
- // } catch (NoSuchMethodException e) {
- // err.ex(e, "method_not_found", classname, "new(String)");
- // return null;
- // } catch (IllegalAccessException e) {
- // err.ex(e, "method_not_accessible", classname, "new(String)");
- // return null;
- // } catch (InvocationTargetException e) {
- // err.invocationTargetException(e, classname, "new(String)");
- // return null;
- // }
- // Class javadocToolClass = null;
- // classname = "com.sun.tools.javadoc.JavadocTool";
- // try {
- // javadocToolClass = Class.forName(classname);
- // } catch (ClassNotFoundException e) {
- // err.ex(e, "class_not_found", "JavadocTool", classname);
- // return null;
- // }
- // Object javadocTool = null;
- // try {
- // Method make = javadocToolClass.getMethod("make",
- // new Class[]{messagerClass,
- // hashtableClass});
- // javadocTool = make.invoke(null, new Object[]{messager,
- // hashtable});
- // } catch (NoSuchMethodException e) {
- // err.ex(e, "method_not_found", classname, "make");
- // return null;
- // } catch (InvocationTargetException e) {
- // err.invocationTargetException(e, classname, "make");
- // return null;
- // } catch (IllegalAccessException e) {
- // err.ex(e, "method_not_accessible", classname, "make");
- // return null;
- // } catch (Exception e) {
- // err.ex(e, "exception_thrown", "JavadocTool",
- // classname, "make", e != null ? e.getMessage() : e+"");
- // return null;
- // }
- // Class modifierFilterClass = null;
- // classname = "com.sun.tools.javadoc.ModifierFilter";
- // try {
- // modifierFilterClass = Class.forName(classname);
- // } catch (ClassNotFoundException e) {
- // err.ex(e, "class_not_found", "ModifierFilter", classname);
- // return null;
- // }
- // Object modifierFilter = null;
- // classname = "com.sun.tools.javadoc.ModifierFilter";
- // try {
- // Constructor ctor =
- // modifierFilterClass.getConstructor(new Class[]{long.class});
- // modifierFilter = ctor.newInstance(new Object[]{new Long(flags)});
- // } catch (InstantiationException e) {
- // err.ex(e, "cant_construct_object", classname);
- // return null;
- // } catch (NoSuchMethodException e) {
- // err.ex(e, "method_not_found", classname, "new()");
- // return null;
- // } catch (IllegalAccessException e) {
- // err.ex(e, "method_not_accessible", classname, "new()");
- // return null;
- // } catch (InvocationTargetException e) {
- // err.invocationTargetException(e, classname, "new()");
- // return null;
- // }
- // Class listClass = null;
- // classname = "com.sun.tools.javac.v8.util.List";
- // try {
- // listClass = Class.forName(classname);
- // } catch (ClassNotFoundException e) {
- // err.ex(e, "class_not_found", "List", classname);
- // return null;
- // }
- // RootDoc rootDoc = null;
- // classname = "com.sun.tools.javadoc.JavadocTool";
- // try {
- // Method getRootDocImpl =
- // javadocToolClass.getMethod("getRootDocImpl",
- // new Class[]{String.class,
- // modifierFilterClass,
- // listClass,
- // listClass});
- // Object classesOrPackageList = list(classesAndPackages, listClass);
- // Object optionsList = list(options, listClass);
- //
- // rootDoc =
- // (RootDoc)getRootDocImpl.invoke(javadocTool,
- // new Object[]{locale,
- // modifierFilter,
- // classesOrPackageList,
- // optionsList});
- // } catch (NoSuchMethodException e) {
- // err.ex(e, "method_not_found", classname, "getRootDocImpl");
- // return null;
- // } catch (InvocationTargetException e) {
- // err.invocationTargetException(e, classname, "getRootDocImpl");
- // return null;
- // } catch (IllegalAccessException e) {
- // err.ex(e, "method_not_accessible", classname, "getRootDocImpl");
- // return null;
- // } catch (ClassCastException e) {
- // err.ex(e, "class_cast_exception", "getRootDocImpl", classname,
- // "com.sun.javadoc.RootDoc",
- // rootDoc == null ? "" : rootDoc.getClass().getName());
- // return null;
- // }
- // return rootDoc;
- // }
- //
- //
- // private final Object list(List list, Class listClass) {
- // if (listClass == null) return null;
- // Object newlist = newInstance(listClass);
- // if (newlist == null) return null;
- // if (list == null) return newlist;
- // Class listBufferClass = type("com.sun.tools.javac.v8.util.ListBuffer");
- // if (listBufferClass == null) return newlist;
- // Object listBuffer = newInstance(listBufferClass);
- // if (listBuffer == null) return newlist;
- // Method append = method("append", new Class[]{Object.class},listBufferClass);
- // if (append == null) return newlist;
- // for (Iterator i = list.iterator(); i.hasNext();) {
- // invoke(append, listBuffer, new Object[]{i.next()});
- // }
- //
- // Method toList = method("toList", new Class[]{}, listBufferClass);
- // if (toList == null) return newlist;
- // newlist = invoke(toList, listBuffer, new Object[]{});
- // return newlist;
- // }
- //}
|