odd results on @suppresswarning("unchecked")

Discussion in 'Java' started by Aryeh M. Friedman, Mar 13, 2013.

  1. 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)?
     
    Aryeh M. Friedman, Mar 13, 2013
    #1
    1. Advertising

  2. Aryeh M. Friedman

    Stefan Ram Guest

    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anonymous
    Replies:
    4
    Views:
    510
    Ioannis Vranos
    Feb 24, 2005
  2. th3dude
    Replies:
    0
    Views:
    452
    th3dude
    Jan 3, 2007
  3. Eli Criffield

    variable arguments, odd results

    Eli Criffield, Jun 13, 2005, in forum: C Programming
    Replies:
    3
    Views:
    344
    Eli Criffield
    Jun 14, 2005
  4. Michael Speer

    Odd behavior with odd code

    Michael Speer, Feb 16, 2007, in forum: C Programming
    Replies:
    33
    Views:
    1,157
    Richard Heathfield
    Feb 18, 2007
  5. RVic
    Replies:
    19
    Views:
    1,449
Loading...

Share This Page