Skip to content
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

[MSHARED-1077] Bugfix for classifier in pattern #26

Merged
merged 8 commits into from Jun 11, 2022

Conversation

cstamas
Copy link
Member

@cstamas cstamas commented Jun 8, 2022

Parsing of pattern with classifier was busted, that
prevented use cases like before rewrite, that was again
busted due early return (not happening since rewrite, but since rewrite
we do no support classifiers in patterns).

So, here is yet another rewrite, that not only fixes old use cases (w/ classifier)
but also makes it even more faster. Last, but not least, new code is
now in high level Java, instead of char[][] and is self documenting.


https://issues.apache.org/jira/browse/MSHARED-1077
(causes https://issues.apache.org/jira/browse/MASSEMBLY-955)

Parsing of pattern with classifier was busted, that
prevented use cases like before rewrite, that was again
busted due early return (not happening since rewrite).
@cstamas cstamas requested review from gnodet and michael-o June 8, 2022 07:34
@cstamas cstamas self-assigned this Jun 8, 2022
@cstamas cstamas changed the title [MASSEMBLY-955] Bugfix for classifier in pattern [MSHARED-1077] Bugfix for classifier in pattern Jun 8, 2022
Not only it's never used (as version seems alwats PosPattern),
but is completely left out from methods like getPatternsAsString
and hasMissedCriteries etc.
Rewrite pattern matcher to high level Java (and make it even more faster).
@cstamas
Copy link
Member Author

cstamas commented Jun 10, 2022

Aside of build passing above, @gnodet made a nice perf test as well (to prove that his rewrite was better than "old" one). So, this PR continues along (hence, copies the existing code from master as GN prefixed) and now perf tests have 3 classes testing. You can run perf test locally as well to ensure, but locally my results are:
https://gist.github.com/cstamas/844fbe97bf861ffab045c43e9f734c4a

Legend:
"old" - in src/test the "old" pattern filter code
"gn" - this PR moves current master from src/main to src/test the code it replaces
"new" - the src/main "newest" pattern filter code

@cstamas
Copy link
Member Author

cstamas commented Jun 10, 2022

Um. The GN file is copied from master unmodified. No need to review it, should be as it was on master. Reason to keep it to have perf reference (as perf test is using it).

@cstamas cstamas requested a review from michael-o June 10, 2022 19:56
private static Artifactoid adapt( final String depTrailString )
{
requireNonNull( depTrailString );
// G:A:T:C:V
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please document how the pattern looks like with 4 components

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You want me to document org.apache.maven.artifact.Artifact#getDependencyTrail() method here?

Copy link
Member

@michael-o michael-o Jun 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the code processes two pattern styles, no? 4 and 5 component. The comment documents on 5 components.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's be fine, then we have context.

// xxx:*:yyy -> G(xxx) + TC(yyy)
// xxx:yyy:* -> G(xxx)+A(yyy)
// xxx:yyy:zzz -> G(xxx)+A(yyy)+T(zzz)
if ( ANY.equals( tokens[0] ) && ANY.equals( tokens[1] ) && ANY.equals( tokens[2] ) )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a problem with those:

  • Those aren't documented anywhere
  • How can we be sure that those aren't ambigious?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic just re-implement what happened before (old and older code). My intention is not to fix the pattern spec or change any behavior (as test proves).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, agreed. Please put a comment above that those patterns are in question since they aren't documented. An open TODO.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pushed 349dd80

Copy link
Member

@michael-o michael-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's squash, merge and roll.

@cstamas cstamas merged commit 0c6674f into master Jun 11, 2022
@cstamas cstamas deleted the massembly-955-bugfix branch June 11, 2022 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants