summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/JavaUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Slice/JavaUtil.cpp')
-rw-r--r--cpp/src/Slice/JavaUtil.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp
index ad20211a1c7..9ad435fbae7 100644
--- a/cpp/src/Slice/JavaUtil.cpp
+++ b/cpp/src/Slice/JavaUtil.cpp
@@ -669,6 +669,28 @@ Slice::computeSerialVersionUUID(const ExceptionPtr& p)
return hashCode;
}
+bool
+Slice::isValidMethodParameterList(const DataMemberList& members, int additionalUnits)
+{
+ // The maximum length of a method parameter list is 255 units, including the implicit 'this' parameter.
+ // Each parameter is 1 unit, except for long and double parameters, which are 2 units.
+ // Start the length at 1 to account for the implicit 'this' parameter (plus any additional units).
+ int length = 1 + additionalUnits;
+ for(DataMemberList::const_iterator p = members.begin(); p != members.end(); ++p)
+ {
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast((*p)->type());
+ if(builtin && (builtin->kind() == Builtin::KindLong || builtin->kind() == Builtin::KindDouble))
+ {
+ length += 2;
+ }
+ else
+ {
+ length++;
+ }
+ }
+ return length <= 255;
+}
+
Slice::JavaOutput::JavaOutput()
{
}