From 426d2f2502780635ca56c09a5aeb0829dd9212ee Mon Sep 17 00:00:00 2001 From: Edouard CHIN Date: Mon, 22 Jul 2019 15:27:17 +0200 Subject: 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" ``` --- railties/lib/rails/source_annotation_extractor.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'railties') 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 Rails::Command::NotesCommand. See rails notes --help 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") -- cgit v1.2.3