René's URL Explorer Experiment


Title: Make Preferences standalone in app:utils by diyaayay · Pull Request #1563 · processing/processing4 · GitHub

Open Graph Title: Make Preferences standalone in app:utils by diyaayay · Pull Request #1563 · processing/processing4

X Title: Make Preferences standalone in app:utils by diyaayay · Pull Request #1563 · processing/processing4

Description: Resolves #1104 Splits processing.app.Preferences into a standalone storage class (processing.utils.Preferences in app:utils) and an app-side facade, so preferences work in contexts without the PDE: the Gradle plugin, CLI tools, and the preprocessor, as motivated in #1104 and the standalone-CLI discussion in #1522. Changes New processing.utils.Preferences: the storage half of the old class. Bundled defaults from the classpath, reading/writing preferences.txt, platform-specific keys, and the 3.x sketchbook migration. JDK-only (no core, no AWT/Swing). Errors are reported by throwing IOException with the cause chained instead of showing dialogs, so callers decide how to react. processing.app.Preferences becomes a facade: keeps fonts/colors, Messages dialogs, and the proxy/native-chooser side effects in their original startup order, delegating storage to the utils class. No call sites change (~246 across app and java). defaults.txt moves into app:utils resources: the published utils jar now carries its own defaults and works standalone. All readers (including the Compose PreferencesProvider) load it via getResourceAsStream, so nothing else changes. Platform.getName(): platform name for preference-key suffixes, mirroring PConstants.platformNames. The four strings are part of the preferences file format, so a small mirror avoids giving app:utils a core dependency. Change listeners (from the issue's TODO list): addChangeListener / removeChangeListener on the utils class. Fires only on real changes from set()/unset(); bulk loading is silent; a throwing listener can't block the change or other listeners. No consumers wired yet. First candidates are PDE components that currently re-read on window close, and possibly converging with the Compose side's PreferencesEvents later. Preprocessor shim now delegates to the same class: java:preprocessor's processing.app.Preferences used to re-read preferences.txt on every call with the platform charset and had no defaults, so a standalone preprocessor could crash on getInteger("editor.tabs.size") with no prefs file present. It now resolves from the bundled defaults. Happy to split this commit into a follow-up PR if preferred. Design notes Why the cyclic dependency from the earlier attempt is gone: the original blocker was that the settings-folder logic lived in :app (Base/Platform) while Preferences was moving to :app:utils, so each module needed the other. Since then, #1196 created app:utils and #1335 moved settings-folder resolution into processing.utils.Settings, so the knowledge Preferences needs now lives below it and all dependency arrows point one way. This PR adds no new dependencies on top of that: the remaining app couplings are handled by throwing instead of dialogs, and by passing the settings folder in as an argument (loadUserPrefs(File)), with Settings.getFolder() and the processing.app.preferences.file system property as fallbacks for standalone use. Staged init: the app needs to set its own defaults (run.window.bgcolor, CJK input-method support) between loading the bundled defaults and the user's file, so init is split into loadDefaults() / loadUserPrefs(File), with init(File) composing them for standalone consumers. This keeps the PDE's startup order exactly as on main. Delegation instead of inheritance: static methods only shadow, they don't override. An extends relationship would let calls through the parent type silently skip the app's error dialogs. The facade delegates explicitly; the cost is fully-qualified names (Java can't alias same-named imports), which was preferred over renaming a class and churning every reference. Intentional behavior changes (both make failures visible rather than silent): a corrupt/unreadable preferences.txt surfaces as an exception (the PDE shows the same error dialog as before), and the utils class won't run the sketchbook migration/save over a file it couldn't read. Builds on the direction @AhmedMagedC explored in #1209, thank you for the groundwork! Rebuilt on today's main since that branch predates the app:utils module: delegation instead of static inheritance, chained IOExceptions instead of a custom exception, no core dependency, and defaults bundled in the utils jar. Tests 17 new tests in app:utils (PreferencesTest): default loading, file creation, and backwards compatibility (3.x sketchbook migration, backslash normalization, platform-suffix keys), plus save/load round trips, the preferences.file override, getInteger fallback, sorted save, and the listener contract. All suites pass on the rebased branch: app:utils, app (incl. PreferencesKtTest, so the Compose provider still finds the moved defaults.txt), and java (incl. ParserTests through the preprocessor). Smoke-tested the utils jar standalone (jshell, nothing else on the classpath): fresh folder → defaults resolve → set/save → new JVM reads the value back. This caught a first-save folder-creation bug only real standalone use could hit, fixed with a regression test. Manual: PDE runs normally; preference changes persist across restart. Checklist Tests pass locally

Open Graph Description: Resolves #1104 Splits processing.app.Preferences into a standalone storage class (processing.utils.Preferences in app:utils) and an app-side facade, so preferences work in contexts without the PDE:...

