compiling under 1.5

Nicholas Jordan

Ranch Hand

Posts: 1282

posted 11 years ago

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.

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.

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.

"I'm not back." - Bill Harding, Twister

Nicholas Jordan

Ranch Hand

Posts: 1282

posted 11 years ago

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....

"The differential equations that describe dynamic interactions of power generators are similar to that of the gravitational interplay among celestial bodies, which is chaotic in nature."

Nicholas Jordan

Ranch Hand

Posts: 1282

posted 11 years ago

Originally posted by Ernest Friedman-Hill: They're not errors, they're warnings, and they can safely be ignored.

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 ]

"The differential equations that describe dynamic interactions of power generators are similar to that of the gravitational interplay among celestial bodies, which is chaotic in nature."