Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   unreachable code (http://www.velocityreviews.com/forums/t948284-unreachable-code.html)

bob smith 07-19-2012 09:50 PM

unreachable code
 
Is there an easy way to tell Java not to bug me about unreachable code?

Arne Vajh°j 07-19-2012 10:02 PM

Re: unreachable code
 
On 7/19/2012 5:50 PM, bob smith wrote:
> Is there an easy way to tell Java not to bug me about unreachable code?


Why not simply outcomment the unreachable code?

Arne



glen herrmannsfeldt 07-19-2012 10:04 PM

Re: unreachable code
 
bob smith <bob@coolfone.comze.com> wrote:
> Is there an easy way to tell Java not to bug me about unreachable code?


How unreachable is it?

As I understand it, the compiler is supposed to understand

if(false) { code }

and even

public static final boolean debug=false;

if(debug) code;

without complaint.

(That is, the Java replacement for C's

#if 0

#endif
)

-- glen

Daniel Pitts 07-19-2012 10:06 PM

Re: unreachable code
 
On 7/19/12 2:50 PM, bob smith wrote:
> Is there an easy way to tell Java not to bug me about unreachable code?
>

Yes, you have several easy ways:

1. Make the code reachable.
2. Delete the unreachable code.
3. Surround the code which *causes* the unreachability with if(true){}
4. Comment out the unreachable code.

All of those will tell Java not to bug you about an obvious bug in your
code.


Eric Sosman 07-19-2012 10:28 PM

Re: unreachable code
 
On 7/19/2012 5:50 PM, bob smith wrote:
> Is there an easy way to tell Java not to bug me about unreachable code?


"Delete it" comes to mind ...

Could you describe your situation in more detail? The
unreachable code will never be executed; why do you wish to
keep it around? I assume you've got some better reason than
"I admire the sheer beauty of useless clutter;" what is it?

--
Eric Sosman
esosman@ieee-dot-org.invalid

Roedy Green 07-19-2012 11:15 PM

Re: unreachable code
 
On Thu, 19 Jul 2012 14:50:58 -0700 (PDT), bob smith
<bob@coolfone.comze.com> wrote, quoted or indirectly quoted someone
who said :

>Is there an easy way to tell Java not to bug me about unreachable code?


Most IDES have a way to with a keystroke comment the code out. That
way it is easy to revive it later, but has no effect on the class
file.
--
Roedy Green Canadian Mind Products
http://mindprod.com
The greatest shortcoming of the human race is our inability to understand the exponential function.
~ Dr. Albert A. Bartlett (born: 1923-03-21 age: 89)
http://www.youtube.com/watch?v=F-QA2rkpBSY




All times are GMT. The time now is 07:54 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.