OpenJPA
  1. OpenJPA
  2. OPENJPA-2085

Improve enhancement process to support JAVA 7 compliant class file generation

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.2.0
    • Component/s: Enhance, kernel
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      Java 7 requires StackMapTable attribute to be set in class file for verification.

      Serp does not support StackMapTable generation, hence the currently enhanced PersistenceCapable class will NOT be able to load by a Java 7 JVM if the entity is compiled with a Java 7 compiler (i.e. class file major version >= 51)

        Issue Links

          Activity

          Hide
          Albert Lee added a comment -

          Use of ASM is one solution to implement the support. When Serp is enhanced to support the same function, it can be be switched back to use Serp exclusively for the enhancement process.

          Show
          Albert Lee added a comment - Use of ASM is one solution to implement the support. When Serp is enhanced to support the same function, it can be be switched back to use Serp exclusively for the enhancement process.
          Hide
          garpinc added a comment -

          I had a problem where classloader couldn't find ClassWriter for some reason in AsmAdapter when running as osgi bundle. changing as follows seems to do the trick. Can you guys change implementation in trunk please:

          private static void tryClass(final String s) {
          if (cwClass == null) {
          try

          { //garpinc changed here instead of AsmAdaptor.class.getClassLoader() cwClass = Thread.currentThread().getContextClassLoader().loadClass(s + "ClassWriter"); }

          catch (Throwable t)

          { //ignore }
          }
          if (crClass == null) {
          try { //garpinc changed here instead of AsmAdaptor.class.getClassLoader() crClass = Thread.currentThread().getContextClassLoader().loadClass(s + "ClassReader"); } catch (Throwable t) { //ignore }

          }
          }

          Show
          garpinc added a comment - I had a problem where classloader couldn't find ClassWriter for some reason in AsmAdapter when running as osgi bundle. changing as follows seems to do the trick. Can you guys change implementation in trunk please: private static void tryClass(final String s) { if (cwClass == null) { try { //garpinc changed here instead of AsmAdaptor.class.getClassLoader() cwClass = Thread.currentThread().getContextClassLoader().loadClass(s + "ClassWriter"); } catch (Throwable t) { //ignore } } if (crClass == null) { try { //garpinc changed here instead of AsmAdaptor.class.getClassLoader() crClass = Thread.currentThread().getContextClassLoader().loadClass(s + "ClassReader"); } catch (Throwable t) { //ignore } } }

            People

            • Assignee:
              Albert Lee
              Reporter:
              Albert Lee
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development