René's URL Explorer Experiment


Title: Add UUIDGenerator with UUIDv7 and configurable generation modes by Copilot · Pull Request #107 · simbo1905/java.util.json.Java21 · GitHub

Open Graph Title: Add UUIDGenerator with UUIDv7 and configurable generation modes by Copilot · Pull Request #107 · simbo1905/java.util.json.Java21

X Title: Add UUIDGenerator with UUIDv7 and configurable generation modes by Copilot · Pull Request #107 · simbo1905/java.util.json.Java21

Description: What changed Added UUIDGenerator utility class with two UUID generation strategies: UUIDv7 (default): Backported from Java 26 (JDK-8334015) with 48-bit millisecond timestamp, version/variant bits, and cryptographically strong random data Unique-Then-Time: Custom format with 64-bit unique MSB + 44-bit time component + 20-bit random LSB Configuration via system property jdk.sandbox.uuid.generator.mode with values v7 or unique-then-time. Static initialization ensures thread-safety and single configuration point for both Android and server environments. // Default (V7) UUID uuid = UUIDGenerator.generateUUID(); // Explicit UUIDv7 with timestamp UUID uuid = UUIDGenerator.ofEpochMillis(System.currentTimeMillis()); // Unique-then-time mode UUID uuid = UUIDGenerator.uniqueThenTime(uniqueMsb); // Configuration java -Djdk.sandbox.uuid.generator.mode=unique-then-time -jar app.jar Why this change is needed Provides time-ordered UUID generation (UUIDv7) for database efficiency and distributed systems, with fallback to alternative generation strategy when needed. System property configuration supports both server startup flags and Android Application.onCreate() initialization patterns. How were these changes tested 19 unit tests covering UUIDv7 generation, timestamp validation, monotonicity, thread safety (10 threads × 100 UUIDs), and unique-then-time generation 2 configuration tests verifying mode detection and consistency Demo application validated in both V7 and unique-then-time modes via system property CodeQL security scan: 0 vulnerabilities Checklist Code builds / passes tests (107 tests passing) New tests added if needed Update to use CODING_STYLE_LLM.md conventions (JEP 467 Markdown docs, exhaustive switch expressions, final vars, lambda logging) Documentation updated if needed (Demo + usage examples) AGENTS.md updated if appropriate (N/A - utility addition) Original prompt upgrade the current UUIDGenerator to use this logic backported from java26 ``` /// Creates a type 7 UUID (UUIDv7) {@code UUID} from the given Unix Epoch timestamp. /// /// The returned {@code UUID} will have the given {@code timestamp} in /// the first 6 bytes, followed by the version and variant bits representing {@code UUIDv7}, /// and the remaining bytes will contain random data from a cryptographically strong /// pseudo-random number generator. /// /// @APinote {@code UUIDv7} values are created by allocating a Unix timestamp in milliseconds /// in the most significant 48 bits, allocating the required version (4 bits) and variant (2-bits) /// and filling the remaining 74 bits with random bits. As such, this method rejects {@code timestamp} /// values that do not fit into 48 bits. /// /// Monotonicity (each subsequent value being greater than the last) is a primary characteristic /// of {@code UUIDv7} values. This is due to the {@code timestamp} value being part of the {@code UUID}. /// Callers of this method that wish to generate monotonic {@code UUIDv7} values are expected to /// ensure that the given {@code timestamp} value is monotonic. /// /// @param timestamp the number of milliseconds since midnight 1 Jan 1970 UTC, /// leap seconds excluded. /// /// @return a {@code UUID} constructed using the given {@code timestamp} /// /// @throws IllegalArgumentException if the timestamp is negative or greater than {@code (1L << 48) - 1} /// /// @SInCE Backport from Java 26 (JDK-8334015) public static UUID ofEpochMillis(long timestamp) { if ((timestamp >> 48) != 0) { throw new IllegalArgumentException("Supplied timestamp: " + timestamp + " does not fit within 48 bits"); } byte[] randomBytes = new byte[16]; LazyRandom.RANDOM.nextBytes(randomBytes); // Embed the timestamp into the first 6 bytes randomBytes[0] = (byte)(timestamp >> 40); randomBytes[1] = (byte)(timestamp >> 32); randomBytes[2] = (byte)(timestamp >> 24); randomBytes[3] = (byte)(timestamp >> 16); randomBytes[4] = (byte)(timestamp >> 8); randomBytes[5] = (byte)(timestamp); // Set version to 7 randomBytes[6] &= 0x0f; randomBytes[6] |= 0x70; // Set variant to IETF randomBytes[8] &= 0x3f; randomBytes[8] |= (byte) 0x80; // Convert byte array to UUID using ByteBuffer ByteBuffer buffer = ByteBuffer.wrap(randomBytes); long msb = buffer.getLong(); long lsb = buffer.getLong(); return new UUID(msb, lsb); } ``` then also add in this alternative optional way: /// ┌──────────────────────────────────────────────────────────────────────────────┐ /// │ unique (64 bits) │ time+counter (44 bits) │ random (20 bits) │ /// └──────────────────────────────────────────────────────────────────────────────┘ public static UUID uniqueThenTime(long uniqueMsb) { final int timeBits = 44; final int randomBits = 20; final int randomMask = (1 << randomBits) - 1; long timeCounter = timeCounterBits(); long msb = uniqueMsb; // Take the most significant 44 bits of timeCounter to preserve time ordering long timeComponent = timeCounter >> (64 - timeBits); // timeBits is 44 long lsb = (timeComponent << randomBits) | (getRandom().nextInt() & randomMask); return new UUID(msb, lsb); } it would be best current public static UUID generateUUID() can default to using the UUIDv7 approach yet have options to set it up be configurable at startup such as providing a system property to be able to flip it to the other method. have a think about how that is best done on both android and servers. ✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Open Graph Description: What changed Added UUIDGenerator utility class with two UUID generation strategies: UUIDv7 (default): Backported from Java 26 (JDK-8334015) with 48-bit millisecond timestamp, version/variant bits,...

