finding undefined classes


Subject: finding undefined classes
From: Karl Lieberherr (lieber@ccs.neu.edu)
Date: Thu Nov 16 2000 - 08:51:32 EST


In the check for undefined classes you should, in principle,
check for classes defined in imported packages. Based on Doug
Orleans' statement below this is an optional
task. You get full credit if you only search for classes
defined in the class dictionary.

-- Karl L.

> Should I advise them not to find the names of all imported classes.
> Or is it easy to find out which classes are imported, for example,
> by java.util.*

It's not too hard, but it's not trivial. You have to search the
directories in the class path for .class files in subdirectories
corresponding to the package name, e.g.

    foo/java/util/*.class

for each "foo" in the class path. You also have to search the .jar
files in the class path; the Java library has utility classes for
opening jar files and getting indexes. (Note that DJ doesn't
currently do this.)

> Can the undergrads do this? And if so, please can you provide
> a hint how to go about it.

This is an interesting Java exercise, but not a very interesting
adaptive programming exercise, and not even really an interesting
programming exercise-- it's mostly an exercise in using the Java
libraries (namely java.io and java.util.jar). I'd say undergrads
could probably do it, but is this really what you want them spending
their time on?



This archive was generated by hypermail 2b28 : Thu Nov 16 2000 - 08:52:12 EST