Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Yannis LE BARS
Source Code Analyzer
Commits
5e32f3fe
Commit
5e32f3fe
authored
Dec 05, 2019
by
Raphael
Browse files
Fixed a bug where the rule avoidThreadGroup would throw an error.
parent
af81f962
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/atl/analysis.atl
View file @
5e32f3fe
...
...
@@ -473,7 +473,7 @@ rule measureAvoidThreadGroup(variable : java!VariableDeclarationFragment) {
measure <- noc,
measurements <- measurement
),
noc: smm!DimnsionalMeasure (
noc: smm!Dim
e
nsionalMeasure (
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.'
),
...
...
src/main/atl/multithreading.atl
View file @
5e32f3fe
...
...
@@ -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
endif
);
--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 s.variablesContainer.type.type.name.toString() = 'ThreadGroup' then
true
else
false
endif;
java!VariableDeclarationFragment.allInstances() ->
select(i | i.variablesContainer.type.toString() <> 'OclUndefined')->
select(s|s.variablesContainer.type.type.name.toString() = 'ThreadGroup')->collect(i | thisModule.measureAvoidThreadGroup(i) );
--------------------------------------------- UseNotifyAllInsteadOfNotify ---------------------------------------------
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment