Skip to content

Conversation

craftyworks
Copy link
Contributor

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.InnerClassQOuterClass_InnerClass
  • ✅ Multi-level nesting: A.B.CQA_B_C
  • ✅ Top-level classes unchanged: TopLevelQTopLevel
  • ✅ Custom prefix/suffix support

Breaking Changes

None - this fixes compatibility issues rather than introducing them.

  - Change queryClassName generation to use underscore separator for nested classes
  - Maintains compatibility with existing KAPT-generated Q-classes
  - Add comprehensive test cases for inner class naming scenarios

  Fixes: Inner classes now generate QOuterClass_InnerClass instead of QInnerClass
  This ensures seamless migration from KAPT to KSP without breaking existing code.
Copy link

codecov bot commented Aug 15, 2025

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (a78b8c6) to head (007c67b).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
...in/com/querydsl/ksp/codegen/QueryModelExtractor.kt 0.00% 6 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #1317    +/-   ##
=======================================
  Coverage    0.00%   0.00%            
=======================================
  Files         812     837    +25     
  Lines       31149   31484   +335     
  Branches     3536    3545     +9     
=======================================
- Misses      31149   31484   +335     
Flag Coverage Δ
cubrid 0.00% <0.00%> (?)
db2 0.00% <0.00%> (?)
embedded 0.00% <0.00%> (?)
examples 0.00% <ø> (?)
firebird 0.00% <0.00%> (?)
mongodb 0.00% <0.00%> (?)
mysql 0.00% <0.00%> (?)
oracle 0.00% <0.00%> (?)
postgresql 0.00% <0.00%> (?)
test 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@velo velo requested a review from IceBlizz6 September 5, 2025 13:18
@IceBlizz6 IceBlizz6 enabled auto-merge September 9, 2025 09:14
@IceBlizz6 IceBlizz6 merged commit 639fb99 into OpenFeign:master Sep 9, 2025
5 checks passed
@IceBlizz6
Copy link
Collaborator

Looks good, sorry for the delay.
I'm not sure if i got notified when this was made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants