wood burning stoves 2.0*
The moose likes IDEs, Version Control and other tools and the fly likes eclipse 3.1, java 5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "eclipse 3.1, java 5" Watch "eclipse 3.1, java 5" New topic
Author

eclipse 3.1, java 5

miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i just migrated some code to eclipse 3.1 and configured it to java 5; ever since i get these yellow warnings.
eg:
QUOTE]
The serializable class EncontraContratoException does not declare a static final serialVersionUID field of type long

How can i get rid of them?

TiA


java amateur
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
add a 'final static long serialVersionUID' to your class.
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
thanks, Steven

i found that in /properties for proj/enable project specific settings/potential programming problems/ i can tune warnings.

but i wonder why should i code that line: is it java5 specific?
May it generate problems if i dont?

TiA
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
See http://www.prevayler.org/wiki.jsp?topic=serialVersionUID


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
It's not 1.5 specific but in the past didn't generate a compiler warning.


42
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i migrated my code to eclipse 3.1 but i'm not yet prepared to change it to java5

i have douzens of msgs like:
Type safety: The method iterator() belongs to the raw type Set. References to generic type Set<E> should be parameterized

i'd like to know if i could turn off those msgs while i keep working, ( eventually turning them on again when having those features understood), and if that turning off would be safe.

It's not 1.5 specific but in the past didn't generate a compiler warning.

maybe i'm not aware of those compile msgs because eclipse hiddes that from me;

but when i use command line to compile several files previously written with 1.4, java5 often tells me to recompile with -Xlint and then i see warnings, mostly (if all) about using deprecated stuff
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
You can tell eclipse to use the 1.4 compiler. I'm not sure if you can turn off the warnings with the 1.5 compiler.
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i disabled those above mentioned warnings inside eclipse, using java5

from command line i can see:
prompt>javac -cp . logica/ActoMedico.java
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
prompt>javac -Xlint -cp . logica/ActoMedico.java
logica/ActoMedico.java:28: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.ut
.Set
tecnicas.add(tecnica);
^
1 warning

Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
It's giving you warnings about using collections without using generics. These won't go away unless you find some way to disable them in eclipse, or start using generics.
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
These won't go away unless you find some way to disable them in eclipse

yes, i already described how to

One Q:
can i use java5 iterator (blabla b : bla)without generics or all this new java5 stuff?
(i tried without success...)

TiA
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30123
    
150

Originally posted by miguel lisboa:

yes, i already described how to

One Q:
can i use java5 iterator (blabla b : bla)without generics or all this new java5 stuff?
(i tried without success...)

TiA

The java 5 iterator uses generics by definition, which explains the lack of success.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
Originally posted by miguel lisboa:


One Q:
can i use java5 iterator (blabla b : bla)without generics or all this new java5 stuff?
(i tried without success...)

TiA


Perhaps I am not understanding what you are asking. I think you are asking if you can compile/run with java 5 and use the only the new for loop construct; that is, with raw collections (that don't use generic features). You can do this:

import java.util.ArrayList;


Since you're not using generics you need to cast the objects if you need them as Integer (or whatever object type you are using).
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

It would be nice to know how to teach Eclipse understand Java 1.5 syntax. It's screwing my sources very badly.


Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: eclipse 3.1, java 5
 
Similar Threads
JVM terminated. Exit code=2
eclipse 3.0 and java 5
Is it me or just Eclipse... JEdit too...
The winners...
Eclipse 3.1