This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

JDK 1.5 and Safe Type Enums

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hello there,
I've been reading some documentation including JSR for the new Safe Type Enum feature in JDK1.5.
Our group is considering the development of our own Safe Type Enum pattern or the adoption of the new JDK1.5 feature.
As it is stated in the JSR for this new feature:
"The proposed enum facility requires no JVM changes. It is implemented in the compiler with support from the libraries. Attributes are used to identify enum classes and enum constants in class files (JVMS 4.7). The enum facility interacts well with other language work proposed for Tiger, notably the static import statement, the enhanced for statement, and generics."
It is not clear in this statement if classes compiled with this new feature could run in a 1.4, 1.3, 1.2 JRE. It seems that JVM is compatible but some kind of base class would be needed to run with this new feature. It is supposed that this new class will be part of the rt.jar for 1.5 version but, then the real fact would be that the compilad class wouldn't run in a 1.4/1.3/1.2 environment because rt.jar doesn't include this new enum class.
Anyone there working in this can give us a little bit of light of this before new JDK1.5 is released. We should decide just now an strategy to follow.
Many many thanks,
Rafael Torcida Fern´┐Żndez
Dynasty Technology Group
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
  • Report post to moderator
This is true of any release. They are backwards compatible (for the most part) but not forwards compatible.
Something compiled in 1.4 may well not run correctly in a 1.3 JVM. Something compiled in 1.5 will probably not run in the 1.4 rt environment.
However stuff compiled in 1.3 or 1.4 will (with a few exceptions) run just fine in the 1.5 JVM and rt environment.
Which is essentially the same situation as if you decide to implement your own enum functionality. You will have to include the classes that you write to implement enums in your release, or it won't work.
However, with the 1.5 release only months away from beta, it seems a waste of your time to try to duplicate what Sun is doing, and your solution will not integrate with the other new functionality very well.
I suppose that it depends on your deadlines.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
  • Report post to moderator
However, with the 1.5 release only months away from beta, it seems a waste of your time to try to duplicate what Sun is doing, and your solution will not integrate with the other new functionality very well.
But if Rafael needs to target 1.3 and 1.4 JVMs, 1.5 won't really help anyway. The new enum functionality does depend on an Enum class, and older JVMs won't have it. The "other new functionality" will also not work on the target VMs.
Which is essentially the same situation as if you decide to implement your own enum functionality. You will have to include the classes that you write to implement enums in your release, or it won't work.
Right - the difference though is that you can include those classes, if they're your own custom classes, without worrying too much about the JVM version. You just include the classes in the jar file that you would have had to distribute anyway in odrer to install your application. But if you use 1.5's functionality, you basically have to force all the clients to upgrade to 1.5.
Historic note - back when collections were introduced to Java (1.2), you could use them in 1.1 applications if you included a a special jar file Sun had released for this purpose - collections.jar. Though as I recally there were a few little differences between the versions; it was annoying to switch from 1.1 collections.jar to 1.2 collections. And it made figuring out environments a pain. I think Sun has chosen to keep things simpler nowadays by not trying to support this type of forward compatibility. The goal seems to be to discourage people from trying to use complex hybird environments with an old JVM and a bunch of extra customizations to use newer eatures along with the old JVM. Instead, if you want to use the new features, ya gotta upgrade the JVM. Period. I'm not entirely happy with this approach, but it does keep things simpler.
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Report post to moderator
You could start using http://sourceforge.net/projects/retroweaver/files/

Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.com
 
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
Raja,
I don't know if you noticed it, but the original poster has not been active for 7 years!
http://faq.javaranch.com/java/DontWakeTheZombies
 
Friends help you move. Good friends help you move bodies. This tiny ad will help:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!