Skip to content

Commit ef17fc7

Browse files
committed
[GR-59866] Remove deprecated Encoding#replicate method
PullRequest: truffleruby/4427
2 parents 8d4ff03 + ec111d4 commit ef17fc7

File tree

7 files changed

+1
-53
lines changed

7 files changed

+1
-53
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Compatibility:
4343
* Declare `File::SHARE_DELETE` constant (#3745, @andrykonchin).
4444
* Support `symbolize_names` argument to `MatchData#named_captures` (#3681, @rwstauner).
4545
* Support `Proc#initialize_{dup,copy}` for subclasses (#3681, @rwstauner).
46+
* Remove deprecated `Encoding#replicate` method (#3681, @rwstauner).
4647

4748
Performance:
4849

spec/tags/core/encoding/replicate_tags.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

spec/tags/truffle/methods_tags.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ fails(we defined these methods on the generated Data subclasses):Public methods
101101
fails(we defined these methods on the generated Data subclasses):Public methods on Data should include to_s
102102
fails(we defined these methods on the generated Data subclasses):Public methods on Data should include with
103103
fails:Public methods on Dir should include chdir
104-
fails:Public methods on Encoding should not include replicate
105104
fails:Public methods on Fiber should include kill
106105
fails:Public methods on Method should include dup
107106
fails:Public methods on Module should include set_temporary_name

src/main/java/org/truffleruby/core/encoding/EncodingManager.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -256,16 +256,6 @@ public synchronized RubyEncoding createDummyEncoding(String name) {
256256
return defineDynamicEncoding(Encodings.DUMMY_ENCODING_BASE, nameBytes);
257257
}
258258

259-
@TruffleBoundary
260-
public synchronized RubyEncoding replicateEncoding(RubyEncoding encoding, String name) {
261-
if (getRubyEncoding(name) != null) {
262-
return null;
263-
}
264-
265-
final byte[] nameBytes = StringOperations.encodeAsciiBytes(name);
266-
return defineDynamicEncoding(encoding.jcoding, nameBytes);
267-
}
268-
269259
public RubyEncoding getLocaleEncoding() {
270260
return localeEncoding;
271261
}

src/main/java/org/truffleruby/core/encoding/EncodingNodes.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -537,33 +537,6 @@ public static RubyArray setIndexOrRaiseError(Node node, String name, RubyEncodin
537537

538538
}
539539

540-
@Primitive(name = "encoding_replicate")
541-
public abstract static class EncodingReplicateNode extends EncodingCreationNode {
542-
543-
@Specialization(guards = "strings.isRubyString(this, nameObject)", limit = "1")
544-
static RubyArray encodingReplicate(RubyEncoding object, Object nameObject,
545-
@Cached RubyStringLibrary strings,
546-
@Cached ToJavaStringNode toJavaStringNode,
547-
@Bind("this") Node node) {
548-
final String name = toJavaStringNode.execute(node, nameObject);
549-
550-
final RubyEncoding newEncoding = replicate(node, name, object);
551-
return setIndexOrRaiseError(node, name, newEncoding);
552-
}
553-
554-
@TruffleBoundary
555-
private static RubyEncoding replicate(Node node, String name, RubyEncoding encoding) {
556-
if (getContext(node).getEncodingManager().getNumberOfEncodings() >= Encodings.MAX_NUMBER_OF_ENCODINGS) {
557-
throw new RaiseException(
558-
getContext(node),
559-
coreExceptions(node).encodingErrorTooManyEncodings(Encodings.MAX_NUMBER_OF_ENCODINGS, node));
560-
}
561-
562-
return getContext(node).getEncodingManager().replicateEncoding(encoding, name);
563-
}
564-
565-
}
566-
567540
@Primitive(name = "encoding_create_dummy")
568541
public abstract static class DummyEncodingNode extends EncodingCreationNode {
569542

src/main/ruby/truffleruby/core/encoding.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,6 @@ def names
138138
names
139139
end
140140

141-
def replicate(name)
142-
warn 'Encoding#replicate is deprecated and will be removed in Ruby 3.3; use the original encoding instead', category: :deprecated, uplevel: 1
143-
144-
Truffle::EncodingOperations.replicate_encoding(self, name)
145-
end
146-
147141
def _dump(depth)
148142
name
149143
end

src/main/ruby/truffleruby/core/truffle/encoding_operations.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ def self.dummy_encoding(name)
4949
[new_encoding, index]
5050
end
5151

52-
def self.replicate_encoding(encoding, name)
53-
name = StringValue(name)
54-
new_encoding, _index = Primitive.encoding_replicate encoding, name
55-
EncodingMap[name.upcase.to_sym] = [nil, new_encoding]
56-
new_encoding
57-
end
58-
5952
def self.define_alias(encoding, alias_name)
6053
key = alias_name.upcase.to_sym
6154
EncodingMap[key] = [alias_name, encoding]

0 commit comments

Comments
 (0)