I do know the concept of constructor parameters. I...
# intellij
m
I do know the concept of constructor parameters. I was just wondering why
bar2
is not marked as unused.
k
Maybe you're just using it somewhere else?
foo.bar2
or something like that?
But don't put too much trust in the IDE, sometimes it wrongly marks things as used.
m
It's a class which isn't used anywhere - just for testing this. You can reproduce this with random class or property names.
As soon as I use
bar2
in
init
it gets marked as unused. As soon as I remove the usage of
bar1
in
init
it gets un-marked as unused.
k
Then why is
Foo
not marked unused?
m
Unused symbol
inspection is disabled
hmm, this is only about the
val
part, i.e. the property declaration
k
That's interesting, I can't get it to tell me the
val
part is useless at all.
Turns I just have that inspection disabled.
m
Does it mark the variable as unused or the
val
(i.e. property)?
k
When I turn that on I get the same behavior as you.
But it makes sense that the
val
inspection doesn't fire if the entire variable is unused, it would be a bit redundant to have both.
image.png
m
Yeah, but I have the latter disabled.
It's just a bit confusing but it may make sense how it works
k