Skip to content

Commit 6690899

Browse files
committed
Remove Java.synchronized
* It does not work on host objects. * It only worked on Ruby objects, for which TruffleRuby.synchronized is better.
1 parent ea2a0e9 commit 6690899

File tree

4 files changed

+1
-51
lines changed

4 files changed

+1
-51
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Changes:
7979

8080
* Standalone builds of TruffleRuby are now based on JDK11 (they used JDK8 previously). There should be no user-visible changes. Similarly, JDK11 is now used by default in development instead of JDK8.
8181
* The deprecated `Truffle::System.synchronized` has been removed.
82+
* `Java.synchronized` has been removed, it did not work on host objects.
8283

8384
# 21.0.0
8485

doc/user/polyglot.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,6 @@ To access instance methods use `.class`, such as `MyClass.class.getName`.
128128

129129
To import a Java class as a top-level constant, use `Java.import 'name'`.
130130

131-
`Java.synchronized(object) { }` will use the Java object's monitor to synchronize.
132-
133131
## Embedding in Java
134132

135133
TruffleRuby is embedded via the Polyglot API, which is part of GraalVM.

spec/truffle/interop/java_synchronized_spec.rb

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

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,6 @@ def self.import(name)
5858
type
5959
end
6060

61-
def self.synchronized(object)
62-
TruffleRuby.synchronized(object) do
63-
yield
64-
end
65-
end
66-
6761
# test-unit expects `Java::JavaLang::Throwable` to be resolvable if `::Java` is defined (see assertions.rb).
6862
# When doing JRuby-style interop, that's a fine assumption. However, we have `::Java` defined for Truffle-style
6963
# interop and in that case, the assumption does not hold. In order to allow the gem to work properly, we define

0 commit comments

Comments
 (0)