Giter Club home page Giter Club logo

Comments (20)

akurtakov avatar akurtakov commented on August 11, 2024 1

As per previous comment.

from equinox.

kriegaex avatar kriegaex commented on August 11, 2024

To the Equinox team: This is the AspectJ maintainer. I have zero knowledge about Equinox Weaving, but if you have any questions about AspectJ and the changes I mentioned in eclipse-aspectj/ajdt#57, by all means feel free to mention my user ID and ask me questions.

from equinox.

tjwatson avatar tjwatson commented on August 11, 2024

@martinlippert Do you know what could cause this?

from equinox.

laeubi avatar laeubi commented on August 11, 2024

@kriegaex I'm not sure what exactly is considered "changed" here something in AspectJ? Some change (wich one?) in Equinox or JDT?
As far as it comes to Equinox it is implementing the Weaving Hook Service Specification so can you mention what part of the specification is violated by Equinox here from your analysis?

from equinox.

tjwatson avatar tjwatson commented on August 11, 2024

Equinox weaving predates OSGi Weaving Hook Service Specification. The AspectJ weaving hooks into Equinox Weaving. Equinox Weaving is built upon Equinox Framework specific behavior.

The AspectJ weaving use to live with the Equinox project but since got moved out of the project. I don't recall now where they went but I think this issue belongs with that project. @martinlippert is the last developer I know that has touched the AspectJ weaving integration with Equinox Weaving.

from equinox.

kriegaex avatar kriegaex commented on August 11, 2024

@laeubi, I am reiterating: I have zero knowledge about Equinox Weaving. I do not even know if it is the root cause of the problem at all. Therefore, I am not claiming that anything is wrong there. I just made an educated guess, as LTW with plain AspectJ seems to work fine, both inside and outside of Eclipse, and I have yet to see a reproducer for the problem with a simple AspectJ LTW configuration in Eclipse.

What has changed in AspectJ that I think might have an impact on what is woven or not is in these commits:

The main affected weaver classes are:

  • org.aspectj.weaver.loadtime.Aj
  • org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor
  • org.aspectj.weaver.tools.WeavingAdaptor
  • org.aspectj.weaver.tools.cache.SimpleCache

Like I said in the comment I linked to earlier:

Maybe it needs to be adjusted to recent changes (since 1.21.1, if I remember correctly) in the weaver, where in case of non-woven code null is returned instead of the original bytes.

The rationale behind the change is that now the AspectJ weaver behaves like most intrumentation agents, simply returning null for unchanged code instead of the input bytes, because that way it is easiest for the caller to find out if anything has changed at all, saving him the chore to compare two complete byte arrays.

from equinox.

tjwatson avatar tjwatson commented on August 11, 2024

Also see https://bugs.eclipse.org/bugs/show_bug.cgi?id=470000 where the aspectj weaving integration moved out of Equinox. I don't believe there is anything for Equinox to do here.

from equinox.

kriegaex avatar kriegaex commented on August 11, 2024

@tjwatson, sorry for the stupid question, but where did the AspectJ integration move to, except for the parts located in AJDT?

from equinox.

tjwatson avatar tjwatson commented on August 11, 2024

@tjwatson, sorry for the stupid question, but where did the AspectJ integration move to, except for the parts located in AJDT?

