Recompile with -Xlint:unchecked for details???
843810Aug 22 2008 — edited Nov 5 2008hi friends ,
im using jdk-6-windows-i586. and apache-tomcat-5.5.26.
In development phase i got the following error while compiling
BeerExpert.java file. This is my model.
Note: BeerExpert.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
But the class file is created. Is this any type of error or just warning msg.
What is the meaning of this and what to do for it.
Then I recompile the file with javac -Xlint BeerExpert.java or javac -Xlint:unchecked BeerExpert.java
and the warning msg. appered as-
BeerExpert.java:9: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List
brands.add("Jack Amber");
error pos::: ^ error or warning position pointed by compiler
..
..
4 warnings
my source code is-
package com.example.model;
import java.util.*;
public class BeerExpert {
public List getBrands(String color) {
List brands = new ArrayList();
if(color.equals("amber")) {
brands.add("Jack Amber");
brands.add("Red Moose");
}
else {
brands.add("Jail Pale Ale");
brands.add("Gout Stout");
}
return(brands);
}
}
Any suggestions what to do? Please..
Thanx in advance.