Question

I am using Rascal to analyze an Eclipse project and I was wondering if it is possible to detect whether a certain field is declared as static, like static int x;.

I have created an M3 model for my project and using fields(model) I can obtain all the fields that are present within my project.

I would like to be able to extract any static fields from this set (without having to check the original code myself).

Is this possible within Rascal and if so, how can I extract them?

Was it helpful?

Solution

Take a look at the modifiers relation.

Inside Rascal you can find the definition of Modifier in rascal > lang > java > m3 > AST.rsc (also included in the tutor at: http://tutor.rascal-mpl.org/Rascal/Libraries/lang/java/m3/AST/Declaration/Declaration.html )

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top