You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some code threw an AssertionError. It's not immediately obvious to all developers that neither } catch (RuntimeException e) { nor } catch (Exception e) { catch Error, so it bypassed handling code, resulting in a broken application state.
What did you want to happen?
We shouldn't allow AssertionError to be thrown, not in main sources at least. Ideally we would take this a step farther and disallow all Error implementations from being thrown because it's relatively common that libraries fail to handle them properly.
Automated Fix?
We could replace AssertionError with IllegalStateException/SafeIllegalStateException depending on whether or not the message is a compile-time constant.
The text was updated successfully, but these errors were encountered:
Discouraging throwing any kind of Error sounds reasonable to me, the only exception would be projects which are intentionally test libraries, which may well throw AssertionErrors as these are handled nicely by junit.
What happened?
Some code threw an AssertionError. It's not immediately obvious to all developers that neither
} catch (RuntimeException e) {
nor} catch (Exception e) {
catchError
, so it bypassed handling code, resulting in a broken application state.What did you want to happen?
We shouldn't allow AssertionError to be thrown, not in main sources at least. Ideally we would take this a step farther and disallow all Error implementations from being thrown because it's relatively common that libraries fail to handle them properly.
Automated Fix?
We could replace AssertionError with IllegalStateException/SafeIllegalStateException depending on whether or not the message is a compile-time constant.
The text was updated successfully, but these errors were encountered: