summaryrefslogtreecommitdiff
path: root/cpp/src/slice2java/Gen.cpp
diff options
context:
space:
mode:
authorJoe George <joe@zeroc.com>2023-10-09 13:47:52 -0400
committerGitHub <noreply@github.com>2023-10-09 13:47:52 -0400
commit45cf4a9ccba65d4d2b8129d11c4debcb117cbc68 (patch)
treeadb98c12bd36c24eafc39b00d456cdd03ea051bd /cpp/src/slice2java/Gen.cpp
parentRework Java & Java Compat README files (#1538) (diff)
downloadice-45cf4a9ccba65d4d2b8129d11c4debcb117cbc68.tar.bz2
ice-45cf4a9ccba65d4d2b8129d11c4debcb117cbc68.tar.xz
ice-45cf4a9ccba65d4d2b8129d11c4debcb117cbc68.zip
slice2java: fix constructor parameter count check (#1540)
Closes #1539
Diffstat (limited to 'cpp/src/slice2java/Gen.cpp')
-rw-r--r--cpp/src/slice2java/Gen.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index dbd2ddfd280..7cd4c75f268 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -2552,9 +2552,9 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
out << eb;
//
- // A method cannot have more than 255 parameters (including the implicit "this" argument).
+ // Generate constructor if the parameter list is not too large.
//
- if(allDataMembers.size() < 255)
+ if(isValidMethodParameterList(allDataMembers))
{
DataMemberList baseDataMembers;
if(baseClass)
@@ -2945,9 +2945,9 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
}
//
- // A method cannot have more than 255 parameters (including the implicit "this" argument).
+ // Generate constructor if the parameter list is not too large.
//
- if(allDataMembers.size() < 255)
+ if(isValidMethodParameterList(allDataMembers))
{
if(hasRequiredMembers && hasOptionalMembers)
{
@@ -3010,8 +3010,9 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
//
// Create constructor that takes all data members plus a Throwable.
+ // Do this only when the parameter list is not too large.
//
- if(allDataMembers.size() < 254)
+ if(isValidMethodParameterList(allDataMembers, 1))
{
const string causeParamName = getEscapedParamName(allDataMembers, "cause");
@@ -3090,9 +3091,10 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
out << eb;
//
- // Create constructor that takes all data members plus a Throwable
+ // Create constructor that takes all data members plus a Throwable.
+ // Do this only when the parameter list is not too large.
//
- if(allDataMembers.size() < 254)
+ if(isValidMethodParameterList(allDataMembers, 1))
{
const string causeParamName = getEscapedParamName(allDataMembers, "cause");
@@ -3382,9 +3384,9 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
out << eb;
//
- // A method cannot have more than 255 parameters (including the implicit "this" argument).
+ // Generate constructor if the parameter list is not too large.
//
- if(members.size() < 255)
+ if(isValidMethodParameterList(members))
{
vector<string> paramDecl;
vector<string> paramNames;