File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Features new in Java 7 and the fly likes just want to fix the compilation errors by moving to Java7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Features new in Java 7
Bookmark "just want to fix the compilation errors by moving to Java7" Watch "just want to fix the compilation errors by moving to Java7" New topic
Author

just want to fix the compilation errors by moving to Java7

Siva Meka
Greenhorn

Joined: Aug 11, 2008
Posts: 6

Hi,
what many application developers do while they migrate/upgrade to a new version of Java, they just fix the compilation issues with the deprecated APIs.
My question for them..what's the use if you are just upgrading to newer version and making use of any of the features or updates that it has provided you. The simple answer is not enough time to look into the feature in a maintenance project. We all should agree that is a fair case in most of our maintenance projects.

What is your take on this? Is this book answer the questions of an easy upgrade and jump start with new features of Java 7.
Shiv Swaminathan
Ranch Hand

Joined: Jul 21, 2010
Posts: 48

Whenever we upgrade existing applications to a new version of Java, our first step is migration. The goal during migration is to first get the application working as-is an not trying to use new features.
By migrating we lay out a platform, to start using the new language features for the enhancements that you might plan on your application. Unless there is a forcing need we dont have to go for refactoring the existing code to use the new features provided by the upgrade.

I like's Jeff's answer in the following post

http://www.coderanch.com/t/607069/Java/java/Queries-Java-Beginner-book

There is an old saying: "If something ain't broke, don't fix it." If a company is getting good use out of a previous version of Java, there is little need to upgrade (although that sucks for developers). The only considerations that I can see for obtaining a newer Java version are:

1) The new version fixes a security problem or other bug.
2) Oracle has "end-of-lifed" the Java version being used and this is a problem for the company using that version (e.g., there will be no more bug fixes).
3) A company wants to upgrade software using the current Java version and a newer Java version offers features (e.g., web services support) desirable for the upgrade.

There may be other considerations as well. You could make these points to your company management and see if they agree.


SCEA EE5, CSM, PMP, IBM OOAD with UML, SCDJWS, SCWCD, SCJP 1.5
Siva Meka
Greenhorn

Joined: Aug 11, 2008
Posts: 6

Shiv, I completely agree with your reply.
As you said, mostly managers never want to go for an upgrade unless there is something that cannot be solved with the present release.
We are thinking of moving to Java 7 from java 6. I just wanted to make use of enhancements to multithreading and try-catch blocks.
Any suggestions from your end to jumpstart with new features while we upgrade to newer version.

Also thanks for refering to other post. That was an interesting read.

thanks
Siva
Shiv Swaminathan
Ranch Hand

Joined: Jul 21, 2010
Posts: 48

@Siva, If you upgrading to Java 7 from Java 6, the best place to start is, during your application bug fixes and enhancements you can re-factor the existing try-catch to try with resources which generates efficient byte codes and also provides cleaner way of handling resources closing. But beware that the re-factoring that you do must not have any heavy regression testing need on the application, so don't try to update the code in common modules unless needed.

With respect to mutli-threading there is not much need for enhancement in your application unless you have used any custom class loaders. Even if you have custom classloaders I would say adhere to an acyclic class loader delegation model to avoid the deadlock issue which is what is fixed in Java 7.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36501
    
  16
Shiv Swaminathan wrote: . . . re-factor the existing try-catch to try with resources which generates efficient byte codes . . .
How do you know?Agree that the syntactic sugar of try‑with‑resources made that second method easier to write, but its bytecode is about 30 instructions longer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: just want to fix the compilation errors by moving to Java7
 
Similar Threads
Java 5 to 7 upgrade for using new programmatic features released
byte code compatibility with 6 ?
WSAD 5.0.1 JDK
Daylight Saving Time in Java5
how to use jsr