Java5 update - convert to use generics and new Collections classes

Change-Id: Ibe51b5c8d4065c88cd6bae8cddb42a9b6117312a
This commit is contained in:
Noel Grandin
2012-06-27 16:51:04 +02:00
committed by Michael Stahl
parent b707a707aa
commit d137d6ac1d
5 changed files with 27 additions and 33 deletions

View File

@@ -59,7 +59,6 @@ public class AccessibleStatusBarItem {
/**
* Sleeps for a certain time.
* @param Thread is sleeping for this time in milliseconds.
*/
private void shortWait() {
try {

View File

@@ -46,9 +46,9 @@ public class Assert
* it means that <em>no</em> exception must be throw by invoking the method.
*/
public static void assertException( final String i_message, final Object i_object, final String i_methodName,
final Class[] i_argClasses, final Object[] i_methodArgs, final Class i_expectedExceptionClass )
final Class<?>[] i_argClasses, final Object[] i_methodArgs, final Class<?> i_expectedExceptionClass )
{
Class objectClass = i_object.getClass();
Class<?> objectClass = i_object.getClass();
boolean noExceptionAllowed = ( i_expectedExceptionClass == null );
@@ -88,11 +88,11 @@ public class Assert
/**
* retrieves a method, given by name and parameter signature, from the given class
*
* The method does somewhat more than simply calling {@link Class.getMethod}. In particular, it recognizes
* The method does somewhat more than simply calling {@link Class#getMethod}. In particular, it recognizes
* primitiive parameter types, and attempts to find a method taking the given primitive type, instead of the
* type represented by the parameter class.
*
* For instance, if you have a method <code>foo( int )</code>, {@link Class.getMethod} would not return this
* For instance, if you have a method <code>foo( int )</code>, {@link Class#getMethod} would not return this
* method when you pass <code>Integer.class</code>. <code>impl_getMethod</code> will recognize this, and
* properly retrieve the method.
*
@@ -100,12 +100,12 @@ public class Assert
* and non-primitive types. That is, a method like <code>foo( int, Integer, int )</code> is likely to not be
* found.
*
* @param i_obbjectClass
* @param i_objectClass
* @param i_methodName
* @param i_argClasses
* @return
*/
private static Method impl_getMethod( final Class i_objectClass, final String i_methodName, final Class[] i_argClasses ) throws NoSuchMethodException
private static Method impl_getMethod( final Class<?> i_objectClass, final String i_methodName, final Class<?>[] i_argClasses ) throws NoSuchMethodException
{
try
{
@@ -117,7 +117,7 @@ public class Assert
int substitutedTypes = 0;
int substitutedTypesLastRound = 0;
final Class[][] substitutionTable = new Class[][] {
final Class<?>[][] substitutionTable = new Class[][] {
new Class[] { Long.class, long.class },
new Class[] { Integer.class, int.class },
new Class[] { Short.class, short.class },
@@ -129,7 +129,7 @@ public class Assert
do
{
substitutedTypes = 0;
final Class[] argClasses = new Class[ i_argClasses.length ];
final Class<?>[] argClasses = new Class[ i_argClasses.length ];
for ( int i=0; i < argClasses.length; ++i )
{
argClasses[i] = i_argClasses[i];
@@ -172,9 +172,9 @@ public class Assert
* it means that <em>no</em> exception must be throw by invoking the method.
*/
public static void assertException( final String i_message, final Object i_object, final String i_methodName,
final Object[] i_methodArgs, final Class i_expectedExceptionClass )
final Object[] i_methodArgs, final Class<?> i_expectedExceptionClass )
{
Class[] argClasses = new Class[ i_methodArgs.length ];
Class<?>[] argClasses = new Class[ i_methodArgs.length ];
for ( int i=0; i<i_methodArgs.length; ++i )
argClasses[i] = i_methodArgs[i].getClass();
assertException( i_message, i_object, i_methodName, argClasses, i_methodArgs, i_expectedExceptionClass );
@@ -189,7 +189,7 @@ public class Assert
* it means that <em>no</em> exception must be throw by invoking the method.
*/
public static void assertException( final Object i_object, final String i_methodName, final Object[] i_methodArgs,
final Class i_expectedExceptionClass )
final Class<?> i_expectedExceptionClass )
{
assertException(
"did not catch the expected exception (" +
@@ -206,8 +206,8 @@ public class Assert
* @param i_expectedExceptionClass is the class of the exception to be caught. If this is null,
* it means that <em>no</em> exception must be throw by invoking the method.
*/
public static void assertException( final Object i_object, final String i_methodName, final Class[] i_argClasses,
final Object[] i_methodArgs, final Class i_expectedExceptionClass )
public static void assertException( final Object i_object, final String i_methodName, final Class<?>[] i_argClasses,
final Object[] i_methodArgs, final Class<?> i_expectedExceptionClass )
{
assertException(
"did not catch the expected exception (" +
@@ -217,8 +217,8 @@ public class Assert
}
// --------------------------------------------------------------------------------------------------------
public static void assertException( Object i_object, Class _unoInterfaceClass, String i_methodName, Object[] i_methodArgs,
Class i_expectedExceptionClass )
public static void assertException( Object i_object, Class<?> _unoInterfaceClass, String i_methodName, Object[] i_methodArgs,
Class<?> i_expectedExceptionClass )
{
assertException( UnoRuntime.queryInterface( _unoInterfaceClass, i_object ), i_methodName,
i_methodArgs, i_expectedExceptionClass );

View File

@@ -365,9 +365,9 @@ public class GridControl
for ( boolean ascending : new boolean[] { true, false } )
{
m_dataModel.sortByColumn( colIndex, ascending );
Pair currentSortOrder = m_dataModel.getCurrentSortOrder();
assertEquals( "invalid current sort column (column " + colIndex + ")", ((Integer)currentSortOrder.First).intValue(), colIndex );
assertEquals( "invalid current sort direction", ((Boolean)currentSortOrder.Second).booleanValue(), ascending );
Pair<Integer,Boolean> currentSortOrder = m_dataModel.getCurrentSortOrder();
assertEquals( "invalid current sort column (column " + colIndex + ")", currentSortOrder.First.intValue(), colIndex );
assertEquals( "invalid current sort direction", currentSortOrder.Second.booleanValue(), ascending );
/*for ( int i=0; i<rowCount; ++i )
{
@@ -613,7 +613,7 @@ public class GridControl
private final XComponent m_component;
private boolean m_isDisposed;
};
}
// -----------------------------------------------------------------------------------------------------------------
private static final class ColumnModelListener implements XContainerListener
@@ -639,7 +639,6 @@ public class GridControl
public void disposing( EventObject eo )
{
m_isDisposed = true;
}
private List< ContainerEvent > assertExclusiveInsertionEvents()
@@ -668,13 +667,10 @@ public class GridControl
private List< ContainerEvent > getInsertionEvents() { return m_insertionEvents; }
private List< ContainerEvent > getRemovalEvents() { return m_removalEvents; }
final boolean isDisposed() { return m_isDisposed; }
private List< ContainerEvent > m_insertionEvents = new ArrayList< ContainerEvent >();
private List< ContainerEvent > m_removalEvents = new ArrayList< ContainerEvent >();
private List< ContainerEvent > m_replacementEvents = new ArrayList< ContainerEvent >();
private boolean m_isDisposed = false;
};
}
// -----------------------------------------------------------------------------------------------------------------
private static final OfficeConnection m_connection = new OfficeConnection();

View File

@@ -18,15 +18,16 @@
package complex.toolkit.accessibility;
import java.util.ArrayList;
import com.sun.star.accessibility.XAccessible;
import com.sun.star.accessibility.XAccessibleComponent;
import com.sun.star.accessibility.XAccessibleContext;
import com.sun.star.awt.Point;
import com.sun.star.awt.Rectangle;
import com.sun.star.awt.Size;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.accessibility.XAccessible;
import com.sun.star.accessibility.XAccessibleComponent;
import com.sun.star.accessibility.XAccessibleContext;
import com.sun.star.uno.XInterface;
import java.util.Vector;
/**
* Testing <code>com.sun.star.accessibility.XAccessibleComponent</code>
@@ -418,7 +419,7 @@ public class _XAccessibleComponent {
cnt = 50;
}
Vector childComp = new Vector();
ArrayList<XAccessibleComponent> childComp = new ArrayList<XAccessibleComponent>();
for (int i = 0; i < cnt; i++) {
try {
XAccessible child = xAccCon.getAccessibleChild(i);
@@ -430,8 +431,7 @@ public class _XAccessibleComponent {
} catch (com.sun.star.lang.IndexOutOfBoundsException e) {}
}
return (XAccessibleComponent[]) childComp.toArray
(new XAccessibleComponent[childComp.size()]);
return childComp.toArray(new XAccessibleComponent[childComp.size()]);
}
/**

View File

@@ -101,7 +101,6 @@ public class _XAccessibleEventBroadcaster {
/**
* c'tor
* @param object
* @param eventMessage
* @param window
*/
public _XAccessibleEventBroadcaster(XInterface object, XWindow window) {