2番目 basic_info_listener.py

〇参考サイト
https://end0tknr.hateblo.jp/entry/20200907/1599438157


# -*- coding: utf-8 -*-
from ast.JavaParserListener import JavaParserListener
from ast.JavaParser import JavaParser
import re
import sys
import pprint

class BasicInfoListener(JavaParserListener):
   def __init__(self):
       self.call_methods = []
       self.ast_info = {'packageName': '',
                        'className'  : '',
                        'annotation' : [],
                        'modifier'   : [],
                        'implements' : [],
                        'extends'    : '',
                        'imports'    : [],
                        'fields'     : [],
                        'methods'    : []}
       self.tmp_annotation = []
       self.tmp_modifier   = []

   def enterPackageDeclaration(self, ctx):
       # pprint.pprint(sys._getframe().f_code.co_name+' '+ctx.getText())
       self.ast_info['packageName'] = ctx.qualifiedName().getText()
       #pprint.pprint(self.ast_info['packageName'])

   def enterImportDeclaration(self, ctx):
       # pprint.pprint(sys._getframe().f_code.co_name+' '+ctx.getText())
       import_class = ctx.qualifiedName().getText()
       self.ast_info['imports'].append(import_class)

   def enterClassOrInterfaceModifier(self, ctx):
       #pprint.pprint(sys._getframe().f_code.co_name+' '+ ctx.getText())
       if re.match('^@',ctx.getText()):
           self.tmp_annotation.append(ctx.getText())
       else :
           self.tmp_modifier.append(ctx.getText())
   # Enter a parse tree produced by JavaParser#methodCall.
   def enterMethodCall(self, ctx:JavaParser.MethodCallContext):
       # ★ポイント7
       line_number = str(ctx.start.line)
       column_number = str(ctx.start.column)
       self.call_methods.append(ctx.parentCtx.getText())

   def enterClassDeclaration(self, ctx):
       # pprint.pprint(sys._getframe().f_code.co_name+' '+ctx.getText())
       
       self.ast_info['annotation'] += self.tmp_annotation
       self.ast_info['modifier']   += self.tmp_modifier
       self.tmp_annotation = []
       self.tmp_modifier = []
       
       child_count = int(ctx.getChildCount())
       if child_count == 7:
           # c1 = ctx.getChild(0)                      # class
           c2 = ctx.getChild(1).getText()              # class name
           c3 = ctx.getChild(2)                        # extends
           c4 = ctx.getChild(3).getChild(0).getText()  # extends class name
           c5 = ctx.getChild(4)                        # implements
           c7 = ctx.getChild(6)                        # class body
           
           self.ast_info['className']  = c2
           self.ast_info['extends']    = c4
           self.ast_info['implements'] = \
           self.parse_implements_block(ctx.getChild(5))
           return
       
       if child_count == 5:
           c1 = ctx.getChild(0)                        # class
           c2 = ctx.getChild(1).getText()              # class name
           c3 = ctx.getChild(2).getText()              # extends or implements
           c5 = ctx.getChild(4)                        # class body

           
           self.ast_info['className'] = c2
           if c3 == 'implements':
               self.ast_info['implements'] = \
                   self.parse_implements_block(ctx.getChild(3))
           elif c3 == 'extends':
               c4 = ctx.getChild(3).getChild(0).getText()
               self.ast_info['extends'] = c4
           return
       
       if child_count == 3:
           c1 = ctx.getChild(0)                        # class
           c2 = ctx.getChild(1).getText()              # class name
           c3 = ctx.getChild(2)                        # class body
           self.ast_info['className'] = c2
           
           return
       
       print("unknown child_count"+ str(child_count))
       sys.exit()
       
   
   def enterFieldDeclaration(self, ctx):
       # pprint.pprint(sys._getframe().f_code.co_name+' '+ctx.getText())
       field = {'fieldType'      : ctx.getChild(0).getText(),
                'fieldDefinition': ctx.getChild(1).getText(),
                'annotation'     : [],
                'modifier'       : []  }
       
       field['annotation'] += self.tmp_annotation
       field['modifier']   += self.tmp_modifier
       self.tmp_annotation = []
       self.tmp_modifier = []
       
       self.ast_info['fields'].append(field)

