polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niclas Hedhman (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (POLYGENE-309) @Optional in ValueBuilder does not work if field not touched
Date Mon, 20 Aug 2018 07:27:00 GMT

     [ https://issues.apache.org/jira/browse/POLYGENE-309?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Niclas Hedhman updated POLYGENE-309:
------------------------------------
    Description: 
The code below will not fail, although it should. Instead it will output "title":null

If the comments are removed, the exception will be thrown. This is not what is expected, all
non-Optional properties must be disallowed.
{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}
{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}


> @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
>
> The code below will not fail, although it should. Instead it will output "title":null
> If the comments are removed, the exception will be thrown. This is not what is expected,
all non-Optional properties must be disallowed.
> {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)

Mime
View raw message