eclipse-ocl / org.eclipse.ocl

Eclipse Public License 2.0
0 stars 0 forks source link

[cg] Package interface suffix inadequately supported #1827

Closed eclipse-ocl-bot closed 2 hours ago

eclipse-ocl-bot commented 2 hours ago

| --- | --- | | Bugzilla Link | 514527 | | Status | RESOLVED FIXED | | Importance | P3 normal | | Reported | Mar 31, 2017 04:32 EDT | | Modified | Apr 01, 2017 08:30 EDT | | Reporter | Faiez Za |

Description

Created attachment 267562\ the emf project containing errors

I create a metamodel named "test"\ I generate test.genmodel.\ I customize Interface package suffix and metadata package suffixes.\ I make 'core' suffix.

I add the delegation annotation in the test.genmodel

\
\

When I generate code, the import statments to TestTables.java are wrong.\ the generated code contains

import test.TestTables;\ instead of

import test.core.TestTables;

In addition the generated code in TestTables.java is also wrong

public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.ClassId CLSSid_Activite = test.TestTables.PACKid_http_c_s_s_test_s_2_0.getClassId("Activite", 0);\
public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.ClassId CLSSid_Kind = test.TestTables.PACKid_http_c_s_s_test_s_2_0.getClassId("Kind", 0);\
public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.DataTypeId DATAid_EInt = test.TestTables.PACKid_http_c_s_s_www_eclipse_org_s_emf_s_2002_s_Ecore.getDataTypeId("EInt", 0);

I had to do a lot "Find" and "Replace" in the generated code.

Is it normal?

the core project containing errors in the attachment\ \ best regards

:compression: org.eclipse.example.test.zip

eclipse-ocl-bot commented 2 hours ago

By Faiez Za on Mar 31, 2017 04:40

In addition the generated code in TestTables.java is also wrong

public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.ClassId CLSSid_Class = test.TestTables.PACKid_http_c_s_s_test_s_2_0.getClassId("Class", 0);\
public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.DataTypeId DATAid_EInt = test.TestTables.PACKid_http_c_s_s_www_eclipse_org_s_emf_s_2002_s_Ecore.getDataTypeId("EInt", 0);
eclipse-ocl-bot commented 2 hours ago

By Ed Willink on Mar 31, 2017 06:55

Thanks for the repro.

Simple bug: incomplete support for genmodel interface suffix

Workaround: don't use a suffix

or manually edit. No idea why you need many Find and Replace. JDT error markers work much better. Might be quicker to move the generated Tables to its declared package, then refactor it to its intended package.

eclipse-ocl-bot commented 2 hours ago

By Ed Willink on Apr 01, 2017 08:30

Simple fix: use genPackage.getReflectionPackageName() rather than genPackage.getQualifiedPackageName() in getTablesClassName.

Pushed to master for M7.