Generics Usage Warning-Type safety:The cast from Object to Collection<String> is....

Discussion in 'Java' started by niceguyi, Jan 22, 2008.

  1. niceguyi

    niceguyi

    Joined:
    Nov 13, 2007
    Messages:
    1
    In Eclipse I m getting the following warning while I tried to use generics.

    "Type safety: The cast from Object to Collection<String> is actually checking against the erased type Collection"

    My code goes like...

    Collection rules = null;
    rules = (Collection<String>) JmxServiceAgent.invoke(InfoVO);


    Where "JmxServiceAgent.invoke(mBeanInfoVO)" will return an object and my expectation is of type Collection<String>

    Please letme know watz wrong with the code?
    niceguyi, Jan 22, 2008
    #1
    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. Imran Aziz
    Replies:
    4
    Views:
    8,671
    ljenner01
    Jan 19, 2011
  2. keithb
    Replies:
    3
    Views:
    18,495
    =?ISO-8859-1?Q?G=F6ran_Andersson?=
    May 7, 2006
  3. Øyvind Isaksen
    Replies:
    1
    Views:
    948
    Øyvind Isaksen
    May 18, 2007
  4. kathychow
    Replies:
    0
    Views:
    2,100
    kathychow
    Mar 31, 2009
  5. grz01

    Type safety warning...

    grz01, Sep 23, 2009, in forum: Java
    Replies:
    19
    Views:
    2,187
Loading...

Share This Page