Use default method in Paranamer interface #43
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.
With one exception (
NullParanamer
), all implementations of the single-argument version ofParanamer.lookupParameterNames
have the same implementation, delegating to the two argument version withtrue
as the second argument. This is also a sensible default for user-defined Paranamer instances. Now that Paranamer requires a minimum of Java 8, it seems like a switch to adefault
method might be appropriate. This PR implements this change.Incidentally, not a big deal if you don't want to go this route. Figured I'd throw it out there to see what your thoughts are on this approach.
That said, the fact that
NullParanamer
has different results forParanamer.lookupParameterNames(methodOrConstructor, true)
andParanamer.lookupParameterNames (methodOrConstructor)
does feel like a little bit of a code smell.I have confirmed that this change does not break compilation of the build (
mvn clean install -DskipTests=true
). I have not confirmed that unit tests pass, since unit tests appear to be broken inmaster
. I built on macOS 10.14.5 with Maven 3.8.2 & Java 8 using AdoptOpenJDK 1.8.0_282: