<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <tt>And MR-Jar obviates using ASM to add the right value to the
      meta-annotation; you just have two sources, one for 13 and one for
      prior.  </tt><br>
    <br>
    <div class="moz-cite-prefix">On 4/10/2018 5:07 PM, Remi Forax wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:350222201.925811.1523394456214.JavaMail.zimbra@u-pem.fr">
      <div style="font-family: arial, helvetica, sans-serif; font-size:
        12pt; color: #000000">
        <div>Here is what i've done to support ElementType.MODULE a
          library that has to work with Java 8, <br data-mce-bogus="1">
        </div>
        <div>adding a target type is usually compatible because the one
          that add the annotation target is often the one in control of
          the code that will also consume the annotation.<br>
        </div>
        <div><br data-mce-bogus="1">
        </div>
        <div>In order to work you need to answer two questions:<br
            data-mce-bogus="1">
        </div>
        <div>  - how to create an annotation compatible 8 with a
          meta-annotation value only available in 9.</div>
        <div>    using ASM to add the right value to the annotation
          meta-annotation is a 10 lines program,<br data-mce-bogus="1">
        </div>
        <div> - how to consume a non existing meta-annotation value,<br
            data-mce-bogus="1">
        </div>
        <div>   i do a switch on the name of the enum instead of doing a
          switch on the enum itself.<br data-mce-bogus="1">
        </div>
        <div><br data-mce-bogus="1">
        </div>
        <div>Rémi<br data-mce-bogus="1">
        </div>
        <div><br>
        </div>
        <hr id="zwchr" data-marker="__DIVIDER__">
        <div data-marker="__HEADERS__">
          <blockquote style="border-left:2px solid
#1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>De:
            </b>"Kevin Bourrillion" <a class="moz-txt-link-rfc2396E" href="mailto:kevinb@google.com"><kevinb@google.com></a><br>
            <b>À: </b>"Brian Goetz" <a class="moz-txt-link-rfc2396E" href="mailto:brian.goetz@oracle.com"><brian.goetz@oracle.com></a><br>
            <b>Cc: </b>"amber-spec-experts"
            <a class="moz-txt-link-rfc2396E" href="mailto:amber-spec-experts@openjdk.java.net"><amber-spec-experts@openjdk.java.net></a><br>
            <b>Envoyé: </b>Mardi 10 Avril 2018 22:42:24<br>
            <b>Objet: </b>Re: Annos on records (was: Records -- Using
            them as JPA entities and validating them with Bean
            Validation)<br>
          </blockquote>
        </div>
        <div data-marker="__QUOTED_TEXT__">
          <blockquote style="border-left:2px solid
