|
Groovy example source code file (Groovy2350Bug.groovy)
The Groovy Groovy2350Bug.groovy source codepackage groovy.bugs class Groovy2350Bug extends GroovyTestCase{ void testNoArg () { shouldFail (org.codehaus.groovy.runtime.metaclass.MethodSelectionException) { def a = new DefaultNoArgCtor() println a } assertEquals "NULL", new DefaultNoArgCtor2().value } void testNoDefCtor () { def a = new NoDefaultCtor("first") assertEquals "toS: first", a.toString() def b = new NoDefaultCtor() assertEquals "toS: null", b.toString() } } class NoDefaultCtor { def field NoDefaultCtor(param) { field= param } String toString() { return "toS: ${field}" } } class DefaultNoArgCtor { DefaultNoArgCtor(String s) {} DefaultNoArgCtor(int s) {} } class DefaultNoArgCtor2 { String value DefaultNoArgCtor2(String s) { value = s ? s : "NULL" } } Other Groovy examples (source code examples)Here is a short list of links related to this Groovy Groovy2350Bug.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.