Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3555

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/55/3555/1

Java cleanup - static fields that should not be static

Somebody appears to have been confused about the purpose of static
in Java.
These are instance fields and should therefore not be static.

Also reduce the visibility of some methods and fields.

Change-Id: I0b5875b6cbd91ee89823e2058b87c1087dc5c92e
---
M qadevOOo/runner/lib/TestCase.java
M qadevOOo/runner/lib/TestEnvironment.java
M qadevOOo/tests/java/mod/_forms/GenericModelTest.java
3 files changed, 31 insertions(+), 48 deletions(-)



diff --git a/qadevOOo/runner/lib/TestCase.java b/qadevOOo/runner/lib/TestCase.java
index 0477ebe..a4895f1 100644
--- a/qadevOOo/runner/lib/TestCase.java
+++ b/qadevOOo/runner/lib/TestCase.java
@@ -19,8 +19,8 @@
 package lib;
 
 import java.io.PrintWriter;
-
 import lib.TestParameters;
+
 /**
  * <code>TestCase</code> represent a factory for <code>TestEnvironment</code>s
  * creation and disposing for a given implementation object. The
@@ -49,9 +49,7 @@
     /**
      * Specifies the PrintWriter to log information.
      */
-    public PrintWriter log;
-
-    //public static TestCase tCase;
+    protected PrintWriter log;
 
     /**
      * Sets the log to write information during testing.
@@ -66,7 +64,7 @@
      *
      * @param tParam test parameters.
      */
