Re: Trouble with Java completion

David Ventimiglia <[email protected]> Mon, 29 Aug 2016 19:11:34 -0700
Newsgroups gmane.emacs.semantic
Message-ID <CALaE=t8G7gUa0dhiVdOEah6TFM4Xi3ZnQD+LKmR8AHD1DcKV3g@mail.gmail.com>
--===============1712147454174147991==
Content-Type: multipart/alternative; boundary=001a113e243c2ec184053b4081bb

--001a113e243c2ec184053b4081bb
Content-Type: text/plain; charset=UTF-8

Hi Edward,

Thanks so much for replying.  Here's what I can tell you.

   1. I'm using CEDET from the Git repository
   http://git.code.sf.net/p/cedet/git and it's up-to-date.
   2. It's the very first thing I load in my init file, so as to avoid
   using the built-in CEDET.
   3. CEDET version is 2.0.  Full (cedet-version) output is below.
   4. I've always had global-semantic-decoration-mode enabled and all my
   imports have always been green "Fileless."  Full output is below.
   5. I didn't originally have an EDE project-root (is that necessary).  I
   only had the HelloWorld.java file in /home/dventimi/Scratch
   6. I have however always had (require 'semantic/db-javap) at the top of
   my init file.
   7. I added a project-root with this line in my init file:
    (ede-java-root-project "Scratch" :file
   "/home/dventimi/Scratch/HelloWorld.java").  I know the project root doesn't
   typically "hang off" the file I'm trying to compile, but there's no choice
   since I have no other files in the Scratch directory.
   8. Even with this addition, I get precisely the same behavior.  The key
   is that it seems to identify the import statements as "Fileless."  In my
   experience (I've had completion working in the past, though long ago under
   different circumstances on a different computer) "green is good" and that's
   the ideal state for importing tags from JAR files via javap.  And yet, the
   tags table it builds this time has 0 tags.

I'm happy to start drilling in with the debugger, but at present I don't
even know where to begin.  Anyway, thanks!

Best,
David

(cedet-version)
->
CEDET Version: 2.0
  Requested File Loaded
  Package Version Version Version
  ----------------------------------------------------------
  cedet: 2.0 ok ok
  eieio: 1.4 nil ok
  semantic: 2.2 ok ok
  srecode: 1.2 ok ok
  ede: 1.2 2.0 2.0
  cogre: 1.2 ok ok
  cedet-contrib: 1.2 nil Not Loaded


"What's this?"
->
Include Tag: java.util.Map

This header tag has been marked "Fileless".
This means that Semantic cannot find a file associated with this tag
on disk, but a database table of tags has been associated with it.

This means that the include will still be used to find tags for
searches, but you cannot visit this include.

This Header is now represented by the following database table:

  #<semanticdb-table-jar-file java/util/Map.class (0 tags)>



On Mon, Aug 29, 2016 at 1:26 PM, Edward John Steere <[email protected]
> wrote:

>
> Hi David,
>
> You're right, db-javap does deal with this :)  I could only replicate
> your problem with db-javap turned off (i.e. not `require'd).  Once I
> `require'd it it complained that generic projects don't have a
> :classpath slot (which is of course true.)  Once I created a `java-root'
> project, and dumped your code in it, it worked fine and gave me the
> following options:
>
>     clear        compute
>     computeIfAbsent computeIfPresent
>     containsKey  containsValue entrySet
>     equals       forEach      get
>     getOrDefault hashCode     isEmpty
>     keySet       merge        put
>     putAll       putIfAbsent  remove
>     replace      replaceAll   size
>     values
>
> Are you using upstream or built in CEDET?
>
> You can also turn on `global-semantic-decoration-mode' and your imports
> will be decorated to indicate whether they have been:
>
>  - Parsed (no highlighting)
>  - Still need to be parsed (highlighted yellow on my machine)
>  - None-file imports -- such as an import from a jar file (highlighted
>    green on my machine)
>  - Unrecognised imports (highlighted red on my machine)
>  - (Your function tags will also be decorated in the buffer)
>
> This ought to give you a good idea of whether cedet has figured out your
> project setup.
>
> To answer 1. and 2. I'm not familiar with the global versus local type
> cache, but with any luck you wont have to be either :)
>
> Kind regards,
>
> Edward Steere
>
> > Hi!
> >
> > I'm having trouble with the Semantic Analyzer and Analyzer Debugging
> > for Java programs. I've a simple "Hello, World!" Java file that looks
> > like this:
> >
> >     import java.util.Map;
> >
> >     import java.util.HashMap;
> >
> >
> >
> >
> >     public class HelloWorld {
> >
> >     public static void main (String[] args) {
> >
> >     Map m = new HashMap();
> >
> >     m.
> >
> >     }
> >
> >     }
> >
> > When I try M-x semantic-ia-complete-symbol after the "m.", I get the
> > message "Cannot find types for `Map m'," I get the output in the
> > attached debug.txt file. I'm trying to interpret this output, and a
> > couple questions come to mind.
> >
> > 1 Should I expect the type to be a local type or a global type?
> > 2 What's the difference between a local type and a global type?
> > 3 Shouldn't semantic/db-javap just handle this?
> >
> > The typecache (also attached) seems to have all the java.lang types,
> > which semantic/db-javap presumably fished out of my Java
> > installation's rt.jar file. If that's the case, shouldn't it also have
> > fished out java.util.Map?
> >
> > Thanks!
> > Best,
> > David
> >
> >
> >
> >
> > ------------------------------------------------------------
> ------------------
> > _______________________________________________
> > cedet-semantic mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/cedet-semantic
>

--001a113e243c2ec184053b4081bb
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi Edward,<div><br></div><div>Thanks so much for replying.=
=C2=A0 Here&#39;s what I can tell you.</div><div><ol><li>I&#39;m using CEDE=
T from the Git repository=C2=A0<a href=3D"http://git.code.sf.net/p/cedet/gi=
t">http://git.code.sf.net/p/cedet/git</a> and it&#39;s up-to-date.</li><li>=
It&#39;s the very first thing I load in my init file, so as to avoid using =
the built-in CEDET.</li><li>CEDET version is 2.0.=C2=A0 Full (cedet-version=
) output is below.</li><li>I&#39;ve always had=C2=A0<span style=3D"font-siz=
e:12.8px">global-semantic-decoration-</span><wbr style=3D"font-size:12.8px"=
><span style=3D"font-size:12.8px">mode enabled and all my imports have alwa=
ys been green &quot;Fileless.&quot; =C2=A0Full output is below.</span></li>=
<li><span style=3D"font-size:12.8px">I didn&#39;t originally have an EDE pr=
oject-root (is that necessary).=C2=A0 I only had the HelloWorld.java file i=
n /home/dventimi/Scratch</span></li><li><span style=3D"font-size:12.8px">I =
have however always had (require &#39;semantic/db-javap) at the top of my i=
nit file.</span></li><li><span style=3D"font-size:12.8px">I added a project=
-root with this line in my init file: =C2=A0(ede-java-root-project &quot;Sc=
ratch&quot; :file &quot;/home/dventimi/Scratch/HelloWorld.java&quot;).=C2=
=A0 I know the project root doesn&#39;t typically &quot;hang off&quot; the =
file I&#39;m trying to compile, but there&#39;s no choice since I have no o=
ther files in the Scratch directory.</span></li><li><span style=3D"font-siz=
e:12.8px">Even with this addition, I get precisely the same behavior.=C2=A0=
 The key is that it seems to identify the import statements as &quot;Filele=
ss.&quot; =C2=A0In my experience (I&#39;ve had completion working in the pa=
st, though long ago under different circumstances on a different computer) =
&quot;green is good&quot; and that&#39;s the ideal state for importing tags=
 from JAR files via javap.=C2=A0 And yet, the tags table it builds this tim=
e has 0 tags. =C2=A0</span></li></ol><div><span style=3D"font-size:12.8px">=
I&#39;m happy to start drilling in with the debugger, but at present I don&=
#39;t even know where to begin.=C2=A0 Anyway, thanks!</span></div></div><di=
v><span style=3D"font-size:12.8px"><br></span></div><div><span style=3D"fon=
t-size:12.8px">Best,</span></div><div><span style=3D"font-size:12.8px">Davi=
d</span></div><div><span style=3D"font-size:12.8px"><br></span></div><div><=
span style=3D"font-size:12.8px">(cedet-version)</span></div><div><span styl=
e=3D"font-size:12.8px">-&gt;</span></div><div><div style=3D""><span style=
=3D"font-size:12.8px">CEDET Version:<span class=3D"" style=3D"white-space:p=
re">	</span>2.0</span></div><div style=3D""><span style=3D"font-size:12.8px=
">=C2=A0 <span class=3D"" style=3D"white-space:pre">			</span>Requested<spa=
n class=3D"" style=3D"white-space:pre">	</span>File<span class=3D"" style=
=3D"white-space:pre">		</span>Loaded</span></div><div style=3D""><span styl=
e=3D"font-size:12.8px">=C2=A0 Package<span class=3D"" style=3D"white-space:=
pre">		</span>Version<span class=3D"" style=3D"white-space:pre">		</span>Ve=
rsion<span class=3D"" style=3D"white-space:pre">		</span>Version</span></di=
v><div style=3D""><span style=3D"font-size:12.8px">=C2=A0 -----------------=
-----------------------------------------</span></div><div style=3D""><span=
 style=3D"font-size:12.8px">=C2=A0 cedet:<span class=3D"" style=3D"white-sp=
ace:pre">		</span>2.0<span class=3D"" style=3D"white-space:pre">		</span>ok=
<span class=3D"" style=3D"white-space:pre">		</span>ok</span></div><div sty=
le=3D""><span style=3D"font-size:12.8px">=C2=A0 eieio:<span class=3D"" styl=
e=3D"white-space:pre">		</span>1.4<span class=3D"" style=3D"white-space:pre=
">		</span>nil<span class=3D"" style=3D"white-space:pre">		</span>ok</span>=
</div><div style=3D""><span style=3D"font-size:12.8px">=C2=A0 semantic:<spa=
n class=3D"" style=3D"white-space:pre">		</span>2.2<span class=3D"" style=
=3D"white-space:pre">		</span>ok<span class=3D"" style=3D"white-space:pre">=
		</span>ok</span></div><div style=3D""><span style=3D"font-size:12.8px">=
=C2=A0 srecode:<span class=3D"" style=3D"white-space:pre">		</span>1.2<span=
 class=3D"" style=3D"white-space:pre">		</span>ok<span class=3D"" style=3D"=
white-space:pre">		</span>ok</span></div><div style=3D""><span style=3D"fon=
t-size:12.8px">=C2=A0 ede:<span class=3D"" style=3D"white-space:pre">			</s=
pan>1.2<span class=3D"" style=3D"white-space:pre">		</span>2.0<span class=
=3D"" style=3D"white-space:pre">		</span>2.0</span></div><div style=3D""><s=
pan style=3D"font-size:12.8px">=C2=A0 cogre:<span class=3D"" style=3D"white=
-space:pre">		</span>1.2<span class=3D"" style=3D"white-space:pre">		</span=
>ok<span class=3D"" style=3D"white-space:pre">		</span>ok</span></div><div =
style=3D""><span style=3D"font-size:12.8px">=C2=A0 cedet-contrib:<span clas=
s=3D"" style=3D"white-space:pre">	</span>1.2<span class=3D"" style=3D"white=
-space:pre">		</span>nil<span class=3D"" style=3D"white-space:pre">		</span=
>Not Loaded</span></div><div style=3D""><br></div></div><div style=3D""><br=
></div><div style=3D"">&quot;What&#39;s this?&quot;</div><div style=3D"">-&=
gt;</div><div style=3D""><div>Include Tag: java.util.Map</div><div><br></di=
v><div>This header tag has been marked &quot;Fileless&quot;.</div><div>This=
 means that Semantic cannot find a file associated with this tag</div><div>=
on disk, but a database table of tags has been associated with it.</div><di=
v><br></div><div>This means that the include will still be used to find tag=
s for</div><div>searches, but you cannot visit this include.</div><div><br>=
</div><div>This Header is now represented by the following database table:<=
/div><div><br></div><div>=C2=A0 #&lt;semanticdb-table-jar-file java/util/Ma=
p.class (0 tags)&gt;</div><div><br></div></div><div><span style=3D"font-siz=
e:12.8px"><br></span></div></div><div class=3D"gmail_extra"><br><div class=
=3D"gmail_quote">On Mon, Aug 29, 2016 at 1:26 PM, Edward John Steere <span =
dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_blank=
">[email protected]</a>&gt;</span> wrote:<br><blockquote class=3D"gma=
il_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-lef=
t:1ex"><br>
Hi David,<br>
<br>
You&#39;re right, db-javap does deal with this :)=C2=A0 I could only replic=
ate<br>
your problem with db-javap turned off (i.e. not `require&#39;d).=C2=A0 Once=
 I<br>
`require&#39;d it it complained that generic projects don&#39;t have a<br>
:classpath slot (which is of course true.)=C2=A0 Once I created a `java-roo=
t&#39;<br>
project, and dumped your code in it, it worked fine and gave me the<br>
following options:<br>
<br>
=C2=A0 =C2=A0 clear=C2=A0 =C2=A0 =C2=A0 =C2=A0 compute<br>
=C2=A0 =C2=A0 computeIfAbsent computeIfPresent<br>
=C2=A0 =C2=A0 containsKey=C2=A0 containsValue entrySet<br>
=C2=A0 =C2=A0 equals=C2=A0 =C2=A0 =C2=A0 =C2=A0forEach=C2=A0 =C2=A0 =C2=A0 =
get<br>
=C2=A0 =C2=A0 getOrDefault hashCode=C2=A0 =C2=A0 =C2=A0isEmpty<br>
=C2=A0 =C2=A0 keySet=C2=A0 =C2=A0 =C2=A0 =C2=A0merge=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 put<br>
=C2=A0 =C2=A0 putAll=C2=A0 =C2=A0 =C2=A0 =C2=A0putIfAbsent=C2=A0 remove<br>
=C2=A0 =C2=A0 replace=C2=A0 =C2=A0 =C2=A0 replaceAll=C2=A0 =C2=A0size<br>
=C2=A0 =C2=A0 values<br>
<br>
Are you using upstream or built in CEDET?<br>
<br>
You can also turn on `global-semantic-decoration-<wbr>mode&#39; and your im=
ports<br>
will be decorated to indicate whether they have been:<br>
<br>
=C2=A0- Parsed (no highlighting)<br>
=C2=A0- Still need to be parsed (highlighted yellow on my machine)<br>
=C2=A0- None-file imports -- such as an import from a jar file (highlighted=
<br>
=C2=A0 =C2=A0green on my machine)<br>
=C2=A0- Unrecognised imports (highlighted red on my machine)<br>
=C2=A0- (Your function tags will also be decorated in the buffer)<br>
<br>
This ought to give you a good idea of whether cedet has figured out your<br=
>
project setup.<br>
<br>
To answer 1. and 2. I&#39;m not familiar with the global versus local type<=
br>
cache, but with any luck you wont have to be either :)<br>
<br>
Kind regards,<br>
<br>
Edward Steere<br>
<span class=3D""><br>
&gt; Hi!<br>
&gt;<br>
&gt; I&#39;m having trouble with the Semantic Analyzer and Analyzer Debuggi=
ng<br>
&gt; for Java programs. I&#39;ve a simple &quot;Hello, World!&quot; Java fi=
le that looks<br>
&gt; like this:<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0import java.util.Map;<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0import java.util.HashMap;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0public class HelloWorld {<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0public static void main (String[] args) {<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0Map m =3D new HashMap();<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0m.<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0}<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0}<br>
&gt;<br>
&gt; When I try M-x semantic-ia-complete-symbol after the &quot;m.&quot;, I=
 get the<br>
&gt; message &quot;Cannot find types for `Map m&#39;,&quot; I get the outpu=
t in the<br>
&gt; attached debug.txt file. I&#39;m trying to interpret this output, and =
a<br>
&gt; couple questions come to mind.<br>
&gt;<br>
</span>&gt; 1 Should I expect the type to be a local type or a global type?=
<br>
&gt; 2 What&#39;s the difference between a local type and a global type?<br=
>
&gt; 3 Shouldn&#39;t semantic/db-javap just handle this?<br>
<span class=3D"">&gt;<br>
&gt; The typecache (also attached) seems to have all the java.lang types,<b=
r>
&gt; which semantic/db-javap presumably fished out of my Java<br>
&gt; installation&#39;s rt.jar file. If that&#39;s the case, shouldn&#39;t =
it also have<br>
&gt; fished out java.util.Map?<br>
&gt;<br>
&gt; Thanks!<br>
&gt; Best,<br>
&gt; David<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
</span>&gt; ------------------------------<wbr>----------------------------=
--<wbr>------------------<br>
&gt; ______________________________<wbr>_________________<br>
&gt; cedet-semantic mailing list<br>
&gt; <a href=3D"mailto:[email protected]">cedet-semantic=
@lists.<wbr>sourceforge.net</a><br>
&gt; <a href=3D"https://lists.sourceforge.net/lists/listinfo/cedet-semantic=
" rel=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/<wbr>l=
ists/listinfo/cedet-semantic</a><br>
</blockquote></div><br></div>

--001a113e243c2ec184053b4081bb--


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

------------------------------------------------------------------------------

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

--===============1712147454174147991==--