"Boehm, Hans" wrote:
>
> > This is in the SUN Assertion JSR.
> > http://java.sun.com/aboutJava/communityprocess/jsr/asrt_prop.html
> >
> > ... The documentation is public but we certainly can not
> > participate in its
> > development because of SUNs *stupid* IP restrictions in the
> > JCP. There are good
> > ideas here though and since this stuff will eventually make
> > it into JDK 1.4 I
> > would say it should eventually belong here.
> >
> True. But isn't this an awfully weak proposal? It doesn't seem to allow me
> to cleanly compute additional state that's used only in assertion checking.
> I find that I need to do that all the time in order to be able to write
> reasonable assertions. For example, I might explicitly keep track of who
> holds a particular lock, so that I can assert that I hold it at some point.
> Or I might need to count opened files so that I can assert that I closed
> everything I opened in a certain section of code. Or ...
>
> Hans
Can't you put all this stuff a special debug class to keep things clean?
This class will only gets loaded if assertions are enabled!
class Debugging {
static int openFilesCount;
static boolean openFile() {
return openFilesCount < LIMIT;
}
static boolean closeFile() {
return openFilesCount > 0;
}
}
class Main {
void doSomething() {
assert(Debugging.openFile());
// do something
assert(Debugging.closeFile());
}
}
Cedric
_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath