<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Hi Jan,<div><br></div><div>Thanks for a quick response.</div><div><br></div><div>I am afraid I am not knowledgeable enough to tell how it might be implemented but the common pattern in annotation processors is to generate non-existing classes that are already used in the source code, ex:</div><div><br></div><div>@Immutable.Value</div><div>Interface MyImmutable extends WithMyImmutable { //WithMyImmutable is generated by annotation processor</div><div>}</div><div><br></div><div>I understand the difference is that in this case annotation processor doesn’t actually need to get the extended interface name but assumes the programmer follows a certain naming convention.</div><div><br></div><div>In my case I could extend the module annotation with an attribute containing some metadata used to generate classes. But that would require specifying them twice: in the annotation and in the actual provides directive.</div><div><br></div><div>From what I understand it is not easy to achieve without major API change. Will need to find a workaround then :)</div><div><br></div><div>Thanks,</div><div>Michal</div><div><div><br><blockquote type="cite"><div>On 1 Dec 2022, at 16:45, Jan Lahoda <jan.lahoda@oracle.com> wrote:</div><br class="Apple-interchange-newline"><div>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  
  <div><p>Hi Michal,</p><p><br>
    </p><p>The provides directive returns TypeElement as the service and a
      list of TypeElements as the implementations, and I don't think we
      can reasonably model non-existing types as TypeElements (normally
      missing types are modeled as erroneous TypeMirrors, I believe).
      So, having the non-existent implementation listed in the directive
      is probably difficult. Currently, when there are no
      implementations, the directive is skipped altogether - it might be
      possible to change that, although I am not sure if that would be
      helpful (as the non-existent type would not be in the directive
      anyway).</p><p><br>
    </p><p>Overall, I wonder how exactly is this meant to work. Using the
      (javac-specific) AST, one could get the (qualified) name that
      refers to the type that does not exist, but that may be a simple
      name, and depend on an import, so the correct FQN must be
      inferable somehow?<br>
    </p><p><br>
    </p><p>Thanks,<br>
    </p><p>Jan</p><p><br>
    </p>
    <div class="moz-cite-prefix">On 01. 12. 22 9:24, Michał Kłeczek
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:C70E4304-755D-47AE-9459-1492863D2ADD@kleczek.org">
      
      <span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px;">Hi,</span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px;">
      <br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px;">
      <span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px;">I am implementing
        an annotation processor that (among other things) is supposed to
        generate service provider classes that delegate calls to beans
        from a Spring application context.</span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px;">
      <br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px;">
      <span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px;">The idea is to
        mark a module in module-info with an annotation and add
        “provides Service with Implementation” where Implementation is
        not existent (yet).</span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px;">
      <span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px;">Unfortunately it
        seems ModuleElement.getDirectives() does not return such a
        provides directive.</span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px;">
      <br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px;">
      <span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px;">Is it a bug or I
        am missing something?</span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px;">
      <br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px;">
      <span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px;">Thanks,</span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px;">
      <span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 13px;">Michal</span>
    </blockquote>
  </div>

</div></blockquote></div><br></div></body></html>