Bug 252168 - [MTL] parsing should provide compilation error for duplicate protected area
Summary: [MTL] parsing should provide compilation error for duplicate protected area
Status: CLOSED FIXED
Alias: None
Product: Acceleo
Classification: Modeling
Component: Core (show other bugs)
Version: 0.7.0   Edit
Hardware: All All
: P3 normal
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2008-10-27 07:14 EDT by Laurent Goubet CLA
Modified: 2010-07-30 05:22 EDT (History)
0 users

See Also:


Attachments
Patch (4.69 KB, patch)
2010-07-05 09:36 EDT, Stephane Begaudeau CLA
no flags Details | Diff
Patch v2 (4.74 KB, patch)
2010-07-06 08:28 EDT, Stephane Begaudeau CLA
no flags Details | Diff
Patch v3 (4.97 KB, patch)
2010-07-07 10:03 EDT, Stephane Begaudeau CLA
no flags Details | Diff
Patch v4 (5.03 KB, patch)
2010-07-07 10:44 EDT, Stephane Begaudeau CLA
no flags Details | Diff
Patch v5 (5.68 KB, patch)
2010-07-07 10:58 EDT, Stephane Begaudeau CLA
laurent.goubet: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent Goubet CLA 2008-10-27 07:14:12 EDT
If we create a template with two protected areas with the same id, the parser should create error markers to inform the user generation cannot be run as is.
Comment 1 Stephane Begaudeau CLA 2010-07-05 09:36:57 EDT
Created attachment 173428 [details]
Patch

With this patch, if two (or more) protected areas are sharing the same identifier a compilation error will be thrown during the compilation.
Comment 2 Stephane Begaudeau CLA 2010-07-06 08:28:08 EDT
Created attachment 173538 [details]
Patch v2

Previously the patch would look for conflicts in the name of all protected areas within a module, now it is limited to conflicts within a template.
And some unit tests have been modified in order to suppress some conflicts.
Comment 3 Stephane Begaudeau CLA 2010-07-07 10:03:07 EDT
Created attachment 173653 [details]
Patch v3

the previous patch was for https://bugs.eclipse.org/bugs/show_bug.cgi?id=252169
Comment 4 Laurent Goubet CLA 2010-07-07 10:20:47 EDT
line 729 shouldn't be

"while (!(object instanceof Template)) {"

but

"while (!(object instanceof Template) && !(object instanceof FileBlock)) {"

As the true "scope" within wich protected area markers must be unique are the files.

Could you make the necessary modifications so as to avoid the ClassCast that would arise below with such a change?
Comment 5 Stephane Begaudeau CLA 2010-07-07 10:44:19 EDT
Created attachment 173658 [details]
Patch v4

Improved version of the last patch.
Comment 6 Stephane Begaudeau CLA 2010-07-07 10:58:32 EDT
Created attachment 173660 [details]
Patch v5

This patch is an improved version of the last one. With the last one, if a protected area was buried in [for] and [if] it could skip some conflict with other protected areas with the same name.
Comment 7 Laurent Goubet CLA 2010-07-30 05:22:06 EDT
Thanks for the fix, this has been committed on HEAD.

However, the "parsing error" that is logged should really be a warning. I've opened bug 321308 for this.