Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-888

Empty method in an entity causes errors while enhancing

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.2.0
    • Fix Version/s: None
    • Component/s: kernel
    • Labels:
      None

      Description

      I have a class subclassing another class. Both are entities. They have a method, which has nothing to do with JPA cause it's not a getter o a setter. The subclass overrides this method with an empty implementation, that is @Override public void theMethod() {} .

      As a result, OpenJPA throws an error while enhancing the subclass, more specifically the stacktrace is relative at SERP internals :

      java.lang.ClassCastException: serp.bytecode.CodeEntry cannot be cast to serp.bytecode.Instruction
      at serp.bytecode.Local.getEnd(Local.java:114)
      at serp.bytecode.Local.updateTargets(Local.java:155)
      at serp.bytecode.LocalTable.updateTargets(LocalTable.java:163)
      at serp.bytecode.Code.read(Code.java:2031)
      at serp.bytecode.Attributes.readAttributes(Attributes.java:152)
      at serp.bytecode.BCMember.read(BCMember.java:365)
      at serp.bytecode.BCClass.read(BCClass.java:123)
      at serp.bytecode.Project.loadClass(Project.java:211)

      Looking the Serp code and debugging it, I can confirm it is a SERP error, and opened a bug on its tracker (https://sourceforge.net/tracker2/?func=detail&aid=2556092&group_id=31479&atid=402282 ).

      I'm opening this bug here to track the problem, and eventually use an updated version of SERP if/when they solve the problem.

      The most obvious workaround (which works) is to write something inside an empty method, a plain "int i = 0" will do the job.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              s.gianni Simone Gianni
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: