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

Compile Xlint Errors

 
B Crosthwaite
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I am in the process of following a tutorial from the head first JSP & servlets book and i have got stuck. Hopefully someone will be able to help me.

I have copied this code from the book


When i come to compile the code i get this message in the terminal


After i recompile with -Xlint i get these messages


Does anyone have any idea where i am going wrong?

Thanks,
-Ben
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They aren't errors but warnings.

If you read this part of the Java Tutorial I'm sure you'll get a better understanding.
 
Reinhard Horn
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ben,

replace

public List getBrands(String color) {

with

public List<String> getBrands(String color) {

and

List brands = new ArrayList();

with

List<String> brands = new ArrayList<String>();

and your warnings will vanish. The problem has to do with generics, which are introduced
since Java Version 1.5

Kind regards
 
B Crosthwaite
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you worked like a charm.

-Ben
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic