0

カスタムフォントに関する Slick2D チュートリアルに従った後、初期化するための次のコードが提供されました。

titleFont.addAsciiGlyphs();
titleFont.addGlyphs(400, 600);
titleFont.getEffects().add(new ColorEffect()); //Type safety: The method add(Object) belongs to the raw type List. References to generic type List<E> should be parameterized
titleFont.loadGlyphs();

Eclipse は、その行にコメント付きの警告をスローします。3行目を置き換えて、Eclipseがそこに入れるように求めているものは何でも答えてください。

4

1 に答える 1

0

That warning is telling you the list returned by getEffects() is not parameterized. It is of type List. Since that list is inside the Slick library, you can't really do anything about that warning. Just carry on.

Here is the source code, I'm guessing you are using Unicode font: https://bob.newdawnsoftware.com/repos/slick/trunk/Slick/src/org/newdawn/slick/UnicodeFont.java

You can see for yourself that the effects are stored in a List rather than being parameterized.

I was wrong in my initial comment, the error isn't because of type erasure, its because the effects list is raw. See this: What is a raw type and why shouldn't we use it?

于 2012-08-27T17:31:28.967 に答える