This is the mail archive of the java@gcc.gnu.org mailing list for the Java 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: how to deal with non-generic (legacy) code ?


Ahhh thanks a lot ! exactly what I was looking for !

Many thanks

David

2009/8/4 Bryce McKinlay <bmckinlay@gmail.com>:
> On Tue, Aug 4, 2009 at 4:09 PM, David Michel <dmichel76@googlemail.com> wrote:
>
>> We all know that generics have been introduced in jdk 1.5 and that
>> Sun's javac still accepts raw types for backward compatibility.
>>
>> With gcj, however, one will always get some warnings like "Vector is a
>> raw type. References to generic type Vector<T> should be
>> parameterized" when using raw types. It's easy to write the code with
>> generics properly so that these warnings do not appear, however, how
>> does one deal with, for instance, a method from a somewhat older
>> legacy code that returns a raw type.
>>
>> What is the proper way to deal with this ?
>> Is there a way to switch these warnings off ?
>
>
> Put @SuppressWarnings("unchecked") at the top of the method (or class)
> that does the unchecked type parameter conversions.
> Bryce
>


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