Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-4745

Support for aspectj advice static method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • ipojo-manipulator-1.12.0, ipojo-manipulator-1.12.1
    • None
    • iPOJO
    • None

    Description

      When using aspectj to weave classes prior to iPojo packaging, injected advice are ignore by iPojo bytecode manipulation.
      Then NPE are thrown in the advice because of the lazy initialization mechanism of @Requires services.

      In my usecase, I want to weave @Transactional springframework aspect in iPojo component.

      Code generated:

      static final String updateName_aroundBody0(SignupTestDao ajc$this, String name) {
      LOGGER.info(ajc$this.testDao);

      for (Test test : ajc$this.testDao.findAll()) {
      test.setName(name);
      ajc$this.testDao.update(test);
      if (name.equals("boom"))

      { throw new RuntimeException("boom"); }
      }
      return "done";
      }

      Code expected:

      static final String updateName_aroundBody0(SignupTestDao ajc$this, String name)
      {
      LOGGER.info(ajc$this.__gettestDao());

      for (Test test : ajc$this.__gettestDao().findAll()) {
      test.setName(name);
      ajc$this.__gettestDao().update(test);
      if (name.equals("boom")) { throw new RuntimeException("boom"); }

      }
      return "done";
      }

      A naive fix is to apply iPojo bytecode manipulation to static methods... see the patch provided.

      Attachments

        1. 0001-FELIX-4745-naive-fix.patch
          2 kB
          Olivier NOUGUIER
        2. 0001-FELIX-4745-naive-fix-2eme.patch
          5 kB
          Olivier NOUGUIER

        Activity

          People

            clement.escoffier Clement Escoffier
            cheleb Olivier NOUGUIER
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified