In the Java Debugger Interface documentation for the Location class, there's a paragraph discussing the "stratum" of the location. I've been looking around a bit for more detail on how one would go about implementing a new stratum (for, say, Scala or JRuby), but I haven't found much. Can anyone shed some light on the topic?
+2
A:
Strata wouldn't really be appropriate for Scala or JRuby as they are compiled directly to bytecodes so the SourceFile and LineNumberTable attributes are enough. Strata are intended for things like JSP which are translated to a Java source file and them compiled. The strata are defined by an source map (SMAP) stored in a SourceDebugExtension attribute. The details of how this all works is part of JSR-45. Another example would be the State Machine Compiler though I don't believe it generates an SMAP. I'm also not sure if javac has an option for embedding the SMAP in the class file. You would then need a separate tool for that.
Geoff Reedy
2010-09-17 03:39:22
In fact, line numbers are insufficiently precise for the bytecode address -> source position mapping for Scala code. A given line of Scala code can easily yield many meaningful breakpoints but current debuggers cannot resolve their source position within such a line.
Randall Schulz
2010-09-17 04:10:13