Pergunta

In IntelliJ with the ASM Bytecode plugin installed you can select "Show Bytecode outline" in the popup menu when viewing a class file. Recently my IntelliJ (Community Version 12.1.6) started displaying:

// couldn't generate bytecode view, no .class file found

in the ASM window.

This occurs on various class files across different modules in my project. The strange thing is that I will get this message for one class; but another class in the same module and package works fine.

The entire project compiles fine and all my tests run. I cannot figure out why I get this message for one class and not another.

Foi útil?

Solução 2

Per Andrey Breslav's comment, the correct resolution to this issue is to use the "Show Bytecode" command in the "View" menu. You must have the source file open for this command to be displayed. You must have compiled the source since the last change for the command to complete successfully.

Outras dicas

I have had the same problems after moving to IDEA 12 but my "positive hit rate" for being actually able to view the byte code outline became more stable again after upgrading to version 13. However, the result is still rather dissatisfying. From the logs, I learned that the plugin seems to not being able to find the referred class files even though they exist. It helps to make the project before trying to view the files, but this is not a perfect solution either. I guess, the problems will stay until someone sufficiently annoyed (maybe you?) upgrades the plugin.

What I use for now is simply javap from IntelliJ IDEA. You can add external tools by doing the following:

  1. Settings > External Tools > Add...
  2. Set the javap location for the called program: For example C:\Program Files\Java\jdk7\bin\javap.exe on Windows, depending of your installation path.
  3. Add -v -c $FileClass$ as the parameters (here you can of course set the parameters you actually require).
  4. Set $OutputPath$ as the working directory.

Now you can use javap from the right click menu on the source code view and you can also define a shortcut for the command.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top