@@ -181,16 +181,28 @@ protected boolean hasConcreteOverride(Method m0, JavaType implementedType)
181
181
{
182
182
final String name = m0 .getName ();
183
183
final Class <?>[] argTypes = m0 .getParameterTypes ();
184
+ try {
185
+ // getMethod returns the most-specific method implementation, for public methods only (which is any method in an interface)
186
+ Method effectiveMethod = implementedType .getRawClass ().getMethod (name , argTypes );
187
+ if (BeanUtil .isConcrete (effectiveMethod )) {
188
+ return true ;
189
+ }
190
+ } catch (NoSuchMethodException e ) {
191
+ // method must be non-public, fallback to using getDeclaredMethod
192
+ }
193
+
184
194
for (JavaType curr = implementedType ; (curr != null ) && !curr .isJavaLangObject ();
185
195
curr = curr .getSuperClass ()) {
186
196
// 29-Nov-2015, tatu: Avoiding exceptions would be good, so would linear scan
187
197
// be better here?
188
198
try {
189
199
Method effectiveMethod = curr .getRawClass ().getDeclaredMethod (name , argTypes );
190
- if (effectiveMethod != null && BeanUtil .isConcrete (effectiveMethod )) {
200
+ if (BeanUtil .isConcrete (effectiveMethod )) {
191
201
return true ;
192
202
}
193
- } catch (NoSuchMethodException e ) { }
203
+ } catch (NoSuchMethodException e ) {
204
+ // method must exist on a superclass, continue searching...
205
+ }
194
206
}
195
207
return false ;
196
208
}
@@ -245,7 +257,7 @@ protected final static boolean returnsBoolean(Method m)
245
257
Class <?> rt = m .getReturnType ();
246
258
return (rt == Boolean .class || rt == Boolean .TYPE );
247
259
}
248
-
260
+
249
261
/*
250
262
/**********************************************************
251
263
/* Internal methods, bytecode generation
@@ -354,7 +366,7 @@ protected void createUnimplementedMethod(ClassWriter cw, String internalClassNam
354
366
/* Internal methods, other
355
367
/**********************************************************
356
368
*/
357
-
369
+
358
370
protected String decap (String name ) {
359
371
char c = name .charAt (0 );
360
372
if (name .length () > 1
0 commit comments