We're updating the issue view to help you get more done. 

Direct-linking changes lose line-number on invoke()

Description

1 2 3 4 5 6 7 8 9 10 (ns foo) ;; 1 ;; 2 ;; 3 ;; 4 ;; 5 ;; 6 ;; 7 (defn callstack [] ;; 8 [1 2 3] ;; 9 (throw (Exception. "whoopsie!"))) ;; 10

Stack Trace comparison. Only the first two lines of each trace are relevant, the rest is all REPL fluff.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 ;;; 1.7.0 {:cause "whoopsie!", :via [{:type java.lang.Exception, :message "whoopsie!", :at [foo$callstack invoke "foo.clj" 8]}], :trace [[foo$callstack invoke "foo.clj" 8] [user$eval7675 invoke "form-init3342294504880003721.clj" 1] [clojure.lang.Compiler eval "Compiler.java" 6782] [clojure.lang.Compiler eval "Compiler.java" 6745] ... ;;; 1.8 RC2 {:cause "whoopsie!", :via [{:type java.lang.Exception, :message "whoopsie!", :at [foo$callstack invokeStatic "foo.clj" 8]}], :trace [[foo$callstack invokeStatic "foo.clj" 8] [foo$callstack invoke "foo.clj" -1] ;; Unexpected: -1 [user$eval4 invokeStatic "NO_SOURCE_FILE" 28] [user$eval4 invoke "NO_SOURCE_FILE" -1] ;; Unexpected: -1 [clojure.lang.Compiler eval "Compiler.java" 6913] [clojure.lang.Compiler eval "Compiler.java" 6876] ... ;;; 1.8 RC2 with patch {:cause "whoopsie!", :via [{:type java.lang.Exception, :message "whoopsie!", :at [foo$callstack invokeStatic "foo.clj" 8]}], :trace [[foo$callstack invokeStatic "foo.clj" 8] [foo$callstack invoke "foo.clj" 8] ;; Fixed [user$eval4 invokeStatic "NO_SOURCE_FILE" 3] [user$eval4 invoke "NO_SOURCE_FILE" 3] ;; Fixed [clojure.lang.Compiler eval "Compiler.java" 6917] [clojure.lang.Compiler eval "Compiler.java" 6880] ...

Cause: Non-direct linking now calls from invoke() through to invokeStatic(). In invoke(), Compiler does not visitLineNumber() before invoke() calls invokeStatic(), meaning that stack traces end up with -1 instead of a useful line number.

Patch: CLJ-1854-more-context.patch

Screened by: Alex Miller

Environment

Clojure 1.8RC2, leiningen 2.5.1

Status

Assignee

Unassigned

Reporter

Gary Trakhman

Labels

Approval

Ok

Patch

Code

Fix versions

Affects versions

Release 1.8

Priority

Major