• Post Reply Bookmark Topic Watch Topic
  • New Topic

compiling under 1.5  RSS feed

 
Nicholas Jordan
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to recompile under 1.5 so other team members can use what I have gotten working, but I get ten or so errors because the current JDK needs to have what looks like function instantiation on templated type paramaters



Just tell me where to look - links into the Java Documentation at the Sun site or anything else that gets to the point, something aimed at a bench technician with a job to do and a reasonable time to do it.

[ November 19, 2006: Message edited by: Nicholas Jordan ]
[ December 10, 2006: Message edited by: Nicholas Jordan ]
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They're not errors, they're warnings, and they can safely be ignored. Otherwise, there's an article on "generics" (as this feature is called) in the JDK doc bundle, here. That's enough to get started, anyway.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These warning have to do with generics - a good starting point is here. Basically whenever you declare a Collection or Map in 1.5, you need to tell the compiler what sorts of things will go into the collection. You do this with the new <> notation shown in the link.

Note that what you're seeing are warnings, not errors. It's possible to ignore them. But if you use generics and make the warnings go away, you'll get much better compile-time checking of the rest of your code that uses the collections and maps.

Also, genercs aren't just for collections and maps, but that's the most common case - and the one that applies to your code, apparently.
 
Nicholas Jordan
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jim Yingst:
[QB] .... get much better compile-time checking of the rest of your code that uses the collections and maps.


Compile-time time (no pun intended) is an issue, one that contributes to much of the 'style' deficiencies some have pointed out in my posts .... I will try this out, I have Thur, Sat and Sun to apply advice in this and other topics,.... I will be changing all of my variable names throughout the code to conform to camp style. We will see whether some of my claims stand up under real-world loading.

Teacher asks: 5 birds on a wire, one hit with birdshot. How many left ?

Jimmey Wiley: One, the one on the ground. The other 4 flew away....

 
Nicholas Jordan
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ernest Friedman-Hill:
They're not errors, they're warnings, and they can safely be ignored.


I know this problem inside out, sometimes phrased as un-anticipated failure modes. To cite the Generics documentation:

You should use generics everywhere you can. The extra effort in generifying code is well worth the gains in clarity and type safety. It is straightforward to use a generic library, but it requires some expertise to write a generic library, or to generify an existing library. There is one caveat: You may not use generics (or any other Tiger features) if you intend to deploy the compiled code on a pre-5.0 virtual machine.


Fortunately for my effort, the team lead is trained in this type of failure scenario. I have thrown " Twenty Trick Questions " and every one of them is recognized and handled professionally, under real world conditions. This is someone who has, been through the fire.

I note with interest, the caveat was far down the page in the documentation.

I already know to look there/\/\/\/\/\/\/

in case something goes wrong.

(the stilts are there to represent this in the post)
[ November 26, 2006: Message edited by: Nicholas Jordan ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!