HHH-5928 - Clean up compilation warnings
This commit is contained in:
parent
e6eb434f7b
commit
f7c3091381
|
@ -653,7 +653,7 @@ public final class Environment {
|
|||
|
||||
boolean getGeneratedKeysSupport;
|
||||
try {
|
||||
Statement.class.getMethod("getGeneratedKeys", null);
|
||||
Statement.class.getMethod("getGeneratedKeys", (Class[])null);
|
||||
getGeneratedKeysSupport = true;
|
||||
}
|
||||
catch (NoSuchMethodException nsme) {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.engine;
|
||||
|
||||
|
@ -42,7 +41,7 @@ public class UnsavedValueFactory {
|
|||
|
||||
private static Object instantiate(Constructor constructor) {
|
||||
try {
|
||||
return constructor.newInstance(null);
|
||||
return constructor.newInstance( (Object[]) null );
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new InstantiationException( "could not instantiate test object", constructor.getDeclaringClass(), e );
|
||||
|
|
|
@ -78,18 +78,18 @@ public final class SerializableProxy extends AbstractSerializableProxy {
|
|||
private Object readResolve() {
|
||||
try {
|
||||
HibernateProxy proxy = CGLIBLazyInitializer.getProxy(
|
||||
getEntityName(),
|
||||
persistentClass,
|
||||
interfaces,
|
||||
getIdentifierMethodName==null ?
|
||||
null :
|
||||
getIdentifierMethodClass.getDeclaredMethod(getIdentifierMethodName, null),
|
||||
setIdentifierMethodName==null ?
|
||||
null :
|
||||
setIdentifierMethodClass.getDeclaredMethod(setIdentifierMethodName, setIdentifierMethodParams),
|
||||
getEntityName(),
|
||||
persistentClass,
|
||||
interfaces,
|
||||
getIdentifierMethodName==null
|
||||
? null
|
||||
: getIdentifierMethodClass.getDeclaredMethod( getIdentifierMethodName, (Class[]) null ),
|
||||
setIdentifierMethodName==null
|
||||
? null
|
||||
: setIdentifierMethodClass.getDeclaredMethod(setIdentifierMethodName, setIdentifierMethodParams),
|
||||
componentIdType,
|
||||
getId(),
|
||||
null
|
||||
getId(),
|
||||
null
|
||||
);
|
||||
|
||||
setReadOnlyBeforeAttachedToSession( ( CGLIBLazyInitializer ) proxy.getHibernateLazyInitializer() );
|
||||
|
|
|
@ -78,13 +78,13 @@ public final class SerializableProxy extends AbstractSerializableProxy {
|
|||
getEntityName(),
|
||||
persistentClass,
|
||||
interfaces,
|
||||
getIdentifierMethodName==null ?
|
||||
null :
|
||||
getIdentifierMethodClass.getDeclaredMethod(getIdentifierMethodName, null),
|
||||
setIdentifierMethodName==null ?
|
||||
null :
|
||||
setIdentifierMethodClass.getDeclaredMethod(setIdentifierMethodName, setIdentifierMethodParams),
|
||||
componentIdType,
|
||||
getIdentifierMethodName==null
|
||||
? null
|
||||
: getIdentifierMethodClass.getDeclaredMethod( getIdentifierMethodName, (Class[]) null ),
|
||||
setIdentifierMethodName==null
|
||||
? null
|
||||
: setIdentifierMethodClass.getDeclaredMethod(setIdentifierMethodName, setIdentifierMethodParams),
|
||||
componentIdType,
|
||||
getId(),
|
||||
null
|
||||
);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,10 +20,10 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.transaction;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.transaction.TransactionManager;
|
||||
|
@ -36,15 +36,19 @@ import org.hibernate.HibernateException;
|
|||
*
|
||||
* @author Ludovic Orban
|
||||
*/
|
||||
@SuppressWarnings( {"UnusedDeclaration"})
|
||||
public class BTMTransactionManagerLookup implements TransactionManagerLookup {
|
||||
|
||||
private static final String TM_CLASS_NAME = "bitronix.tm.TransactionManagerServices";
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TransactionManager getTransactionManager(Properties props) throws HibernateException {
|
||||
try {
|
||||
Class clazz = Class.forName("bitronix.tm.TransactionManagerServices");
|
||||
return (TransactionManager) clazz.getMethod("getTransactionManager", null).invoke(null, null);
|
||||
final Class clazz = Class.forName( TM_CLASS_NAME );
|
||||
final Method method = clazz.getMethod( "getTransactionManager", (Class[]) null );
|
||||
return (TransactionManager) method.invoke( null, (Object[]) null );
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new HibernateException( "Could not obtain BTM transaction manager instance", e );
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,10 +20,10 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.transaction;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.transaction.TransactionManager;
|
||||
|
@ -36,15 +36,19 @@ import org.hibernate.HibernateException;
|
|||
*
|
||||
* @author Low Heng Sin
|
||||
*/
|
||||
@SuppressWarnings( {"UnusedDeclaration"})
|
||||
public class JOTMTransactionManagerLookup implements TransactionManagerLookup {
|
||||
|
||||
private static final String TM_CLASS_NAME = "org.objectweb.jotm.Current";
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TransactionManager getTransactionManager(Properties props) throws HibernateException {
|
||||
try {
|
||||
Class clazz = Class.forName("org.objectweb.jotm.Current");
|
||||
return (TransactionManager) clazz.getMethod("getTransactionManager", null).invoke(null, null);
|
||||
final Class clazz = Class.forName( TM_CLASS_NAME );
|
||||
final Method method = clazz.getMethod( "getTransactionManager", (Class[]) null );
|
||||
return (TransactionManager) method.invoke( null, (Object[]) null );
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new HibernateException( "Could not obtain JOTM transaction manager instance", e );
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,10 +20,10 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.transaction;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.transaction.TransactionManager;
|
||||
|
@ -34,15 +34,19 @@ import org.hibernate.HibernateException;
|
|||
/**
|
||||
* {@link TransactionManagerLookup} strategy for JOnAS
|
||||
*/
|
||||
@SuppressWarnings( {"UnusedDeclaration"})
|
||||
public class JOnASTransactionManagerLookup implements TransactionManagerLookup {
|
||||
|
||||
private static final String TM_CLASS_NAME = "org.objectweb.jonas_tm.Current";
|
||||
|
||||
/**
|
||||
* @see org.hibernate.transaction.TransactionManagerLookup#getTransactionManager(Properties)
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TransactionManager getTransactionManager(Properties props) throws HibernateException {
|
||||
try {
|
||||
Class clazz = Class.forName("org.objectweb.jonas_tm.Current");
|
||||
return (TransactionManager) clazz.getMethod("getTransactionManager", null).invoke(null, null);
|
||||
final Class clazz = Class.forName( TM_CLASS_NAME );
|
||||
final Method method = clazz.getMethod( "getTransactionManager", (Class[]) null );
|
||||
return (TransactionManager) method.invoke( null, (Object[]) null );
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new HibernateException( "Could not obtain JOnAS transaction manager instance", e );
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.transaction;
|
||||
|
||||
|
@ -80,9 +79,10 @@ public class WebSphereExtendedJTATransactionLookup implements TransactionManager
|
|||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@SuppressWarnings( {"UnnecessaryBoxing"})
|
||||
public Object getTransactionIdentifier(Transaction transaction) {
|
||||
// WebSphere, however, is not a sane JEE/JTA container...
|
||||
return new Integer( transaction.hashCode() );
|
||||
return Integer.valueOf( transaction.hashCode() );
|
||||
}
|
||||
|
||||
public static class TransactionManagerAdapter implements TransactionManager {
|
||||
|
@ -101,8 +101,7 @@ public class WebSphereExtendedJTATransactionLookup implements TransactionManager
|
|||
"registerSynchronizationCallbackForCurrentTran",
|
||||
new Class[] { synchronizationCallbackClass }
|
||||
);
|
||||
getLocalIdMethod = extendedJTATransactionClass.getMethod( "getLocalId", null );
|
||||
|
||||
getLocalIdMethod = extendedJTATransactionClass.getMethod( "getLocalId", (Class[]) null );
|
||||
}
|
||||
catch ( ClassNotFoundException cnfe ) {
|
||||
throw new HibernateException( cnfe );
|
||||
|
@ -223,10 +222,7 @@ public class WebSphereExtendedJTATransactionLookup implements TransactionManager
|
|||
);
|
||||
|
||||
try {
|
||||
registerSynchronizationMethod.invoke(
|
||||
extendedJTATransaction,
|
||||
new Object[] { synchronizationCallback }
|
||||
);
|
||||
registerSynchronizationMethod.invoke( extendedJTATransaction, synchronizationCallback );
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new HibernateException(e);
|
||||
|
@ -250,14 +246,9 @@ public class WebSphereExtendedJTATransactionLookup implements TransactionManager
|
|||
return getLocalId().equals( that.getLocalId() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for property 'localId'.
|
||||
*
|
||||
* @return Value for property 'localId'.
|
||||
*/
|
||||
private Object getLocalId() throws HibernateException {
|
||||
try {
|
||||
return getLocalIdMethod.invoke( extendedJTATransaction, null );
|
||||
return getLocalIdMethod.invoke( extendedJTATransaction, (Object[]) null );
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
throw new HibernateException( e );
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
package org.hibernate.transaction;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.transaction.TransactionManager;
|
||||
|
@ -39,6 +40,7 @@ import org.hibernate.HibernateException;
|
|||
*
|
||||
* @author Gavin King
|
||||
*/
|
||||
@SuppressWarnings( {"UnusedDeclaration"})
|
||||
public class WebSphereTransactionManagerLookup implements TransactionManagerLookup {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(WebSphereTransactionManagerLookup.class);
|
||||
|
@ -83,7 +85,8 @@ public class WebSphereTransactionManagerLookup implements TransactionManagerLook
|
|||
*/
|
||||
public TransactionManager getTransactionManager(Properties props) throws HibernateException {
|
||||
try {
|
||||
return ( TransactionManager ) tmfClass.getMethod( "getTransactionManager", null ).invoke( null, null );
|
||||
final Method method = tmfClass.getMethod( "getTransactionManager", (Class[]) null );
|
||||
return ( TransactionManager ) method.invoke( null, (Object[]) null );
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
throw new HibernateException( "Could not obtain WebSphere TransactionManager", e );
|
||||
|
|
|
@ -108,7 +108,7 @@ public class PojoInstantiator implements Instantiator, Serializable {
|
|||
}
|
||||
else {
|
||||
try {
|
||||
return constructor.newInstance( null );
|
||||
return constructor.newInstance( (Object[]) null );
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
throw new InstantiationException( "Could not instantiate entity: ", mappedClass, e );
|
||||
|
|
|
@ -62,7 +62,7 @@ public class ProxyTest extends FunctionalTestCase {
|
|||
assertFalse( Hibernate.isInitialized(dp) );
|
||||
|
||||
try {
|
||||
dp.getClass().getDeclaredMethod("finalize",null);
|
||||
dp.getClass().getDeclaredMethod( "finalize", (Class[]) null );
|
||||
fail();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue