|
Groovy example source code file (Groovy1706_Bug.groovy)
The Groovy Groovy1706_Bug.groovy source codepackage groovy.bugs class Groovy1706_Bug extends GroovyTestCase { void testStaticMethodIsCalledFromSubclass() { // disclaimer: static methods shouldn't be // called on instances Groovy1706A a = new Groovy1706A() Groovy1706B b = new Groovy1706B() assert "A" == a.doit() assert "B" == b.doit() } void testStaticMethodIsCalledInCorrectInstance() { // disclaimer: static methods shouldn't be // called on instances Groovy1706A i = new Groovy1706B() assert "B" == i.doit() // in Java the answer would be "A" } } class Groovy1706A { static doit() { "A" } } class Groovy1706B extends Groovy1706A { static doit() { "B" } } Other Groovy examples (source code examples)Here is a short list of links related to this Groovy Groovy1706_Bug.groovy source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.