Class CompilationUtils


  • public final class CompilationUtils
    extends Object
    Helper class to create the ASTSignature instances using ChangeDistiller.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ch.uzh.ifi.seal.changedistiller.ast.java.JavaCompilation compileFile​(String _filename)
      Returns the generated JavaCompilation from the file identified by the given filename.
      static ch.uzh.ifi.seal.changedistiller.ast.java.JavaCompilation compileSource​(String source)
      compileSource.
      static List<ch.uzh.ifi.seal.changedistiller.ast.java.Comment> extractComments​(ch.uzh.ifi.seal.changedistiller.ast.java.JavaCompilation sCompilationUnit)
      extractComments.
      static org.eclipse.jdt.internal.compiler.ast.FieldDeclaration findField​(org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration cu, String fieldName)
      findField.
      static org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration findMethod​(org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration cu, String methodName)
      findMethod.
      static org.eclipse.jdt.internal.compiler.ast.TypeDeclaration findType​(org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration cu, String typeName)
      findType.
      static File getFile​(String filename)
      getFile.
    • Method Detail

      • compileSource

        public static ch.uzh.ifi.seal.changedistiller.ast.java.JavaCompilation compileSource​(String source)

        compileSource.

        Parameters:
        source - a String object.
        Returns:
        a JavaCompilation object.
      • compileFile

        public static ch.uzh.ifi.seal.changedistiller.ast.java.JavaCompilation compileFile​(String _filename)
        Returns the generated JavaCompilation from the file identified by the given filename.
        Parameters:
        _filename - of the file to compile
        Returns:
        the compilation of the file
      • extractComments

        public static List<ch.uzh.ifi.seal.changedistiller.ast.java.Comment> extractComments​(ch.uzh.ifi.seal.changedistiller.ast.java.JavaCompilation sCompilationUnit)

        extractComments.

        Parameters:
        sCompilationUnit - a JavaCompilation object.
        Returns:
        a List object.
      • findMethod

        public static org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration findMethod​(org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration cu,
                                                                                                 String methodName)

        findMethod.

        Parameters:
        cu - a CompilationUnitDeclaration object.
        methodName - a String object.
        Returns:
        a AbstractMethodDeclaration object.
      • findField

        public static org.eclipse.jdt.internal.compiler.ast.FieldDeclaration findField​(org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration cu,
                                                                                       String fieldName)

        findField.

        Parameters:
        cu - a CompilationUnitDeclaration object.
        fieldName - a String object.
        Returns:
        a FieldDeclaration object.
      • findType

        public static org.eclipse.jdt.internal.compiler.ast.TypeDeclaration findType​(org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration cu,
                                                                                     String typeName)

        findType.

        Parameters:
        cu - a CompilationUnitDeclaration object.
        typeName - a String object.
        Returns:
        a TypeDeclaration object.
      • getFile

        public static File getFile​(String filename)

        getFile.

        Parameters:
        filename - a String object.
        Returns:
        a File object.