X Description: What changed Added UUIDGenerator utility class with two UUID generation strategies: UUIDv7 (default): Backported from Java 26 (JDK-8334015) with 48-bit millisecond timestamp, version/variant bits,...

Opengraph URL: https://github.com/simbo1905/java.util.json.Java21/pull/107

X: @github

direct link

Domain: patch-diff.githubusercontent.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:4e1e8250-c847-360a-45ae-e86b68723db1
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id81E4:27383:C542DC:1017B14:697F709C
html-safe-nonce6d2a382662a2c7abb73e767d2417a725d729d21830e16f793989f8f26941965a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MUU0OjI3MzgzOkM1NDJEQzoxMDE3QjE0OjY5N0Y3MDlDIiwidmlzaXRvcl9pZCI6IjE2ODM4NzEzMDM0NDgwOTY5MjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac00eb75ea528ff7339ae390b7d38e3f66a0fa3b3dd1efb4e3dbc53d576ecf3110
hovercard-subject-tagpull_request:2992283967
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/simbo1905/java.util.json.Java21/pull/107/files
twitter:imagehttps://avatars.githubusercontent.com/in/1143301?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/in/1143301?s=400&v=4
og:image:altWhat changed Added UUIDGenerator utility class with two UUID generation strategies: UUIDv7 (default): Backported from Java 26 (JDK-8334015) with 48-bit millisecond timestamp, version/variant bits,...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None60279d4097367e16897439d16d6bbe4180663db828c666eeed2656988ffe59f6
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simbo1905/java.util.json.Java21 git https://github.com/simbo1905/java.util.json.Java21.git
octolytics-dimension-user_id322608
octolytics-dimension-user_loginsimbo1905
octolytics-dimension-repository_id1025867939
octolytics-dimension-repository_nwosimbo1905/java.util.json.Java21
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1025867939
octolytics-dimension-repository_network_root_nwosimbo1905/java.util.json.Java21
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
release7c85641c598ad130c74f7bcc27f58575cac69551
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimbo1905%2Fjava.util.json.Java21%2Fpull%2F107%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimbo1905%2Fjava.util.json.Java21%2Fpull%2F107%2Ffiles
Sign up https://patch-diff.githubusercontent.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=simbo1905%2Fjava.util.json.Java21
Reloadhttps://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files
Reloadhttps://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files
Reloadhttps://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files
simbo1905 https://patch-diff.githubusercontent.com/simbo1905
java.util.json.Java21https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fsimbo1905%2Fjava.util.json.Java21
Fork 0 https://patch-diff.githubusercontent.com/login?return_to=%2Fsimbo1905%2Fjava.util.json.Java21
Star 1 https://patch-diff.githubusercontent.com/login?return_to=%2Fsimbo1905%2Fjava.util.json.Java21
Code https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21
Issues 5 https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/issues
Pull requests 2 https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pulls
Actions https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/actions
Projects 0 https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/projects
Security 0 https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/security
Insights https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pulse
Code https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21
Issues https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/issues
Pull requests https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pulls
Actions https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/actions
Projects https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/projects
Security https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/security
Insights https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pulse
Sign up for GitHub https://patch-diff.githubusercontent.com/signup?return_to=%2Fsimbo1905%2Fjava.util.json.Java21%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://patch-diff.githubusercontent.com/login?return_to=%2Fsimbo1905%2Fjava.util.json.Java21%2Fissues%2Fnew%2Fchoose
Copilothttps://patch-diff.githubusercontent.com/apps/copilot-swe-agent
mainhttps://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/tree/main
copilot/upgrade-uuid-generator-to-v7https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/tree/copilot/upgrade-uuid-generator-to-v7
Conversation 0 https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107
Commits 3 https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/commits
Checks 0 https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/checks
Files changed https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files
Please reload this pagehttps://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files
Add UUIDGenerator with UUIDv7 and configurable generation modes https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files#top
Show all changes 3 commits https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files
295cac5 Initial plan Copilot Nov 9, 2025 https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/commits/295cac58f9a3127a9b9768c21d15eba9dc2fc81f
328e11c Add UUIDGenerator with UUIDv7 support and configurable modes Copilot Nov 9, 2025 https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/commits/328e11c06e78b3542a5cd4d3176434e7c0d70d3c
f209543 Add UUIDGeneratorDemo showing usage examples Copilot Nov 9, 2025 https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/commits/f20954345ab5537233f84b365d88d151786a228c
Clear filters https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files
Please reload this pagehttps://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files
Please reload this pagehttps://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files
pom.xml https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files#diff-54cd267af4e8cc5d265d020039be95cb330239c2b3265829f2fc6a913d42008d
UUIDGeneratorDemo.java https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files#diff-496654a0c1ea2892d1da5365cc15dd86fdb2afe030fdaa73446663f7887d95c6
UUIDGenerator.java https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files#diff-1caac1099d17da2d8332669f750dca3ca81487b43397b1b3df7c2e18cf063d53
UUIDGeneratorConfigTest.java https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files#diff-cd606abad2c9d71acfe75f6c5975a7990722e6b010a235fad18535982660f800
UUIDGeneratorTest.java https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files#diff-1f83e7fc2b4573c871cdbca2c88d8c845e1bdda1dcfcee703eb043c060621a04
json-java21/pom.xmlhttps://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files#diff-54cd267af4e8cc5d265d020039be95cb330239c2b3265829f2fc6a913d42008d
View file https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/blob/f20954345ab5537233f84b365d88d151786a228c/json-java21/pom.xml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/{{ revealButtonHref }}
https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files#diff-54cd267af4e8cc5d265d020039be95cb330239c2b3265829f2fc6a913d42008d
https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files#diff-54cd267af4e8cc5d265d020039be95cb330239c2b3265829f2fc6a913d42008d
json-java21/src/main/java/jdk/sandbox/demo/UUIDGeneratorDemo.javahttps://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files#diff-496654a0c1ea2892d1da5365cc15dd86fdb2afe030fdaa73446663f7887d95c6
View file https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/blob/f20954345ab5537233f84b365d88d151786a228c/json-java21/src/main/java/jdk/sandbox/demo/UUIDGeneratorDemo.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/{{ revealButtonHref }}
json-java21/src/main/java/jdk/sandbox/java/util/json/UUIDGenerator.javahttps://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files#diff-1caac1099d17da2d8332669f750dca3ca81487b43397b1b3df7c2e18cf063d53
View file https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/blob/f20954345ab5537233f84b365d88d151786a228c/json-java21/src/main/java/jdk/sandbox/java/util/json/UUIDGenerator.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/{{ revealButtonHref }}
json-java21/src/test/java/jdk/sandbox/java/util/json/UUIDGeneratorConfigTest.javahttps://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/files#diff-cd606abad2c9d71acfe75f6c5975a7990722e6b010a235fad18535982660f800
View file https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/blob/f20954345ab5537233f84b365d88d151786a228c/json-java21/src/test/java/jdk/sandbox/java/util/json/UUIDGeneratorConfigTest.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/{{ revealButtonHref }}
Please reload this pagehttps://patch-diff.githubusercontent.com/simbo1905/java.util.json.Java21/pull/107/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

Viewport: width=device-width


URLs of crawlers that visited me.