-
Notifications
You must be signed in to change notification settings - Fork 140
Validate enum uppercase #2200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate enum uppercase #2200
Conversation
WalkthroughIntroduces enum validation within the annotation processor: during attribute scanning, if a setter parameter is an enum, the processor checks that all enum constants are uppercase and throws IllegalArgumentException on violations. Changes
Sequence Diagram(s)sequenceDiagram
actor Dev as Developer Code
participant AP as SpringConfigurationXSDGeneratingAnnotationProcessor
participant Scan as Attribute Scanner
participant Val as Enum Validator
Dev->>AP: Compile/Process annotations
AP->>Scan: Scan attributes
loop For each attribute
Scan->>Val: validateEnumAttribute(ai)
alt Setter param is enum
Val->>Val: validateEnumConstantsUppercase(enumType)
alt All constants uppercase
Val-->>Scan: OK
else Non-uppercase found
Val-->>AP: throw IllegalArgumentException
AP-->>Dev: Fail with error
end
else Not an enum
Val-->>Scan: Skip
end
end
AP-->>Dev: Processing continues/succeeds
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This pull request needs "/ok-to-test" from an authorized committer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
annot/src/main/java/com/predic8/membrane/annot/SpringConfigurationXSDGeneratingAnnotationProcessor.java
(2 hunks)core/src/main/java/com/predic8/membrane/core/interceptor/oauth2/authorizationservice/AuthorizationService.java
(2 hunks)core/src/main/java/com/predic8/membrane/core/interceptor/oauth2/authorizationservice/ClientAuthorization.java
(1 hunks)core/src/test/java/com/predic8/membrane/core/interceptor/oauth2/client/b2c/B2CMembrane.java
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Analyze (java)
🔇 Additional comments (6)
core/src/main/java/com/predic8/membrane/core/interceptor/oauth2/authorizationservice/ClientAuthorization.java (1)
23-24
: LGTM! Enum constants now follow Java naming conventions.The renaming from
client_secret_basic
andclient_secret_post
to uppercase follows standard Java enum naming conventions. All usages across the codebase have been updated consistently.annot/src/main/java/com/predic8/membrane/annot/SpringConfigurationXSDGeneratingAnnotationProcessor.java (2)
438-438
: LGTM! Enum validation integrated into attribute scanning.The validation call is appropriately placed during attribute scanning to enforce uppercase enum constants at compile time.
519-531
: LGTM! Proper detection of enum-typed attributes.The logic correctly identifies when an attribute setter accepts an enum parameter by checking the parameter type and its superclass against
java.lang.Enum
.core/src/test/java/com/predic8/membrane/core/interceptor/oauth2/client/b2c/B2CMembrane.java (1)
162-162
: LGTM! Test updated to use the renamed enum constant.The usage correctly references
ClientAuthorization.CLIENT_SECRET_POST
, aligning with the enum constant renaming.core/src/main/java/com/predic8/membrane/core/interceptor/oauth2/authorizationservice/AuthorizationService.java (2)
78-78
: LGTM! Default value updated to use the renamed enum constant.The default initialization correctly uses
ClientAuthorization.CLIENT_SECRET_BASIC
, maintaining the same default behavior with the new enum naming.
258-258
: LGTM! Comparison updated to use the renamed enum constant.The conditional check correctly compares against
ClientAuthorization.CLIENT_SECRET_BASIC
, consistent with the enum renaming.
Summary by CodeRabbit