<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">I agree with Gunnar. I'm for option #1
      as well.<br>
      <br>
      seb<br>
      <br>
      On 09.02.2013 12:12, Gunnar Morling wrote:<br>
    </div>
    <blockquote
cite="mid:CADGJaX8N9F68cbOQkB2e==_yi5jLsUWQV1dw=Aky6zgOQ51AYg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div style="">My personal preference would be #1 as well.</div>
        <div style=""><br>
        </div>
        <div style="">The docs don't say that non-existent nodes are
          allowed, so IMO it's ok to clarify now that it is not allowed.
          If code relied on adding non-existent nodes, it relied on
          behavior not guaranteed explicitly by the spec.</div>
        <div style=""><br>
        </div>
        <div style="">--Gunnar</div>
        <div style=""><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">2013/2/8 Emmanuel Bernard <span
            dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:emmanuel@hibernate.org" target="_blank">emmanuel@hibernate.org</a>&gt;</span><br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">I had the
            same reserve as you but then reading the JavaDoc made me<br>
            realize that the doc mentions properties so it is
            technically not as<br>
            vague as I initially thought.<br>
            <span class="HOEnZb"><font color="#888888"><br>
                Emmanuel<br>
              </font></span>
            <div class="HOEnZb">
              <div class="h5"><br>
                On Fri 2013-02-08 11:48, Matt Benson wrote:<br>
                &gt; Personally my reason for eschewing option #1 is the
                possibility of breaking<br>
                &gt; existing code.<br>
                &gt;<br>
                &gt; Matt<br>
                &gt;<br>
                &gt;<br>
                &gt; On Fri, Feb 8, 2013 at 11:22 AM, Emmanuel Bernard
                &lt;<a moz-do-not-send="true"
                  href="mailto:emmanuel@hibernate.org">emmanuel@hibernate.org</a>&gt;wrote:<br>
                &gt;<br>
                &gt; &gt; At this time of day I do tend to like option
                #1 (ie making virtual nodes<br>
                &gt; &gt; illegal). Otherwise my preferred option is #4<br>
                &gt; &gt; (VirtualElementDescriptor).<br>
                &gt; &gt;<br>
                &gt; &gt; Out of curiosity for people not preferring
                option #1. What use case do<br>
                &gt; &gt; you see in having virtual nodes?<br>
                &gt; &gt;<br>
                &gt; &gt; Emmanuel<br>
                &gt; &gt;<br>
                &gt; &gt; On Fri 2013-02-08 11:08, Matt Benson wrote:<br>
                &gt; &gt; &gt; Hmm, a third option for the elementClass
                of such a descriptor might be<br>
                &gt; &gt; &gt; Void.class.<br>
                &gt; &gt; &gt;<br>
                &gt; &gt; &gt; I prefer option #3, followed by #4.<br>
                &gt; &gt; &gt;<br>
                &gt; &gt; &gt; Matt<br>
                &gt; &gt; &gt;<br>
                &gt; &gt; &gt;<br>
                &gt; &gt; &gt; On Fri, Feb 8, 2013 at 5:17 AM, Gunnar
                Morling &lt;<a moz-do-not-send="true"
                  href="mailto:gunnar@hibernate.org">gunnar@hibernate.org</a>&gt;<br>
                &gt; &gt; wrote:<br>
                &gt; &gt; &gt;<br>
                &gt; &gt; &gt; &gt; Hi experts,<br>
                &gt; &gt; &gt; &gt;<br>
                &gt; &gt; &gt; &gt; One of the remaining issues on our
                way to 1.1 is BVAL-336 [1], which is<br>
                &gt; &gt; &gt; &gt; about what to return from
                Node#getElementDescriptor() for nodes added<br>
                &gt; &gt; by<br>
                &gt; &gt; &gt; &gt; the user via the
                ConstraintViolationBuilder API.<br>
                &gt; &gt; &gt; &gt;<br>
                &gt; &gt; &gt; &gt; Note that as per the spec only sub
                paths can be created by the user,<br>
                &gt; &gt; i.e.<br>
                &gt; &gt; &gt; &gt; user added nodes always represent
                properties but e.g. no methods or<br>
                &gt; &gt; &gt; &gt; parameters. Based on that, it seems
                right to return the correct<br>
                &gt; &gt; &gt; &gt; PropertyDescriptor in case a user
                adds a node for an existing property.<br>
                &gt; &gt; &gt; &gt;<br>
                &gt; &gt; &gt; &gt; Things get tricky though when nodes
                are added for non-existent<br>
                &gt; &gt; properties.<br>
                &gt; &gt; &gt; &gt; Emmanuel, Hardy and I identified the
                following options to address this<br>
                &gt; &gt; &gt; &gt; situation:<br>
                &gt; &gt; &gt; &gt;<br>
                &gt; &gt; &gt; &gt; #1 Disallow adding non-existent
                nodes<br>
                &gt; &gt; &gt; &gt;<br>
                &gt; &gt; &gt; &gt; In case a user adds a node but no
                property with that names exist, an<br>
                &gt; &gt; &gt; &gt; exception is thrown. The problem is
                elegantly avoided that way, but we<br>
                &gt; &gt; &gt; &gt; might break some 1.0 user code
                (currently the spec is not really clear<br>
                &gt; &gt; &gt; &gt; whether added nodes must exist or
                not).<br>
                &gt; &gt; &gt; &gt;<br>
                &gt; &gt; &gt; &gt; #2 return null from
                getElementDescriptor()<br>
                &gt; &gt; &gt; &gt;<br>
                &gt; &gt; &gt; &gt; When invoking getElementDescriptor()
                on a Node representing a<br>
                &gt; &gt; non-existent<br>
                &gt; &gt; &gt; &gt; property, null could be returned.
                This seems consistent (there is no<br>
                &gt; &gt; &gt; &gt; element), but causes additional null
                checking when traversing a path.<br>
                &gt; &gt; &gt; &gt;<br>
                &gt; &gt; &gt; &gt; #3 return a PropertyDescriptor from
                getElementDescriptor()<br>
                &gt; &gt; &gt; &gt;<br>
                &gt; &gt; &gt; &gt; Since all user-added nodes represent
                properties, a PropertyDescriptor<br>
                &gt; &gt; &gt; &gt; could be returned. hasConstraints()
                would return false,<br>
                &gt; &gt; &gt; &gt; getConstraintDescriptors() the empty
                set etc. This would allow to<br>
                &gt; &gt; handle<br>
                &gt; &gt; &gt; &gt; all nodes and their descriptors
                uniformly when traversing a path.<br>
                &gt; &gt; Question<br>
                &gt; &gt; &gt; &gt; is what to return from
                PropertyDescriptor#getElementClass(). Options<br>
                &gt; &gt; are to<br>
                &gt; &gt; &gt; &gt; return null (signaling that the
                property is non-existent) or<br>
                &gt; &gt; Object.class.<br>
                &gt; &gt; &gt; &gt;<br>
                &gt; &gt; &gt; &gt; #4 return a VirtualDescriptor from
                getElementDescriptor()<br>
                &gt; &gt; &gt; &gt;<br>
                &gt; &gt; &gt; &gt; We could create a new Kind, VIRTUAL,
                and an accompanying type<br>
                &gt; &gt; &gt; &gt; VirtualDescriptor and return an
                instance of this. Behavior of the<br>
                &gt; &gt; methods<br>
                &gt; &gt; &gt; &gt; on the descriptor would be basically
                the same as in #3; getKind()<br>
                &gt; &gt; returning<br>
                &gt; &gt; &gt; &gt; Kind.VIRTUAL would allow for a very
                explicit checking whether the node<br>
                &gt; &gt; &gt; &gt; exists or not.<br>
                &gt; &gt; &gt; &gt;<br>
                &gt; &gt; &gt; &gt; Any feedback on the options (ideally
                with arguments pro/con) or other<br>
                &gt; &gt; &gt; &gt; alternatives are highly welcome. As
                life goes, Emmanuel's, Hardy's and<br>
                &gt; &gt; my<br>
                &gt; &gt; &gt; &gt; preferences are equally distributed
                between these options :)<br>
                &gt; &gt; &gt; &gt;<br>
                &gt; &gt; &gt; &gt; Thanks,<br>
                &gt; &gt; &gt; &gt;<br>
                &gt; &gt; &gt; &gt; --Gunnar<br>
                &gt; &gt; &gt; &gt;<br>
                &gt; &gt; &gt; &gt; [1] <a moz-do-not-send="true"
                  href="https://hibernate.onjira.com/browse/BVAL-336"
                  target="_blank">https://hibernate.onjira.com/browse/BVAL-336</a><br>
                &gt; &gt; &gt; &gt;<br>
                &gt; &gt; &gt; &gt;<br>
              </div>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>