1

When spelunking through Java code, I rely heavily on the semantic integration through the use of helm-semantic-or-imenu to navigate to different functions in a file.

This works great for simple to moderately-complex Java files, however, some complex Java files show an empty semantic imenu. There are no errors in the log, only the customary:

Parsing NettyTransport.java (LALR)...done

And then the imenu is empty.

How can I diagnose and/or fix the semantic parsing for these Java files so they correctly show functions/vars/etc in the imenu?

For reference, a Java file that silently fails semantic parsing can be found here.

2

You can use M-x bovinate to see what the parser will dump. On the file you linked it's fairly obvious from the output that it gets stuck near the class definition. The offending token is AbstractLifecycleComponent<Transport>. You can test this yourself by deleting the "extends" portion of that class definition and trying again.

This is a problem with the parser used in wisent/java-tags.el in both the cedet included in recent versions of emacs, and in the cedet development version. There is an alternative parser that works fine with your example file, and basically everything I've ever thrown at it, included in the development version of cedet. Just make sure that the full parser is loaded in favour of the inaccurate but fast java-tags.el parser. You can do this by messing with cedet's autoloads using the following:

(autoload 'wisent-java-default-setup "semantic/wisent/java")
  • Is there a package available anywhere (MELPA?) with a development snapshot of CEDET? Or how can I use the development version of CEDET? Just clone the repo and add to the load-path? – Lee H Oct 3 '14 at 8:01
  • Also, I'm not sure where to make the autoload change, should I change the CEDET source to do that? Should it be in my personal configuration before I load semantic-mode? – Lee H Oct 3 '14 at 8:45
  • @LeeH, unfortunately, the nature of CEDET makes it difficult to use with package.el. The main reason for this is that it needs to be able to unload older built in versions of itself before a particular library is loaded (eieio), this lib happens to be a dep of package.el. As for the autoload, it should come after manually loading the cedet setup files. – krupped Oct 7 '14 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.