aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorEdouard CHIN <edouard.chin@shopify.com>2019-07-22 15:27:17 +0200
committerEdouard CHIN <edouard.chin@shopify.com>2019-07-22 15:27:17 +0200
commit426d2f2502780635ca56c09a5aeb0829dd9212ee (patch)
tree4d913d38a0ac553d0c1974f378d8f50e593f8e53 /railties
parent9ad806887096be1f60019a6b301a4c84aa1d8e65 (diff)
downloadrails-426d2f2502780635ca56c09a5aeb0829dd9212ee.tar.gz
rails-426d2f2502780635ca56c09a5aeb0829dd9212ee.tar.bz2
rails-426d2f2502780635ca56c09a5aeb0829dd9212ee.zip
Move the deprecation call after the new class has been defined:
- If we create the deprecation before the new class is defined this creates an issue in case you use a `TracePoint`. The `Tracepoint#return_value` will try to get the new class constant resulting in a uninitialized constant Rails::SourceAnnotationExtractor The problem can be reproduced like this: ```ruby @defined = Set.new ANONYMOUS_CLASS_DEFINITION_TRACEPOINT = TracePoint.new(:c_return) do |tp| next unless @defined.add?(tp.return_value) end ANONYMOUS_CLASS_DEFINITION_TRACEPOINT.enable require 'rails' require "rails/source_annotation_extractor" ```
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/source_annotation_extractor.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/railties/lib/rails/source_annotation_extractor.rb b/railties/lib/rails/source_annotation_extractor.rb
index 9ce22b96a6..77a99036ec 100644
--- a/railties/lib/rails/source_annotation_extractor.rb
+++ b/railties/lib/rails/source_annotation_extractor.rb
@@ -2,11 +2,6 @@
require "active_support/deprecation"
-# Remove this deprecated class in the next minor version
-#:nodoc:
-SourceAnnotationExtractor = ActiveSupport::Deprecation::DeprecatedConstantProxy.
- new("SourceAnnotationExtractor", "Rails::SourceAnnotationExtractor")
-
module Rails
# Implements the logic behind <tt>Rails::Command::NotesCommand</tt>. See <tt>rails notes --help</tt> for usage information.
#
@@ -160,3 +155,8 @@ module Rails
end
end
end
+
+# Remove this deprecated class in the next minor version
+#:nodoc:
+SourceAnnotationExtractor = ActiveSupport::Deprecation::DeprecatedConstantProxy.
+ new("SourceAnnotationExtractor", "Rails::SourceAnnotationExtractor")