[prev in list] [next in list] [prev in thread] [next in thread]
List: groovy-user
Subject: [groovy-user] bug in FactoryBuilderSupport
From: "Skeptic ." <skeptic2000 () hotmail ! com>
Date: 2014-01-31 19:36:47
Message-ID: BLU175-W2BFBAF7DBF0A9F076D452BEAE0 () phx ! gbl
[Download RAW message or body]
Hi,
When a explicit method is called in nested factories with the wrong name / arguments, \
the error is not correctly reported abd the methodMissingDelegate is not called. Here \
is a builder and a script that show the problem. class TestBuilder extends \
FactoryBuilderSupport { TestBuilder() { super(true) }
def registerAll() { registerFactory('a', new AFactory()) \
registerFactory('b', new BFactory()) registerExplicitMethod('c', this.&test) \
}
class AFactory extends AbstractFactory {
@Override public Object newInstance(FactoryBuilderSupport builder, \
Object name, Object value, Map attributes) throws InstantiationException, \
IllegalAccessException { true } } class BFactory extends \
AbstractFactory { @Override public Object newInstance(FactoryBuilderSupport \
builder, Object name, Object value, Map attributes) throws InstantiationException, \
IllegalAccessException { true } } protected Integer \
test(Integer i1, Integer i2) { i1 + i2 }} \
///////////////////////////////////////////////////////// def tb = new TestBuilder()
tb.a() {
b() { c(3, "4") // or it could have been ct(3, 4) or any other typo. \
}}
[Attachment #3 (text/html)]
<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi,<div><br></div><div>When a explicit method \
is called in nested factories with the wrong name / arguments, the error is not \
correctly reported abd the methodMissingDelegate is not \
called.</div><div><br></div><div><span style="font-size: 12pt;">Here is a builder and \
a script that show the problem.</span></div><div><br></div><div><div>class \
TestBuilder extends FactoryBuilderSupport {</div><div><br></div><div> \
TestBuilder() {</div><div> super(true)</div><div> \
}</div><div><br></div><div> def registerAll() {</div><div> \
registerFactory('a', new AFactory())</div><div> \
registerFactory('b', new BFactory())</div><div> \
registerExplicitMethod('c', this.&test)</div><div> \
}</div><div><br></div><div><br></div><div> class AFactory extends \
AbstractFactory {</div><div><br></div><div> \
@Override</div><div> public Object \
newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) \
throws InstantiationException, IllegalAccessException {</div><div> \
true</div><div> \
}</div><div> }</div><div><br></div><div> class BFactory \
extends AbstractFactory {</div><div><br></div><div> \
@Override</div><div> public Object \
newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) \
throws InstantiationException, IllegalAccessException {</div><div> \
true</div><div> \
}</div><div> }</div><div><br></div><div> protected Integer \
test(Integer i1, Integer i2) {</div><div> i1 + \
i2</div><div> \
}</div><div>}</div></div><div><br></div><div>/////////////////////////////////////////////////////////</div><div><br></div><div><div>def \
tb = new TestBuilder()</div><div><br></div><div>tb.a() \
{</div><div><br></div><div> b() {</div><div> \
c(3, "4") // or it could have been ct(3, 4) or any other typo.</div><div> \
}</div><div>}</div></div><div><br></div><div><br></div> \
</div></body> </html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic