enable unchecked lint for our java code
and annotate where necessary, mostly just suppressing the warnings Change-Id: I8e39d797cde6c7c3f4e3e1bd93a128965ecec81d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159205 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
b4cbd33588
commit
eee1ff9651
20 changed files with 29 additions and 11 deletions
|
@ -139,7 +139,7 @@ public final class JNI_proxy implements java.lang.reflect.InvocationHandler
|
|||
public static java.lang.reflect.Constructor get_proxy_ctor( Class clazz )
|
||||
throws Throwable
|
||||
{
|
||||
Class proxy_class = java.lang.reflect.Proxy.getProxyClass(
|
||||
Class<?> proxy_class = java.lang.reflect.Proxy.getProxyClass(
|
||||
s_classloader,
|
||||
new Class [] { clazz, IQueryInterface.class,
|
||||
com.sun.star.lib.uno.Proxy.class } );
|
||||
|
|
|
@ -174,6 +174,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
|
|||
};
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void dispose()
|
||||
{
|
||||
final EventObject event = new EventObject(this);
|
||||
|
|
|
@ -365,7 +365,7 @@ public class RowSet extends TestCase
|
|||
m_rowSet.addRowSetListener(pRow);
|
||||
|
||||
// do some movements to check if we got all notifications
|
||||
final Class cResSet = Class.forName("com.sun.star.sdbc.XResultSet");
|
||||
final Class<?> cResSet = Class.forName("com.sun.star.sdbc.XResultSet");
|
||||
final boolean moves[] = new boolean[9];
|
||||
for (int i = 0; i < moves.length; ++i)
|
||||
{
|
||||
|
@ -399,7 +399,7 @@ public class RowSet extends TestCase
|
|||
testCursorMove(m_resultSet, cResSet.getMethod(NEXT, (Class[]) null), pRow, moves, null);
|
||||
|
||||
moves[RowSetEventListener.IS_MODIFIED] = false;
|
||||
final Class cupd = Class.forName("com.sun.star.sdbc.XResultSetUpdate");
|
||||
final Class<?> cupd = Class.forName("com.sun.star.sdbc.XResultSetUpdate");
|
||||
final XResultSetUpdate upd = UnoRuntime.queryInterface( XResultSetUpdate.class, m_resultSet );
|
||||
testCursorMove(upd, cupd.getMethod("moveToInsertRow", (Class[]) null), pRow, moves, null);
|
||||
|
||||
|
@ -445,7 +445,7 @@ public class RowSet extends TestCase
|
|||
moves[RowSetEventListener.COLUMN_VALUE] = true;
|
||||
moves[RowSetEventListener.CURSOR_MOVED] = true;
|
||||
|
||||
final Class cloc = Class.forName("com.sun.star.sdbcx.XRowLocate");
|
||||
final Class<?> cloc = Class.forName("com.sun.star.sdbcx.XRowLocate");
|
||||
m_resultSet.first();
|
||||
final Object bookmark = m_rowLocate.getBookmark();
|
||||
m_resultSet.next();
|
||||
|
@ -470,7 +470,7 @@ public class RowSet extends TestCase
|
|||
moves[RowSetEventListener.APPROVE_ROW_CHANGE] = true;
|
||||
moves[RowSetEventListener.ROW_CHANGED] = true;
|
||||
moves[RowSetEventListener.ROW_COUNT] = true;
|
||||
final Class cdelRows = Class.forName("com.sun.star.sdbcx.XDeleteRows");
|
||||
final Class<?> cdelRows = Class.forName("com.sun.star.sdbcx.XDeleteRows");
|
||||
ctemp[0] = Object[].class;
|
||||
final XDeleteRows delRows = UnoRuntime.queryInterface( XDeleteRows.class, m_resultSet );
|
||||
final Object bookmarks[] = new Object[5];
|
||||
|
|
|
@ -81,7 +81,7 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
|
|||
String realValue = null;
|
||||
try
|
||||
{
|
||||
final Class composerClass = m_composer.getClass();
|
||||
final Class<?> composerClass = m_composer.getClass();
|
||||
final Method attributeGetter = composerClass.getMethod("get" + _attributeName, new Class[]
|
||||
{
|
||||
});
|
||||
|
|
|
@ -119,7 +119,7 @@ public abstract class TestCase
|
|||
private void assureException( final String _message, final Object _object, final String _methodName,
|
||||
final Class[] _argClasses, final Object[] _methodArgs, final Class _expectedExceptionClass )
|
||||
{
|
||||
Class objectClass = _object.getClass();
|
||||
Class<?> objectClass = _object.getClass();
|
||||
|
||||
boolean noExceptionAllowed = ( _expectedExceptionClass == null );
|
||||
|
||||
|
|
|
@ -626,6 +626,7 @@ public class InterfaceContainer_Test
|
|||
it.previous();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test public void ListIterator_add() throws Exception
|
||||
{
|
||||
logger.log(Level.INFO, "Testing ListIterator.add()");
|
||||
|
|
|
@ -1077,6 +1077,7 @@ public class ValueChanger {
|
|||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T> T copyStruct(T value) {
|
||||
Class<T> clazz = (Class<T>) value.getClass();
|
||||
T newValue;
|
||||
|
|
|
@ -73,7 +73,8 @@ public class _XFastPropertySet extends MultiMethodTest {
|
|||
/**
|
||||
* Retrieves relation.
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected void before() {
|
||||
exclude = (Set<String>) tEnv.getObjRelation("XFastPropertySet.ExcludeProps") ;
|
||||
if (exclude == null) {
|
||||
|
|
|
@ -78,6 +78,7 @@ public class _XMultiPropertySet extends MultiMethodTest {
|
|||
/**
|
||||
* Initializes some fields.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void before() {
|
||||
exclProps = (Set<String>) tEnv.getObjRelation("XMultiPropertySet.ExcludeProps");
|
||||
|
|
|
@ -76,12 +76,12 @@ public class _XDataInputStream extends MultiMethodTest {
|
|||
* data of different types and fills the appropriate variables.
|
||||
* @throws StatusException If one of relations not found.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void before(){
|
||||
|
||||
XInterface x = (XInterface)tEnv.getObjRelation("StreamWriter") ;
|
||||
oStream = UnoRuntime.queryInterface(
|
||||
XDataOutputStream.class, x);
|
||||
oStream = UnoRuntime.queryInterface(XDataOutputStream.class, x);
|
||||
List<Object> data = (List<Object>) tEnv.getObjRelation("StreamData") ;
|
||||
if (data == null || oStream == null) {
|
||||
throw new StatusException(Status.failed("Object relation not found."));
|
||||
|
|
|
@ -56,6 +56,7 @@ public class _XDataOutputStream extends MultiMethodTest {
|
|||
* If relation or data of some type in stream not found then
|
||||
* tests of corresponding methods are skipped.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void before() throws RuntimeException {
|
||||
|
||||
|
|
|
@ -99,6 +99,7 @@ public class _XParameters extends MultiMethodTest {
|
|||
/**
|
||||
* Gets object relation
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void before() {
|
||||
data = (List<Object>) tEnv.getObjRelation("XParameters.ParamValues") ;
|
||||
|
|
|
@ -100,6 +100,7 @@ public class _XRow extends MultiMethodTest {
|
|||
/**
|
||||
* Retrieves object relation first.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void before() {
|
||||
data = (List<Object>) tEnv.getObjRelation("CurrentRowData") ;
|
||||
|
|
|
@ -99,6 +99,7 @@ public class _XRowUpdate extends MultiMethodTest {
|
|||
/**
|
||||
* Gets relations.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void before() {
|
||||
rowData = (List<Object>) tEnv.getObjRelation("CurrentRowData") ;
|
||||
|
|
|
@ -54,6 +54,7 @@ public class _XMultiSelectionSupplier extends MultiMethodTest {
|
|||
Object[] selections = null;
|
||||
Comparator<Object> ObjCompare = null;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected void before() {
|
||||
selections = (Object[])tEnv.getObjRelation("Selections");
|
||||
|
|
|
@ -53,6 +53,7 @@ public class _XSelectionSupplier extends MultiMethodTest {
|
|||
Object[] selections = null;
|
||||
Comparator<Object> ObjCompare = null;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected void before() {
|
||||
selections = (Object[])tEnv.getObjRelation("Selections");
|
||||
|
|
|
@ -165,6 +165,7 @@ public final class WeakMap<K,V> implements Map {
|
|||
* @return previous value associated with the specified key, or
|
||||
* <code>null</code> if there was no mapping for the key
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object /*WeakReference<V>*/ put(/*K*/ Object key, /*V*/ Object value) {
|
||||
cleanUp();
|
||||
return map.put((K) key, new Entry<K,V>((K) key, (V) value, queue));
|
||||
|
@ -193,6 +194,7 @@ public final class WeakMap<K,V> implements Map {
|
|||
* must be plain objects, which are then wrapped in instances of
|
||||
* <code>WeakReference</code>.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void putAll(Map/*<K,V>*/ m) {
|
||||
cleanUp();
|
||||
for (Iterator<Map.Entry<K,V>> i = m.entrySet().iterator(); i.hasNext();) {
|
||||
|
@ -267,6 +269,7 @@ public final class WeakMap<K,V> implements Map {
|
|||
* @return the referent of the specified <code>WeakReference</code>, or
|
||||
* <code>null</code> if <code>ref</code> is <code>null</code>
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T getValue(Object /*WeakReference<T>*/ ref) {
|
||||
return ref == null ? null : ((WeakReference<T>) ref).get();
|
||||
}
|
||||
|
@ -277,6 +280,7 @@ public final class WeakMap<K,V> implements Map {
|
|||
* (Specifically, iterating over the collections returned by those
|
||||
* methods), as non-modifying methods might modify the underlying map.
|
||||
**/
|
||||
@SuppressWarnings("unchecked")
|
||||
private void cleanUp() {
|
||||
for (;;) {
|
||||
Entry<K,V> e = (Entry<K,V>) queue.poll();
|
||||
|
|
|
@ -1384,6 +1384,7 @@ public class UndoManager
|
|||
return new String[] { getCallbackComponentServiceName() };
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void dispose()
|
||||
{
|
||||
final EventObject event = new EventObject( this );
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
gb_JavaClassSet_JAVACCOMMAND = $(ICECREAM_RUN) $(JAVACOMPILER) $(JAVACFLAGS) \
|
||||
-encoding utf8 \
|
||||
--release $(1) \
|
||||
-Xlint:-options
|
||||
-Xlint:-options \
|
||||
-Xlint:unchecked
|
||||
|
||||
gb_JavaClassSet_JAVACDEBUG :=
|
||||
|
||||
|
|
|
@ -375,6 +375,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
|
|||
/** Notifies all registered listeners about the event.
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private void fireItemSelected()
|
||||
{
|
||||
java.util.ArrayList<XItemListener> list;
|
||||
|
|
Loading…
Reference in a new issue