Commit 4eb8c8c7 authored by Gerson Sunyé's avatar Gerson Sunyé
Browse files

code reorganization

parent 6b87db32
library multithreading; library multithreading;
--------------------------------------------- DontCallThreadRun ---------------------------------------------
--Goes through all the methods to check if the following rule is followed: --- Goes through all the variables to check if the following rule is followed:
--Don't call Thread.run() --- Avoid using java.lang.ThreadGroup;
helper def: avoidThreadGroup() : Set(smm!Measure) =
java!VariableDeclarationStatement.allInstances()
-> select(variable | variable.type.type.name = 'ThreadGroup')
-> collect(variable | thisModule.measureAvoidThreadGroup(variable) );
--- Goes through all the methods to check if the following rule is followed:
--- Don't call Thread.run()
helper def: dontCallThreadRun() : Set(smm!Measure) = helper def: dontCallThreadRun() : Set(smm!Measure) =
java!MethodDeclaration.allInstances() java!MethodDeclaration.allInstances()
-> select (m | m.name='run' ) -> select (m | m.name='run' )
...@@ -11,18 +18,7 @@ helper def: dontCallThreadRun() : Set(smm!Measure) = ...@@ -11,18 +18,7 @@ helper def: dontCallThreadRun() : Set(smm!Measure) =
-> select (m | m.abstractTypeDeclaration.name = 'Thread' ) -> select (m | m.abstractTypeDeclaration.name = 'Thread' )
-> collect (m | thisModule.MeasureDontCallThreadRun(m)); -> collect (m | thisModule.MeasureDontCallThreadRun(m));
--------------------------------------------- AvoidThreadGroup --------------------------------------------- --- Returns a set of measures each time the method 'notify()' is used instead of 'notifyAll()'
--Goes through all the variables to check if the following rule is followed:
--Avoid using java.lang.ThreadGroup;
helper def: avoidThreadGroup() : Set(smm!Measure) =
java!VariableDeclarationStatement.allInstances()
-> select(variable | variable.type.type.name = 'ThreadGroup')
-> collect(variable | thisModule.measureAvoidThreadGroup(variable) );
--------------------------------------------- UseNotifyAllInsteadOfNotify ---------------------------------------------
-- Returns a set of measures each time the method 'notify()' is used instead of 'notifyAll()'
helper def: useNotifyAllInsteadOfNotify(): Set(smm!Measure) = helper def: useNotifyAllInsteadOfNotify(): Set(smm!Measure) =
-- Get the method declarations of notify() and for each of their MethodInvocation usages, create a measure -- Get the method declarations of notify() and for each of their MethodInvocation usages, create a measure
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment