|
Re: Question about Activator template in SDK [message #1467710 is a reply to message #1464429] |
Mon, 10 November 2014 08:39 |
Jeremie Bresson Messages: 1252 Registered: October 2011 |
Senior Member |
|
|
Patrick TOURNET wrote on Fri, 07 November 2014 15:48But 2 of them were flagged as critical...
It seems to me, that is is a standard pattern for Activator classes.
If you create a new "Plug-in project" and you select "Generate an activator, a java class that controls the plug-ins' life cycle" in the second step, you end up with a class like this:
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
private static BundleContext context;
static BundleContext getContext() {
return context;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}
}
Same pattern as with the Eclipse Scout template... I agree with the SonarQube issue, this is not a recommended java pattern.
I my opinion you can mark those as false positive in SonarQube (for each Activator class).
Patrick TOURNET wrote on Fri, 07 November 2014 15:48As I'm configuring my project and the development pipeline, I've set up a Sonar server and an analysis of the bare generated Scout plugins triggered several warnings a lot of which being field names not matching the regular expression '^[a-z][a-zA-Z0-9]*$'.
It is up to you to decide what your coding/naming convention will be.
Scout follows a pattern, where all member fields use the prefix: "m_".
If you want to keep this pattern in your scout application, you need to change the regular expression in the Sonar rule.
[Updated on: Mon, 10 November 2014 08:45] Report message to a moderator
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03271 seconds