eclipse-ocl / org.eclipse.ocl

Eclipse Public License 2.0
0 stars 0 forks source link

[cg] Inappropriate use of Object in generated List declarations #1657

Closed eclipse-ocl-bot closed 1 hour ago

eclipse-ocl-bot commented 1 hour ago

| --- | --- | | Bugzilla Link | 485965 | | Status | RESOLVED FIXED | | Importance | P3 normal | | Reported | Jan 15, 2016 13:34 EDT | | Modified | Jan 17, 2016 09:40 EDT | | Reporter | Ed Willink |

Description

From Bug 485151#c2 the generated code

final /@Thrown/ java.util.@NonNull List namedElements = this.getNamedElements();

should be

final /@Thrown/ java.util.@NonNull List namedElements = this.getNamedElements();

to avoid type errors on usage.

eclipse-ocl-bot commented 1 hour ago

By Ed Willink on Jan 15, 2016 14:19

Problem is that NamedElement is described by Pivot.genmodel which is a usedGenPackage f the Lookup.genmodel.

However the GenPackage registration does not traverse the usedGenPackages.

Trivial fix to use

genModel.getAllGenUsedAndStaticGenPackagesWithClassifiers()

rather than

genModel.getAllGenPackagesWithClassifiers()

eclipse-ocl-bot commented 1 hour ago

By Ed Willink on Jan 15, 2016 16:49

commit 67b4dfabfade36012b09c9ddbe1d761be6fdfa85 pushed to master for M5.

eclipse-ocl-bot commented 1 hour ago

By Adolfo Sanchez-Barbudo Herrera on Jan 17, 2016 08:46

(In reply to comment #1)

Problem is that NamedElement is described by Pivot.genmodel which is a usedGenPackage f the Lookup.genmodel.

I'm lost. From Bug 485151#c2 refers to example 2. How is the example related to pivot.genmodel or lookup.genmodel ?

eclipse-ocl-bot commented 1 hour ago

By Ed Willink on Jan 17, 2016 08:51

Correction the NamedElement in Classes.ecore and so Classes.genmodel

Correction the lookup package in EnvExample2.ecore and so EnvExample2.genmodel

EnvExample2.genmodel has a usedGenPackages ref to Classes.genmodel that was being ignored.

eclipse-ocl-bot commented 1 hour ago

By Adolfo Sanchez-Barbudo Herrera on Jan 17, 2016 09:09

It sounds OK. I was wondering if that problem comes a recent change or what, because I'd swear that those LookEnvironment were properly generated before. EMF regression on that getAllGenPackagesWithClassifiers() ?

Anyway, thanks for the fix.

eclipse-ocl-bot commented 1 hour ago

By Ed Willink on Jan 17, 2016 09:40

(In reply to Adolfo Sanchez-Barbudo Herrera from comment #5)

It sounds OK. I was wondering if that problem comes a recent change or what, because I'd swear that those LookEnvironment were properly generated before. EMF regression on that getAllGenPackagesWithClassifiers() ?

Anyway, thanks for the fix.

No cause to blame EMF.

I suspect it worked before I eliminated the use of extension point registrations in the test plugins.

I'm puzzled that I didn't find the routine before. I'm sure I looked for it, but I see no @since ... to indicate recent change.