Uploaded image for project: 'HiveMind'
  1. HiveMind
  2. HIVEMIND-76

Interface inheritance can cause Javassist errors

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0, 1.1
    • 1.1
    • framework
    • None

    Description

      For certain complex interfaces, HiveMind gets runtime errors generating a class:

      PM [DEBUG] Creating SingletonProxy for service kd.PM
      org.apache.hivemind.ApplicationRuntimeException: Unable to add method void close() throws javax.resource.ResourceExcepti
      on to class $SingletonProxy_1001ed04167_14: duplicate method: close
      at org.apache.hivemind.impl.servicemodel.SingletonServiceModel.createSingletonProxy(SingletonServiceModel.java:114)
      at org.apache.hivemind.impl.servicemodel.SingletonServiceModel.getService(SingletonServiceModel.java:58)
      at org.apache.hivemind.impl.ServicePointImpl.getService(ServicePointImpl.java:171)
      at org.apache.hivemind.impl.ServicePointImpl.getService(ServicePointImpl.java:184)
      at org.apache.hivemind.impl.RegistryInfrastructureImpl.getService(RegistryInfrastructureImpl.java:162)
      at org.apache.hivemind.impl.RegistryImpl.getService(RegistryImpl.java:66)
      at kd.Main.main(Main.java:25)
      Caused by: org.apache.hivemind.ApplicationRuntimeException: Unable to add method void close() throws javax.resource.Reso
      urceException to class $SingletonProxy_1001ed04167_14: duplicate method: close
      at org.apache.hivemind.service.impl.ClassFabImpl.addMethod(ClassFabImpl.java:310)
      at org.apache.hivemind.impl.ProxyBuilder.addServiceMethods(ProxyBuilder.java:93)
      at org.apache.hivemind.impl.servicemodel.SingletonServiceModel.createSingletonProxyClass(SingletonServiceModel.java:169
      )
      at org.apache.hivemind.impl.servicemodel.SingletonServiceModel.createSingletonProxy(SingletonServiceModel.java:89)
      ... 6 more
      Caused by: javassist.CannotCompileException: duplicate method: close
      at javassist.bytecode.ClassFile.testExistingMethod(ClassFile.java:456)
      at javassist.bytecode.ClassFile.addMethod(ClassFile.java:440)
      at javassist.CtClassType.addMethod(CtClassType.java:848)
      at org.apache.hivemind.service.impl.ClassFabImpl.addMethod(ClassFabImpl.java:306)
      ... 9 more
      Exception in thread "main"

      Investigation found that the interface in question, kodo.runtime.KodoPersistenceManager extended a number of other interfaces,
      and has conflicting definitions for method close():

      void close() throws Exception ... from com.solarmetric.util.Closeable
      void close() throws javax.resource.ResourceException ... from javax.resource.cci.Connection
      void close() ... from javax.jdo.PersistenceManager

      HiveMind was attempting to implement all of these, causing problems (same return type, same name, same parameters means there can be only one such method).

      HiveMind needs to more carefully analyze these method signatures and implement the most general case; in this case "void close() throws Exception". This logic is centralized in the MethodIterator and MethodSignature classes.

      Attachments

        Activity

          People

            hlship Howard Lewis Ship
            hlship Howard Lewis Ship
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: