Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java uses unchecked or unsafe operations

 
Chris Jr
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to servlets please help with the second servlet version from HF book

When I try to compile the BeerExpert.java (code in page 82) class it says
Note: src\com\example\model\BeerExpert .java uses unchecked or unsafe operations
Note:Recompile with -Xlint Unchecked for details.

Not sure What this means.
 
Karen Jirak
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Chris,

What compiler are you using, 5.0? You get those warnings when you use Lists and you don't specify types, because of the new generics in 5.0. It's nothing to worry about... they are most likely just warning you that you are inserting a raw object into a list and it wants you to parameterize it. It's no problem for the running of the application, though.
 
Chris Jr
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply, Karen.
 
MI Mohammed
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chris,

It shows you are using java 5.0. Read the generic topic of the java official tutorial, you will just be fine.
All the same, it just a way of ensuring the right thing ends up at
the right place. Say a basket of red balls will always contain red balls.
For the example, guess it takes string, so you have to ensure that it is a List of Strings.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic