You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the format of the comments with the replacements is somewhat mixed: In most cases the type of the method receiver is fully qualified, and the method arguments are not qualified. That's a very readable format.
However, some cases use fully qualified names for all types, even the method arguments. I consider that hard to read. Also it's not necessary: With the full qualified method receiver type, there are only a handful of potential overloads of the same method name that a developer might consider. It should always be sufficient to use a non-qualified type for all method arguments, without causing confusion which method to use.
I would suggest to shorten the types in the first lines of this screenshot (and other affected places):
The text was updated successfully, but these errors were encountered:
I agree that the fully-qualified method and unqualified parameter names are more readable and this was the intent. I am happy to merge PRs that manually make the style consistent although automatically enforcing the format seems more difficult. A complete solution would be to programmatically generate modernizer.xml#72.
There is another option we could consider: We could write <comment>Prefer {{signature:S}} for improved performance.</comment> to create the format proposed by @Bananeweizen from the unambiguous Java method signature syntax S. The signature: prefix let us introduce more parameter sources in future, while :S suffix is an actual Java method signature as already used in <name>. The benefits are:
The actual format template is stored in one single location in Java code, so it can be changed in future without replacing thousands of <comment> elements.
The software can throw a ClassNotFoundException for incorrect S, effectively preventing any typos in the comment.
It would be great to do anything better than the current human-generated modernizer.xml. Ideally the input would be valid Java that a Maven phase processes into modernizer.xml.
Currently the format of the comments with the replacements is somewhat mixed: In most cases the type of the method receiver is fully qualified, and the method arguments are not qualified. That's a very readable format.
However, some cases use fully qualified names for all types, even the method arguments. I consider that hard to read. Also it's not necessary: With the full qualified method receiver type, there are only a handful of potential overloads of the same method name that a developer might consider. It should always be sufficient to use a non-qualified type for all method arguments, without causing confusion which method to use.
I would suggest to shorten the types in the first lines of this screenshot (and other affected places):
The text was updated successfully, but these errors were encountered: