[kaffe] kjc generics bug
Matthias Pfisterer
Matthias.Pfisterer@web.de
Mon Jan 19 10:52:02 2004
This is a multi-part message in MIME format.
--------------070005040000030103020600
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Hi,
I found a bug in the generics support of kjc. The attached program
produces an error:
---
artemis:~/java/genericstest>kjavac -generic FakeList.java
FakeList.java:39: error:Too less type arguments for type "FakeList";
required: 1 [JSR 41]
artemis:~/java/genericstest>kjavac -version
Version 2.1A released 11. February 2002
---
With the compiler if the Sun JDK 1.5.0, there is no error message.
Matthias
--
Matthias Pfisterer <mailto:Matthias.Pfisterer@web.de>
Reuchlinstrasse 28 phone ++49-711-62 87 12
D-70176 Stuttgart (in Deutschland 0711-62 87 12)
GERMANY
Work like you don't need the money.
Love like you've never been hurt.
Dance like nobody is watching.
Java Sound Resources (examples, FAQ, applications):
http://www.jsresources.org/
Tritonus, the open source implementation of the Java Sound API:
http://www.tritonus.org/
--------------------------------------------------------------
--------------070005040000030103020600
Content-Type: text/java;
name="FakeList.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="FakeList.java"
/** A List class skeleton with generics.
Used to test if compilers handle generics.
*/
public class FakeList<E>
{
private E[] m_data;
public FakeList(int nSize)
{
m_data = (E[]) new Object[nSize];
}
public int size()
{
return m_data.length;
}
public void set(int nIndex, E element)
{
m_data[nIndex] = element;
}
public E get(int nIndex)
{
return m_data[nIndex];
}
/** Some tests for this class.
*/
public static void main(String[] args)
{
// kjc gives an error on this:
FakeList list = new FakeList<String>(22);
// With this line instead, there is no error
// FakeList<String> list = new FakeList<String>(22);
out("length: " + list.size());
list.set(21, "abc");
out("element #21: " + list.get(21));
}
private static void out(String s)
{
System.out.println(s);
}
}
--------------070005040000030103020600--