Skip to content

Add "since" to bare Deprecated annotations#9027

Merged
headius merged 1 commit intojruby:masterfrom
headius:deprecated_since
Oct 10, 2025
Merged

Add "since" to bare Deprecated annotations#9027
headius merged 1 commit intojruby:masterfrom
headius:deprecated_since

Conversation

@headius
Copy link
Member

@headius headius commented Oct 9, 2025

The "since" attributes added here reflect the first release after each deprecation was added. We will use this to remove oldest deprecations (by some measure of oldest) in an upcoming release.

The Ruby script used to make this change is provided here:

Dir[ARGV[0] + "/**/*.java"].each do |file|
  file_lines = File.readlines(file)
  file_lines.each_with_index do |line, i|
    line.gsub!(/@Deprecated\S*$/) do
      sha = `git blame -L #{i+1},#{i+1} #{file}`.split(" ")[0]
      tag = `git describe --abbrev=0 --tags --contains #{sha}`.split("~")[0]
      "@Deprecated(since = \"#{tag}\")"
    end
  end
  File.write(file, file_lines.join(''))
  puts "process #{file}"
end

There may be places where sources moved or the deprecation line does not reflect the true earliest version, but worst case the deprecations stick around a little longer, or require manual investigation.

@headius headius added this to the JRuby 10.0.3.0 milestone Oct 9, 2025
The "since" attributes added here reflect the first release after
each deprecation was added. We will use this to remove oldest
deprecations (by some measure of oldest) in an upcoming release.

The Ruby script used to make this change is provided here:

```ruby
Dir[ARGV[0] + "/**/*.java"].each do |file|
  file_lines = File.readlines(file)
  file_lines.each_with_index do |line, i|
    line.gsub!(/@deprecated\S*$/) do
      sha = `git blame -L #{i+1},#{i+1} #{file}`.split(" ")[0]
      tag = `git describe --abbrev=0 --tags --contains #{sha}`.split("~")[0]
      "@deprecated(since = \"#{tag}\")"
    end
  end
  File.write(file, file_lines.join(''))
  puts "process #{file}"
end
```

There may be places where sources moved or the deprecation line
does not reflect the true earliest version, but worst case the
deprecations stick around a little longer, or require manual
investigation.

Several tags have been manually updated to the next logical one:

* jruby-openssl-* tags have been updated to the nearest JRuby
  release tag.
* All preview and RC tags have been updated to their associated
  non-prerelease versions.
* One bogus tag "list" was removed from the repo and all "since"
  lines updated to point at the nearest JRuby release tag.
* The "10.0" deprecations have been updated to "10.0.0.0" so they
  point at a full, valid tag and release version.
* The "9.4" deprecations added to methods that *should have* been
  deprecated in 9.4.x were modified to "10.0.0.0" because that is
  the first release in which they were *actually* deprecated.
@headius
Copy link
Member Author

headius commented Oct 10, 2025

I made a few manual changes after the initial push of the automated version:

  • jruby-openssl-* tags have been updated to the nearest JRuby release tag.
  • All preview and RC tags have been updated to their associated non-prerelease versions.
  • One bogus tag "list" was removed from the repo and all "since" lines updated to point at the nearest JRuby release tag.
  • The "10.0" deprecations have been updated to "10.0.0.0" so they point at a full, valid tag and release version.
  • The "9.4" deprecations added to methods that should have been deprecated in 9.4.x were modified to "10.0.0.0" because that is the first release in which they were actually deprecated.

@headius headius merged commit a718ac9 into jruby:master Oct 10, 2025
75 checks passed
@headius headius deleted the deprecated_since branch October 10, 2025 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant