diff options
author | Shigeru Chiba <chibash@users.noreply.github.com> | 2024-05-03 19:01:47 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-03 19:01:47 +0900 |
commit | bb261b443831e52409eeed6e49ddfb24db2c4d08 (patch) | |
tree | 3f8189ef73984d71ad0b8fe595c0e3a2a425e6bb /src/main/javassist/compiler/CompileError.java | |
parent | 204d67844433c9b781054154695eeb14c2291847 (diff) | |
parent | 9777bae93cc84249fe08a7e81b2101c415bd55e5 (diff) | |
download | javassist-bb261b443831e52409eeed6e49ddfb24db2c4d08.tar.gz javassist-bb261b443831e52409eeed6e49ddfb24db2c4d08.zip |
Merge pull request #484 from kuznet1/master
Line numbers support
Diffstat (limited to 'src/main/javassist/compiler/CompileError.java')
-rw-r--r-- | src/main/javassist/compiler/CompileError.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/main/javassist/compiler/CompileError.java b/src/main/javassist/compiler/CompileError.java index 5b857cf2..3a41779c 100644 --- a/src/main/javassist/compiler/CompileError.java +++ b/src/main/javassist/compiler/CompileError.java @@ -25,12 +25,19 @@ public class CompileError extends Exception { private Lex lex; private String reason; + private int lineNumber = -1; + public CompileError(String s, Lex l) { - reason = s; + this(s, l.getLineNumber()); lex = l; } - public CompileError(String s) { + public CompileError(String s, int lineNumber) { + this.lineNumber = lineNumber; + reason = String.format("line %d: %s", lineNumber, s); + } + + private CompileError(String s) { reason = s; lex = null; } @@ -45,6 +52,10 @@ public class CompileError extends Exception { public Lex getLex() { return lex; } + public int getLineNumber() { + return lineNumber; + } + @Override public String getMessage() { return reason; |