Backport175 1.0 released: Annotations for Java 1.3 & 1.4

Discussions

News: Backport175 1.0 released: Annotations for Java 1.3 & 1.4

  1. backport175 is porting of the Java 5 annotations (JSR-175) specification to the Java 1.3 and 1.4 platform, making strongly typed annotation available for older JVMs. They are bytecode compatible with Java 5 annotations making them available for use by tools or AOP frameworks.

    The project also includedes plugins for IDEA and Eclipse.

    Check out Backport175.

    Threaded Messages (6)

  2. Hibernate 3?[ Go to top ]

    Does this mean that we can use Hibernate 3 anotations with a 1.4 JVM?
  3. Hibernate 3?[ Go to top ]

    Does this mean that we can use Hibernate 3 anotations with a 1.4 JVM?

    No, because HB3 annotations would have to use Backport.
  4. Hibernate 3?[ Go to top ]

    Bill

    It is not exactly that. Backport is not intrusive.

    Ones would need to ship java 1.3/1.4 interfaces that mirrors the official Hibernate Java 5 annotations. That 's a fairly straightforward task (Backport does support default values as well f.e.). Let's call it "hb-anno-1.3.jar"

    From there ones write its source code of persitent object for 1.3/1.4, thus using doclets style.
    The build process for this user would then be:
    - compile with regular javac (1.3/1.4)
    - use Backport (Ant task / IDE plugin) with the hb-anno-1.3.jar in the classpath to process the Hibernate doclets annotations

    the output will then be 1.3/1.4 level .class files that will be understood out of the box by Hibernate.

    The question is then - does Hibernate 3 reads the annotation using reflection (thus requiring Java 5) or using some more low level way that works on Java 1.3/1.4? ie is it possible for Hibernate to support its annotation style even on 1.3.

    Alex
  5. Hibernate 3?[ Go to top ]

    IMO it makes no sense to use annotations wo Java 5. Here are the 2 *very* good reasons to use annotations:
     - implicit contextual informations: Generic collections are a time saver in conjunction with H3 annotations
     - Type safety and refactoring
    Both of them require Java 5
  6. Wrong direction[ Go to top ]

    I think this solution goes the wrong direction. The other direction - develop with jdk 1.5 and port this back to achieve 1.4 or even 1.3 compatibility - i would recommend.

    The tool of choice for this is retroweaver.
  7. Wrong direction[ Go to top ]

    The actual direction is not to force the user in some or other way, but have your project / lib / framework provide almost the same feature set on both 1.5 and 1.4 - with implicit and undeniable benefits when using 1.5.
    We have done that for more than 2 years f.e. in AspectWerkz by providing a way to write plain java aspect using annotation - this with or without Java 5.

    This means that teams that are working with 1.4 (as in real world) can use today annotations. This is not at all new (XDoclet etc). The difference with backport is bytecode compatibility hence this helps tools that consume those annotations (f.e. AOP).

    I would never go with retroweaver since it is the best option to use Java 5 features (directly or thru some third parties) that won't be retroweaved at all - hence be stuck in some middle unnamed version 1.4 / 1.5
    Simple example: annotations, runtime visible annotations.
    Another example: use of JDK concurrent, or new java.lang.reflect calls and so on.

    I think the purpose are simply different. We do one thing and one thing well.
    Alex