This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Patch for --warn-invoke-unknown-class option
- From: Dean Ferreyra <dferreyra at igc dot org>
- To: kawa at sources dot redhat dot com
- Date: Mon, 11 Apr 2005 22:06:36 -0700
- Subject: Patch for --warn-invoke-unknown-class option
Here's a small patch that adds the --warn-invoke-unknown-class option
modeled after --warn-invoke-unknown-method.
I've used it locally to suppress a warning on an invoke that needs to
be resolved at run-time, as in:
(with-compile-options
warn-invoke-unknown-class: #f
(invoke-static <ClassNotBuiltYet> 'fn))
Dean
Index: doc/kawa.texi
===================================================================
RCS file: /cvs/kawa/kawa/doc/kawa.texi,v
retrieving revision 1.155
diff -a -u -r1.155 kawa.texi
--- doc/kawa.texi 13 Dec 2004 00:52:53 -0000 1.155
+++ doc/kawa.texi 12 Apr 2005 04:39:32 -0000
@@ -1034,6 +1034,11 @@
for which there is no matching method in the compile-time type of the receiver.
This (currently) defaults to on;
to turn it off use the @code{--no-warn-invoke-unknown-method} flag.
+@item --warn-invoke-unknown-class
+Emit a warning if the @code{invoke} function is called with an object of a
+type whose class is not found at compile-time.
+This (currently) defaults to on;
+to turn it off use the @code{--no-warn-invoke-unknown-class} flag.
@item --warn-undefined-variable
Emit a warning if the code references a variable which is neither in
lexical scope nor in the compile-time dynamic (global) environment.
Index: gnu/expr/Compilation.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/expr/Compilation.java,v
retrieving revision 1.140
diff -a -u -r1.140 Compilation.java
--- gnu/expr/Compilation.java 24 Mar 2005 07:42:56 -0000 1.140
+++ gnu/expr/Compilation.java 12 Apr 2005 04:39:32 -0000
@@ -56,6 +56,8 @@
"warn if invoke calls an unknown method");
options.add("warn-as-error", Options.BOOLEAN_OPTION,
"Make all warnings into errors");
+ options.add("warn-invoke-unknown-class", Options.BOOLEAN_OPTION,
+ "warn if invoke called on an unknown class");
}
/** Get a named boolean option. */
Index: gnu/kawa/reflect/Invoke.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/kawa/reflect/Invoke.java,v
retrieving revision 1.38
diff -a -u -r1.38 Invoke.java
--- gnu/kawa/reflect/Invoke.java 24 Feb 2005 16:01:15 -0000 1.38
+++ gnu/kawa/reflect/Invoke.java 12 Apr 2005 04:39:32 -0000
@@ -341,7 +341,8 @@
}
catch (Exception ex)
{
- walker.error('w', "unknown class: " + type.getName());
+ if (comp.getBooleanOption("warn-invoke-unknown-class", true))
+ walker.error('w', "unknown class: " + type.getName());
methods = null;
}
okCount = cacheDefinitelyApplicableMethodCount;