Commit f8815726 authored by Raphael PAGE's avatar Raphael PAGE Committed by Gerson SUNYE
Browse files

Revert "REMOVED ALL IF THEN ELSE"

This reverts commit 7f7099f93e6bc4b785033b2ecdc1d38678335428.
parent 105e035d
/org.eclipse.jdt.source.all.xmi
......@@ -39,6 +39,7 @@ helper def: allMeasures(project : java!Model): Set(smm!Measure) =
--
thisModule.avoidThreadGroup(),
thisModule.useNotifyAllInsteadOfNotify(),
thisModule.dontCallThreadRun(),
-- Code Style rules
......@@ -138,7 +139,6 @@ helper def: allMeasures(project : java!Model): Set(smm!Measure) =
-- thisModule.avoidStringBufferField()
-- thisModule.avoidThrowingNewInstanceOfSameException(),
-- thisModule.stringToString(),
-- thisModule.dontCallThreadRun(),
-- thisModule.methodWithSameNameAsEnclosingClass(),
-- thisModule.dontUseFloatTypeForLoopIndices(),
-- thisModule.methodWithSameNameAsEnclosingClass(),
......@@ -267,7 +267,7 @@ rule MeasureStringToString(method : java!MethodInvocation) {
}
-- creates a new Measure when Thread.run() is used instead of Thread.start()
rule MeasureDontCallThreadRun(method : java!MethodInvocation) {
rule MeasureDontCallThreadRun(method : java!MethodDeclaration) {
to
om: smm!ObservedMeasure (
measure <- noc,
......@@ -556,7 +556,7 @@ rule MeasureAvoidPrintStackTrace(method : java!MethodInvocation) {
}
-- creates a new Measure when Thread.run() is used instead of Thread.start()
rule measureAvoidThreadGroup(variable : java!VariableDeclarationFragment) {
rule measureAvoidThreadGroup(variable : java!VariableDeclarationStatement) {
to
om: smm!ObservedMeasure (
measure <- noc,
......
......@@ -5,9 +5,10 @@ library multithreading;
--Goes through all the methods to check if the following rule is followed:
--Don't call Thread.run()
helper def: dontCallThreadRun() : Set(smm!Measure) =
java!MethodInvocation.allInstances()
-> select (m | m.method.name='run' )
-> select (m | m.method.abstractTypeDeclaration.name = 'Thread' )
java!MethodDeclaration.allInstances()
-> select (m | m.name='run' )
-> select (m | m.abstractTypeDeclaration <> OclUndefined )
-> select (m | m.abstractTypeDeclaration.name = 'Thread' )
-> collect (m | thisModule.MeasureDontCallThreadRun(m));
--------------------------------------------- AvoidThreadGroup ---------------------------------------------
......
Supports Markdown
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