onConfigurationChanged never calls super, so every rotation crashes the app - #191
Merged
Merged
Conversation
Android runs onConfigurationChanged, then checks that Activity's own implementation ran, and throws SuperNotCalledException when it did not. HTTrackActivity only logged, so every rotation, dark-mode switch, font-size change or split-screen entry killed the app. Play has 4 users and 6 reports. No activity in the manifest declares android:configChanges, so the activity is recreated for the changes it can be recreated for and the override handles nothing. The TODO asking whether to handle orientation change goes with it. The other lifecycle overrides in the tree all chain. A new source-text guard reads every Java source under src/main/java and fails on any void lifecycle override that never calls its super. A second case feeds the scan one chaining and one silent override, so a scan that stopped matching cannot pass. Signed-off-by: Xavier Roche <xroche@gmail.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com>
The scan wanted `void` right after `public` or `protected`. So `public synchronized void onDestroy()` and `@Override public void onResume()` were not reported missing, they were not seen at all. The tree has none today, so the guard stayed green and would have stayed green for the next author who wrote one. The declaration pattern now takes same-line annotations and any modifier order. A second pass then looks for every lifecycle name used other than as a call on a receiver. It fails when one falls outside a matched declaration, so a style neither pattern reads is a failure rather than a silent gap. Private helpers of the same name are read and skipped, so widening the match does not flag them. The test now states two limits. A chain on another overload, such as super.onCreate(null), sets the flag the framework checks while dropping the argument. And the scan reads .java under src/main/java only. Signed-off-by: Xavier Roche <xroche@gmail.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Nine of the twenty-two names had no declaration in the tree and no fixture. Nothing ever fed them to the scan, so the suite reported coverage it did not have. A new case runs each name through the scan twice, once chaining and once silent, which is four assertions in a loop. The list itself stays. Its value is the next override someone adds without a super call, and cutting it to what the tree declares today throws that away. The comments are reworded too. The class doc splits its two limits into a sentence each, and the field docs get a subject and a verb. The note on the MENTION pattern no longer reads as if a declaration were excluded from it. A declaration matches and is filtered out later. Signed-off-by: Xavier Roche <xroche@gmail.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HTTrackActivity.onConfigurationChangedonly logged. Android runs it, checks thatActivity's own implementation ran, and throwsSuperNotCalledExceptionwhen it did not. Play reports 4 users and 6 crashes at this frame.No activity declares
android:configChanges, so most configuration changes relaunch the activity instead of reaching this method. Which ones do reach it is not something the manifest tells us, and production shows some do. The override has to chain either way, and the// TODO: handle orientation change ?comment goes with the fix.Every other lifecycle override in the tree already chains. A new source-text guard reads each Java source under
src/main/javaand fails on any void lifecycle override that never calls its super.Closes #186