[Kaffe] ease of use patch.
Moses DeJong
dejong at cs.umn.edu
Wed Feb 24 01:33:29 PST 1999
Hello.
Here is a quick patch to fix a really common error
that I make all the time. It would be nice if Kaffe
gave a helpful error for this case. This is really an
"ease of use" issue and not a bug but I think people
might like this feature.
(before patch)
% kaffe ReflectedFloatBug1.java
java.lang.NoClassDefFoundError: ReflectedFloatBug1/java
at java.lang.Throwable.<init>(Throwable.java:37)
at java.lang.Error.<init>(Error.java:21)
at java.lang.LinkageError.<init>(LinkageError.java:21)
at java.lang.NoClassDefFoundError.<init>(NoClassDefFoundError.java:21)
(after patch)
% kaffe ReflectedFloatBug1.java
You probably meant ReflectedFloatBug1
Index: main.c
===================================================================
RCS file: /home/cvspublic/kaffe/kaffe/kaffe/main.c,v
retrieving revision 1.20
diff -u -r1.20 main.c
--- main.c 1999/01/18 21:09:21 1.20
+++ main.c 1999/02/24 10:33:01
@@ -54,6 +54,8 @@
{
int farg;
char* cp;
+ char* tmp;
+ int len;
#if defined(MAIN_MD)
/* Machine specific main first */
@@ -100,6 +102,22 @@
if (argv[farg] == 0) {
usage();
exit(1);
+ } else {
+ /* Check that SOMECLASS.java was not given */
+ tmp = argv[farg];
+ len = strlen(tmp);
+
+ if (len > 5 &&
+ tmp[len - 5] == '.' &&
+ tmp[len - 4] == 'j' &&
+ tmp[len - 3] == 'a' &&
+ tmp[len - 2] == 'v' &&
+ tmp[len - 1] == 'a') {
+
+ tmp[len - 5] = 0;
+ fprintf(stderr, "You probably meant %s\n", tmp);
+ exit(1);
+ }
}
/* Initialise */
Wed Feb 24 03:27:22 CST 1999 Moses DeJong <dejong at cs.umn.edu>
* kaffe/kaffe/main.c: helpful error message added for the
case where kaffe is invoked with XXX.java as the class name.
Mo DeJong
dejong at cs.umn.edu
More information about the kaffe
mailing list