unreachable code

G

glen herrmannsfeldt

bob smith said:
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
 
D

Daniel Pitts

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.
 
E

Eric Sosman

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?
 
R

Roedy Green

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top