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

Remove a lot of IDE warnings #6201

Merged
merged 5 commits into from
Jan 12, 2024
Merged

Conversation

ThadHouse
Copy link
Member

Many related to unused fields

Many related to unused fields
@ThadHouse ThadHouse requested review from PeterJohnson and a team as code owners January 11, 2024 06:07
@@ -140,6 +142,7 @@ public void close() {
if (m_choicesPublisher != null) {
m_choicesPublisher.close();
}
Reference.reachabilityFence(m_videoListener);
Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed? What does it do?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

@ThadHouse ThadHouse Jan 11, 2024

Choose a reason for hiding this comment

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

It does 2 things. One it gets rid of the warning, and 2 it stops the field from being GC'd. Unused fields are eligible for GC even if the class containing the field is still alive. Basically its a method to keep a field alive.

@@ -34,16 +34,16 @@ public class ADXL345_I2C implements NTSendable, AutoCloseable {
private static final byte kDataFormatRegister = 0x31;
private static final byte kDataRegister = 0x32;
private static final double kGsPerLSB = 0.00390625;
private static final byte kPowerCtl_Link = 0x20;
private static final byte kPowerCtl_AutoSleep = 0x10;
// private static final byte kPowerCtl_Link = 0x20;
Copy link
Member

Choose a reason for hiding this comment

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

What's the advantage of commenting them out rather than suppressing the unused warning?

Copy link
Member Author

Choose a reason for hiding this comment

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

A little bit cleaner IMO. We still want them there incase they're needed in the future.

@PeterJohnson PeterJohnson merged commit 1981b8d into wpilibsuite:main Jan 12, 2024
27 checks passed
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.

4 participants