1

COFOJA を使用してメソッドのコントラクトを作成する必要があるプロジェクトに取り組んでおり、ヒューリスティックを使用してコントラクトからメソッドのコードを生成する必要があります。

1) @requires、@ensures などの COFOJA で使用される注釈をスキャンするにはどうすればよいですか? 2) 抽象構文ツリーを生成する場合、AST に注釈/契約言語も含まれるかどうか?

例:私のプロジェクトへの次の入力を検討してください

class Test{

@requires( { a> 0})
@ensures( {a==0 implies fact(a)=1 , and a>0 implies fact(a) = fact(a-1)*a } )

 public int fact (int a)
 {

  }

     }



       // Output of first version of code: (Its a rough estimate of code,)

     class Test1{

  public int fact (int a)
  {
    if (a==0)
   return 1;

     if(a >0)
      return a*fact(a-1);

      if(a<0) throw new AssertionException("Precondition failed/violated a<0 ");

           }

         } // end of class
4

1 に答える 1

0

日食を設定するには: http://webcourse.cs.technion.ac.il/236700/Spring2013/ho/WCFiles/Contracts%20for%20Java.pdf

cofoja の場合: https://fsteeg.wordpress.com/2011/02/07/setting-up-contracts-for-java-in-eclipse/

于 2015-02-27T11:47:32.050 に答える