Package naming convention for deprecated API migrations

34 views
Skip to first unread message

Radek Antoniuk

unread,
Jan 28, 2025, 3:59:49 PM1/28/25
to Jenkins Developers

I recently looked at Basil's PR migrating deprecated EE8 APIs to EE9:
https://github.com/jenkinsci/jira-plugin/pull/635.

Thank you for taking on this task—it’s much appreciated!

While reviewing the PR, I noticed a naming convention that I had hoped we’d moved past, hence my stupid comment in the PR. This led me to discover https://github.com/jenkinsci/stapler/pull/482, which had been reviewed by several contributors without raising concerns about the class naming. I decided it might be worth starting a discussion about this. 😊

Wouldn’t it enhance readability and maintainability to follow a consistent naming convention, such as the approach Jetty uses? Specifically, this could mean creating a dedicated package for such migrations. This way, we ensure clarity and maintainable organization for the future.


Regards,
Radek


Mark Waite

unread,
Jan 28, 2025, 4:17:53 PM1/28/25
to Jenkins Developers
On Tuesday, January 28, 2025 at 1:59:49 PM UTC-7 Radek wrote:

I recently looked at Basil's PR migrating deprecated EE8 APIs to EE9:
https://github.com/jenkinsci/jira-plugin/pull/635.

Thank you for taking on this task—it’s much appreciated!


I agree with the thanks for all the work that Basil and others have done on Spring Security.  The migration has worked very well because of how hard Basil and others worked.

While reviewing the PR, I noticed a naming convention that I had hoped we’d moved past, hence my stupid comment in the PR. This led me to discover https://github.com/jenkinsci/stapler/pull/482, which had been reviewed by several contributors without raising concerns about the class naming. I decided it might be worth starting a discussion about this. 😊


I prefer the "2" suffix in the naming because I find it easier to read in-line.  I know that StaplerRequest is the old API and StaplerRequest2 is the new API.  The import statements are at the top of the file and I would rather not jump to the top of the file to decide which methods are being called.
 

Wouldn’t it enhance readability and maintainability to follow a consistent naming convention, such as the approach Jetty uses? Specifically, this could mean creating a dedicated package for such migrations. This way, we ensure clarity and maintainable organization for the future.


Consistency in naming convention is a reason whey I prefer the "2" suffix within Jenkins.  It was used by Kohsuke in some of the earliest API migrations.  It was used by Jesse Glick in other early API migrations.  The Jenkins migration from acegi to Spring Security (JEP-220 from 2020) used the "2" suffix.  The Spring Security 5 to Spring Security 6 and Java EE 8 to Jakarta EE 9 migration chose the same naming convention.

Mark Waite
Reply all
Reply to author
Forward
0 new messages