You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@polygene.apache.org by "Niclas Hedhman (JIRA)" <ji...@apache.org> on 2018/08/20 07:26:00 UTC
[jira] [Updated] (POLYGENE-309) @Optional in ValueBuilder does not
work if field not touched
[ https://issues.apache.org/jira/browse/POLYGENE-309?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Niclas Hedhman updated POLYGENE-309:
------------------------------------
Description:
{color:#707070}The code below will not fail, although it should. Instead it will output "title":null{color}
{color:#707070}If the comments are removed, the exception will be thrown. This is not what is expected, all non-Optional properties must be disallowed.{color}
{code:java}
public class RegressionTest extends AbstractPolygeneTest
{
@Test
public void givenNullValueWhenInstantiatingValueCompositeExpectException()
{
ValueBuilder<Value> builder = valueBuilderFactory.newValueBuilder( Value.class );
// Value prototype = builder.prototype();
// prototype.title().set( null );
System.out.println(builder.newInstance());
}
@Override
public void assemble( ModuleAssembly module )
throws AssemblyException
{
module.defaultServices();
module.values( Value.class );
}
public interface Value
{
Property<String> title();
}
}
{code}
was:
{color:#707070}The code below will not fail, although it should. Instead it will output "title":null
{color}
{color:#707070}If the comments are removed, the exception will be thrown. This is not what is expected, all non-Optional properties must be disallowed.{color}
{{{color:#000080}public class {color}RegressionTest {color:#000080}extends {color}AbstractPolygeneTest}}
{{{}}
{{ {color:#808000}@Test
{color} {color:#000080}public void {color}test()}}
{{ {}}
{{ ValueBuilder<Value> builder = {color:#660e7a}valueBuilderFactory{color}.newValueBuilder( Value.{color:#000080}class {color});}}
{{{color:#808080} // Value prototype = builder.prototype();
{color}{color:#808080} // prototype.title().set( null );
{color} System.{color:#660e7a}out{color}.println(builder.newInstance());}}
{{ }}}
{{ {color:#808000}@Override
{color} {color:#000080}public void {color}assemble( ModuleAssembly module )}}
{{ {color:#000080}throws {color}AssemblyException}}
{{ {}}
{{ module.defaultServices();}}
{{ module.values( Value.{color:#000080}class {color});}}
{{ }}}
{{{color:#000080} public interface {color}Value}}
{{ {}}
{{ Property<String> title();}}
{{ }}}
{{}}}
> @Optional in ValueBuilder does not work if field not touched
> ------------------------------------------------------------
>
> Key: POLYGENE-309
> URL: https://issues.apache.org/jira/browse/POLYGENE-309
> Project: Polygene
> Issue Type: New Feature
> Reporter: Niclas Hedhman
> Priority: Major
>
> {color:#707070}The code below will not fail, although it should. Instead it will output "title":null{color}
> {color:#707070}If the comments are removed, the exception will be thrown. This is not what is expected, all non-Optional properties must be disallowed.{color}
> {code:java}
> public class RegressionTest extends AbstractPolygeneTest
> {
> @Test
> public void givenNullValueWhenInstantiatingValueCompositeExpectException()
> {
> ValueBuilder<Value> builder = valueBuilderFactory.newValueBuilder( Value.class );
> // Value prototype = builder.prototype();
> // prototype.title().set( null );
> System.out.println(builder.newInstance());
> }
> @Override
> public void assemble( ModuleAssembly module )
> throws AssemblyException
> {
> module.defaultServices();
> module.values( Value.class );
> }
> public interface Value
> {
> Property<String> title();
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)