[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mistake in TypedLinkedList?



This is a bug.

Ideally, we should use delegation, instead of inheritance, to protect against
addition of new methods in newer JDK versions.

Something like TypedLinkedList implements List, instead of "extends LinkedList",
but there might be a small performance penalty (?).

Jon Shapcott wrote:
I have noticed something rather odd about the set(int,Object) method in the
generated TypedLinkedList class. It is not defined. This means that the
set(int,Object) method defined by the Linkedlist superclass may be used to
violate the strict syntax tree property enforced by SableCC.

It is such a small change that diff are barely woth it. Just add the
following few lines to the TypedLinkedList declaration in the "utils.txt"
macro file.


public void set(int index, Object o) { super.set(index, cast.cast(o)); }

There are still a few wierd were the strict DAG property of SableCC can be
violated, but you have be doing something very strange. I've reported this
on this list previously.



--
Etienne M. Gagnon, Ph.D.             http://www.info.uqam.ca/~egagnon/
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/