IntelliJ no longer finds .java source files inside .jar files--decompiler bug?

I am using the latest prd worthy IntelliJ release,14.0.1, community edition.

In project A, I have 3 modules, each of which I build a jar file for which contains BOTH the module's .class files, as well as the .java files that were used in compilation.  (For work internal to my firm, I like to stick everything into one .jar file, so that way there is never any ambiguity about what source produced the class files.)

Project B uses all 3 of those jars.  When in project B and I use ctrl-B on some usage of a class from project A, I want the actual source to be displayed.

This used to work, but recently I noticed that instead of getting the true source, what I get displayed is a decompilation of the .class file in the ,jar file.

Now, IntelliJ 14 added decompilation.  This is a Godsend when dealing with 3rd party .jar files which have no source.

But in my case, is that decompiler being used now by IntelliJ in all situations, even in cases when there is source available?

Or, is there some other config that I need to do when adding project A's .jar files that will cause the .java files inside them to be seen by IntellIJ when in project B?

Note: when in project B, I can go to the Project view's External Libraries, and inside each of project A's .jar files, when I examine the content of each one, I see double names.  These are surely the .class and .java files.  When I double click on either one, the actual .java file, not the decompiled one, is displayed.

Comment actions Permalink

Hmm, no has any feedback?  Darn.

Any IntelliJ developers monitoring this forum have any thought?

Comment actions Permalink

I think I have a partial solution to this probelm: for a completely unrelated reason, I had to rebuild this project (project B in my original post) from scratch.

After the project rebuild, I now see the proper source files from project A (i.e. IntelliJ now finds the .java files inside project A's .jar file).

I bet that not even a project rebuild would be required to solve this particular problem.  Instead, I think that if I just removed project A's jar file as a module dependency inside project B, and then added it back, that the source files inside would have been detected at that point by IntelliJ.  I say this because I now recall seeing behavior like this before with IntelliJ.

So, the basic problem seems to be that IntelliJ only scans your jar file for sources when it is first added as a dependency.

But IntelliJ fails to do such a scan when just a new version of the jar file is added?


Please sign in to leave a comment.