groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [groovy] 03/08: Fix illegal access warning `java.util.Observable.changed`
Date Sat, 02 Nov 2019 21:47:00 GMT
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 3612aaf04a28d9d06f5285cd1e5c1c6a3e4ea255
Author: Daniel Sun <sunlan@apache.org>
AuthorDate: Fri Nov 1 23:49:45 2019 +0800

    Fix illegal access warning `java.util.Observable.changed`
    
    (cherry picked from commit 5694a1187252dfb91379b1ed634c191abbc6a4f4)
---
 src/test/groovy/GroovyMethodsTest.groovy | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/test/groovy/GroovyMethodsTest.groovy b/src/test/groovy/GroovyMethodsTest.groovy
index fcbf3dd..0c9d5d3 100644
--- a/src/test/groovy/GroovyMethodsTest.groovy
+++ b/src/test/groovy/GroovyMethodsTest.groovy
@@ -99,9 +99,14 @@ class GroovyMethodsTest extends GroovyTestCase {
     void testAsCoercionInterface() {
         def letters = ['a', 'b', 'c']
         def ol = new ObserverLike()
-        def o = new Observable()
+        def o = new Observable() {
+            @Override
+            synchronized void setChanged() {
+                super.setChanged()
+            }
+        }
         o.addObserver(ol as Observer) // addObserver takes Observer as param
-        letters.each{ o.changed = true; o.notifyObservers(it) }
+        letters.each{ o.setChanged(); o.notifyObservers(it) }
         assert ol.observed == letters
     }
 


Mime
View raw message