Update of /cvsroot/nice/Nice/stdlib/nice/lang
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10997/stdlib/nice/lang
Modified Files:
source-lines.nice
Log Message:
Accept a ClassLoader argument, which is useful when the code was loaded
from a custom class loader.
Index: source-lines.nice
===================================================================
RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/source-lines.nice,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** source-lines.nice 25 Jun 2004 12:53:35 -0000 1.6
--- source-lines.nice 5 Aug 2004 12:04:21 -0000 1.7
***************
*** 32,38 ****
public void printStackTraceWithSourceInfo(Throwable t, PrintStream s) =
! printStackTraceWithSourceInfo(t, new PrintWriter(s, true));
! public void printStackTraceWithSourceInfo(Throwable t, PrintWriter w)
{
w.println("Exception in thread \"" Thread.currentThread().getName "\" " t);
--- 32,46 ----
public void printStackTraceWithSourceInfo(Throwable t, PrintStream s) =
! printStackTraceWithSourceInfo(t, s, null);
! public void printStackTraceWithSourceInfo(Throwable t, PrintStream s,
! ?ClassLoader loader) =
! printStackTraceWithSourceInfo(t, new PrintWriter(s, true), loader);
!
! public void printStackTraceWithSourceInfo(Throwable t, PrintWriter w) =
! printStackTraceWithSourceInfo(t, w, null);
!
! public void printStackTraceWithSourceInfo(Throwable t, PrintWriter w,
! ?ClassLoader loader)
{
w.println("Exception in thread \"" Thread.currentThread().getName "\" " t);
***************
*** 41,46 ****
let Object[] elements = cast(getSTMethod.invoke(t, null));
elements.foreach(Object e => {
! (?String file, int line) =
! getSourceLocation__(e.call__("getClassName"), e.call__("getLineNumber"))
|| (e.call__("getFileName"), e.call__("getLineNumber"));
let location =
--- 49,54 ----
let Object[] elements = cast(getSTMethod.invoke(t, null));
elements.foreach(Object e => {
! (?String file, int line) =
! getSourceLocation__(e.call__("getClassName"), e.call__("getLineNumber"), loader)
|| (e.call__("getFileName"), e.call__("getLineNumber"));
let location =
***************
*** 94,101 ****
/** Fetch the SourceDebugExtension attribute from a compiled class. */
! ?String sourceDebugExtension__(String className)
{
let resourceName = className.replace('.', '/') + ".class";
! let ?InputStream inputStream = java.lang.ClassLoader.getSystemResourceAsStream(resourceName);
if (inputStream == null)
return null;
--- 102,114 ----
/** Fetch the SourceDebugExtension attribute from a compiled class. */
! ?String sourceDebugExtension__(String className, ?ClassLoader loader)
{
let resourceName = className.replace('.', '/') + ".class";
!
! let ?InputStream inputStream =
! loader == null
! ? java.lang.ClassLoader.getSystemResourceAsStream(resourceName)
! : loader.getResourceAsStream(resourceName);
!
if (inputStream == null)
return null;
***************
*** 197,208 ****
outStart = Integer.parseInt(line.substring(pos + 1));
outInc = 1;
! }
return (start, id, repeat, outStart, outInc);
}
! ?(String,int) getSourceLocation__(String className, int lineNumber)
{
! let map = sourceDebugExtension__(className);
if (map == null)
return null;
--- 210,222 ----
outStart = Integer.parseInt(line.substring(pos + 1));
outInc = 1;
! }
return (start, id, repeat, outStart, outInc);
}
! ?(String,int) getSourceLocation__(String className, int lineNumber,
! ?ClassLoader loader)
{
! let map = sourceDebugExtension__(className, loader);
if (map == null)
return null;
|