farrellf/TelemetryViewer

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

Closed this issue · 2 comments

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.

You're right, it should be:

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

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