In the Java Debugger Interface documentation for t开发者_高级运维he 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?
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.
精彩评论