blob: ee178a37cd1be11dcb174921757cd427245a52d0 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel=stylesheet type="text/css" href="../css/style.css">
<link rel=stylesheet type="text/css" href="../css/nn.css">
<title>OTDT 2.3 - New and Noteworthy</title>
</head>
<script language="JavaScript">
// web:
var OTJLD_BASE = "http://www.objectteams.org/def/1.3.1"; //"../otjld/def"
// help: var OTJLD_BASE = "../otjld/def"
var HELP_ROOT = "http://help.eclipse.org/staging/luna/topic" // only if not already replaced
function replaceROOTS() {
var baseURLskip = document.URL.lastIndexOf("/");
var anchors = document.getElementsByTagName("a");
for (i = 0; i < anchors.length; i++) {
var item = anchors[i];
var relref = item.href.substring(baseURLskip+1)
if (relref.indexOf("OTJLD") == 0) {
item.href = relref.replace("OTJLD", OTJLD_BASE);
} else if (relref.indexOf("PLUGINS_ROOT") == 0) {
item.href = relref.replace("PLUGINS_ROOT", HELP_ROOT);
}
}
}
</script>
<body onload="replaceROOTS();">
<h1>OTDT 2.3 - New and Noteworthy</h1>
<div class="navigation">On this page:
<!--a href="#metrics">&bull; Metrics Plug-in</a-->
<!--a href="#configuration">&bull; Configuration</a-->
<!--a href="#views">&bull; Views/Dialogs</a-->
<!--a href="#assist">&bull; Content Assist</a-->
<!--a href="#refactor">&bull; Refactoring</a-->
<!--a href="#formatting">&bull; Formatting</a-->
<!--a href="#debug">&bull; Run/Debug</a-->
<a href="#language">&bull; Language</a>
<!--a href="#api">&bull; API</a-->
<!--a href="#compiler">&bull; Compiler</a-->
<a href="#otre">&bull; Runtime</a>
<a href="#otequinox">&bull; OT/Equinox</a>
<!--a href="#releng">&bull; Release Engineering</a-->
</div>
<table cellpadding="10" cellspacing="0" width="100%">
<colgroup>
<col width="20%">
<col width="80%">
</colgroup>
<tbody>
<!--
<tr><td colspan="2" id="NAME"><h2>HEADING</h2></td></tr>
<tr>
<td><p align="right"><b>DESC</b><br>
<span class="since">since&nbsp;0.7.1</span><br>
<a class="buglink" title="TITLE" href="https://bugs.eclipse.org/308029">308029</a></p></td>
<td><p>
</p>
<p><img alt="TEXT" src="../images/screenshots/NN07/.png"></p>
<p></p>
</td>
</tr>
<div class="listbox"><div class="listing"><pre><code class="keyword">public team class</code> <font color="blue">MyTeam</font> {
}</pre></div></div>
-->
<tr><td colspan="2" id="language"><h2>Language</h2></td></tr>
<tr>
<td id="java8"><a href="PLUGINS_ROOT/org.eclipse.jdt.doc.user/whatsNew/jdt_whatsnew.html#JavaCompiler"><img align="right" src="../images/java8.png"/></a><br/>
<p align="right"><b>Adopt Java 8</b><br/>
&nbsp;<br/>
<!--span class="since">since&nbsp;2.3</span><br-->
<a class="buglink" target="_blank" title="[java8] adopt and merge implementation of Java 8 from JDT's BETA_JAVA8 branch " href="https://bugs.eclipse.org/384991">384991</a></p></td>
<td>
<div style="background-color:#fffce4;padding:4px;border:solid 2px #e0e0f0;color:#300080;"><strong>OT/J has been fully integrated with Java&trade; 8.</strong><br/>
This means that lambda expressions, method references, default methods, type annotations etc. can all be used in OT/J programs.
Additionally, roles in OT/J can bind to Java 8 classes containing any of these new features.
</div>
<h3>Grammar challenge</h3>
<p>Syntactically, some of the new features in Java 8 look surprisingly similar to OT/J:</p>
<ul>
<li>The arrow "<code>-&gt;</code>" used for lambda expressions is the same token that
OT/J uses for <a class="otjldlink" href="OTJLD/s3.html">callout bindings</a> and
<a class="otjldlink" href="OTJLD/s3.html#s3.2">role-to-base parameter mappings</a>
(see also <a class="otjldlink" href="OTJLD/s4.html#s4.4">4.4</a>).</li>
<li>The "<code>@</code>" token used for type annotations (JSR 308) is the same that
OT/J uses to denote a <a class="otjldlink" href="OTJLD/s1.html#s1.2.2.b">team anchor</a></li>
</ul>
<h3>Clean integration</h3>
<p>
Despite these syntactic similarities, it was not necessary to change OT/J in order to harmonize
with the syntax of Java 8. So with the minimal, inevitable restrictions ("team" and "within"
are unconditional keywords in OT/J) every legal Java 8 program is also a legal OT/J program.
Conversely, every legal OT/J program from earlier versions, is still a legal OT/J program.
</p>
<h3>Feature interaction</h3>
<p>
For the most part, the new features in Java 8 can be regarded as orthogonal to features
introduced by OT/J:
</p>
<ul>
<li>Lambda expressions in Java 8 are about the details of implementing algorithms</li>
<li>Type annotations in Java 8 are about improving the type system</li>
<li>Roles and Teams in OT/J are about composing individual objects into a system</li>
</ul>
<p>With respect to <strong>type checking</strong> the following features required significant
work behind the scenes to reconcile the various type rules: generics with enhanced type inference,
type annotations and finally: role types, all contribute to a very rich notion of types.
Given that type inference in the Eclipse Compiler for Java was completely re-written,
adopting that re-write for OT/J required intimate knowledge about that implementation.</p>
<p><strong>Inheritance</strong> now has more options due to the introduction of default methods.
This poses a new challenge in combination with OT/J's
<a href="OTJLD/s1.html#s1.3.1">implicit inheritance</a>,
some details of which may still require more work after the 2.3 release.
Technically, OT/J now supports two different styles of multiple inheritance,
but from the details it is clear that both concepts pursue entirely different goals.
It is not expected that these concepts compete for solving any real world design task.
</p>
</td>
</tr>
<tr><td colspan="2" id="otre"><h2>Object Teams Runtime Environment</h2></td></tr>
<tr>
<td><p align="right"><b>New byte code weaver</b><br>
&nbsp;<br>
<a class="buglink" target="_blank" title="Support runtime weaving " href="https://bugs.eclipse.org/398232">398232</a></p></td>
<td><p>Starting with 2.3, OTDT ships with a new byte code weaver as an alternative to the traditional
<a href="PLUGINS_ROOT/org.eclipse.objectteams.otdt.doc/guide/features.html#execution">OTRE</a>.</p>
<p>This weaver, called "<strong>Object Teams Dynamic Runtime Environment (OTDRE)</strong>"
has been developed with the goal to support <strong>runtime weaving</strong>,
i.e., to support the integration of roles and teams that are not known during application launch.
This capability has been fully implemented, but infrastructure to fully leverage the new flexibility
still needs to be developed (think, i.e., of a monitoring console that allows runtime deployment
of new monitoring team classes).</p>
<p>The OTDRE is implemented using the byte code library <strong>ASM</strong>,
as opposed to the BCEL-based implementation of the OTRE.
ASM follows a more modern approach, which results in better weaving performance.
ASM is also actively maintained, which, unfortunately, is no longer true of BCEL.</p>
</td></tr>
<tr>
<td class="noborder"><a href="#java8"><img align="right" src="../images/java8.png"/></a></td>
<td class="noborder"><p>By using the latest version of ASM, the OTDRE is capable of processing class files even of <strong>Java 8</strong>,
which is not possible using BCEL.
Therefore, the OTDRE is shipped with the specific goal to support Java 8, although it has not yet reached exactly
the maturity, which the OTRE has obtained over the years.</p>
<p>Both weavers are supported by the compiler, by generating specific infrastructure to be invoked
from woven code. Due to the fundamental difference in <strong>weaving schemes</strong>,
it is necessary to selected at compile time, which weaver should be targeted. Please see the section on
<a href="PLUGINS_ROOT/org.eclipse.objectteams.otdt.doc/guide/weavingscheme.html">target weaving schemes</a> in the developers' guide.</p>
</td>
</tr>
<tr><td colspan="2" id="otequinox"><h2>OT/Equinox</h2></td></tr>
<tr>
<td><p align="right"><b>Migrate to new Equinox implemen&shy;tation</b><br>
<span class="since">since&nbsp;2.3M2</span><br>
<a class="buglink" target="_blank" title="migrate OT/Equinox to the standard OSGi WeavingHook" href="https://bugs.eclipse.org/406518">406518</a></p></td>
<td><h3>A mostly compatible re-implementation</h3>
<p>The implementation of OT/Equinox has been re-written,
which became necessary when Equinox withdrew an "inofficial API" called "Adapter Hooks",
on which OT/Equinox had relied for many years.</p>
<p>At the surface this should hardly be visible to regular clients of the OT/Equinox technology;
the existing extension point
<a href="PLUGINS_ROOT/org.eclipse.objectteams.otdt.doc/reference/extension-points/org_eclipse_objectteams_otequinox_aspectBindings.html"><code>aspectBindings</code></a>
is supported unchanged.</p>
<p>The single surface change regards the way how visibility between a base class and an adapting team is established:
In the new implementation each aspect bundle must <strong>export all packages containing one or more team classes</strong>.
This is a hard requirement and missing exports will be flagged as an error.
A new <strong><a href="#qfAddExport">quick fix</a></strong> is provided to support this task.</p>
<h3>Current limitations</h3>
<p>A few add-on features of OT/Equinox are currently unimplemented and are planned to be re-added in Luna service releases:</p>
<ul>
<li><a href="PLUGINS_ROOT/org.eclipse.objectteams.otdt.doc/reference/extension-points/org_eclipse_objectteams_otequinox_aspectBindings.html#e.forcedExports">Forced Exports</a></li>
<li><a href="PLUGINS_ROOT/org.eclipse.objectteams.otdt.doc/reference/extension-points/org_eclipse_objectteams_otequinox_liftingParticipant.html">Lifting Participants</a>
<li><a href="PLUGINS_ROOT/org.eclipse.objectteams.otdt.doc/reference/extension-points/org_eclipse_objectteams_otequinox_aspectBindingNegotiators.html">Aspect Binding Negotiation</a>
</ul>
<h3>Details</h3>
<p>Previously, we had given advice that OT/Equinox can be <strong>disabled</strong> by removing a particular line
from the file <code>configuration/config.ini</code>. This line no longer exists.
Instead, OT/Equinox can now be disabled using the following Java property:</p>
<pre> -Dot.equinox=false</pre>
<p>The new implementation also plays better with Equinox' <strong>lazy loading</strong>:
previously, loading and activation of teams was triggered whenever the affected base <em>bundle</em> was activated.
Given that team loading/activation could in turn trigger other bundles to be loaded/activated,
a lot of loading activity could be observed right during system launch, which was not strictly necessary.
The new implementation waits until actually an affected base <em>class</em> is accessed,
which is the latest possible point for activating corresponding teams.
As a result the impact on the loading sequence could be significantly reduced.</p>
<h3>Portability</h3>
<p>The new implementation no longer depends on "inofficial API", but relies on the OSGi standard <strong>WeavingHook</strong>.
This way, the basic functionality of OT/Equinox should in fact work on other OSGi containers, as well.
Of course, using extension points for declaring teams to be activated still depends on Equinox,
but this is a well isolated concern and porting this to any other means for configuration
should be straight-forward.</p>
<h3>Visualization unchanged</h3>
<p>As a (partial) proof of compatibility, the existing <strong>OT/Equinox Monitor</strong> view works
on top of the new implementation without a single line of code changed.</p>
<img src="../images/screenshots/otequinoxMonitor.png" width="519" alt="OT/Equinox Montitor View"/>
<p>In fact this view can be used to observe the non-impact of OT/Equinox in two regards:</p>
<ul>
<li>Teams whose base classes have not yet been loaded will not be known / shown.
To see the highlighted BrandingAdaptor, it is necessary to open an about dialog like
<code class="UI">Help &gt; Installation Details &gt; Plug-ins</code></li>
<li>Role instances adapting a base instance that has been garbage-collected are also removed from memory
and hence no longer show in the monitor view (cf. the many zeros in the "# roles" column).</li>
</ul>
</td>
</tr>
<tr>
<td id="qfAddExport"><p align="right"><b>Quick fix to add aspect export</b><br>
<span class="since">since&nbsp;2.3M2</span><br>
<a class="buglink" target="_blank" title="migrate OT/Equinox to the standard OSGi WeavingHook" href="https://bugs.eclipse.org/406518#c37">406518#c37</a></p></td>
<td><p>The new implementation of OT/Equinox requires to export all packages containing teams (see above).
When this export is missing, an error is flagged against the plugin's manifest and a quick fix is
offered for adding the required export in the recommended format.
</p>
<a href="../images/screenshots/NN23/QFAddAspectExport.png"><img src="../images/screenshots/NN23/QFAddAspectExport.png" width=519 alt="Quick fix to add required aspect export"/></a>
<p>Applying the quick fix produces this result:</p>
<a href="../images/screenshots/NN23/QFAddAspectExport1.png"><img src="../images/screenshots/NN23/QFAddAspectExport1.png" width=519 alt="Result of the quick fix"/></a>
<p id="ot-aspect-host">The screenshot shows a package export with a <em>recommended</em> property <code>ot-aspect-host</code>,
which marks the export as intended for the sole purpose of letting woven code call into the team.
Additionally, the value of this property identifies the declaring aspect bundle,
which is internally used to uniquely identify this package even in situations of split packages.
</p>
<p>Finally, the export may use one of <code>x-internal</code> or <code>x-friends</code>
for preventing unintended use of this package.
</p>
<p> Once we re-implement the Forced Exports concept (see above), we may consider to remove the
additional requirement to export all packages containing teams.
</p>
</td>
</tr>
<!--
<tr><td colspan="2" id="debug"><h2>Run / Debug</h2></td></tr>
<tr>
<td><p align="right"><b>HEADING</b><br>
<span class="since">since&nbsp;2.1M6</span><br>
<a class="buglink" title="TITLE" href="https://bugs.eclipse.org/301314">301314</a></p></td>
<td><p>PARA</p>
</td>
</tr>
<tr><td colspan="2" id="api"><h2>API</h2></td></tr>
<tr>
<td><p align="right"><b>HEADING</b><br>
<span class="since">since&nbsp;2.1M6</span><br>
<a class="buglink" title="TITLE" href="https://bugs.eclipse.org/301314">301314</a></p></td>
<td><p>PARA</p>
</td>
</tr>
<tr><td colspan="2" id="compiler"><h2>Compiler</h2></td></tr>
<tr>
<td><p align="right"><b>HEADING</b><br>
<span class="since">since&nbsp;2.1M6</span><br>
<a class="buglink" title="TITLE" href="https://bugs.eclipse.org/301314">301314</a></p></td>
<td><p>PARA</p>
</td>
</tr>
<tr><td colspan="2" id="releng"><h2>Release Engineering</h2></td></tr>
<tr>
<td><p align="right"><b>HEADING</b><br>
<span class="since">since&nbsp;2.1M6</span><br>
<a class="buglink" title="TITLE" href="https://bugs.eclipse.org/301314">301314</a></p></td>
<td><p>PARA</p>
</td>
</tr>
-->
</table>
</body>