Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #22939 > unrolled thread

odd results on @suppresswarning("unchecked")

Started by"Aryeh M. Friedman" <Aryeh.Friedman@gmail.com>
First post2013-03-12 20:31 -0700
Last post2013-03-12 20:31 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.java.programmer


Contents

  odd results on @suppresswarning("unchecked") "Aryeh M. Friedman" <Aryeh.Friedman@gmail.com> - 2013-03-12 20:31 -0700

#22939 — odd results on @suppresswarning("unchecked")

From"Aryeh M. Friedman" <Aryeh.Friedman@gmail.com>
Date2013-03-12 20:31 -0700
Subjectodd results on @suppresswarning("unchecked")
Message-ID<710ce746-dc67-436a-91b1-068957f0326d@googlegroups.com>
I decided to switch from 1.6 to 1.7 for developing one of our major projects and am now getting warnings that I did not in 1.6.   Seems the primary suspect is @SupressWarnings("uncheck") is not being honored.   For example the following snippet compiles with no warning under 1.6 but with a warning on 1.7:

        @SuppressWarnings("unchecked")
        private Queue<CharacterToken> prep(String s)
        {
                return CollectionUtil.toQueue(new UnicodeLexer(
                   LexerUtil.lexerPrep(s),loc).getTokens());
        }

Here are are the signatures of the called methods:

LexerUtil:
public static Queue<Character> lexerPrep(String s)

UnicodeLexer:
public UnicodeLexer(Queue<Character> in,String compilationUnit)
public List<CharacterToken> getTokens()

CollectionUtil:
@SuppressWarnings("unchecked")
public static Queue toQueue(List list)

and the derivation for CharacterToken:

public class CharacterToken extends Token<Character>
public abstract class Token<T>

Why does it not work in 1.7 but does in 1.6 (yes I know the warning is generated by CollectionUtil.toQueue)?

[toc] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web