tags:

views:

91

answers:

4

Well, the title is self-explanatory. I wondered this while compiling a project which has a lot of lines commented. It's a bit silly because the jar file wouldn't increase much (some bytes) but I'm curious if this could affect a program with a lot of code and comments.

Thanks

+3  A: 

No, comments normally are stripped out in any language (not just in Java). They have no representative in byte code. What stays in there, is annotated stuff and such

Scoregraphic
Not all of them :-) In PHP you can actually reflect over the comments of a class or method. See http://www.php.net/manual/en/reflectionclass.getdoccomment.php.
Hannes de Jager
Well, PHP is an interpreted language. So your code is not compiled like in Java, C#, C++, ... If you use something like eAccelerator which stored the code in their compiled representative, you won't be able to use this functionality, as the comments got stripped out
Scoregraphic
+2  A: 

It would not affect the execution or performance (unless you have commented out the wrong statements :-)

But it definitely would affect readability. There is no reason to have large blocks of commented out code (in production), version control is the way to go

See this question also.

Nivas
Thanks all for the answers. I'm just doing some basic stuff without using subversion or anything, but when I use such tools I will remember your advice!
oli206
+1  A: 

No, documentation isn't included in the compiled class file.

The javadocs can be generated with the javadoc program. All javadoc will be converterd to HTML.

Salandur
+1  A: 

No, this is not added.

However, you should consider to kill dead code (i.e. commented code, but also unused code). If you think that "maybe I will need that method again", simply delete the method, and if you really need this method some day, use you SCM tool (Subversion, Git, CVS or whatever) to retrieve this old code...

romaintaz