• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

eclipse 3.1, java 5

 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
add a 'final static long serialVersionUID' to your class.
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See http://www.prevayler.org/wiki.jsp?topic=serialVersionUID
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's not 1.5 specific but in the past didn't generate a compiler warning.
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1071
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1071
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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).
 
Ranch Hand
Posts: 472
Objective C Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would be nice to know how to teach Eclipse understand Java 1.5 syntax. It's screwing my sources very badly.
 
expectation is the root of all heartache - shakespeare. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic