recompile with -Xlint:unchecked for details

hi i am getting this compiler warning when compiling my code, i have looked around google and no one seems to have had this exact message.

here is my code if it helps:

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import javax.swing.event.*;

import java.util.*;

publicclass PaintPanelextends JPanelimplements MouseListener, MouseMotionListener

{

public Color currentColor = Color.BLACK;

public Point startPoint, endPoint;

public Vector vectors;

public PaintPanel()

{

vectors =new Vector();

addMouseListener(this);

addMouseMotionListener(this);

}

publicvoid mousePressed(MouseEvent e)

{

startPoint = e.getPoint() ;

}

publicvoid mouseReleased(MouseEvent e)

{

Vectors line =new Vectors(startPoint, e.getPoint(),true);

vectors.add(line);

startPoint =null ;

}

publicvoid mouseDragged(MouseEvent e)

{

Point endPoint = e.getPoint() ;

getGraphics().drawLine(startPoint.x, startPoint.y, endPoint.x, endPoint.y) ;

startPoint = endPoint ;

}

publicvoid mouseExited(MouseEvent e)

{

}

publicvoid mouseEntered(MouseEvent e)

{

}

publicvoid mouseMoved(MouseEvent e)

{

}

publicvoid mouseClicked(MouseEvent e)

{

}

publicvoid paintComponent(Graphics g)

{

}

}

please help me, thanks

[3192 byte] By [boblettoj99a] at [2007-11-27 2:09:11]
# 1
Well add the-Xlint:unchecked option to your javac command as the message says, and it will give you more detail about the warning (and it is only a warning). But what it is, is that you are using JDK 5 or later, and using some Collection without using Generics.
masijade.a at 2007-7-12 1:59:18 > top of Java-index,Java Essentials,New To Java...
# 2

> hi i am getting this compiler warning when compiling

> my code, i have looked around google and no one seems

> to have had this exact message.

At the risk of sounding like I'm calling you a liar... that is not true. There are approximately 27.100 hits with an exact match with your topic title.

Anyway, did you actually, like it says, recompile with -Xlint:unchecked for details? If you do, you will find it points you exactly to the offending line(s). It will be in the area of declaration/use of your "Vector vectors".

Lokoa at 2007-7-12 1:59:18 > top of Java-index,Java Essentials,New To Java...
# 3

the nearest thing on google says ":deprecation for details"

when i compiled with -Xlint it just gave me a load of jargon i dont really understand. but it did point towards the line

vectors.add(line)

im very new to vectors and dont know much about them but im sure this is a perfectly good line of code...can anyone with more experience help?

boblettoj99a at 2007-7-12 1:59:18 > top of Java-index,Java Essentials,New To Java...
# 4
Your problem, as I said, has to do with Generics. http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html
masijade.a at 2007-7-12 1:59:18 > top of Java-index,Java Essentials,New To Java...
# 5
aaaaah i get it now, thanks that article helped alot!all i needed was <Vector> in a couple of places!
boblettoj99a at 2007-7-12 1:59:18 > top of Java-index,Java Essentials,New To Java...
# 6

> the nearest thing on google says ":deprecation for

> details"

Whatever. Your google must be having a bad day. Hint: enclosing your query with quotes ("your topic title") returns exact matches.

> when i compiled with -Xlint it just gave me a load of

> jargon i dont really understand. but it did point

> towards the line

> vectors.add(line)

Posting that jargon might help.

The cause is that you are using Java 1.5 or higher, and declare a Vector without specifying the type of elements it should hold. For example, if you want a Vector holding Strings, you should declare it as

Vector<String>

.

I'd advice you to google for "java generics tutorial" which would directly link you to Sun's tutorial, but... ;-p

Lokoa at 2007-7-12 1:59:18 > top of Java-index,Java Essentials,New To Java...