Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Problems with Enum

My code isn't AspectJ code. It's simple Java 1.5 code. I tried changing my visitor to AjASTVisitor, but it still doesn't work.

I suspect you should be using AjASTVisitor as the superclass if you
intend to process AspectJ code eventually.  Be aware that the AspectJ
AST support is not complete - we are accepting contributions from
anyone who wants to fill in missing pieces.  I'm surprised enum isn't
working for you though, I would have imagined it is merely the AJ
constructs that are not visited correctly.

On 28/11/2007, Wojto <jestem.wojtek@xxxxxxxxxx> wrote:
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

_______________________________________________
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





----------------------------------------------------------------------
Odmienila swoje oblicze a Ty ... ??

http://link.interia.pl/f1c86



Back to the top