• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

-Xlint error in Chat Server

 
Greenhorn
Posts: 5
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 76464
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you copied the code from an old book?
 
Today's lesson is that you can't wear a jetpack AND a cape. I should have read this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic