blob: 591508a4cea88219013c6e67dc884fd46e2b0667 [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.1</title>
</head>
<body class="otdt">
<div id="content">
<table class="nav">
<tr>
<td class="back"><a id="top"></a><a href="s2.1.2.b.html" rel="prev">&lt;&lt;&nbsp;&sect;2.1.2.(b)&nbsp;Cycles</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.1.2.d.html" rel="next">&sect;2.1.2.(d)&nbsp;Base imports&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.1.html" rel="section">&sect;2.1&nbsp;playedBy relation</a>&nbsp;&gt;&nbsp;<a class="nav" href="s2.1.2.html" rel="section">&sect;2.1.2&nbsp;Legal base classes</a></div>
<div class="subsect depth4" id="s2.1.2.c">
<h4 class="subsect">&sect;2.1.2.(c)&nbsp;<span class="title">Base class decapsulation</span><a class="img" href="s2.1.2.c.html"
title="PermaLink to (c)&nbsp;Base class decapsulation"><img style="vertical-align:text-top;margin-left:5px;" src="../images/permalink.png"
alt="" /></a></h4>
<p>If a base class referenced after <code>playedBy</code> exists but is not visible under normal visibility rules of Java,
this restriction may be overridden. This concept is called <strong>decapsulation</strong>, i.e., the opposite of encapsulation
(see also <a href="s3.4.html" title="&sect;3.4&nbsp;Overriding access restrictions"
class="sect">&sect;3.4</a>). A compiler should signal any occurrence of base class decapsulation. If a compiler supports to
configure warnings this may be used to let the user choose to (a) ignore base class decapsulation, (b) treat it as a warning
or even
(c) treat it as an error.
</p>
<p>
Binding to a <code>final</code> base class is also considered as decapsulation, since a <code>playedBy</code> relationship has
powers similar to an <code>extends</code> relationship, which is prohibited by marking a class as <code>final</code>.
</p>
<p>
Decapsulation is not allowed if the base class is a confined role (see <a href="s7.2.html" title="&sect;7.2&nbsp;Confined roles" class="sect">&sect;7.2</a>).
</p>
<p>
Within the current role a decapsulated base class can be mentioned in the right-hand-side of any method binding
(<a href="s3.html" title="&sect;3&nbsp;Callout Binding" class="sect">callout (&sect;3)</a> or <a href="s4.html" title="&sect;4&nbsp;Callin Binding" class="sect">callin (&sect;4)</a>). Also arguments in these positions are allowed to mention the decapsulated base class:
</p>
<ul>
<li>the first argument of one of the role's constructors (see <a href="s2.4.1.html"
title="&sect;2.4.1&nbsp;Role creation via a lifting constructor"
class="sect">lifting constructor (&sect;2.4.1)</a>).
</li>
<li>the base side of an argument with declared lifting (see <a href="s2.3.2.html" title="&sect;2.3.2&nbsp;Declared lifting" class="sect">declared lifting (&sect;2.3.2)</a>).
</li>
</ul>
</div>
<table class="nav">
<tr>
<td class="back"><a href="s2.1.2.b.html" rel="prev">&lt;&lt;&nbsp;&sect;2.1.2.(b)&nbsp;Cycles</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.1.2.d.html" rel="next">&sect;2.1.2.(d)&nbsp;Base imports&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.1.html" rel="section">&sect;2.1&nbsp;playedBy relation</a>&nbsp;&gt;&nbsp;<a class="nav" href="s2.1.2.html" rel="section">&sect;2.1.2&nbsp;Legal base classes</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.1 &mdash; last modified: 2013-05-28
</div>
</body>
</html>