Community
Participate
Working Groups
The compiler emits declare error/warning statements without accompanying code context or file/line numbers. TestCase "omnibus declare warning" checked in: tests/ajcTestsFailing.xml tests/new/declare/DeclareWarning.java FYI, other issues that should be in another bug but are in the test case: - initialization listed at line 0. s.b. first initializer or first line of class - pointcut using adviceexecution() does not pick out advice
The main tests in the omnibus now pass (ie. declare error/warnings are now emitted with context). I'm leaving this bug open as the "other issues" still remain. Initializers are reported at line zero because the shadow has no range associated with it.
Update : two of the expected warnings are *not* being generated - line 5 and 74. This is post the "fix" for over eager CONSTRUCTOR kind matching on SignaturePatterns.
I just checked in a fix that prefixes declare error/warning messages with the file and line, but not with source context. (Adrian added the source location info, but it wasn't being emitted by the command-line compiler.) We need to work up a good way for weaver messages to be associated with source context by any weaver clients (command-line and IDE compiler; linker hidden in shipping tool or load-time weaver with JMX face...). The passing tests in the omnibus render false positives now because the harness only checks message lines (known harness limitation). I need to enable the harness support for checking message files and develop support for checking text and context, then update the tests to seek the desired context.
this test passes in the current tree with the initializer join point now having the correct location from the corresponding constructor another test was added (new/declare/DeclareWarningEmpty.java) for initializers and static intializer source locations when none are explicitly present in the source code Wes should reopen this bug if there are remaining message rendering issues that I'm unaware of.
Re-opening as a P3 known limitation. The test currently gives false positives because the content of the text is not checked. Currently the weaver emits messages without source context, e.g., file.java:23: this is an error rather than void around() : pc() { ^^^^ file.java:23: this is an error This is true of all error and warning messages detected by the weaver.
adding info keyword. also fyi the test harness can now detect errors based on the content of messages, but the test has not been updated accordingly.
I've updated ajcTests.xml to verify message text too. Also updated org.aspectj. testing.util.LangUtil to handle matching of multiple expected messages on same line that differ only by message text. Reclassified what's left of this bug as an enhancement request (give source context for declare error/warning) to be addressed "LATER."
reopening so that I can move the status to resolved-fixed
This was fixed as part of the work done for enh 50458. If source files are available, then the context is now output as part of the message. See enh 54819 for details.