Friday, February 25, 2005

Non generic collections in J2SE 5.0



It seems you cannot use the plain old collection objects - the non generic versions aka "raw" collections - anymore without getting unchecked warnings!

The following code doesn't use any generics but compiler throws unchecked warnings as shown below:

List c = new ArrayList();
c.add(new Object());

>javac -Xlint Test.javaTest.java:10: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List

c.add(new Object());
^
1 warning

Compiler has infact recognized the "raw" type but still decides to throw a generic related - note the type variable E - warning. Price for "guaranteed" type safety I guess!



Food for thought: IT folks are usually skeptical about the X.0 versions and tend to wait for the X.xx before taking the plunge!

Sun Generics tutorial bug



As per the Sun Generics tutorial page # 15, Section 7.3 - Arrays, you can declare array types whose element type is a type variable or a parameterized type, but not array objects.

The sample code there states that the following is legal but would generate unchecked warning.


List<String> c[] = new List<?>[10];


But actually this code doesn't compile and so it doesn't appear to be legal. It seems only unbounded wild cards are allowed for both array types and array objects. So following code is legal and it works too:


List<?> c[] = new List<?>[10];


Very strange this being the "official" tutorial. Hope someone fixes this soon.

Thursday, February 24, 2005

Free IBM certification vouchers!!!



IBM has started giving out free test vouchers (worth $175 ) again! It seems they do it every year for a limited period of time. Here's what you need to do - take the 10$ pre-assesment test at the IBM test site. This test is very easy and it seems they use the same set of questions. It is an online test anyway- no need to go to a test center ;) (Check this link in case you didnt get my drift!). IBM will send you the voucher in 3-4 days once you pass the test. To be eligible, you need to take the pre-assessment before this April 30th and the free voucher itself is valid only till June 30th. Here's the official announcement if you wanna take a look. Many people at Javaranch have already received thier free vouchers and there are only about a 400 or so left it seems - so hurry up and all the best!

Using Commons logging with Websphere



Having trouble running Jakartha commons logging with Websphere?

This IBM link might save you some pain!

Friday, February 11, 2005

SCJP5 (Tiger) , Generics and Concurrency



Took the Sun beta exam for SCJP5 (Tiger) yesterday. I had this free voucher and we were having knowledge sharing sessions on new Tiger features at work - which kind of helped me make my decision but the real point of attraction was the long 5 hour torture! I really wanted to see if I could stand the 5 hour marathon exam with 160+ questions. And I guess I made it even though I got burned out at the end! About after 4 hours into the test I could look at the questions and realize that it is a simple one, but couldn't get myself to concentrate enough to pick the right answer !!! Especially the ones with exhibits (code) - I didn't even bother to click those. I really wonder what the exam authors were thinking when they designed this mammoth. I mean it would be pretty hard to make a fair judgment on the difficulty level based on the test takers performance. Well.. Unless you go to the extreme extent of time slotting exam and judge difficulty level separately for each slots - provided the test engine is capable of capturing all necessary inputs for such an exhaustive analysis!


Content wise I think the exam was pretty tough - lots of generic and autoboxing stuff from the new feature side. But the ones that I got beaten up was the thread ones - not too tough technically but a whole set of lengthy code exhibits combined with the dreaded "this code will not compile/complier error" as a valid option makes them really really hard! However bit of a disappointment with the new concurrency stuff - not even a single question related to any of the new util.concurrent package or the new concurrent collections. Even though it is not explicitly mentioned in the exam objectives, I was expecting a few questions as I think this is one of the most important addition - maybe even more important than generics from a usability perspective. I mean this is stuff that we, Java developers, have been missing for a long time. Btw the drag and drop questions were fun - they have got it right this time and I really enjoyed those.


Anyway now that I'm done with it, I am happy I took it. And the news today at javaranch
is that the beta deadline got extended until March 6 - So plenty of time still if you want to take it - costs only 50$ instead of the regular 150$. But here's my advise - wait for the official 2 hour(or so) exam - because this five hour torture is definitely not worth it.

Wednesday, February 02, 2005

Free gmail accounts giveaway



I've got some gmail account to giveaway if you need. Add a comment with your email below and I'll send one your way - first come first serve! Btw if you didnt know already, you could get gmail invites by starting a blogger account. Thats how I got mine - not sure if it still works though..