[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Problems with Enum
|
Hello everybody! I'm new here so I find it nice to say hello in the very
beginning :-)
And now to the point... I'm trying to write a simple mertic-counting
tool. I decided to use aspectj's AST. Currently I'm trying to make out
the api of the ast (as in eclipse I find it tricky). Everything works
fine for classes but not for enum's. My code looks like this:
import java.util.ArrayList;
import org.aspectj.org.eclipse.jdt.core.dom.ASTVisitor;
import org.aspectj.org.eclipse.jdt.core.dom.AnonymousClassDeclaration;
import org.aspectj.org.eclipse.jdt.core.dom.CompilationUnit;
import org.aspectj.org.eclipse.jdt.core.dom.EnumDeclaration;
import org.aspectj.org.eclipse.jdt.core.dom.MethodDeclaration;
import pl.wirp.user23.logic.metrics.beans.MetricResult;
public class NLOCVisitor extends ASTVisitor {
private ArrayList<MetricResult> result = new ArrayList<MetricResult>();
public ArrayList<MetricResult> getResult() {
return result;
}
......
@Override
public boolean visit(EnumDeclaration ed) {
System.out.println(ed.toString());
return true;
}
@Override
public boolean visit(AnonymousClassDeclaration acd) {
System.out.println(acd);
return true;
}
...
}
I want (by now) write the source of my enum on standard out. Similar
code for classes works fine, but for enums nothing happens. Methodes
aren't even invoked.
My enum class looks like this:
public enum BasicEnum {
A = 1, B = 2, C = 3;
public int getNumberOfEnumerators(){
return 3;
}
}
so it's really simple.
I would appreciate any help. Thanks!
Wojtek
----------------------------------------------------------------------
"Kup bilet na najlepsze zawody Freestyle Motocross - DIVERSE Night of
the Jumps!" http://link.interia.pl/f1c5f