-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement source location matching for weave messages in XML tests #218
Comments
WIP (work in progress). Closes #218. Signed-off-by: Alexander Kriegisch <[email protected]>
WIP (work in progress). Closes #218. Signed-off-by: Alexander Kriegisch <[email protected]>
Remove leading "weaveInfo", add missing "see also:" to weave messages. Relates to #218. Signed-off-by: Alexander Kriegisch <[email protected]>
@aclement, the PR review request relates to my recent Slack message, which I am quoting here in order to document my intent and the options we have for implementing this functionality:
|
WIP (work in progress). Closes #218. Signed-off-by: Alexander Kriegisch <[email protected]>
Remove leading "weaveInfo", add missing "see also:" to weave messages. Relates to #218. Signed-off-by: Alexander Kriegisch <[email protected]>
Andy said on Slack:
I replied:
|
WIP (work in progress). Closes #218. Signed-off-by: Alexander Kriegisch <[email protected]>
Remove leading "weaveInfo", add missing "see also:" to weave messages. Relates to #218. Signed-off-by: Alexander Kriegisch <[email protected]>
@aclement, this is because in this example post-compile weaving is used and aspectj/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java Lines 76 to 89 in 49cb924
This can be ameliorated by changing
simply call
On the one hand, it would be a complete path for files from JARs. OTOH, that path might be from another system and also unnecessarily expose file system info from there. OK, the data are in the class file anyway, but I think in this case they provide no added value and might even irritate more than help the user. Feel free to comment. For now, I think I am going to leave it at the cosmetic change for default package classes, removing the leading (back)slash. For classes and aspects compiled from sources, the full paths are already there in weaving messages. |
Hm, I am just reconsidering this. You are right, the "see also" location is also a path to a class file, even from inside a JAR. |
In AbstractReferenceTypeDelegate::setSourcefilename, yield 'MyClass.class' instead of '/MyClass.class', if the package name is empty (default package). See #218 (comment) and subsequent comments. Signed-off-by: Alexander Kriegisch <[email protected]>
For the record: I have experimented with variations of code like this: final String fileName = javaClass.getFileName();
final String sourceFileName = javaClass.getSourceFileName();
if (fileName == null || !fileName.endsWith(".class"))
setSourcefilename(sourceFileName);
else if (sourceFileName == null || sourceFileName.isEmpty() || sourceFileName.endsWith(".class"))
setSourcefilename(fileName);
else
setSourcefilename(fileName + " (from " + sourceFileName + ")"); But this leads to unwanted ripple effects with certain types of output. E.g., it could look like this:
The simple variant setSourcefilename(javaClass.getFileName()) would lead to (single line, line breaks added manually) :
Things like |
In AbstractReferenceTypeDelegate::setSourcefilename, yield 'MyClass.class' instead of '/MyClass.class', if the package name is empty (default package). See #218 (comment) and subsequent comments. Relates to #218. Signed-off-by: Alexander Kriegisch <[email protected]>
reference Experimental code leading to undesired ripple effects elsewhere, requiring more rework which now I do not feel inclined to invest to perfect source file string representation for post-compile binary classes and aspects. Relates to #218. Signed-off-by: Alexander Kriegisch <[email protected]>
It looks as if removing the leading file separator also has unwanted side effects, e.g. it makes
I do not feel so inclined to investigate how to fix that in AJDT and check for side effects there when working with AJDT in Eclipse. Sigh - I am going to revert the change, and users will have to live with |
reference Experimental code leading to undesired ripple effects elsewhere, requiring more rework which now I do not feel inclined to invest to perfect source file string representation for post-compile binary classes and aspects. Relates to #218. Signed-off-by: Alexander Kriegisch <[email protected]>
Instead of creating dedicated ITs for #218, just use the new matching capabilities like this for good measure: <message kind="weave" aspectFile="MyAspect.java" aspectLine="8" .../> Tests affected: - Ajc165Tests::testFunkyPointcut_pr272233_2 - Bugs1920Tests::test_GitHub_214 Relates to #218. Signed-off-by: Alexander Kriegisch <[email protected]>
WIP (work in progress). Closes #218. Signed-off-by: Alexander Kriegisch <[email protected]>
Remove leading "weaveInfo", add missing "see also:" to weave messages. Relates to #218. Signed-off-by: Alexander Kriegisch <[email protected]>
reference Experimental code leading to undesired ripple effects elsewhere, requiring more rework which now I do not feel inclined to invest to perfect source file string representation for post-compile binary classes and aspects. Relates to #218. Signed-off-by: Alexander Kriegisch <[email protected]>
Instead of creating dedicated ITs for #218, just use the new matching capabilities like this for good measure: <message kind="weave" aspectFile="MyAspect.java" aspectLine="8" .../> Tests affected: - Ajc165Tests::testFunkyPointcut_pr272233_2 - Bugs1920Tests::test_GitHub_214 Relates to #218. Signed-off-by: Alexander Kriegisch <[email protected]>
In internal AspectJ integration tests, it is possible to match log messages for file and line number information in error, warning and lint messages. For weave messages, however, matching is not implemented.
The text was updated successfully, but these errors were encountered: