Re: How to support for Annotations in Semantic function tags in java

Andreas Marschke <[email protected]> Thu, 5 Jul 2018 04:31:03 +0200
Newsgroups gmane.emacs.semantic
Message-ID <CADq4APsx5C-cZw7Krg98R5JjsVuq7iaofVm5=nMwwtgNvhzysQ@mail.gmail.com>
--===============1285004140225858517==
Content-Type: multipart/alternative; boundary="0000000000005c3eb50570375710"

--0000000000005c3eb50570375710
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi Eric!

Thanks for the recommendation. I have looked at wisent/bison & bovine under
semantic and the tags code.

If my understanding is correct, it is best to MR anything against the emacs
repository, correct?

IIUIC 'CONTRIBUTING' does not address lisp changes explicitly but it
appears most development changes are supposed to be sent to emacs-devel
mailing list. Correct?
Was there any notes on how to best present them? Is referring to a branch
on github/gitlab and commit-id in the repository? Or attaching a patch
generated from that?

I will also most likely have questions around wisent and how to write the
changes properly, those questions should also go to emacs-devel?

How is semantic/cedet being tested? Purely by using it in Emacs? Would it
be beneficial to introduce unittests based in some form testing semantic
against files and tags at points?

Thanks again,

Andreas Marschke.



On Sun, 1 Jul 2018 at 04:37, Eric Ludlam <[email protected]> wrote:

> Hi Andreas,
>
> It is certainly possible to make the CEDET/Semantic infrastructure do
> what you are asking, but several pieces are missing.
>
> I don't believe that annotations are supported by the parser.  I don't
> know enough about annotations or Java to be sure, but a short test on my
> part indicates it isn't part of the method tag.  Someone will need to
> update semantic/wisent/java-tags.wy  (and probably java.wy which is a
> parallel full language parser) to add annotations.
>
> Once it is part of the parser, adding a keybinding, probably in the ede
> java support to run the test would probably be pretty easy as long as
> there is an EDE wrapper around whichever build system you are using.  If
> there isn't a build system, you can probably create an EDE wrapper based
> on the existing java flavors like ede/maven2.el or the like.
>
> There is existing android ede support in the CEDET version on
> sourceforge which I don't think made it into emacs proper.  I've had a
> hard time keeping up with it as Android dev has moved forward faster
> than my occasional android development.  That ede wrapper has a few
> custom key bindings for build / upload that might make a reasonable
> model for what you want to do.
>
> If possible, I would recommend you do your development against the Emacs
> build.  The version in cedet/git has gotten stale since the eieio update
> in Emacs and I have no way to promote changes to there anymore.
>
> Thanks
> Eric
>
> On 06/29/2018 09:02 AM, Andreas Marschke wrote:
> > 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 somethin=
g
> > 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 i=
s
> in.
> >
> > Any suggestions tips or pointers would be appreciated.
> >
> > Kind regards,
> >
> > Andreas Marschke.
> >
> >
> >
> -------------------------------------------------------------------------=
-----
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> >
> >
> >
> > _______________________________________________
> > cedet-semantic mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/cedet-semantic
> >
>


--=20
Mit freundlichen Gr=C3=BC=C3=9Fen,

Andreas Marschke.
_________________________________________________________
Web: http://www.andreas-marschke.name
Blog: http://andreasmarschke.wordpress.com
Github: http://github.com/andreas-marschke

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

<div dir=3D"ltr">Hi Eric!<div><br></div><div>Thanks for the recommendation.=
 I have looked at wisent/bison &amp; bovine under semantic and the tags cod=
e.</div><div><br></div><div>If my understanding is correct, it is best to M=
R anything against the emacs repository, correct?</div><div><br></div><div>=
IIUIC &#39;CONTRIBUTING&#39; does not address lisp changes explicitly but i=
t appears most development changes are supposed to be sent to emacs-devel m=
ailing list. Correct?</div><div>Was there any notes on how to best present =
them? Is referring to a branch on github/gitlab and commit-id in the reposi=
tory? Or attaching a patch generated from that?</div><div><br></div><div>I =
will also most likely have questions around wisent and how to write the cha=
nges properly, those questions should also go to emacs-devel?</div><div><br=
></div><div>How is semantic/cedet being tested? Purely by using it in Emacs=
? Would it be beneficial to introduce unittests based in some form testing =
semantic against files and tags at points?</div><div><br></div><div>Thanks =
again,</div><div><br></div><div>Andreas Marschke.</div><div><br></div><div>=
<br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Sun, 1 J=
ul 2018 at 04:37, Eric Ludlam &lt;<a href=3D"mailto:[email protected]">=
[email protected]</a>&gt; wrote:<br></div><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex=
">Hi Andreas,<br>
<br>
It is certainly possible to make the CEDET/Semantic infrastructure do <br>
what you are asking, but several pieces are missing.<br>
<br>
I don&#39;t believe that annotations are supported by the parser.=C2=A0 I d=
on&#39;t <br>
know enough about annotations or Java to be sure, but a short test on my <b=
r>
part indicates it isn&#39;t part of the method tag.=C2=A0 Someone will need=
 to <br>
update semantic/wisent/java-tags.wy=C2=A0 (and probably java.wy which is a =
<br>
parallel full language parser) to add annotations.<br>
<br>
Once it is part of the parser, adding a keybinding, probably in the ede <br=
>
java support to run the test would probably be pretty easy as long as <br>
there is an EDE wrapper around whichever build system you are using.=C2=A0 =
If <br>
there isn&#39;t a build system, you can probably create an EDE wrapper base=
d <br>
on the existing java flavors like ede/maven2.el or the like.<br>
<br>
There is existing android ede support in the CEDET version on <br>
sourceforge which I don&#39;t think made it into emacs proper.=C2=A0 I&#39;=
ve had a <br>
hard time keeping up with it as Android dev has moved forward faster <br>
than my occasional android development.=C2=A0 That ede wrapper has a few <b=
r>
custom key bindings for build / upload that might make a reasonable <br>
model for what you want to do.<br>
<br>
If possible, I would recommend you do your development against the Emacs <b=
r>
build.=C2=A0 The version in cedet/git has gotten stale since the eieio upda=
te <br>
in Emacs and I have no way to promote changes to there anymore.<br>
<br>
Thanks<br>
Eric<br>
<br>
On 06/29/2018 09:02 AM, Andreas Marschke wrote:<br>
&gt; Hi everyone!<br>
&gt; <br>
&gt; I&#39;m looking for a way to find java annotations on methods/classes =
and <br>
&gt; detect them as attribute on methods found in a file.<br>
&gt; So for example, in a class like this:<br>
&gt; <br>
&gt; package com.example.app;<br>
&gt; <br>
&gt; public class Example<br>
&gt; {<br>
&gt;=C2=A0 =C2=A0 public Example() { /* ... */ }<br>
&gt;=C2=A0 =C2=A0=C2=A0@Test<br>
&gt;=C2=A0 =C2=A0 =C2=A0public void exampleTest() { /* ... */ }<br>
&gt; <br>
&gt;=C2=A0 =C2=A0=C2=A0@SuppressWarnings(&quot;static-access&quot;)<br>
&gt;=C2=A0 =C2=A0 public void exampleMethod() { /* ... */ }<br>
&gt; }<br>
&gt; <br>
&gt; In=C2=A0 a class like the above, I&#39;d love to have the ability to d=
o something <br>
&gt; like:<br>
&gt;=C2=A0 =C2=A0(semantic-tags-java-get-annotations (semantic-current-tag)=
)<br>
&gt;=C2=A0 =C2=A0 =C2=A0;; (&quot;Test&quot;), for `exampleTest()&#39;<br>
&gt;=C2=A0 =C2=A0(semantic-tags-java-get-annotations (semantic-current-tag)=
)<br>
&gt;=C2=A0 =C2=A0 =C2=A0;; (&quot;SuppressWarnings&quot; . &quot;static-acc=
ess&quot;), for `exampleMethod()&#39;<br>
&gt; <br>
&gt; Is something like this possible with semantic? Is there another <br>
&gt; tool/library that I could use to get at the annotations?<br>
&gt; <br>
&gt; The goal is to do something akin to the way Android Studio for example=
 <br>
&gt; can kick off a test with only a single test selected. I know the <br>
&gt; commandline param to do it but would like to automate it down to a key=
 <br>
&gt; chord that would execute the test based on the test method my pointer =
is in.<br>
&gt; <br>
&gt; Any suggestions tips or pointers would be appreciated.<br>
&gt; <br>
&gt; Kind regards,<br>
&gt; <br>
&gt; Andreas Marschke.<br>
&gt; <br>
&gt; <br>
&gt; ----------------------------------------------------------------------=
--------<br>
&gt; Check out the vibrant tech community on one of the world&#39;s most<br=
>
&gt; engaging tech sites, Slashdot.org! <a href=3D"http://sdm.link/slashdot=
" rel=3D"noreferrer" target=3D"_blank">http://sdm.link/slashdot</a><br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; _______________________________________________<br>
&gt; cedet-semantic mailing list<br>
&gt; <a href=3D"mailto:[email protected]" target=3D"_bla=
nk">[email protected]</a><br>
&gt; <a href=3D"https://lists.sourceforge.net/lists/listinfo/cedet-semantic=
" rel=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/=
listinfo/cedet-semantic</a><br>
&gt; <br>
</blockquote></div><br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr"=
 class=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div dir=3D"l=
tr"><div><div dir=3D"ltr">Mit freundlichen Gr=C3=BC=C3=9Fen,<div><br></div>=
<div>Andreas Marschke.</div><div>__________________________________________=
_______________</div><div><font size=3D"1">Web: <a href=3D"http://www.andre=
as-marschke.name" target=3D"_blank">http://www.andreas-marschke.name</a></f=
ont></div><div><font size=3D"1">Blog: <a href=3D"http://andreasmarschke.wor=
dpress.com" target=3D"_blank">http://andreasmarschke.wordpress.com</a></fon=
t></div><div><font size=3D"1">Github: <a href=3D"http://github.com/andreas-=
marschke" target=3D"_blank">http://github.com/andreas-marschke</a></font></=
div></div></div></div></div>

--0000000000005c3eb50570375710--


--===============1285004140225858517==
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
--===============1285004140225858517==
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

--===============1285004140225858517==--