Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8267432

Refactoring deprecated calls to make @SuppressWarning more precise after JEP 411

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P3
    • 18
    • None
    • security-libs
    • None

    Description

      JDK-8266459 deprecated the Security Manager for removal and added hundreds of `@SuppressWarnings("removal")` all around JDK. In some cases, the annotation must be added to a place which is quite faraway from where the deprecated API is called (For example, if the API is called in a static block and not in a declaration, the annotation must be added to the class level). It is not obvious what the annotation is for, and with the annotation covering too big a portion it's easy to call other deprecated methods without being noticed.

      Overall, there are two ways to refactor existing code to avoid this:

      1. Call the deprecated API in a declaration statement. Sometimes this means a temporary or useless variable must be declared.

      2. Extract the call into a separate method

      During the automatic conversion, we have a full list of the distance between where each annotation is added and where the deprecated API it guards is. Sub-tasks will be created in this issue to deal with them area by area. Those cases with the longest distance will be considered first.

      Attachments

        Issue Links

          Activity

            People

              weijun Weijun Wang
              weijun Weijun Wang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: