blob: d7634cf8ff1e096e36abbf814e21dc19af017f2a [file] [log] [blame]
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "../xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="../css/ot.css" />
<link rel="stylesheet" type="text/css" href="../css/otjld.css" />
<title>OT/J Language Definition v1.3</title>
</head>
<body class="otdt">
<div id="content">
<table class="nav">
<tr>
<td class="back"><a id="top"></a><a href="s2.3.4.a.html" rel="prev">&lt;&lt;&nbsp;&sect;2.3.4.(a)&nbsp;Potential ambiguity</a></td>
<td class="top"><a href="index.html" rel="contents">&uarr;&nbsp;Table of Contents&nbsp;&uarr;</a></td>
<td class="next"><a href="s2.3.4.c.html" rel="next">&sect;2.3.4.(c)&nbsp;Actual ambiguity&nbsp;&gt;&gt;</a></td>
</tr>
</table>
<div class="breadcrumb"><a class="nav" href="s2.html" rel="section">&sect;2&nbsp;Role Binding</a>&nbsp;&gt;&nbsp;<a class="nav" href="s2.3.html" rel="section">&sect;2.3&nbsp;Lifting</a>&nbsp;&gt;&nbsp;<a class="nav" href="s2.3.4.html" rel="section">&sect;2.3.4&nbsp;Binding ambiguities</a></div>
<div class="subsect depth4" id="s2.3.4.b">
<h4 class="subsect">&sect;2.3.4.(b)&nbsp;<span class="title">Definite ambiguity</span><a class="img" href="s2.3.4.b.html"
title="PermaLink to (b)&nbsp;Definite ambiguity"><img style="vertical-align:text-top;margin-left:5px;" src="../images/permalink.png"
alt="" /></a></h4>
<p>A <strong>definite ambiguity</strong> is given if
</p>
<ul>
<li>the situation of potential ambiguity according to (a)
above is given and
</li>
<li>lifting is requested (either by method binding or explicitly
(<a href="s2.3.2.html" title="&sect;2.3.2&nbsp;Declared lifting" class="sect">&sect;2.3.2</a>)) from the shared base class <code>B</code> to any role
class <code>R0</code> that is a common super role for <code>R1</code> and <code>R2</code>.
</li>
</ul>
<p>Definite binding ambiguity also occurs in cases of generic declared lifting <a href="s2.3.2.e.html" title="&sect;2.3.2.(e)&nbsp;Generic declared lifting"
class="sect">&sect;2.3.2.(e)</a>
if the specified role <code>R</code> is unbound and if two independent sub-roles <code>R1</code> and <code>R2</code>
exist that introduce a playedBy binding to the same base class <code>BX</code>.
In this case no potential ambiguity is flagged because roles <code>R1</code> and <code>R2</code>
have no shared bound super-role.
</p>
<div class="note">
<h5>Effect:</h5>
Code causing definite ambiguity is required to handle <code>org.objectteams.LiftingFailedException</code>.
</div>
<p>
In cases of definite binding ambiguity lifting will indeed fail except for some corner cases.
Such corner cases may arise if lifting already finds an appropriate role in the cache or
if an (indirect) subrole of the ambiguously bound role is an unambiguous lift target for the
concrete type of the base object at run-time. See also <a href="s2.3.5.html"
title="&sect;2.3.5&nbsp;Consequences of lifting problems"
class="sect">&sect;2.3.5</a>.
</p>
<h5 class="listing">Example code (Definite Ambiguity):</h5>
<div class="listing example frame">
<table class="listing">
<tr class="line odd">
<td class="ln">1</td>
<td><pre><b>team</b> <b>class</b> MyTeam {</pre></td>
</tr>
<tr class="line even">
<td class="ln">2</td>
<td><pre> <b>public</b> <b>class</b> SuperRole <b>playedBy</b> MyBase {...}</pre></td>
</tr>
<tr class="line odd">
<td class="ln">3</td>
<td><pre> <b>public</b> <b>class</b> SubRoleA <b>extends</b> SuperRole <b>playedBy</b> SubBase {...}</pre></td>
</tr>
<tr class="line even">
<td class="ln">4</td>
<td><pre> <b>public</b> <b>class</b> SubRoleB <b>extends</b> SuperRole <b>playedBy</b> SubBase {...}</pre></td>
</tr>
<tr class="line odd">
<td class="ln">5</td>
<td><pre></pre></td>
</tr>
<tr class="line even">
<td class="ln">6</td>
<td><pre> <b>public</b> <b>void</b> useSuperRole(SubBase <b>as</b> SuperRole r) {...} <span class="comment">// <span class="error">must declare LiftingFailedException</span></span></pre></td>
</tr>
<tr class="line odd">
<td class="ln">7</td>
<td><pre>}</pre></td>
</tr>
</table>
</div>
</div>
<table class="nav">
<tr>
<td class="back"><a href="s2.3.4.a.html" rel="prev">&lt;&lt;&nbsp;&sect;2.3.4.(a)&nbsp;Potential ambiguity</a></td>
<td class="top"><a href="index.html" rel="contents">&uarr;&nbsp;Table of Contents&nbsp;&uarr;</a></td>
<td class="next"><a href="s2.3.4.c.html" rel="next">&sect;2.3.4.(c)&nbsp;Actual ambiguity&nbsp;&gt;&gt;</a></td>
</tr>
</table>
<div class="breadcrumb"><a class="nav" href="s2.html" rel="section">&sect;2&nbsp;Role Binding</a>&nbsp;&gt;&nbsp;<a class="nav" href="s2.3.html" rel="section">&sect;2.3&nbsp;Lifting</a>&nbsp;&gt;&nbsp;<a class="nav" href="s2.3.4.html" rel="section">&sect;2.3.4&nbsp;Binding ambiguities</a></div>
</div>
<div id="footer">
<hr /><a class="w3c img" href="http://jigsaw.w3.org/css-validator/check/referer"
shape="rect"><img src="../images/valid-css2-blue.png" alt="Valid CSS!" height="31" width="88" /></a><a class="w3c img" href="http://validator.w3.org/check?uri=referer" shape="rect"><img src="../images/valid-xhtml10-blue.png" alt="Valid XHTML 1.0 Strict" height="31"
width="88" /></a><address>&copy; Stephan Herrmann, Christine Hundt, Marco Mosconi</address>
OT/J version 1.3 &mdash; last modified: 2011-05-15
</div>
</body>
</html>