-    public void initializeTestCase( TestParameters tParam ) {
+    public final void initializeTestCase( TestParameters tParam ) {
         initialize( tParam, log );
     }
 
@@ -89,7 +87,7 @@
      *
      * @param tParam test parameters
      */
-    public void cleanupTestCase( TestParameters tParam ) {
+    public final void cleanupTestCase( TestParameters tParam ) {
         cleanup( tParam, log );
     }
 
diff --git a/qadevOOo/runner/lib/TestEnvironment.java b/qadevOOo/runner/lib/TestEnvironment.java
index 7c9b3d7..ba00770 100644
--- a/qadevOOo/runner/lib/TestEnvironment.java
+++ b/qadevOOo/runner/lib/TestEnvironment.java
@@ -98,18 +98,6 @@
     }
 
     /**
-     * Checks if an auxiliary object has been registered with name
-     *
-     * @param name a name referencing an auxiliarx object
-     *
-     * @return <tt>true</tt> if the object has been associated, <tt>false</tt>
-     * otherwise.
-     */
-    public boolean hasObjRelation(String name) {
-        return (relations.get(name) != null) ;
-    }
-
-    /**
      * Sets the <code>TestCase</code> that created the environment.
      */
     public void setTestCase( TestCase tCase) {
diff --git a/qadevOOo/tests/java/mod/_forms/GenericModelTest.java 
b/qadevOOo/tests/java/mod/_forms/GenericModelTest.java
index 2bf33f6..92bdf1d 100644
--- a/qadevOOo/tests/java/mod/_forms/GenericModelTest.java
+++ b/qadevOOo/tests/java/mod/_forms/GenericModelTest.java
@@ -124,26 +124,26 @@
 * @see ifc.container._XChild
 */
 public class GenericModelTest extends TestCase {
-    private static XTextDocument m_xTextDoc;
-    private static Object m_dbSrc = null;
-    private static DBTools.DataSourceInfo m_srcInf = null;
+    private XTextDocument m_xTextDoc;
+    private Object m_dbSrc = null;
+    private DBTools.DataSourceInfo m_srcInf = null;
     /**
      * This is the name of the Data Base which the test uses: "APITestDatabase"
      */
-    protected final static String m_dbSourceName = "APITestDatabase";
-    protected final static String m_TestDB = "TestDB";
+    private final static String m_dbSourceName = "APITestDatabase";
+    private final static String m_TestDB = "TestDB";
     private DBTools m_dbTools = null;
 
-    private static boolean m_ConnectionColsed = false;
+    private boolean m_ConnectionColsed = false;
 
     /**
-     * descibes the kind of the shape which should be created.
+     * describes the kind of the shape which should be created.
      * Example: m_kindOfshape=DateFiled
      */
-    public static String m_kindOfControl = null;
+    protected String m_kindOfControl = null;
 
     /**
-     * If your object needs some special propery values you can specify them with this
+     * If your object needs some special property values you can specify them with this
      * <CODE>ArrayList</CODE>. You have to add a <CODE>NamedValue</CODE> to this list.
      * Example:
      * NamedValue myProp = new NamedValue();
@@ -151,7 +151,7 @@
      * myProp.Value = "My special Value";
      * m_propertiesToSet.add(myProp);
      */
-    public static ArrayList<NamedValue> m_propertiesToSet = new ArrayList<NamedValue>();
+    protected ArrayList<NamedValue> m_propertiesToSet = new ArrayList<NamedValue>();
 
     /**
      * This variable contains the name of the property which should be changed while
@@ -161,56 +161,53 @@
      * @see ifc.form._XUpdateBroadcaster.UpdateChecker
      * @see ifc.form._XUpdateBroadcaster
      */
-    public static String m_ChangePropertyName = null;
+    protected String m_ChangePropertyName = null;
     /**
      * This variable contains the value the property should be set while
      * interface <CODE>com::sun::star::form::XUpdateBroadcaster</CODE> is tested.
      * The interface test needs the <CODE>ObjectRelation</CODE>
      * "XUpdateBroadcaster.Checker" which is a 
<CODE>ifc.form._XUpdateBroadcaster.UpdateChecker</CODE>.
-     * Normaly the <CODE>Checker</CODE> uses <CODE>util.ValueChanger</CODE> to change
+     * Normally the <CODE>Checker</CODE> uses <CODE>util.ValueChanger</CODE> to change
      * the value of the property. If the current of this property is NULL the
      * <CODE>ValueChanger</CODE> is unable to change the value. In this case the value
      * of this variable was used.
      */
-    public static Object m_ChangePropertyValue = null;
+    protected Object m_ChangePropertyValue = null;
 
     /**
-     * This variable contains the implelemtation name of the object.
+     * This variable contains the implementation name of the object.
      */
-    public static String m_ObjectName = null;
+    protected String m_ObjectName = null;
 
     /**
-     * For local implementaions of <CODE>Checker</CODE> this variable contains the
+     * For local implementations of <CODE>Checker</CODE> this variable contains the
      * <CODE>FormLoader</CODE>
      */
-    protected static XLoadable m_XFormLoader = null;
+    protected XLoadable m_XFormLoader = null;
     /**
-     * For local implementaions of <CODE>Checker</CODE> this variable contains the
+     * For local implementations of <CODE>Checker</CODE> this variable contains the
      * <CODE>XPropertySet</CODE>
      */
-    protected static XPropertySet m_XPS = null;
+    protected XPropertySet m_XPS = null;
     /**
-     * For local implementaions of <CODE>Checker</CODE> this variable contains the
+     * For local implementations of <CODE>Checker</CODE> this variable contains the
      * <CODE>Control</CODE>
      */
-    protected static XInterface m_XCtrl = null;
+    protected XInterface m_XCtrl = null;
     /**
-     * The insterface test of <CODE>ifc.form._DataWareControlModel</CODE> expects an
+     * The interface test of <CODE>ifc.form._DataWareControlModel</CODE> expects an
      * object relation <CODE>'LC'</CODE>. This is a <CODE>XControlModel</CODE> of a shape.
      * This variable contains the kind of shape to create for the interface test,
      * f.e. "FixedText"
      * @see ifc.form._DataAwareControlModel
      */
-    protected static String m_LCShape_Type = null;
+    protected String m_LCShape_Type = null;
 
-    protected static String m_XPropertyAccess_propertyToChange = "HelpText";
-
-    protected static String m_XPropertyContainer_propertyNotRemovable = "HelpText";
     /**
-     * If this variable is true some more debug info was logged. It was setted by the parameter 
variable
+     * If this variable is true some more debug info was logged. It was set by the parameter 
variable
      * <code>debug_is_active</code>
      */
-    protected static boolean debug = false;
+    private boolean debug = false;
 
     /**
      * Creates Writer document where controls are placed.
@@ -484,10 +481,10 @@
         tEnv.addObjRelation("XFastPropertySet.ExcludeProps", exclude);
 
         PropertyValue propVal = new PropertyValue();
-        propVal.Name = m_XPropertyAccess_propertyToChange;
+        propVal.Name = "HelpText";
         propVal.Value = "Text since XPropertyAccess";
         tEnv.addObjRelation("XPropertyAccess.propertyToChange", propVal);
-        tEnv.addObjRelation("XPropertyContainer.propertyNotRemovable", 
m_XPropertyContainer_propertyNotRemovable);
+        tEnv.addObjRelation("XPropertyContainer.propertyNotRemovable", "HelpText");
 
 
         return tEnv;

-- 
To view, visit https://gerrit.libreoffice.org/3555
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0b5875b6cbd91ee89823e2058b87c1087dc5c92e
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Noel Grandin <noelgrandin@gmail.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.