Not a stupid question. It is an answer I was searching for, but have not found (besides the discussions in https://bugs.eclipse.org/bugs/show_bug.cgi?id=470000). I am hoping @martinlippert sees this and can chime in.

from equinox.

martinlippert avatar martinlippert commented on August 11, 2024

@tjwatson, sorry for the stupid question, but where did the AspectJ integration move to, except for the parts located in AJDT?

https://bugs.eclipse.org/bugs/show_bug.cgi?id=470000#c33

The overall, AspectJ independent parts of the weaving infrastructure that we've built back then remained in Equinox, whereas the AspectJ specific implementation of the weaving moved out to the AJDT project back then.

I haven't looked at this code for years now, so can't really say anything from the top of my head. Looks like some debugging would be needed here in order to find out whether the weaver creates the additional (missing) bytecode and if so, check if the weaving infrastructure in Equinox correctly retrieves and uses this.

Since I am not actively working on this anymore, I wonder whether we should deprecate this implementation and load-time weaving of AspectJ aspects in Equinox for future releases. Opinions @tjwatson ?

from equinox.

martinlippert avatar martinlippert commented on August 11, 2024

The part that uses the home-grown weaving infrastructure in Equinox to do AspectJ weaving is here: https://github.com/eclipse-aspectj/ajdt/tree/master/org.eclipse.equinox.weaving.aspectj

from equinox.

martinlippert avatar martinlippert commented on August 11, 2024

The main implementation of the AspectJ lead-time weaving is implemented in here: https://github.com/eclipse-aspectj/ajdt/blob/master/org.eclipse.equinox.weaving.aspectj/src/org/eclipse/equinox/weaving/aspectj/loadtime/OSGiWeavingAdaptor.java - it calls and re-uses the ClassLoaderWeavingAdaptor from AspectJ.

from equinox.

tjwatson avatar tjwatson commented on August 11, 2024

Since I am not actively working on this anymore, I wonder whether we should deprecate this implementation and load-time weaving of AspectJ aspects in Equinox for future releases. Opinions @tjwatson ?

Right, I do think we need to deprecate Equinox weaving and ultimately stop building it in our quarterly releases. That is unless we get someone to step up that has time and interest to maintain these integrations.

from equinox.

kriegaex avatar kriegaex commented on August 11, 2024

@martinlippert, thanks for the hint about OSGiWeavingAdaptor. I will try to add a null guard to the weaveClass method and see if that helps to solve the problem or is totally unrelated. It is worth a try.

from equinox.

martinlippert avatar martinlippert commented on August 11, 2024

From a very high level, it looks like the weaver should have produced bytecode for this new inner class TypeBinding$AjcClosure1 as a result of weaving an aspect, but it looks like the weaving mechanism can't find that bytecode when trying to load it.

There is special handling for generated classes in the mechanism, you will stumble upon it when looking at the code. The basic idea is to keep the generated bytecodes for additional classes in memory until the JVM loads that class (as far as I remember).

from equinox.

martinlippert avatar martinlippert commented on August 11, 2024

I also vaguely remember a PR being raised a while ago, fixing problems with race conditions in this area. You might want to reach out to the reporter here #234, who did a great and very detailed job on this - just in case.

from equinox.

kriegaex avatar kriegaex commented on August 11, 2024

I think, I was able to locate the code in AJDT responsible for the problem. It is about defining classes in a different classloader, which both AspectJ and AJDT used the same method for. In AspectJ, this was updated to work with more recent JDKs already, but in AJDT there was still a copy of the old code. It is not so much a bug as a missing, but necessary adjustment to new Java runtimes.

Thanks @martinlippert and @tjwatson for providing the context information necessary for me to zero in on the problem. I think, the issue can be closed. I am going to fix the original problem in eclipse-aspectj/ajdt#57.

from equinox.

martinlippert avatar martinlippert commented on August 11, 2024

I think, I was able to locate the code in AJDT responsible for the problem. It is about defining classes in a different classloader, which both AspectJ and AJDT used the same method for. In AspectJ, this was updated to work with more recent JDKs already, but in AJDT there was still a caopy of the old code. It is not so much a bug as a missing, but necessary adjustment to new Java runtimes.

Thanks @martinlippert and @tjwatson for providing the context information necessary for me to zero in on the problem. I think, the issue can be closed. I am going to fix the original problem in eclipse-aspectj/ajdt#57.

Sounds good, thanks a lot @kriegaex for looking into this, much appreciated.

from equinox.

kriegaex avatar kriegaex commented on August 11, 2024

@martinlippert, maybe we were too optimistic to close the issue. The error still occurs, just in another situation. Would you mind reading the thread from eclipse-aspectj/ajdt#57 (comment) downwards? Sorry, quite a lot of text. Maybe you have an idea what has changed in Equinox weaving that could cause this or what AJDT needs to accomodate to to avoid the problem. Thank you.

from equinox.

martinlippert avatar martinlippert commented on August 11, 2024

@kriegaex replied on the AspectJ issue via eclipse-aspectj/ajdt#57 (comment)

from equinox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.