Full debugging information not included in compiled classes with new Milestone-9 compiler


(Joel Robotham) #1

Hi guys,

Attempting to upgrade to milestone-9 and discovered a bunch of our integration tests failing. After a bit of hunting around, I discovered the problem is that the new non-ant Javac compiler is not including variable name debugging in the generated classes. Frameworks like Spring tend to use this to do some of their nifty wiring (which was the cause of the failure)

I’ve changed our build script to get around it with something like:

compileJava.options.debugOptions.debugLevel = "source,lines,vars"
compileTestJava.options.debugOptions.debugLevel = "source,lines,vars"

Justing wondering: a) was this change intentional? b) if so, would definately be worth adding it to the milestone-9 breaking changes.

Thanks for the awesome work! Joel


(René Groeschke) #2

Hello Joel, thanks for your efforts to pointing out that problem. I think this change wasn’t intentional. I would like to reproduce your problem. Can provide a tiny sample project to reproduce this problem.


(Joel Robotham) #3

Hi Rene,

I’ve created a small sample, using javap to print out the class file information:

git://github.com/joelrobotham/gradle9-no-debugging.git

Cheers, Joel


(Peter Niederwieser) #4

Both the Ant javac task and the javac command-line compiler use the same defaults as the new Gradle Java compiler integration - they will generate debug info for sources and lines, but not for vars. Also I can’t find any indication that our old Ant-based compiler integration (which is still available by setting ‘options.useAnt=true’) ever generated debug info for vars by default. Therefore I don’t yet understand why some people started to get problems with m9. Any pointers are appreciated.


(Joel Robotham) #5

If I compile from the command line using javac without specifying any debugging parameters, as suggested, you get source and lines, but not variables.

When I show the debug info when using the ant compiler through gradle, it explicitly passes in a -g which causes all source, lines and vars to be included. (without specifying anything in the build script)

For the new gradle compiler integration, there’s no compiler arguments relating to debugging info unless you explicitly provided them in the build script. (hence we only get source and lines)


(Jerry Cattell) #6

I downgraded back to milestone 8 when I noticed I could no longer access debug info in IntelliJ, and I didn’t have time to look into it further.

My preference would be for it to work the way it previously did, even if one can explicitly configure the project to add the debug info like Joel pointed out above.


(Peter Niederwieser) #7

Thanks for figuring this out. It’s true that Gradle’s old compiler integration generates full debug information by default (like Maven but unlike Ant and javac). I think we should do the same for the new compiler integration. I’ve created GRADLE-2197 to track this issue.