From dev-return-4091-archive-asf-public=cust-asf.ponee.io@polygene.apache.org Mon Aug 20 09:26:04 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id D567D180663 for ; Mon, 20 Aug 2018 09:26:03 +0200 (CEST) Received: (qmail 78427 invoked by uid 500); 20 Aug 2018 07:26:02 -0000 Mailing-List: contact dev-help@polygene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@polygene.apache.org Delivered-To: mailing list dev@polygene.apache.org Received: (qmail 78414 invoked by uid 99); 20 Aug 2018 07:26:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Aug 2018 07:26:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 2FC521802DE for ; Mon, 20 Aug 2018 07:26:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id KpTPssZSQfqc for ; Mon, 20 Aug 2018 07:26:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id D52935F47D for ; Mon, 20 Aug 2018 07:26:00 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 5C468E070F for ; Mon, 20 Aug 2018 07:26:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 12A8A24693 for ; Mon, 20 Aug 2018 07:26:00 +0000 (UTC) Date: Mon, 20 Aug 2018 07:26:00 +0000 (UTC) From: "Niclas Hedhman (JIRA)" To: dev@polygene.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (POLYGENE-309) @Optional in ValueBuilder does not work if field not touched MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/POLYGENE-309?page=3Dcom.atlass= ian.jira.plugin.system.issuetabpanels:all-tabpanel ] Niclas Hedhman updated POLYGENE-309: ------------------------------------ Description:=20 {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. T= his is not what is expected, all non-Optional properties must be disallowed= .{color} {code:java} public class RegressionTest extends AbstractPolygeneTest { @Test public void givenNullValueWhenInstantiatingValueCompositeExpectExceptio= n() { ValueBuilder builder =3D valueBuilderFactory.newValueBuilder= ( Value.class ); // Value prototype =3D 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 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. T= his is not what is expected, all non-Optional properties must be disallowed= .{color} =C2=A0 {{{color:#000080}public class {color}RegressionTest {color:#000080}extends = {color}AbstractPolygeneTest}} {{{}} {{=C2=A0=C2=A0=C2=A0 {color:#808000}@Test {color}=C2=A0=C2=A0=C2=A0 {color:#000080}public void {color}test()}} {{=C2=A0=C2=A0=C2=A0 {}} {{=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ValueBuilder builder = =3D {color:#660e7a}valueBuilderFactory{color}.newValueBuilder( Value.{color= :#000080}class {color});}} {{{color:#808080}=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 // Value protot= ype =3D builder.prototype(); {color}{color:#808080}=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 // prototy= pe.title().set( null ); {color}=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 System.{color:#660e7a}out= {color}.println(builder.newInstance());}} {{=C2=A0=C2=A0=C2=A0 }}} {{=C2=A0=C2=A0=C2=A0 {color:#808000}@Override {color}=C2=A0=C2=A0=C2=A0 {color:#000080}public void {color}assemble( Modul= eAssembly module )}} {{=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 {color:#000080}throws {color}A= ssemblyException}} {{=C2=A0=C2=A0=C2=A0 {}} {{=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 module.defaultServices();}} {{=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 module.values( Value.{color:#0= 00080}class {color});}} {{=C2=A0=C2=A0=C2=A0 }}} {{{color:#000080}=C2=A0=C2=A0=C2=A0 public interface {color}Value}} {{=C2=A0=C2=A0=C2=A0 {}} {{=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Property title();}} {{=C2=A0=C2=A0=C2=A0 }}} {{}}} > @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 disallow= ed.{color} > {code:java} > public class RegressionTest extends AbstractPolygeneTest > { > @Test > public void givenNullValueWhenInstantiatingValueCompositeExpectExcept= ion() > { > ValueBuilder builder =3D valueBuilderFactory.newValueBuild= er( Value.class ); > // Value prototype =3D 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 title(); > } > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)