IG visibility isssue

For 'off-line' inspections, under Visibility issues, I have

Local variable hides member variable.

I have also checked the Options "Ignore superclass fields not visible from
subclass."

I have a class derived from JPanel which has overrides the following method:

public void setEnabled(final boolean enabled)


The inspection tells me that 'enabled' hides member variable.

I don't think that this is correct. Is it?

Thanks,

Ted Hill



2 comments

java.awt.Component defines a package-visible boolean member variable enabled, so this is correct. This variable is likely inaccessible to your code (I'm assuming your code doesn't live in the java.awt package), but is potentially confusing nonetheless, so IG flags it as a warning.

0

But the inspection can be configured to

"Ignore superclass fields not visible from
subclass."

The 'enabled' field in the parent class is not visible in my class.

So my thinking is, the inspection shouldn't tell me about this.

Ted Hill


0

Please sign in to leave a comment.