Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Objectteams » Adding Methods To TeamManager
Adding Methods To TeamManager [message #1769392] Mon, 31 July 2017 09:58 Go to next message
Lars Schütze is currently offline Lars SchützeFriend
Messages: 42
Registered: March 2012
Location: Germany
Member

Hi,

I am a bit puzzled about what I experience. I added new static methods to TeamManager. But when I add ASM code to call them from CreateDispatchInCallAllBindingsAdapter I get some tests fail with NoSuchMethodError.
ava.lang.NoSuchMethodError: org.eclipse.objectteams.otredyn.runtime.TeamManager.getTest()V

These tests have callout bindings with either before/replace/after modifier.

The code modification in CreateDispatchInCallAllBindingsAdapter
if(indy) {		
			instructions.add(new InvokeDynamicInsnNode(ConstantMembers.callAllBindingsTeam.getName(),
				ConstantMembers.callAllBindingsTeam.getSignature(), ConstantMembers.callAllBindingsBootstrap));
		} else {		
			instructions.add(new MethodInsnNode(Opcodes.INVOKEINTERFACE,
					ClassNames.ITEAM_SLASH, 
					ConstantMembers.callAllBindingsTeam.getName(),
					ConstantMembers.callAllBindingsTeam.getSignature(),
					true));
			instructions.add(new MethodInsnNode(Opcodes.INVOKESTATIC, ClassNames.TEAM_MANAGER_SLASH,
					ConstantMembers.getTest.getName(), ConstantMembers.getTest.getSignature(), false));
		}

And I defined it in the ConstantMembers as following:
	public static final Method getTest = new Method("getTest", Types
			.getTypeStringForMethod(Types.VOID, new String[] {}));

and it is implemented in TeamManager
public static void getTest () { System.out.println("works");}


The only reason I can imagine is that the IDE does not take the version that is built in my IDE. I did now increased the version numbers of required plugins (for ot.equinox since it re-exports runtime) but this does not help.
When calling the tests (otdt.tests.otjld.AllTests.java) from within the IDE as JUnit Plugin Tests does the IDE take the installed ObjectTeams Plugin or does it take the last built version which is under change?

I experience it with invokestatic as well as with the invokedynamic instruction. Method descriptor and everything matches.

Thanks for sharing your experience.

[Updated on: Mon, 31 July 2017 10:01]

Report message to a moderator

Re: Adding Methods To TeamManager [message #1769610 is a reply to message #1769392] Wed, 02 August 2017 08:16 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1602
Registered: July 2009
Senior Member
For JUnit Plugin Tests you should check two things:
1. first the core runtime classes need to be jarred up as o.e.o.otdt/lib/otre_min.jar, see otre_min.jardesc in the runtime project
2. ensure that tests use o.e.o.otdt from your workspace.

To observe how it is all combined for launching the test JVM, set a breakpoint on org.eclipse.objectteams.otdt.tests.otjld.AbstractOTJLDTest.getOTVMArgs().
Re: Adding Methods To TeamManager [message #1769622 is a reply to message #1769610] Wed, 02 August 2017 09:00 Go to previous messageGo to next message
Lars Schütze is currently offline Lars SchützeFriend
Messages: 42
Registered: March 2012
Location: Germany
Member

Oh boy. It works! That took me some time trying to figure out what the problem might be. Should have asked earlier ;-)

[Updated on: Wed, 02 August 2017 09:08]

Report message to a moderator

Re: Adding Methods To TeamManager [message #1769625 is a reply to message #1769622] Wed, 02 August 2017 09:08 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1602
Registered: July 2009
Senior Member
Glad it works :)

I added a red reminder in https://wiki.eclipse.org/OTDevelopmentSetup
Re: Adding Methods To TeamManager [message #1773840 is a reply to message #1769625] Thu, 05 October 2017 12:19 Go to previous messageGo to next message
Lars Schütze is currently offline Lars SchützeFriend
Messages: 42
Registered: March 2012
Location: Germany
Member

Okay, I hijack my own thread now :-D

I also made changes to the Object Teams compiler in the plugin org.eclipse.jdt.core. If I export the jars I can run the modified version externally.

But I cannot use the modified version of the compiler currently when running the tests. I did not see, where it takes the compiler from. I even changed the version number in the jdt.core plugin and increased the minimum version for that plugin in the test plugin. Still does not work.

Any suggestions? Thanks for your help :-)
Re: Adding Methods To TeamManager [message #1773999 is a reply to message #1773840] Sun, 08 October 2017 20:47 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1602
Registered: July 2009
Senior Member
If this is about running tests in the IDE, and you have the OT variant of o.e.jdt.core in your workspace, you should be able to see the set of plugins used for the test launch right in the launch configuration on tab "Plug-ins" (assuming you do Run as ... JUnit Plug-in Test).
See the drop-down "Launch with" and choose "plug-ins selected below" to inspect and perhaps modify.

HTH,
Stephan
Re: Adding Methods To TeamManager [message #1774272 is a reply to message #1773999] Thu, 12 October 2017 12:16 Go to previous message
Lars Schütze is currently offline Lars SchützeFriend
Messages: 42
Registered: March 2012
Location: Germany
Member

Well, at the end it was a bug in my code that has been triggered which I thought is functional :-D
Previous Topic:Question about OTDRE
Next Topic:Upcoming tests including Mockito
Goto Forum:
  


Current Time: Wed Jun 20 10:04:20 GMT 2018

Powered by FUDForum. Page generated in 0.02473 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top