Semantic Analyzer not completing symbols from JAR dragged in by Maven (Java)

[email protected] (David A. Ventimiglia) Mon, 24 Nov 2014 05:59:48 -0800
Newsgroups gmane.emacs.semantic
Message-ID <[email protected]>
Hi!

How do I debug the Semantic Analyzer not completing symbols (methods and
members) from classes that are in Java JAR files that are part of my
project by way of Maven dependencies?  I suppose variations of this
question pop up a lot.  Sorry.

In my case, I've a simple Java Servlet in a Maven style project with a single pom.xml file that lists the Java Servlet API as a dependency.  

    package com.neptunestation.cosmotron;
     
    import javax.servlet.http.*;
     
    public class CosmotronServlet extends HttpServlet {
        @Override public void doGet (HttpServletRequest req, HttpServletResponse res) {
            res.
    }

and point is right after the dot (.) dereference operator after the
symbol `res', which refers to the HttpServletResponse in the `doGet'
method signature.  When I invoke semantic-ia-complete-symbol-menu I get
the error

    semantic-analyze-possible-completions-default: Cannot find types for `"res"'

Reading the Info docs under "File: semantic-user.info,  Node: Smart Completion Debugging,  Prev: Speedbar Analysis,  Up: Analyzer" I see I need to try the function semanticdb-find-test-translate-path.  Doing that at point gives me

    *#<semanticdb-table-jar-directory java/lang (112 Classes, 0 Packages)>
    *#<semanticdb-table CosmotronServlet.java (3 tags)>
    *#<semanticdb-table-jar-directory javax/servlet/http/ (17 Classes, 0 Packages)>
       ] Name: "javax/servlet/http/"
       ] Class: #'semanticdb-table-jar-directory
       ] parent-db #<semanticdb-java-jar-database servlet-api-2.5.jar (1 tables) (42 Files)>
       ] :major-mode #'java-mode
       ] :tags #unbound
       ] db-refs #<list o' stuff: 1 entries>
         > #<semanticdb-table CosmotronServlet.java (3 tags)>
       ] index #unbound
       ] cache : nil
       ] :directory "javax/servlet/http/"
       ] filenamecache #<list o' stuff: 17 entries>
         > "Cookie.class"
         > "HttpServlet.class"
         > "HttpServletRequest.class"
         > "HttpServletRequestWrapper.class"
         > "HttpServletResponse.class"
         > "HttpServletResponseWrapper.class"
         > "HttpSession.class"
         > "HttpSessionActivationListener.class"
         > "HttpSessionAttributeListener.class"
         > "HttpSessionBindingEvent.class"
         > "HttpSessionBindingListener.class"
         > "HttpSessionContext.class"
         > "HttpSessionEvent.class"
         > "HttpSessionListener.class"
         > "HttpUtils.class"
         > "NoBodyOutputStream.class"
         > "NoBodyResponse.class"
       ] packagenamecache : nil
       ] filetaghash #(hash-table count 2 size 11 test equal)
         > key "HttpServlet.class"
         > val 'no-tags
         > key "HttpServletResponse.class"
         > val 'no-tags
       ] :proxy ':tag-proxy
    *#<semanticdb-table-java-directory cosmotron (0 tags)>

I've expanded out the database table for "javax/servlet/http", which seems to have "HttpServletRequest.class" in its filenamecache.  That tells me a couple of things.

* EDE seems to have figured out I've a Maven project based on the pom.xml file alone.  Great!

* Semanticdb seems to have figured out how to use dependencies in my pom.xml file to find related JAR files.  Great!

* Semantic Analyzer seems to have found the right table for the symbol at point, and that table is for the right JAR file.  Great!

* But, Semantic doesn't seem to understand what's in the JAR file.  Not Great!

The filenamecache is just a list of strings.  Maybe that's correct, but I expected somewhere to find a list of tags for the HttpServletRequest class itself, presumably by virtue of semantic/db-javap, which I've enabled in my init file.

What have I done wrong here?  I've a pretty recent CEDET having updated my bzr snapshot just the other day.  I've enabled semantic-mode and have required semantic/db-javp and have enabled global-ede-mode.  I haven't done anything special for EDE mode other than enabling it, though it seems to have figured out I've a Maven project anyway.  

In fac, here's what I get from cedet-version

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


C-h f cedet-version RET
  for details on output format.

Thanks!
Cheers,
David

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk