Commit e4f84b7d authored by Gerson SUNYE's avatar Gerson SUNYE
Browse files

Merge branch 'master' into 'master'

Fixed a bug where the rule avoidThreadGroup would throw an error.

See merge request naomod/mde/projet-2019!52
parents 490d4d0e 5e32f3fe
......@@ -463,7 +463,7 @@ rule measureAvoidThreadGroup(variable : java!VariableDeclarationFragment) {
measure <- noc,
measurements <- measurement
noc: smm!DimnsionalMeasure (
noc: smm!DimensionalMeasure (
name <- 'Avoid Thread Group',
shortDescription <- 'Avoid using java.lang.ThreadGroup; although it is intended to be used in a threaded environment it contains methods that are not thread-safe.'
......@@ -43,23 +43,9 @@ helper def:isDontCallThreadRun(s:java!MethodInvocation): Boolean =
--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!VariableDeclarationFragment.allInstances() -> iterate(i; res : Set(smm!Measure) = Set{} |
if (thisModule.isThreadGroup(i))
then res->union(Set{thisModule.measureAvoidThreadGroup(i)})
else res
--Detect a wrong usage of the variable type java.lang.ThreadGroup
--return true if the variable of type java.lang.ThreadGroup
helper def:isThreadGroup(s:java!VariableDeclarationFragment): Boolean =
if = 'ThreadGroup' then
java!VariableDeclarationFragment.allInstances() ->
select(i | i.variablesContainer.type.toString() <> 'OclUndefined')->
select(s| = 'ThreadGroup')->collect(i | thisModule.measureAvoidThreadGroup(i) );
--------------------------------------------- UseNotifyAllInsteadOfNotify ---------------------------------------------
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