#1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;">
            <div dir="ltr">If we create a new ElementType.RECORD, the
              annotation in question won't even be <i>able </i>to add
              that target type until it is ready to <i>require</i> JDK
              13 (or whatever) as its new minimum version.<br>
              <br>
            </div>
            <div class="gmail_extra"><br>
              <div class="gmail_quote">On Tue, Apr 10, 2018 at 1:38 PM,
                Brian Goetz <span dir="ltr"><<a
                    href="mailto:brian.goetz@oracle.com" target="_blank"
                    moz-do-not-send="true">brian.goetz@oracle.com</a>></span>
                wrote:<br>
                <blockquote class="gmail_quote" style="margin:0 0 0
                  .8ex;border-left:1px #ccc solid;padding-left:1ex">[
                  moving to amber-spec-experts]<br>
                  <br>
                  I tend to agree.  It will take longer to adopt, but it
                  _is_ a new kind of target in a source file, and then
                  frameworks can decide what it should mean, and then
                  there's no confusion.<br>
                  <br>
                  It's possible, too, as a migration move, to split the
                  difference, though I'm not sure its worth it -- add a
                  new target, _and_, if the target includes
                  param/field/method, but does _not_ include record,
                  then lower the anno onto all applicable members.<br>
                  <br>
                  On 4/10/2018 1:34 PM, Remi Forax wrote:<br>
                  <blockquote class="gmail_quote" style="margin:0 0 0
                    .8ex;border-left:1px #ccc solid;padding-left:1ex">
                    No, not right for me,<br>
                    a new Annotation target is better so each framework
                    can decide what it means for its annotation.<br>
                    <br>
                    It will slow the adoption but it's better in the
                    long term.<br>
                    <br>
                    Rémi<br>
                    <br>
                    ----- Mail original -----<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      De: "Kevin Bourrillion" <<a
                        href="mailto:kevinb@google.com" target="_blank"
                        moz-do-not-send="true">kevinb@google.com</a>><br>
                      À: "Gunnar Morling" <<a
                        href="mailto:gunnar@hibernate.org"
                        target="_blank" moz-do-not-send="true">gunnar@hibernate.org</a>><br>
                      Cc: "amber-dev" <<a
                        href="mailto:amber-dev@openjdk.java.net"
                        target="_blank" moz-do-not-send="true">amber-dev@openjdk.java.net</a>><br>
                      Envoyé: Mardi 10 Avril 2018 19:25:57<br>
                      Objet: Re: Records -- Using them as JPA entities
                      and validating them with Bean Validation<br>
                      On Mon, Apr 9, 2018 at 1:39 PM, Gunnar Morling
                      <<a href="mailto:gunnar@hibernate.org"
                        target="_blank" moz-do-not-send="true">gunnar@hibernate.org</a>>
                      wrote:<br>
                      <br>
                      <blockquote class="gmail_quote" style="margin:0 0
                        0 .8ex;border-left:1px #ccc
                        solid;padding-left:1ex">
                           * Annotation semantics: I couldn't find any
                        example of records with<br>
                        annotations, but IIUC, something like<br>
                        <br>
                                 @Entity record Book(@Id long id, String
                        isbn) { ... }<br>
                        <br>
                             would desugar into<br>
                        <br>
                                 class @Entity public class Book {
                        private @Id long id, private<br>
                        String isbn; ... };<br>
                        <br>
                             For the JPA entity use case it'd be helpful
                        to have an option to lift<br>
                        annotations to the corresponding getters instead
                        of the fields (as the<br>
                        location of the @Id annotation controls the
                        default strategy -- field vs.<br>
                        property -- for reading/writing entity state).
                        Similarly, Bean Validation<br>
                        would benefit from such option.<br>
                        <br>
                      </blockquote>
                      My assumption has been that we would allow an
                      annotation on a record<br>
                      parameter as long as it has *any of
                      *{FIELD,METHOD,PARAMETER} as target,<br>
                      and that the annotation would be automatically
                      propagated to each<br>
                      synthesized element it applies to. Does this sound
                      about right to everyone?<br>
                      <br>
                      <span class="HOEnZb"><span data-mce-style="color:
                          #888888;" style="color: #888888;"
                          color="#888888">
                          <br>
                          --<br>
                          Kevin Bourrillion | Java Librarian | Google,
                          Inc. | <a href="mailto:kevinb@google.com"
                            target="_blank" moz-do-not-send="true">kevinb@google.com</a><br>
                        </span></span></blockquote>
                  </blockquote>
                  <br>
                </blockquote>
              </div>
              <br>
              <br clear="all">
              <br>
              -- <br>
              <div class="gmail_signature">
                <div dir="ltr">
                  <div>
                    <div dir="ltr">
                      <div>
                        <div dir="ltr">
                          <div
style="line-height:1.5em;padding-top:10px;margin-top:10px;color:rgb(85,85,85);font-family:sans-serif"><span
                              style="border-width:2px 0px
0px;border-style:solid;border-color:rgb(213,15,37);padding-top:2px;margin-top:2px">Kevin
                              Bourrillion |</span><span
                              style="border-width:2px 0px
0px;border-style:solid;border-color:rgb(51,105,232);padding-top:2px;margin-top:2px"> Java
                              Librarian |</span><span
                              style="border-width:2px 0px
0px;border-style:solid;border-color:rgb(0,153,57);padding-top:2px;margin-top:2px"> Google,
                              Inc. |</span><span style="border-width:2px
                              0px
0px;border-style:solid;border-color:rgb(238,178,17);padding-top:2px;margin-top:2px"> <a
                                href="mailto:kevinb@google.com"
                                target="_blank" moz-do-not-send="true">kevinb@google.com</a></span><br
                              data-mce-bogus="1">
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <br>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>