Categories
Coding

Eclipse 3.1M6 and package-info

Another issue this time with Eclipse 3.1 M6. This concerns the “package-info” mechanism for package-level annotations. We are using package-info.java to declare a package-level sequence generator:


@javax.persistence.SequenceGenerator(
      name="SEQ_GEN",
      sequenceName="SQ_CDB_IDS"
  )

package uk.co.researchkitchen.hibernate;

This seems to compile OK, but when I try to run some unit tests, it chokes:


org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'test.sessionFactory' defined in class path resource [application_test_context.xml]: Initialization of bean failed; nested exception is java.lang.ClassFormatError: Illegal class modifiers in class uk/co/researchkitchen/hibernate/package-info: 0x1600
java.lang.ClassFormatError: Illegal class modifiers in class uk/co/researchkitchen/hibernate/package-info: 0x1600
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:102)
at org.hibernate.cfg.AnnotationBinder.bindPackage(AnnotationBinder.java:141)
at org.hibernate.cfg.AnnotationConfiguration.addPackage(AnnotationConfiguration.java:115)
...

Apparently, support for the package-info mechanism has been added in M6. I’m presuming this is an Eclipse issue as colleagues using IDEA have no such issues.

Leave a Reply