Repository navigation
Add regression test for handler(Exception+) advice woven into catch(Exception|LinkageError) multi-catch (#368) - #369
Open
robinjohri wants to merge 1 commit into
Conversation
…xception|LinkageError) multi-catch (eclipse-aspectj#368) Weaving handler(Exception+) advice into a Java 7+ multi-catch clause that mixes an Exception subtype with a non-Exception Throwable subtype (e.g. catch (Exception | LinkageError e)) used to produce invalid bytecode: the caught variable's compile-time type is the least-upper-bound Throwable, not Exception, and the woven advice-dispatch code passed it on without a checkcast, causing a VerifyError at class-load time. This was already fixed silently between 1.9.21.1 and 1.9.21.2 (no release notes entry, no test coverage), so this adds a load-time-weaving regression test to guard the fixed behaviour against future regressions. Fixes eclipse-aspectj#368 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #368.
Adds a regression test for a
VerifyErrorthat occurred whenhandler(Exception+)(or anyhandler(SomeType+)) advice was woven into a Java 7+ multi-catch clause mixing anExceptionsubtype with a non-ExceptionThrowablesubtype, e.g.:In that case javac types
eas the least-upper-boundjava.lang.Throwable(notException), and the woven advice-dispatch code used to pass it on without acheckcast, so the woven class failed the JVM's bytecode verifier at class-load time with:Why a test-only PR
I bisected this across released versions and confirmed it's already fixed:
The fix landed silently between 1.9.21.1 and 1.9.21.2 (release notes for 1.9.22 say "No major bug fixes"), and I couldn't find any existing test covering this exact scenario, so nothing currently guards against a regression. See #368 for the full root-cause writeup and version bisection.
What this PR adds
tests/bugs1925/github_368/: a minimalWorker/LoggingAspect/Applicationreproduction, woven via load-time weaving (mirrors the existingbugs1921/github_279LTW test pattern, since this only reproduces under a forked JVM + java agent).ajc-testentry inajc1925.xmland a corresponding test method inBugs1925Tests.java.Verified locally (JDK 17,
mvn -pl tests test -Dtest=Bugs1925Tests): all 9 tests in the suite pass, including the new one, confirming currentmasteris not affected.Test plan
Bugs1925Testslocally against currentmaster— all pass, including the new test.aspectjweaverjars) that the same aspect/target reproduces theVerifyErroron 1.9.21 and 1.9.21.1, and passes on 1.9.21.2+.