Commit 0934211a authored by Roxane Kang Maréchal's avatar Roxane Kang Maréchal
Browse files

Added case where there is continue statement in input file and also handling in analysis.atl

parent 1193718f
......@@ -6,8 +6,61 @@
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.0" name="main">
<modifier visibility="public" static="true"/>
<body originalCompilationUnit="//@compilationUnits.0">
<statements xsi:type="java:LabeledStatement" originalCompilationUnit="//@compilationUnits.0" name="loop">
<body xsi:type="java:ForStatement" originalCompilationUnit="//@compilationUnits.0">
<expression xsi:type="java:InfixExpression" originalCompilationUnit="//@compilationUnits.0" operator="&lt;">
<rightOperand xsi:type="java:NumberLiteral" originalCompilationUnit="//@compilationUnits.0" tokenValue="10"/>
<leftOperand xsi:type="java:SingleVariableAccess" variable="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@body/@initializers.0/@fragments.0"/>
</expression>
<updaters xsi:type="java:PostfixExpression" originalCompilationUnit="//@compilationUnits.0">
<operand xsi:type="java:SingleVariableAccess" variable="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@body/@initializers.0/@fragments.0"/>
</updaters>
<initializers xsi:type="java:VariableDeclarationExpression" originalCompilationUnit="//@compilationUnits.0">
<type type="//@orphanTypes.0"/>
<fragments originalCompilationUnit="//@compilationUnits.0" name="i" usageInVariableAccess="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@body/@expression/@leftOperand //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@body/@updaters.0/@operand //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@body/@body/@statements.0/@expression //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@body/@body/@statements.1/@expression/@arguments.0">
<initializer xsi:type="java:NumberLiteral" originalCompilationUnit="//@compilationUnits.0" tokenValue="0"/>
</fragments>
<modifier/>
</initializers>
<body xsi:type="java:Block" originalCompilationUnit="//@compilationUnits.0">
<statements xsi:type="java:SwitchStatement" originalCompilationUnit="//@compilationUnits.0">
<comments xsi:type="java:LineComment" originalCompilationUnit="//@compilationUnits.0" content="// No violation" prefixOfParent="true"/>
<expression xsi:type="java:SingleVariableAccess" variable="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@body/@initializers.0/@fragments.0"/>
<statements xsi:type="java:SwitchCase" originalCompilationUnit="//@compilationUnits.0">
<comments xsi:type="java:LineComment" originalCompilationUnit="//@compilationUnits.0" content="// intentional fallthrough"/>
<expression xsi:type="java:NumberLiteral" originalCompilationUnit="//@compilationUnits.0" tokenValue="1"/>
</statements>
<statements xsi:type="java:SwitchCase" originalCompilationUnit="//@compilationUnits.0">
<comments xsi:type="java:LineComment" originalCompilationUnit="//@compilationUnits.0" content="// intentional fallthrough"/>
<expression xsi:type="java:NumberLiteral" originalCompilationUnit="//@compilationUnits.0" tokenValue="3"/>
</statements>
<statements xsi:type="java:SwitchCase" originalCompilationUnit="//@compilationUnits.0">
<comments xsi:type="java:LineComment" originalCompilationUnit="//@compilationUnits.0" content="// intentional fallthrough"/>
<expression xsi:type="java:NumberLiteral" originalCompilationUnit="//@compilationUnits.0" tokenValue="5"/>
</statements>
<statements xsi:type="java:SwitchCase" originalCompilationUnit="//@compilationUnits.0">
<comments xsi:type="java:LineComment" originalCompilationUnit="//@compilationUnits.0" content="// intentional fallthrough"/>
<expression xsi:type="java:NumberLiteral" originalCompilationUnit="//@compilationUnits.0" tokenValue="7"/>
</statements>
<statements xsi:type="java:SwitchCase" originalCompilationUnit="//@compilationUnits.0">
<comments xsi:type="java:LineComment" originalCompilationUnit="//@compilationUnits.0" content="// intentional fallthrough"/>
<expression xsi:type="java:NumberLiteral" originalCompilationUnit="//@compilationUnits.0" tokenValue="9"/>
</statements>
<statements xsi:type="java:ContinueStatement" originalCompilationUnit="//@compilationUnits.0" label="//@unresolvedItems.0"/>
</statements>
<statements xsi:type="java:ExpressionStatement" originalCompilationUnit="//@compilationUnits.0">
<expression xsi:type="java:MethodInvocation" originalCompilationUnit="//@compilationUnits.0" method="//@ownedElements.1/@ownedPackages.1/@ownedElements.1/@bodyDeclarations.0">
<arguments xsi:type="java:SingleVariableAccess" variable="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@body/@initializers.0/@fragments.0"/>
<expression xsi:type="java:SingleVariableAccess" variable="//@ownedElements.1/@ownedPackages.0/@ownedElements.3/@bodyDeclarations.0/@fragments.0">
<qualifier xsi:type="java:TypeAccess" type="//@ownedElements.1/@ownedPackages.0/@ownedElements.3"/>
</expression>
</expression>
</statements>
</body>
</body>
</statements>
<statements xsi:type="java:ExpressionStatement" originalCompilationUnit="//@compilationUnits.0">
<expression xsi:type="java:MethodInvocation" originalCompilationUnit="//@compilationUnits.0" method="//@ownedElements.1/@ownedPackages.1/@ownedElements.1/@bodyDeclarations.0">
<expression xsi:type="java:MethodInvocation" originalCompilationUnit="//@compilationUnits.0" method="//@ownedElements.1/@ownedPackages.1/@ownedElements.1/@bodyDeclarations.1">
<arguments xsi:type="java:StringLiteral" originalCompilationUnit="//@compilationUnits.0" escapedValue="&quot;Sample code for testing missing break in switch statement.&quot;"/>
<expression xsi:type="java:SingleVariableAccess" variable="//@ownedElements.1/@ownedPackages.0/@ownedElements.3/@bodyDeclarations.0/@fragments.0">
<qualifier xsi:type="java:TypeAccess" type="//@ownedElements.1/@ownedPackages.0/@ownedElements.3"/>
......@@ -106,10 +159,11 @@
<expression xsi:type="java:NumberLiteral" originalCompilationUnit="//@compilationUnits.1" tokenValue="0"/>
</statements>
<statements xsi:type="java:SwitchCase" originalCompilationUnit="//@compilationUnits.1">
<comments xsi:type="java:LineComment" originalCompilationUnit="//@compilationUnits.1" content="// not return, break, continue or throw so violation"/>
<expression xsi:type="java:StringLiteral" originalCompilationUnit="//@compilationUnits.1" escapedValue="&quot;one&quot;"/>
</statements>
<statements xsi:type="java:ExpressionStatement" originalCompilationUnit="//@compilationUnits.1">
<expression xsi:type="java:MethodInvocation" originalCompilationUnit="//@compilationUnits.1" method="//@ownedElements.1/@ownedPackages.1/@ownedElements.1/@bodyDeclarations.0">
<expression xsi:type="java:MethodInvocation" originalCompilationUnit="//@compilationUnits.1" method="//@ownedElements.1/@ownedPackages.1/@ownedElements.1/@bodyDeclarations.1">
<arguments xsi:type="java:StringLiteral" originalCompilationUnit="//@compilationUnits.1" escapedValue="&quot;Test&quot;"/>
<expression xsi:type="java:SingleVariableAccess" variable="//@ownedElements.1/@ownedPackages.0/@ownedElements.3/@bodyDeclarations.0/@fragments.0">
<qualifier xsi:type="java:TypeAccess" type="//@ownedElements.1/@ownedPackages.0/@ownedElements.3"/>
......@@ -117,7 +171,7 @@
</expression>
</statements>
<statements xsi:type="java:ExpressionStatement" originalCompilationUnit="//@compilationUnits.1">
<expression xsi:type="java:MethodInvocation" originalCompilationUnit="//@compilationUnits.1" method="//@ownedElements.1/@ownedPackages.1/@ownedElements.1/@bodyDeclarations.0">
<expression xsi:type="java:MethodInvocation" originalCompilationUnit="//@compilationUnits.1" method="//@ownedElements.1/@ownedPackages.1/@ownedElements.1/@bodyDeclarations.1">
<arguments xsi:type="java:StringLiteral" originalCompilationUnit="//@compilationUnits.1" escapedValue="&quot;Test2&quot;"/>
<expression xsi:type="java:SingleVariableAccess" variable="//@ownedElements.1/@ownedPackages.0/@ownedElements.3/@bodyDeclarations.0/@fragments.0">
<qualifier xsi:type="java:TypeAccess" type="//@ownedElements.1/@ownedPackages.0/@ownedElements.3"/>
......@@ -125,6 +179,7 @@
</expression>
</statements>
<statements xsi:type="java:SwitchCase" originalCompilationUnit="//@compilationUnits.1">
<comments xsi:type="java:LineComment" originalCompilationUnit="//@compilationUnits.1" content="// intentional fallthrough"/>
<expression xsi:type="java:StringLiteral" originalCompilationUnit="//@compilationUnits.1" escapedValue="&quot;two&quot;"/>
</statements>
<statements xsi:type="java:SwitchCase" originalCompilationUnit="//@compilationUnits.1" default="true"/>
......@@ -372,7 +427,7 @@
</ownedElements>
<ownedElements name="java" proxy="true">
<ownedPackages name="lang" proxy="true">
<ownedElements xsi:type="java:ClassDeclaration" name="String" proxy="true" usagesInTypeAccess="//@orphanTypes.9/@elementType //@ownedElements.1/@ownedPackages.1/@ownedElements.1/@bodyDeclarations.0/@parameters.0/@type //@ownedElements.0/@ownedElements.1/@bodyDeclarations.0/@type //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@parameters.0/@type //@ownedElements.0/@ownedElements.1/@bodyDeclarations.4/@returnType //@ownedElements.0/@ownedElements.2/@bodyDeclarations.0/@type">
<ownedElements xsi:type="java:ClassDeclaration" name="String" proxy="true" usagesInTypeAccess="//@orphanTypes.9/@elementType //@ownedElements.1/@ownedPackages.1/@ownedElements.1/@bodyDeclarations.1/@parameters.0/@type //@ownedElements.0/@ownedElements.1/@bodyDeclarations.0/@type //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@parameters.0/@type //@ownedElements.0/@ownedElements.1/@bodyDeclarations.4/@returnType //@ownedElements.0/@ownedElements.2/@bodyDeclarations.0/@type">
<superInterfaces type="//@ownedElements.1/@ownedPackages.1/@ownedElements.0"/>
<superInterfaces type="//@ownedElements.1/@ownedPackages.0/@ownedElements.1"/>
<superInterfaces type="//@ownedElements.1/@ownedPackages.0/@ownedElements.2"/>
......@@ -381,9 +436,9 @@
<typeParameters name="T" proxy="true"/>
</ownedElements>
<ownedElements xsi:type="java:InterfaceDeclaration" name="CharSequence" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@superInterfaces.2"/>
<ownedElements xsi:type="java:ClassDeclaration" name="System" proxy="true" usagesInTypeAccess="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@expression/@expression/@qualifier //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@body/@statements.0/@statements.3/@expression/@expression/@qualifier //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@body/@statements.0/@statements.4/@expression/@expression/@qualifier">
<ownedElements xsi:type="java:ClassDeclaration" name="System" proxy="true" usagesInTypeAccess="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@body/@body/@statements.1/@expression/@expression/@qualifier //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.1/@expression/@expression/@qualifier //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@body/@statements.0/@statements.3/@expression/@expression/@qualifier //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@body/@statements.0/@statements.4/@expression/@expression/@qualifier">
<bodyDeclarations xsi:type="java:FieldDeclaration" proxy="true">
<fragments name="out" proxy="true" usageInVariableAccess="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@expression/@expression //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@body/@statements.0/@statements.3/@expression/@expression //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@body/@statements.0/@statements.4/@expression/@expression"/>
<fragments name="out" proxy="true" usageInVariableAccess="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@body/@body/@statements.1/@expression/@expression //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.1/@expression/@expression //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@body/@statements.0/@statements.3/@expression/@expression //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@body/@statements.0/@statements.4/@expression/@expression"/>
</bodyDeclarations>
</ownedElements>
<ownedElements xsi:type="java:InterfaceDeclaration" name="AutoCloseable" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.1/@ownedElements.4/@superInterfaces.0"/>
......@@ -405,7 +460,12 @@
<ownedPackages name="io" proxy="true">
<ownedElements xsi:type="java:InterfaceDeclaration" name="Serializable" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@superInterfaces.0 //@ownedElements.1/@ownedPackages.0/@ownedElements.9/@superInterfaces.0"/>
<ownedElements xsi:type="java:ClassDeclaration" name="PrintStream" proxy="true">
<bodyDeclarations xsi:type="java:MethodDeclaration" name="println" proxy="true" usages="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@expression //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@body/@statements.0/@statements.3/@expression //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@body/@statements.0/@statements.4/@expression">
<bodyDeclarations xsi:type="java:MethodDeclaration" name="println" proxy="true" usages="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@body/@body/@statements.1/@expression">
<parameters name="arg0" proxy="true">
<type type="//@orphanTypes.0"/>
</parameters>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" name="println" proxy="true" usages="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.1/@expression //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@body/@statements.0/@statements.3/@expression //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@body/@statements.0/@statements.4/@expression">
<parameters name="arg0" proxy="true">
<type type="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
</parameters>
......@@ -427,7 +487,7 @@
<ownedElements xsi:type="java:InterfaceDeclaration" name="Flushable" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.1/@ownedElements.3/@superInterfaces.1"/>
</ownedPackages>
</ownedElements>
<orphanTypes xsi:type="java:PrimitiveTypeInt" name="int" usagesInTypeAccess="//@ownedElements.0/@ownedElements.1/@bodyDeclarations.2/@parameters.0/@type //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@returnType //@ownedElements.0/@ownedElements.1/@bodyDeclarations.4/@parameters.0/@type //@ownedElements.0/@ownedElements.2/@bodyDeclarations.2/@parameters.0/@type //@ownedElements.0/@ownedElements.3/@bodyDeclarations.0/@type //@ownedElements.0/@ownedElements.3/@bodyDeclarations.1/@type //@ownedElements.0/@ownedElements.3/@bodyDeclarations.2/@type //@ownedElements.0/@ownedElements.3/@bodyDeclarations.3/@type //@ownedElements.0/@ownedElements.3/@bodyDeclarations.4/@type //@ownedElements.0/@ownedElements.3/@bodyDeclarations.6/@parameters.0/@type"/>
<orphanTypes xsi:type="java:PrimitiveTypeInt" name="int" usagesInTypeAccess="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@body/@initializers.0/@type //@ownedElements.0/@ownedElements.1/@bodyDeclarations.2/@parameters.0/@type //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@returnType //@ownedElements.0/@ownedElements.1/@bodyDeclarations.4/@parameters.0/@type //@ownedElements.0/@ownedElements.2/@bodyDeclarations.2/@parameters.0/@type //@ownedElements.0/@ownedElements.3/@bodyDeclarations.0/@type //@ownedElements.0/@ownedElements.3/@bodyDeclarations.1/@type //@ownedElements.0/@ownedElements.3/@bodyDeclarations.2/@type //@ownedElements.0/@ownedElements.3/@bodyDeclarations.3/@type //@ownedElements.0/@ownedElements.3/@bodyDeclarations.4/@type //@ownedElements.0/@ownedElements.3/@bodyDeclarations.6/@parameters.0/@type //@ownedElements.1/@ownedPackages.1/@ownedElements.1/@bodyDeclarations.0/@parameters.0/@type"/>
<orphanTypes xsi:type="java:PrimitiveTypeLong" name="long"/>
<orphanTypes xsi:type="java:PrimitiveTypeFloat" name="float"/>
<orphanTypes xsi:type="java:PrimitiveTypeDouble" name="double"/>
......@@ -439,8 +499,9 @@
<orphanTypes xsi:type="java:ArrayType" name="java.lang.String[]" usagesInTypeAccess="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@parameters.0/@type" dimensions="1">
<elementType type="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
</orphanTypes>
<compilationUnits name="Main.java" originalFilePath="G:\Gitlab\m2-mde-projet\src\main\java\MissingBreakInSwitch\src\main\Main.java" package="//@ownedElements.0" types="//@ownedElements.0/@ownedElements.0"/>
<compilationUnits name="Foo.java" originalFilePath="G:\Gitlab\m2-mde-projet\src\main\java\MissingBreakInSwitch\src\main\Foo.java" commentList="//@ownedElements.0/@ownedElements.1/@bodyDeclarations.2/@comments.0 //@ownedElements.0/@ownedElements.1/@bodyDeclarations.2/@body/@statements.0/@statements.9/@comments.0 //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@comments.0 //@ownedElements.0/@ownedElements.1/@bodyDeclarations.4/@comments.0" package="//@ownedElements.0" types="//@ownedElements.0/@ownedElements.1"/>
<unresolvedItems xsi:type="java:UnresolvedLabeledStatement" name="loop" proxy="true" usagesInContinueStatements="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@body/@body/@statements.0/@statements.5"/>
<compilationUnits name="Main.java" originalFilePath="G:\Gitlab\m2-mde-projet\src\main\java\MissingBreakInSwitch\src\main\Main.java" commentList="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@body/@body/@statements.0/@comments.0 //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@body/@body/@statements.0/@statements.0/@comments.0 //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@body/@body/@statements.0/@statements.1/@comments.0 //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@body/@body/@statements.0/@statements.2/@comments.0 //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@body/@body/@statements.0/@statements.3/@comments.0 //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@body/@body/@statements.0/@statements.4/@comments.0" package="//@ownedElements.0" types="//@ownedElements.0/@ownedElements.0"/>
<compilationUnits name="Foo.java" originalFilePath="G:\Gitlab\m2-mde-projet\src\main\java\MissingBreakInSwitch\src\main\Foo.java" commentList="//@ownedElements.0/@ownedElements.1/@bodyDeclarations.2/@comments.0 //@ownedElements.0/@ownedElements.1/@bodyDeclarations.2/@body/@statements.0/@statements.9/@comments.0 //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@comments.0 //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@body/@statements.0/@statements.2/@comments.0 //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@body/@statements.0/@statements.5/@comments.0 //@ownedElements.0/@ownedElements.1/@bodyDeclarations.4/@comments.0" package="//@ownedElements.0" types="//@ownedElements.0/@ownedElements.1"/>
<compilationUnits name="FooBar.java" originalFilePath="G:\Gitlab\m2-mde-projet\src\main\java\MissingBreakInSwitch\src\main\FooBar.java" commentList="//@ownedElements.0/@ownedElements.2/@bodyDeclarations.2/@comments.0 //@ownedElements.0/@ownedElements.2/@bodyDeclarations.2/@body/@statements.0/@statements.12/@comments.0" package="//@ownedElements.0" types="//@ownedElements.0/@ownedElements.2"/>
<compilationUnits name="Bar.java" originalFilePath="G:\Gitlab\m2-mde-projet\src\main\java\MissingBreakInSwitch\src\main\Bar.java" commentList="//@ownedElements.0/@ownedElements.3/@bodyDeclarations.6/@comments.0 //@ownedElements.0/@ownedElements.3/@bodyDeclarations.6/@body/@statements.0/@statements.2/@comments.0 //@ownedElements.0/@ownedElements.3/@bodyDeclarations.6/@body/@statements.0/@statements.4/@comments.0 //@ownedElements.0/@ownedElements.3/@bodyDeclarations.6/@body/@statements.0/@statements.6/@comments.0 //@ownedElements.0/@ownedElements.3/@bodyDeclarations.6/@body/@statements.0/@statements.6/@comments.1 //@ownedElements.0/@ownedElements.3/@bodyDeclarations.7/@body/@comments.0 //@ownedElements.0/@ownedElements.3/@bodyDeclarations.8/@body/@comments.0 //@ownedElements.0/@ownedElements.3/@bodyDeclarations.9/@body/@comments.0 //@ownedElements.0/@ownedElements.3/@bodyDeclarations.10/@body/@comments.0" package="//@ownedElements.0" types="//@ownedElements.0/@ownedElements.3"/>
</java:Model>
......@@ -175,8 +175,7 @@ rule MeasureMissingBreakInSwitch(ss: java!SwitchStatement) {
measurement: smm!DirectMeasurement (
error <- 'Missing breaks in Switch in Class : ' + ss.originalCompilationUnit.name + '',
-- Indicates the number of breaks missing in the switch statement
-- value <- (thisModule.nbBranchesOfASwitchStatement(ss) - thisModule.nbIntentionalFallThroughOfASwitchStatement(ss)) - thisModule.nbBreakStatementOfASwitchStatement(ss)
value <- thisModule.nbEmptySwitchCasesOfASwitchStatement(ss)
value <- (thisModule.nbBranchesOfASwitchStatement(ss) - thisModule.nbEmptySwitchCasesOfASwitchStatement(ss)) - thisModule.nbBreakStatementOfASwitchStatement(ss)
)
do {
missingBreakInSwitch;
......@@ -2042,7 +2041,8 @@ helper def: nbBreakStatementOfASwitchStatement(ss:java!SwitchStatement) : Intege
ss.statements->select(each |
each.oclIsTypeOf(java!BreakStatement) or
each.oclIsTypeOf(java!ReturnStatement) or
each.oclIsTypeOf(java!ThrowStatement)
each.oclIsTypeOf(java!ThrowStatement) or
each.oclIsTypeOf(java!ContinueStatement)
).size()
;
......
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