Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 314610 - Produce warning when two roles capture the same method at the same time
Summary: Produce warning when two roles capture the same method at the same time
Status: VERIFIED FIXED
Alias: None
Product: Objectteams
Classification: Tools
Component: OTDT (show other bugs)
Version: 0.7   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 2.1 M2   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 355297
Blocks:
  Show dependency tree
 
Reported: 2010-05-27 03:28 EDT by Matthias Diehn Ingesman CLA
Modified: 2011-12-16 15:27 EST (History)
1 user (show)

See Also:


Attachments
proposed implementation (16.40 KB, patch)
2011-08-19 19:36 EDT, Stephan Herrmann CLA
no flags Details | Diff
additional changes for binary types (8.81 KB, patch)
2011-08-20 17:14 EDT, Stephan Herrmann CLA
no flags Details | Diff
additional changes: marker lifecycle (5.66 KB, patch)
2011-08-20 18:54 EDT, Stephan Herrmann CLA
no flags Details | Diff
additional change: avoid interference with workspace initialization (4.43 KB, patch)
2011-08-23 13:53 EDT, Stephan Herrmann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Diehn Ingesman CLA 2010-05-27 03:28:34 EDT
In a talk at the university of Aarhus, Computer Science, Stephan Herrmann presented Object Teams to a class on Types in Objct-Oriented Programming Languages.
I asked him what would happen if two different roles captured the same method at the same time - the answer is not relevant here, but he asked me to file an enhancement request for the compiler.

So, the compiler should warn you if two roles capture the same method at the same time.
Comment 1 Stephan Herrmann CLA 2010-05-27 16:55:17 EDT
Thanks for the report!

After thinking about this I will probably not add this to the compiler
but add a separate builder to drive that analysis. The reason is:
This kind of analysis requires knowledge about the whole system.
The compiler, however, is geared at operating locally to show
good performance when translating individual files.
A separate builder will instead be able to use the search engine
in order to find overlaping playedBy & callin bindings.

Enabling the new analysis will then be a matter of adding one more
builder to a project - for which I will probably add a menu action
in the context menu below "Configure".
Comment 2 Matthias Diehn Ingesman CLA 2010-06-05 12:50:23 EDT
(In reply to comment #1)
> Thanks for the report!
> 
> After thinking about this I will probably not add this to the compiler
> but add a separate builder to drive that analysis. The reason is:
> This kind of analysis requires knowledge about the whole system.
> The compiler, however, is geared at operating locally to show
> good performance when translating individual files.
> A separate builder will instead be able to use the search engine
> in order to find overlaping playedBy & callin bindings.
> 
> Enabling the new analysis will then be a matter of adding one more
> builder to a project - for which I will probably add a menu action
> in the context menu below "Configure".

That makes sense. I didn't know you have that kind of separation in ObjectTeams.
Comment 3 Stephan Herrmann CLA 2011-08-19 19:36:45 EDT
Created attachment 201844 [details]
proposed implementation

In contrast to my initial assessment it seems easiest to indeed use
the information directly from the compiler. Just, the compiler doesn't
know when to start/stop collecting information.

The required coordination between the BatchImageBuilder (because this
analysis cannot work during incremental compilation) and the Compiler
is performed by a new team CheckUniqueCallinCapture.
This team activates callin-data collection only during a full build and 
at the end of the build it creates markers for all affected base methods.

Initial experiments look promising, let's see how this works in real life.

Open issues:
- can we add markers to binary types?
- can we create this warning also during command-line, ant, or maven builds?
- In the IDE: should we use a different marker ID so that markers are not
  deleted by incremental compilation?
Comment 4 Stephan Herrmann CLA 2011-08-20 17:14:50 EDT
Created attachment 201861 [details]
additional changes for binary types

This patch leverages the infrastructure from bug 355297 to add markers
also to binary types (classfiles). We also add some more attributes
to the marker so that the Problems view can display Resource and Path
of these markers.

Finally, a new team (MarkerViewAdaptor) fixes openMarkerInEditor for
our new markers.

So far, these markers on binary types are not deleted, so they accumulate
across full builds :-/
Comment 5 Stephan Herrmann CLA 2011-08-20 18:54:23 EDT
Created attachment 201862 [details]
additional changes: marker lifecycle

This patch adds a new marker type "Global Analysis Problem".
These markers are persistent and are not deleted by incremental builds.

A new team ProblemCleaner observes the start of any full or clean build
in order to remove all Global Analysis Problems.

This defines the life cycle of the new problem markers.
Comment 6 Stephan Herrmann CLA 2011-08-20 18:57:37 EDT
With the above improvements (which have been committed between r1910 and
r1921) I consider this issue as resolved.
Further enhancements should be discussed in separate bugs (if any).
Comment 7 Stephan Herrmann CLA 2011-08-23 13:53:00 EDT
Created attachment 202022 [details]
additional change: avoid interference with workspace initialization

With the new MarkerViewAdaptor the Choose Workspace dialog was no longer
shown due to bug 204829, triggered here by loading interface IMarker when
activating the team.

With the latest patch we avoid this issue by one more indirection:
an outer team that has no dependencies on the resources plugin,
watching for initialization of the problems view and only then 
activating the inner team that contains the actual logic.
Comment 8 Stephan Herrmann CLA 2011-12-16 15:27:53 EST
Verified using build 201112131519.