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 #601009] Thu, 20 May 2010 16:14
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 |
Previous Topic:Load-Time weave only one single aspect of a project containing several aspects
Next Topic:BUG? Organize Imports on Intertype-Declaration complains "Compilation unit has parse errors&quo
Goto Forum:
  


Current Time: Tue Jul 29 13:00:11 EDT 2014

Powered by FUDForum. Page generated in 0.02459 seconds