Kotlin/avoid implicit recompiling regex
This is a big one. Not all tests and examples work the same for Kotlin compared to Java.
There is no difference for short or long Regexp's as far as I can see.
Basically you should not call .toRegex() for each invocation.
Some String methods, like split() have versions without Regex, with String, these are advertised as more effictive.
We could add checks to see if strings are really regexps or could be used as plain string.
Need some help with this one (now not checked in unit test):
val fs = FileSystems.getDefault()
p = fs.getPathMatcher(PAT_STRING) // bad: violation
Where match should be made on the fs and the corresponding var to check if it is made of FileSystems.
The unit test can be cleaned up and rearranged when all are working.
Quality Gate passed
Issues
2 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
There is no difference for short or long Regexp's as far as I can see.
The number of characters to process in the compile is different and so the amount of work is, right? Every time a compile if 2 chars is not so bad, of 20 chars is bad. This holds for Kotlin too, I assume.
There is no difference for short or long Regexp's as far as I can see.
The number of characters to process in the compile is different and so the amount of work is, right? Every time a compile if 2 chars is not so bad, of 20 chars is bad. This holds for Kotlin too, I assume.
On the other hand, the Kotlin Regex can easily be used from a (companion object) field.
I think we need to add rules for the default constructor Regex("bla.*") and also toRegex(options)
I think we need to add rules for the default constructor
Regex("bla.*")and alsotoRegex(options)
also added this
Note that Regex(...) is not so Implicit... can also create a separate rule, but I think it fits with this one
This PR also includes:
- upgrade to PMD 7.13.0
- make unit tests work for both Java and Kotlin
- remove the maven profiles, both Java and Kotlin can be run from same branch now
- note: for Kotlin merge use shell command:
./merge kotlin
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code