Skip to content

Fix most-recent file not set after loading recent-files list (#3711)#3866

Merged
unp1 merged 1 commit into
mainfrom
fix/key-ui-recentfiles-low
Jun 28, 2026
Merged

Fix most-recent file not set after loading recent-files list (#3711)#3866
unp1 merged 1 commit into
mainfrom
fix/key-ui-recentfiles-low

Conversation

@unp1

@unp1 unp1 commented Jun 27, 2026

Copy link
Copy Markdown
Member

Related Issue

This pull request resolves #3711.

Intended Change

RecentFileMenu.loadFrom updated mostRecentFile only when it was already non-null,
and then reassigned it on every loop iteration. As a result, after startup
mostRecentFile was left null, so File -> Reload (which uses getMostRecent()) had
no — or the wrong — target.

The fix resets mostRecentFile and sets it to the first entry of the stored list, which
is kept most-recent-first.

Note: the in-session "move an already-listed file to the front" behaviour described in
#3711 was already fixed by an earlier refactor of addRecentFileNoSave; this PR addresses
the remaining startup case.

Type of pull request

  • Bug fix (non-breaking change which fixes an issue)
  • There are changes to the (Java) code

Ensuring quality

  • I made sure that introduced/changed code is well documented (javadoc and inline comments).
  • I added new test case(s) for new functionality.
  • I have tested the feature as follows: added RecentFileMenuTest.mostRecentIsFirstEntryAfterLoad,
    a headless test that writes a recent-files store (via the same Configuration.ConfigurationWriter
    the app uses), loads it, and asserts getMostRecent() is the first entry. Verified it fails
    without the fix (expected A.key but was null) and passes with it. Ran
    ./gradlew :key.ui:test --tests "de.uka.ilkd.key.gui.RecentFileMenuTest".
  • I have checked that runtime performance has not deteriorated.

Additional information and contact(s)

PR created with AI tooling support

The contributions within this pull request are licensed under GPLv2 (only) for inclusion in KeY.

RecentFileMenu.loadFrom updated mostRecentFile only when it was already
non-null, and then reassigned it on every iteration. After startup this
left mostRecentFile null, so File -> Reload had no (or the wrong) target.

Reset mostRecentFile and set it to the first entry of the stored list,
which is kept most-recent-first.

Created with AI tooling support
@unp1 unp1 self-assigned this Jun 27, 2026
@unp1 unp1 added the 🐞 Bug label Jun 27, 2026
@unp1 unp1 added this to the v3.0.0 milestone Jun 27, 2026
@unp1
unp1 marked this pull request as ready for review June 27, 2026 10:57
@unp1
unp1 enabled auto-merge June 27, 2026 14:59
@unp1
unp1 added this pull request to the merge queue Jun 28, 2026
Merged via the queue into main with commit 90d8bac Jun 28, 2026
36 checks passed
@unp1
unp1 deleted the fix/key-ui-recentfiles-low branch June 28, 2026 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Reload" loads the wrong file

2 participants