Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Objectteams » Understanding or Bug?(hasRole(Object, Class) ends up in NoSuchMethodError)
Understanding or Bug? [message #530702] Fri, 30 April 2010 15:02 Go to next message
Jan Marc Hoffmann is currently offline Jan Marc HoffmannFriend
Messages: 32
Registered: July 2009
Member
Here is what I did:

public team class OuterTeam {
	
	public team class InnerTeam playedBy OuterBase {
	
		protected class SomeRole playedBy InnerBase {
		}
		
		@SuppressWarnings("ambiguouslowering")
		public void createRole(InnerBase as SomeRole b) {
			System.out.println(OuterTeam.this.hasRole(b, SomeRole.class));
		}	
	}
	
	public InnerTeam registerInnerTeam(OuterBase as InnerTeam o) {
		return o;
	}
}


Called by:

public class Main {

	public static void main(String[] args) {
		OuterBase ob = new OuterBase();
		InnerBase ib = new InnerBase();
		final OuterTeam ot = new OuterTeam();
		InnerTeam<@ot> it = ot.registerInnerTeam(ob);
		it.createRole(ib);
	}
}


Results in:

Exception in thread "main" java.lang.NoSuchMethodError: otdtbugs.OuterTeam$InnerTeam._OT$getClass$SomeRole()Ljava/lang/Class;
	at otdtbugs.OuterTeam$__OT__InnerTeam.createRole(OuterTeam.java:12)
	at otdtbugs.Main.main(Main.java:10)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.cs3.jmangler.bootstrap.Start.main(Start.java:66)


The exact same code works fine if the second argument of the hasRole method is omitted.

Really troublesome got this when I used it in conclusion with the ObjectRegistration Pattern ( http://trac.objectteams.org/ot/wiki/OtPatterns/ObjectRegistr ation). Used in GuardPredicates no error will get thrown and the Base wont get lifted.

Is there an error in my understanding or is this a bug?

greetings and congratulations on the approval

Jan Marc

Re: Understanding or Bug? [message #530721 is a reply to message #530702] Fri, 30 April 2010 15:52 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Hi Jan Marc,

that's a bug. The SomeRole.class literal isn't correctly translated.
Thanks for the report, which is just in time to get fixed for 0.7.0 M2
due next week in conjunction with Eclipse 3.6 M7.

Please let me know, if you need the fix backported to 1.4.

I'd actually appreciate if you open a bugzilla with your example.
Thanks,
Stephan

PS: regarding the guard predicate: I'm thinking whether exceptions
thrown in guards should be logged somewhere (configurable).
The point is that guards must catch these exceptions because there's
nowhere else in the program where this catching can reasonably happen.
For checked exceptions we have a compiler error, but for unchecked ones
this is tricky...
Re: Understanding or Bug? [message #530822 is a reply to message #530721] Sat, 01 May 2010 10:58 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
For cross-reference:
this bug is tracked (resolved) in https://bugs.eclipse.org/311201
Re: Understanding or Bug? [message #530824 is a reply to message #530822] Sat, 01 May 2010 11:17 Go to previous messageGo to next message
Jan Marc Hoffmann is currently offline Jan Marc HoffmannFriend
Messages: 32
Registered: July 2009
Member
Thanks for fixing the bug. I wont need it backported, since the release is close and i can work around it by using Strings... (dirty but works).

Regarding the Exceptions in Guardpredicates, I think as a starter it would be enough to just log it to System.err. Configurable logging would be a nice to have .. :=)

Nevertheless I think its quite an important feature since Teamactivation (Lifting) can be troublesome with a lot of Threads and Teams. So I would love to see a logging option of some kind.

greetings

Jan Marc

Re: Understanding or Bug? [message #573947 is a reply to message #530702] Fri, 30 April 2010 15:52 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Hi Jan Marc,

that's a bug. The SomeRole.class literal isn't correctly translated.
Thanks for the report, which is just in time to get fixed for 0.7.0 M2
due next week in conjunction with Eclipse 3.6 M7.

Please let me know, if you need the fix backported to 1.4.

I'd actually appreciate if you open a bugzilla with your example.
Thanks,
Stephan

PS: regarding the guard predicate: I'm thinking whether exceptions
thrown in guards should be logged somewhere (configurable).
The point is that guards must catch these exceptions because there's
nowhere else in the program where this catching can reasonably happen.
For checked exceptions we have a compiler error, but for unchecked ones
this is tricky...
Re: Understanding or Bug? [message #573972 is a reply to message #573947] Sat, 01 May 2010 10:58 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
For cross-reference:
this bug is tracked (resolved) in https://bugs.eclipse.org/311201
Re: Understanding or Bug? [message #573994 is a reply to message #530822] Sat, 01 May 2010 11:17 Go to previous message
Jan Marc Hoffmann is currently offline Jan Marc HoffmannFriend
Messages: 32
Registered: July 2009
Member
Thanks for fixing the bug. I wont need it backported, since the release is close and i can work around it by using Strings... (dirty but works).

Regarding the Exceptions in Guardpredicates, I think as a starter it would be enough to just log it to System.err. Configurable logging would be a nice to have .. :=)

Nevertheless I think its quite an important feature since Teamactivation (Lifting) can be troublesome with a lot of Threads and Teams. So I would love to see a logging option of some kind.

greetings

Jan Marc
Previous Topic:Understanding or Bug?
Next Topic:Warm-up Milestone: 0.7.0 M1
Goto Forum:
  


Current Time: Fri Apr 19 08:07:02 GMT 2024

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

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

Back to the top