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

final check doesn't work correctly when not initialized in all constructor #508

Closed
Luro02 opened this issue Apr 25, 2024 · 0 comments · Fixed by #522
Closed

final check doesn't work correctly when not initialized in all constructor #508

Luro02 opened this issue Apr 25, 2024 · 0 comments · Fixed by #522
Labels
bug Something isn't working false-positive A lint triggers on something that is correct.

Comments

@Luro02
Copy link
Collaborator

Luro02 commented Apr 25, 2024

Summary

When a non-final field is not initialized with a value, it implicitly assumes a default value. A final field must be explicitly initialized. When the final field is not initialized in each constructor, only in some or none, it can not be final, because then the code would not compile.

Lint Name

No response

Reproducer

<code>
@Luro02 Luro02 added bug Something isn't working false-positive A lint triggers on something that is correct. labels Apr 25, 2024
Luro02 added a commit to Luro02/autograder that referenced this issue May 10, 2024
Luro02 added a commit to Luro02/autograder that referenced this issue May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working false-positive A lint triggers on something that is correct.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant