[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jdt-dev] Use of Java asserts in ECJ
|
> PS: Does anyone know, if it is possible to set -ea programmatically?
In that case the ECJ Main could do just that for asserts that in other
use cases could be ignorable :)
Might be possible but that needs to happen before the class with the
assert is loaded:
https://stackoverflow.com/questions/5558731/how-to-programmatically-enable-assert
A much cleaner solution would be to replace the assert with a method
call which has a guard that we can disable with a compiler option.
The next step would be add a way to serialize the internal compiler
state. After that, we could do this: Run the compiler as usual. If one
of the "asserts" fails, serialize the state and dump it in an error
file. That would give devs all the information they need (if the finder
is willing to share that much information).
If there is state that would be very expensive to collect (memory or
CPU), then the assert could take the current config and compile unit and
run the compiler again with the flag enabled and then dump, when it
crashes the second time. There is a chance that this fails (the
additional code might hide the bug) but in most cases, it should work.
Regards,
--
Aaron "Optimizer" Digulla a.k.a. Philmann Dark
"It's not the universe that's limited, it's our imagination.
Follow me and I'll show you something beyond the limits."
http://blog.pdark.de/