Class JavaLanguageFrontend


  • public class JavaLanguageFrontend
    extends LanguageFrontend
    Main parser for ONE Java files.
    • Method Detail

      • parse

        protected com.github.javaparser.ast.CompilationUnit parse​(java.lang.String fileContent,
                                                                  com.github.javaparser.JavaParser parser)
                                                           throws TranslationException
        Throws:
        TranslationException
      • getCodeFromRawNode

        public <T> java.lang.String getCodeFromRawNode​(T astNode)
        Description copied from class: LanguageFrontend
        Returns the raw code of the ast node, generic for java or c++ ast nodes.
        Specified by:
        getCodeFromRawNode in class LanguageFrontend
        Type Parameters:
        T - the raw ast type
        Parameters:
        astNode - the ast node
        Returns:
        the source code
      • getRegionFromRawNode

        public <T> @NonNull Region getRegionFromRawNode​(T astNode)
        Description copied from class: LanguageFrontend
        Returns the Region of the code with line and column, index starting at 1, generic for java or c++ ast nodes.
        Specified by:
        getRegionFromRawNode in class LanguageFrontend
        Type Parameters:
        T - the raw ast type
        Parameters:
        astNode - the ast node
        Returns:
        the region
      • getTypeAsGoodAsPossible

        public Type getTypeAsGoodAsPossible​(com.github.javaparser.ast.nodeTypes.NodeWithType nodeWithType,
                                            com.github.javaparser.resolution.declarations.ResolvedValueDeclaration resolved)
      • getQualifiedMethodNameAsGoodAsPossible

        public java.lang.String getQualifiedMethodNameAsGoodAsPossible​(com.github.javaparser.ast.expr.MethodCallExpr callExpr)
      • recoverTypeFromUnsolvedException

        public java.lang.String recoverTypeFromUnsolvedException​(java.lang.Throwable ex)
      • getQualifiedNameFromImports

        public java.lang.String getQualifiedNameFromImports​(java.lang.String className)
      • getTypeAsGoodAsPossible

        public Type getTypeAsGoodAsPossible​(com.github.javaparser.ast.type.Type type)
      • getReturnTypeAsGoodAsPossible

        public Type getReturnTypeAsGoodAsPossible​(com.github.javaparser.ast.nodeTypes.NodeWithType nodeWithType,
                                                  com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration resolved)
      • getContext

        public com.github.javaparser.ast.CompilationUnit getContext()