[Kaffe] ease of use patch.
Jan Weerts
weerts at pu.informatik.tu-darmstadt.de
Thu Feb 25 04:01:15 PST 1999
Alexandre Oliva wrote:
>`java' is not a keyword, `class' is. Nevertheless, this is all
>irrelevant: the question is whether `class' and `java' are valid class
>names in terms of bytecode, not in terms of Java source.
Hi there,
Using the given example (and the 'class'-version):
public class java {
public static void main(String[] argv) {
System.out.println("java ran");
}
}
I created two class-files demonstrating that 'class' and 'java' are
valid classnames. Prove done by execution on different VMs :-), not
the spec. Find them attached.
Tested on: kaffe-snapshot SunOS 4.1.3_U1
jdk1.1.6 SunOS 5.5.1
Symantec Java for jdk1.1.x WinNT 4
For me it looks like the VMs accept most class names. As someone
already noted, we talk about two different things here. Compilation of
java-sourcecode and interpretation of java-bytecode.
The compilers seem to vary in behaviour (who would have thought
that). For the java.java-version the jdk-compiler gives following
error, where pizza runs smoothly:
error: File ./java.java does not contain nested type
java. lang.Object as expected. Please adjust the class path
so that the file does not appear in the unnamed package.
java.java:1: Superclass java. lang.Object of class java not found.
IMHO the second lines shows, that Sun's compiler already interprets the
"java" as a start of a hierachical class name. The opinions about this
being correct or not may vary...
Errors are the same for class.java on both compilers (keyword).
Two sidenotes on execution:
- Accidently creating wrong bytecode with wrong type signature
(missing return-type of println) showed different behaviour on Sun's
VM and Kaffe's:
Sun: java.lang.NoSuchMethodError: java.io.PrintStream: method
println(Ljava/lang/String;) not found
Kaffe: Abort
- Having this error, I also tried wrong paramter types (int instead of
String) and had different results:
Kaffe: 3931392
Sun: -312041552
Is this a problem of different machines/operating systems? Not that
I want a bytecode-error to be executed on all platforms in the same
way :-).
Verfifying the bytecode on Sun's compiler just gives the
blarney-answer: Can't find class class
Thanks to all you delevopers out there. Else I would have no good java
on my old SunOS4.1.3 system
Jan
--
Jan Weerts for my PGP key: send email with subject "get pgp key"
#include <spammers-warning>
I know, you believe, you understood, what you think I said; but I am not
sure, you understand, that what you heard, isn't what I meant. [Nixon]
More information about the kaffe
mailing list