Skip to content

Commit

Permalink
added file names in reflection warnings, patch from Toralf Wittner
Browse files Browse the repository at this point in the history
  • Loading branch information
richhickey committed Apr 14, 2009
1 parent e05a1ad commit 3dd4c1c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/jvm/clojure/lang/Compiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public class Compiler implements Opcodes{

//String
static final public Var SOURCE_PATH = Var.intern(Namespace.findOrCreate(Symbol.create("clojure.core")),
Symbol.create("*file*"), null);
Symbol.create("*file*"), "NO_SOURCE_PATH");

//String
static final public Var COMPILE_PATH = Var.intern(Namespace.findOrCreate(Symbol.create("clojure.core")),
Expand Down Expand Up @@ -866,8 +866,8 @@ public InstanceFieldExpr(int line, Expr target, String fieldName) throws Excepti
if(field == null && RT.booleanCast(RT.WARN_ON_REFLECTION.deref()))
{
((PrintWriter) RT.ERR.deref())
.format("Reflection warning, line: %d - reference to field %s can't be resolved.\n", line,
fieldName);
.format("Reflection warning, %s:%d - reference to field %s can't be resolved.\n",
SOURCE_PATH.deref(), line, fieldName);
}
}

Expand Down Expand Up @@ -1129,7 +1129,8 @@ public InstanceMethodExpr(String source, int line, Expr target, String methodNam
if(method == null && RT.booleanCast(RT.WARN_ON_REFLECTION.deref()))
{
((PrintWriter) RT.ERR.deref())
.format("Reflection warning, line: %d - call to %s can't be resolved.\n", line, methodName);
.format("Reflection warning, %s:%d - call to %s can't be resolved.\n",
SOURCE_PATH.deref(), line, methodName);
}
}

Expand Down Expand Up @@ -1270,7 +1271,8 @@ public StaticMethodExpr(String source, int line, Class c, String methodName, IPe
if(method == null && RT.booleanCast(RT.WARN_ON_REFLECTION.deref()))
{
((PrintWriter) RT.ERR.deref())
.format("Reflection warning, line: %d - call to %s can't be resolved.\n", line, methodName);
.format("Reflection warning, %s:%d - call to %s can't be resolved.\n",
SOURCE_PATH.deref(), line, methodName);
}
}

Expand Down Expand Up @@ -2114,7 +2116,8 @@ public NewExpr(Class c, IPersistentVector args, int line) throws Exception{
if(ctor == null && RT.booleanCast(RT.WARN_ON_REFLECTION.deref()))
{
((PrintWriter) RT.ERR.deref())
.format("Reflection warning, line: %d - call to %s ctor can't be resolved.\n", line, c.getName());
.format("Reflection warning, %s:%d - call to %s ctor can't be resolved.\n",
SOURCE_PATH.deref(), line, c.getName());
}
}

Expand Down

0 comments on commit 3dd4c1c

Please sign in to comment.