This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I am working for a client on migrating his applications from Java5/6 to Java7.I have already gone through the new features in Java7 like try-with resources,Switch with strings,etc.
My client's idea of migration is NOT TO change the code (as much as possible) during migration.Unfortunately that is not negotiable.Minor changes to code are ofcourse acceptable if it affects performance or if there is any deprication.
With this background in mind,I surfed through various resources on the web and could find only one glitch with JDK 1.7 in compariosn to JDK 1.6 (Not really sure if this is fixed in any of the new builds of java 7,if so please enlighten me on it)
It says that the hashmap is now designed to be force synchronised and would show performance issues in JDK 7 when compared to JDK 6.
I need your help from your experiences or migration projects of what are the aspects or code snippets that I need to validate in addition to compiling the code with JDK 7.Any help is appreciated.
Note that this implementation is not synchronized.
Shyam Sunder V R
Joined: Jul 29, 2008
Thanks that really helps...Apart from that if someone could help in answering the other part of my question...
"I need your help from your experiences or migration projects of what are the aspects or code snippets that I need to validate in addition to compiling the code with JDK 7.Any help is appreciated"
Joined: Mar 17, 2012
Moves to Java 7 from 5 and 6 don't really require much (if anything at all). It's backwards compatible so if you are not allowed to make changes you can just start running the old code on on the new run time without affecting the logic. You can chose which parts you want to improve by using new language features based on their usefulness for your particular project.
Oracle is always very careful to keep new Java versions compatible with older versions. You should be able to run your code on Java 7 without changing anything (you don't even need to recompile your code).
I haven't changed a thing since I went from Java 6 to Java 7, and I cannot actually recall coding anything specific to Java 6. Although some of the resources I tap into probably do so. If I'm not mistaken, Java 6 finally got annotations to be civilized.
I think you read the specs on HashMap wrong. A number of classes in their original implementations were synchronized, including Vector. When Sun began to seriously implement collections, the newer stuff was all non-synchronized, and a simple capability was supplied to make any particular instance of a collection be synchronized. The older, always-synchronized classes remain, however, and they continue to be synchronized, just discouraged in favor of the default-unsynchronized classes. Hence StringBuffer/StringBuilder, Vector/ArrayList, and so forth.
Customer surveys are for companies who didn't pay proper attention to begin with.