jankotek / JDBM3

Embedded Key Value Java Database
367 stars 94 forks source link

Add MANY assertions #39

Closed jankotek closed 12 years ago

jankotek commented 12 years ago

JDBM currently have some assertions. This is not enough, we should be much more paranoid and have MUCH more assert statements. Each method should should verify all its arguments.

Java assert() is not good. JDBM tries to minimize jar file. Assert code and messages are always linked into class files.

Better is to have static final boolean field which would control assertions. If this field is off, javac outputs 'unreachable code warning' and removes assertion code. Something like:

if(CompileConfig.ASSERT && recid<0) throw new IllegalArgumentException("recid is negative: "+recid);

By default flag will be on. We always release two jar files, one with assertions included for debuging, second without assertions for production. Both releases will have to pass acceptance tests.

jankotek commented 12 years ago

Closing, not going to fix right now