Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 351520 - Undefined getClass() for role in seperate role file
Summary: Undefined getClass() for role in seperate role file
Status: VERIFIED FIXED
Alias: None
Product: Objectteams
Classification: Tools
Component: OTDT (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 2.1 M2   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-08 04:24 EDT by Andreas Mertgen CLA
Modified: 2013-02-20 14:21 EST (History)
1 user (show)

See Also:


Attachments
test & fix (4.28 KB, patch)
2011-09-03 15:02 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 Andreas Mertgen CLA 2011-07-08 04:24:36 EDT
In a very complex setting of multiple projects and teams with many role classes I see an error in the editor, when I try to do something like the following:

Class c = SeperateRole<@t>.class;

In the editor, an error is shown: "The method _OT$getClass$SeperateRole() is undefined for the type SomeTeam". However, this error does not appear in the problem view nor is it a problem while compiling. 

SeperateRole is any role of SomeTeam, which is definied in a seperate role file within the team package. If I do the same for a role class which is inlined in the enclosing team, the error message does not appear.

Unfortunately (or not?), I was not able to reproduce the error in a simpler setting.
Comment 1 Stephan Herrmann CLA 2011-07-08 05:13:12 EDT
Could you please try what happens if you add a corresponding @role tag
to the javadoc of the team containing SeperateRole?
   @role SeperateRole
This should help the compiler to find the role file, and is recommended
in order to prevent all kinds of issues wrt role files.

Still a test case would be great so we could actually fix the issue, if possible.
Comment 2 Andreas Mertgen CLA 2011-07-08 06:44:25 EDT
Adding the @role tag does not change the behaviour.

At the moment I don't see how I could extract a test case.
Comment 3 Stephan Herrmann CLA 2011-08-13 11:08:49 EDT
Closing as WORKSFORME since I can't reproduce.

Feel free to reopen, when you see it again.
Perhaps you could share the whole project so I can see the bug?
Comment 4 Stephan Herrmann CLA 2011-09-03 14:28:16 EDT
Using the original projects I can now reproduce.

In reconciler mode the compiler takes a shortcut when processing
a type that is not in the CU being reconciled.
For the case of role files, however, we need to perform some more
steps even in reconciler mode.
Comment 5 Stephan Herrmann CLA 2011-09-03 15:02:30 EDT
Created attachment 202709 [details]
test & fix

Here's a minimal unit test and a simple fix.

The change in TypeDeclaration actually handles a follow-up NPE that
resulted when continuing to process a type with partial method bodies.
Comment 6 Stephan Herrmann CLA 2011-09-03 15:08:07 EDT
Patch has been released for 2.1 M2 (r1998/99)
Comment 7 Stephan Herrmann CLA 2013-02-20 14:21:49 EST
Verified (using 2.2 M5) that the change in class Dependencies indeed toggles the bug, and that this is correctly detected by OTReconcilerTests.