Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] Load Time Weaver Java 1.4 AJ.BAT

 Seems like aspectj may be analyzing unused
non-1.4 classes or something along those lines.

As I mentioned, AspectJ, in order to determine pointcut matches, will likely be chasing down type references that you don’t need for the code to run but you would likely have needed when the target code was compiled. Ignoring can’t find type messages (turning them off) is possible if you are positive your aspects are managing to advise the right locations (i.e. you basically say "I know you can’t find that type but it doesn’t matter"). Have you tried just turning them off? (Xlint ignoring them - although I’ll admit I can’t quite recall if they were configurable on 1.6.3)

Between 1.6.3 and 1.7.0, if you look at the readme for 1.6.7 (http://eclipse.org/aspectj/doc/released/README-167.html ) you will see I did a complete rewrite of the matching algorithms. I greatly modified how references are chased down for pointcut matching as prior to that we were chasing down even more than strictly necessary.  You are very likely hitting some of this. From the readme:

"As well as faster matching there is also less exploration to determine a match. Visitors that walk hierarchies and discover methods now terminate as early as possible once they can determine something is a match or is definetly not a match. This reduces memory usage, speeds up weaving and reduces the occurrences of those annoying 'cantFindType' messages."

The main changes with the AspectJ weaver requiring a JVM later than 1.4 to run were so that we could use generics inside the AspectJ source code - moving to typed collections made the code much cleaner. There wasn’t any special reason beyond that. Removing all the generics would give you a 1.4 runnable weaver (and I think that is what retroweaver could do for you).

cheers,
Andy

On May 13, 2015, at 6:38 AM, Dennis Taylor <dwt@xxxxxxxxxxxxxxx> wrote:

Thanks Andy,

I'm still digging into this.  I've found that the first level that
eliminates the exceptions is 1.7.0.  I found that the reason for "can't
determine superclass" error was due to a referenced, but unused, class
that wasn't in the classpath so that one is gone.  I'm starting to
wonder if the other exceptions could be due to certain classes in the
application being newer than java 1.4 since the application and its
supporting infrastructure are like aspectj and so many other things:
they run on older JVMs but also contain support for newer constructs if
running on a newer JVM.  Seems like aspectj may be analyzing unused
non-1.4 classes or something along those lines.

I'm currently trying to understand what changed in the aspectjweaver
source between 1.6.3 and 1.7.0 to see how bad it will be to bring the
necessary 1.7.0 code back to 1.4 source level.  I did take a quick look
at retroweaver and may come back to that. No matter what happens, its
all a pretty good learning experience for me and is applicable to the
kinds of things we do here.

Dennis
919 719 8428 (w)

On 5/12/2015 12:00 PM, aspectj-dev-request@xxxxxxxxxxx wrote:
Send aspectj-dev mailing list submissions to
aspectj-dev@xxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-dev
or, via email, send a message with subject or body 'help' to
aspectj-dev-request@xxxxxxxxxxx

You can reach the person managing the list at
aspectj-dev-owner@xxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of aspectj-dev digest..."


Today's Topics:

  1. Re: Load Time Weaver Java 1.4 AJ.BAT (Andy Clement)


----------------------------------------------------------------------

Message: 1
Date: Mon, 11 May 2015 12:11:19 -0700
From: Andy Clement <andrew.clement@xxxxxxxxx>
To: AspectJ developer discussions <aspectj-dev@xxxxxxxxxxx>
Subject: Re: [aspectj-dev] Load Time Weaver Java 1.4 AJ.BAT
Message-ID: <E723A335-E84E-43DE-BF1B-F9EC32EB9FA5@xxxxxxxxx>
Content-Type: text/plain; charset="utf-8"

Hi Dennis,

For a long time AspectJ was keeping the compatibility requirements as low as possible. The times it has been increased have typically been when the JDT compiler (upon which we are based) has increased its own requirements - and that doesn?t happen very often.

The Readme for 1.6.6 ( https://eclipse.org/aspectj/doc/released/README-166.html <https://eclipse.org/aspectj/doc/released/README-166.html> ) mentioned that Java5 was now required to run the compiler/weaver. This doesn?t mean it couldn?t weave into older code but of course that is only true for compile time weaving or binary weaving (run AspectJ on Java5 but weave into Java1.4 or 1.3 code). With load-time weaving you are running the weaver on the same level of Java as the code being loaded - so if they are using a 1.4 VM to run their 1.4 code, it?ll be a problem.

So 1.6.5 is the most recent you can probably get away with. Maybe I can help you with the ?can?t determine superclass of missing type? exceptions? Recall that weaving can need to do as much analysis to determine pointcut matches as a compiler would (in terms of resolving types) so you may need to put as many jars on the class path to weave something as were then when it was compiled. For some messages, if you are confident they are irrelevant you can turn them off (e.g. you *know* you don?t need to resolve the information related to the type it can?t find). The AbortExceptions are more worrying.

There is a tool called retroweaver that allows the use of later JVM constructs on older VMs - possibly the aspectjweaver jar could be run through retroweaver but I?m not sure how it?ll behave. It is possible, given that Java5 requirement, that AspectJ will attempt to load classes like Annotation and fail horribly if they aren?t there (because they?d always be there on Java5 or higher).

cheers,
Andy

On May 8, 2015, at 8:36 AM, Dennis Taylor <dwt@xxxxxxxxxxxxxxx> wrote:

We're incorporating some very simple aspects into some of the things we
do and have kind of a major problem.  We're good with Java 1.5 and later
but can't get load time weaving working on Java 1.4 with versions of
aspectj 1.6.9 and later. Versions 1.6.3 and earlier seem to have issues
with the java 1.4 code that we're trying to weave into.

Unfortunately, we can't dictate what jvm versions our customers run on
and some very large installations need to run 1.4.  We are a very small
part of large java applications that they own/maintain.  All of their
application code is java 1.4 compatible and that is what we are weaving
into.  When we try to use AspectJ 1.6.3 and earlier, there are aspectj
related issues that we don't see with the latest version of the AspectJ
weaver (org.aspectj.bridge.AbortException's and "can't determine
superclass of missing type" exceptions).

I'm hoping for some kind of guidance.  I can't find anything anywhere
about the LTW requiring a newer level of java.  The 1.4 JVM compatible
AJ.BAT still ships with even the latest versions and all the
documentation that refers to AJ.BAT still seems to be in place, yet
AJ.BAT doesn't work if the JVM is java 1.4.  Am I missing something?

Thanks.

--
Dennis
919 719 8428 (w)

_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dev.eclipse.org/mailman/private/aspectj-dev/attachments/20150511/63b21807/attachment.html>

------------------------------

_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-dev

End of aspectj-dev Digest, Vol 119, Issue 2
*******************************************

_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-dev


Back to the top