Ticket #195 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Callout bindings should be more flexible wrt visibility

Reported by: stephan Owned by: stephan
Priority: minor Milestone: OTDT_1.2.6
Component: language Version: 1.2.5
Keywords: Cc:

Description

OTJLD §3.1(i) states that shorthand callout bindings define role methods with default visibility. Now that we enforce that default visible role methods cannot be accessed from outside the role (cf. #194), such shorthand bindings are much less useful.

First, if the corresponding base feature is already public or protected, the callout should inherit this visibility (should generally inherit this visibility by default).

Second, a shorthand callout binding should be allowed to optionally specify a visibility modifier.

Need to check some consistency constraints, like not reducing the visibility of something inherited.

Change History

Changed 3 years ago by stephan

r19519/r19520 provide the general specification and implementation. See also OTJLD §B.1.2 for an overview (2 new entries regarding callout bindings).

Changed 3 years ago by stephan

  • status changed from new to closed
  • resolution set to fixed

Many tests successfully apply this feature, e.g.:
positive:

negative:

And many more throughout all of jacks.

Changed 3 years ago by stephan

BTW: see also #196 for supporting this new feature by a quickfix.

Changed 3 years ago by stephan

Additional improvements while adjusting the jacks suite for strict adherence ot OTJLD §1.2.1(e):

  • r19521: don't inherit other bits than visibility
  • r19523: fix detection whether modifier is legal or not
  • r19525: include callout modifier in flattening (needed for quickfix etc.)
  • r19534: treat static role methods in the same way as non-static

Changed 3 years ago by stephan

r19552 relaxed the rule for one specific case:

A callout to a public base feature has a non-public role type in its signature. Now the callout inherits publicness from its base, causing the compiler to complain that the roles in the signature cannot be externalized. This is relaxed by reporting this as a warning only, if the enclosing role itself is non-public.

Rationale: the public method cannot be invoked from outside the team anyway. We keep the diagnostic, however, because a subclass of this role might be public and then it's difficult to tell, what's wrong: a previously legal callout/method becomes illegal because it is now visible to a greater audience..

For consistency, this relaxation applies to callouts and methods alike.

Note: See TracTickets for help on using tickets.