Breakpoints set in an inner class don't stop. IntelliJ community 2016.2

Answered

I have been scratching my head for a few days on a problem of debugging my Java code in IntelliJ (community version 2016.2). I have a class with an inner class. For some reason, the breakpoints set within a method of the inner class don’t stop but the lines are executed (breakpoints set in a method of outer class are fine). The breakpoints are shown with an icon of orange color solid circle. I read JetBrain’s help page, and it says that icon stands for break point enabled but yet to be loaded into debugger. Does anyone know what possible reasons those break points may not get loaded into debugger after debugging session started? Below is the screenshot of debug session.

Breakpoints in inner class method CommandArtifact doInvoke() won't stop but one in outer class method doLoadValue() works.


 

 

 

7 comments
Comment actions Permalink

I'd like to add some details: I build it outside of IntelliJ. I'm doing remote application debugging.

0
Comment actions Permalink

Your screenshot indicates a misconfigured project. Java file doesn't belong to any of the source roots (red circle on the icon instead of the blue icon for a class: http://i.imgur.com/LFHEtRt.png). It means that the code running in the debugger may not correspond to the sources you have in a project.

Since it's a Gradle project, make sure the file is located under /src/main/java. See https://docs.gradle.org/current/userguide/java_plugin.html#N152C8 for the reference of the default Gradle roots.

0
Comment actions Permalink

> I'd like to add some details: I build it outside of IntelliJ. I'm doing remote application debugging.

Make sure you build with debug info enabled and classes loaded in the JVM are in sync with the sources you have in IDEA.

Also configure the roots correctly so that IDE recognizes Java sources.

0
Comment actions Permalink

Hi Serge, thanks for your quick reply. I verified that the class does get blue icon (with a lock in it though). See below (BApogeeEditor.class. Should the nested class file be shown in the tree too?):


 Also, I did javap -l on BApogeeEditor$Launch.class (Launch is the nested class in BApogeeEditor, the outer class), and debug info is generated:

Also, you mentioned source files need to be in src\main\... for gradle project. My source file folder structure doesn't have main in it. But class file structure does have main in it. I assume this should be Ok. But I don't know... 

Any idea?

0
Comment actions Permalink

Sorry, I looked wrong the icon. It's the icon having red circle with J in it for my class source file. JetBrains icon info page says it means "Java class located out of the source root. Refer to the section Configuring Content Roots for details.". I'll work on that. Thanks

0
Comment actions Permalink

I followed the JetBrains add content root instruction to add it for my project but it tells me I have had it already!? See below:

I lost.

 

0
Comment actions Permalink

In case your sources layout is not the default for Gradle, you have to instruct Gradle to use your custom sources location and reimport the project in IDEA.

https://docs.gradle.org/current/userguide/java_plugin.html#sec%3asource_sets

You should not modify the sources manually in IDE settings when the project is Gradle or Maven based since your changes will be lost on the next reimport. The problem you have is not with the content roots, it's with the source roots under the defined content roots.

0

Please sign in to leave a comment.