private void addCallableMemberDescriptor(ReflectionCallableMemberDescriptor memberDesc) { // Note: "varargs" methods are always callable as fixed args, with a sequence (array) as the last parameter. fixArgMethods.addCallableMemberDescriptor(memberDesc); if (memberDesc.isVarargs()) { if (varargMethods == null) { varargMethods = new OverloadedVarArgsMethods(bugfixed); } varargMethods.addCallableMemberDescriptor(memberDesc); } }
final Class[][] unwrappingHintsByParamCount = getUnwrappingHintsByParamCount(); final Object[] pojoArgs = new Object[argsLen]; int[] typesFlags = null; typesFlags = getTypeFlags(paramCount); if (typesFlags == ALL_ZEROS_ARRAY) { typesFlags = null; MaybeEmptyCallableMemberDescriptor maybeEmtpyMemberDesc = getMemberDescriptorForArgs(pojoArgs, true); if (maybeEmtpyMemberDesc instanceof CallableMemberDescriptor) { CallableMemberDescriptor memberDesc = (CallableMemberDescriptor) maybeEmtpyMemberDesc; Object[] pojoArgsWithArray; Object argsOrErrorIdx = replaceVarargsSectionWithArray(pojoArgs, tmArgs, memberDesc, unwrapper); if (argsOrErrorIdx instanceof Object[]) { pojoArgsWithArray = (Object[]) argsOrErrorIdx; forceNumberArgumentsToParameterTypes(pojoArgsWithArray, memberDesc.getParamTypes(), typesFlags);
private void widenHintsToCommonSupertypes( int paramCountOfWidened, Class[] wideningTypes, int[] wideningTypeFlags) { final Class[] typesToWiden = getUnwrappingHintsByParamCount()[paramCountOfWidened]; if (typesToWiden == null) { return; // no such overload exists; nothing to widen } final int typesToWidenLen = typesToWiden.length; final int wideningTypesLen = wideningTypes.length; int min = Math.min(wideningTypesLen, typesToWidenLen); for (int i = 0; i < min; ++i) { typesToWiden[i] = getCommonSupertypeForUnwrappingHint(typesToWiden[i], wideningTypes[i]); } if (typesToWidenLen > wideningTypesLen) { Class varargsComponentType = wideningTypes[wideningTypesLen - 1]; for (int i = wideningTypesLen; i < typesToWidenLen; ++i) { typesToWiden[i] = getCommonSupertypeForUnwrappingHint(typesToWiden[i], varargsComponentType); } } if (bugfixed) { mergeInTypesFlags(paramCountOfWidened, wideningTypeFlags); } }
final Class[][] unwrappingHintsByParamCount = getUnwrappingHintsByParamCount(); final Class[] previousHints = unwrappingHintsByParamCount[i]; if (previousHints != null) { widenHintsToCommonSupertypes( paramCount, previousHints, getTypeFlags(i)); break; // we only do this for the first hit, as the methods before that has already widened it. Class[] oneLongerHints = unwrappingHintsByParamCount[paramCount + 1]; if (oneLongerHints != null) { widenHintsToCommonSupertypes( paramCount, oneLongerHints, getTypeFlags(paramCount + 1)); widenHintsToCommonSupertypes( i, paramTypes, paramNumericalTypes); widenHintsToCommonSupertypes( paramCount - 1, paramTypes, paramNumericalTypes);
final Class[][] unwrappingHintsByParamCount = getUnwrappingHintsByParamCount(); final Class[] previousHints = unwrappingHintsByParamCount[i]; if (previousHints != null) { widenHintsToCommonSupertypes( paramCount, previousHints, getTypeFlags(i)); break; // we only do this for the first hit, as the methods before that has already widened it. Class[] oneLongerHints = unwrappingHintsByParamCount[paramCount + 1]; if (oneLongerHints != null) { widenHintsToCommonSupertypes( paramCount, oneLongerHints, getTypeFlags(paramCount + 1)); widenHintsToCommonSupertypes( i, paramTypes, paramNumericalTypes); widenHintsToCommonSupertypes( paramCount - 1, paramTypes, paramNumericalTypes);
final Class[][] unwrappingHintsByParamCount = getUnwrappingHintsByParamCount(); final Object[] pojoArgs = new Object[argsLen]; int[] typesFlags = null; typesFlags = getTypeFlags(paramCount); if (typesFlags == ALL_ZEROS_ARRAY) { typesFlags = null; MaybeEmptyCallableMemberDescriptor maybeEmtpyMemberDesc = getMemberDescriptorForArgs(pojoArgs, true); if (maybeEmtpyMemberDesc instanceof CallableMemberDescriptor) { CallableMemberDescriptor memberDesc = (CallableMemberDescriptor) maybeEmtpyMemberDesc; Object[] pojoArgsWithArray; Object argsOrErrorIdx = replaceVarargsSectionWithArray(pojoArgs, tmArgs, memberDesc, unwrapper); if (argsOrErrorIdx instanceof Object[]) { pojoArgsWithArray = (Object[]) argsOrErrorIdx; forceNumberArgumentsToParameterTypes(pojoArgsWithArray, memberDesc.getParamTypes(), typesFlags);
private void widenHintsToCommonSupertypes( int paramCountOfWidened, Class[] wideningTypes, int[] wideningTypeFlags) { final Class[] typesToWiden = getUnwrappingHintsByParamCount()[paramCountOfWidened]; if (typesToWiden == null) { return; // no such overload exists; nothing to widen } final int typesToWidenLen = typesToWiden.length; final int wideningTypesLen = wideningTypes.length; int min = Math.min(wideningTypesLen, typesToWidenLen); for (int i = 0; i < min; ++i) { typesToWiden[i] = getCommonSupertypeForUnwrappingHint(typesToWiden[i], wideningTypes[i]); } if (typesToWidenLen > wideningTypesLen) { Class varargsComponentType = wideningTypes[wideningTypesLen - 1]; for (int i = wideningTypesLen; i < typesToWidenLen; ++i) { typesToWiden[i] = getCommonSupertypeForUnwrappingHint(typesToWiden[i], varargsComponentType); } } if (bugfixed) { mergeInTypesFlags(paramCountOfWidened, wideningTypeFlags); } }
final Class[][] unwrappingHintsByParamCount = getUnwrappingHintsByParamCount(); final Class[] previousHints = unwrappingHintsByParamCount[i]; if (previousHints != null) { widenHintsToCommonSupertypes( paramCount, previousHints, getTypeFlags(i)); break; // we only do this for the first hit, as the methods before that has already widened it. Class[] oneLongerHints = unwrappingHintsByParamCount[paramCount + 1]; if (oneLongerHints != null) { widenHintsToCommonSupertypes( paramCount, oneLongerHints, getTypeFlags(paramCount + 1)); widenHintsToCommonSupertypes( i, paramTypes, paramNumericalTypes); widenHintsToCommonSupertypes( paramCount - 1, paramTypes, paramNumericalTypes);
private void addCallableMemberDescriptor(ReflectionCallableMemberDescriptor memberDesc) { // Note: "varargs" methods are always callable as fixed args, with a sequence (array) as the last parameter. fixArgMethods.addCallableMemberDescriptor(memberDesc); if (memberDesc.isVarargs()) { if (varargMethods == null) { varargMethods = new OverloadedVarArgsMethods(bugfixed); } varargMethods.addCallableMemberDescriptor(memberDesc); } }
final Class[][] unwrappingHintsByParamCount = getUnwrappingHintsByParamCount(); final Object[] pojoArgs = new Object[argsLen]; int[] typesFlags = null; typesFlags = getTypeFlags(paramCount); if (typesFlags == ALL_ZEROS_ARRAY) { typesFlags = null; MaybeEmptyCallableMemberDescriptor maybeEmtpyMemberDesc = getMemberDescriptorForArgs(pojoArgs, true); if (maybeEmtpyMemberDesc instanceof CallableMemberDescriptor) { CallableMemberDescriptor memberDesc = (CallableMemberDescriptor) maybeEmtpyMemberDesc; Object[] pojoArgsWithArray; Object argsOrErrorIdx = replaceVarargsSectionWithArray(pojoArgs, tmArgs, memberDesc, unwrapper); if (argsOrErrorIdx instanceof Object[]) { pojoArgsWithArray = (Object[]) argsOrErrorIdx; forceNumberArgumentsToParameterTypes(pojoArgsWithArray, memberDesc.getParamTypes(), typesFlags);
private void widenHintsToCommonSupertypes( int paramCountOfWidened, Class[] wideningTypes, int[] wideningTypeFlags) { final Class[] typesToWiden = getUnwrappingHintsByParamCount()[paramCountOfWidened]; if (typesToWiden == null) { return; // no such overload exists; nothing to widen } final int typesToWidenLen = typesToWiden.length; final int wideningTypesLen = wideningTypes.length; int min = Math.min(wideningTypesLen, typesToWidenLen); for (int i = 0; i < min; ++i) { typesToWiden[i] = getCommonSupertypeForUnwrappingHint(typesToWiden[i], wideningTypes[i]); } if (typesToWidenLen > wideningTypesLen) { Class varargsComponentType = wideningTypes[wideningTypesLen - 1]; for (int i = wideningTypesLen; i < typesToWidenLen; ++i) { typesToWiden[i] = getCommonSupertypeForUnwrappingHint(typesToWiden[i], varargsComponentType); } } if (bugfixed) { mergeInTypesFlags(paramCountOfWidened, wideningTypeFlags); } }
private void addCallableMemberDescriptor(ReflectionCallableMemberDescriptor memberDesc) { // Note: "varargs" methods are always callable as fixed args, with a sequence (array) as the last parameter. fixArgMethods.addCallableMemberDescriptor(memberDesc); if (memberDesc.isVarargs()) { if (varargMethods == null) { varargMethods = new OverloadedVarArgsMethods(bugfixed); } varargMethods.addCallableMemberDescriptor(memberDesc); } }