• Post Reply Bookmark Topic Watch Topic
  • New Topic

-Xlint error in Chat Server  RSS feed

 
Harsh Misra
Greenhorn
Posts: 5
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


This is a part of my code for chat server for which I ain't getting any compilation errors for syntax but I am getting an error
Note: ChatServer.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.


As I am a newbie I don't know about the -Xlint errors.So I compiled with command
javac -Xlint:unchecked ChatServer.java

and got the following error
ChatServer.java:24: warning: [unchecked] unchecked call to add(E) as a member of
the raw type ArrayList
clientOutputStream.add((Object)p);
^
where E is a type-variable:
E extends Object declared in class ArrayList


So please help me out to understand this error and the way to corect it.
Thanks in advance.
 
Joe Ess
Bartender
Posts: 9429
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Harsh Misra wrote: but I am getting an error


This is not an error. It's a warning so you are free to ignore it.
If you want to get rid of it, have a look at the Java Tutorial chapter on Generics which explains the syntax involved.
 
Campbell Ritchie
Marshal
Posts: 55772
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you copied the code from an old book?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!