alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 * 
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 * 
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

package org.openide.compiler;

import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.Iterator;

/** Exception created when a set of compilers should be compiled and
* there is a cyclic dependency between them.
* 

* The exception carries list of objects that form the cycle. * * @author Jaroslav Tulach, Jesse Glick */ public final class DependencyException extends Exception { /** array of Compilable */ private final Compilable[] array; /** Creates new DependencyException. */ DependencyException (Compilable[] comp) { super (comp.length + " compilers formed a cycle"); // NOI18N array = comp; } /** Getter for list of compilables that form the cycle. * @return array of compilables */ public Compilable[] getCompilables () { return array; } // Debugging info for e.g. #10585 or #12252: public void printStackTrace () { printStackTrace (System.err); } public void printStackTrace (PrintStream ps) { super.printStackTrace (ps); ps.println ("Compiler cycle:"); // NOI18N for (int i = 0; i < array.length; i++) { ps.println ("\t" + info(array[i])); // NOI18N ps.println ("\t\tIncludes:\n"); // NOI18N Iterator it = array[i].compilers ().iterator (); while (it.hasNext ()) { Compiler c = (Compiler) it.next (); ps.println ("\t\t\t" + info(c)); // NOI18N } ps.println ("\t\tDepends on:\n"); // NOI18N it = array[i].dependsOn ().iterator (); while (it.hasNext ()) { Compilable c = (Compilable) it.next (); ps.println ("\t\t\t" + info(c)); // NOI18N } } } public void printStackTrace (PrintWriter pw) { super.printStackTrace (pw); pw.println ("Compiler cycle:"); // NOI18N for (int i = 0; i < array.length; i++) { pw.println ("\t" + info(array[i])); // NOI18N pw.println ("\t\tIncludes:\n"); // NOI18N Iterator it = array[i].compilers ().iterator (); while (it.hasNext ()) { Compiler c = (Compiler) it.next (); pw.println ("\t\t\t" + info(c)); // NOI18N } pw.println ("\t\tDepends on:\n"); // NOI18N it = array[i].dependsOn ().iterator (); while (it.hasNext ()) { Compilable c = (Compilable) it.next (); pw.println ("\t\t\t" + info(c)); // NOI18N } } } private static String info(Object o) { return o.toString() + " [class=" + o.getClass().getName() + ",id=" + System.identityHashCode(o) + ",hash=" + o.hashCode() + "]"; // NOI18N } }

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.