FREE BURMA!

( ? , qUeStIoNMaRk )

Seeking for a sustainable amount of chaos. AKA an electronic stream of consciousness about software engineering, open source, life. By Marco Fabbri.

November 19, 2007

Mixed Feelings

Filed under: life, java, geek, programming

Somewhere in a Java source file

// content does not include the quotes or curly braces around the string!
private String content;
/**
* content includes the quotes or curly braces around the string!
*
* @param content
*/
BibtexString(BibtexFile file, String content) {
super(file);
this.content = content;
}

This code features a self-contradicting couple of comments: “does not include” / “includes” referred to the same object, what can be called a Schroendiger’s String; i.e. until you open the box… hmmm… take a look at the actual code, content is a marvelous data structure able to and not to include the quotes or curly braces around the string at the same time. A look at the actual code, a few lines below, leads to the death of this quantum string, revealing it does not contain the quotes or curly braces around the string.

// is this really a number?
try {
Integer.parseInt(content);
writer.print(content);
} catch (NumberFormatException nfe) {
writer.print('{');
writer.print(content);
writer.print('}');

Get free blog up and running in minutes with Blogsome | Theme designs available here