role-strategy-plugin icon indicating copy to clipboard operation
role-strategy-plugin copied to clipboard

Remove com.synopsys.arc.jenkins.plugins.rolestrategy.UserMacroExtension deprecated warnings

Open Conrad-T-Pino opened this issue 2 years ago • 2 comments

Remove com.synopsys.arc.jenkins.plugins.rolestrategy.UserMacroExtension deprecated warnings.

Remove internal API deprecated warnings in preparation for coming matrix-auth-3.0 API deprecated warnings.

  • [x] Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • [x] Ensure that the pull request title represents the desired changelog entry
  • [x] Please describe what you did
  • [x] Link to relevant issues in GitHub or Jira
  • [x] Link to relevant pull requests, esp. upstream and downstream changes
  • [x] Ensure you have provided tests - that demonstrates feature works or fixes the issue

JIRA Issue: https://issues.jenkins.io/browse/JENKINS-67413 No relevant pull requests are known, Changes limited to where a successful compile is a sufficient test.

Conrad-T-Pino avatar Dec 21 '21 04:12 Conrad-T-Pino

@SuppressWarnings("deprecation") cannot be applied to import statements and UserMacroExtension class is deprecated. Keeping import statements in place leaves three (3) instances of this warning in place:

  1. rolestrategy/RoleStrategyConfig.java:[30,53] com...UserMacroExtension in com.synopsys.arc.jenkins.plugins.rolestrategy has been deprecated
  2. rolestrategy/RoleBasedAuthorizationStrategy.java:[29,53] com...UserMacroExtension in com.synopsys.arc.jenkins.plugins.rolestrategy has been deprecated
  3. rolestrategy/macros/LoggedUserMacro.java:[28,53] com...UserMacroExtension in com.synopsys.arc.jenkins.plugins.rolestrategy has been deprecated
  • Unfortunately only deprecated class import warning workaround is the fully qualified class name; agreed it's ugly.
  • IMO warnings should be calls to action and if no action is correct then suppression is the newbie-friendly course.

I'm training myself as new contributor and chose innocuous goal (zero warnings) as an exercise. Your feedback and participation are valued.

Conrad-T-Pino avatar Dec 21 '21 06:12 Conrad-T-Pino

Thanks for the reply. This is very interesting. I found https://bugs.openjdk.java.net/browse/JDK-8065613 which should ideally remove deprecation warnings for import statements. I checked this with JDK11 and JDK16 and I still get warnings; this should have been fixed with Java 9. Maybe this should be raised as a bug in javac given that the JLS now states that:

A Java compiler must produce a deprecation warning when an ordinarily deprecated program element is used (overridden, invoked, or referenced by name) in the declaration of a program element (whether explicitly or implicitly declared), unless:

  • ...
  • The use is within an import declaration that imports the ordinarily deprecated class, interface, or member; or ...

AbhyudayaSharma avatar Dec 21 '21 07:12 AbhyudayaSharma

UserMacros have been removed completely

mawinter69 avatar May 02 '23 20:05 mawinter69