Regarding RSPEC-3749 and the implementation of Rule S3749

883 views
Skip to first unread message

simon schrottner

unread,
Mar 30, 2017, 4:32:43 AM3/30/17
to SonarQube
Hi!

Well i just checked out the new "Sonar-Java" update and i find the rule s3749 is somehow odd!

Yes in spring you should use @Autowired, but you could also use @Resource which is defined in JSR-250 -> so it would be great if we could extend the rule!

Both of them seem for me to be somehow valid and have their usecase!

Br
Simon

PS: here is a small stackoverflow which covers that issue! 



G. Ann Campbell

unread,
Mar 30, 2017, 4:54:47 AM3/30/17
to SonarQube
Hi Simon,

According to the answers on the SO link you posted, it looks like @Resource and @Injected should both be accepted in addition to @Autowired?


Thx,
Ann

simon schrottner

unread,
Mar 30, 2017, 5:24:44 AM3/30/17
to SonarQube
Well for our case at least @Resource should be also included! i have not seen and not use @injected so far! :D

Basically i just wanted to start the discussion, maybe your devs had a good reasoning for that, and that brings a new facet to the discussion, which i had with my team :D

Br
Simon

simon schrottner

unread,
Mar 31, 2017, 9:38:00 AM3/31/17
to SonarQube
So, what will be the next step? Should i create a change request or should i provide the suggested changes?, i mean this is - based on the implementation - a quick code change, which i will be able to handle i think :)

Just curious :)

G. Ann Campbell

unread,
Apr 3, 2017, 9:26:43 AM4/3/17
to simon schrottner, SonarQube
Hi Simon,

I've updated the rule specification to include these two annotations & entered SONARJAVA-2219 to update the implementation as well. I'm sure that if you wanted to provide a PR to address that ticket it would be well received. 


:-)
Ann



---
G. Ann CAMPBELL | SonarSource
Product Manager

On Fri, Mar 31, 2017 at 9:37 AM, simon schrottner <simon.sc...@gmail.com> wrote:
So, what will be the next step? Should i create a change request or should i provide the suggested changes?, i mean this is - based on the implementation - a quick code change, which i will be able to handle i think :)

Just curious :)

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/T-f83S9mvQU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/acd42f40-a918-43ed-8def-ced06fcec0b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

simon schrottner

unread,
Apr 5, 2017, 5:03:52 AM4/5/17
to SonarQube, simon.sc...@gmail.com
well it is my first try... and i did everything except ITS, but is this the right approach? 



On Monday, 3 April 2017 15:26:43 UTC+2, G. Ann Campbell wrote:
Hi Simon,

I've updated the rule specification to include these two annotations & entered SONARJAVA-2219 to update the implementation as well. I'm sure that if you wanted to provide a PR to address that ticket it would be well received. 


:-)
Ann



---
G. Ann CAMPBELL | SonarSource
Product Manager

On Fri, Mar 31, 2017 at 9:37 AM, simon schrottner <simon.sc...@gmail.com> wrote:
So, what will be the next step? Should i create a change request or should i provide the suggested changes?, i mean this is - based on the implementation - a quick code change, which i will be able to handle i think :)

Just curious :)

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/T-f83S9mvQU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+...@googlegroups.com.

G. Ann Campbell

unread,
Apr 5, 2017, 8:15:53 AM4/5/17
to SonarQube, simon.sc...@gmail.com
Hi Simon,

Reviewing this is in the proper queue. But I have no idea how big the queue is.


:-)
Ann

simon schrottner

unread,
May 11, 2017, 12:49:22 AM5/11/17
to SonarQube, simon.sc...@gmail.com
Hi Everybody!

It seems like we forgot an important Annotations "@Value" to inject configuration properties!

The question is, shoul i simply create another pull request with that change, or will there be an internal ticket on your side?

BR
Simon

Nicolas Peru

unread,
May 11, 2017, 2:39:12 AM5/11/17
to simon schrottner, SonarQube
Hi, 

Ideally we would like both : create a ticket explaining the functional requirement and then you can create a PR based on this. 

So could you detail a bit what we missed exactly and why ? 
Thanks. 

You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/1820fd7f-c2cd-409f-afbc-90bf8749bf84%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
Nicolas Peru | SonarSource

simon schrottner

unread,
May 11, 2017, 2:50:23 AM5/11/17
to Nicolas Peru, SonarQube
Well i already created the pull request... which is explaining the issue:


please take a short look - i will create a ticket if you give me the go with the reasoning etc.

 :D 

Br simon

simon schrottner

unread,
May 11, 2017, 7:09:38 AM5/11/17
to SonarQube, nicola...@sonarsource.com
please continue discussion regarding this issue in https://github.com/SonarSource/sonar-java/pull/1444
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+unsubscribe@googlegroups.com.

fesp...@tennaxia.com

unread,
Jun 21, 2017, 11:01:05 AM6/21/17
to SonarQube
Hi!

The @Value has been added but what about other injection mode like constructor injection (which doesn't even require the @Autowired with recent spring version) ?

https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-spring-beans-and-dependency-injection.html


Thx,
Fabio

vhai...@gmail.com

unread,
Jan 23, 2018, 8:06:36 AM1/23/18
to SonarQube


Dne středa 21. června 2017 17:01:05 UTC+2 fesp...@tennaxia.com napsal(a):
Hi!

The @Value has been added but what about other injection mode like constructor injection (which doesn't even require the @Autowired with recent spring version) ?

https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-spring-beans-and-dependency-injection.html


:+1: I have complaints from devs about this exact situation as well. It would be nice to have this kind of injection detected correctly.

Nicolas Peru

unread,
Feb 5, 2018, 11:58:43 AM2/5/18
to vhai...@gmail.com, SonarQube
Hi, 

Indeed, thanks for the suggestion and reference link : ticket created to handle this issue : https://jira.sonarsource.com/browse/SONARJAVA-2639

Cheers, 

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/75ec7fa8-ba0a-416c-96ed-1f4478955278%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
Nicolas Peru | SonarSource

marko....@gmail.com

unread,
Apr 20, 2018, 1:59:07 PM4/20/18
to SonarQube
Hello Nicolas.

I see the issue is closed, but still I have problems when I have a multi-parameters constructor. 
In particular, this is a constructor generated using Project Lombok.

@ConstructorProperties({"sender", "beginPrescan", "listenerManager"})
@Autowired
@Generated
public BeginPrescanService(Sender sender, BeginPrescan beginPrescan, ListenerManager listenerManager) {

Best regards
Marko.
Reply all
Reply to author
Forward
0 new messages