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