1 24 25 package org.aspectj.compiler.base; 26 27 import org.aspectj.compiler.base.ast.ASTObject; 28 29 import java.io.PrintWriter ; 30 31 public class InternalCompilerError extends Error { 32 public Throwable uncaughtThrowable; 33 public ASTObject where; 34 private JavaCompiler compiler; 35 private String currentSection; 36 37 public InternalCompilerError(JavaCompiler compiler, 38 Throwable uncaughtThrowable, ASTObject where) { 39 this.compiler = compiler; 40 this.uncaughtThrowable = uncaughtThrowable; 41 if (where == null && compiler != null) { 42 where = compiler.getCurrentNode(); 43 } 44 this.where = where; 45 if (compiler != null) { 46 currentSection = compiler.getCurrentSection(); 47 } 48 } 49 50 public void showWhere(PrintWriter errorWriter) { 51 if (currentSection != null) { 53 errorWriter.println("The error occured in "+currentSection+"."); 54 errorWriter.println(); 55 } 56 57 if (where != null) { 58 errorWriter.println("At the time of the error, the compiler was processing (" 59 +where.getClass().getName()+"):"); 60 ErrorHandler errorHandler = new ErrorHandler(errorWriter); 61 errorHandler.setCompiler(compiler); 62 errorHandler.showMessage(where, "", true,true); 63 errorWriter.println(); 64 } else { 66 } 68 errorWriter.flush(); 69 } 70 } 71 | Popular Tags |