micronaut-projects / micronaut-projects/micronaut-data

Naming strategy UnderScoreSeparatedLowerCase does not work with two Upper characters after each other

Open
#786 7 comments 0 reactions 0 assignees View on GitHub
priority: high type: bug
Dominant language
Java
Stars
482
Forks
229
Avg merge
1d 7h
Merged PRs (30d)
32

Description

### Task List

- [x] Steps to reproduce provided
- [] Stacktrace (if present) provided
- [] Example that reproduces the problem uploaded to Github
- [x] Full description of the issue provided (see below)

### Steps to Reproduce

1. Call io.micronaut.core.naming.NameUtils.separateCamelCase("DataCJpa", false, '_')

### Expected Behaviour

should return 'Data_C_Jpa'

### Actual Behaviour

returns 'Data_CJpa'

### Environment Information

- **Operating System**: Windows 10
- **Micronaut Version:** 2.1.0
- **JDK Version:** 11.0.8

### Example Application

N/A

### How to fix

In class io.micronaut.core.naming.NameUtils in method separateCamelCase on line 370:

change line:
if (Character.isUpperCase(c) && !Character.isUpperCase(last)) {

to:
if (Character.isUpperCase(c)) {

Contributor guide

Open the contributing guide

Research direction

Start in io.micronaut.core.naming.NameUtils, specifically separateCamelCase, and reproduce the issue with NameUtils.separateCamelCase("DataCJpa", false, '_'). Done means the result is 'Data_C_Jpa' rather than 'Data_CJpa'; the issue does not name a test file to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.