farrellf / TelemetryViewer

Data Visualization Tool
164 stars 69 forks source link

Problem in WidgetHistogramYaxisType.java - Unlikely argument type for equals(): String seems to be unrelated to JComboBox<String> #43

Closed greenonline closed 2 years ago

greenonline commented 3 years ago

Eclipse is showing me that there is a "problem" (rather than an error) here: https://github.com/farrellf/TelemetryViewer/blob/master/Telemetry%20Viewer/src/WidgetHistogramYaxisType.java#L243

Description Resource Path Location Type
Unlikely argument type for equals(): String seems to be unrelated to JComboBox<String> WidgetHistogramYaxisType.java /TelemetryViewer-mgj2/src line 243 Java Problem

The line is

if(axisTypeCombobox.equals(type))

I think that it should be

if(axisTypeCombobox.getSelectedItem().toString().equals(type))

but I may be wrong. .? Either way, as it currently stands, the types don't match in the equals().


There's a reason why it compiles without error, but the "problem" still shows up, which seems to be explained in this answer to the question Elegant way to overcome Unlikely argument type for equals(): Stream seems to be unrelated to String.

farrellf commented 3 years ago

You're right, it should be:

if(axisTypeCombobox.getSelectedItem().toString().equals(type))

I'll fix this and include it in the next release. Thanks.

farrellf commented 2 years ago

The fix is in the latest release: http://www.farrellf.com/projects/software/2021-07-24_Telemetry_Viewer_v0.8/