Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-dev] Use of Java asserts in ECJ

On 21.04.24 21:49, Aaron Digulla via jdt-dev wrote:
> 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

Thanks, Aaron.
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.
...

I feel that would be overkill, given that we already have a standard red alert mechanism in the compiler: raising AbortCompilation (directly or via ProblemHandler).

best,
Stephan



Back to the top