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?

有帮助吗?

解决方案

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 )

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top