Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Recompile with -Xlint:unchecked for details???

843810Aug 22 2008 — edited Nov 5 2008
hi 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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 3 2008
Added on Aug 22 2008
4 comments
5,898 views