Commit 3f3fdf6b authored by Gerson SUNYE's avatar Gerson SUNYE
Browse files

Merge branch 'master' into 'master'

Fixed the rule dontCallThreadRun

Closes #910, #873, #616, and #876

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