This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GSOC | Extending Common Lisp support


On Apr 25, 2012, at 6:42 PM, Charles Turner wrote:

Sidenote: I'm having trouble logging into Savannah, but I noticed this
buglet today:

#|kawa:1|# (zero? (define-simple-class))
java.lang.NullPointerException
	at kawa.standard.define_class.rewriteForm(define_class.java:122)
...

I've made a note to look into it at some point in the future, but
NullPointerExceptions aren't good, so maybe if anyone else has time,
they could look at why that's happening.


(define-simple-class) is a syntax error, of course, but yeah a NPE isn't
very helpful. The cause is that define_class#rewriteForm() does this:

Declaration decl = null;
Object form_cdr = form.getCdr(); // form is the list (define- simple-class), so form_cdr is ()
if (form_cdr instanceof Pair) // and () is not a pair, so we skip directly to line 122
{
...
}
ClassExp oexp = (ClassExp) decl.getValue(); // here, where decl is still null, triggering the NPE



So that if statement should probably have an else clause, something like


    else
    {
      return tr.syntaxError(this.getName() + ": missing class name");
    }

or maybe "else if (form_cdr == EmptyList.emptyList) { ... } else {...}"
so other bad syntax like "(define-simple-class . 42)" can have a different
error message.


-J

--
Jamison Hope
The PTR Group
www.theptrgroup.com




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]