-
Notifications
You must be signed in to change notification settings - Fork 0
new: first implementation #2
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
Conversation
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.
Pull Request Overview
This PR implements the initial version of the exception handling library by introducing the Exc class that accepts a reason (a record) and an optional cause, and includes methods for message formatting, runtime conversion, and serialization.
- Introduces the Exc class with constructors, custom toString(), and serialization support.
- Implements comprehensive JUnit tests covering construction, getters, exception message formatting, and serialization behaviors.
- Removes legacy Sample and SampleTest files that are no longer necessary.
Reviewed Changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/com/github/sttk/errs/ExcTest.java | Tests for the new Exc class (constructors, getters, serialization, etc.) |
| src/test/java/SampleTest.java | Removed legacy test file |
| src/main/java/module-info.java | New module declaration supporting the library |
| src/main/java/com/github/sttk/errs/package-info.java | Package documentation for the exception handling API |
| src/main/java/com/github/sttk/errs/Exc.java | New Exc class implementation with runtime conversion and serialization |
| src/main/java/Sample.java | Removed legacy implementation |
Files not reviewed (2)
- src/main/resources/META-INF/native-image/com.github.sttk/errs/reachability-metadata.json: Language not supported
- src/test/resources/META-INF/native-image/reachability-metadata.json: Language not supported
…pport reachability-metadata.json
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.
Pull Request Overview
This PR introduces the initial implementation of the Exc exception class along with comprehensive tests covering construction, message formatting, and serialization/deserialization behavior.
- Introduces the Exc class (and its RuntimeExc wrapper) for exceptions with a record-based reason.
- Adds extensive JUnit tests in ExcTest.java to validate exception properties and serialization.
- Removes the sample code and test artifacts not associated with the new functionality.
Reviewed Changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/com/github/sttk/errs/Exc.java | Implements the core Exc exception with custom message formatting and serialization logic. |
| src/test/java/com/github/sttk/errs/ExcTest.java | Provides tests for constructors, getters, toString(), and serialization of Exc. |
| src/main/java/module-info.java | Defines module metadata for the errs package. |
| src/main/java/com/github/sttk/errs/package-info.java | Provides package-level documentation for the errs package. |
| src/test/java/SampleTest.java & src/main/java/Sample.java | Removes unused sample test and sample implementation files. |
Files not reviewed (2)
- src/main/resources/META-INF/native-image/com.github.sttk/errs/serialization-config.json: Language not supported
- src/test/resources/META-INF/native-image/serialization-config.json: Language not supported
Comments suppressed due to low confidence (1)
src/test/java/com/github/sttk/errs/ExcTest.java:156
- [nitpick] Hardcoding the expected line number in the test makes it brittle; any refactoring or change in the code location could cause false negatives. Consider a more flexible approach to validate the line number, such as checking for a range or using metadata.
assertThat(exc.getLine()).isEqualTo(155);
This PR provides the implementation of the
Errclass as the first implementation of this library.