X Description: Resolves #1104 Splits processing.app.Preferences into a standalone storage class (processing.utils.Preferences in app:utils) and an app-side facade, so preferences work in contexts without the PDE:...

Opengraph URL: https://github.com/processing/processing4/pull/1563

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:459cb33f-26a7-9e8d-edf3-aa848b195531
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id91EA:32B63:16BD38:1F691F:6B05F98E
html-safe-nonce0908e6b4e83f3a2a7416419ba83de219fa341802c8b1afc9f4c37eb3b18e4f7d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MUVBOjMyQjYzOjE2QkQzODoxRjY5MUY6NkIwNUY5OEUiLCJ2aXNpdG9yX2lkIjoiMTQzNDY5NTIzNjc0MzE5OTExOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacdf2f2c8fc1c42ceb4539c1c7876eb86b4c7bcf16caffb64dd273ac9c97882c39
hovercard-subject-tagpull_request:4222995141
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/processing/processing4/pull/1563/files
twitter:imagehttps://avatars.githubusercontent.com/u/110971977?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/110971977?s=400&v=4
og:image:altResolves #1104 Splits processing.app.Preferences into a standalone storage class (processing.utils.Preferences in app:utils) and an app-side facade, so preferences work in contexts without the PDE:...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonec214754a6652274794ed4e054a7b71be999d69843f103ba54893001d45010ece
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/processing/processing4 git https://github.com/processing/processing4.git
octolytics-dimension-user_id1617169
octolytics-dimension-user_loginprocessing
octolytics-dimension-repository_id844382769
octolytics-dimension-repository_nwoprocessing/processing4
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id844382769
octolytics-dimension-repository_network_root_nwoprocessing/processing4
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release7d164a4e71eb333b2b17fd5b17e18efb7855505c
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/processing/processing4/pull/1563/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fprocessing%2Fprocessing4%2Fpull%2F1563%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fprocessing%2Fprocessing4%2Fpull%2F1563%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=processing%2Fprocessing4
Reloadhttps://github.com/processing/processing4/pull/1563/files
Reloadhttps://github.com/processing/processing4/pull/1563/files
Reloadhttps://github.com/processing/processing4/pull/1563/files
processinghttps://github.com/processing
processing4https://github.com/processing/processing4
Codehttps://github.com/processing/processing4
Issues265 (265)https://github.com/processing/processing4/issues
Pull requests22 (22)https://github.com/processing/processing4/pulls
Actionshttps://github.com/processing/processing4/actions
Projectshttps://github.com/processing/processing4/projects
Wikihttps://github.com/processing/processing4/wiki
Security and qualityhttps://github.com/processing/processing4/security
Insightshttps://github.com/processing/processing4/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fprocessing%2Fprocessing4%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fprocessing%2Fprocessing4%2Fissues%2Fnew%2Fchoose
diyaayayhttps://github.com/diyaayay
processing:mainhttps://github.com/processing/processing4/tree/main
diyaayay:preferences-decouplehttps://github.com/diyaayay/processing4/tree/preferences-decouple
Conversation 3 https://github.com/processing/processing4/pull/1563
Commits 10 https://github.com/processing/processing4/pull/1563/commits
Checks 2 https://github.com/processing/processing4/pull/1563/checks
Files changed https://github.com/processing/processing4/pull/1563/files
Please reload this pagehttps://github.com/processing/processing4/pull/1563/files
Make Preferences standalone in app:utils https://github.com/processing/processing4/pull/1563/files#top
Show all changes 10 commits https://github.com/processing/processing4/pull/1563/files
27bc405 feat(utils): add Platform.getName() for platform-specific pref keys diyaayay Jun 29, 2026 https://github.com/processing/processing4/pull/1563/commits/27bc405b10341010c0ef7d5deb1c908c60ba04e7
23bce88 refactor(utils): move defaults.txt into app:utils resources diyaayay Aug 1, 2026 https://github.com/processing/processing4/pull/1563/commits/23bce8873c06e1f620128a60196bb50c31f36461
3b74729 add standalone Preferences to app:utils diyaayay Aug 2, 2026 https://github.com/processing/processing4/pull/1563/commits/3b74729caf4c2abfb06c3625c270ba1ba3fa8db3
be94d2e delegate app.Preferences storage to utils.Preferences diyaayay Aug 2, 2026 https://github.com/processing/processing4/pull/1563/commits/be94d2e6a07949df0de78af7591e199df848dd5b
25ed898 back the preprocessor Preferences shim with utils.Preferences diyaayay Aug 3, 2026 https://github.com/processing/processing4/pull/1563/commits/25ed898a04279e28297b6c0e96773c16a12c233d
b270253 add change listeners to utils.Preferences diyaayay Aug 3, 2026 https://github.com/processing/processing4/pull/1563/commits/b2702531d2c070585ea7ec564e3027c0b09345fd
435ffed add tests for utils.Preferences diyaayay Aug 4, 2026 https://github.com/processing/processing4/pull/1563/commits/435ffeddf54aca72caf41b9c43c893643efcac65
dd9b4e8 create the settings folder on save when missing diyaayay Aug 6, 2026 https://github.com/processing/processing4/pull/1563/commits/dd9b4e801adcf0fcd44e8b1920d42a3f39b6a9ad
4b65f2c keep a failed first-run save a warning, not a fatal error diyaayay Nov 16, 2026 https://github.com/processing/processing4/pull/1563/commits/4b65f2cdd6867aca884dc9be69e39c5892e18b31
c9238e7 restore commented-out code removed from app.Preferences diyaayay Nov 16, 2026 https://github.com/processing/processing4/pull/1563/commits/c9238e7dc3f37c912156de976178e8665751b770
Clear filters https://github.com/processing/processing4/pull/1563/files
Please reload this pagehttps://github.com/processing/processing4/pull/1563/files
Please reload this pagehttps://github.com/processing/processing4/pull/1563/files
Preferences.java https://github.com/processing/processing4/pull/1563/files#diff-b4c522ac09409ec748f7458bc1ba0d1da60f02e5352f0f904be0f200452c63dd
Platform.java https://github.com/processing/processing4/pull/1563/files#diff-f39a6e746cb6a3f6228edb1162aaa5e175b185113d6547adaab665e07a905ab3
Preferences.java https://github.com/processing/processing4/pull/1563/files#diff-b86b9ead376042c8e2ee9abd481f3a8f62ca657b9015d326e01edcf0037c5c04
defaults.txt https://github.com/processing/processing4/pull/1563/files#diff-c036e751bcaf97559c830a2ef5ffc08900530e427829f78794a6d31787b050ae
PreferencesTest.java https://github.com/processing/processing4/pull/1563/files#diff-a809ff12e470b376fd1f4349d25175f32bbcea33f401eca31b18bdbfcc2ebeb7
Preferences.java https://github.com/processing/processing4/pull/1563/files#diff-cbfdbe83aff52364660d0d9c6464c1dc9dc9484c56c927353c86023e49eb7e08
app/src/processing/app/Preferences.javahttps://github.com/processing/processing4/pull/1563/files#diff-b4c522ac09409ec748f7458bc1ba0d1da60f02e5352f0f904be0f200452c63dd
View file https://github.com/processing/processing4/blob/c9238e7dc3f37c912156de976178e8665751b770/app/src/processing/app/Preferences.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/processing/processing4/pull/1563/{{ revealButtonHref }}
https://github.com/processing/processing4/pull/1563/files#diff-b4c522ac09409ec748f7458bc1ba0d1da60f02e5352f0f904be0f200452c63dd
https://github.com/processing/processing4/pull/1563/files#diff-b4c522ac09409ec748f7458bc1ba0d1da60f02e5352f0f904be0f200452c63dd
https://github.com/processing/processing4/pull/1563/files#diff-b4c522ac09409ec748f7458bc1ba0d1da60f02e5352f0f904be0f200452c63dd
https://github.com/processing/processing4/pull/1563/files#diff-b4c522ac09409ec748f7458bc1ba0d1da60f02e5352f0f904be0f200452c63dd
https://github.com/processing/processing4/pull/1563/files#diff-b4c522ac09409ec748f7458bc1ba0d1da60f02e5352f0f904be0f200452c63dd
catilachttps://github.com/catilac
Sep 17, 2026https://github.com/processing/processing4/pull/1563/files#r4040837067
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/processing/processing4/pull/1563/files
https://github.com/processing/processing4/pull/1563/files#diff-b4c522ac09409ec748f7458bc1ba0d1da60f02e5352f0f904be0f200452c63dd
https://github.com/processing/processing4/pull/1563/files#diff-b4c522ac09409ec748f7458bc1ba0d1da60f02e5352f0f904be0f200452c63dd
https://github.com/processing/processing4/pull/1563/files#diff-b4c522ac09409ec748f7458bc1ba0d1da60f02e5352f0f904be0f200452c63dd
https://github.com/processing/processing4/pull/1563/files#diff-b4c522ac09409ec748f7458bc1ba0d1da60f02e5352f0f904be0f200452c63dd
app/utils/src/main/java/processing/utils/Platform.javahttps://github.com/processing/processing4/pull/1563/files#diff-f39a6e746cb6a3f6228edb1162aaa5e175b185113d6547adaab665e07a905ab3
View file https://github.com/processing/processing4/blob/c9238e7dc3f37c912156de976178e8665751b770/app/utils/src/main/java/processing/utils/Platform.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/processing/processing4/pull/1563/{{ revealButtonHref }}
https://github.com/processing/processing4/pull/1563/files#diff-f39a6e746cb6a3f6228edb1162aaa5e175b185113d6547adaab665e07a905ab3
Please reload this pagehttps://github.com/processing/processing4/pull/1563/files
Please reload this pagehttps://github.com/processing/processing4/pull/1563/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.