Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Michal Tkacz is currently offline Michal TkaczFriend
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 #553880 is a reply to message #553870] Thu, 19 August 2010 09:32 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
Acceleo and Xpand don't have the same mechanism as Jet so no java code is generated from the template which is directly executed i.e. you can't have that problem with those tools.
Re: [JET] The code of constructor Editor() is exceeding the 65535 bytes limit [message #553892 is a reply to message #553880] Thu, 19 August 2010 10:58 Go to previous messageGo to next message
Michal Tkacz is currently offline Michal TkaczFriend
Messages: 105
Registered: July 2009
Senior Member
Thanks Sylvain,

Unfortunately Acceleo's and Xpand's template languages look quite
different from that of JET. It seems that there's no way to import
existing JET templates into any of these tools either, or is there?

Michal

On 08/19/2010 11:32 AM, Sylvain EVEILLARD wrote:
> Acceleo and Xpand don't have the same mechanism as Jet so no java code
> is generated from the template which is directly executed i.e. you can't
> have that problem with those tools.
Re: [JET] The code of constructor Editor() is exceeding the 65535 bytes limit [message #553918 is a reply to message #553892] Thu, 19 August 2010 12:19 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
Michal Tkacz wrote on Thu, 19 August 2010 06:58
Thanks Sylvain,

Unfortunately Acceleo's and Xpand's template languages look quite
different from that of JET. It seems that there's no way to import
existing JET templates into any of these tools either, or is there?

Michal

I don't think there is anything that does that right now.
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 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
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>&lt;%new Runnable() { public void run() {%&gt;<br>
&lt;%}}.run();%&gt;<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 &lt;%@include%&gt; 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 Go to previous message
Michal Tkacz is currently offline Michal TkaczFriend
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
Previous Topic:How to use the EditingDomain to update a model
Next Topic:XMLResource serialization of cross-resource references vs. schema conformity
Goto Forum:
  


Current Time: Fri Mar 29 15:56:24 GMT 2024

Powered by FUDForum. Page generated in 0.02547 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top