Use bridge methods in ReflectiveMethodResolver

Update ReflectiveMethodResolver to consider bridge methods.

Issue: SPR-10210
This commit is contained in:
Phillip Webb
2013-02-10 16:25:38 -08:00
parent d442c40e0c
commit 634284e1fd
6 changed files with 113 additions and 18 deletions

View File

@@ -24,6 +24,7 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -1736,6 +1737,14 @@ public class SpelReproTests extends ExpressionTestCase {
assertThat(fromClass, is("interfaceValue"));
}
@Test
public void SPR_10210() throws Exception {
StandardEvaluationContext context = new StandardEvaluationContext();
context.setVariable("bridgeExample", new org.springframework.expression.spel.spr10210.D());
Expression parseExpression = parser.parseExpression("#bridgeExample.bridgetMethod()");
parseExpression.getValue(context);
}
public static class BooleanHolder {
private Boolean simpleProperty = true;
@@ -1796,4 +1805,5 @@ public class SpelReproTests extends ExpressionTestCase {
public static class StaticFinalImpl2 extends AbstractStaticFinal {
}
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.expression.spel.spr10210;
import org.springframework.expression.spel.spr10210.comp.B;
import org.springframework.expression.spel.spr10210.infra.C;
abstract class A extends B<C> {
}

View File

@@ -0,0 +1,20 @@
/*
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.expression.spel.spr10210;
public class D extends A {
}

View File

@@ -0,0 +1,24 @@
/*
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.expression.spel.spr10210.comp;
import java.io.Serializable;
import org.springframework.expression.spel.spr10210.infra.C;
public class B<T extends C> implements Serializable {
}

View File

@@ -0,0 +1,20 @@
/*
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.expression.spel.spr10210.infra;
public interface C {
}