Commit e0d1a116 authored by Yannis LE BARS's avatar Yannis LE BARS
Browse files

Merge branch 'master' into 'fix/TooManyFields'

# Conflicts:
#   output/.gitignore
#   src/main/atl/analysis.atl
parents 6e72f81b 2fabdcb3
This diff is collapsed.
<?xml version="1.0" encoding="ASCII"?>
<java:Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:java="http://www.eclipse.org/MoDisco/Java/0.2.incubation/java" name="TooManyMethods">
<ownedElements name="(default package)">
<ownedElements xsi:type="java:ClassDeclaration" originalCompilationUnit="//@compilationUnits.0" name="ClassWithTooManyMethods1">
<modifier visibility="public"/>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.0" name="method1">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.0"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.0" name="method2">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.0"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.0" name="method3">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.0"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.0" name="method4">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.0"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.0" name="method5">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.0"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.0" name="method6">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.0"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.0" name="method7">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.0"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.0" name="method8">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.0"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.0" name="method9">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.0"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.0" name="method10">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.0"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.0" name="method11">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.0"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
</ownedElements>
<ownedElements xsi:type="java:ClassDeclaration" originalCompilationUnit="//@compilationUnits.1" name="ClassWithTooManyMethods2">
<modifier visibility="public"/>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.1" name="method1">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.1"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.1" name="isMethod2">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.1"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.1" name="method3">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.1"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.1" name="method4">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.1"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.1" name="method5">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.1"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.1" name="method6">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.1"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.1" name="getMethod7">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.1"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.1" name="method8">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.1"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.1" name="method9">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.1"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.1" name="method10">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.1"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.1" name="setMethod11">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.1"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.1" name="method12">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.1"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.1" name="method13">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.1"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.1" name="method14">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.1"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.1" name="method15">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.1"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.1" name="method16">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.1"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
</ownedElements>
<ownedElements xsi:type="java:ClassDeclaration" originalCompilationUnit="//@compilationUnits.2" name="ClassWithEnoughMethods">
<modifier visibility="public"/>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.2" name="method1">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.2"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.2" name="method2">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.2"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.2" name="method3">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.2"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.2" name="method4">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.2"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.2" name="method5">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.2"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.2" name="method6">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.2"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.2" name="method7">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.2"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
</ownedElements>
<ownedElements xsi:type="java:ClassDeclaration" originalCompilationUnit="//@compilationUnits.3" name="ClassWithEnoughMethodsBecauseGetSetIs">
<modifier visibility="public"/>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.3" name="method1">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.3"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.3" name="method2">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.3"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.3" name="method3">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.3"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.3" name="method4">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.3"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.3" name="method5">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.3"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.3" name="method6">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.3"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.3" name="method7">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.3"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.3" name="method8">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.3"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.3" name="method9">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.3"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.3" name="method10">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.3"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.3" name="getMethod11">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.3"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.3" name="setMethod12">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.3"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.3" name="isMethod13">
<modifier visibility="public"/>
<body originalCompilationUnit="//@compilationUnits.3"/>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
</ownedElements>
</ownedElements>
<orphanTypes xsi:type="java:PrimitiveTypeInt" name="int"/>
<orphanTypes xsi:type="java:PrimitiveTypeLong" name="long"/>
<orphanTypes xsi:type="java:PrimitiveTypeFloat" name="float"/>
<orphanTypes xsi:type="java:PrimitiveTypeDouble" name="double"/>
<orphanTypes xsi:type="java:PrimitiveTypeBoolean" name="boolean"/>
<orphanTypes xsi:type="java:PrimitiveTypeVoid" name="void" usagesInTypeAccess="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@returnType //@ownedElements.0/@ownedElements.0/@bodyDeclarations.1/@returnType //@ownedElements.0/@ownedElements.0/@bodyDeclarations.2/@returnType //@ownedElements.0/@ownedElements.0/@bodyDeclarations.3/@returnType //@ownedElements.0/@ownedElements.0/@bodyDeclarations.4/@returnType //@ownedElements.0/@ownedElements.0/@bodyDeclarations.5/@returnType //@ownedElements.0/@ownedElements.0/@bodyDeclarations.6/@returnType //@ownedElements.0/@ownedElements.0/@bodyDeclarations.7/@returnType //@ownedElements.0/@ownedElements.0/@bodyDeclarations.8/@returnType //@ownedElements.0/@ownedElements.0/@bodyDeclarations.9/@returnType //@ownedElements.0/@ownedElements.0/@bodyDeclarations.10/@returnType //@ownedElements.0/@ownedElements.1/@bodyDeclarations.0/@returnType //@ownedElements.0/@ownedElements.1/@bodyDeclarations.1/@returnType //@ownedElements.0/@ownedElements.1/@bodyDeclarations.2/@returnType //@ownedElements.0/@ownedElements.1/@bodyDeclarations.3/@returnType //@ownedElements.0/@ownedElements.1/@bodyDeclarations.4/@returnType //@ownedElements.0/@ownedElements.1/@bodyDeclarations.5/@returnType //@ownedElements.0/@ownedElements.1/@bodyDeclarations.6/@returnType //@ownedElements.0/@ownedElements.1/@bodyDeclarations.7/@returnType //@ownedElements.0/@ownedElements.1/@bodyDeclarations.8/@returnType //@ownedElements.0/@ownedElements.1/@bodyDeclarations.9/@returnType //@ownedElements.0/@ownedElements.1/@bodyDeclarations.10/@returnType //@ownedElements.0/@ownedElements.1/@bodyDeclarations.11/@returnType //@ownedElements.0/@ownedElements.1/@bodyDeclarations.12/@returnType //@ownedElements.0/@ownedElements.1/@bodyDeclarations.13/@returnType //@ownedElements.0/@ownedElements.1/@bodyDeclarations.14/@returnType //@ownedElements.0/@ownedElements.1/@bodyDeclarations.15/@returnType //@ownedElements.0/@ownedElements.2/@bodyDeclarations.0/@returnType //@ownedElements.0/@ownedElements.2/@bodyDeclarations.1/@returnType //@ownedElements.0/@ownedElements.2/@bodyDeclarations.2/@returnType //@ownedElements.0/@ownedElements.2/@bodyDeclarations.3/@returnType //@ownedElements.0/@ownedElements.2/@bodyDeclarations.4/@returnType //@ownedElements.0/@ownedElements.2/@bodyDeclarations.5/@returnType //@ownedElements.0/@ownedElements.2/@bodyDeclarations.6/@returnType //@ownedElements.0/@ownedElements.3/@bodyDeclarations.0/@returnType //@ownedElements.0/@ownedElements.3/@bodyDeclarations.1/@returnType //@ownedElements.0/@ownedElements.3/@bodyDeclarations.2/@returnType //@ownedElements.0/@ownedElements.3/@bodyDeclarations.3/@returnType //@ownedElements.0/@ownedElements.3/@bodyDeclarations.4/@returnType //@ownedElements.0/@ownedElements.3/@bodyDeclarations.5/@returnType //@ownedElements.0/@ownedElements.3/@bodyDeclarations.6/@returnType //@ownedElements.0/@ownedElements.3/@bodyDeclarations.7/@returnType //@ownedElements.0/@ownedElements.3/@bodyDeclarations.8/@returnType //@ownedElements.0/@ownedElements.3/@bodyDeclarations.9/@returnType //@ownedElements.0/@ownedElements.3/@bodyDeclarations.10/@returnType //@ownedElements.0/@ownedElements.3/@bodyDeclarations.11/@returnType //@ownedElements.0/@ownedElements.3/@bodyDeclarations.12/@returnType"/>
<orphanTypes xsi:type="java:PrimitiveTypeChar" name="char"/>
<orphanTypes xsi:type="java:PrimitiveTypeShort" name="short"/>
<orphanTypes xsi:type="java:PrimitiveTypeByte" name="byte"/>
<compilationUnits name="ClassWithTooManyMethods1.java" originalFilePath="D:\Programmation\Projets\Eclipse\TooManyMethods\src\ClassWithTooManyMethods1.java" types="//@ownedElements.0/@ownedElements.0"/>
<compilationUnits name="ClassWithTooManyMethods2.java" originalFilePath="D:\Programmation\Projets\Eclipse\TooManyMethods\src\ClassWithTooManyMethods2.java" types="//@ownedElements.0/@ownedElements.1"/>
<compilationUnits name="ClassWithEnoughMethods.java" originalFilePath="D:\Programmation\Projets\Eclipse\TooManyMethods\src\ClassWithEnoughMethods.java" types="//@ownedElements.0/@ownedElements.2"/>
<compilationUnits name="ClassWithEnoughMethodsBecauseGetSetIs.java" originalFilePath="D:\Programmation\Projets\Eclipse\TooManyMethods\src\ClassWithEnoughMethodsBecauseGetSetIs.java" types="//@ownedElements.0/@ownedElements.3"/>
</java:Model>
<?xml version="1.0" encoding="ASCII"?>
<java:Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:java="http://www.eclipse.org/MoDisco/Java/0.2.incubation/java" name="useIndexOfChar">
<ownedElements name="useIndexOfChar">
<ownedElements xsi:type="java:ClassDeclaration" originalCompilationUnit="//@compilationUnits.0" name="Main">
<modifier visibility="public"/>
<bodyDeclarations xsi:type="java:MethodDeclaration" originalCompilationUnit="//@compilationUnits.0" name="main">
<modifier visibility="public" static="true"/>
<body originalCompilationUnit="//@compilationUnits.0">
<statements xsi:type="java:VariableDeclarationStatement" originalCompilationUnit="//@compilationUnits.0">
<type type="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
<fragments originalCompilationUnit="//@compilationUnits.0" name="s" usageInVariableAccess="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.1/@expression/@arguments.0/@expression //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.2/@expression/@arguments.0/@expression">
<initializer xsi:type="java:StringLiteral" originalCompilationUnit="//@compilationUnits.0" escapedValue="&quot;hello world&quot;"/>
</fragments>
<modifier/>
</statements>
<statements xsi:type="java:ExpressionStatement" originalCompilationUnit="//@compilationUnits.0">
<comments xsi:type="java:LineComment" originalCompilationUnit="//@compilationUnits.0" content="// avoid this" prefixOfParent="true"/>
<expression xsi:type="java:MethodInvocation" originalCompilationUnit="//@compilationUnits.0" method="//@ownedElements.1/@ownedPackages.1/@ownedElements.1/@bodyDeclarations.0">
<arguments xsi:type="java:MethodInvocation" originalCompilationUnit="//@compilationUnits.0" method="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@bodyDeclarations.0">
<arguments xsi:type="java:StringLiteral" originalCompilationUnit="//@compilationUnits.0" escapedValue="&quot;d&quot;"/>
<expression xsi:type="java:SingleVariableAccess" variable="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@fragments.0"/>
</arguments>
<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>
<statements xsi:type="java:ExpressionStatement" originalCompilationUnit="//@compilationUnits.0">
<comments xsi:type="java:LineComment" originalCompilationUnit="//@compilationUnits.0" content="// instead do this" prefixOfParent="true"/>
<expression xsi:type="java:MethodInvocation" originalCompilationUnit="//@compilationUnits.0" method="//@ownedElements.1/@ownedPackages.1/@ownedElements.1/@bodyDeclarations.0">
<arguments xsi:type="java:MethodInvocation" originalCompilationUnit="//@compilationUnits.0" method="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@bodyDeclarations.1">
<arguments xsi:type="java:CharacterLiteral" originalCompilationUnit="//@compilationUnits.0" escapedValue="'d'"/>
<expression xsi:type="java:SingleVariableAccess" variable="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@fragments.0"/>
</arguments>
<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>
<parameters originalCompilationUnit="//@compilationUnits.0" name="args">
<modifier/>
<type type="//@orphanTypes.9"/>
</parameters>
<returnType type="//@orphanTypes.5"/>
</bodyDeclarations>
</ownedElements>
</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.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.0/@type //@ownedElements.1/@ownedPackages.0/@ownedElements.0/@bodyDeclarations.0/@parameters.0/@type">
<bodyDeclarations xsi:type="java:MethodDeclaration" name="indexOf" proxy="true" usages="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.1/@expression/@arguments.0">
<parameters name="arg0" proxy="true">
<type type="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
</parameters>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" name="indexOf" proxy="true" usages="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.2/@expression/@arguments.0">
<parameters name="arg0" proxy="true">
<type type="//@orphanTypes.0"/>
</parameters>
</bodyDeclarations>
<superInterfaces type="//@ownedElements.1/@ownedPackages.1/@ownedElements.0"/>
<superInterfaces type="//@ownedElements.1/@ownedPackages.0/@ownedElements.1"/>
<superInterfaces type="//@ownedElements.1/@ownedPackages.0/@ownedElements.2"/>
</ownedElements>
<ownedElements xsi:type="java:InterfaceDeclaration" name="Comparable" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@superInterfaces.1">
<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.1/@expression/@expression/@qualifier //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.2/@expression/@expression/@qualifier">
<bodyDeclarations xsi:type="java:FieldDeclaration" proxy="true">
<fragments name="out" proxy="true" usageInVariableAccess="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.1/@expression/@expression //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.2/@expression/@expression"/>
</bodyDeclarations>
</ownedElements>
<ownedElements xsi:type="java:InterfaceDeclaration" name="AutoCloseable" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.1/@ownedElements.4/@superInterfaces.0"/>
<ownedElements xsi:type="java:InterfaceDeclaration" name="Appendable" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.1/@ownedElements.1/@superInterfaces.0"/>
</ownedPackages>
<ownedPackages name="io" proxy="true">
<ownedElements xsi:type="java:InterfaceDeclaration" name="Serializable" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@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.1/@expression //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.2/@expression">
<parameters name="arg0" proxy="true">
<type type="//@orphanTypes.0"/>
</parameters>
</bodyDeclarations>
<superInterfaces type="//@ownedElements.1/@ownedPackages.0/@ownedElements.5"/>
<superInterfaces type="//@ownedElements.1/@ownedPackages.1/@ownedElements.4"/>
<superClass type="//@ownedElements.1/@ownedPackages.1/@ownedElements.2"/>
</ownedElements>
<ownedElements xsi:type="java:ClassDeclaration" name="FilterOutputStream" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.1/@ownedElements.1/@superClass">
<superClass type="//@ownedElements.1/@ownedPackages.1/@ownedElements.3"/>
</ownedElements>
<ownedElements xsi:type="java:ClassDeclaration" name="OutputStream" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.1/@ownedElements.2/@superClass">
<superInterfaces type="//@ownedElements.1/@ownedPackages.1/@ownedElements.4"/>
<superInterfaces type="//@ownedElements.1/@ownedPackages.1/@ownedElements.5"/>
</ownedElements>
<ownedElements xsi:type="java:InterfaceDeclaration" name="Closeable" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.1/@ownedElements.3/@superInterfaces.0 //@ownedElements.1/@ownedPackages.1/@ownedElements.1/@superInterfaces.1">
<superInterfaces type="//@ownedElements.1/@ownedPackages.0/@ownedElements.4"/>
</ownedElements>
<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.1/@ownedPackages.1/@ownedElements.1/@bodyDeclarations.0/@parameters.0/@type //@ownedElements.1/@ownedPackages.0/@ownedElements.0/@bodyDeclarations.1/@parameters.0/@type"/>
<orphanTypes xsi:type="java:PrimitiveTypeLong" name="long"/>
<orphanTypes xsi:type="java:PrimitiveTypeFloat" name="float"/>
<orphanTypes xsi:type="java:PrimitiveTypeDouble" name="double"/>
<orphanTypes xsi:type="java:PrimitiveTypeBoolean" name="boolean"/>
<orphanTypes xsi:type="java:PrimitiveTypeVoid" name="void" usagesInTypeAccess="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@returnType"/>
<orphanTypes xsi:type="java:PrimitiveTypeChar" name="char"/>
<orphanTypes xsi:type="java:PrimitiveTypeShort" name="short"/>
<orphanTypes xsi:type="java:PrimitiveTypeByte" name="byte"/>
<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="/home/raphael/eclipse/workspaceGersonPhoton/useIndexOfChar/src/useIndexOfChar/Main.java" commentList="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.1/@comments.0 //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@body/@statements.2/@comments.0" package="//@ownedElements.0" types="//@ownedElements.0/@ownedElements.0"/>
</java:Model>
/metrics.xmi
/metrics.smm
*.xmi
......@@ -17,12 +17,16 @@ rule Java2SMM {
name <- 'Java metrics',
measureElements <- thisModule.allMeasures(project)
)
}
helper def: allMeasures(project : java!Model): Set(smm!Measure) =
Set{
thisModule.numberOfClasses(),
thisModule.tooManyFields()
thisModule.tooManyFields() -- to test, use input/example_toomanyfields.xmi
thisModule.tooFewBranchesForASwitchStatement(),
thisModule.useIndexOfChar(), --to test, use input/useIndexOfChar_java.xmi
thisModule.tooManyMethods() --to test, use input/tooManyMethods.xmi
--
-- Placeholder for other Measures
--
......@@ -65,6 +69,49 @@ rule MesureTooManyFields(class : java!ClassDeclaration) {
}
}
--Goes through all the methods to check if the following rule is followed:
--Use String.indexOf(char) when checking for the index of a single character; it executes faster.
helper def: useIndexOfChar() : Set(smm!Measure) =
java!MethodInvocation.allInstances() -> iterate(i; res : Set(smm!Measure) = Set{} |
-- Add a new measurement if the argument of String.indexOf() is not of type char when checking for the index of a single character
if thisModule.isWrongUsageIndexOfChar(i) then
res->union(Set{thisModule.MeasureUseIndexOfChar(i)})
else
res
endif
);
--Detect a wrong usage of the method String.indexOf(char)
--return true if the argument of String.indexOf(char) is not of type char when checking for the index of a single character
helper def:isWrongUsageIndexOfChar(s:java!MethodInvocation): Boolean =
if s.method.name = 'indexOf' then
if s.arguments.size() = 1 and s.arguments.first().oclType().toString() <> 'java!CharacterLiteral' then
true
else
false
endif
else
false
endif;
-- creates a new Measure when the parameter of String.indexOf(char) is not of type char when checking for the index of a single character
rule MeasureUseIndexOfChar(method : java!MethodInvocation) {
to
om: smm!ObservedMeasure (
measure <- noc,
measurements <- measurement
),
noc: smm!DimensionalMeasure (
name <- 'Use index of char',
shortDescription <- 'Use String.indexOf(char) when checking for the index of a single character; it executes faster.'
),
measurement: smm!DirectMeasurement (
error<- 'The class '+ method.originalCompilationUnit.name + ' violates the rule index of char.'
)
do {
noc;
}
}
rule numberOfClasses() {
to
......@@ -82,4 +129,86 @@ rule numberOfClasses() {
do {
noc;
}
}
\ No newline at end of file
}
-- Returns a set of measures for each switch statement that violates the rule : number of switch cases < 3
-- To test, use input model : tooFewBranchesForASwitchStatement.xmi
helper def: tooFewBranchesForASwitchStatement(): Set(smm!Measure) =
-- Iterate through all SwitchStatement
java!SwitchStatement.allInstances()->iterate(current; measures: Set(smm!Measure) = Set{} |
-- If the number of switch cases for the current switch statement is < 3 then add a new measure to the set
if (thisModule.nbBranchesOfASwitchStatement(current) < 3)
then measures->union(Set{thisModule.createMeasureForTooFewBranchesForASwitchStatement(current)})
else measures
endif
);
-- Rule that creates an instance of Measure for the switch statement with too few branches passed in parameter
rule createMeasureForTooFewBranchesForASwitchStatement(switchStatement: java!SwitchStatement) {
to
om: smm!ObservedMeasure (
measure <- tooFewBranchesForASwitchStatement,
measurements <- measurement
),
tooFewBranchesForASwitchStatement: smm!DimensionalMeasure (
name <- 'Violated rule : Too few branches for a switch statement',
shortDescription <- 'minimumNumberCaseForASwitch : 3'
),
measurement: smm!DirectMeasurement (
error <- 'Too few branches for SwitchStatement in Class : ' + switchStatement.originalCompilationUnit.name + '',
value <- thisModule.nbBranchesOfASwitchStatement(switchStatement)
)
do {
tooFewBranchesForASwitchStatement;
}
}
-- Returns the number of branches in the switch statement passed in parameter
helper def: nbBranchesOfASwitchStatement(switchStatement:java!SwitchStatement) : Integer =
switchStatement.statements->iterate(current; nbSwitchCases: Integer = 0 |
if (current.oclIsTypeOf(java!SwitchCase))
then nbSwitchCases+1
else nbSwitchCases
endif
);
--------------------------------------------- TooManyMethods ---------------------------------------------
-- Rule for metrics TooManyMethods : return the set of class Measures that violates the rule.
-- To test, tooManyMethods.xmi, 1 class has enough methods, 2 classes have too many methods and 1 class has too many methods with its getters and setters but enough without them.
helper def: tooManyMethods() : Set(smm!Measure) =
-- Browse through all class
java!ClassDeclaration.allInstances() -> reject(each | each.isProxy())->iterate(i; res : Set(smm!Measure) = Set{} |
-- Add a new measurement if there are more than 10 methods in the class.
if thisModule.numberMethodsInClasse(i) > 10
then res->union(Set{thisModule.MesureTooManyMethods(i)})
else res
endif
);
helper def: numberMethodsInClasse(s:java!ClassDeclaration) : Integer =
-- Return the number of MethodsDeclaration in a class.
s.bodyDeclarations->select(r | r.oclIsTypeOf(java!MethodDeclaration))->reject(without | without.name.startsWith('get') or without.name.startsWith('set') or without.name.startsWith('is'))->size();
-- A Measure instance if the class violates the rule 'TooManyMethods'.
rule MesureTooManyMethods(class : java!ClassDeclaration) {
to
om: smm!ObservedMeasure (
measure <- noc,
measurements <- measurement
),
noc: smm!DimensionalMeasure (
name <- 'TooManyMethods',
shortDescription <- 'A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.'
),
measurement: smm!DirectMeasurement (
error <- class.originalCompilationUnit.name + ' have too many methods'
)
do {
noc;
}
}
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