Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » How to let jet/emf codegen generate incorrect java files?
How to let jet/emf codegen generate incorrect java files? [message #71526] Wed, 14 February 2007 19:43 Go to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
I am upgrading a code generation project to emf 2.3. Something which seems to have changed is that
when I make a mistake in my template it seems that Jet does not generate the java source file but
instead throws a RuntimeException. Is there a way for me to let jet still generate the source file
and save it? This makes it easier to identify the error in the template.

Also jet does not seem to create a .JETEmitters project anymore.

--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: How to let jet/emf codegen generate incorrect java files? [message #71564 is a reply to message #71526] Wed, 14 February 2007 19:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------000502000308090307000502
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Martin,

A similar type of issue came up in the GMF newsgroup and in that case it
wasn't really even an error in the generated code but simply a redundant
semicolon that was configured to be treated as a warning. The issue
arises *here *in ASTFacadeHelper:

public ASTJCompilationUnit createCompilationUnit(String name,
String contents)
{
// set source
char[] contentAsCharArray = contents.toCharArray();
ASTParser astParser = createASTParser();
astParser.setSource(contentAsCharArray);

// parse
CompilationUnit astCompilationUnit =
(CompilationUnit)astParser.createAST(null);

// display errors if any
*if (astCompilationUnit.getProblems().length > 0)*
{
// TODO do a better job with reporting errors
String problems =
logCompilationErrors(astCompilationUnit.getProblems());

// NAME may be passed as name - do not show it
if (name != null && !"".equals(name) && !"NAME".equals(name))
{
problems = name + ":" + problems;
}

// stop merging and report problems
throw new RuntimeException(problems);
}

It seems to me it might be best to continue despite errors because a
whole bunch of times I've needed to set a breakpoint here and look at
the value of "contents" to see what's gone wrong when it would have been
easier to see it in the generated result. Please open a bugzilla to
track this issue. I'd like to discuss this with Marcelo (and Dave) but
Marcelo is on vacation. You could comment out this block of code in
your local version in the meantime...

I tried setting dynamic templates to true in a sample model and the
..JETEmitter project is still created as always. You aren't just
filtering it out are you?


Martin Taal wrote:
> Hi,
> I am upgrading a code generation project to emf 2.3. Something which
> seems to have changed is that when I make a mistake in my template it
> seems that Jet does not generate the java source file but instead
> throws a RuntimeException. Is there a way for me to let jet still
> generate the source file and save it? This makes it easier to identify
> the error in the template.
>
> Also jet does not seem to create a .JETEmitters project anymore.
>


--------------000502000308090307000502
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Martin,<br>
<br>
A similar type of issue came up in the GMF newsgroup and in that case
it wasn't really even an error in the generated code but simply a
redundant semicolon that was configured to be treated as a warning.&nbsp;&nbsp;&nbsp;
The issue arises <b>here </b>in ASTFacadeHelper:<br>
<blockquote><small>&nbsp; public ASTJCompilationUnit
createCompilationUnit(String name, String contents)<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; // set source<br>
&nbsp;&nbsp;&nbsp; char[] contentAsCharArray = contents.toCharArray();<br>
&nbsp;&nbsp;&nbsp; ASTParser astParser = createASTParser();<br>
&nbsp;&nbsp;&nbsp; astParser.setSource(contentAsCharArray);<br>
<br>
&nbsp;&nbsp;&nbsp; // parse<br>
&nbsp;&nbsp;&nbsp; CompilationUnit astCompilationUnit =
(CompilationUnit)astParser.createAST(null);<br>
<br>
&nbsp;&nbsp;&nbsp; // display errors if any<br>
&nbsp;&nbsp;&nbsp; <b>if (astCompilationUnit.getProblems().length &gt; 0)</b><br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // TODO do a better job with reporting errors&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String problems =
logCompilationErrors(astCompilationUnit.getProblems());<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // NAME may be passed as name - do not show it<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (name != null &amp;&amp; !"".equals(name) &amp;&amp;
!"NAME".equals(name))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; problems = name + ":" + problems;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // stop merging and report problems<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new RuntimeException(problems);<br>
&nbsp;&nbsp;&nbsp; }</small><small></small><br>
</blockquote>
It seems to me it might be best to continue despite errors because a
whole bunch of times I've needed to set a breakpoint here and look at
the value of "contents" to see what's gone wrong when it would have
been easier to see it in the generated result.&nbsp; Please open a bugzilla
to track this issue.&nbsp; I'd like to discuss this with Marcelo (and Dave)
but Marcelo is on vacation.&nbsp; You could comment out this block of code
in your local version in the meantime...<br>
<br>
I tried setting dynamic templates to true in a sample model and the
..JETEmitter project is still created as always.&nbsp; You aren't just
filtering it out are you?<br>
<br>
<br>
Martin Taal wrote:
<blockquote cite="mideqvooc$1gd$1@utils.eclipse.org" type="cite">Hi,
<br>
I am upgrading a code generation project to emf 2.3. Something which
seems to have changed is that when I make a mistake in my template it
seems that Jet does not generate the java source file but instead
throws a RuntimeException. Is there a way for me to let jet still
generate the source file and save it? This makes it easier to identify
the error in the template.
<br>
<br>
Also jet does not seem to create a .JETEmitters project anymore.
<br>
<br>
</blockquote>
<br>
</body>
</html>

--------------000502000308090307000502--
Re: How to let jet/emf codegen generate incorrect java files? [message #71582 is a reply to message #71564] Wed, 14 February 2007 20:00 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Ed,
Thanks, I will enter a feature request.

Regarding the jetemitters project. I do this:
final Generator generator = new Generator(registry);
generator.setInput(genModel);
generator.getOptions().codeFormatting = true;
generator.getOptions().dynamicTemplates = true;
generator.getOptions().forceOverwrite = true;

I also tried setting the projectname on the jetemitters but without result.
Before I could see the .JETEmitters project in the java browsing perspective but now its not shown
(because it is not there or it is hidden). To ask a basic eclipse question, how can I make hidden
projects visible?

gr. Martin

Ed Merks wrote:
> Martin,
>
> A similar type of issue came up in the GMF newsgroup and in that case it
> wasn't really even an error in the generated code but simply a redundant
> semicolon that was configured to be treated as a warning. The issue
> arises *here *in ASTFacadeHelper:
>
> public ASTJCompilationUnit createCompilationUnit(String name,
> String contents)
> {
> // set source
> char[] contentAsCharArray = contents.toCharArray();
> ASTParser astParser = createASTParser();
> astParser.setSource(contentAsCharArray);
>
> // parse
> CompilationUnit astCompilationUnit =
> (CompilationUnit)astParser.createAST(null);
>
> // display errors if any
> *if (astCompilationUnit.getProblems().length > 0)*
> {
> // TODO do a better job with reporting errors
> String problems =
> logCompilationErrors(astCompilationUnit.getProblems());
>
> // NAME may be passed as name - do not show it
> if (name != null && !"".equals(name) && !"NAME".equals(name))
> {
> problems = name + ":" + problems;
> }
>
> // stop merging and report problems
> throw new RuntimeException(problems);
> }
>
> It seems to me it might be best to continue despite errors because a
> whole bunch of times I've needed to set a breakpoint here and look at
> the value of "contents" to see what's gone wrong when it would have been
> easier to see it in the generated result. Please open a bugzilla to
> track this issue. I'd like to discuss this with Marcelo (and Dave) but
> Marcelo is on vacation. You could comment out this block of code in
> your local version in the meantime...
>
> I tried setting dynamic templates to true in a sample model and the
> ..JETEmitter project is still created as always. You aren't just
> filtering it out are you?
>
>
> Martin Taal wrote:
>> Hi,
>> I am upgrading a code generation project to emf 2.3. Something which
>> seems to have changed is that when I make a mistake in my template it
>> seems that Jet does not generate the java source file but instead
>> throws a RuntimeException. Is there a way for me to let jet still
>> generate the source file and save it? This makes it easier to identify
>> the error in the template.
>>
>> Also jet does not seem to create a .JETEmitters project anymore.
>>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: How to let jet/emf codegen generate incorrect java files? [message #71637 is a reply to message #71582] Wed, 14 February 2007 20:34 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Martin,

In the Package Explorer the little triangle will bring up a menu that
says "Filters..." and by default .* resources are filtered and hence a
project starting with dot will be filtered.


Martin Taal wrote:
> Ed,
> Thanks, I will enter a feature request.
>
> Regarding the jetemitters project. I do this:
> final Generator generator = new Generator(registry);
> generator.setInput(genModel);
> generator.getOptions().codeFormatting = true;
> generator.getOptions().dynamicTemplates = true;
> generator.getOptions().forceOverwrite = true;
>
> I also tried setting the projectname on the jetemitters but without
> result.
> Before I could see the .JETEmitters project in the java browsing
> perspective but now its not shown (because it is not there or it is
> hidden). To ask a basic eclipse question, how can I make hidden
> projects visible?
>
> gr. Martin
>
> Ed Merks wrote:
>> Martin,
>>
>> A similar type of issue came up in the GMF newsgroup and in that case
>> it wasn't really even an error in the generated code but simply a
>> redundant semicolon that was configured to be treated as a
>> warning. The issue arises *here *in ASTFacadeHelper:
>>
>> public ASTJCompilationUnit createCompilationUnit(String name,
>> String contents)
>> {
>> // set source
>> char[] contentAsCharArray = contents.toCharArray();
>> ASTParser astParser = createASTParser();
>> astParser.setSource(contentAsCharArray);
>>
>> // parse
>> CompilationUnit astCompilationUnit =
>> (CompilationUnit)astParser.createAST(null);
>>
>> // display errors if any
>> *if (astCompilationUnit.getProblems().length > 0)*
>> {
>> // TODO do a better job with reporting errors
>> String problems =
>> logCompilationErrors(astCompilationUnit.getProblems());
>> // NAME may be passed as name - do not show it
>> if (name != null && !"".equals(name) && !"NAME".equals(name))
>> {
>> problems = name + ":" + problems;
>> }
>> // stop merging and report problems
>> throw new RuntimeException(problems);
>> }
>>
>> It seems to me it might be best to continue despite errors because a
>> whole bunch of times I've needed to set a breakpoint here and look at
>> the value of "contents" to see what's gone wrong when it would have
>> been easier to see it in the generated result. Please open a
>> bugzilla to track this issue. I'd like to discuss this with Marcelo
>> (and Dave) but Marcelo is on vacation. You could comment out this
>> block of code in your local version in the meantime...
>>
>> I tried setting dynamic templates to true in a sample model and the
>> ..JETEmitter project is still created as always. You aren't just
>> filtering it out are you?
>>
>>
>> Martin Taal wrote:
>>> Hi,
>>> I am upgrading a code generation project to emf 2.3. Something which
>>> seems to have changed is that when I make a mistake in my template
>>> it seems that Jet does not generate the java source file but instead
>>> throws a RuntimeException. Is there a way for me to let jet still
>>> generate the source file and save it? This makes it easier to
>>> identify the error in the template.
>>>
>>> Also jet does not seem to create a .JETEmitters project anymore.
>>>
>>
>
>
Re: How to let jet/emf codegen generate incorrect java files? [message #602548 is a reply to message #71526] Wed, 14 February 2007 19:56 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000502000308090307000502
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Martin,

A similar type of issue came up in the GMF newsgroup and in that case it
wasn't really even an error in the generated code but simply a redundant
semicolon that was configured to be treated as a warning. The issue
arises *here *in ASTFacadeHelper:

public ASTJCompilationUnit createCompilationUnit(String name,
String contents)
{
// set source
char[] contentAsCharArray = contents.toCharArray();
ASTParser astParser = createASTParser();
astParser.setSource(contentAsCharArray);

// parse
CompilationUnit astCompilationUnit =
(CompilationUnit)astParser.createAST(null);

// display errors if any
*if (astCompilationUnit.getProblems().length > 0)*
{
// TODO do a better job with reporting errors
String problems =
logCompilationErrors(astCompilationUnit.getProblems());

// NAME may be passed as name - do not show it
if (name != null && !"".equals(name) && !"NAME".equals(name))
{
problems = name + ":" + problems;
}

// stop merging and report problems
throw new RuntimeException(problems);
}

It seems to me it might be best to continue despite errors because a
whole bunch of times I've needed to set a breakpoint here and look at
the value of "contents" to see what's gone wrong when it would have been
easier to see it in the generated result. Please open a bugzilla to
track this issue. I'd like to discuss this with Marcelo (and Dave) but
Marcelo is on vacation. You could comment out this block of code in
your local version in the meantime...

I tried setting dynamic templates to true in a sample model and the
..JETEmitter project is still created as always. You aren't just
filtering it out are you?


Martin Taal wrote:
> Hi,
> I am upgrading a code generation project to emf 2.3. Something which
> seems to have changed is that when I make a mistake in my template it
> seems that Jet does not generate the java source file but instead
> throws a RuntimeException. Is there a way for me to let jet still
> generate the source file and save it? This makes it easier to identify
> the error in the template.
>
> Also jet does not seem to create a .JETEmitters project anymore.
>


--------------000502000308090307000502
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Martin,<br>
<br>
A similar type of issue came up in the GMF newsgroup and in that case
it wasn't really even an error in the generated code but simply a
redundant semicolon that was configured to be treated as a warning.&nbsp;&nbsp;&nbsp;
The issue arises <b>here </b>in ASTFacadeHelper:<br>
<blockquote><small>&nbsp; public ASTJCompilationUnit
createCompilationUnit(String name, String contents)<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; // set source<br>
&nbsp;&nbsp;&nbsp; char[] contentAsCharArray = contents.toCharArray();<br>
&nbsp;&nbsp;&nbsp; ASTParser astParser = createASTParser();<br>
&nbsp;&nbsp;&nbsp; astParser.setSource(contentAsCharArray);<br>
<br>
&nbsp;&nbsp;&nbsp; // parse<br>
&nbsp;&nbsp;&nbsp; CompilationUnit astCompilationUnit =
(CompilationUnit)astParser.createAST(null);<br>
<br>
&nbsp;&nbsp;&nbsp; // display errors if any<br>
&nbsp;&nbsp;&nbsp; <b>if (astCompilationUnit.getProblems().length &gt; 0)</b><br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // TODO do a better job with reporting errors&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String problems =
logCompilationErrors(astCompilationUnit.getProblems());<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // NAME may be passed as name - do not show it<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (name != null &amp;&amp; !"".equals(name) &amp;&amp;
!"NAME".equals(name))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; problems = name + ":" + problems;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // stop merging and report problems<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new RuntimeException(problems);<br>
&nbsp;&nbsp;&nbsp; }</small><small></small><br>
</blockquote>
It seems to me it might be best to continue despite errors because a
whole bunch of times I've needed to set a breakpoint here and look at
the value of "contents" to see what's gone wrong when it would have
been easier to see it in the generated result.&nbsp; Please open a bugzilla
to track this issue.&nbsp; I'd like to discuss this with Marcelo (and Dave)
but Marcelo is on vacation.&nbsp; You could comment out this block of code
in your local version in the meantime...<br>
<br>
I tried setting dynamic templates to true in a sample model and the
..JETEmitter project is still created as always.&nbsp; You aren't just
filtering it out are you?<br>
<br>
<br>
Martin Taal wrote:
<blockquote cite="mideqvooc$1gd$1@utils.eclipse.org" type="cite">Hi,
<br>
I am upgrading a code generation project to emf 2.3. Something which
seems to have changed is that when I make a mistake in my template it
seems that Jet does not generate the java source file but instead
throws a RuntimeException. Is there a way for me to let jet still
generate the source file and save it? This makes it easier to identify
the error in the template.
<br>
<br>
Also jet does not seem to create a .JETEmitters project anymore.
<br>
<br>
</blockquote>
<br>
</body>
</html>

--------------000502000308090307000502--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How to let jet/emf codegen generate incorrect java files? [message #602553 is a reply to message #71564] Wed, 14 February 2007 20:00 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Ed,
Thanks, I will enter a feature request.

Regarding the jetemitters project. I do this:
final Generator generator = new Generator(registry);
generator.setInput(genModel);
generator.getOptions().codeFormatting = true;
generator.getOptions().dynamicTemplates = true;
generator.getOptions().forceOverwrite = true;

I also tried setting the projectname on the jetemitters but without result.
Before I could see the .JETEmitters project in the java browsing perspective but now its not shown
(because it is not there or it is hidden). To ask a basic eclipse question, how can I make hidden
projects visible?

gr. Martin

Ed Merks wrote:
> Martin,
>
> A similar type of issue came up in the GMF newsgroup and in that case it
> wasn't really even an error in the generated code but simply a redundant
> semicolon that was configured to be treated as a warning. The issue
> arises *here *in ASTFacadeHelper:
>
> public ASTJCompilationUnit createCompilationUnit(String name,
> String contents)
> {
> // set source
> char[] contentAsCharArray = contents.toCharArray();
> ASTParser astParser = createASTParser();
> astParser.setSource(contentAsCharArray);
>
> // parse
> CompilationUnit astCompilationUnit =
> (CompilationUnit)astParser.createAST(null);
>
> // display errors if any
> *if (astCompilationUnit.getProblems().length > 0)*
> {
> // TODO do a better job with reporting errors
> String problems =
> logCompilationErrors(astCompilationUnit.getProblems());
>
> // NAME may be passed as name - do not show it
> if (name != null && !"".equals(name) && !"NAME".equals(name))
> {
> problems = name + ":" + problems;
> }
>
> // stop merging and report problems
> throw new RuntimeException(problems);
> }
>
> It seems to me it might be best to continue despite errors because a
> whole bunch of times I've needed to set a breakpoint here and look at
> the value of "contents" to see what's gone wrong when it would have been
> easier to see it in the generated result. Please open a bugzilla to
> track this issue. I'd like to discuss this with Marcelo (and Dave) but
> Marcelo is on vacation. You could comment out this block of code in
> your local version in the meantime...
>
> I tried setting dynamic templates to true in a sample model and the
> ..JETEmitter project is still created as always. You aren't just
> filtering it out are you?
>
>
> Martin Taal wrote:
>> Hi,
>> I am upgrading a code generation project to emf 2.3. Something which
>> seems to have changed is that when I make a mistake in my template it
>> seems that Jet does not generate the java source file but instead
>> throws a RuntimeException. Is there a way for me to let jet still
>> generate the source file and save it? This makes it easier to identify
>> the error in the template.
>>
>> Also jet does not seem to create a .JETEmitters project anymore.
>>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: How to let jet/emf codegen generate incorrect java files? [message #602570 is a reply to message #71582] Wed, 14 February 2007 20:34 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Martin,

In the Package Explorer the little triangle will bring up a menu that
says "Filters..." and by default .* resources are filtered and hence a
project starting with dot will be filtered.


Martin Taal wrote:
> Ed,
> Thanks, I will enter a feature request.
>
> Regarding the jetemitters project. I do this:
> final Generator generator = new Generator(registry);
> generator.setInput(genModel);
> generator.getOptions().codeFormatting = true;
> generator.getOptions().dynamicTemplates = true;
> generator.getOptions().forceOverwrite = true;
>
> I also tried setting the projectname on the jetemitters but without
> result.
> Before I could see the .JETEmitters project in the java browsing
> perspective but now its not shown (because it is not there or it is
> hidden). To ask a basic eclipse question, how can I make hidden
> projects visible?
>
> gr. Martin
>
> Ed Merks wrote:
>> Martin,
>>
>> A similar type of issue came up in the GMF newsgroup and in that case
>> it wasn't really even an error in the generated code but simply a
>> redundant semicolon that was configured to be treated as a
>> warning. The issue arises *here *in ASTFacadeHelper:
>>
>> public ASTJCompilationUnit createCompilationUnit(String name,
>> String contents)
>> {
>> // set source
>> char[] contentAsCharArray = contents.toCharArray();
>> ASTParser astParser = createASTParser();
>> astParser.setSource(contentAsCharArray);
>>
>> // parse
>> CompilationUnit astCompilationUnit =
>> (CompilationUnit)astParser.createAST(null);
>>
>> // display errors if any
>> *if (astCompilationUnit.getProblems().length > 0)*
>> {
>> // TODO do a better job with reporting errors
>> String problems =
>> logCompilationErrors(astCompilationUnit.getProblems());
>> // NAME may be passed as name - do not show it
>> if (name != null && !"".equals(name) && !"NAME".equals(name))
>> {
>> problems = name + ":" + problems;
>> }
>> // stop merging and report problems
>> throw new RuntimeException(problems);
>> }
>>
>> It seems to me it might be best to continue despite errors because a
>> whole bunch of times I've needed to set a breakpoint here and look at
>> the value of "contents" to see what's gone wrong when it would have
>> been easier to see it in the generated result. Please open a
>> bugzilla to track this issue. I'd like to discuss this with Marcelo
>> (and Dave) but Marcelo is on vacation. You could comment out this
>> block of code in your local version in the meantime...
>>
>> I tried setting dynamic templates to true in a sample model and the
>> ..JETEmitter project is still created as always. You aren't just
>> filtering it out are you?
>>
>>
>> Martin Taal wrote:
>>> Hi,
>>> I am upgrading a code generation project to emf 2.3. Something which
>>> seems to have changed is that when I make a mistake in my template
>>> it seems that Jet does not generate the java source file but instead
>>> throws a RuntimeException. Is there a way for me to let jet still
>>> generate the source file and save it? This makes it easier to
>>> identify the error in the template.
>>>
>>> Also jet does not seem to create a .JETEmitters project anymore.
>>>
>>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:How to let jet/emf codegen generate incorrect java files?
Next Topic:copier.copyReferences() causes stack overflow
Goto Forum:
  


Current Time: Wed Apr 24 16:00:03 GMT 2024

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

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

Back to the top