Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API isStatic() under CtExecutableReference does not return true. Under Spoon 5.2.0. #817

Closed
giphon opened this issue Sep 6, 2016 · 0 comments

Comments

@giphon
Copy link

giphon commented Sep 6, 2016

The API isStatic() under CtExecutableReference does not return the staticness. Under Spoon 5.2.0.
Not sure whether this is a dropped feature or a bug.

The input source code

package temp;
public class A {
    public static int getInt1() { return 1; }
    public final static int getInt2() { return 2; }
    public final int getInt3() { return 3; }    
    public int getInt4() { return 4; }
}

The Spoon processor

package spoonbug;
public class ExecRefProcessor extends AbstractProcessor<CtClass> {
    @Override
    public void process(CtClass ctClass) {
        CtTypeReference typeRef = ctClass.getReference();
        Collection<CtExecutableReference<?>> collectExecRef = typeRef.getDeclaredExecutables(               
        for(CtExecutableReference execRef: collectExecRef)
        {
            System.out.println("" + execRef.getSimpleName() + " # isStatic()? " + execRef.isStatic() );
            System.out.println("" + execRef.getSimpleName() + " # isFinal()? " + execRef.isFinal() );
        }
    }
}

Output is as follows. Then isStatic() does not return true for getInt1() and getInt2()

getInt1 # isStatic()? false
getInt1 # isFinal()? false
getInt2 # isStatic()? false
getInt2 # isFinal()? true
getInt3 # isStatic()? false
getInt3 # isFinal()? true
getInt4 # isStatic()? false
getInt4 # isFinal()? false
<init> # isStatic()? false
<init> # isFinal()? false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant