Bugs item #1003404, was opened at 2004-08-04 17:04
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=438935&aid=1003404&group_id=44253
Category: Other
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Robert Cartwright (rcartwright)
Assigned to: Nobody/Anonymous (nobody)
Summary: NullPointerException in parser/checker for elementary LL
Initial Comment:
Compiling the following elementary level program
generates a null pointer exception (or other spurious
behavior):
abstract class List {
abstract int length();
abstract List insert(Comparable o);
}
class NonEmpty extends List {
Object first;
List rest;
int length() { return 1 + rest.length(); }
List insert(Comparable o) {
if (o.compareTo(f) <= 0) return new NonEmpty(o, this);
return new NonEmpty(f, rest.insert(o));
}
}
class Empty extends List {
int length() { return 0; }
List insert(Comparable o) { return new NonEmpty(o,new
Empty()); }
}
Note that this program has a syntax error. The
variable "f" in NonEmpty should be "first".
When I tried to reproduce the bug, compiling the
program (three
separate files) generated .java files with syntax
errors. These
files suddenly appear in the open files list which is
very disconcerting.
P.S. We need to add Language Levels as a bug category.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=438935&aid=1003404&group_id=44253
|