This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 256178 - Stop constructor generation from @Model if more than 255 properties
Summary: Stop constructor generation from @Model if more than 255 properties
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Html4j (show other bugs)
Version: 8.2
Hardware: PC Mac OS X
: P2 normal (vote)
Assignee: Jaroslav Tulach
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-26 11:29 UTC by maxnitribitt
Modified: 2015-10-28 18:30 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
proposed patch (1.61 KB, application/octet-stream)
2015-10-26 12:07 UTC, maxnitribitt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description maxnitribitt 2015-10-26 11:29:47 UTC
According to Java VM specifications a method is not allowed to have more than 255 parameters (https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3):

"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."

expected behaviour:

Only a parameterless constructor should be created in this case.

perceived behaviour:

An invalid parameter is generated.

workaround:

There's the possibility to let the annotation processor generate the Model,
 then disable the Annotation and move the generated class into your regular source package. You can then remove the offending constructor and use the model. This
 solution is impractical and only works in certain cases where you don't have any function definitions or ComputedProperty.

  

If there are more than 255 Properties the AnnotationProcessor will generate an invalid constructor and compilation will fail with "error, too many parameters".
Comment 1 maxnitribitt 2015-10-26 11:33:14 UTC
I somehow destroyed the order of my description. The last sentence should be the first:

If there are more than 255 Properties on a Model Annotation, the AnnotationProcessor will generate an invalid constructor and compilation will fail with "error, too many parameters".
Comment 2 maxnitribitt 2015-10-26 12:07:33 UTC
Created attachment 156974 [details]
proposed patch
Comment 3 Jaroslav Tulach 2015-10-28 18:12:23 UTC
The patch properly identifies the place where to make the change, but needs to take in account also behavior of array properties.
Comment 4 Jaroslav Tulach 2015-10-28 18:30:50 UTC
Should be part of HTML/Java post 1.2.3 release:
http://hg.netbeans.org/html4j/rev/267ca1bfeb6f