Commit 639fb99
authored
Fix inner class naming in KSP to match KAPT behavior (#1317)
## Problem
When migrating from KAPT to KSP, inner class naming conventions differ:
- KAPT: `QOuterClass_InnerClass`
- KSP: `QInnerClass`
This breaks existing code that relies on KAPT naming conventions.
## Solution
Modified `QueryModelExtractor.queryClassName()` to:
1. Traverse parent class hierarchy using `generateSequence`
2. Collect all class names from inner to outer
3. Join with underscore separator to match KAPT behavior
## Changes
- **Fixed**: Inner class naming now matches KAPT exactly
- **Added**: Comprehensive test coverage for nested scenarios
- **Maintained**: Backward compatibility for top-level classes
## Test Cases
- ✅ Single level inner class: `OuterClass.InnerClass` →
`QOuterClass_InnerClass`
- ✅ Multi-level nesting: `A.B.C` → `QA_B_C`
- ✅ Top-level classes unchanged: `TopLevel` → `QTopLevel`
- ✅ Custom prefix/suffix support
## Breaking Changes
None - this fixes compatibility issues rather than introducing them.File tree
2 files changed
+60
-1
lines changed- querydsl-tooling/querydsl-ksp-codegen/src
- main/kotlin/com/querydsl/ksp/codegen
- test/kotlin
2 files changed
+60
-1
lines changedLines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
157 | 164 | | |
158 | 165 | | |
159 | | - | |
| 166 | + | |
160 | 167 | | |
161 | 168 | | |
162 | 169 | | |
| |||
Lines changed: 52 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
214 | 256 | | |
215 | 257 | | |
216 | 258 | | |
| |||
271 | 313 | | |
272 | 314 | | |
273 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
0 commit comments