Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #5002
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Newsgroups | comp.lang.java.gui |
| Subject | Re: What do these errors mean? |
| Date | 2012-02-12 08:54 -0800 |
| Organization | http://groups.google.com |
| Message-ID | <27486591.640.1329065646306.JavaMail.geo-discussion-forums@pbd3> (permalink) |
| References | <4f37e5ef$0$2478$db0fefd9@news.zen.co.uk> |
On Sunday, February 12, 2012 8:16:44 AM UTC-8, A B wrote:
> I've finally got around to compiling my program with -Xlint, as the compiler
> kept nagging me to. This is what I got. (I've removed some entries for
> different bits that caused identical errors.) I haven't a clue what any of
> it means or what to do about it; can anyone enlighten me? What's a raw
> type, for instance, and what's a serializable class and how do you give it a
> definition of serialVersionUID?
You need to read the Java tutorials before you code.
<http://docs.oracle.com/javase/tutorial/index.html>
Every single one of those terms is eminently searchable, did you but take the
effort to do so:
<http://lmgtfy.com/?q=Java+raw+type>
The first result of which points to the Java Language Specification, which has
an entire section on raw types:
<http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#110257>
The tutorial explains your problem:
<http://docs.oracle.com/javase/tutorial/extra/generics/legacy.html>
"When a generic type like Collection is used without a type parameter, it's
called a raw type."
You need to read the Java API docs as you code.
<http://docs.oracle.com/javase/7/docs/api/>
If you look at the docs for 'JComboBox' you will see that it's a generic type:
<http://docs.oracle.com/javase/7/docs/api/javax/swing/JComboBox.html>
You neglected to specify the item type for the combo box.
You show us none of your code, for shame, but clearly you defined your class as
'implements Serializable' ('implements java.io.Serializable'). This is in your
code, so presumably you looked up the API docs for 'Serializable' and read them
thoroughly. Otherwise, why did you use it?
A "serializable class" is one defined that it 'implements Serializable', and in
the Javadocs for that interface they explain about 'serialVersionUID'. Read it.
<http://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html>
Then, do not use 'Serializable'. Do not use it. Stop using it.
Until you have purchased and studied /Effective Java/ (2nd ed.) by Joshua Bloch.
<http://java.sun.com/docs/books/effective/>
which devotes its entire Chapter 11 to serialization and 'Serializable'. You
must not use Java serialization until you properly understand it! /Effective
Java/ has the best explanation of serialization, its dangers (of which there
are many) and how to circumvent them.
Next time, post an SSCCE.
http://sscce.org/
> ----------------------------------------------
> Vectorine.java:39: warning: [rawtypes] found raw type: JComboBox
> JComboBox droplist = new JComboBox();
> ^
> missing type arguments for generic class JComboBox<E>
> where E is a type-variable:
> E extends Object declared in class JComboBox
The message is pretty darned clear. You are missing the type arguments. So add
type arguments! See the Javadocs, linked above.
> ...
> Vectorine.java:21: warning: [serial] serializable class Vectorine has no
> definition of serialVersionUID
> public class Vectorine extends JFrame implements ItemListener, MouseListener
> ^
> ----------------------------------------------
Don't declare the class 'Serializable'.
> (DatasetReader is another class in my program, which the main class creates
> an instance of so it can use its methods to look up data. Anything else I
> should explain, just tell me.)
Stop the hand waving. If code is relevant, show the code, don't just describe
it.
http://sscce.org/
In your case, the problem is not in the code but in insufficient study
beforehand. Read the tutorial before setting finger to keyboard to code again.
*LOOK UP* terms that you don't recognize! Read the Javadocs.
GIYF.
--
Lew
Back to comp.lang.java.gui | Previous | Next — Previous in thread | Next in thread | Find similar
What do these errors mean? "A B" <@bleBaker.uk> - 2012-02-12 16:16 +0000
Re: What do these errors mean? Lew <lewbloch@gmail.com> - 2012-02-12 08:54 -0800
Re: What do these errors mean? Knute Johnson <nospam@knutejohnson.com> - 2012-02-12 08:55 -0800
Re: What do these errors mean? Lew <lewbloch@gmail.com> - 2012-02-12 09:07 -0800
Re: What do these errors mean? Knute Johnson <nospam@knutejohnson.com> - 2012-02-12 09:17 -0800
Re: What do these errors mean? Roedy Green <see_website@mindprod.com.invalid> - 2012-02-13 07:47 -0800
Re: What do these errors mean? "A B" <@bleBaker.uk> - 2012-02-16 20:50 +0000
Re: What do these errors mean? Lew <lewbloch@gmail.com> - 2012-02-16 13:01 -0800
Re: What do these errors mean? "A B" <@bleBaker.uk> - 2012-02-16 21:44 +0000
Re: What do these errors mean? Jeff Higgins <jeff@invalid.invalid> - 2012-02-16 17:54 -0500
Re: What do these errors mean? "A B" <@bleBaker.uk> - 2012-02-17 18:21 +0000
Re: What do these errors mean? Roedy Green <see_website@mindprod.com.invalid> - 2012-02-17 15:36 -0800
csiph-web