• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Source/Bytecode lines match... how come?

 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How is it possible for the JVM to indicate an error at a specific line in the compiled code when the source code has comments above it? I mean, if the source is compiled into bytecodes without the comments how would it be possible for a runtime error be generated and pointed to a line in the source?
 
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The compiled code contains the debugging tables where the debug info (such as line numbers and local variables) are kept (you can control it with the -g switch). The compiler contains a sophisticated parser, -- surely it knows how to count the line numbers and how to distinguish between the regular code and the comments.
 
reply
    Bookmark Topic Watch Topic
  • New Topic