@ Requires ( { "kind != null" , "pos >= 0" , "id >= 0" , "pos <= id" , "expr != null" , "annotation != null" , "kind.isOld()" , "lineNumber == null || lineNumber >= 1" } ) private void createOldMethods ( ContractKind kind , int pos , int id , String expr , ContractAnnotationModel annotation , Long lineNumber ) { MethodModel helper = ContractCreation . createBlankContractHelper ( kind , annotation , "$" + Integer . toString ( pos ) ) ; helper . setReturnType ( new ClassName ( "java/lang/Object" ) ) ; if ( helper . getKind ( ) == ElementKind . CONTRACT_METHOD ) { ContractMethodModel helperContract = ( ContractMethodModel ) helper ; if ( lineNumber != null ) { helperContract . setLineNumbers ( Collections . singletonList ( lineNumber ) ) ; } String code = expr ; if ( ! annotation . isVirtual ( ) ) { code = ContractCreation . rebaseLocalCalls ( expr , JavaUtils . THAT_VARIABLE , null ) ; } helperContract . addStatement ( "return " + code + ";" ) ; } ContractMethodModel contract = ContractCreation . createBlankContractMethod ( kind , annotation , "$" + id ) ; contract . setReturnType ( new ClassName ( "java/lang/Object" ) ) ; contract . setId ( id ) ; contract . addStatement ( "return " + ContractCreation . getHelperCallCode ( helper , annotation ) + ";" ) ; }
Creates contract and helper methods according to the parameters and adds it to the parent type .