Skip to content

Commit

Permalink
Make some Java classes proper utilities
Browse files Browse the repository at this point in the history
Made the design cleaner by marking Java classes as `final`
and explicitly declaring their default constructors as `private`.
This change makes the code coverage reports more accurate.
Closes #4921.
  • Loading branch information
vil02 committed Oct 13, 2023
1 parent 0b6ed10 commit 70b65bc
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 9 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
- [Support retrieval of enum types](https://github.com/ballerina-platform/ballerina-standard-library/issues/4588)
- [Make some of the Java classes proper utility classes](https://github.com/ballerina-platform/ballerina-standard-library/issues/4921)

## [1.9.0] - 2023-06-01

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
/**
* This class provides functionality for the `ProcedureCallResult` to iterate through the sql result sets.
*/
public class ProcedureCallResultUtils {
public ProcedureCallResultUtils() {
public final class ProcedureCallResultUtils {
private ProcedureCallResultUtils() {
}

public static Object getNextQueryResult(BObject procedureCallResult) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
*
* @since 1.2.0
*/
public class RecordIteratorUtils {
public RecordIteratorUtils() {
public final class RecordIteratorUtils {
private RecordIteratorUtils() {
}

public static Object nextResult(BObject recordIterator) {
Expand Down
4 changes: 3 additions & 1 deletion native/src/test/java/io/ballerina/stdlib/sql/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@
/**
* TestUtils class for testing ballerina native classes/methods.
*/
public class TestUtils {
public final class TestUtils {

private TestUtils() {}

/**
* ExtendedColumnDefinition Class for test utils.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
*
* @since 0.6.0
*/
public class Exec {
public final class Exec {

private Exec() {}

public static Object exec(BString command, BMap<BString, BString> env, Object dir, BString[] args) {
List<String> commandList = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
*
* @since 0.6.0
*/
public class ExitCode {
public final class ExitCode {

private ExitCode() {}

public static Object exitCode(BObject objVal) {
Process process = OSUtils.processFromObject(objVal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
*
* @since 0.6.0
*/
public class WaitForExit {
public final class WaitForExit {

private WaitForExit() {}

public static Object waitForExit(BObject objVal) {
Process process = OSUtils.processFromObject(objVal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
/**
* @since 0.6.0
*/
public class OSUtils {
public final class OSUtils {

private OSUtils() {}

private static final BString UNKNOWN_MESSAGE = StringUtils.fromString("Unknown Error");

Expand Down

0 comments on commit 70b65bc

Please sign in to comment.