diff options
author | Noel Grandin <noel@peralex.com> | 2014-11-18 10:01:21 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-11-18 12:44:28 +0200 |
commit | 0063cf285696951e336b9cec1da8881997b286ce (patch) | |
tree | be70dfd8127c35f9e4a6d18d4db459a587813bf4 /scripting | |
parent | 250391009aec9930abcc57930ddd4b6f56f4df9c (diff) |
java: make fields final where possible
found by PMD
Change-Id: I87780366119c141cd2dafe6ca1bf2d9798b10aec
Diffstat (limited to 'scripting')
24 files changed, 52 insertions, 54 deletions
diff --git a/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java b/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java index 92f5ee777f97..21d78d47c609 100644 --- a/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java +++ b/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java @@ -145,7 +145,7 @@ public class SecurityDialog extends WeakBase implements private static final int lineWrapH = 12; private String _pushed = _doNotRunButtonName; - private XComponentContext _xComponentContext; + private final XComponentContext _xComponentContext; private XDialog _xDialog; public SecurityDialog(XComponentContext xComponentContext) { @@ -539,7 +539,7 @@ public class SecurityDialog extends WeakBase implements private class ActionListenerImpl implements com.sun.star.awt.XActionListener { - private String _buttonName; + private final String _buttonName; private ActionListenerImpl(String buttonName) { _buttonName = buttonName; diff --git a/scripting/java/com/sun/star/script/framework/browse/DialogFactory.java b/scripting/java/com/sun/star/script/framework/browse/DialogFactory.java index a4350fb92d59..303b600e2e3b 100644 --- a/scripting/java/com/sun/star/script/framework/browse/DialogFactory.java +++ b/scripting/java/com/sun/star/script/framework/browse/DialogFactory.java @@ -41,7 +41,7 @@ import com.sun.star.uno.XComponentContext; public class DialogFactory { private static DialogFactory factory; - private XComponentContext xComponentContext; + private final XComponentContext xComponentContext; // singleton private DialogFactory(XComponentContext xComponentContext) { diff --git a/scripting/java/com/sun/star/script/framework/browse/ParcelBrowseNode.java b/scripting/java/com/sun/star/script/framework/browse/ParcelBrowseNode.java index 23999a1c1e8c..85b8b3d6c057 100644 --- a/scripting/java/com/sun/star/script/framework/browse/ParcelBrowseNode.java +++ b/scripting/java/com/sun/star/script/framework/browse/ParcelBrowseNode.java @@ -51,9 +51,9 @@ import javax.swing.JOptionPane; public class ParcelBrowseNode extends PropertySet implements XBrowseNode, XInvocation { - private ScriptProvider provider; + private final ScriptProvider provider; private Collection<XBrowseNode> browsenodes; - private ParcelContainer container; + private final ParcelContainer container; private Parcel parcel; public ParcelBrowseNode(ScriptProvider provider, ParcelContainer container, diff --git a/scripting/java/com/sun/star/script/framework/browse/ProviderBrowseNode.java b/scripting/java/com/sun/star/script/framework/browse/ProviderBrowseNode.java index 3bf1ba5eaf25..3bcf706b3dbe 100644 --- a/scripting/java/com/sun/star/script/framework/browse/ProviderBrowseNode.java +++ b/scripting/java/com/sun/star/script/framework/browse/ProviderBrowseNode.java @@ -47,11 +47,11 @@ import javax.swing.JOptionPane; public class ProviderBrowseNode extends PropertySet implements XBrowseNode, XInvocation { - private ScriptProvider provider; + private final ScriptProvider provider; private Collection<XBrowseNode> browsenodes; - private String name; + private final String name; protected ParcelContainer container; - private XComponentContext m_xCtx; + private final XComponentContext m_xCtx; public ProviderBrowseNode(ScriptProvider provider, ParcelContainer container, XComponentContext xCtx) { diff --git a/scripting/java/com/sun/star/script/framework/browse/ScriptBrowseNode.java b/scripting/java/com/sun/star/script/framework/browse/ScriptBrowseNode.java index fe2efd939899..3c7bfa03f327 100644 --- a/scripting/java/com/sun/star/script/framework/browse/ScriptBrowseNode.java +++ b/scripting/java/com/sun/star/script/framework/browse/ScriptBrowseNode.java @@ -53,12 +53,12 @@ import java.util.HashMap; public class ScriptBrowseNode extends PropertySet implements XBrowseNode, XInvocation { - private ScriptProvider provider; + private final ScriptProvider provider; private Parcel parent; private String name; - private boolean editable = false; + private boolean editable; private boolean deletable = false; private boolean renamable = false; diff --git a/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java b/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java index b641cd038b66..85a9b8d1d551 100644 --- a/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java +++ b/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java @@ -64,7 +64,7 @@ public class ParcelContainer implements XNameAccess { static protected XSimpleFileAccess m_xSFA; protected XComponentContext m_xCtx; private ParcelContainer parent = null; - private Collection<ParcelContainer> childContainers = new + private final Collection<ParcelContainer> childContainers = new ArrayList<ParcelContainer>(10); private boolean isPkgContainer = false; diff --git a/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java b/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java index b7817a7deea9..b6db2397ce40 100644 --- a/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java +++ b/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java @@ -54,7 +54,7 @@ public class ParcelDescriptor { private Document document = null; private String language = null; - private Map<String, String> languagedepprops = new HashMap<String, String>(3); + private final Map<String, String> languagedepprops = new HashMap<String, String>(3); public ParcelDescriptor() throws IOException { ByteArrayInputStream bis = null; diff --git a/scripting/java/com/sun/star/script/framework/container/ScriptMetaData.java b/scripting/java/com/sun/star/script/framework/container/ScriptMetaData.java index d19928fa445e..edca57b23286 100644 --- a/scripting/java/com/sun/star/script/framework/container/ScriptMetaData.java +++ b/scripting/java/com/sun/star/script/framework/container/ScriptMetaData.java @@ -38,9 +38,9 @@ import java.util.StringTokenizer; public class ScriptMetaData extends ScriptEntry { private boolean hasSource = false; - private String locationPlaceHolder = ""; + private final String locationPlaceHolder = ""; private String source; - private Parcel parent; + private final Parcel parent; public ScriptMetaData(Parcel parent, ScriptEntry entry, diff --git a/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java b/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java index 64269f3dd740..ec22608f31f7 100644 --- a/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java +++ b/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java @@ -38,10 +38,9 @@ import java.util.Map; public class UnoPkgContainer extends ParcelContainer { - private Map<String, ParcelContainer> registeredPackages = new - HashMap<String, ParcelContainer>(); - private String extensionDb; - private String extensionRepository; + private final Map<String, ParcelContainer> registeredPackages = new HashMap<String, ParcelContainer>(); + private final String extensionDb; + private final String extensionRepository; public UnoPkgContainer(XComponentContext xCtx, String locationURL, String _extensionDb, String _extensionRepository, diff --git a/scripting/java/com/sun/star/script/framework/container/XMLParserFactory.java b/scripting/java/com/sun/star/script/framework/container/XMLParserFactory.java index 0e25745a1b38..c34908f8c773 100644 --- a/scripting/java/com/sun/star/script/framework/container/XMLParserFactory.java +++ b/scripting/java/com/sun/star/script/framework/container/XMLParserFactory.java @@ -54,7 +54,7 @@ public class XMLParserFactory { private static class DefaultParser implements XMLParser { - private DocumentBuilderFactory factory; + private final DocumentBuilderFactory factory; public DefaultParser() { factory = DocumentBuilderFactory.newInstance(); diff --git a/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java b/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java index 3c27b0367d38..e7c6fdb15236 100644 --- a/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java +++ b/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java @@ -46,9 +46,8 @@ public class UCBStreamHandler extends URLStreamHandler { public final static String separator = "/ucb/"; - private XSimpleFileAccess m_xSimpleFileAccess = null; - private HashMap<String, InputStream> m_jarStreamMap = new - HashMap<String, InputStream>(12); + private final XSimpleFileAccess m_xSimpleFileAccess; + private final HashMap<String, InputStream> m_jarStreamMap = new HashMap<String, InputStream>(12); private static String m_ucbscheme; public UCBStreamHandler(String scheme, XSimpleFileAccess xSFA) { diff --git a/scripting/java/com/sun/star/script/framework/io/XInputStreamImpl.java b/scripting/java/com/sun/star/script/framework/io/XInputStreamImpl.java index 90766c51c553..a6c5d69d7941 100644 --- a/scripting/java/com/sun/star/script/framework/io/XInputStreamImpl.java +++ b/scripting/java/com/sun/star/script/framework/io/XInputStreamImpl.java @@ -25,7 +25,7 @@ import java.io.InputStream; public class XInputStreamImpl implements XInputStream { - private InputStream is; + private final InputStream is; public XInputStreamImpl(InputStream is) { this.is = is; diff --git a/scripting/java/com/sun/star/script/framework/io/XInputStreamWrapper.java b/scripting/java/com/sun/star/script/framework/io/XInputStreamWrapper.java index 10cb1db52888..654f0e24c01e 100644 --- a/scripting/java/com/sun/star/script/framework/io/XInputStreamWrapper.java +++ b/scripting/java/com/sun/star/script/framework/io/XInputStreamWrapper.java @@ -24,7 +24,7 @@ import java.io.InputStream; public class XInputStreamWrapper extends InputStream { - private XInputStream m_xInputStream; + private final XInputStream m_xInputStream; public XInputStreamWrapper(XInputStream xInputStream) { m_xInputStream = xInputStream; diff --git a/scripting/java/com/sun/star/script/framework/io/XOutputStreamWrapper.java b/scripting/java/com/sun/star/script/framework/io/XOutputStreamWrapper.java index 542fb0ae9422..16357fd17017 100644 --- a/scripting/java/com/sun/star/script/framework/io/XOutputStreamWrapper.java +++ b/scripting/java/com/sun/star/script/framework/io/XOutputStreamWrapper.java @@ -24,7 +24,7 @@ import java.io.OutputStream; public class XOutputStreamWrapper extends OutputStream { - private XOutputStream m_xOutputStream; + private final XOutputStream m_xOutputStream; public XOutputStreamWrapper(XOutputStream xOs) { this.m_xOutputStream = xOs; diff --git a/scripting/java/com/sun/star/script/framework/provider/EditorScriptContext.java b/scripting/java/com/sun/star/script/framework/provider/EditorScriptContext.java index c6165818b6b7..d107edcc74c6 100644 --- a/scripting/java/com/sun/star/script/framework/provider/EditorScriptContext.java +++ b/scripting/java/com/sun/star/script/framework/provider/EditorScriptContext.java @@ -29,8 +29,8 @@ import com.sun.star.uno.XComponentContext; public class EditorScriptContext implements XScriptContext { - private XDesktop m_xDeskTop; - private XComponentContext m_xComponentContext; + private final XDesktop m_xDeskTop; + private final XComponentContext m_xComponentContext; public EditorScriptContext(XComponentContext xmComponentContext, XDesktop xDesktop) { diff --git a/scripting/java/com/sun/star/script/framework/provider/ScriptContext.java b/scripting/java/com/sun/star/script/framework/provider/ScriptContext.java index 19f8bfc1080f..ab01797b9ccd 100644 --- a/scripting/java/com/sun/star/script/framework/provider/ScriptContext.java +++ b/scripting/java/com/sun/star/script/framework/provider/ScriptContext.java @@ -44,12 +44,12 @@ public class ScriptContext extends PropertySet implements XScriptContext { private final static String DOC_URI = "SCRIPTING_DOC_URI"; - private XModel m_xModel = null; - private XScriptInvocationContext m_xInvocationContext = null; + private final XModel m_xModel; + private final XScriptInvocationContext m_xInvocationContext; - private XDesktop m_xDeskTop = null; + private final XDesktop m_xDeskTop; - private XComponentContext m_xComponentContext = null; + private final XComponentContext m_xComponentContext; private ScriptContext(XComponentContext xmComponentContext, XDesktop xDesktop, XModel xModel, XScriptInvocationContext xInvocContext) { diff --git a/scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java b/scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java index d639e3669433..4d97d43c4718 100644 --- a/scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java +++ b/scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java @@ -34,7 +34,7 @@ import javax.swing.event.DocumentListener; public class PlainSourceView extends JScrollPane implements ScriptSourceView, DocumentListener { - private ScriptSourceModel model; + private final ScriptSourceModel model; private JTextArea ta; private GlyphGutter gg; private int linecount; @@ -144,7 +144,7 @@ public class PlainSourceView extends JScrollPane implements class GlyphGutter extends JComponent { - private PlainSourceView view; + private final PlainSourceView view; private static final String DUMMY_STRING = "99"; GlyphGutter(PlainSourceView view) { diff --git a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptProviderForBeanShell.java b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptProviderForBeanShell.java index 424c25969c37..8b02bd316d03 100644 --- a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptProviderForBeanShell.java +++ b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptProviderForBeanShell.java @@ -126,11 +126,11 @@ public class ScriptProviderForBeanShell { class ScriptImpl implements XScript { - private ScriptMetaData metaData; - private XComponentContext m_xContext; + private final ScriptMetaData metaData; + private final XComponentContext m_xContext; private XMultiComponentFactory m_xMultiComponentFactory; - private XModel m_xModel; - private XScriptInvocationContext m_xInvocContext; + private final XModel m_xModel; + private final XScriptInvocationContext m_xInvocContext; ScriptImpl(XComponentContext ctx, ScriptMetaData metaData, XModel xModel, XScriptInvocationContext xContext) throws diff --git a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptSourceModel.java b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptSourceModel.java index 67041ff2cdb8..165f00844d70 100644 --- a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptSourceModel.java +++ b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptSourceModel.java @@ -27,7 +27,7 @@ import java.net.URL; public class ScriptSourceModel { private int currentPosition = -1; - private URL file = null; + private final URL file; private ScriptSourceView view = null; public ScriptSourceModel(URL file) { diff --git a/scripting/java/com/sun/star/script/framework/provider/java/ScriptDescriptor.java b/scripting/java/com/sun/star/script/framework/provider/java/ScriptDescriptor.java index 1ca7cb540d00..ff56564b20df 100644 --- a/scripting/java/com/sun/star/script/framework/provider/java/ScriptDescriptor.java +++ b/scripting/java/com/sun/star/script/framework/provider/java/ScriptDescriptor.java @@ -27,11 +27,11 @@ import java.util.StringTokenizer; */ public class ScriptDescriptor { - private String m_name; - private String m_methodName; - private String m_className; + private final String m_name; + private final String m_methodName; + private final String m_className; private List<String> m_classpath; - private ArrayList<Class<?>> m_argumentTypes = new ArrayList<Class<?>>(11); + private final ArrayList<Class<?>> m_argumentTypes = new ArrayList<Class<?>>(11); /** * Constructs a ScriptDescriptor for the given name diff --git a/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java b/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java index a27b5e9755c4..fb18d34aadd3 100644 --- a/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java +++ b/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java @@ -52,7 +52,7 @@ public class ScriptProviderForJava { public static class _ScriptProviderForJava extends ScriptProvider { - private Resolver m_resolutionPolicy = new StrictResolver(); + private final Resolver m_resolutionPolicy = new StrictResolver(); public _ScriptProviderForJava(XComponentContext ctx) { super(ctx, "Java"); @@ -126,12 +126,12 @@ public class ScriptProviderForJava { class ScriptImpl implements XScript { - private ScriptMetaData metaData; - private XComponentContext m_xContext; - private XModel m_xModel; - private XScriptInvocationContext m_xInvocContext; + private final ScriptMetaData metaData; + private final XComponentContext m_xContext; + private final XModel m_xModel; + private final XScriptInvocationContext m_xInvocContext; private XMultiComponentFactory m_xMultiComponentFactory; - private Resolver m_resolutionPolicy; + private final Resolver m_resolutionPolicy; ScriptImpl(XComponentContext ctx, Resolver resolver, ScriptMetaData metaData, XModel xModel, XScriptInvocationContext xInvocContext) throws diff --git a/scripting/java/com/sun/star/script/framework/provider/java/ScriptProxy.java b/scripting/java/com/sun/star/script/framework/provider/java/ScriptProxy.java index e8ab74b4fb9b..921b282cc939 100644 --- a/scripting/java/com/sun/star/script/framework/provider/java/ScriptProxy.java +++ b/scripting/java/com/sun/star/script/framework/provider/java/ScriptProxy.java @@ -28,7 +28,7 @@ import java.lang.reflect.Method; public class ScriptProxy { private Object m_targetObject; - private Method m_method; + private final Method m_method; /** * Constructs a <code>ScriptProxy</code> object for the given diff --git a/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptEditorForJavaScript.java b/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptEditorForJavaScript.java index 4fb29852d303..41ab77c1879b 100644 --- a/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptEditorForJavaScript.java +++ b/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptEditorForJavaScript.java @@ -296,7 +296,7 @@ public class ScriptEditorForJavaScript implements ScriptEditor { private class closeHandler implements Runnable { - private URL url; + private final URL url; private closeHandler(URL url) { this.url = url; diff --git a/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java b/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java index 25edc0f851dd..a2f78916a1b8 100644 --- a/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java +++ b/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java @@ -121,11 +121,11 @@ public class ScriptProviderForJavaScript { class ScriptImpl implements XScript { - private ScriptMetaData metaData; - private XComponentContext m_xContext; + private final ScriptMetaData metaData; + private final XComponentContext m_xContext; private XMultiComponentFactory m_xMultiComponentFactory; - private XModel m_xModel; - private XScriptInvocationContext m_xInvocContext; + private final XModel m_xModel; + private final XScriptInvocationContext m_xInvocContext; ScriptImpl(XComponentContext ctx, ScriptMetaData metaData, XModel xModel, XScriptInvocationContext xInvocContext) throws |