[60] in java-interest

home help back first fref pref prev next nref lref last post

Questions on importing and the VM spec

daemon@ATHENA.MIT.EDU (Jeremy Fitzhardinge)
Mon May 8 12:25:34 1995

From: jeremy@sour.sw.oz.au (Jeremy Fitzhardinge)
To: java-interest@java.Eng.Sun.COM
Date: Mon, 8 May 1995 19:17:54 +1000 (EST)

Hi again.

A couple of little problems in the VM spec:

Documentation for attributes is a little odd.  The docs for constant
value attribute keeps talking about source file attribute.

There's a little discussion in the Class file format about the
access bits.  It says it says at most one of ACC_PUBLIC and
ACC_PRIVATE can be set: what about ACC_PROTECTED?  What about
none set and other allowable/forbidden combinations?

Is there a discussion about special method names like "<init>"?
I noticed some others (but I can't remember what now).  I assume
"<init>" is a constructor for a class, and there can be more
than one.  Must there be at least one, even if its compiler
generated, or does the runtime generate one for those which
are missing? 

Thanks,
	J

I posted the following the other day, but I didn't see a reply.
Perhaps it didn't get out, I didn't notice.

- -----

In the VM spec, in the section on the format of the constant pool,
it has a table with the values of CONTSTANT_*.  However, it doesn't
list CONSTANT_Unicode which it mentions in the discussion below.
I guessed its value is 2, because that's a gap in the table, and
a look at oobj.h in the runtime include files confirms this.  Is
there any reason for the random formatting of the table?

If you do "import some.pkg.*", does the compiler look through
CLASSPATH and find the first directory mapping to some.pkg and
import all the classes in that, or does it import every class in
every some/pkg directory in CLASSPATH?  What if you import the same
class twice?  If it imports the union of all some/pkg directories
in CLASSPATH, what happens if it finds multiple implementations
for a particular class?

What classes are implicitly imported, if any?  I assume that
java.lang.Object and java.lang.String are, but is the whole
of java.lang.* implicitly imported?  Anything else?

The language spec talks about the operators abs(), max() and
min() in 7.1, Operators.  I notice that java.lang.Math defines
these as methods, so I wonder if they are really considered to be
part of the language or as part of the library (that is, are they
really "operators" or methods in the standard library?).  Is it
legal to just have

import java.lang.Math;
// ...
	int i = min(int1, int2);

or do you have to say

	int i = Math.min(int1, int2);?

If they are operators, are they keywords?  If so, it would make
java.lang.Math hard to compile, unless there's some special rules
about method names and reserved words...

Also, it doesn't actually describe what they do.  Sure, they have
descriptive enough names, from which you can guess their operation,
but all the spec says about their semantics is that "The operators
abs(x), max(x,y), and min(x,y) work for integers as they do for
all numbers" (ditto for floats), and there's no fallback on the C
standard.  The class API doc doesn't say what Math.abs() etc do
either.

Thanks,
	J
- ------


-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post