eclipse-ocl / org.eclipse.ocl

Eclipse Public License 2.0
0 stars 0 forks source link

[CG] @NonNull annotation not generated for Pivot multi-valued properties which are defined as required #1658

Closed eclipse-ocl-bot closed 1 hour ago

eclipse-ocl-bot commented 1 hour ago

| --- | --- | | Bugzilla Link | 486486 | | Status | RESOLVED FIXED | | Importance | P3 normal | | Reported | Jan 25, 2016 11:08 EDT | | Modified | Jan 26, 2016 08:21 EDT | | Depends on | 486485 | | Reporter | Adolfo Sanchez-Barbudo Herrera |

Description

After my local fix for the to-be-properly-solved Bug 486485, I've noticed another problem.

I'm expecting some @NonNull annotation in the generated code for a multi-valued required pivot property.

May it be some side-effect of java8 transition ?

Repro coming next

eclipse-ocl-bot commented 1 hour ago

By Adolfo Sanchez-Barbudo Herrera on Jan 25, 2016 11:23

Branches asanchez/486486 for OCL and QVTd

Repro (note that the repro depends on Bug 486485 fix):

  1. Run GenerateExample2Models.mwe2 [1].
  2. Open the generated OperationLookupFilter [2]
  3. Remove unused imports
  4. Look at line 50, so that the generated class field doesn't have a @NonNull annotation
  5. This should produce an unwanted warning at line 76, (i.e. at idResolver.createOrderedSetOfAll(ORD_CLSSid_Argument, args))

Some additional hints (if you wanna create useful breakpoints):

Regards,\ Adolfo

[1] org.eclipse.qvtd.cs2as.compiler.tests\src\org\eclipse\qvtd\cs2as\compiler\tests\models\example2\mwe\GenerateExample2Models.mwe2\ [2] org.eclipse.qvtd.cs2as.compiler.tests\tests-gen\example2\classes\lookup\util\OperationFilter.java\ [3] org.eclipse.ocl.examples.autogen\src\org\eclipse\ocl\examples\autogen\lookup\LookupFilterGenerator.java

eclipse-ocl-bot commented 1 hour ago

By Ed Willink on Jan 25, 2016 15:43

This is caused by Bug 485948. The @NonNull 'runtime' annotation is invisible to the CG using Java reflection. It is visible, but not very obviously to ASM.

eclipse-ocl-bot commented 1 hour ago

By Ed Willink on Jan 26, 2016 08:21

ASM (version 5, but no longer version 3) is once again used to access the @NonNull/@Nullable annotations.

commit a318ed718c309cf5d23f3ff11c0c4fbe25721190 and others pushed to master for M5.