Skip to content

Commit

Permalink
Fix [cast] compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
philwebb authored and cbeams committed Dec 28, 2012
1 parent b098604 commit 6c14eaa
Show file tree
Hide file tree
Showing 63 changed files with 122 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ else if (varNames.size() == 1) {
// 1 primitive arg, and one candidate...
for (int i = 0; i < this.argumentTypes.length; i++) {
if (isUnbound(i) && this.argumentTypes[i].isPrimitive()) {
bindParameterName(i, (String) varNames.get(0));
bindParameterName(i, varNames.get(0));
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected List<Advisor> sortAdvisors(List<Advisor> advisors) {

// sort it
List<PartiallyComparableAdvisorHolder> sorted =
(List<PartiallyComparableAdvisorHolder>) PartialOrder.sort(partiallyComparableAdvisors);
PartialOrder.sort(partiallyComparableAdvisors);
if (sorted == null) {
// TODO: work harder to give a better error message here.
throw new IllegalArgumentException("Advice precedence circularity error");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ public void testIntroductionOnTargetImplementingInterface() {
),
CannotBeUnlocked.class);
assertTrue(proxy instanceof Lockable);
Lockable lockable = (Lockable) proxy;
Lockable lockable = proxy;
assertTrue("Already locked", lockable.locked());
lockable.lock();
assertTrue("Real target ignores locking", lockable.locked());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public abstract aspect AbstractMethodMockingControl percflow(mockStaticsTestMeth
if (responseType == CallResponse.return_) {
return call.returnValue(lastSig, args);
} else if(responseType == CallResponse.throw_) {
return (RuntimeException)call.throwException(lastSig, args);
return call.throwException(lastSig, args);
} else if(responseType == CallResponse.nothing) {
// do nothing
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ public static void copyNonMethodProperties(PropertyDescriptor source, PropertyDe
// copy all attributes (emulating behavior of private FeatureDescriptor#addTable)
Enumeration<String> keys = source.attributeNames();
while (keys.hasMoreElements()) {
String key = (String)keys.nextElement();
String key = keys.nextElement();
target.setValue(key, source.getValue(key));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ else if (value instanceof Class) {
else if (value instanceof String) {
Class editorClass = ClassUtils.forName((String) value, this.beanClassLoader);
Assert.isAssignable(PropertyEditor.class, editorClass);
beanFactory.registerCustomEditor(requiredType, (Class<? extends PropertyEditor>) editorClass);
beanFactory.registerCustomEditor(requiredType, editorClass);
}
else {
throw new IllegalArgumentException("Mapped value [" + value + "] for custom editor key [" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -995,15 +995,15 @@ public void testIndexedPropertiesWithDirectAccess() {
bw.setPropertyValues(pvs);
assertEquals(tb5, bean.getArray()[0]);
assertEquals(tb4, bean.getArray()[1]);
assertEquals(tb3, ((TestBean) bean.getList().get(0)));
assertEquals(tb2, ((TestBean) bean.getList().get(1)));
assertEquals(tb0, ((TestBean) bean.getList().get(2)));
assertEquals(null, ((TestBean) bean.getList().get(3)));
assertEquals(tb1, ((TestBean) bean.getList().get(4)));
assertEquals(tb1, ((TestBean) bean.getMap().get("key1")));
assertEquals(tb0, ((TestBean) bean.getMap().get("key2")));
assertEquals(tb4, ((TestBean) bean.getMap().get("key5")));
assertEquals(tb5, ((TestBean) bean.getMap().get("key9")));
assertEquals(tb3, (bean.getList().get(0)));
assertEquals(tb2, (bean.getList().get(1)));
assertEquals(tb0, (bean.getList().get(2)));
assertEquals(null, (bean.getList().get(3)));
assertEquals(tb1, (bean.getList().get(4)));
assertEquals(tb1, (bean.getMap().get("key1")));
assertEquals(tb0, (bean.getMap().get("key2")));
assertEquals(tb4, (bean.getMap().get("key5")));
assertEquals(tb5, (bean.getMap().get("key9")));
assertEquals(tb5, bw.getPropertyValue("array[0]"));
assertEquals(tb4, bw.getPropertyValue("array[1]"));
assertEquals(tb3, bw.getPropertyValue("list[0]"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ public void testSimpleReference() {
int count = (new PropertiesBeanDefinitionReader(lbf)).registerBeanDefinitions(p, PREFIX);
assertTrue("2 beans registered, not " + count, count == 2);

TestBean kerry = (TestBean) lbf.getBean("kerry", TestBean.class);
TestBean kerry = lbf.getBean("kerry", TestBean.class);
assertTrue("Kerry name is Kerry", "Kerry".equals(kerry.getName()));
ITestBean spouse = kerry.getSpouse();
assertTrue("Kerry spouse is non null", spouse != null);
Expand All @@ -516,7 +516,7 @@ public void testPropertiesWithDotsInKey() {
assertTrue("1 beans registered, not " + count, count == 1);
assertEquals(1, lbf.getBeanDefinitionCount());

TestBean tb = (TestBean) lbf.getBean("tb", TestBean.class);
TestBean tb = lbf.getBean("tb", TestBean.class);
assertEquals("my.value", tb.getSomeMap().get("my.key"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void testDoesNotComplainWhenTargetBeanNameRefersToSingleton() throws Exce
factory.setTargetBeanName(targetBeanName);
factory.setBeanFactory(beanFactory);
factory.afterPropertiesSet();
ObjectFactory<?> objectFactory = (ObjectFactory<?>) factory.getObject();
ObjectFactory<?> objectFactory = factory.getObject();
Object actualSingleton = objectFactory.getObject();
assertSame(expectedSingleton, actualSingleton);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void testWithPropertiesFile() throws Exception {
PropertiesFactoryBean pfb = new PropertiesFactoryBean();
pfb.setLocation(TEST_PROPS);
pfb.afterPropertiesSet();
Properties props = (Properties) pfb.getObject();
Properties props = pfb.getObject();
assertEquals("99", props.getProperty("tb.array[0].age"));
}

Expand All @@ -51,7 +51,7 @@ public void testWithPropertiesXmlFile() throws Exception {
PropertiesFactoryBean pfb = new PropertiesFactoryBean();
pfb.setLocation(TEST_PROPS_XML);
pfb.afterPropertiesSet();
Properties props = (Properties) pfb.getObject();
Properties props = pfb.getObject();
assertEquals("99", props.getProperty("tb.array[0].age"));
}

Expand All @@ -62,7 +62,7 @@ public void testWithLocalProperties() throws Exception {
localProps.setProperty("key2", "value2");
pfb.setProperties(localProps);
pfb.afterPropertiesSet();
Properties props = (Properties) pfb.getObject();
Properties props = pfb.getObject();
assertEquals("value2", props.getProperty("key2"));
}

Expand All @@ -75,7 +75,7 @@ public void testWithPropertiesFileAndLocalProperties() throws Exception {
localProps.setProperty("tb.array[0].age", "0");
pfb.setProperties(localProps);
pfb.afterPropertiesSet();
Properties props = (Properties) pfb.getObject();
Properties props = pfb.getObject();
assertEquals("99", props.getProperty("tb.array[0].age"));
assertEquals("value2", props.getProperty("key2"));
}
Expand All @@ -100,7 +100,7 @@ public void testWithPropertiesFileAndMultipleLocalProperties() throws Exception
pfb.setPropertiesArray(new Properties[] {props1, props2, props3});
pfb.afterPropertiesSet();

Properties props = (Properties) pfb.getObject();
Properties props = pfb.getObject();
assertEquals("99", props.getProperty("tb.array[0].age"));
assertEquals("value2", props.getProperty("key2"));
assertEquals("framework", props.getProperty("spring"));
Expand All @@ -119,7 +119,7 @@ public void testWithPropertiesFileAndLocalPropertiesAndLocalOverride() throws Ex
pfb.setProperties(localProps);
pfb.setLocalOverride(true);
pfb.afterPropertiesSet();
Properties props = (Properties) pfb.getObject();
Properties props = pfb.getObject();
assertEquals("0", props.getProperty("tb.array[0].age"));
assertEquals("value2", props.getProperty("key2"));
}
Expand All @@ -133,10 +133,10 @@ public void testWithPrototype() throws Exception {
localProps.setProperty("key2", "value2");
pfb.setProperties(localProps);
pfb.afterPropertiesSet();
Properties props = (Properties) pfb.getObject();
Properties props = pfb.getObject();
assertEquals("99", props.getProperty("tb.array[0].age"));
assertEquals("value2", props.getProperty("key2"));
Properties newProps = (Properties) pfb.getObject();
Properties newProps = pfb.getObject();
assertTrue(props != newProps);
assertEquals("99", newProps.getProperty("tb.array[0].age"));
assertEquals("value2", newProps.getProperty("key2"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void testMergeSunnyDay() {
ManagedList child = new ManagedList();
child.add("three");
child.setMergeEnabled(true);
List mergedList = (List) child.merge(parent);
List mergedList = child.merge(parent);
assertEquals("merge() obviously did not work.", 3, mergedList.size());
}

Expand Down Expand Up @@ -72,7 +72,7 @@ public void testMergeEmptyChild() {
parent.add("two");
ManagedList child = new ManagedList();
child.setMergeEnabled(true);
List mergedList = (List) child.merge(parent);
List mergedList = child.merge(parent);
assertEquals("merge() obviously did not work.", 2, mergedList.size());
}

Expand All @@ -84,7 +84,7 @@ public void testMergeChildValuesOverrideTheParents() {
ManagedList child = new ManagedList();
child.add("one");
child.setMergeEnabled(true);
List mergedList = (List) child.merge(parent);
List mergedList = child.merge(parent);
assertEquals("merge() obviously did not work.", 3, mergedList.size());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void testMergeSunnyDay() {
ManagedSet child = new ManagedSet();
child.add("three");
child.setMergeEnabled(true);
Set mergedSet = (Set) child.merge(parent);
Set mergedSet = child.merge(parent);
assertEquals("merge() obviously did not work.", 3, mergedSet.size());
}

Expand Down Expand Up @@ -72,7 +72,7 @@ public void testMergeEmptyChild() {
parent.add("two");
ManagedSet child = new ManagedSet();
child.setMergeEnabled(true);
Set mergedSet = (Set) child.merge(parent);
Set mergedSet = child.merge(parent);
assertEquals("merge() obviously did not work.", 2, mergedSet.size());
}

Expand All @@ -84,7 +84,7 @@ public void testMergeChildValuesOverrideTheParents() {
ManagedSet child = new ManagedSet();
child.add("one");
child.setMergeEnabled(true);
Set mergedSet = (Set) child.merge(parent);
Set mergedSet = child.merge(parent);
assertEquals("merge() obviously did not work.", 2, mergedSet.size());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private void doTestSchedulerFactoryBean(boolean explicitJobDetail, boolean proto
}
mijdfb.setTargetMethod("doSomething");
mijdfb.afterPropertiesSet();
JobDetail jobDetail1 = (JobDetail) mijdfb.getObject();
JobDetail jobDetail1 = mijdfb.getObject();

SimpleTriggerBean trigger1 = new SimpleTriggerBean();
trigger1.setBeanName("myTrigger1");
Expand Down Expand Up @@ -210,7 +210,7 @@ private void doTestSchedulerFactoryBeanWithExistingJobs(boolean overwrite) throw
mijdfb.setTargetObject(task1);
mijdfb.setTargetMethod("doSomething");
mijdfb.afterPropertiesSet();
JobDetail jobDetail1 = (JobDetail) mijdfb.getObject();
JobDetail jobDetail1 = mijdfb.getObject();

SimpleTriggerBean trigger1 = new SimpleTriggerBean();
trigger1.setBeanName("myTrigger1");
Expand Down Expand Up @@ -304,7 +304,7 @@ private void doTestSchedulerFactoryBeanWithExistingJobsAndRaceCondition(boolean
mijdfb.setTargetObject(task1);
mijdfb.setTargetMethod("doSomething");
mijdfb.afterPropertiesSet();
JobDetail jobDetail1 = (JobDetail) mijdfb.getObject();
JobDetail jobDetail1 = mijdfb.getObject();

SimpleTriggerBean trigger1 = new SimpleTriggerBean();
trigger1.setBeanName("myTrigger1");
Expand Down Expand Up @@ -446,7 +446,7 @@ private void methodInvokingConcurrency(boolean concurrent) throws Exception {
mijdfb.setTargetObject(task1);
mijdfb.setTargetMethod("doWait");
mijdfb.afterPropertiesSet();
JobDetail jobDetail1 = (JobDetail) mijdfb.getObject();
JobDetail jobDetail1 = mijdfb.getObject();

SimpleTriggerBean trigger0 = new SimpleTriggerBean();
trigger0.setBeanName("myTrigger1");
Expand Down Expand Up @@ -532,7 +532,7 @@ public void testSchedulerFactoryBeanWithPlainQuartzObjects() throws Exception {
mijdfb.setTargetObject(task1);
mijdfb.setTargetMethod("doSomething");
mijdfb.afterPropertiesSet();
JobDetail jobDetail1 = (JobDetail) mijdfb.getObject();
JobDetail jobDetail1 = mijdfb.getObject();

SimpleTrigger trigger1 = new SimpleTrigger();
trigger1.setName("myTrigger1");
Expand Down Expand Up @@ -618,7 +618,7 @@ protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String sc
try {
schedulerFactoryBean.afterPropertiesSet();
schedulerFactoryBean.start();
Scheduler returnedScheduler = (Scheduler) schedulerFactoryBean.getObject();
Scheduler returnedScheduler = schedulerFactoryBean.getObject();
assertEquals(tb, returnedScheduler.getContext().get("testBean"));
assertEquals(ac, returnedScheduler.getContext().get("appCtx"));
}
Expand Down Expand Up @@ -659,7 +659,7 @@ public void testMethodInvokingJobDetailFactoryBeanWithListenerNames() throws Exc
mijdfb.setTargetMethod("doSomething");
mijdfb.setJobListenerNames(names);
mijdfb.afterPropertiesSet();
JobDetail jobDetail = (JobDetail) mijdfb.getObject();
JobDetail jobDetail = mijdfb.getObject();
List result = Arrays.asList(jobDetail.getJobListenerNames());
assertEquals(Arrays.asList(names), result);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void addTransformer(ClassFileTransformer transformer) {

public ClassLoader getThrowawayClassLoader() {
try {
ClassLoader loader = (ClassLoader) cloneConstructor.newInstance(getClassLoader());
ClassLoader loader = cloneConstructor.newInstance(getClassLoader());
// clear out the transformers (copied as well)
List<?> list = (List<?>) transformerList.get(loader);
list.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public List<FieldError> getFieldErrors(String field) {

public FieldError getFieldError(String field) {
List<FieldError> fieldErrors = getFieldErrors(field);
return (!fieldErrors.isEmpty() ? (FieldError) fieldErrors.get(0) : null);
return (!fieldErrors.isEmpty() ? fieldErrors.get(0) : null);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void testReturningBean() {
@Test
public void testReturningBeanArray() {
this.testBeanTarget.setSpouse(new TestBean());
ITestBean[] spouses = (ITestBean[]) this.testBeanTarget.getSpouses();
ITestBean[] spouses = this.testBeanTarget.getSpouses();
mockCollaborator.testBeanArrayArg(spouses);
replay(mockCollaborator);
testBeanProxy.getSpouses();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void testGrandparentDefinitionFound() throws Exception {
}

public void testGrandparentTypedDefinitionFound() throws Exception {
TestBean dad = (TestBean) applicationContext.getBean("father", TestBean.class);
TestBean dad = applicationContext.getBean("father", TestBean.class);
assertTrue("Dad has correct name", dad.getName().equals("Albert"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ public void testAttributeHasCorrespondingOperations() throws Exception {
ModelMBeanOperationInfo get = info.getOperation("getName");
assertNotNull("get operation should not be null", get);
assertEquals("get operation should have visibility of four",
(Integer) get.getDescriptor().getFieldValue("visibility"),
get.getDescriptor().getFieldValue("visibility"),
new Integer(4));
assertEquals("get operation should have role \"getter\"", "getter", get.getDescriptor().getFieldValue("role"));

ModelMBeanOperationInfo set = info.getOperation("setName");
assertNotNull("set operation should not be null", set);
assertEquals("set operation should have visibility of four",
(Integer) set.getDescriptor().getFieldValue("visibility"),
set.getDescriptor().getFieldValue("visibility"),
new Integer(4));
assertEquals("set operation should have role \"setter\"", "setter", set.getDescriptor().getFieldValue("role"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void ignoreTestValidConnection() throws Exception {
bean.afterPropertiesSet();

try {
MBeanServerConnection connection = (MBeanServerConnection) bean.getObject();
MBeanServerConnection connection = bean.getObject();
assertNotNull("Connection should not be null", connection);

// perform simple MBean count test
Expand Down Expand Up @@ -100,7 +100,7 @@ public void ignoreTestWithLazyConnection() throws Exception {
bean.setConnectOnStartup(false);
bean.afterPropertiesSet();

MBeanServerConnection connection = (MBeanServerConnection) bean.getObject();
MBeanServerConnection connection = bean.getObject();
assertTrue(AopUtils.isAopProxy(connection));

JMXConnectorServer connector = null;
Expand All @@ -122,7 +122,7 @@ public void testWithLazyConnectionAndNoAccess() throws Exception {
bean.setConnectOnStartup(false);
bean.afterPropertiesSet();

MBeanServerConnection connection = (MBeanServerConnection) bean.getObject();
MBeanServerConnection connection = bean.getObject();
assertTrue(AopUtils.isAopProxy(connection));
bean.destroy();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class ScheduledTasksBeanDefinitionParserTests {
public void setup() {
this.context = new ClassPathXmlApplicationContext(
"scheduledTasksContext.xml", ScheduledTasksBeanDefinitionParserTests.class);
this.registrar = (ScheduledTaskRegistrar) this.context.getBeansOfType(
this.registrar = this.context.getBeansOfType(
ScheduledTaskRegistrar.class).values().iterator().next();
this.testBean = this.context.getBean("testBean");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void testTimerFactoryBean() throws Exception {
mittfb.setTargetObject(task1);
mittfb.setTargetMethod("doSomething");
mittfb.afterPropertiesSet();
final TimerTask timerTask1 = (TimerTask) mittfb.getObject();
final TimerTask timerTask1 = mittfb.getObject();

final TestRunnable timerTask2 = new TestRunnable();

Expand Down
Loading

0 comments on commit 6c14eaa

Please sign in to comment.