micronaut-projects / micronaut-projects/micronaut-cache

Hyphen keys are converted to camelCase with Caffeine Cache

Open
#810 1 comment 0 reactions 0 assignees View on GitHub
status: example attached status: in progress type: bug
Dominant language
PLSQL
Stars
32
Forks
36
Avg merge
2h 2m
Merged PRs (30d)
5

Description

### Expected Behavior

When a Map with a String key that contains hyphen is cached (for instance `"an-example"`), when accessing through the cache, the key should be the same (`"an-example"`).

### Actual Behaviour

When a Map with a String key that contains hyphen is cached (for instance `"an-example"`), when accessing through the cache, the key is converted to camelCase (`"anExample"`).

### Steps To Reproduce

Download and run https://github.com/dcalap/micronaut-cache-bug

Perform a GET http://localhost:8080/cacheBug

The first time you will see `an-id-with-hypen`

Perform again a GET http://localhost:8080/cacheBug

The second time you will see `anIdWithHypen`

### Environment Information

macOS, OpenJDK Runtime Environment Temurin-17.0.8.1+1 (build 17.0.8.1+1)
Micronaut 4.6.2 with Java 17, Gradle, and Micronaut Caffeine Cache

### Example Application

https://github.com/dcalap/micronaut-cache-bug

### Version

4.6.2

Contributor guide

Open the contributing guide

Research direction

Start by running the linked micronaut-cache-bug example with Micronaut 4.6.2 and Java 17, then issue GET requests to /cacheBug and compare the first and second responses. Trace the cache path used by the Caffeine cache to identify where the hyphenated map key changes. Done means repeated requests preserve "an-id-with-hypen" rather than returning "anIdWithHypen".

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.