Home » Modeling » EMF » [JET] The code of constructor Editor() is exceeding the 65535 bytes limit
[JET] The code of constructor Editor() is exceeding the 65535 bytes limit [message #553870] |
Thu, 19 August 2010 08:52 |
Michal Tkacz Messages: 105 Registered: July 2009 |
Senior Member |
|
|
Hi,
I'm using JET to create my own template classes and then use them with
EMF generator. The templates became quite complicated over time which
led me to a point where the Java compiler complains about the template
classes, e.g.:
The code of constructor Editor() is exceeding the 65535 bytes limit
This seems to be a limitation of Java and in this case it is caused by
the huge amount of fields TEXT_1, TEXT_2, ... created from the template
(I already have a few thousands of them).
Did anyone come across this problem before?
In order to try and fix it I modified JETCompiler class from the
org.eclipse.emf.codegen bundle so that the strings get inlined which
removed the need for the fields TEXT_1, TEXT_2, ... .
Now I get
The code of method generate() is exceeding the 65535 bytes limit
So there seems to be no way to escape from the problem, which is a real
blocker for me right now. Note that my template is already split into
several files using <%@include%> directive, but this doesn't help at all
because all of them are finally merged into one generate() method.
As far as I know JET2 follows the same pattern for the generated code so
probably it suffers from the same problem. Am I right?
Can someone suggest any other tool (Acceleo? Xpand?) which might
successfully generate code from my templates (by splitting the code into
several methods I guess)?
Thanks,
Michal
|
|
| | | |
Re: [JET] The code of constructor Editor() is exceeding the 65535 bytes limit [message #553970 is a reply to message #553870] |
Thu, 19 August 2010 14:32 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------080600050806080802070503
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Michał,
A trick we used in our Class.javajet, which got too big, is to surround
a section in the template with
<%new Runnable() { public void run() {%>
<%}}.run();%>
This causes that stuff to be generated in an inner class thereby
reducing the byte code of the method in which this is nested. You'll
need to make out stuff that needs to be visible in there final...
It's dirty but effective.
Michał Tkacz wrote:
> Hi,
>
> I'm using JET to create my own template classes and then use them with
> EMF generator. The templates became quite complicated over time which
> led me to a point where the Java compiler complains about the template
> classes, e.g.:
>
> The code of constructor Editor() is exceeding the 65535 bytes limit
>
> This seems to be a limitation of Java and in this case it is caused by
> the huge amount of fields TEXT_1, TEXT_2, ... created from the
> template (I already have a few thousands of them).
>
> Did anyone come across this problem before?
>
> In order to try and fix it I modified JETCompiler class from the
> org.eclipse.emf.codegen bundle so that the strings get inlined which
> removed the need for the fields TEXT_1, TEXT_2, ... .
>
> Now I get
>
> The code of method generate() is exceeding the 65535 bytes limit
>
> So there seems to be no way to escape from the problem, which is a
> real blocker for me right now. Note that my template is already split
> into several files using <%@include%> directive, but this doesn't help
> at all because all of them are finally merged into one generate() method.
>
> As far as I know JET2 follows the same pattern for the generated code
> so probably it suffers from the same problem. Am I right?
>
> Can someone suggest any other tool (Acceleo? Xpand?) which might
> successfully generate code from my templates (by splitting the code
> into several methods I guess)?
>
> Thanks,
>
> Michal
--------------080600050806080802070503
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Michał,<br>
<br>
A trick we used in our Class.javajet, which got too big, is to surround
a section in the template with<br>
<blockquote><%new Runnable() { public void run() {%><br>
<%}}.run();%><br>
</blockquote>
This causes that stuff to be generated in an inner class thereby
reducing the byte code of the method in which this is nested. You'll
need to make out stuff that needs to be visible in there final...<br>
<br>
It's dirty but effective.<br>
<br>
<br>
Michał Tkacz wrote:
<blockquote cite="mid:i4irc5$eib$1@build.eclipse.org" type="cite">Hi,
<br>
<br>
I'm using JET to create my own template classes and then use them with
EMF generator. The templates became quite complicated over time which
led me to a point where the Java compiler complains about the template
classes, e.g.:
<br>
<br>
The code of constructor Editor() is exceeding the 65535 bytes limit
<br>
<br>
This seems to be a limitation of Java and in this case it is caused by
the huge amount of fields TEXT_1, TEXT_2, ... created from the template
(I already have a few thousands of them).
<br>
<br>
Did anyone come across this problem before?
<br>
<br>
In order to try and fix it I modified JETCompiler class from the
org.eclipse.emf.codegen bundle so that the strings get inlined which
removed the need for the fields TEXT_1, TEXT_2, ... .
<br>
<br>
Now I get
<br>
<br>
The code of method generate() is exceeding the 65535 bytes limit
<br>
<br>
So there seems to be no way to escape from the problem, which is a real
blocker for me right now. Note that my template is already split into
several files using <%@include%> directive, but this doesn't help
at all because all of them are finally merged into one generate()
method.
<br>
<br>
As far as I know JET2 follows the same pattern for the generated code
so probably it suffers from the same problem. Am I right?
<br>
<br>
Can someone suggest any other tool (Acceleo? Xpand?) which might
successfully generate code from my templates (by splitting the code
into several methods I guess)?
<br>
<br>
Thanks,
<br>
<br>
Michal
<br>
</blockquote>
</body>
</html>
--------------080600050806080802070503--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: [JET] The code of constructor Editor() is exceeding the 65535 bytes limit [message #554035 is a reply to message #553970] |
Thu, 19 August 2010 19:13 |
Michal Tkacz Messages: 105 Registered: July 2009 |
Senior Member |
|
|
Wow, it is so obvious now!
Thank you Ed! You saved my day!
Michal
On 08/19/2010 04:32 PM, Ed Merks wrote:
> Michał,
>
> A trick we used in our Class.javajet, which got too big, is to surround
> a section in the template with
>
> <%new Runnable() { public void run() {%>
> <%}}.run();%>
>
> This causes that stuff to be generated in an inner class thereby
> reducing the byte code of the method in which this is nested. You'll
> need to make out stuff that needs to be visible in there final...
>
> It's dirty but effective.
>
>
> Michał Tkacz wrote:
>> Hi,
>>
>> I'm using JET to create my own template classes and then use them with
>> EMF generator. The templates became quite complicated over time which
>> led me to a point where the Java compiler complains about the template
>> classes, e.g.:
>>
>> The code of constructor Editor() is exceeding the 65535 bytes limit
>>
>> This seems to be a limitation of Java and in this case it is caused by
>> the huge amount of fields TEXT_1, TEXT_2, ... created from the
>> template (I already have a few thousands of them).
>>
>> Did anyone come across this problem before?
>>
>> In order to try and fix it I modified JETCompiler class from the
>> org.eclipse.emf.codegen bundle so that the strings get inlined which
>> removed the need for the fields TEXT_1, TEXT_2, ... .
>>
>> Now I get
>>
>> The code of method generate() is exceeding the 65535 bytes limit
>>
>> So there seems to be no way to escape from the problem, which is a
>> real blocker for me right now. Note that my template is already split
>> into several files using <%@include%> directive, but this doesn't help
>> at all because all of them are finally merged into one generate() method.
>>
>> As far as I know JET2 follows the same pattern for the generated code
>> so probably it suffers from the same problem. Am I right?
>>
>> Can someone suggest any other tool (Acceleo? Xpand?) which might
>> successfully generate code from my templates (by splitting the code
>> into several methods I guess)?
>>
>> Thanks,
>>
>> Michal
|
|
|
Goto Forum:
Current Time: Sun Apr 28 21:07:12 GMT 2024
Powered by FUDForum. Page generated in 0.03530 seconds
|