#    def exitFieldDeclaration(self, ctx): pass
       
   def enterMemberDeclaration(self, ctx): pass
       # pprint.pprint(sys._getframe().f_code.co_name+' '+ctx.getText())
       # print("{0} {1} {2} {3}".format(sys._getframe().f_code.co_name,
       #                                ctx.start.line,
       #                                ctx.start.column,
       #                                ctx.getText()))

   def enterMethodDeclaration(self, ctx):
       # pprint.pprint(sys._getframe().f_code.co_name+' '+ctx.getText())
       self.call_methods = []
       c1 = ctx.getChild(0).getText()  # return type
       c2 = ctx.getChild(1).getText()  # method name
       # params
       params = self.parse_method_params_block(ctx.getChild(2))

       # method bodyを CommonTokenStream と tokenIndex により得る為
       ctx_method_body = ctx.getChild(-1)


       method_info = {'returnType': c1,
                      'methodName': c2,
                      'annotation': [],
                      'modifier'  : [],
                      'params': params,
                      'callMethods': self.call_methods,
                      'body_pos' : {
                          'start_line'  : ctx_method_body.start.line,
                          'start_column': ctx_method_body.start.column,
                          'start_index' : ctx_method_body.start.tokenIndex,
                          'stop_line'   : ctx_method_body.stop.line,
                          'stop_column' : ctx_method_body.stop.column,
                          'stop_index'  : ctx_method_body.stop.tokenIndex}}
       method_info['annotation'] += self.tmp_annotation
       method_info['modifier']   += self.tmp_modifier
       self.tmp_annotation = []
       self.tmp_modifier = []
       self.ast_info['methods'].append(method_info)

       # cols = []
       # for child in ctx.getChildren():
       #     cols.append(child.getText())
       # print("HOGEHOGE:"+" ".join(cols))
       
          
   def parse_implements_block(self, ctx):
       implements_child_count = int(ctx.getChildCount())
       result = []
       if implements_child_count == 1:
           impl_class = ctx.getChild(0).getText()
           result.append(impl_class)
       elif implements_child_count > 1:
           for i in range(implements_child_count):
               if i % 2 == 0:
                   impl_class = ctx.getChild(i).getText()
                   result.append(impl_class)
       return result

   def parse_method_params_block(self, ctx):
       params_exist_check = int(ctx.getChildCount())
       result = []
       if params_exist_check == 3:
           params_child_count = int(ctx.getChild(1).getChildCount())
           if params_child_count == 1:
               param_type = ctx.getChild(1).getChild(0).getChild(0).getText()
               param_name = ctx.getChild(1).getChild(0).getChild(1).getText()
               param_info = {'paramType': param_type,
                             'paramName': param_name }
               result.append(param_info)
           elif params_child_count > 1:
               for i in range(params_child_count):
                   if i % 2 == 0:
                       param_type = \
                           ctx.getChild(1).getChild(i).getChild(0).getText()
                       param_name = \
                           ctx.getChild(1).getChild(i).getChild(1).getText()
                       param_info = {'paramType': param_type,
                                     'paramName': param_name }
                       result.append(param_info)
       return result# -*- coding: utf-8 -*-
       
       
       
       
       
       
       
       
       ############################
       {
 "packageName": "finergit.ast",
 "className": "FinerJavaFileBuilderTest",
 "annotation": [],
 "modifier": [
   "public"
 ],
 "implements": [],
 "extends": "",
 "imports": [
   "org.assertj.core.api.Assertions.assertThat",
   "java.nio.file.Files",
   "java.nio.file.Path",
   "java.nio.file.Paths",
   "java.util.List",
   "java.util.Set",
   "java.util.stream.Collectors",
   "org.junit.Test",
   "finergit.FinerGitConfig"
 ],
 "fields": [],
 "methods": [
   {
     "returnType": "void",
     "methodName": "getFinerJavaModulesSuccessTest01",
     "annotation": [
       "@Test"
     ],
     "modifier": [
       "public"
     ],
     "params": [],
     "callMethods": [
       "Paths.get(\"src/test/resources/finergit/ast/token/MethodAndConstructor.java\")",
       "String.join(System.lineSeparator(),Files.readAllLines(targetPath))",
       "System.lineSeparator()",
       "Files.readAllLines(targetPath)",
       "config.setPeripheralFileGenerated(\"false\")",
       "config.setClassFileGenerated(\"true\")",
       "config.setMethodFileGenerated(\"true\")",
       "config.setFieldFileGenerated(\"true\")",
       "builder.getFinerJavaModules(targetPath.toString(),text)",
       "targetPath.toString()",
       "modules.stream()",
       "modules.stream().map(m->m.getFileName())",
       "m.getFileName()",
       "modules.stream().map(m->m.getFileName()).collect(Collectors.toSet())",
       "Collectors.toSet()",
       "assertThat(moduleNames)",
       "assertThat(moduleNames).containsExactlyInAnyOrder(\"MethodAndConstructor.cjava\",\"MethodAndConstructor#MethodAndConstructor().mjava\",\"MethodAndConstructor#void_method01().mjava\",\"MethodAndConstructor#void_method02().mjava\")"
     ],
     "body_pos": {
       "start_line": 16,
       "start_column": 66,
       "start_index": 125,
       "stop_line": 51,
       "stop_column": 2,
       "stop_index": 415
     }
   },
   {
     "returnType": "void",
     "methodName": "getFinerJavaModulesSuccessTest02",
     "annotation": [
       "@Test"
     ],
     "modifier": [
       "public"
     ],
     "params": [],
     "callMethods": [
       "Paths.get(\"src/test/resources/finergit/ast/token/MethodAndConstructor.java\")",
       "String.join(System.lineSeparator(),Files.readAllLines(targetPath))",
       "System.lineSeparator()",
       "Files.readAllLines(targetPath)",
       "builder.getFinerJavaModules(targetPath.toString(),text)",
       "targetPath.toString()",
       "module.getTokens()",
       "module.getTokens().stream()",
       "module.getTokens().stream().map(t->t.value)",
       "module.getTokens().stream().map(t->t.value).collect(Collectors.toList())",
       "Collectors.toList()",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"void\",\"method02\",\"(\",\")\",\"{\",\"new\",\"String\",\"(\",\")\",\";\",\"@SuppressWarnings(\\\"unused\\\")\",\"class\",\"InnerClass01\",\"{\",\"InnerClass01\",\"(\",\")\",\"{\",\"new\",\"String\",\"(\",\")\",\";\",\"}\",\"void\",\"method03\",\"(\",\")\",\"{\",\"new\",\"String\",\"(\",\")\",\";\",\"}\",\"}\",\"}\")",
       "assertThat(true)",
       "assertThat(true).isEqualTo(false)"
     ],
     "body_pos": {
       "start_line": 54,
       "start_column": 66,
       "start_index": 432,
       "stop_line": 84,
       "stop_column": 2,
       "stop_index": 764
     }
   },
   {
     "returnType": "void",
     "methodName": "getFinerJavaModulesSuccessTest03",
     "annotation": [
       "@Test"
     ],
     "modifier": [
       "public"
     ],
     "params": [],
     "callMethods": [
       "Paths.get(\"src/test/resources/finergit/ast/token/NestedClass.java\")",
       "String.join(System.lineSeparator(),Files.readAllLines(targetPath))",
       "System.lineSeparator()",
       "Files.readAllLines(targetPath)",
       "config.setPeripheralFileGenerated(\"false\")",
       "config.setClassFileGenerated(\"true\")",
       "config.setMethodFileGenerated(\"true\")",
       "config.setFieldFileGenerated(\"true\")",
       "builder.getFinerJavaModules(targetPath.toString(),text)",
       "targetPath.toString()",
       "modules.stream()",
       "modules.stream().map(m->m.getFileName())",
       "m.getFileName()",
       "modules.stream().map(m->m.getFileName()).collect(Collectors.toSet())",
       "Collectors.toSet()",
       "assertThat(moduleNames)",
       "assertThat(moduleNames).containsExactlyInAnyOrder(\"NestedClass.cjava\",\"NestedClass#void_method01().mjava\",\"NestedClass#void_method02().mjava\")"
     ],
     "body_pos": {
       "start_line": 87,
       "start_column": 66,
       "start_index": 781,
       "stop_line": 103,
       "stop_column": 2,
       "stop_index": 975
     }
   },
   {
     "returnType": "void",
     "methodName": "getFinerJavaModulesSuccessTest04",
     "annotation": [
       "@Test"
     ],
     "modifier": [
       "public"
     ],
     "params": [],
     "callMethods": [
       "Paths.get(\"src/test/resources/finergit/ast/token/NestedClass.java\")",
       "String.join(System.lineSeparator(),Files.readAllLines(targetPath))",
       "System.lineSeparator()",
       "Files.readAllLines(targetPath)",
       "builder.getFinerJavaModules(targetPath.toString(),text)",
       "targetPath.toString()",
       "module.getTokens()",
       "module.getTokens().stream()",
       "module.getTokens().stream().map(t->t.value)",
       "module.getTokens().stream().map(t->t.value).collect(Collectors.toList())",
       "Collectors.toList()",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"void\",\"method01\",\"(\",\")\",\"{\",\"new\",\"Runnable\",\"(\",\")\",\"{\",\"@Override\",\"public\",\"void\",\"run\",\"(\",\")\",\"{\",\"}\",\"}\",\";\",\"}\")",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"void\",\"method02\",\"(\",\")\",\"{\",\"@SuppressWarnings(\\\"unused\\\")\",\"class\",\"InnerClass02\",\"{\",\"}\",\"}\")",
       "assertThat(true)",
       "assertThat(true).isEqualTo(false)"
     ],
     "body_pos": {
       "start_line": 106,
       "start_column": 66,
       "start_index": 992,
       "stop_line": 134,
       "stop_column": 2,
       "stop_index": 1309
     }
   },
   {
     "returnType": "void",
     "methodName": "getFinerJavaModulesSuccessTest05",
     "annotation": [
       "@Test"
     ],
     "modifier": [
       "public"
     ],
     "params": [],
     "callMethods": [
       "Paths.get(\"src/test/resources/finergit/ast/token/GetterAndSetter.java\")",
       "String.join(System.lineSeparator(),Files.readAllLines(targetPath))",
       "System.lineSeparator()",
       "Files.readAllLines(targetPath)",
       "config.setPeripheralFileGenerated(\"false\")",
       "config.setClassFileGenerated(\"true\")",
       "config.setMethodFileGenerated(\"true\")",
       "config.setFieldFileGenerated(\"true\")",
       "builder.getFinerJavaModules(targetPath.toString(),text)",
       "targetPath.toString()",
       "modules.stream()",
       "modules.stream().map(m->m.getFileName())",
       "m.getFileName()",
       "modules.stream().map(m->m.getFileName()).collect(Collectors.toSet())",
       "Collectors.toSet()",
       "assertThat(moduleNames)",
       "assertThat(moduleNames).containsExactlyInAnyOrder(\"GetterAndSetter.cjava\",\"GetterAndSetter#public_GetterAndSetter(String).mjava\",\"GetterAndSetter#public_String_getText().mjava\",\"GetterAndSetter#public_void_setText(String).mjava\",\"GetterAndSetter#private_String_text.fjava\")"
     ],
     "body_pos": {
       "start_line": 137,
       "start_column": 66,
       "start_index": 1326,
       "stop_line": 156,
       "stop_column": 2,
       "stop_index": 1526
     }
   },
   {
     "returnType": "void",
     "methodName": "getFinerJavaModulesSuccessTest06",
     "annotation": [
       "@Test"
     ],
     "modifier": [
       "public"
     ],
     "params": [],
     "callMethods": [
       "Paths.get(\"src/test/resources/finergit/ast/token/GetterAndSetter.java\")",
       "String.join(System.lineSeparator(),Files.readAllLines(targetPath))",
       "System.lineSeparator()",
       "Files.readAllLines(targetPath)",
       "builder.getFinerJavaModules(targetPath.toString(),text)",
       "targetPath.toString()",
       "module.getTokens()",
       "module.getTokens().stream()",
       "module.getTokens().stream().map(t->t.value)",
       "module.getTokens().stream().map(t->t.value).collect(Collectors.toList())",
       "Collectors.toList()",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"public\",\"GetterAndSetter\",\"(\",\"String\",\"text\",\")\",\"{\",\"this\",\".\",\"text\",\"=\",\"text\",\";\",\"}\")",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"public\",\"String\",\"getText\",\"(\",\")\",\"{\",\"return\",\"text\",\";\",\"}\")",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"public\",\"void\",\"setText\",\"(\",\"String\",\"text\",\")\",\"{\",\"this\",\".\",\"text\",\"=\",\"text\",\";\",\"}\")",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"private\",\"String\",\"text\",\";\")",
       "System.err.println(module.name)",
       "assertThat(true)",
       "assertThat(true).isEqualTo(false)"
     ],
     "body_pos": {
       "start_line": 159,
       "start_column": 66,
       "start_index": 1543,
       "stop_line": 194,
       "stop_column": 2,
       "stop_index": 1937
     }
   },
   {
     "returnType": "void",
     "methodName": "getFinerJavaModulesSuccessTest07",
     "annotation": [
       "@Test"
     ],
     "modifier": [
       "public"
     ],
     "params": [],
     "callMethods": [
       "Paths.get(\"src/test/resources/finergit/ast/token/PreAndPostOperator.java\")",
       "String.join(System.lineSeparator(),Files.readAllLines(targetPath))",
       "System.lineSeparator()",
       "Files.readAllLines(targetPath)",
       "builder.getFinerJavaModules(targetPath.toString(),text)",
       "targetPath.toString()",
       "module.getTokens()",
       "module.getTokens().stream()",
       "module.getTokens().stream().map(t->t.value)",
       "module.getTokens().stream().map(t->t.value).collect(Collectors.toList())",
       "Collectors.toList()",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"void\",\"preOperatorMethod\",\"(\",\")\",\"{\",\"int\",\"i\",\"=\",\"0\",\";\",\"++\",\"i\",\";\",\"System\",\".\",\"out\",\".\",\"println\",\"(\",\"i\",\")\",\";\",\"}\")",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"void\",\"postOperatorMethod\",\"(\",\")\",\"{\",\"int\",\"i\",\"=\",\"0\",\";\",\"i\",\"++\",\";\",\"System\",\".\",\"out\",\".\",\"println\",\"(\",\"i\",\")\",\";\",\"}\")",
       "System.err.println(module.name)",
       "assertThat(true)",
       "assertThat(true).isEqualTo(false)"
     ],
     "body_pos": {
       "start_line": 198,
       "start_column": 66,
       "start_index": 1954,
       "stop_line": 229,
       "stop_column": 2,
       "stop_index": 2325
     }
   },
   {
     "returnType": "void",
     "methodName": "getFinerJavaModulesSuccessTest08",
     "annotation": [
       "@Test"
     ],
     "modifier": [
       "public"
     ],
     "params": [],
     "callMethods": [
       "Paths.get(\"src/test/resources/finergit/ast/token/Literal.java\")",
       "String.join(System.lineSeparator(),Files.readAllLines(targetPath))",
       "System.lineSeparator()",
       "Files.readAllLines(targetPath)",
       "builder.getFinerJavaModules(targetPath.toString(),text)",
       "targetPath.toString()",
       "module.getTokens()",
       "module.getTokens().stream()",
       "module.getTokens().stream().map(t->t.value)",
       "module.getTokens().stream().map(t->t.value).collect(Collectors.toList())",
       "Collectors.toList()",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"void\",\"method01\",\"(\",\")\",\"{\",\"System\",\".\",\"out\",\".\",\"println\",\"(\",\"0\",\")\",\";\",\"System\",\".\",\"out\",\".\",\"println\",\"(\",\"0l\",\")\",\";\",\"System\",\".\",\"out\",\".\",\"println\",\"(\",\"0f\",\")\",\";\",\"System\",\".\",\"out\",\".\",\"println\",\"(\",\"\\\"0\\\"\",\")\",\";\",\"System\",\".\",\"out\",\".\",\"println\",\"(\",\"'0'\",\")\",\";\",\"}\")",
       "System.err.println(module.name)",
       "assertThat(true)",
       "assertThat(true).isEqualTo(false)"
     ],
     "body_pos": {
       "start_line": 232,
       "start_column": 66,
       "start_index": 2342,
       "stop_line": 262,
       "stop_column": 2,
       "stop_index": 2726
     }
   },
   {
     "returnType": "void",
     "methodName": "getFinerJavaModulesSuccessTest09",
     "annotation": [
       "@Test"
     ],
     "modifier": [
       "public"
     ],
     "params": [],
     "callMethods": [
       "Paths.get(\"src/test/resources/finergit/ast/token/Bracket.java\")",
       "String.join(System.lineSeparator(),Files.readAllLines(targetPath))",
       "System.lineSeparator()",
       "Files.readAllLines(targetPath)",
       "builder.getFinerJavaModules(targetPath.toString(),text)",
       "targetPath.toString()",
       "module.getTokens()",
       "module.getTokens().stream()",
       "module.getTokens().stream().map(t->t.value)",
       "module.getTokens().stream().map(t->t.value).collect(Collectors.toList())",
       "Collectors.toList()",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"void\",\"doMethod\",\"(\",\")\",\"{\",\"do\",\"{\",\"}\",\"while\",\"(\",\"true\",\")\",\";\",\"}\")",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"void\",\"forMethod\",\"(\",\")\",\"{\",\"for\",\"(\",\";\",\"true\",\";\",\")\",\"{\",\"}\",\"}\")",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"void\",\"foreachMethod\",\"(\",\")\",\"{\",\"for\",\"(\",\"Object\",\"o\",\":\",\"Collections\",\".\",\"emptyList\",\"(\",\")\",\")\",\"{\",\"o\",\".\",\"toString\",\"(\",\")\",\";\",\"}\",\"}\")",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"@SuppressWarnings(\\\"unused\\\")\",\"void\",\"ifMethod\",\"(\",\")\",\"{\",\"if\",\"(\",\"true\",\")\",\"{\",\"}\",\"else\",\"{\",\"}\",\"}\")",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"void\",\"lambdaMethod\",\"(\",\")\",\"{\",\"Collections\",\".\",\"emptyList\",\"(\",\")\",\".\",\"forEach\",\"(\",\"o\",\"->\",\"{\",\"}\",\")\",\";\",\"}\")",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"void\",\"simpleBlockMethod\",\"(\",\")\",\"{\",\"{\",\"}\",\"}\")",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"void\",\"synchronizedMethod\",\"(\",\")\",\"{\",\"synchronized\",\"(\",\"this\",\")\",\"{\",\"}\",\"}\")",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"void\",\"switchMethod\",\"(\",\"int\",\"value\",\")\",\"{\",\"switch\",\"(\",\"value\",\")\",\"{\",\"case\",\"0\",\":\",\"break\",\";\",\"default\",\":\",\"break\",\";\",\"}\",\"}\")",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"void\",\"tryMethod\",\"(\",\")\",\"{\",\"try\",\"{\",\"}\",\"catch\",\"(\",\"Exception\",\"e\",\")\",\"{\",\"}\",\"finally\",\"{\",\"}\",\"}\")",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"void\",\"whileMethod\",\"(\",\")\",\"{\",\"while\",\"(\",\"true\",\")\",\"{\",\"}\",\"}\")",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"void\",\"anonymousInnerClassMethod\",\"(\",\")\",\"{\",\"new\",\"Nothing\",\"(\",\")\",\"{\",\"@Override\",\"public\",\"void\",\"doNothing\",\"(\",\")\",\"{\",\"}\",\"}\",\";\",\"}\")",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"void\",\"doNothing\",\"(\",\")\",\";\")",
       "System.err.println(module.name)",
       "assertThat(true)",
       "assertThat(true).isEqualTo(false)"
     ],
     "body_pos": {
       "start_line": 265,
       "start_column": 66,
       "start_index": 2743,
       "stop_line": 383,
       "stop_column": 2,
       "stop_index": 3830
     }
   },
   {
     "returnType": "void",
     "methodName": "getFinerJavaModulesSuccessTest10",
     "annotation": [
       "@Test"
     ],
     "modifier": [
       "public"
     ],
     "params": [],
     "callMethods": [
       "Paths.get(\"src/test/resources/finergit/ast/Enum.java\")",
       "String.join(System.lineSeparator(),Files.readAllLines(targetPath))",
       "System.lineSeparator()",
       "Files.readAllLines(targetPath)",
       "config.setPeripheralFileGenerated(\"false\")",
       "config.setClassFileGenerated(\"true\")",
       "config.setMethodFileGenerated(\"true\")",
       "config.setFieldFileGenerated(\"true\")",
       "builder.getFinerJavaModules(targetPath.toString(),text)",
       "targetPath.toString()",
       "modules.stream()",
       "modules.stream().map(m->m.getFileName())",
       "m.getFileName()",
       "modules.stream().map(m->m.getFileName()).collect(Collectors.toSet())",
       "Collectors.toSet()",
       "assertThat(moduleNames)",
       "assertThat(moduleNames).containsExactlyInAnyOrder(\"Enum.cjava\",\"Enum#public_String_toString().mjava\")"
     ],
     "body_pos": {
       "start_line": 386,
       "start_column": 66,
       "start_index": 3847,
       "stop_line": 402,
       "stop_column": 2,
       "stop_index": 4038
     }
   },
   {
     "returnType": "void",
     "methodName": "getFinerJavaModulesSuccessTest11",
     "annotation": [
       "@Test"
     ],
     "modifier": [
       "public"
     ],
     "params": [],
     "callMethods": [
       "Paths.get(\"src/test/resources/finergit/ast/VariableLengthParameter.java\")",
       "String.join(System.lineSeparator(),Files.readAllLines(targetPath))",
       "System.lineSeparator()",
       "Files.readAllLines(targetPath)",
       "config.setPeripheralFileGenerated(\"false\")",
       "config.setClassFileGenerated(\"true\")",
       "config.setMethodFileGenerated(\"true\")",
       "config.setFieldFileGenerated(\"true\")",
       "builder.getFinerJavaModules(targetPath.toString(),text)",
       "targetPath.toString()",
       "modules.stream()",
       "modules.stream().map(m->m.getFileName())",
       "m.getFileName()",
       "modules.stream().map(m->m.getFileName()).collect(Collectors.toList())",
       "Collectors.toList()",
       "assertThat(moduleNames)",
       "assertThat(moduleNames).containsExactlyInAnyOrder(\"VariableLengthParameter.cjava\",\"VariableLengthParameter#public_String_method01(String).mjava\",\"VariableLengthParameter#public_String_method01(String...).mjava\")"
     ],
     "body_pos": {
       "start_line": 405,
       "start_column": 66,
       "start_index": 4055,
       "stop_line": 423,
       "stop_column": 2,
       "stop_index": 4249
     }
   },
   {
     "returnType": "void",
     "methodName": "getFinerJavaModulesSuccessTest12",
     "annotation": [
       "@Test"
     ],
     "modifier": [
       "public"
     ],
     "params": [],
     "callMethods": [
       "Paths.get(\"src/test/resources/finergit/ast/MethodTypeErasure.java\")",
       "String.join(System.lineSeparator(),Files.readAllLines(targetPath))",
       "System.lineSeparator()",
       "Files.readAllLines(targetPath)",
       "config.setPeripheralFileGenerated(\"false\")",
       "config.setClassFileGenerated(\"true\")",
       "config.setMethodFileGenerated(\"true\")",
       "config.setFieldFileGenerated(\"true\")",
       "builder.getFinerJavaModules(targetPath.toString(),text)",
       "targetPath.toString()",
       "modules.stream()",
       "modules.stream().map(m->m.getFileName())",
       "m.getFileName()",
       "modules.stream().map(m->m.getFileName()).collect(Collectors.toList())",
       "Collectors.toList()",
       "assertThat(moduleNames)",
       "assertThat(moduleNames).containsExactlyInAnyOrder(\"MethodTypeErasure.cjava\",\"MethodTypeErasure#public_[R-extends-Set[T]]_T_get(R).mjava\",\"MethodTypeErasure#public_[R-extends-List[T]]_T_get(R).mjava\")"
     ],
     "body_pos": {
       "start_line": 426,
       "start_column": 66,
       "start_index": 4266,
       "stop_line": 443,
       "stop_column": 2,
       "stop_index": 4460
     }
   },
   {
     "returnType": "void",
     "methodName": "getFinerJavaModulesSuccessTest13",
     "annotation": [
       "@Test"
     ],
     "modifier": [
       "public"
     ],
     "params": [],
     "callMethods": [
       "Paths.get(\"src/test/resources/finergit/ast/ArrayDefinition.java\")",
       "String.join(System.lineSeparator(),Files.readAllLines(targetPath))",
       "System.lineSeparator()",
       "Files.readAllLines(targetPath)",
       "config.setPeripheralFileGenerated(\"false\")",
       "config.setClassFileGenerated(\"true\")",
       "config.setMethodFileGenerated(\"true\")",
       "config.setFieldFileGenerated(\"true\")",
       "builder.getFinerJavaModules(targetPath.toString(),text)",
       "targetPath.toString()",
       "modules.stream()",
       "modules.stream().map(m->m.getFileName())",
       "m.getFileName()",
       "modules.stream().map(m->m.getFileName()).collect(Collectors.toList())",
       "Collectors.toList()",
       "assertThat(moduleNames)",
       "assertThat(moduleNames).containsExactlyInAnyOrder(\"ArrayDefinition.cjava\",\"ArrayDefinition#public_void_set(int).mjava\",\"ArrayDefinition#public_void_set(int[]).mjava\",\"ArrayDefinition#public_void_set(int[][]).mjava\",\"ArrayDefinition#public_void_set(int[][][]).mjava\")"
     ],
     "body_pos": {
       "start_line": 446,
       "start_column": 66,
       "start_index": 4477,
       "stop_line": 465,
       "stop_column": 2,
       "stop_index": 4677
     }
   },
   {
     "returnType": "void",
     "methodName": "getFinerJavaModulesSuccessTest14",
     "annotation": [
       "@Test"
     ],
     "modifier": [
       "public"
     ],
     "params": [],
     "callMethods": [
       "Paths.get(\"src/test/resources/finergit/ast/ClassName.java\")",
       "String.join(System.lineSeparator(),Files.readAllLines(targetPath))",
       "System.lineSeparator()",
       "Files.readAllLines(targetPath)",
       "config.setPeripheralFileGenerated(\"false\")",
       "config.setClassFileGenerated(\"true\")",
       "config.setMethodFileGenerated(\"true\")",
       "config.setFieldFileGenerated(\"true\")",
       "builder.getFinerJavaModules(targetPath.toString(),text)",
       "targetPath.toString()",
       "modules.stream()",
       "modules.stream().map(m->m.getFileName())",
       "m.getFileName()",
       "modules.stream().map(m->m.getFileName()).collect(Collectors.toList())",
       "Collectors.toList()",
       "assertThat(moduleNames)",
       "assertThat(moduleNames).containsExactlyInAnyOrder(\"ClassName.cjava\",\"ClassName#public_void_set(String).mjava\",\"[ClassName]A.cjava\",\"[ClassName]A#public_void_set(String).mjava\")"
     ],
     "body_pos": {
       "start_line": 468,
       "start_column": 66,
       "start_index": 4694,
       "stop_line": 485,
       "stop_column": 2,
       "stop_index": 4891
     }
   },
   {
     "returnType": "void",
     "methodName": "getFinerJavaModulesSuccessTest15",
     "annotation": [
       "@Test"
     ],
     "modifier": [
       "public"
     ],
     "params": [],
     "callMethods": [
       "Paths.get(\"src/test/resources/finergit/ast/token/Field.java\")",
       "String.join(System.lineSeparator(),Files.readAllLines(targetPath))",
       "System.lineSeparator()",
       "Files.readAllLines(targetPath)",
       "config.setPeripheralFileGenerated(\"false\")",
       "config.setClassFileGenerated(\"true\")",
       "config.setMethodFileGenerated(\"true\")",
       "config.setFieldFileGenerated(\"true\")",
       "builder.getFinerJavaModules(targetPath.toString(),text)",
       "targetPath.toString()",
       "modules.stream()",
       "modules.stream().map(m->m.getFileName())",
       "m.getFileName()",
       "modules.stream().map(m->m.getFileName()).collect(Collectors.toList())",
       "Collectors.toList()",
       "assertThat(moduleNames)",
       "assertThat(moduleNames).containsExactlyInAnyOrder(\"Field.cjava\",\"Field#private_int_a.fjava\",\"Field#private_char_b.fjava\",\"Field#private_byte[]_c_d.fjava\",\"Field#private_short[]_e_f.fjava\",\"Field#public_long_g.fjava\",\"Field#void_method().mjava\")"
     ],
     "body_pos": {
       "start_line": 488,
       "start_column": 66,
       "start_index": 4908,
       "stop_line": 506,
       "stop_column": 2,
       "stop_index": 5114
     }
   },
   {
     "returnType": "void",
     "methodName": "getFinerJavaModulesSuccessTest16",
     "annotation": [
       "@Test"
     ],
     "modifier": [
       "public"
     ],
     "params": [],
     "callMethods": [
       "Paths.get(\"src/test/resources/finergit/ast/token/Field.java\")",
       "String.join(System.lineSeparator(),Files.readAllLines(targetPath))",
       "System.lineSeparator()",
       "Files.readAllLines(targetPath)",
       "builder.getFinerJavaModules(targetPath.toString(),text)",
       "targetPath.toString()",
       "module.getTokens()",
       "module.getTokens().stream()",
       "module.getTokens().stream().map(t->t.value)",
       "module.getTokens().stream().map(t->t.value).collect(Collectors.toList())",
       "Collectors.toList()",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"private\",\"int\",\"a\",\";\")",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"private\",\"final\",\"char\",\"b\",\"=\",\"'b'\",\";\")",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"private\",\"byte\",\"[\",\"]\",\"c\",\",\",\"d\",\";\")",
       "assertThat(tokens)",
       "assertThat(tokens).containsExactly(\"private\",\"short\",\"[\",\"]\",\"e\",\",\",\"f\",\"=\",\"{\",\"1\",\",\",\"2\",\"}\",\";\")",
       "assertThat(tokens)",
       "assertThat(tokens).contains(\"public\",\"final\",\"long\",\"g\",\"=\",\"100l\",\";\")",
       "System.err.println(module.name)",
       "assertThat(true)",
       "assertThat(true).isEqualTo(false)"
     ],
     "body_pos": {
       "start_line": 509,
       "start_column": 66,
       "start_index": 5131,
       "stop_line": 552,
       "stop_column": 2,
       "stop_index": 5556
     }
   },
   {
     "returnType": "void",
     "methodName": "getFinerJavaModulesSuccessTest17",
     "annotation": [
       "@Test"
     ],
     "modifier": [
       "public"
     ],
     "params": [],
     "callMethods": [
       "Paths.get(\"src/test/resources/finergit/ast/EscapeRout.java\")",
       "String.join(System.lineSeparator(),Files.readAllLines(targetPath))",
       "System.lineSeparator()",
       "Files.readAllLines(targetPath)",
       "config.setPeripheralFileGenerated(\"false\")",
       "config.setClassFileGenerated(\"true\")",
       "config.setMethodFileGenerated(\"true\")",
       "config.setFieldFileGenerated(\"true\")",
       "builder.getFinerJavaModules(targetPath.toString(),text)",
       "targetPath.toString()",
       "modules.stream()",
       "modules.stream().map(m->m.getFileName())",
       "m.getFileName()",
       "modules.stream().map(m->m.getFileName()).collect(Collectors.toList())",
       "Collectors.toList()",
       "assertThat(moduleNames)",
       "assertThat(moduleNames).containsExactlyInAnyOrder(\"EscapeRout.cjava\",\"EscapeRout#public_void_main(String[]).mjava\")"
     ],
     "body_pos": {
       "start_line": 555,
       "start_column": 66,
       "start_index": 5573,
       "stop_line": 571,
       "stop_column": 2,
       "stop_index": 5764
     }
   }
 ]
}

いいなと思ったら応援しよう!