How to support for Annotations in Semantic function tags in java

Andreas Marschke <[email protected]> Fri, 29 Jun 2018 15:02:58 +0200
Newsgroups gmane.emacs.semantic
Message-ID <CADq4APuRsWvYALiQjKeKkd-4HVMJG8XMfz-V6Qfr1MnNYu+6XQ@mail.gmail.com>
--===============3708416339363675652==
Content-Type: multipart/alternative; boundary="00000000000039ff9e056fc77808"

--00000000000039ff9e056fc77808
Content-Type: text/plain; charset="UTF-8"

Hi everyone!

I'm looking for a way to find java annotations on methods/classes and
detect them as attribute on methods found in a file.
So for example, in a class like this:

package com.example.app;

public class Example
{
  public Example() { /* ... */ }

  @Test
   public void exampleTest() { /* ... */ }

  @SuppressWarnings("static-access")
  public void exampleMethod() { /* ... */ }
}

In  a class like the above, I'd love to have the ability to do something
like:
 (semantic-tags-java-get-annotations (semantic-current-tag))
   ;; ("Test"), for `exampleTest()'
 (semantic-tags-java-get-annotations (semantic-current-tag))
   ;; ("SuppressWarnings" . "static-access"), for `exampleMethod()'

Is something like this possible with semantic? Is there another
tool/library that I could use to get at the annotations?

The goal is to do something akin to the way Android Studio for example can
kick off a test with only a single test selected. I know the commandline
param to do it but would like to automate it down to a key chord that would
execute the test based on the test method my pointer is in.

Any suggestions tips or pointers would be appreciated.

Kind regards,

Andreas Marschke.

--00000000000039ff9e056fc77808
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi everyone!<div><br></div><div>I&#39;m looking for a way =
to find java annotations on methods/classes and detect them as attribute on=
 methods found in a file.</div><div>So for example, in a class like this:</=
div><div><br></div><div>package com.example.app;</div><div><br></div><div>p=
ublic class Example</div><div>{</div><div>=C2=A0 public Example() { /* ... =
*/ }</div><div>=C2=A0=C2=A0</div><div>=C2=A0=C2=A0@Test=C2=A0</div><div>=C2=
=A0 =C2=A0public void exampleTest() { /* ... */ }</div><div><br></div><div>=
=C2=A0=C2=A0@SuppressWarnings(&quot;static-access&quot;)</div><div>=C2=A0 p=
ublic void exampleMethod() { /* ... */ }</div><div>}<br clear=3D"all"><div>=
<br></div><div>In=C2=A0 a class like the above, I&#39;d love to have the ab=
ility to do something like:<br>=C2=A0(semantic-tags-java-get-annotations (s=
emantic-current-tag))=C2=A0</div><div>=C2=A0 =C2=A0;; (&quot;Test&quot;), f=
or `exampleTest()&#39;</div><div><div style=3D"background-color:rgb(255,255=
,255);text-decoration-style:initial;text-decoration-color:initial">=C2=A0(s=
emantic-tags-java-get-annotations (semantic-current-tag))=C2=A0</div><div s=
tyle=3D"background-color:rgb(255,255,255);text-decoration-style:initial;tex=
t-decoration-color:initial">=C2=A0 =C2=A0;; (&quot;SuppressWarnings&quot; .=
 &quot;static-access&quot;), for `exampleMethod()&#39;</div><div><br></div>=
Is something like this possible with semantic? Is there another tool/librar=
y that I could use to get at the annotations?</div><div><br></div><div>The =
goal is to do something akin to the way Android Studio for example can kick=
 off a test with only a single test selected. I know the commandline param =
to do it but would like to automate it down to a key chord that would execu=
te the test based on the test method my pointer is in.</div><div><br></div>=
<div>Any suggestions tips or pointers would be appreciated.</div><div><br><=
/div><div>Kind regards,</div><div><br></div><div>Andreas Marschke.<br></div=
></div></div>

--00000000000039ff9e056fc77808--


--===============3708416339363675652==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
--===============3708416339363675652==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
cedet-semantic mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cedet-semantic

--===============3708416339363675652==--