Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AJDT » How to call inherited methods with return values?
How to call inherited methods with return values? [message #534975] Thu, 20 May 2010 16:14 Go to next message
Tassilo Horn is currently offline Tassilo Horn
Messages: 93
Registered: July 2009
Member
Hi all,

I have some aspects doing some logging of different things to some
server. To move out some complexity with synchronization and stuff, I
have a class dealing with all that:

--8<---------------cut here---------------start------------->8---
abstract public class LogClient {
private boolean enabled = false;

protected final boolean isEnabled() {
return enabled;
}

protected final void send(String message) {
if (!enabled) {
return;
}
// ...
}
// ...
}
--8<---------------cut here---------------end--------------->8---

All my aspects now extend that class like that:

--8<---------------cut here---------------start------------->8---
public aspect TraceMethodCalls extends LogClient {
public TraceMethodCalls() throws IOException {
super();
}

private synchronized void log(boolean before, boolean constructor,
String signature) {
// ...
send(sb.toString());
}
// ...
}
--8<---------------cut here---------------end--------------->8---

As you can see, the aspect calls the send()-Method inherited from
LogClient. This works, but as soon as I change the log() method in the
aspect like that

--8<---------------cut here---------------start------------->8---
private synchronized void log(boolean before, boolean constructor,
String signature) {
if (!isEnabled())
return;

// ...
send(sb.toString());
}
--8<---------------cut here---------------end--------------->8---

I get this exception:

--8<---------------cut here---------------start------------->8---
Exception in thread "main" java.lang.NoSuchMethodError: de.uni_koblenz.aspects.tracing.client.method_calls.TraceMeth odCalls.isEnabled()Z
at de.uni_koblenz.aspects.tracing.client.method_calls.TraceMeth odCalls.log(TraceMethodCalls.aj:50)
at de.uni_koblenz.aspects.tracing.client.method_calls.TraceMeth odCalls.ajc$after$de_uni_koblenz_aspects_tracing_client_meth od_calls_TraceMethodCalls$4$1e623020(TraceMethodCalls.aj:140 )
at
FoobarClientApplication.main(FoobarClientApplication.java:15 0)
--8<---------------cut here---------------end--------------->8---

Why can I call the inherited send() method but not the inherited
isEnabled() method?

Bye,
Tassilo
--
Dipl.-Inform. Tassilo Horn | Room: B015
University of Koblenz-Landau, Campus Koblenz | Phone: +49 (261) 287-2745
Institute for Software Technology | Mail: horn@uni-koblenz.de
Universitätsstr. 1, 56070 Koblenz, Germany |
NoSuchMethodError when calling methods from an aspect's superclass (was: How to call inherited metho [message #535040 is a reply to message #534975] Fri, 21 May 2010 03:19 Go to previous messageGo to next message
Tassilo Horn is currently offline Tassilo Horn
Messages: 93
Registered: July 2009
Member
Tassilo Horn <horn@uni-koblenz.de> writes:

> Why can I call the inherited send() method but not the inherited
> isEnabled() method?

I've tried to rule out some possibilities which might cause that
problem. One difference between send() and isEmpty() is that the first
returns void. So I created a method "protected void bla(){}" in the
superclass LogClient and tried to call that from the aspect extending
LogClient. But then I get the NoSuchMethodError for bla().

The I duplicated the LogClient.send(String) method to
LogClient.send2(String). And believe it or not, I cannot call send2()
but only send()...

Then I commented the send() method and made all my aspects only call
send2(). Result: NoSuchMethodError on send2().

I cleaned and rebuilt all involved projects, but still no luck.

So now I'm really stunned. How can I debug what's going on? I guess
something wents wrong during load time weaving. Is there some knob for
debugging that?

I'm happy for any pointers!

Bye,
Tassilo
--
Dipl.-Inform. Tassilo Horn | Room: B015
University of Koblenz-Landau, Campus Koblenz | Phone: +49 (261) 287-2745
Institute for Software Technology | Mail: horn@uni-koblenz.de
Universitätsstr. 1, 56070 Koblenz, Germany |
Re: How to call inherited methods with return values? [message #535088 is a reply to message #534975] Fri, 21 May 2010 05:26 Go to previous message
Tassilo Horn is currently offline Tassilo Horn
Messages: 93
Registered: July 2009
Member
Hi all,

of course it was a user-error. Somewhere in the depth of the Run
Configuration there was an outdated JAR file.

Sorry for the noise,
Tassilo
--
Dipl.-Inform. Tassilo Horn | Room: B015
University of Koblenz-Landau, Campus Koblenz | Phone: +49 (261) 287-2745
Institute for Software Technology | Mail: horn@uni-koblenz.de
Universitätsstr. 1, 56070 Koblenz, Germany |
NoSuchMethodError when calling methods from an aspect's superclass (was: How to call inherited metho [message #601026 is a reply to message #534975] Fri, 21 May 2010 03:19 Go to previous message
Tassilo Horn is currently offline Tassilo Horn
Messages: 93
Registered: July 2009
Member
Tassilo Horn <horn@uni-koblenz.de> writes:

> Why can I call the inherited send() method but not the inherited
> isEnabled() method?

I've tried to rule out some possibilities which might cause that
problem. One difference between send() and isEmpty() is that the first
returns void. So I created a method "protected void bla(){}" in the
superclass LogClient and tried to call that from the aspect extending
LogClient. But then I get the NoSuchMethodError for bla().

The I duplicated the LogClient.send(String) method to
LogClient.send2(String). And believe it or not, I cannot call send2()
but only send()...

Then I commented the send() method and made all my aspects only call
send2(). Result: NoSuchMethodError on send2().

I cleaned and rebuilt all involved projects, but still no luck.

So now I'm really stunned. How can I debug what's going on? I guess
something wents wrong during load time weaving. Is there some knob for
debugging that?

I'm happy for any pointers!

Bye,
Tassilo
--
Dipl.-Inform. Tassilo Horn | Room: B015
University of Koblenz-Landau, Campus Koblenz | Phone: +49 (261) 287-2745
Institute for Software Technology | Mail: horn@uni-koblenz.de
Universitätsstr. 1, 56070 Koblenz, Germany |
Re: How to call inherited methods with return values? [message #601034 is a reply to message #534975] Fri, 21 May 2010 05:26 Go to previous message
Tassilo Horn is currently offline Tassilo Horn
Messages: 93
Registered: July 2009
Member
Hi all,

of course it was a user-error. Somewhere in the depth of the Run
Configuration there was an outdated JAR file.

Sorry for the noise,
Tassilo
--
Dipl.-Inform. Tassilo Horn | Room: B015
University of Koblenz-Landau, Campus Koblenz | Phone: +49 (261) 287-2745
Institute for Software Technology | Mail: horn@uni-koblenz.de
Universitätsstr. 1, 56070 Koblenz, Germany |
Previous Topic:BUG? Organize Imports on Intertype-Declaration complains "Compilation unit has parse errors&
Next Topic:Equinox Weaving SDK update site
Goto Forum:
  


Current Time: Wed Aug 27 15:07:58 EDT 2014

Powered by FUDForum. Page generated in 0.02020 seconds