Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Duplicate
-
Affects Version/s: 1.7.2
-
Fix Version/s: None
-
Component/s: groovy-jdk
-
Labels:None
-
Number of attachments :
Description
I assume this is a hard fix, as it is mentioned in GROOVY-2599, but the following code passes all the asserts. I would have expected them all to fail?
String.metaClass.toString = {-> "silly"} StringBuffer.metaClass.toString = {-> "silly"} StringBuilder.metaClass.toString = {-> "silly"} assert "hello world".toString() == "hello world" assert new StringBuffer("hello world").toString() == "hello world" assert new StringBuilder("hello world").toString() == "hello world"
I have added it as a new issue as I don't believe GROOVY-2599 actually covers this problem, it just crops up in the comments
Issue Links
- duplicates
-
GROOVY-3493
Cannot override methods via metaclass that are part of an interface implementation
-