Heaps of "good code red" caused by use of typical logging libraries

Hi,

I've been running with the "Enable experimental error highlighting" option enabled for the last month.
It's very useful, and moves the plugin much further towards what people expect from an IDE.

I know that a lot of current focus is on type system work, and other more structural features.
However, I'd like to provide some feedback on using the nightly builds of the plugin on actual day-to-day production/maintenance work.

In our projects, we use some common Java logging libraries (log4j, slf4j).
At the moment, more than half of all the "good code red" that we see is caused by usages of these libraries.

Part of this seems to be caused by an unresolved getClass from an object:
http://youtrack.jetbrains.net/issue/SCL-2216

In other cases (when also using classOf()), it seems that the plugin cannot properly determine the exact method that we're calling on a logger object:
http://youtrack.jetbrains.net/issue/SCL-2239 (seems to occur when providing an exception parameter)
http://youtrack.jetbrains.net/issue/SCL-2238 (seems to be overloading related as well)

Getting rid of this category of "good code red" would help us submitting the remaining ones, which would likely be much more interesting ;)

-tt

7 comments
Comment actions Permalink

Two issues fixed.
Third isuue about AnyVal type passed to java Object parameter. It seems, it's exception case in Scala compiler (because it's impossible to pass AnyVal exapression to AnyRef scala parameter) and I don't know how to fix it better. So I can suggest just to avoid such code, I mean if you want to use something like this, make boxing explicit.

Best regards,
Alexander Podkhalyuzin.

0
Comment actions Permalink

How do I enable this "experimental error highlighting"?

0
Comment actions Permalink

Settings -> Code Style -> Scala -> Other Settings -> Enable experimental error highlighting.

Or, press Ctrl-Shift-Alt-E ;)

0
Comment actions Permalink

There's also Ctrl-Alt-Shift-T for "Show Type", and Ctrl-Alt-Shift-I to show implicit conversions.
Regarding the issues linked in this thread, Alexander fixed two, with http://youtrack.jetbrains.net/issue/SCL-2216 still open as the main source of red.

0
Comment actions Permalink

Cool. Show Type is useful, but I can't figure out how to use Show Implicit Conversions. I have some code that's using implicit conversions of Java collections, but I can't get Ctrl-Alt-Shift-I to show me anything.

0
Comment actions Permalink

Select the full value of interest (CTRL-W is helpful for this) and then type CTRL+ALT+SHIFT-I. You'll see a pop-up that lists all the implicit conversions whose formal parameter type is compatible with the actual value selected. If there's an actual conversion being used to make that expression suitable in its surrounding context, that conversion will be shown in bold.

Perhaps the easiest way to see this is with the ArrowAssoc conversions that is used to allow Maps to be populated with one or more (key -> value) expressions. In this case, select the entire key expression and type CTRL+ALT+SHIFT-I. You should also notice that the -> is underlined in these expressions, indicating it was selected based on an implicitly converted value.

Another common case is "Some RE here".r. In this case, the string literal (the RE) will elicit the available conversions pop-up and the r will be underlined.


Randall Schulz

0

Please sign in to leave a comment.