Skip to content
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

[Refactoring] Mark fields as final if they are not reassigned #43028

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Shadow-Devil
Copy link
Contributor

Purpose

Fields that are not reassigned should be marked as final to make the intent clear. It also helps to later convert some classes to records and encapsulate public fields (use getters & setters).

Approach

Describe how you are implementing the solutions along with the design details.

Samples

Provide high-level details about the samples related to this feature.

Remarks

List any other known issues, related PRs, TODO items, or any other notes related to the PR.

Check List

  • Read the Contributing Guide
  • Updated Change Log
  • Checked Tooling Support (#)
  • Added necessary tests
    • Unit Tests
    • Spec Conformance Tests
    • Integration Tests
    • Ballerina By Example Tests
  • Increased Test Coverage
  • Added necessary documentation
    • API documentation
    • Module documentation in Module.md files
    • Ballerina By Examples

@Shadow-Devil Shadow-Devil changed the title Mark fields as final if they are not reassigned [Refactoring] Mark fields as final if they are not reassigned Jul 3, 2024
Copy link

codecov bot commented Jul 3, 2024

Codecov Report

Attention: Patch coverage is 68.91386% with 83 lines in your changes missing coverage. Please review.

Project coverage is 77.49%. Comparing base (b45e1e1) to head (465d1da).
Report is 17 commits behind head on master.

Files with missing lines Patch % Lines
...ntime/transactions/TransactionResourceManager.java 0.00% 23 Missing ⚠️
...llerinalang/docgen/docs/BallerinaDocGenerator.java 12.50% 21 Missing ⚠️
.../runtime/transactions/TransactionLocalContext.java 0.00% 7 Missing ⚠️
...main/java/io/ballerina/cli/utils/TokenUpdater.java 0.00% 5 Missing ⚠️
.../ballerina/runtime/observability/tracer/BSpan.java 0.00% 4 Missing ⚠️
...llerina/runtime/internal/scheduling/Scheduler.java 81.25% 2 Missing and 1 partial ⚠️
...ballerinalang/natives/NativeElementRepository.java 0.00% 2 Missing ⚠️
...llerinalang/util/BackendCodeGeneratorProvider.java 0.00% 2 Missing ⚠️
...g/ballerinalang/util/EmbeddedExecutorProvider.java 0.00% 2 Missing ⚠️
...rinalang/compiler/packaging/repo/PathBalaRepo.java 0.00% 2 Missing ⚠️
... and 10 more
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #43028      +/-   ##
============================================
- Coverage     77.51%   77.49%   -0.02%     
+ Complexity    58585    58575      -10     
============================================
  Files          3438     3438              
  Lines        219219   219196      -23     
  Branches      28921    28910      -11     
============================================
- Hits         169921   169873      -48     
- Misses        39884    39909      +25     
  Partials       9414     9414              

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

@SasinduDilshara
Copy link
Contributor

Other than #43028 (comment) LGTM

chiranSachintha
chiranSachintha previously approved these changes Jul 4, 2024
SasinduDilshara
SasinduDilshara previously approved these changes Jul 4, 2024
Copy link

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

Copy link

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

@github-actions github-actions bot added the Stale label Aug 18, 2024
Copy link

Closed PR due to inactivity for more than 18 days.

@github-actions github-actions bot closed this Aug 23, 2024
@NipunaRanasinghe
Copy link
Contributor

NipunaRanasinghe commented Sep 6, 2024

@MaryamZi @SasinduDilshara it seems this PR got closed due to inactivity. So we might need to re-open this and continue reviewing?

@Shadow-Devil Shadow-Devil force-pushed the final-fields branch 2 times, most recently from 246a310 to e7a87ac Compare September 12, 2024 18:40
@Shadow-Devil
Copy link
Contributor Author

Failing testcase in Ballerina Distribution:

Output Verification 'time-formatting-and-parsing'
Failed due to output did not match. Line 3: Civil string representation: 2021-04-12T23:20:50.520+05:30
WARNING: This command is deprecated and will be removed in a future release. Use `bal new .` instead
Building example 'time-formatting-and-parsing'
Created new package 'test'.
Compiling source
	runner/test:0.1.0

Running Tests

	test

	testFunc: has failed.

error: there are test failures

		[fail] testFunc:

		    error {ballerina/test:0}TestError ("Assertion Failed!
			 
			expected: 'Civil string representation: 2021-04-12T17:50:50.520Z'
			actual	: 'Civil string representation: 2021-04-12T23:20:50.520+05:30'
			 
			Diff	:
			
			--- actual
			+++ expected 
			 
			 @@ -1,1 +1,1 @@ 
			 
			 -Civil string representation: 2021-04-12T23:20:50.520+05:30
			+Civil string representation: 2021-04-12T17:50:50.520Z
			")
				callableName: createBallerinaError moduleName: ballerina.test.0 fileName: assert.bal lineNumber: 41
				callableName: assertEquals moduleName: ballerina.test.0 fileName: assert.bal lineNumber: 109
				callableName: testFunc moduleName: runner.test$test.0.tests.time_formatting_and_parsing_test fileName: tests/time_formatting_and_parsing_test.bal lineNumber: 79
				callableName: testFunc$lambda0$ moduleName: runner.test$test.0.tests.test_execute-generated_1 fileName: tests/test_execute-generated_1.bal lineNumber: 4
			


		0 passing
		1 failing
		0 skipped

		Test execution time : 0.145s

This is not related to this PR since it also happened in #42955

Copy link
Contributor

@NipunaRanasinghe NipunaRanasinghe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bindgen tool related changes LGTM

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.

6 participants