-
Notifications
You must be signed in to change notification settings - Fork 46
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
feat: Migrate and Enhance Spring Analyzer for Kotlin (#251) #307
Conversation
- Implemented various methods in `KotlinLexer` to tokenize Kotlin code based on logic - Fixed bug in `trace` method in `minilexer.cr` Signed-off-by: ksg <ksg97031@gmail.com>
- Defined the `AnnotationModel`, `ClassModel`, `MethodModel`, and `FieldModel` classes within the `KotlinParser` class - Implemented various methods for parsing import statements, formal parameters, annotations, classes, class fields, and methods in the `KotlinParser` class Signed-off-by: ksg <ksg97031@gmail.com>
- Updated `print_tokens` method to display token types - Added `trace` method to display parsed data for classes, fields, and methods Signed-off-by: ksg <ksg97031@gmail.com>
Signed-off-by: ksg <ksg97031@gmail.com>
Signed-off-by: ksg <ksg97031@gmail.com>
Signed-off-by: ksg <ksg97031@gmail.com>
Signed-off-by: ksg <ksg97031@gmail.com>
- Fix typos and add missing commas in Kotlin lexer files Signed-off-by: ksg <ksg97031@gmail.com>
Signed-off-by: ksg <ksg97031@gmail.com>
Signed-off-by: ksg <ksg97031@gmail.com>
Signed-off-by: ksg <ksg97031@gmail.com>
- Modified `KotlinLexer` in `src/minilexers/kotlin.cr` - Added new punctuation types in `src/minilexers/kotlin.cr` - Modified `AnalyzerKotlinSpring` in `src/analyzer/analyzers/analyzer_kotlin_spring.cr` - Modified and added methods for parsing Kotlin files in `src/miniparsers/kotlin.cr` Signed-off-by: ksg <ksg97031@gmail.com>
- Fixed a typo and refactored methods in the Kotlin miniparser - Updated punctuation tokens and removed unnecessary tokens in the Kotlin minilexer Signed-off-by: ksg <ksg97031@gmail.com>
- Removed test case for detecting Spring in `pom.xml` and `build.gradle`, added new test case for detecting it in `test.java` - Various methods for parsing Kotlin files including import statements, class declarations, fields, and methods Signed-off-by: ksg <ksg97031@gmail.com>
- Modified the expected endpoints in `kotlin_spring_spec.cr`. Signed-off-by: ksg <ksg97031@gmail.com>
- Add `==` method to the `Param` struct in `src/models/endpoint.cr` Signed-off-by: ksg <ksg97031@gmail.com>
- Modified method to include method parameters when parsing fields from class body - Added support for multiple request mappings in processing method annotations - Implemented support for optional parameters, headers, values, and paths in handling request methods and formats - Added support for Pageable parameters in endpoint parameter extraction - Implemented support for default values in extracting parameter details - Added support for user-defined class fields in adding parameters to user-defined classes Signed-off-by: ksg <ksg97031@gmail.com>
…_spring.cr` - Added parameter `lorem` with value `ipsum` and type `cookie` to `/api/user/{login}` endpoint in `kotlin_spring_spec.cr` - Deleted `pom.xml` file for `kotlin_spring` fixture in `pom.xml` Signed-off-by: ksg <ksg97031@gmail.com>
- Added new support for Spring framework in Kotlin. - Fixed the support status for Spring framework in Java (missed in the previous update). Signed-off-by: ksg <ksg97031@gmail.com>
- :STRING_LITERAL tokens are always two characters or more, so the size condition check is redundant and has been removed. Signed-off-by: ksg <ksg97031@gmail.com>
Signed-off-by: ksg <ksg97031@gmail.com>
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.
Hiya @ksg97031
Your code looks fantastic as always! I really appreciate your attention to detail :D
I noticed that you included the gradle-wrapper.jar
file. Do you think it's essential for our testing flow? Just curious about your thoughts on this.
Other than that, everything seems perfect. If there are no further issues, I'll go ahead and approve and merge this PR.
Thanks!
- Deleted unnecessary `gradle-wrapper.jar` and `gradle-wrapper.properties` files. Signed-off-by: ksg <ksg97031@gmail.com>
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.
The gradle-wrapper.jar is used to ensure that the same version of Gradle is used across all environments, but it is not strictly necessary for the project to function.
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.
I've removed the gradle-wrapper.jar file as suggested.
Overview
I've made some significant updates to migrate our existing Java Spring analyzer to a Kotlin Spring analyzer. This includes adding new classes like
KotlinLexer
andKotlinParser
, as well as various refactorings and improvements to enhance functionality.Key Changes
Addition of KotlinLexer Class
KotlinLexer
class that inherits fromMiniLexer
to tokenize Kotlin code.Addition and Enhancement of KotlinParser Class
KotlinParser
class specifically for analyzing Spring-Kotlin applications.Porting Java Spring Analyzer to Kotlin Spring
Review Requests
Please let me know if you find any bugs or if there are any areas that need improvement.
Thanks a lot!