You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2007/12/01 21:38:50 UTC
svn commit: r600192 - in /tapestry/tapestry5/trunk/tapestry-ioc/src:
main/java/org/apache/tapestry/ioc/
main/java/org/apache/tapestry/ioc/internal/
main/java/org/apache/tapestry/ioc/internal/services/
main/java/org/apache/tapestry/ioc/internal/util/ ma...
Author: hlship
Date: Sat Dec 1 12:38:48 2007
New Revision: 600192
URL: http://svn.apache.org/viewvc?rev=600192&view=rev
Log:
Apply a number of IntelliJ code inspections
Modified:
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/RegistryBuilder.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/AbstractServiceCreator.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ConstructorServiceCreator.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/RegistryImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/AbstractFab.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ChainBuilderImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFactoryImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyAccessImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyAdapterImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/RegistryShutdownHubImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ValueObjectProvider.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/ConcurrentBarrier.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/Defense.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/IdAllocator.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/InheritanceSearch.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/InternalUtils.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/TapestryException.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/ClassFactory.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/MethodSignature.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/Status.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/AbstractMessages.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/BodyBuilder.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/CaseInsensitiveMap.java
tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ServiceProxySerializationTest.java
tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/StrategyBuilderImplTest.java
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/RegistryBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/RegistryBuilder.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/RegistryBuilder.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/RegistryBuilder.java Sat Dec 1 12:38:48 2007
@@ -71,8 +71,7 @@
// Make the ClassFactory appear to be a service inside TapestryIOCModule, even before that
// module exists.
- Logger classFactoryLogger = loggerSource.getLogger(TapestryIOCModule.class.getName()
- + ".ClassFactory");
+ Logger classFactoryLogger = loggerSource.getLogger(TapestryIOCModule.class.getName() + ".ClassFactory");
_classFactory = new ClassFactoryImpl(_classLoader, classFactoryLogger);
@@ -105,8 +104,7 @@
if (annotation == null) continue;
- for (Class sub : annotation.value())
- queue.add(sub);
+ queue.addAll(Arrays.asList(annotation.value()));
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/AbstractServiceCreator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/AbstractServiceCreator.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/AbstractServiceCreator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/AbstractServiceCreator.java Sat Dec 1 12:38:48 2007
@@ -71,8 +71,8 @@
* containing the collected configuration data. This involves scanning the parameters and
* generic types.
*/
- protected final Map<Class, Object> getParameterDefaultsWithConfiguration(
- Class[] parameterTypes, Type[] genericParameterTypes)
+ protected final Map<Class, Object> getParameterDefaultsWithConfiguration(Class[] parameterTypes,
+ Type[] genericParameterTypes)
{
Map<Class, Object> result = newMap(_parameterDefaults);
ConfigurationType type = null;
@@ -125,8 +125,7 @@
}
@SuppressWarnings("unchecked")
- private final void addOrderedConfigurationParameter(Map<Class, Object> parameterDefaults,
- Type genericType)
+ private void addOrderedConfigurationParameter(Map<Class, Object> parameterDefaults, Type genericType)
{
Class valueType = findParameterizedTypeFromGenericType(genericType);
List configuration = _resources.getOrderedConfiguration(valueType);
@@ -135,8 +134,7 @@
}
@SuppressWarnings("unchecked")
- private void addUnorderedConfigurationParameter(Map<Class, Object> parameterDefaults,
- Type genericType)
+ private void addUnorderedConfigurationParameter(Map<Class, Object> parameterDefaults, Type genericType)
{
Class valueType = findParameterizedTypeFromGenericType(genericType);
Collection configuration = _resources.getUnorderedConfiguration(valueType);
@@ -145,8 +143,7 @@
}
@SuppressWarnings("unchecked")
- private void addMappedConfigurationParameter(Map<Class, Object> parameterDefaults,
- Type genericType)
+ private void addMappedConfigurationParameter(Map<Class, Object> parameterDefaults, Type genericType)
{
Class keyType = findParameterizedTypeFromGenericType(genericType, 0);
Class valueType = findParameterizedTypeFromGenericType(genericType, 1);
@@ -173,8 +170,7 @@
{
Class result = findParameterizedTypeFromGenericType(type, 0);
- if (result == null)
- throw new IllegalArgumentException(IOCMessages.genericTypeNotSupported(type));
+ if (result == null) throw new IllegalArgumentException(IOCMessages.genericTypeNotSupported(type));
return result;
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ConstructorServiceCreator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ConstructorServiceCreator.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ConstructorServiceCreator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ConstructorServiceCreator.java Sat Dec 1 12:38:48 2007
@@ -39,17 +39,14 @@
public Object createObject()
{
- Throwable failure = null;
+ Throwable failure;
try
{
- Object[] parameters = InternalUtils.calculateParametersForConstructor(
- _constructor,
- _resources,
- getParameterDefaultsWithConfigurations());
+ Object[] parameters = InternalUtils.calculateParametersForConstructor(_constructor, _resources,
+ getParameterDefaultsWithConfigurations());
- if (_logger.isDebugEnabled())
- _logger.debug(IOCMessages.invokingConstructor(_creatorDescription));
+ if (_logger.isDebugEnabled()) _logger.debug(IOCMessages.invokingConstructor(_creatorDescription));
return _constructor.newInstance(parameters);
}
@@ -62,10 +59,7 @@
failure = ex;
}
- throw new RuntimeException(IOCMessages.constructorError(
- _creatorDescription,
- _serviceId,
- failure), failure);
+ throw new RuntimeException(IOCMessages.constructorError(_creatorDescription, _serviceId, failure), failure);
}
/**
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java Sat Dec 1 12:38:48 2007
@@ -371,7 +371,7 @@
*/
private void bind()
{
- Throwable failure = null;
+ Throwable failure;
Method bindMethod = null;
try
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/RegistryImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/RegistryImpl.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/RegistryImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/RegistryImpl.java Sat Dec 1 12:38:48 2007
@@ -712,7 +712,7 @@
if (constructor == null) throw new RuntimeException(IOCMessages.noAutobuildConstructor(clazz));
- Throwable failure = null;
+ Throwable failure;
// An empty map, because when performing autobuilding outside the context of building a
// service, we don't have defaults for Log, service id, etc.
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/AbstractFab.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/AbstractFab.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/AbstractFab.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/AbstractFab.java Sat Dec 1 12:38:48 2007
@@ -46,7 +46,7 @@
/**
* Map from Class to CtClass.
*/
- private Map<Class, CtClass> _ctClassCache = newMap();
+ private final Map<Class, CtClass> _ctClassCache = newMap();
public void addInterface(Class interfaceClass)
{
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ChainBuilderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ChainBuilderImpl.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ChainBuilderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ChainBuilderImpl.java Sat Dec 1 12:38:48 2007
@@ -32,7 +32,7 @@
* Map, keyed on service interface, of implementation Class.
*/
- private Map<Class, Class> _cache = newConcurrentMap();
+ private final Map<Class, Class> _cache = newConcurrentMap();
public ChainBuilderImpl(@Builtin ClassFactory classFactory)
{
@@ -85,7 +85,7 @@
String arrayClassName = commandInterface.getCanonicalName() + "[]";
String jvmName = ClassFabUtils.toJVMBinaryName(arrayClassName);
- Class array = null;
+ Class array;
try
{
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFactoryImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFactoryImpl.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFactoryImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFactoryImpl.java Sat Dec 1 12:38:48 2007
@@ -102,8 +102,7 @@
}
catch (Exception ex)
{
- throw new RuntimeException(ServiceMessages.unableToCreateClass(name, superClass, ex),
- ex);
+ throw new RuntimeException(ServiceMessages.unableToCreateClass(name, superClass, ex), ex);
}
}
@@ -152,11 +151,7 @@
String sourceFile = ctMethod.getDeclaringClass().getClassFile2().getSourceFile();
- String description = String.format(
- "%s (at %s:%d)",
- InternalUtils.asString(method),
- sourceFile,
- lineNumber);
+ String description = String.format("%s (at %s:%d)", InternalUtils.asString(method), sourceFile, lineNumber);
return new StringLocation(description, lineNumber);
}
@@ -212,6 +207,7 @@
}
catch (Exception ex)
{
+ // Leave the line number as 0 (aka "unknown").
}
return new StringLocation(builder.toString(), lineNumber);
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyAccessImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyAccessImpl.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyAccessImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyAccessImpl.java Sat Dec 1 12:38:48 2007
@@ -22,6 +22,7 @@
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
+import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -99,12 +100,10 @@
private <T> void addAll(List<T> list, T[] array)
{
- for (T i : array)
- list.add(i);
+ list.addAll(Arrays.asList(array));
}
- private void addPropertiesFromExtendedInterfaces(Class forClass,
- List<PropertyDescriptor> descriptors)
+ private void addPropertiesFromExtendedInterfaces(Class forClass, List<PropertyDescriptor> descriptors)
throws IntrospectionException
{
LinkedList<Class> queue = newLinkedList();
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyAdapterImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyAdapterImpl.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyAdapterImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyAdapterImpl.java Sat Dec 1 12:38:48 2007
@@ -81,11 +81,9 @@
public Object get(Object instance)
{
if (_readMethod == null)
- throw new UnsupportedOperationException(ServiceMessages.readNotSupported(
- instance,
- _name));
+ throw new UnsupportedOperationException(ServiceMessages.readNotSupported(instance, _name));
- Throwable fail = null;
+ Throwable fail;
try
{
@@ -106,11 +104,9 @@
public void set(Object instance, Object value)
{
if (_writeMethod == null)
- throw new UnsupportedOperationException(ServiceMessages.writeNotSupported(
- instance,
- _name));
+ throw new UnsupportedOperationException(ServiceMessages.writeNotSupported(instance, _name));
- Throwable fail = null;
+ Throwable fail;
try
{
@@ -134,8 +130,7 @@
{
T result = _readMethod != null ? _readMethod.getAnnotation(annotationClass) : null;
- if (result == null && _writeMethod != null)
- result = _writeMethod.getAnnotation(annotationClass);
+ if (result == null && _writeMethod != null) result = _writeMethod.getAnnotation(annotationClass);
return result;
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/RegistryShutdownHubImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/RegistryShutdownHubImpl.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/RegistryShutdownHubImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/RegistryShutdownHubImpl.java Sat Dec 1 12:38:48 2007
@@ -45,8 +45,6 @@
/**
* Fires the {@link RegistryShutdownListener#registryDidShutdown()} method on each listener. At
* the end, all the listeners are discarded.
- *
- * @param log used if any listener throws an exception
*/
public void fireRegistryDidShutdown()
{
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ValueObjectProvider.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ValueObjectProvider.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ValueObjectProvider.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ValueObjectProvider.java Sat Dec 1 12:38:48 2007
@@ -32,18 +32,15 @@
private final TypeCoercer _typeCoercer;
- public ValueObjectProvider(@Builtin
- SymbolSource symbolSource,
+ public ValueObjectProvider(@Builtin SymbolSource symbolSource,
- @Builtin
- TypeCoercer typeCoercer)
+ @Builtin TypeCoercer typeCoercer)
{
_symbolSource = symbolSource;
_typeCoercer = typeCoercer;
}
- public <T> T provide(Class<T> objectType, AnnotationProvider annotationProvider,
- ObjectLocator locator)
+ public <T> T provide(Class<T> objectType, AnnotationProvider annotationProvider, ObjectLocator locator)
{
Value annotation = annotationProvider.getAnnotation(Value.class);
@@ -52,8 +49,6 @@
String value = annotation.value();
String expanded = _symbolSource.expandSymbols(value);
- T coerced = _typeCoercer.coerce(expanded, objectType);
-
- return coerced;
+ return _typeCoercer.coerce(expanded, objectType);
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/ConcurrentBarrier.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/ConcurrentBarrier.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/ConcurrentBarrier.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/ConcurrentBarrier.java Sat Dec 1 12:38:48 2007
@@ -36,7 +36,7 @@
* see if the current thread has a read lock. So, we tend to remove the TL, rather than set its
* value to false.
*/
- public static class ThreadBoolean extends ThreadLocal<Boolean>
+ private static class ThreadBoolean extends ThreadLocal<Boolean>
{
@Override
protected Boolean initialValue()
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/Defense.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/Defense.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/Defense.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/Defense.java Sat Dec 1 12:38:48 2007
@@ -24,10 +24,7 @@
}
/**
- * Checks that a method parameter value is not null, and returns it. This method is used in
- * situations where some of the parameters to a method are allowed to be null and other's arent.
- * In that situation, the method will be annotated with {@link SuppressNullCheck}, and the
- * relevent null checks will occur inside the method implementation.
+ * Checks that a method parameter value is not null, and returns it.
*
* @param <T> the value type
* @param value the value (which is checked to ensure non-nullness)
@@ -37,8 +34,7 @@
*/
public static <T> T notNull(T value, String parameterName)
{
- if (value == null)
- throw new IllegalArgumentException(UtilMessages.parameterWasNull(parameterName));
+ if (value == null) throw new IllegalArgumentException(UtilMessages.parameterWasNull(parameterName));
return value;
}
@@ -57,8 +53,7 @@
{
String trimmedValue = value.trim();
- if (!trimmedValue.equals(""))
- return trimmedValue;
+ if (!trimmedValue.equals("")) return trimmedValue;
}
throw new IllegalArgumentException(UtilMessages.parameterWasBlank(parameterName));
@@ -79,10 +74,7 @@
notNull(parameterValue, parameterName);
if (!type.isInstance(parameterValue))
- throw new IllegalArgumentException(UtilMessages.badCast(
- parameterName,
- parameterValue,
- type));
+ throw new IllegalArgumentException(UtilMessages.badCast(parameterName, parameterValue, type));
return type.cast(parameterValue);
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/IdAllocator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/IdAllocator.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/IdAllocator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/IdAllocator.java Sat Dec 1 12:38:48 2007
@@ -62,6 +62,7 @@
/**
* Clones this instance, returning an equivalent but seperate copy.
*/
+ @SuppressWarnings({"CloneDoesntDeclareCloneNotSupportedException"})
@Override
public NameGenerator clone()
{
@@ -110,6 +111,7 @@
/**
* Creates a clone of this IdAllocator instance, copying the allocator's namespace and key map.
*/
+ @SuppressWarnings({"CloneDoesntCallSuperClone"})
@Override
public IdAllocator clone()
{
@@ -148,7 +150,7 @@
String key = name + _namespace;
NameGenerator g = _generatorMap.get(key);
- String result = null;
+ String result;
if (g == null)
{
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/InheritanceSearch.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/InheritanceSearch.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/InheritanceSearch.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/InheritanceSearch.java Sat Dec 1 12:38:48 2007
@@ -62,7 +62,7 @@
private enum State
{
- CLASS, INTERFACE, DONE;
+ CLASS, INTERFACE, DONE
}
private State _state;
@@ -107,10 +107,8 @@
_searchClass = parentOf(_searchClass);
- if (_searchClass == null)
- _state = State.INTERFACE;
- else
- queueInterfaces(_searchClass);
+ if (_searchClass == null) _state = State.INTERFACE;
+ else queueInterfaces(_searchClass);
return result;
@@ -146,8 +144,7 @@
{
Class componentType = clazz.getComponentType();
- while (componentType.isArray())
- componentType = componentType.getComponentType();
+ while (componentType.isArray()) componentType = componentType.getComponentType();
if (!componentType.isPrimitive()) return Object[].class;
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/InternalUtils.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/InternalUtils.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/InternalUtils.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/InternalUtils.java Sat Dec 1 12:38:48 2007
@@ -43,15 +43,15 @@
* Leading punctiation on member names that is stripped off to form a property name or new
* member name.
*/
- public static final String NAME_PREFIX = "_$";
+ private static final String NAME_PREFIX = "_$";
/**
* Converts a method to a user presentable string using a {@link ClassFactory} to obtain a
- * {@link MethodLocation} (where possible). {@link #asString(Method)} is used under the covers,
+ * {@link Location} (where possible). {@link #asString(Method)} is used under the covers,
* to present a detailed, but not excessive, description of the class, method and parameters.
*
* @param method method to convert to a string
- * @param classFactory used to obtain the {@link MethodLocation}
+ * @param classFactory used to obtain the {@link Location}
* @return the method formatted for presentation to the user
*/
public static String asString(Method method, ClassFactory classFactory)
@@ -363,12 +363,12 @@
/**
* Returns true if the method provided is a static method.
*/
- public static final boolean isStatic(Method method)
+ public static boolean isStatic(Method method)
{
return Modifier.isStatic(method.getModifiers());
}
- public static final <T> Iterator<T> reverseIterator(final List<T> list)
+ public static <T> Iterator<T> reverseIterator(final List<T> list)
{
final ListIterator<T> normal = list.listIterator(list.size());
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/TapestryException.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/TapestryException.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/TapestryException.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/TapestryException.java Sat Dec 1 12:38:48 2007
@@ -28,9 +28,9 @@
private transient final Location _location;
/**
- * @param message a message (may be null)
- * @param locatable implements {@link Location} or {@link Locatable}
- * @param cause if not null, the root cause of the exception
+ * @param message a message (may be null)
+ * @param location implements {@link Location} or {@link Locatable}
+ * @param cause if not null, the root cause of the exception
*/
public TapestryException(String message, Object location, Throwable cause)
{
@@ -47,9 +47,9 @@
}
/**
- * @param message a message (may be null)
- * @param locatable location to associated with the exception, or null if not known
- * @param cause if not null, the root cause of the exception
+ * @param message a message (may be null)
+ * @param location location to associated with the exception, or null if not known
+ * @param cause if not null, the root cause of the exception
*/
public TapestryException(String message, Location location, Throwable cause)
{
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/ClassFactory.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/ClassFactory.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/ClassFactory.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/ClassFactory.java Sat Dec 1 12:38:48 2007
@@ -70,7 +70,7 @@
ClassLoader getClassLoader();
/**
- * Converts a method to a {@link MethodLocation}, which includes information about the source
+ * Converts a method to a {@link Location}, which includes information about the source
* file name and line number.
*
* @param method to look up
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/MethodSignature.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/MethodSignature.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/MethodSignature.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/MethodSignature.java Sat Dec 1 12:38:48 2007
@@ -40,13 +40,13 @@
{
private int _hashCode = -1;
- private Class _returnType;
+ private final Class _returnType;
- private String _name;
+ private final String _name;
- private Class[] _parameterTypes;
+ private final Class[] _parameterTypes;
- private Class[] _exceptionTypes;
+ private final Class[] _exceptionTypes;
public MethodSignature(Class returnType, String name, Class[] parameterTypes, Class[] exceptionTypes)
{
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/Status.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/Status.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/Status.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/Status.java Sat Dec 1 12:38:48 2007
@@ -40,5 +40,5 @@
/**
* A service implementation for the service has been created.
*/
- REAL;
+ REAL
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/AbstractMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/AbstractMessages.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/AbstractMessages.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/AbstractMessages.java Sat Dec 1 12:38:48 2007
@@ -86,8 +86,6 @@
{
_cache.put(key, newFormatter);
}
-
- ;
});
return newFormatter;
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/BodyBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/BodyBuilder.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/BodyBuilder.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/BodyBuilder.java Sat Dec 1 12:38:48 2007
@@ -59,8 +59,8 @@
/**
* Adds text to the current line, without ending the line.
*
- * @param a string format, as per {@link java.util.Formatter}
- * @param args arguments referenced by format specifiers
+ * @param format string format, as per {@link java.util.Formatter}
+ * @param args arguments referenced by format specifiers
*/
public void add(String format, Object... args)
{
@@ -70,8 +70,8 @@
/**
* Adds text to the current line and ends the line.
*
- * @param a string format, as per {@link java.util.Formatter}
- * @param args arguments referenced by format specifiers
+ * @param format string format, as per {@link java.util.Formatter}
+ * @param args arguments referenced by format specifiers
*/
public void addln(String format, Object... args)
{
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/CaseInsensitiveMap.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/CaseInsensitiveMap.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/CaseInsensitiveMap.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/util/CaseInsensitiveMap.java Sat Dec 1 12:38:48 2007
@@ -80,6 +80,7 @@
* @param key to compare against
* @return true if equal
*/
+ @SuppressWarnings({"StringEquality"})
boolean matches(String key)
{
return key == _key || (key != null && key.equalsIgnoreCase(_key));
@@ -162,7 +163,7 @@
Position position = select(e.getKey());
- return position.isFound() ? position.entry().valueMatches(e.getValue()) : false;
+ return position.isFound() && position.entry().valueMatches(e.getValue());
}
@Override
@@ -405,7 +406,7 @@
int low = 0;
int high = _size - 1;
- int cursor = 0;
+ int cursor;
while (low <= high)
{
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ServiceProxySerializationTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ServiceProxySerializationTest.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ServiceProxySerializationTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/ServiceProxySerializationTest.java Sat Dec 1 12:38:48 2007
@@ -80,8 +80,7 @@
oos.close();
- byte[] serialized = baos.toByteArray();
- return serialized;
+ return baos.toByteArray();
}
private <T> T deserialize(Class<T> type, byte[] serialized) throws IOException, ClassNotFoundException
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/StrategyBuilderImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/StrategyBuilderImplTest.java?rev=600192&r1=600191&r2=600192&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/StrategyBuilderImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry/ioc/internal/services/StrategyBuilderImplTest.java Sat Dec 1 12:38:48 2007
@@ -42,8 +42,6 @@
}
- ;
-
@Test
public void standard()
{
@@ -56,9 +54,7 @@
assertEquals(service.kindOf(Collections.EMPTY_MAP), "MAP");
assertEquals(service.kindOf(Collections.EMPTY_LIST), "LIST");
- assertEquals(
- service.toString(),
- "<Strategy for org.apache.tapestry.ioc.internal.services.KindOf>");
+ assertEquals(service.toString(), "<Strategy for org.apache.tapestry.ioc.internal.services.KindOf>");
try
{
@@ -67,9 +63,8 @@
}
catch (RuntimeException ex)
{
- assertEquals(
- ex.getMessage(),
- "No adapter from type void to type org.apache.tapestry.ioc.internal.services.KindOf is available (registered types are java.util.List, java.util.Map).");
+ assertEquals(ex.getMessage(),
+ "No adapter from type void to type org.apache.tapestry.ioc.internal.services.KindOf is available (registered types are java.util.List, java.util.Map).");
}
}
@@ -80,9 +75,6 @@
registrations.put(Map.class, new KindOfImpl("MAP"));
registrations.put(List.class, new KindOfImpl("LIST"));
- StrategyRegistry<KindOf> registry = StrategyRegistry.newInstance(
- KindOf.class,
- registrations);
- return registry;
+ return StrategyRegistry.newInstance(KindOf.class, registrations);
}
}