Skip to content

Try to make code android 6 (SDK 23) compatible #4237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,13 @@ protected SettableBeanProperty _resolveInnerClassValuedProperty(DeserializationC
// and is inner class of the bean class...
if ((enclosing != null) && (enclosing == _beanType.getRawClass())) {
for (Constructor<?> ctor : valueClass.getConstructors()) {
if (ctor.getParameterCount() == 1) {
int paramCount=0;
try{
paramCount=ctor.getParameterCount();
}catch (NoSuchMethodError e){
paramCount=ctor.getParameterTypes().length;
}
if (paramCount == 1) {
Class<?>[] paramTypes = ctor.getParameterTypes();
if (enclosing.equals(paramTypes[0])) {
if (ctxt.canOverrideAccessModifiers()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ public Class<?> getRawType() {

@Override
public int getParameterCount() {
return _constructor.getParameterCount();
try{
return _constructor.getParameterCount();
}catch (NoSuchMethodError e){
return _constructor.getParameterTypes().length;
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,12 @@ protected AnnotatedConstructor constructNonDefaultConstructor(ClassUtil.Ctor cto
protected AnnotatedMethod constructFactoryCreator(Method m,
TypeResolutionContext typeResCtxt, Method mixin)
{
final int paramCount = m.getParameterCount();
int paramCount = 0;
try{
paramCount=m.getParameterCount();
}catch (NoSuchMethodError e){
paramCount=m.getParameterTypes().length;
}
if (_intr == null) { // when annotation processing is disabled
return new AnnotatedMethod(typeResCtxt, m, _emptyAnnotationMap(),
_emptyAnnotationMaps(paramCount));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ public final Object callOnWith(Object pojo, Object... args) throws Exception {

@Override
public int getParameterCount() {
return _method.getParameterCount();
try{
return _method.getParameterCount();
}catch (NoSuchMethodError e){
return _method.getParameterTypes().length;
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,13 @@ private static boolean _isIncludableMemberMethod(Method m)
}
// also, for now we have no use for methods with more than 2 arguments:
// (2 argument methods for "any setter", fwtw)
return (m.getParameterCount() <= 2);
int paramCount=0;
try{
paramCount=m.getParameterCount();
}catch (NoSuchMethodError e){
paramCount=m.getParameterTypes().length;
}
return (paramCount <= 2);
}

private final static class MethodBuilder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,11 @@ public Constructor<?> getConstructor() {
public int getParamCount() {
int c = _paramCount;
if (c < 0) {
c = _ctor.getParameterCount();
try{
c = _ctor.getParameterCount();
}catch (NoSuchMethodError e){
c=_ctor.getParameterTypes().length;
}
_paramCount = c;
}
return c;
Expand Down