[
https://issues.apache.org/jira/browse/GROOVY-10101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King closed GROOVY-10101.
------------------------------
> Unexpected value static variable from Child class extends (Base Class extends
> HashMap)
> --------------------------------------------------------------------------------------
>
> Key: GROOVY-10101
> URL: https://issues.apache.org/jira/browse/GROOVY-10101
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 3.0.8
> Reporter: Nguyen Quan
> Priority: Major
> Attachments: 74634384_111179873705730_4758671159485005824_n.jpg
>
>
> It seems that the error occurs when the base class inherits HashMap which
> makes the static value always null. You can read the code below. It prints
> null instead of hello world.
> You can clone it on [my repo|https://github.com/tienquanutc/groovy-3.0.8-bug]
> {code:java}
> class Main {
> static void main(String[] args) {
> BaseClass obj = new ChildClass()
> obj.sayHello() //it print null instead "helloword:
> }
> static abstract class BaseClass extends HashMap<String, Object> {
> protected static final String HELLO_WORLD = "hello world"
> abstract void sayHello()
> }
> static class ChildClass extends BaseClass {
> @Override
> void sayHello() {
> println HELLO_WORLD
> }
> }
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)