Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2007

Tip: Looking for answers? Try searching our database.

too many parameters

Thread view: 
Richard Reynolds - 13 Dec 2007 19:17 GMT
Guys, I'm updating some legacy code from Java 1.3.1 to at least 1.4.2_13.

It's a CORBA app (Orbix) and the idl has many modules with many data
members.

The orbix idlj generates two constructors: a no param constructor and one
that takes all data members as params. The later can have hundreds of params
and somewhere between Java 1.3.1 and 1.4.2 a limit seems to have been placed
on the number of params to around 255, or at least that's the limit I've
seen mentioned in a couple of places retrieved from Google searches.

I was wondering if anyone knows if this limit has been lifted in any later
Java version or if there're any compiler options to disable it?

I've also posted on the Orbzone forum to see if there's an Orbix 6.3 idlj
option to stop it adding these constrctors but I'm not hopeful there.

P.S. I'm very limited in messing with the build as it has to be compliant
with a very restrictive compliance system that monitors technology
compatibilities etc.
I am also assuming that there was no param limit in 1.3.1 as the component
must have built before, though thinking about it I should try that tomorrow
as I guess it could've been fudged by messing with the generated Java files,
or possibly the previous Orbix version, 5.1, didn't generate these
constructors by default.

Cheers, Richard.
Roedy Green - 13 Dec 2007 21:22 GMT
On Thu, 13 Dec 2007 19:17:11 GMT, "Richard Reynolds"
<richiereynolds@ntlworld.com> wrote, quoted or indirectly quoted
someone who said :

>on the number of params to around 255, or at least that's the limit I've
>seen mentioned in a couple of places retrieved from Google searches.

One way to find out is download the latest Java, or the one you want
to use, and cook up a method with 255 parms.  Then compile.

If it eats it, try 256. If not binary search till you find the limit.

This sounds like a limit that is burned into the class file format
somewhere. 255 would be a 1-byte count.  That would be hard to change
now.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Lew - 14 Dec 2007 01:11 GMT
> On Thu, 13 Dec 2007 19:17:11 GMT, "Richard Reynolds"
> <richiereynolds@ntlworld.com> wrote, quoted or indirectly quoted
[quoted text clipped - 11 lines]
> somewhere. 255 would be a 1-byte count.  That would be hard to change
> now.

If there is such a limit it would violate the JLS.

> FormalParameterList:
>     LastFormalParameter
[quoted text clipped - 3 lines]
>     FormalParameter
>     FormalParameters , FormalParameter
<http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.4.1>

If there is a limit to method arity it isn't mentioned in the JLS or in any
source I was able to scare up in a quick web search.

Signature

Lew

Big Jim - 14 Dec 2007 10:35 GMT
> > On Thu, 13 Dec 2007 19:17:11 GMT, "Richard Reynolds"
> > <richiereyno...@ntlworld.com> wrote, quoted or indirectly quoted
[quoted text clipped - 31 lines]
>
> - Show quoted text -

Well, there does seem to be a limit of soms sort, I get this error
message in eclipse:
"Too many parameters, parameter CrvV75 is exceeding the limit of 255
words eligible for method parameters"
This is appearing against param 178 in a constructor using a 1.5
compiler with source compatibility set to 1.4.
Lew - 14 Dec 2007 14:17 GMT
> Well, there does seem to be a limit of soms sort, I get this error
> message in eclipse:
> "Too many parameters, parameter CrvV75 is exceeding the limit of 255
> words eligible for method parameters"
> This is appearing against param 178 in a constructor using a 1.5
> compiler with source compatibility set to 1.4.

Parameter 178, not parameter 255?

Whose JDK?

Signature

Lew

Larry A Barowski - 14 Dec 2007 15:19 GMT
>> Well, there does seem to be a limit of soms sort, I get this error
>> message in eclipse:
[quoted text clipped - 4 lines]
>
> Parameter 178, not parameter 255?

From the VM specification, "A method descriptor is valid only if it
represents
method parameters with a total length of 255 or less, where that length
includes
the contribution for 'this' in the case of instance or interface method
invocations.
The total length is calculated by summing the contributions of the
individual
parameters, where a parameter of type long or double contributes two units
to
the length and a parameter of any other type contributes one unit."
Big Jim - 14 Dec 2007 16:01 GMT
On 14 Dec, 15:19, "Larry A Barowski"
<ThisisLarrybarAtEngDotAuburnDotLearninginstitution> wrote:

> >> Well, there does seem to be a limit of soms sort, I get this error
> >> message in eclipse:
[quoted text clipped - 16 lines]
> to
> the length and a parameter of any other type contributes one unit."

Sounds like my problem alright. Oh well, guess I have to find another
solution. Thanks for that info.
Big Jim - 14 Dec 2007 15:59 GMT
> > Well, there does seem to be a limit of soms sort, I get this error
> > message in eclipse:
[quoted text clipped - 4 lines]
>
> Parameter 178, not parameter 255?

Yep.

> Whose JDK?
>
> --
> Lew

Sun's.
Mark Thornton - 14 Dec 2007 20:07 GMT
> If there is a limit to method arity it isn't mentioned in the JLS or in
> any source I was able to scare up in a quick web search.

These limits appear in the JVM specification.
Joshua Cranmer - 14 Dec 2007 01:32 GMT
> The orbix idlj generates two constructors: a no param constructor and one
> that takes all data members as params. The later can have hundreds of params
[quoted text clipped - 4 lines]
> I was wondering if anyone knows if this limit has been lifted in any later
> Java version or if there're any compiler options to disable it?

Well, the VM spec limits the maximum possible arity to 65533, which is
assuming that all arguments are primitive types and that the return type
is either primitive or void. This limit is based on the fact that the
method descriptor is stored in as a UTF-8 string with an unsigned 2-byte
length. Two characters are '(' and ')'; the last one is for the return type.

Signature

Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth

Owen Jacobson - 14 Dec 2007 21:51 GMT
On Dec 13, 11:17 am, "Richard Reynolds" <richiereyno...@ntlworld.com>
wrote:
> Guys, I'm updating some legacy code from Java 1.3.1 to at least 1.4.2_13.
>
[quoted text clipped - 23 lines]
>
> Cheers, Richard.

What kind of objects are these, that have hundreds of members?
Big Jim - 16 Dec 2007 18:03 GMT
> On Dec 13, 11:17 am, "Richard Reynolds" <richiereyno...@ntlworld.com>
> wrote:
[quoted text clipped - 30 lines]
>
> - Show quoted text -

They're business objects, to represent financial entities e.g. bond
trades. They're really just name value pairs or sublists of the same
but are defined in IDL as they are passed over networks to systems
working in defferent languages. The problem isn't with there being
many members but that, as well as all the getters and setters, for
java, Orbix generates a constructor taking every member by default!


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.