Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

More options for package name matching. #99

Open
tbitonti opened this issue Apr 16, 2020 · 3 comments
Open

More options for package name matching. #99

tbitonti opened this issue Apr 16, 2020 · 3 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@tbitonti
Copy link
Owner

The rules for matching package names needs to be reviewed.

The question is to require exact whole package matches, or to allow prefix matching.

For example, currently, "javax.servlet" matches "javax.servlet" but not "prefixjavax.servlet",
"prefix.javax.servlet", "javax.servletsuffix", or "javax.servlet.suffix".

This might be widened to enable matching against "prefix.javax.servlet" and "javax.servlet.suffix".

However, the case of "javax.transaction.xa" is a problem. "javax.transaction" was renamed within Jakarta EE 9, but "javax.transaction.xa" was not renamed. Any prefix and suffix matching which is added must provide settings which disallow the transaction case.

That is, if "javax.transaction" is allowed to match "javax.transaction.suffix", it must be disallowed at the same time from matching "javax.transaction.xa".

@tbitonti tbitonti added the enhancement New feature or request label Apr 16, 2020
@bjhargrave
Copy link
Collaborator

Exact matching is simple and fast, but more choice may be needed some times. So we could support a regex choice. For example, if the string starts with / then we can consider it a regex/replacement pattern (sort of sed-like)

/javax\.foo(\..*)/jakarta.bar$1/

This would rename any package starting with javax.foo to a package starting with jakarta.bar.

This would open up all the power of Java regex.

@jimblye
Copy link
Collaborator

jimblye commented Apr 16, 2020

We currently have a wildcard (suffix only) option for the key. So you can say
javax.transaction.*=jakarta.transaction

That would transform all subpackages of javax.transaction including javax.transaction.xa

To avoid that one case, you could specify:

javax.transaction.*=jakarta.transaction

jakarta.transaction.xa.*=javax.transaction.xa

As long as we apply those in the right order, I think it does what you want.

A wildcard "prefix" applies to a general transformer, but is probably not needed for the Jakarta transformer.

@tbitonti
Copy link
Owner Author

tbitonti commented Apr 16, 2020

Could we pack more into the package renames properties file? Instead of having:

initial=final

Have something like:

keyword,...;initial=final

For example:

exact;initial=final
regex;initial=final
allowSuffix;initial=final
allowSuffix;disallowSuffix(.xa);initial=final

This would be specifically for package substitution cases, which have specific rules which don't apply for simple string replacement.

I'm not liking my "disallowSuffix" syntax, but I'm not sure how to do the transaction.xa case with regular expressions.

@tbitonti tbitonti added the question Further information is requested label Apr 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants