Commit b514a18a authored by Gerson SUNYE's avatar Gerson SUNYE
Browse files

Merge branch 'revert-88e65b83' into 'master'

Revert "Merge branch 'master' into 'master'"

See merge request !175
parents 88e65b83 659ae2b9
<?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="biginteger-instantiation">
<ownedElements name="(default package)">
<ownedElements xsi:type="java:ClassDeclaration" originalCompilationUnit="//@compilationUnits.0" name="BigIntegerInstantiationNotPass">
<modifier visibility="public"/>
<bodyDeclarations xsi:type="java:FieldDeclaration" originalCompilationUnit="//@compilationUnits.0">
<modifier visibility="private"/>
<type type="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
<fragments originalCompilationUnit="//@compilationUnits.0" name="val">
<initializer xsi:type="java:ClassInstanceCreation" originalCompilationUnit="//@compilationUnits.0" method="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@bodyDeclarations.0">
<arguments xsi:type="java:StringLiteral" originalCompilationUnit="//@compilationUnits.0" escapedValue="&quot;1&quot;"/>
<type type="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
</initializer>
</fragments>
</bodyDeclarations>
</ownedElements>
<ownedElements xsi:type="java:ClassDeclaration" originalCompilationUnit="//@compilationUnits.1" name="BigIntegerInstantiationPass">
<modifier visibility="public"/>
<bodyDeclarations xsi:type="java:FieldDeclaration" originalCompilationUnit="//@compilationUnits.1">
<modifier visibility="private"/>
<type type="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
<fragments originalCompilationUnit="//@compilationUnits.1" name="val">
<initializer xsi:type="java:MethodInvocation" originalCompilationUnit="//@compilationUnits.1" method="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@bodyDeclarations.1">
<arguments xsi:type="java:NumberLiteral" originalCompilationUnit="//@compilationUnits.1" tokenValue="1"/>
<expression xsi:type="java:TypeAccess" type="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
</initializer>
</fragments>
</bodyDeclarations>
</ownedElements>
</ownedElements>
<ownedElements name="java" proxy="true">
<ownedPackages name="math" proxy="true">
<ownedElements xsi:type="java:ClassDeclaration" name="BigInteger" proxy="true" usagesInImports="//@compilationUnits.0/@imports.0 //@compilationUnits.1/@imports.0" usagesInTypeAccess="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@type //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@fragments.0/@initializer/@type //@ownedElements.0/@ownedElements.1/@bodyDeclarations.0/@type //@ownedElements.0/@ownedElements.1/@bodyDeclarations.0/@fragments.0/@initializer/@expression">
<bodyDeclarations xsi:type="java:ConstructorDeclaration" name="BigInteger" proxy="true" usages="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@fragments.0/@initializer">
<parameters name="arg0" proxy="true">
<type type="//@ownedElements.1/@ownedPackages.1/@ownedElements.2"/>
</parameters>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" name="valueOf" proxy="true" usages="//@ownedElements.0/@ownedElements.1/@bodyDeclarations.0/@fragments.0/@initializer">
<parameters name="arg0" proxy="true">
<type type="//@orphanTypes.1"/>
</parameters>
</bodyDeclarations>
<superInterfaces type="//@ownedElements.1/@ownedPackages.1/@ownedElements.1"/>
<superClass type="//@ownedElements.1/@ownedPackages.1/@ownedElements.0"/>
</ownedElements>
</ownedPackages>
<ownedPackages name="lang" proxy="true">
<ownedElements xsi:type="java:ClassDeclaration" name="Number" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@superClass">
<superInterfaces type="//@ownedElements.1/@ownedPackages.2/@ownedElements.0"/>
</ownedElements>
<ownedElements xsi:type="java:InterfaceDeclaration" name="Comparable" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@superInterfaces.0 //@ownedElements.1/@ownedPackages.1/@ownedElements.2/@superInterfaces.1">
<typeParameters name="T" proxy="true"/>
</ownedElements>
<ownedElements xsi:type="java:ClassDeclaration" name="String" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@bodyDeclarations.0/@parameters.0/@type">
<superInterfaces type="//@ownedElements.1/@ownedPackages.2/@ownedElements.0"/>
<superInterfaces type="//@ownedElements.1/@ownedPackages.1/@ownedElements.1"/>
<superInterfaces type="//@ownedElements.1/@ownedPackages.1/@ownedElements.3"/>
</ownedElements>
<ownedElements xsi:type="java:InterfaceDeclaration" name="CharSequence" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.1/@ownedElements.2/@superInterfaces.2"/>
</ownedPackages>
<ownedPackages name="io" proxy="true">
<ownedElements xsi:type="java:InterfaceDeclaration" name="Serializable" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.1/@ownedElements.0/@superInterfaces.0 //@ownedElements.1/@ownedPackages.1/@ownedElements.2/@superInterfaces.0"/>
</ownedPackages>
</ownedElements>
<orphanTypes xsi:type="java:PrimitiveTypeInt" name="int"/>
<orphanTypes xsi:type="java:PrimitiveTypeLong" name="long" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@bodyDeclarations.1/@parameters.0/@type"/>
<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"/>
<orphanTypes xsi:type="java:PrimitiveTypeChar" name="char"/>
<orphanTypes xsi:type="java:PrimitiveTypeShort" name="short"/>
<orphanTypes xsi:type="java:PrimitiveTypeByte" name="byte"/>
<compilationUnits name="BigIntegerInstantiationNotPass.java" originalFilePath="/home/alexis/eclipse-workspace/biginteger-instantiation/src/BigIntegerInstantiationNotPass.java" types="//@ownedElements.0/@ownedElements.0">
<imports originalCompilationUnit="//@compilationUnits.0" importedElement="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
</compilationUnits>
<compilationUnits name="BigIntegerInstantiationPass.java" originalFilePath="/home/alexis/eclipse-workspace/biginteger-instantiation/src/BigIntegerInstantiationPass.java" types="//@ownedElements.0/@ownedElements.1">
<imports originalCompilationUnit="//@compilationUnits.1" importedElement="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
</compilationUnits>
</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="boolean-instantiation">
<ownedElements name="(default package)">
<ownedElements xsi:type="java:ClassDeclaration" originalCompilationUnit="//@compilationUnits.0" name="BooleanInstantiationNotPass">
<modifier visibility="public"/>
<bodyDeclarations xsi:type="java:FieldDeclaration" originalCompilationUnit="//@compilationUnits.0">
<modifier visibility="private"/>
<type type="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
<fragments originalCompilationUnit="//@compilationUnits.0" name="bool">
<initializer xsi:type="java:ClassInstanceCreation" originalCompilationUnit="//@compilationUnits.0" method="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@bodyDeclarations.0">
<arguments xsi:type="java:BooleanLiteral" originalCompilationUnit="//@compilationUnits.0" value="true"/>
<type type="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
</initializer>
</fragments>
</bodyDeclarations>
</ownedElements>
<ownedElements xsi:type="java:ClassDeclaration" originalCompilationUnit="//@compilationUnits.1" name="BooleanInstantiationPass">
<modifier visibility="public"/>
<bodyDeclarations xsi:type="java:FieldDeclaration" originalCompilationUnit="//@compilationUnits.1">
<modifier visibility="private"/>
<type type="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
<fragments originalCompilationUnit="//@compilationUnits.1" name="bool">
<initializer xsi:type="java:MethodInvocation" originalCompilationUnit="//@compilationUnits.1" method="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@bodyDeclarations.1">
<arguments xsi:type="java:BooleanLiteral" originalCompilationUnit="//@compilationUnits.1" value="true"/>
<expression xsi:type="java:TypeAccess" type="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
</initializer>
</fragments>
</bodyDeclarations>
</ownedElements>
</ownedElements>
<ownedElements name="java" proxy="true">
<ownedPackages name="lang" proxy="true">
<ownedElements xsi:type="java:ClassDeclaration" name="Boolean" proxy="true" usagesInTypeAccess="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@type //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@fragments.0/@initializer/@type //@ownedElements.0/@ownedElements.1/@bodyDeclarations.0/@type //@ownedElements.0/@ownedElements.1/@bodyDeclarations.0/@fragments.0/@initializer/@expression">
<bodyDeclarations xsi:type="java:ConstructorDeclaration" name="Boolean" proxy="true" usages="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@fragments.0/@initializer">
<parameters name="arg0" proxy="true">
<type type="//@orphanTypes.4"/>
</parameters>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" name="valueOf" proxy="true" usages="//@ownedElements.0/@ownedElements.1/@bodyDeclarations.0/@fragments.0/@initializer">
<parameters name="arg0" proxy="true">
<type type="//@orphanTypes.4"/>
</parameters>
</bodyDeclarations>
<superInterfaces type="//@ownedElements.1/@ownedPackages.1/@ownedElements.0"/>
<superInterfaces type="//@ownedElements.1/@ownedPackages.0/@ownedElements.1"/>
</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>
</ownedPackages>
<ownedPackages name="io" proxy="true">
<ownedElements xsi:type="java:InterfaceDeclaration" name="Serializable" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@superInterfaces.0"/>
</ownedPackages>
</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" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@bodyDeclarations.0/@parameters.0/@type //@ownedElements.1/@ownedPackages.0/@ownedElements.0/@bodyDeclarations.1/@parameters.0/@type"/>
<orphanTypes xsi:type="java:PrimitiveTypeVoid" name="void"/>
<orphanTypes xsi:type="java:PrimitiveTypeChar" name="char"/>
<orphanTypes xsi:type="java:PrimitiveTypeShort" name="short"/>
<orphanTypes xsi:type="java:PrimitiveTypeByte" name="byte"/>
<compilationUnits name="BooleanInstantiationNotPass.java" originalFilePath="/home/alexis/eclipse-workspace/boolean-instantiation/src/BooleanInstantiationNotPass.java" types="//@ownedElements.0/@ownedElements.0"/>
<compilationUnits name="BooleanInstantiationPass.java" originalFilePath="/home/alexis/eclipse-workspace/boolean-instantiation/src/BooleanInstantiationPass.java" types="//@ownedElements.0/@ownedElements.1"/>
</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="byte-instantiation">
<ownedElements name="(default package)">
<ownedElements xsi:type="java:ClassDeclaration" originalCompilationUnit="//@compilationUnits.0" name="ByteInstantiationNotPass">
<modifier visibility="public"/>
<bodyDeclarations xsi:type="java:FieldDeclaration" originalCompilationUnit="//@compilationUnits.0">
<modifier visibility="private"/>
<type type="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
<fragments originalCompilationUnit="//@compilationUnits.0" name="val">
<initializer xsi:type="java:ClassInstanceCreation" originalCompilationUnit="//@compilationUnits.0" method="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@bodyDeclarations.0">
<arguments xsi:type="java:CastExpression" originalCompilationUnit="//@compilationUnits.0">
<expression xsi:type="java:NumberLiteral" originalCompilationUnit="//@compilationUnits.0" tokenValue="0"/>
<type type="//@orphanTypes.8"/>
</arguments>
<type type="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
</initializer>
</fragments>
</bodyDeclarations>
</ownedElements>
<ownedElements xsi:type="java:ClassDeclaration" originalCompilationUnit="//@compilationUnits.1" name="ByteInstantiationPass">
<modifier visibility="public"/>
<bodyDeclarations xsi:type="java:FieldDeclaration" originalCompilationUnit="//@compilationUnits.1">
<modifier visibility="private"/>
<type type="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
<fragments originalCompilationUnit="//@compilationUnits.1" name="val">
<initializer xsi:type="java:MethodInvocation" originalCompilationUnit="//@compilationUnits.1" method="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@bodyDeclarations.1">
<arguments xsi:type="java:CastExpression" originalCompilationUnit="//@compilationUnits.1">
<expression xsi:type="java:NumberLiteral" originalCompilationUnit="//@compilationUnits.1" tokenValue="0"/>
<type type="//@orphanTypes.8"/>
</arguments>
<expression xsi:type="java:TypeAccess" type="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
</initializer>
</fragments>
</bodyDeclarations>
</ownedElements>
</ownedElements>
<ownedElements name="java" proxy="true">
<ownedPackages name="lang" proxy="true">
<ownedElements xsi:type="java:ClassDeclaration" name="Byte" proxy="true" usagesInTypeAccess="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@type //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@fragments.0/@initializer/@type //@ownedElements.0/@ownedElements.1/@bodyDeclarations.0/@type //@ownedElements.0/@ownedElements.1/@bodyDeclarations.0/@fragments.0/@initializer/@expression">
<bodyDeclarations xsi:type="java:ConstructorDeclaration" name="Byte" proxy="true" usages="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@fragments.0/@initializer">
<parameters name="arg0" proxy="true">
<type type="//@orphanTypes.8"/>
</parameters>
</bodyDeclarations>
<bodyDeclarations xsi:type="java:MethodDeclaration" name="valueOf" proxy="true" usages="//@ownedElements.0/@ownedElements.1/@bodyDeclarations.0/@fragments.0/@initializer">
<parameters name="arg0" proxy="true">
<type type="//@orphanTypes.8"/>
</parameters>
</bodyDeclarations>
<superInterfaces type="//@ownedElements.1/@ownedPackages.0/@ownedElements.2"/>
<superClass type="//@ownedElements.1/@ownedPackages.0/@ownedElements.1"/>
</ownedElements>
<ownedElements xsi:type="java:ClassDeclaration" name="Number" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@superClass //@ownedElements.1/@ownedPackages.2/@ownedElements.0/@superClass">
<superInterfaces type="//@ownedElements.1/@ownedPackages.1/@ownedElements.0"/>
</ownedElements>
<ownedElements xsi:type="java:InterfaceDeclaration" name="Comparable" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@superInterfaces.0 //@ownedElements.1/@ownedPackages.2/@ownedElements.0/@superInterfaces.0">
<typeParameters name="T" proxy="true"/>
</ownedElements>
</ownedPackages>
<ownedPackages name="io" proxy="true">
<ownedElements xsi:type="java:InterfaceDeclaration" name="Serializable" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.0/@ownedElements.1/@superInterfaces.0"/>
</ownedPackages>
<ownedPackages name="math" proxy="true">
<ownedElements xsi:type="java:ClassDeclaration" name="BigInteger" proxy="true" usagesInImports="//@compilationUnits.1/@imports.0">
<superInterfaces type="//@ownedElements.1/@ownedPackages.0/@ownedElements.2"/>
<superClass type="//@ownedElements.1/@ownedPackages.0/@ownedElements.1"/>
</ownedElements>
</ownedPackages>
</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"/>
<orphanTypes xsi:type="java:PrimitiveTypeChar" name="char"/>
<orphanTypes xsi:type="java:PrimitiveTypeShort" name="short"/>
<orphanTypes xsi:type="java:PrimitiveTypeByte" name="byte" usagesInTypeAccess="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@fragments.0/@initializer/@arguments.0/@type //@ownedElements.0/@ownedElements.1/@bodyDeclarations.0/@fragments.0/@initializer/@arguments.0/@type //@ownedElements.1/@ownedPackages.0/@ownedElements.0/@bodyDeclarations.0/@parameters.0/@type //@ownedElements.1/@ownedPackages.0/@ownedElements.0/@bodyDeclarations.1/@parameters.0/@type"/>
<compilationUnits name="ByteInstantiationNotPass.java" originalFilePath="/home/alexis/eclipse-workspace/byte-instantiation/src/ByteInstantiationNotPass.java" types="//@ownedElements.0/@ownedElements.0"/>
<compilationUnits name="ByteInstantiationPass.java" originalFilePath="/home/alexis/eclipse-workspace/byte-instantiation/src/ByteInstantiationPass.java" types="//@ownedElements.0/@ownedElements.1">
<imports originalCompilationUnit="//@compilationUnits.1" importedElement="//@ownedElements.1/@ownedPackages.2/@ownedElements.0"/>
</compilationUnits>
</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="string-instantiation">
<ownedElements name="(default package)">
<ownedElements xsi:type="java:ClassDeclaration" originalCompilationUnit="//@compilationUnits.0" name="StringInstantiationNotPass">
<modifier visibility="public"/>
<bodyDeclarations xsi:type="java:FieldDeclaration" originalCompilationUnit="//@compilationUnits.0">
<modifier visibility="private"/>
<type type="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
<fragments originalCompilationUnit="//@compilationUnits.0" name="val">
<initializer xsi:type="java:ClassInstanceCreation" originalCompilationUnit="//@compilationUnits.0" method="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@bodyDeclarations.0">
<arguments xsi:type="java:StringLiteral" originalCompilationUnit="//@compilationUnits.0" escapedValue="&quot;Bonjour&quot;"/>
<type type="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
</initializer>
</fragments>
</bodyDeclarations>
</ownedElements>
<ownedElements xsi:type="java:ClassDeclaration" originalCompilationUnit="//@compilationUnits.1" name="StringInstantiationPass">
<modifier visibility="public"/>
<bodyDeclarations xsi:type="java:FieldDeclaration" originalCompilationUnit="//@compilationUnits.1">
<modifier visibility="private"/>
<type type="//@ownedElements.1/@ownedPackages.0/@ownedElements.0"/>
<fragments originalCompilationUnit="//@compilationUnits.1" name="val">
<initializer xsi:type="java:StringLiteral" originalCompilationUnit="//@compilationUnits.1" escapedValue="&quot;Bonjour&quot;"/>
</fragments>
</bodyDeclarations>
</ownedElements>
</ownedElements>
<ownedElements name="java" proxy="true">
<ownedPackages name="lang" proxy="true">
<ownedElements xsi:type="java:ClassDeclaration" name="String" proxy="true" usagesInTypeAccess="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@type //@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@fragments.0/@initializer/@type //@ownedElements.1/@ownedPackages.0/@ownedElements.0/@bodyDeclarations.0/@parameters.0/@type //@ownedElements.0/@ownedElements.1/@bodyDeclarations.0/@type">
<bodyDeclarations xsi:type="java:ConstructorDeclaration" name="String" proxy="true" usages="//@ownedElements.0/@ownedElements.0/@bodyDeclarations.0/@fragments.0/@initializer">
<parameters name="arg0" proxy="true">
<type type="//@ownedElements.1/@ownedPackages.0/@ownedElements.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"/>
</ownedPackages>
<ownedPackages name="io" proxy="true">
<ownedElements xsi:type="java:InterfaceDeclaration" name="Serializable" proxy="true" usagesInTypeAccess="//@ownedElements.1/@ownedPackages.0/@ownedElements.0/@superInterfaces.0"/>
</ownedPackages>
</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"/>
<orphanTypes xsi:type="java:PrimitiveTypeChar" name="char"/>
<orphanTypes xsi:type="java:PrimitiveTypeShort" name="short"/>
<orphanTypes xsi:type="java:PrimitiveTypeByte" name="byte"/>
<compilationUnits name="StringInstantiationNotPass.java" originalFilePath="/home/alexis/eclipse-workspace/string-instantiation/src/StringInstantiationNotPass.java" types="//@ownedElements.0/@ownedElements.0"/>
<compilationUnits name="StringInstantiationPass.java" originalFilePath="/home/alexis/eclipse-workspace/string-instantiation/src/StringInstantiationPass.java" types="//@ownedElements.0/@ownedElements.1"/>
</java:Model>
......@@ -86,9 +86,6 @@ helper def: allMeasures(project : java!Model): Set(smm!Measure) =
thisModule.avoidPrintStackTrace(),
thisModule.avoidRethrowingException(),
thisModule.avoidUsingShortType(),
thisModule.bigIntegerInstantiation(),
thisModule.booleanInstantiation(),
thisModule.byteInstantiation(),
thisModule.emptyStatementBlock(),
thisModule.inefficientEmptyStringCheck(),
thisModule.inefficientEmptyStringCheck2(),
......@@ -97,7 +94,6 @@ helper def: allMeasures(project : java!Model): Set(smm!Measure) =
thisModule.integerInstantiation(),
-- #FIXME:
-- thisModule.startsWith(),
thisModule.stringInstantiation(),
thisModule.stringToString(),
thisModule.tooFewBranchesForASwitchStatement(),
thisModule.useArraysAsList(),
......@@ -516,69 +512,6 @@ rule MeasureAvoidUsingShortType(typeShort : java!VariableDeclarationStatement) {
}
}
-- ------------------------------------------- BigIntegerInstantiation ---------------------------------------------
--- creates a Measure when a BigInteger is instantiated with a "new BigInteger()" statement.
rule MeasureBigIntegerInstantiation(variable : java!CompilationUnit) {
to
om: smm!ObservedMeasure (
measure <- noc,
measurements <- measurement
),
noc: smm!DimensionalMeasure (
name <- 'BigIntegerInstantiation',
shortDescription <- 'Don’t create instances of already existing BigInteger (BigInteger.ZERO, BigInteger.ONE) and for Java 1.5 onwards, BigInteger.TEN and BigDecimal (BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.TEN)'
),
measurement: smm!DirectMeasurement (
error<-'In the Class '+ variable.name + ' an instantiation of BigInteger must be BigInteger.valueOf().'
)
do {
noc;
}
}
-- ------------------------------------------- BooleanInstantiation ---------------------------------------------
--- creates a Measure when a Boolean is instantiated with a "new Boolean()" statement.
rule MeasureBooleanInstantiation(variable : java!CompilationUnit) {
to
om: smm!ObservedMeasure (
measure <- noc,
measurements <- measurement
),
noc: smm!DimensionalMeasure (
name <- 'BooleanInstantiation',
shortDescription <- 'Avoid instantiating Boolean objects; you can reference Boolean.TRUE, Boolean.FALSE, or call Boolean.valueOf() instead. Note that new Boolean() is deprecated since JDK 9 for that reason.'
),
measurement: smm!DirectMeasurement (
error<-'In the Class '+ variable.name + ' an instantiation of Boolean must be Boolean.TRUE, Boolean.FALSE or Boolean.valueOf().'
)
do {
noc;
}
}
-- ------------------------------------------- ByteInstantiation ---------------------------------------------
--- creates a Measure when a Byte is instantiated with a "new Byte()" statement.
rule MeasureByteInstantiation(variable : java!CompilationUnit) {
to
om: smm!ObservedMeasure (
measure <- noc,
measurements <- measurement
),
noc: smm!DimensionalMeasure (
name <- 'ByteInstantiation',
shortDescription <- 'Calling new Byte() causes memory allocation that can be avoided by the static Byte.valueOf(). It makes use of an internal cache that recycles earlier instances making it more memory efficient. Note that new Byte() is deprecated since JDK 9 for that reason.'
),
measurement: smm!DirectMeasurement (
error<-'In the Class '+ variable.name + ' an instantiation of Byte must be Byte.valueOf().'
)
do {
noc;
}
}
--- A Measure instance if the class violates the rule CloneMethodMustBePublic.
rule MeasureCloneMethodMustBePublic(w: java!MethodDeclaration) {
to
......@@ -1533,27 +1466,6 @@ rule MeasureStartWith(w: java!MethodInvocation) {
}
}
-- ------------------------------------------- StringInstantiation ---------------------------------------------
--- creates a Measure when a String is instantiated with a "new String()" statement.
rule MeasureStringInstantiation(variable : java!CompilationUnit) {
to
om: smm!ObservedMeasure (
measure <- noc,
measurements <- measurement
),
noc: smm!DimensionalMeasure (
name <- 'StringInstantiation',
shortDescription <- 'Avoid instantiating String objects; this is usually unnecessary since they are immutable and can be safely shared.'
),
measurement: smm!DirectMeasurement (
error<-'In the Class '+ variable.name + ' an instantiation of String must be String str =.'
)
do {
noc;
}
}
--- A Measure instance if the method violates the rule 'StringToString'.
rule MeasureStringToString(method : java!MethodInvocation) {
to
......
......@@ -62,120 +62,8 @@ helper def: avoidThrowingNewInstanceOfSameException() : Set(smm!Measure) =
helper def: avoidUsingShortType() : Set(smm!Measure) =
java!VariableDeclarationStatement.allInstances()
->select(variable | variable.type.type.name = 'short')
->collect(variable | thisModule.MeasureAvoidUsingShortType(variable));
--- ShortInstantiation
--- Rule for metrics ShortInstantiation : return the set of class Measures that instantiate Short objects with "new Short()" statement.
helper def: shortInstantiation() : Set(smm!Measure) =
-- Take all ClassInstanceCreation with allInstances()
java!ClassInstanceCreation.allInstances()
-- Select all class who declare a Short type
->select(it| it.method.oclIsTypeOf(java!ConstructorDeclaration) and it.method.name = 'Short')
-- collect every results and send an error message
->collect(it2|thisModule.MeasureShortInstantiation(it2.originalCompilationUnit))
;
--- LongInstantiation
--- Rule for metricsLongInstantiation : return the set of class Measures that instantiate Long objects with "new Long()" statement.
helper def: longInstantiation() : Set(smm!Measure) =
-- Take all ClassInstanceCreation with allInstances()
java!ClassInstanceCreation.allInstances()
-- Select all class who declare a Long type
->select(it| it.method.oclIsTypeOf(java!ConstructorDeclaration) and it.method.name = 'Long')
-- collect every results and send an error message
->collect(it2|thisModule.MeasureLongInstantiation(it2.originalCompilationUnit))
;
--- AvoidRethrowingException
--- Rule for metrics AvoidRethrowingException :
helper def: avoidRethrowingException() : Set (smm!Measure) =
-- Browse through all try statements
java!TryStatement.allInstances() ->iterate(tryStatement; res : Set(smm!Measure) = Set{} |
tryStatement.catchClauses
->select(catchClause | catchClause.body <> OclUndefined and catchClause.body.statements.size() = 1)
->collect(catchClause | catchClause.body.statements)
->iterate(catchStatement; res1 : Set(smm!Measure) = Set{} |
catchStatement
->select(catchState | catchState.oclIsTypeOf(java!ThrowStatement))
->collect(catchState | thisModule.MeasureAvoidRethrowingException(catchState))
)
);
--- doNotInitBooleanWithNew
--- Rule for doNotInitBooleanWithNew : returns the set of class Measures that instantiate Integer objects with "new Integer()" statement.
helper def: doNotInitIntegerWithNew() : Set(smm!Measure) =
-- Take all ClassInstanceCreation with allInstances()
java!ClassInstanceCreation.allInstances()
-- Select all classes that declare an Integer type
->select(it|it.method.oclIsTypeOf(java!ConstructorDeclaration) and it.method.name = 'Integer')
-- collect every result and sends an error message
->collect(it2|thisModule.MeasureIntegerInstantiation(it2.originalCompilationUnit))
;
--- doNotInitBooleanWithNew
--- Rule for metrics doNotInitBooleanWithNew : returns the set of class Measures that instantiate Boolean objects with "new Boolean()" statement.
helper def: doNotInitBooleanWithNew() : Set(smm!Measure) =
-- Take all ClassInstanceCreation with allInstances()
java!ClassInstanceCreation.allInstances()
-- Select all classes that declare a Boolean type
->select(it|it.method.oclIsTypeOf(java!ConstructorDeclaration) and it.method.name = 'Boolean')
-- collect every result and sends an error message
->collect(it2|thisModule.MeasureBooleanInstantiation(it2.originalCompilationUnit))
;
--- doNotInitBigIntegerWithNew
--- Rule for metrics doNotInitBigIntegerWithNew : returns the set of class Measures that instantiate BigInteger objects with "new BigInteger()" statement.
helper def: doNotInitBigIntegerWithNew() : Set(smm!Measure) =
-- Take all ClassInstanceCreation with allInstances()
java!ClassInstanceCreation.allInstances()
-- Select all classes that declare a BigInteger type
->select(it|it.method.oclIsTypeOf(java!ConstructorDeclaration) and it.method.name = 'BigInteger')
-- collect every result and sends an error message
->collect(it2|thisModule.MeasureBigIntegerInstantiation(it2.originalCompilationUnit))
;
--- doNotInitByteWithNew
--- Rule for metrics doNotInitByteWithNew : returns the set of class Measures that instantiate Byte objects with "new Byte()" statement.
helper def: doNotInitByteWithNew() : Set(smm!Measure) =
-- Take all ClassInstanceCreation with allInstances()
java!ClassInstanceCreation.allInstances()
-- Select all classes that declare a Byte type
->select(it|it.method.oclIsTypeOf(java!ConstructorDeclaration) and it.method.name = 'Byte')
-- collect every result and sends an error message
->collect(it2|thisModule.MeasureByteInstantiation(it2.originalCompilationUnit))
;
--- doNotInitStringWithNew
--- Rule for metrics doNotInitStringWithNew : returns the set of class Measures that instantiate String objects with "new String()" statement.
helper def: doNotInitStringWithNew() : Set(smm!Measure) =
-- Take all ClassInstanceCreation with allInstances()
java!ClassInstanceCreation.allInstances()
-- Select all classes that declare a String type
->select(it|it.method.oclIsTypeOf(java!ConstructorDeclaration) and it.method.name = 'String')
-- collect every result and sends an error message
->collect(it2|thisModule.MeasureStringInstantiation(it2.originalCompilationUnit))
;
--- Use ArrayList Instead Of Vector
helper def: UseArrayListInsteadOfVector() : Set(smm!Measure) =
-- Browse through all class(CompilationUnit)
--On recupere tout les new Vector et on verifie que le Vector appelé appartient au package java.utile
java!ConstructorDeclaration.allInstances()->
collect(i|i.abstractTypeDeclaration)
->select(p|p.name='Vector')->collect(i|i.package)
->select(p|p.name='util')->collect(i|i.package)
->select(p|p.name='java')
->collect(i |thisModule.RuleUseArrayListInsteadOfVector(i));
--- StringToString
--- Rule for metrics stringToString : returns the set of class Measures that violates the rule.
helper def: stringToString() : Set(smm!Measure) =
java!MethodInvocation.allInstances()
-> select( i | i.method.name = 'toString' and i.expression.variable.variablesContainer.type.type.name = 'String')
-> collect ( i | thisModule.MeasureStringToString(i) )
;
->collect(variable | thisModule.MeasureAvoidUsingShortType(variable))
;
--- InefficientEmptyStringCheck
helper def: inefficientEmptyStringCheck() : Set(smm!Measure) =
......@@ -353,18 +241,6 @@ helper def: useIndexOfChar() : Set(smm!Measure) =
-> collect (m | thisModule.MeasureUseIndexOfChar(m))
;
--- avoidInstantiatingObjectsInLoops
--- Checks if Objects are instantiated in loops
helper def: avoidInstantiatingObjectsInLoops(): Set(smm!Measure) =
java!Statement.allInstances()
->select(s | s.oclIsTypeOf(java!ForStatement) or s.oclIsTypeOf(java!DoStatement) or s.oclIsTypeOf(java!WhileStatement))
->select(s | s.body.statements
->select(s2 | s2.oclIsTypeOf(java!VariableDeclarationStatement))
->select(s2 | s2.fragments->exists(f | f.oclIsTypeOf(java!VariableDeclarationFragment)))
->exists(s2 | s2.fragments->exists(f | f.initializer.oclIsTypeOf(java!ClassInstanceCreation)))
)
->collect(s | thisModule.MeasureAvoidInstantiatingObjectInLoops(s));
--- UselessStringValueOf
--Goes through all the methods to check if the following rule is followed:
--No need to call String.valueOf to append to a string; just use the valueOf() argument directly.
......@@ -373,4 +249,4 @@ helper def: uselessStringValueOf() : Set(smm!Measure) =
-> select (m | m.method.name='valueOf' )
-> select (m | m.refImmediateComposite().oclIsTypeOf(java!InfixExpression))
-> collect (m | thisModule.MeasureUselessStringValueOf(m))
;
;
\ No newline at end of file
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