• Post Reply Bookmark Topic Watch Topic
  • New Topic

generics "uses unchecked or unsafe operations" problem  RSS feed

 
Dinah Gans
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone help me understand why this gives me the following Notes?

I don't understand why my constructor doesn't seem to be using generics for myList even though when I created it I said it held generics? Thanks in advance for the help!

Note: InfiniteInt.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.




My DLList class uses objects:



 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
InfiniteInt extends the raw type DLList. you should move the Integer generic type to DLList instead:
And you should know that Integer is final so there are no subclasses of Integer
 
Dinah Gans
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow thanks!!! That solved all of the problems I was having with this & explains why it was telling me "DLList<Integer> cannot be applied to (int)" when I had changed both classes to have generics.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!