Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


Support for Annotations

  • I'm working on the Hibernate project and a huge userbase that needs to deploy JDK 5.0 annotations on JDK 1.4. I'm very clueless about JVM details, can anyone give an estimate on the effort that would be required to support Annotations in Retroweaver?

    • Toby Reyelts
      Toby Reyelts

      Hi Christian,

      It really depends upon your use case. Retroweaver basically leaves the 1.5 annotations intact withiin the transformed class file. This means that JDK1.5 annotation-processing tools should be able to understand and use those annotations just fine.

      If you need the annotations for runtime processing, then I'd need to write a 1.4-based implementation of the 1.5 annotation API - probably by stuffing the annotation data into private fields in the class.

      What are your users' needs?

      God bless,
      -Toby Reyelts

    • On the website, under "Documentation", the "Supported 1.5 Language Features" list now includes "Annotations". How can I understand that?

    • Joachim Sauer
      Joachim Sauer

      Backport175 (http://backport175.codehaus.org) supports reading the Annotations. I've got a local modified version of Retroweaver here, that modifies the constant pool to replace java.lang.annotation.Annotation with a reference to a private interface (to allow loading the Annotation Interfaces themselves) and it _seems_ to work.

      • Paul Kneeland
        Paul Kneeland

        I would like to use hibernate 3 with annotations for persistence, however am stuck in an environment that requires java 1.4.  I tried making an example program and retroweaving but now get the following error:
        Exception in thread "main" java.lang.NoClassDefFoundError: java/lang/annotation/Annotation
                at org.hibernate.cfg.AnnotationConfiguration.addPackage(AnnotationConfiguration.java:112)

        Does retroweaver provide an implementation?  If not is there a way around this?


      • I need too run-time annotations. It would be great if Retroweaver could support them (using backport175 or not)