test(core): Test negative-clause behavior - #299
Open
misonijnik wants to merge 6 commits into
Open
Conversation
…ents Negative pattern clauses (pattern-not and pattern-not-inside) whose excluded event uses the tracked metavariable only in call-argument position never exclude anything, while the identical event matches when required positively and receiver-position counterparts exclude correctly. Static vs instance calls, callee body contents, pattern-not forms, and context containment are all ruled out as causes. DocNegativeShapesTest pins the current behavior: samples named PositiveNotYetExcluded assert the buggy outcome, so the suite is green today and fails exactly when the defect is fixed. Full analysis and reproduction in issues/negative-clause-argument-position.md.
Drop the probe whose pattern-not-inside lacked a pattern-inside producer (dismissible on shape grounds) and reshape the instance-argument and sanitize-reassignment probes to the anchored form: producer declared in pattern-inside, single-event main pattern, containment satisfiable. The argument-position exclusions remain ineffective in the anchored shapes, so the finding stands on clean rules; issue tables and repro updated to match.
Replace the PositiveNotYetExcluded naming hack with the repository's established idiom: the affected samples are Negative (declaring the desired semantics) annotated @TaintRuleFalsePositive, so the harness skips the known over-reporting with a printed reason instead of asserting the buggy outcome. The suite stays green and the skip log shows exactly which exclusions are currently ineffective; when the defect is fixed, the annotations become removable.
…efect Drop the known-false-positive annotations: the argument-position and negative-only-metavariable probes now assert that their Negative samples must not report, and fail until negative clauses anchor on argument-position events. Positive controls and receiver-position counterparts keep passing.
Remove InstanceArgNotInsideDoc, NegOnlyNotInsideDoc, and ReceiverNotInsideSpanDoc; the suite keeps the argument-position probes with shape-clean rules plus their positive controls and receiver counterparts.
The earlier probes all declared their tracked value as Object while the working counterexamples used declared types, so the apparent receiver-vs-argument split was a fixture artifact. example/Rule.yaml already excludes an argument-position event, which prompted the recheck. Bisecting from that rule isolates the real discriminator: a structural negative does not exclude when the tracked value's declared type is java.lang.Object. The excluded call's own parameter type is irrelevant, and an Object-typed value is excluded correctly when the negative rebinds it through a receiver call. Retyping the original probes to String makes every one of them pass. ObjectTypedValueDoc and ObjectTypedValueCastDoc assert the desired semantics and fail on the open defect; the rest are controls and clause-shape coverage.
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.
No description provided.