SonarLint Eclipse Plugin - Java Version

2,909 views
Skip to first unread message

mdo...@googlemail.com

unread,
Apr 20, 2016, 2:38:21 AM4/20/16
to SonarLint
Hello,

I've installed the SonarLint Eclipse Plugin,configured the connection to my SonarQube Server and bind my projects. Everything went quite fine. But I wonder that some rules were shown in Eclipse which relate to Java 8. I'm using Java 7 and my SonarQube server is also configured to analyze the code with Java 7. After setting the "sonar.java.source" property to "7" for SonarLint within Eclipse the issue markers were removed. Is this a bug or wanted behavior? I thought that after binding my projects to my SonarQube Server the rules and issues shown in Eclipse are completely the same as on the Sonar-Web-GUI?

Regards,
Mathias

Duarte Meneses

unread,
Apr 20, 2016, 4:00:06 AM4/20/16
to mdo...@googlemail.com, SonarLint
Hi,

SonarLint will set the java source / target version properties based on the settings of the IDE. These will effectively override the settings coming from the SonarQube project. I think it makes sense to be consistent with the working environment in the IDE.
Are you sure you were using Java 7? Could you please check the JDK compliance in the Java Compiler settings in Eclipse?


 

--
You received this message because you are subscribed to the Google Groups "SonarLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/a5953604-aa7d-4c4b-a499-bd9de4cd552f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Duarte MENESES | SonarSource

mdo...@googlemail.com

unread,
Apr 21, 2016, 2:59:28 AM4/21/16
to SonarLint, mdo...@googlemail.com
Hi,

I checked my global IDE settings: I've installed JDK 1.7U79 and set the "Compiler compliance level" to 1.7. I don't use project specific settings. Without setting the sonar.java.source SonarLint Analyzer-Property, messages like "Replace the type specification in this constructor call with the diamond operator ("<>"). (sonar.java.source not set. Assuming 7 or greater.)" are shown. This is true for binded projects as well as for unbinded projects.

Best Regards,
Mathias

mdo...@googlemail.com

unread,
Apr 25, 2016, 6:23:53 AM4/25/16
to SonarLint, mdo...@googlemail.com
Sorry, but the example above was quite bad. Here's a better one, which should definetely not occur when configuring the Eclipse IDE with Java 7: "Make this anonymous inner class a lambda (sonar.java.source not set. Assuming 8 or greater.)". This message occurs when using anonymous inner classes.

Best Regards,
Mathias

Duarte Meneses

unread,
Apr 25, 2016, 6:49:17 AM4/25/16
to Mathias Dolag, SonarLint
Thanks, that should indeed not happen.
You said that you checked the global IDE settings. What about the project-specific settings for JDK compliance?


For more options, visit https://groups.google.com/d/optout.

mdo...@googlemail.com

unread,
Apr 25, 2016, 7:08:18 AM4/25/16
to SonarLint, mdo...@googlemail.com
There are no project specific settings.

Julien HENRY

unread,
Apr 25, 2016, 8:07:20 AM4/25/16
to mdo...@googlemail.com, SonarLint
Hi,

Do you have installed the optional plugin SonarLint for Eclipse Java ConfigurationHelper?
Images intégrées 1

This plugin is responsible to properly populate analysis properties based on JDT configuration.

++

Julien


mdo...@googlemail.com

unread,
Apr 26, 2016, 4:29:10 AM4/26/16
to SonarLint, mdo...@googlemail.com
Hi Julien,

I've addionally installed the plugin and the problem seems to be solved. Thanks :)

Best Regards,
Mathias
Reply all
Reply to author
Forward
0 new messages