Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why do I see “Unknown Source” in the stack trace of a test failure, rather than the source files line number?

0
Posted

Why do I see “Unknown Source” in the stack trace of a test failure, rather than the source files line number?

0

The debug option for the Java compiler must be enabled in order to see source file and line number information in a stack trace. When invoking the Java compiler from the command line, use the -g option to generate all debugging info. When invoking the Java compiler from an Ant task, use the debug=”on” attribute. For example: When using older JVMs pre-Hotspot (JDK 1.1 and most/all 1.2), run JUnit with the -DJAVA_COMPILER=none JMV command line argument to prevent runtime JIT compilation from obscuring line number info. Compiling the test source with debug enabled will show the line where the assertion failed. Compiling the non-test source with debug enabled will show the line where an exception was raised in the class under test.

0

The debug option for the Java compiler must be enabled in order to see source file and line number information in a stack trace.When invoking the Java compiler from the command line, use the -g option to generate all debugging info.When invoking the Java compiler from an Ant task, use the debug=”on” attribute.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123