Evolution #17

Generate "return null" or something like that while generating operation returing an objet

Added by Arnaud Blouin over 8 years ago. Updated about 8 years ago.

Status:ClosedStart date:08 November 2011
Priority:MediumDue date:
Assignee:Christophe Malgouyres% Done:

100%

Category:-
Target version:2.0.13

Description

If I define an operation +foo():integer, the generated code is

`public integer foo() {

}`

To be directly compilable, the generated code should be somehting like that:

`public integer foo() {

// TODO: to implement

return 0;

}`

Mapping: integer, char, byte –> return 0; double –> return 0.; float –> return 0f; Object, array –> return null; boolean –> return false; …

Thx for your great generator.

History

#1 Updated by Arnaud Blouin over 8 years ago

Oops, it is not a bug but a feature request of course.

#2 Updated by Christophe Malgouyres over 8 years ago

I think it is a good idea, even if it doesn’t match exactly the generator’s current behavior (generating only what is in the model). The model itself won’t be modified at generation, to avoid problems with locked elements (SVN).

It should depend on an a module option, something like “generate default return code”, and throw a warning indicating the missing “Java.Return” note during the generation if not checked: some people prefer direct compilation errors to TODO notes…

#3 Updated by Arnaud Blouin over 8 years ago

I agree with your proposal.

#4 Updated by Christophe Malgouyres over 8 years ago

  • Tracker changed from Issue to Evolution

Moved from Issue to Evolution

#5 Updated by Christophe Malgouyres over 8 years ago

  • Status changed from New to Assigned
  • Assignee set to Christophe Malgouyres
  • Target version set to 2.0.13

#6 Updated by Christophe Malgouyres about 8 years ago

  • Status changed from Assigned to Resolved

Fixed by revision 113 and revision 114.

#7 Updated by Christophe Demeulemeester about 8 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF