Hi Andy,
I've spent some more time on this issue and was able to resolve the
compilation problem. I noticed that this code compiles in Eclipse,
but it was not compiling in maven. I did some research and found
the following link:
http://stackoverflow.com/questions/2610633/maven-compile-aspectj-project-containing-java-1-6-source
In there, the first solution fixed my problem, where I updated my
pom file to have the following line in the execution section of the
aspectj-maven-plugin
<phase>process-sources</phase>
This resolved all the references (I had others too, that I did not
post) that could not be found. So, I don't think there was anything
wrong with this code. It was the compiler plugin all along.
Thanks,
Rene
-------- Original Message --------
Hi Andy,
Below is the code for SearchTimer also, if that's helpful. It's using
SQLUtil.
The compiler we are using is 1.0 beta 2 (embarrassingly old, I'd say).
We compile the code all at once through maven, using the
aspectj-maven-plugin. I'd appreciate any help/guidance you can give
us. I'm expecting this is just the first of several issues we'll need
to work through in order to upgrade.
Thanks,
Rene
package com.vms.adbase.presentation.performance;
import java.io.Serializable;
import java.text.DecimalFormat;
import com.vms.adbase.oracle.search.SearchTranslatorImpl;
import com.vms.adbase.searchBuilder.ConstructedSearch;
import com.vms.adbase.util.HibernateUtil;
import com.vms.adbase.util.TwoDecimalPlaceFormat;
import com.vms.adbase.util.sql.NullResolver;
import com.vms.adbase.util.sql.SQLUtil;
public class SearchTimer implements Serializable {
private ConstructedSearch search;
private Exception lastException;
private boolean shouldRun;
public SearchTimer(ConstructedSearch search) {
this.search = search;
setTimeout(new SQLUtil(HibernateUtil.ADBASE).getTimeout());
}
public SearchTimer(ConstructedSearch search, int timeout) {
this.search = search;
setTimeout(timeout);
}
public Exception getLastException() {
return lastException;
}
public ConstructedSearch getSearch() {
return search;
}
public String getSearchResults() {
if (!getShouldRun()) {
return "--";
}
if (hasException()) {
return lastException.toString();
}
DecimalFormat formatter = new TwoDecimalPlaceFormat();
return formatter.format(getSearch().getRunElapsedTime());
}
public void setShouldRun(boolean shouldRun) {
this.shouldRun = shouldRun;
}
public boolean getShouldRun() {
return shouldRun;
}
public boolean hasException() {
return lastException != null;
}
public void run() {
lastException = null;
SearchTranslatorImpl queryBuilder = new
SearchTranslatorImpl(search);
queryBuilder.setResolver(new NullResolver());
try {
search.runSearchWithTranslator(queryBuilder);
} catch (Exception e) {
lastException = e;
}
}
}
On 07/01/2011 04:41 PM, Andy Clement wrote:
> Hi,
>
> I can help you work through this, but I am not sure anything has
> really changed to affect how ITDs work. In the three example files
> you included, I don't understand the relationship between SQLUtil and
> HasTimeout? Is it via SearchTimer?
>
> How old is the compiler you are on, 1.2?
>
>
> public aspect HasTimeoutImpl {
> private int HasTimeout.timeout = 0;
> public int HasTimeout.getTimeout(){
> return timeout;
> }
> public void HasTimeout.setTimeout(int newTimeout){
> timeout = newTimeout;
> }
> }
>
> this aspect will ensure that HasTimeout and anyone implementing
> HasTimeout will get a 'setTimeout(int)', if they don't already provide
> it. Are you compiling all the code together, or in separate stages?
>
> cheers,
> Andy
>
> On 1 July 2011 11:58, Rene Stone<rstone@xxxxxxxxxxx> wrote:
>> Hi,
>> We have aspectj code using a really old version of the Aspectj compiler.
>> This works fine with it, but we want to upgrade to the latest compiler.
>> When I try to do that, I'm getting a compiler error as follows:
>>
>> /home/rstone/workspace3/Adbase/src/main/java/com/vms/adbase/presentation/performance/SearchTimer.java:[23,8]
>> cannot find symbol
>> symbol : method setTimeout(int)
>> location: class com.vms.adbase.presentation.performance.SearchTimer
>>
>> Sorry if this seems like a basic question, but we created a bunch of aspects
>> years ago and have not upgraded our compiler. Now we need to and we have
>> several examples like this, where we are adding methods to an interface,
>> that are just not compiling with the new compiler.
>>
>> Any ideas on how to fix this?
>>
>> Thanks,
>> Rene
>>
>>
>> Aspect HasTimeoutImple.aj:
>>
>> package com.vms.adbase.presentation.performance;
>>
>> public aspect HasTimeoutImpl {
>> private int HasTimeout.timeout = 0;
>> public int HasTimeout.getTimeout(){
>> return timeout;
>> }
>> public void HasTimeout.setTimeout(int newTimeout){
>> timeout = newTimeout;
>> }
>> }
>>
>> Interface HasTimeout.java:
>> package com.vms.adbase.presentation.performance;
>>
>> public interface HasTimeout {}
>>
>>
>> Aspect to add methods to SearchTimer:
>>
>> package com.vms.adbase.presentation.performance;
>>
>> import com.vms.adbase.util.sql.SQLUtil;
>>
>> public aspect TimeoutPropagation{
>> declare parents : SearchTimer implements HasTimeout;
>>
>> pointcut sqlUtilConstructions():
>> call(SQLUtil+.new(..));
>>
>> pointcut timerMethods(HasTimeout timer) :
>> execution(* HasTimeout+.*(..))&&
>> this(timer);
>>
>> pointcut sqlUtilConstructionsFromTimer(HasTimeout timer) :
>> sqlUtilConstructions()&& cflow(timerMethods(timer));
>>
>> after(HasTimeout timer) returning(SQLUtil newSQLUtil) :
>> sqlUtilConstructionsFromTimer(timer){
>>
>> newSQLUtil.setTimeout(timer.getTimeout());
>> }
>> }
>>
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
|