Ticket #30 (closed enhancement: fixed)

Opened 13 months ago

Last modified 13 months ago

Enable inferred callout-to-field bindings

Reported by: mosconi Owned by: stephan
Priority: major Milestone: OTDT_1.1.5
Component: compiler Version: 1.1.4
Keywords: Cc:

Description

It would be nice to have an option to use inferred callouts also for field accesses. Instead of refactoring get/set field accesses into calls to get/set-method callouts in the source code, the compiler could perhaps perform such mapping behind the scene. (comparable to C# Properties).

Change History

Changed 13 months ago by stephan

  • status changed from new to assigned
  • version set to 1.1.4

Part of this issue has been addressed in

This part infers the use of an explicitly declared callout-to-field for what syntactically would be a field access.

For the remaining I'm uncertain how much automagic the compiler should implement:

  1. From a getter/setter call within a role infer a corresponding callout-to-field.
  2. From an unresolved field access infer both the callout-to-field and replace the field access with a getter/setter call.

If we would support all of these, should all be controlled by the same warning token (concerning @SuppressWarnings("inferredcallout") and concerning the global compiler option)?

Changed 13 months ago by stephan

Changed 13 months ago by stephan

  • status changed from assigned to closed
  • resolution set to fixed
  • milestone set to OTDT_1.1.5

Well, I did add some automagic (item 2. in the previous comment).

Test cases are

I believe this services the original intention. Still open issues:

  • should method calls be analyzed by naming convention to infer a matching callout-to-field? E.g., given an unresolved call this.setVal("x"), should a callout binding void setVal(String v) -> set String val; be generated if the corresponding base field exists?
  • What kinds of adaptations should be inferred / should be possible via explicit callout-to-field? Currently only those explicit callout-to-fields are used where field type and method signature use the same type.
  • What levels of quickfix should be supported ("materialize inferred callout")? (I've just opened #32 for this).

I'm closing this issue in the light of the original intention. Please open new issues for things you'd like to see added.

Note: See TracTickets for help on using tickets.