KR102439456B1 - Compilation device and method of partial source code - Google Patents
Compilation device and method of partial source code Download PDFInfo
- Publication number
- KR102439456B1 KR102439456B1 KR1020180127727A KR20180127727A KR102439456B1 KR 102439456 B1 KR102439456 B1 KR 102439456B1 KR 1020180127727 A KR1020180127727 A KR 1020180127727A KR 20180127727 A KR20180127727 A KR 20180127727A KR 102439456 B1 KR102439456 B1 KR 102439456B1
- Authority
- KR
- South Korea
- Prior art keywords
- class
- dummy
- list
- source code
- dummy class
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/42—Syntactic analysis
- G06F8/427—Parsing
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/44—Encoding
- G06F8/447—Target code generation
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
부분 소스 코드의 컴파일 장치 및 방법이 개시된다. 예시적인 실시예에 따를 장치는, 부분 소스 코드를 파싱하고, 이로부터 소스 심볼 테이블 및 더미클래스 후보 리스트를 생성하는 소스 파싱 모듈; 상기 더미클래스 후보 리스트에 포함된 하나 이상의 더미클래스 후보 클래스들 중 실제 더미클래스 생성이 필요한 대상 클래스를 식별하는 타겟 식별 모듈; 식별된 상기 대상 클래스들의 정보를 획득하고, 이로부터 더미클래스 정보 리스트를 생성하는 더미클래스 정보 생성 모듈; 상기 더미클래스 정보 리스트를 참조하여 하나 이상의 더미클래스를 생성하는 더미클래스 작성 모듈; 및 생성된 상기 더미클래스를 이용하여 상기 부분 소스 코드에 대한 컴파일을 수행하는 컴파일 모듈을 포함한다.An apparatus and method for compiling partial source code are disclosed. An apparatus according to an exemplary embodiment includes a source parsing module that parses a partial source code and generates a source symbol table and a dummy class candidate list therefrom; a target identification module for identifying a target class for which actual dummy class generation is required from among one or more dummy class candidate classes included in the dummy class candidate list; a dummy class information generating module for obtaining information of the identified target classes and generating a dummy class information list therefrom; a dummy class creation module for generating one or more dummy classes by referring to the dummy class information list; and a compilation module that compiles the partial source code using the generated dummy class.
Description
개시되는 실시예들은 프로그램 소스 코드(source code)의 컴파일(compile)을 위한 기술과 관련된다.The disclosed embodiments relate to techniques for compiling program source code.
정적 프로그램 분석(Static Program Analysis)이란 프로그램의 실제 실행 없이 컴퓨터 소프트웨어를 분석하는 방법을 의미한다. 대부분의 정적 프로그램 분석은 소스 코드를 이용하여 수행되는 것이 일반적이나, 최근의 정적 프로그램 분석 도구들은 분석의 정확도를 높이기 위해 소스 코드 대신 컴파일된 파일을 이용하는 경우가 증가하고 있다.Static program analysis refers to a method of analyzing computer software without actually executing a program. Most static program analysis is generally performed using source code, but recent static program analysis tools use compiled files instead of source codes to increase the accuracy of analysis.
소스 코드의 컴파일을 위해서는 작성된 소스 코드가 참조하는 전체 클래스 및 라이브러리가 필요하다. 따라서 만약 개발하려는 소프트웨어의 규모가 큰 경우에는 변경된 일부 소스 코드의 분석을 위하여 전체 소프트웨어 시스템을 구성하는 라이브러리 및 클래스를 데이터 저장소로부터 받아와야 하는 등의 복잡한 사전 준비가 필요하게 된다.In order to compile the source code, all classes and libraries referenced by the written source code are required. Therefore, if the scale of the software to be developed is large, complex preliminary preparations such as having to receive libraries and classes constituting the entire software system from the data storage are required for the analysis of some changed source codes.
개시되는 실시예들은 부분 소스 코드(Partial source code)가 참조하는 클래스 및 라이브러리 정보 없이도 부분 소스 코드를 효과적으로 컴파일하기 위한 기술적인 수단을 제공하기 위한 것이다.The disclosed embodiments are intended to provide technical means for effectively compiling a partial source code without class and library information referenced by the partial source code.
예시적인 실시예에 따르면, 부분 소스 코드를 파싱하고, 이로부터 소스 심볼 테이블 및 더미클래스 후보 리스트를 생성하는 소스 파싱 모듈; 상기 더미클래스 후보 리스트에 포함된 하나 이상의 더미클래스 후보 클래스들 중 실제 더미클래스 생성이 필요한 대상 클래스를 식별하는 타겟 식별 모듈; 식별된 상기 대상 클래스들의 정보를 획득하고, 이로부터 더미클래스 정보 리스트를 생성하는 더미클래스 정보 생성 모듈; 상기 더미클래스 정보 리스트를 참조하여 하나 이상의 더미클래스를 생성하는 더미클래스 작성 모듈; 및 생성된 상기 더미클래스를 이용하여 상기 부분 소스 코드에 대한 컴파일을 수행하는 컴파일 모듈을 포함하는 부분 소스 코드의 컴파일 장치가 제공된다.According to an exemplary embodiment, there is provided a source parsing module that parses a partial source code and generates a source symbol table and a dummy class candidate list therefrom; a target identification module for identifying a target class for which actual dummy class generation is required from among one or more dummy class candidate classes included in the dummy class candidate list; a dummy class information generating module for obtaining information of the identified target classes and generating a dummy class information list therefrom; a dummy class creation module for generating one or more dummy classes by referring to the dummy class information list; and a compilation module that compiles the partial source code using the generated dummy class.
상기 더미클래스 후보 리스트는, 상기 부분 소스 코드에서 사용되는 하나 이상의 클래스들의 FQCN(Fully-Qualified Class Name)을 포함할 수 있다.The dummy class candidate list may include Fully-Qualified Class Names (FQCNs) of one or more classes used in the partial source code.
상기 소스 파싱 모듈은, 상기 부분 소스 코드에 복합 방식의 메소드 호출 구문이 포함되어 있는 경우, 상기 메소드 호출에 대응되는 익명 클래스(anonymous class)를 생성하고, 생성된 익명 클래스의 FQCN을 상기 더미클래스 후보 리스트에 등록할 수 있다.The source parsing module generates an anonymous class corresponding to the method call when the partial source code includes a complex method call syntax, and uses the FQCN of the generated anonymous class as the dummy class candidate. You can register on the list.
상기 소스 파싱 모듈은, 상기 더미클래스 후보 클래스가 자바 가상 머신에서 제공되는 클래스, 상기 부분 소스 코드에 포함된 클래스, 또는 기 설정된 더미클래스 제외 대상 클래스 중 하나 이상에 포함되는 경우 해당 클래스를 상기 대상 클래스에서 제외할 수 있다.The source parsing module is, when the dummy class candidate class is included in at least one of a class provided by the Java virtual machine, a class included in the partial source code, or a preset dummy class exclusion target class, sets the corresponding class to the target class can be excluded from
상기 더미클래스 정보 생성 모듈은, 상기 소스 심볼 테이블 및 상기 더미클래스 대상 리스트를 참조하여 상기 부분 소스 코드를 2차 파싱함으로써 상기 더미클래스 정보 리스트를 생성할 수 있다.The dummy class information generating module may generate the dummy class information list by secondary parsing the partial source code with reference to the source symbol table and the dummy class target list.
상기 더미클래스 정보 리스트는, 상기 대상 클래스 각각의 패키지 이름, 클래스 이름, 상위클래스 이름, 선언이 필요한 인터페이스 목록, 제네릭스(Generics)의 타입 인수(Type Arguments) 목록, 생성자 목록, 어노테이션 클래스 여부, 예외 클래스 여부, 필드 정의 필요 목록, 메소드 정의 필요 목록을 포함할 수 있다.The dummy class information list includes a package name of each target class, a class name, a superclass name, a list of interfaces requiring declaration, a list of type arguments of generics, a list of constructors, whether an annotation class, an exception It can include whether it is a class, a list that requires field definitions, and a list that requires method definitions.
상기 더미클래스 정보 생성 모듈은, 상기 부분 소스 코드에 객체 생성 구문이 포함되어 있는 경우, 상기 객체 생성 구문에 포함된 파라미터의 FQCN을 획득하여 상기 더미클래스 정보 리스트에 등록하되, 상기 부분 소스 코드로부터 상기 파라미터의 FQCN을 획득할 수 없는 경우에는 최상위 객체(java.lang.Object)를 상기 더미클래스 정보 리스트에 등록할 수 있다.The dummy class information generation module is, when the partial source code includes an object creation syntax, obtains an FQCN of a parameter included in the object creation syntax and registers it in the dummy class information list, from the partial source code If the FQCN of the parameter cannot be obtained, the highest level object (java.lang.Object) may be registered in the dummy class information list.
상기 더미클래스 작성 모듈은, 상기 더미클래스 더미클래스 정보 리스트에 익명 클래스가 포함되어 있는 경우, 상기 익명 클래스에 대한 바이트코드를 먼저 작성하고, 상기 익명 클래스의 작성이 완료된 이후 비 익명 클래스에 대한 바이트코드를 작성할 수 있다.The dummy class creation module, when an anonymous class is included in the dummy class dummy class information list, first writes a bytecode for the anonymous class, and then writes a bytecode for the non-anonymous class after the creation of the anonymous class is completed. can write
다른 예시적인 실시예에 따르면, 하나 이상의 프로세서들, 및 상기 하나 이상의 프로세서들에 의해 실행되는 하나 이상의 프로그램들을 저장하는 메모리를 구비한 컴퓨팅 장치에서 수행되는 방법으로서, 부분 소스 코드를 파싱하고, 이로부터 소스 심볼 테이블 및 더미클래스 후보 리스트를 생성하는 단계; 상기 더미클래스 후보 리스트에 포함된 하나 이상의 더미클래스 후보 클래스들 중 실제 더미클래스 생성이 필요한 대상 클래스를 식별하는 단계; 식별된 상기 대상 클래스들의 정보를 획득하고, 이로부터 더미클래스 정보 리스트를 생성하는 단계; 상기 더미클래스 정보 리스트를 참조하여 하나 이상의 더미클래스를 생성하는 더미클래스 작성 단계; 및 생성된 상기 더미클래스를 이용하여 상기 부분 소스 코드에 대한 컴파일을 수행하는 단계를 포함하는 부분 소스 코드의 컴파일 방법이 제공된다.According to another exemplary embodiment, there is provided a method performed in a computing device having one or more processors and a memory storing one or more programs to be executed by the one or more processors, the method comprising: parsing a partial source code; generating a source symbol table and a dummy class candidate list; identifying a target class for which actual dummy class generation is required from among one or more dummy class candidate classes included in the dummy class candidate list; obtaining information of the identified target classes, and generating a dummy class information list therefrom; a dummy class creation step of creating one or more dummy classes with reference to the dummy class information list; and performing compilation on the partial source code using the generated dummy class.
상기 더미클래스 후보 리스트는, 상기 부분 소스 코드에서 사용되는 하나 이상의 클래스들의 FQCN(Fully-Qualified Class Name)을 포함할 수 있다.The dummy class candidate list may include Fully-Qualified Class Names (FQCNs) of one or more classes used in the partial source code.
상기 더미클래스 후보 리스트를 생성하는 단계는, 상기 부분 소스 코드에 복합 방식의 메소드 호출 구문이 포함되어 있는 경우, 상기 메소드 호출에 대응되는 익명 클래스(anonymous class)를 생성하고, 생성된 익명 클래스의 FQCN을 상기 더미클래스 후보 리스트에 등록하도록 구성될 수 있다.The generating of the dummy class candidate list includes generating an anonymous class corresponding to the method call when the partial source code includes a complex method call syntax, and FQCN of the generated anonymous class. may be configured to register in the dummy class candidate list.
상기 더미클래스 후보 리스트를 생성하는 단계는, 상기 더미클래스 후보 클래스가 자바 가상 머신에서 제공되는 클래스, 상기 부분 소스 코드에 포함된 클래스, 또는 기 설정된 더미클래스 제외 대상 클래스 중 하나 이상에 포함되는 경우 해당 클래스를 상기 대상 클래스에서 제외하도록 구성될 수 있다.The generating of the dummy class candidate list may include, when the dummy class candidate class is included in one or more of a class provided by the Java virtual machine, a class included in the partial source code, or a preset dummy class exclusion target class. It may be configured to exclude a class from the target class.
상기 더미클래스 정보를 생성하는 단계는, 상기 소스 심볼 테이블 및 상기 더미클래스 대상 리스트를 참조하여 상기 부분 소스 코드를 2차 파싱함으로써 상기 더미클래스 정보 리스트를 생성하도록 구성될 수 있다.The generating of the dummy class information may include generating the dummy class information list by secondary parsing the partial source code with reference to the source symbol table and the dummy class target list.
상기 더미클래스 정보 리스트는, 상기 대상 클래스 각각의 패키지 이름, 클래스 이름, 상위클래스 이름, 선언이 필요한 인터페이스 목록, 제네릭스(Generics)의 타입 인수(Type Arguments) 목록, 생성자 목록, 어노테이션 클래스 여부, 예외 클래스 여부, 필드 정의 필요 목록, 메소드 정의 필요 목록을 포함할 수 있다.The dummy class information list includes a package name of each target class, a class name, a superclass name, a list of interfaces requiring declaration, a list of type arguments of generics, a list of constructors, whether an annotation class, an exception It can include whether it is a class, a list that requires field definitions, and a list that requires method definitions.
상기 더미클래스 정보를 생성하는 단계는, 상기 부분 소스 코드에 객체 생성 구문이 포함되어 있는 경우, 상기 객체 생성 구문에 포함된 파라미터의 FQCN을 획득하여 상기 더미클래스 정보 리스트에 등록하되, 상기 부분 소스 코드로부터 상기 파라미터의 FQCN을 획득할 수 없는 경우에는 최상위 객체(java.lang.Object)를 상기 더미클래스 정보 리스트에 등록할 수 있다.The generating of the dummy class information includes, when the partial source code includes an object creation syntax, obtains an FQCN of a parameter included in the object creation syntax and registers it in the dummy class information list, wherein the partial source code If the FQCN of the parameter cannot be obtained from , the highest level object (java.lang.Object) may be registered in the dummy class information list.
상기 더미클래스 작성 단계는, 상기 더미클래스 더미클래스 정보 리스트에 익명 클래스가 포함되어 있는 경우, 상기 익명 클래스에 대한 바이트코드를 먼저 작성하고, 상기 익명 클래스의 작성이 완료된 이후 비 익명 클래스에 대한 바이트코드를 작성하도록 구성될 수 있다.In the dummy class creation step, when an anonymous class is included in the dummy class dummy class information list, the bytecode for the anonymous class is first written, and then the bytecode for the non-anonymous class is completed after the creation of the anonymous class is completed. can be configured to write
개시되는 실시예들에 따르면, 부분 소스 코드가 참조하는 클래스 및 라이브러리 정보 없이도 부분 소스 코드를 효과적으로 컴파일할 수 있으며, 컴파일된 클래스 기반의 정적 분석에 소요되는 시간을 단축할 수 있다.According to the disclosed embodiments, it is possible to effectively compile the partial source code without class and library information referenced by the partial source code, and it is possible to reduce the time required for static analysis based on the compiled class.
도 1은 자바 컴파일러의 동작을 설명하기 위한 예시도
도 2는 일 실시예에 따른 컴파일 장치를 설명하기 위한 블록도
도 3은 일 실시예에 따른 부분 소스 코드의 컴파일 방법을 설명하기 위한 흐름도
도 4는 일 실시예에 따른 타겟 식별 모듈에서의 더미클래스 대상 리스트 생성 과정을 설명하기 위한 흐름도
도 5는 일 실시예에 따른 더미클래스 정보 리스트 생성 과정 중 임포트 구문에 대한 처리 과정을 상세히 설명하기 위한 흐름도이다.
도 6는 일 실시예에 따른 더미클래스 정보 리스트 생성 과정 중 필드 선언 구문에 대한 처리 과정을 상세히 설명하기 위한 흐름도
도 7 내지 9는 일 실시예에 따른 더미클래스 정보 리스트 생성 과정 중 객체(Object) 생성 구문에 대한 처리 과정을 상세히 설명하기 위한 흐름도
도 10 내지 13은 일 실시예에 따른 더미클래스 정보 리스트 생성 과정 중 메소드(Method) 호출 구문에 대한 처리 과정을 상세히 설명하기 위한 흐름도
도 14는 일 실시예에 따른 더미클래스 정보 리스트 생성 과정 중 파라미터 선언 구문에 대한 처리 과정을 상세히 설명하기 위한 흐름도
도 15는 일 실시예에 따른 더미클래스 정보 리스트 생성 과정 중 변수 선언 구문에 대한 처리 과정을 상세히 설명하기 위한 흐름도
도 16은 일 실시예에 따른 더미클래스 정보 리스트 생성 과정 중 어노테이션 지정 구문에 대한 처리 과정을 상세히 설명하기 위한 흐름도
도 17은 부분 소스 코드의 예시도
도 18은 예시적인 실시예들에서 사용되기에 적합한 컴퓨팅 장치를 포함하는 컴퓨팅 환경을 예시하여 설명하기 위한 블록도1 is an exemplary diagram for explaining the operation of a Java compiler;
2 is a block diagram illustrating a compilation device according to an embodiment;
3 is a flowchart illustrating a method of compiling a partial source code according to an embodiment;
4 is a flowchart illustrating a process of generating a dummy class target list in a target identification module according to an embodiment;
5 is a flowchart for describing in detail a process for an import statement during a process of generating a dummy class information list according to an embodiment.
6 is a flowchart illustrating in detail a process for a field declaration syntax during a process of generating a dummy class information list according to an embodiment;
7 to 9 are flowcharts for explaining in detail a processing process for an object creation syntax during a dummy class information list creation process according to an embodiment;
10 to 13 are flowcharts for explaining in detail a process for a method call syntax during a process of generating a dummy class information list according to an embodiment;
14 is a flowchart illustrating in detail a process for a parameter declaration syntax during a process of generating a dummy class information list according to an embodiment;
15 is a flowchart for explaining in detail a process for a variable declaration syntax during a process of generating a dummy class information list according to an embodiment;
16 is a flowchart for explaining in detail a process for an annotation designation syntax during a process of generating a dummy class information list according to an embodiment;
17 is an exemplary diagram of a partial source code
18 is a block diagram illustrating and describing a computing environment including a computing device suitable for use in example embodiments;
이하, 도면을 참조하여 본 발명의 구체적인 실시형태를 설명하기로 한다. 이하의 상세한 설명은 본 명세서에서 기술된 방법, 장치 및/또는 시스템에 대한 포괄적인 이해를 돕기 위해 제공된다. 그러나 이는 예시에 불과하며 본 발명은 이에 제한되지 않는다.Hereinafter, specific embodiments of the present invention will be described with reference to the drawings. The following detailed description is provided to provide a comprehensive understanding of the methods, apparatus, and/or systems described herein. However, this is merely an example and the present invention is not limited thereto.
본 발명의 실시예들을 설명함에 있어서, 본 발명과 관련된 공지기술에 대한 구체적인 설명이 본 발명의 요지를 불필요하게 흐릴 수 있다고 판단되는 경우에는 그 상세한 설명을 생략하기로 한다. 그리고, 후술되는 용어들은 본 발명에서의 기능을 고려하여 정의된 용어들로서 이는 사용자, 운용자의 의도 또는 관례 등에 따라 달라질 수 있다. 그러므로 그 정의는 본 명세서 전반에 걸친 내용을 토대로 내려져야 할 것이다. 상세한 설명에서 사용되는 용어는 단지 본 발명의 실시예들을 기술하기 위한 것이며, 결코 제한적이어서는 안 된다. 명확하게 달리 사용되지 않는 한, 단수 형태의 표현은 복수 형태의 의미를 포함한다. 본 설명에서, "포함" 또는 "구비"와 같은 표현은 어떤 특성들, 숫자들, 단계들, 동작들, 요소들, 이들의 일부 또는 조합을 가리키기 위한 것이며, 기술된 것 이외에 하나 또는 그 이상의 다른 특성, 숫자, 단계, 동작, 요소, 이들의 일부 또는 조합의 존재 또는 가능성을 배제하도록 해석되어서는 안 된다.In describing the embodiments of the present invention, if it is determined that the detailed description of the known technology related to the present invention may unnecessarily obscure the gist of the present invention, the detailed description thereof will be omitted. And, the terms to be described later are terms defined in consideration of functions in the present invention, which may vary according to intentions or customs of users and operators. Therefore, the definition should be made based on the content throughout this specification. The terminology used in the detailed description is for the purpose of describing embodiments of the present invention only, and should in no way be limiting. Unless explicitly used otherwise, expressions in the singular include the meaning of the plural. In this description, expressions such as “comprising” or “comprising” are intended to indicate certain features, numbers, steps, acts, elements, some or a combination thereof, one or more other than those described. It should not be construed to exclude the presence or possibility of other features, numbers, steps, acts, elements, or any part or combination thereof.
본 발명의 실시예들에 대한 구체적인 설명에 앞서, 일반적인 소스 코드 컴파일러의 동작을 설명하면 도 1과 같다. 도시되는 실시예는 자바 소스 코드(Java Source Code)를 컴파일하기 위한 자바 컴파일러(Java Compiler)를 나타낸 것이다. 그러나 개시되는 실시예들은 본 발명의 권리범위를 벗어나지 않는 범위 내에서 자바 소스 코드가 아닌 다른 언어로 된 컴파일러에도 적용 가능함을 유의한다.Prior to a detailed description of the embodiments of the present invention, the operation of a general source code compiler is illustrated in FIG. 1 . The illustrated embodiment shows a Java compiler for compiling Java source code. However, it should be noted that the disclosed embodiments are also applicable to a compiler in a language other than Java source code within the scope not departing from the scope of the present invention.
도 1에 도시된 예시도에 따른 소스 코드 컴파일러의 동작을 설명하면 다음과 같다.An operation of the source code compiler according to the exemplary diagram shown in FIG. 1 will be described as follows.
① 소스 파일(Source Files)은 컴파일하고자 하는 자바 소스 코드를 가지고 있는 파일로서, *.java 형태의 확장자를 가진다. ① Source Files are files containing the Java source code to be compiled, and have a *.java extension.
② 바이트코드 클래스(Bytecode classes)는 자바 가상 머신(Java Virtual Machine; JVM) 상에서 실행되는 명령어를 가지고 있는 클래스 파일로, 자바 가상 머신에 의해 실제 기계어 코드로 변역되어 실행된다. ② Bytecode classes are class files that have instructions to be executed on the Java Virtual Machine (JVM), and are translated and executed by the Java Virtual Machine into actual machine code.
③ 라이브러리(Library Files)는 바이트코드를 갖는 클래스 파일들의 구조적 묶음 파일이다.③ Library Files are structured bundle files of class files with bytecode.
④ 컴파일된 바이트코드 클래스(Compiled Bytecode Classes)란 자바 컴파일러에 의해 컴파일된 바이트코드 파일이다. ④ Compiled Bytecode Classes are bytecode files compiled by the Java compiler.
도 1에 도시된 바와 같이 소스 코드 컴파일러는 ②바이트코드 클래스와 ③라이브러리를 참조하여 ①소스 파일을 컴파일함으로써 ④컴파일된 바이트코드 클래스를 생성하게 된다. 즉, 소스 코드 컴파일러는 소스 파일을 컴파일할 때 해당 소스 파일 내의 소스 코드가 참조하는 바이트코드 클래스 및 라이브러리를 반드시 지정하여야 한다. 만약 참조하는 바이트코드 클래스 또는 라이브러리가 지정된 경로상에 없다면 소스 코드 컴파일러는 소스 파일에 대한 컴파일을 수행하지 못한다.As shown in FIG. 1 , the source code compiler generates (4) compiled bytecode classes by compiling (1) source files with reference to (2) bytecode classes and (3) libraries. That is, when compiling a source file, the source code compiler must designate the bytecode class and library referenced by the source code in the source file. If the referenced bytecode class or library is not on the specified path, the source code compiler cannot compile the source file.
도 2는 일 실시예에 따른 컴파일 장치(200)를 설명하기 위한 블록도이다. 일 실시예에 따른 컴파일 장치(200)는 부분 소스 코드(partial source code)를 입력받아 이에 대한 컴파일을 수행하는 장치를 의미한다. 개시되는 실시예들에서 부분 소스 코드란 컴파일을 위하여 별도의 바이트코드 클래스 또는 라이브러리 중 하나 이상을 참조하여야 하는 소스 코드를 의미한다. 일 실시예에 따른 컴파일 장치(200)는 이러한 부분 소스 코드의 컴파일 시 상술한 바이트코드 클래스 또는 라이브러리를 참조하는 것이 아니라, 필요한 바이트코드 클래스 또는 라이브러리에 대응되는 더미클래스(dummy class)를 생성하고 이를 이용하여 상기 부분 소스 코드의 컴파일을 수행하도록 구성된다.2 is a block diagram illustrating the
도시된 바와 같이, 일 실시예에 따른 컴파일 장치(200)는 소스 파싱 모듈(202), 타겟 식별 모듈(204), 더미클래스 정보 생성 모듈(206), 더미클래스 작성 모듈(208) 및 컴파일 모듈(210)을 포함한다.As shown, the
소스 파싱 모듈(202)은 부분 소스 코드를 입력받아 이를 파싱하고(1차 파싱), 이로부터 소스 심볼 테이블(Source Symbol Table) 및 더미클래스 후보 리스트(Dummy Class Candidate List)를 생성한다. 구체적으로 소스 파싱 모듈(202)은 입력된 부분 소스 코드로부터 추상 구문 트리(AST; Abstract Syntax Tree)를 구성하고, 구성된 AST를 이용하여 상기 소스 심볼 테이블 및 더미클래스 후보 리스트를 생성할 수 있다.The
타겟 식별 모듈(204)은 상기 더미클래스 후보 리스트에 포함된 더미클래스 후보들 중 실제로 더미클래스를 생성할 대상 클래스의 리스트(Dummy Class Target List)를 생성한다. The
더미클래스 정보 생성 모듈(206)은 부분 소스 코드를 2차 파싱하고 이로부터 더미클래스 정보 리스트(Dummy Class Information List)를 생성한다. 즉, 상기 더미클래스 정보 리스트는 실제 생성이 필요한 대상 클래스들의 정보가 저장된 리스트이다. 일 실시예에서, 더미클래스 정보 생성 모듈(206)은 소스 심볼 테이블 및 더미클래스 대상 리스트를 참조하여 상기 부분 소스 코드를 2차 파싱함으로써 식별된 상기 대상 클래스들의 정보를 획득하고, 이로부터 상기 더미클래스 정보 리스트를 생성할 수 있다.The dummy class information generation module 206 secondary parses the partial source code and generates a dummy class information list therefrom. That is, the dummy class information list is a list in which information of target classes that need to be actually created is stored. In one embodiment, the dummy class information generating module 206 obtains information of the identified target classes by secondary parsing the partial source code with reference to the source symbol table and the dummy class target list, and from this, the dummy class You can create a list of information.
더미클래스 작성 모듈(208)은 더미클래스 정보 생성 모듈(206)에서 생성된 더미클래스 정보 리스트를 참조하여 실제 더미클래스를 생성한다. 더미클래스 작성 모듈(208)에서 생성되는 더미클래스는 실제 클래스와 동일한 외형 및 구조를 가지는 일종의 껍데기 클래스이다.The dummy
컴파일 모듈(210)은 상기 더미클래스를 이용하여 상기 부분 소스 코드에 대한 컴파일을 수행한다.The
도 3은 일 실시예에 따른 부분 소스 코드의 컴파일 방법(300)을 설명하기 위한 흐름도이다. 도 3에 도시된 방법(300)은 예를 들어 전술한 컴파일 장치(200)에 의하여 수행될 수 있다. 도시된 흐름도에서는 상기 방법을 복수 개의 단계로 나누어 기재하였으나, 적어도 일부의 단계들은 순서를 바꾸어 수행되거나, 다른 단계와 결합되어 함께 수행되거나, 생략되거나, 세부 단계들로 나뉘어 수행되거나, 또는 도시되지 않은 하나 이상의 단계가 부가되어 수행될 수 있다.3 is a flowchart illustrating a
단계 302에서, 소스 파싱 모듈(202)은 부분 소스 코드를 입력받아 이를 파싱하고(1차 파싱), 이로부터 소스 심볼 테이블(Source Symbol Table) 및 더미클래스 후보 리스트(Dummy Class Candidate List)를 생성한다. In
자바 소스 코드는 패키지(package) 선언 구문, 임포트(import) 구문, 클래스(class) 또는 인터페이스(interface) 선언 구문, 콘스트럭터(constructor) 선언 구문, 필드(field) 선언 구문, 메소드(method) 호출 구문, 메소드(method) 선언 구문, 파라미터(parameter) 선언 구문, 변수(variable) 선언 구문, 어노테이션(annotation) 지정 구문 등으로 구분할 수 있다. 소스 심볼 테이블은 해당 부분 소스 코드에서 정의 및 사용되는 패키지, 클래스, 인터페이스, 임포트, 필드, 메소드, 변수, 파라미터 등의 정보를 기록한 테이블이다. 표 1은 일 실시예에 따른 소스 심볼 테이블의 구조를 나타낸 것이다.Java source code includes package declaration syntax, import syntax, class or interface declaration syntax, constructor declaration syntax, field declaration syntax, method call It can be divided into syntax, method declaration syntax, parameter declaration syntax, variable declaration syntax, annotation designation syntax, and the like. The source symbol table is a table in which information such as packages, classes, interfaces, imports, fields, methods, variables, and parameters defined and used in the corresponding partial source code is recorded. Table 1 shows the structure of a source symbol table according to an embodiment.
표 2는 표 1에 기재된 소스 심볼 테이블의 Imports 항목과 연결된 리스트를 예시한 것이다.Table 2 illustrates a list linked to the Imports item of the source symbol table listed in Table 1.
표 3은 표 1에 기재된 소스 심볼 테이블의 Inner Classes 항목과 연결된 리스트를 예시한 것이다.Table 3 illustrates a list linked to the Inner Classes item of the source symbol table listed in Table 1.
표 4는 표 1에 기재된 소스 심볼 테이블의 Fields 항목과 연결된 리스트를 예시한 것이다.Table 4 illustrates a list linked to the Fields item of the source symbol table listed in Table 1.
표 5는 표 1에 기재된 소스 심볼 테이블의 Variables 항목과 연결된 리스트를 예시한 것이다.Table 5 exemplifies the list linked to the Variables item of the source symbol table listed in Table 1.
표 6은 표 1에 기재된 소스 심볼 테이블의 Methods 항목과 연결된 리스트를 예시한 것이다.Table 6 illustrates a list linked to the Methods item of the source symbol table listed in Table 1.
표 7은 표 6에 기재된 리스트의 Parameters 항목과 연결된 리스트를 예시한 것이다.Table 7 exemplifies the list connected to the Parameters item of the list listed in Table 6.
상기와 같은 소스 심볼 테이블은 부분 소스 코드를 구성하는 .java 파일의 개수만큼 생성된다.The source symbol table as described above is created as many as the number of .java files constituting the partial source code.
다음으로, 더미클래스 후보 리스트는 부분 소스 코드에서 사용되는 클래스들의 FQCN(Fully-Qualified Class Name)을 기록한 리스트로서, 부분 소스 코드의 컴파일을 위해 더미클래스를 생성할 필요성이 있는 후보 클래스들의 집합(목록)을 의미한다. 더미클래스 후보 리스트는 소스 심볼 테이블과는 달리 부분 소스 코드 전체에 대해 하나만 생성될 수 있다. 일 실시예에서, 소스 파싱 모듈(202)은 부분 소스 코드에서 임포트된 클래스의 FQCN, 선언된 필드 타입에 대한 FQCN, 복합 방식의 호출에 대응되어 생성된 익명 클래스의 FQCN, 선언된 파라미터 타입에 대한 FQCN, 선언된 변수 타입에 대한 FQCN, 및 지정된 어노테이션의 타입에 대한 FQCN 등을 더미클래스 후보 리스트에 등록할 수 있다. Next, the dummy class candidate list is a list that records the Fully-Qualified Class Name (FQCN) of classes used in the partial source code. ) means Unlike the source symbol table, only one dummy class candidate list can be generated for the entire partial source code. In one embodiment, the
표 8은 일 실시예에 따른 더미클래스 후보 리스트를 예시한 것이다.Table 8 illustrates a dummy class candidate list according to an embodiment.
이하 구체적인 소스 심볼 테이블 및 더미클래스 후보 리스트 생성 과정을 설명하면 다음과 같다.Hereinafter, a detailed process of generating a source symbol table and a dummy class candidate list will be described.
파싱된 부분 소스 코드에 패키지 선언 구문이 포함되어 있는 경우, 소스 파싱 모듈(202)은 패키지 이름을 소스 심볼 테이블에 등록한다.When the parsed partial source code includes a package declaration syntax, the
파싱된 부분 소스 코드에 임포트 구문이 포함되어 있는 경우, 소스 파싱 모듈(202)은 임포트 선언된 클래스의 FQCN 및 임포트 유형(static 및 asterisk 지정 여부)을 확인하여 소스 심볼 테이블의 임포트 항목(표 2 참조)에 기록한다. 또한 상기 임포트 유형 확인 결과 아스테리크(*, asterisk)가 지정되어 있지 않은 경우, 소스 파싱 모듈(202)은 임포트된 클래스의 FQCN을 더미클래스 후보 리스트에 등록한다.If the parsed partial source code includes an import statement, the
파싱된 부분 소스 코드에 클래스 또는 인터페이스 선언 구문이 포함되어 있는 경우, 소스 파싱 모듈(202)은 선언된 클래스 또는 인터페이스가 이너 클래스(Inner Class)인지 여부를 판단하고, 이너 클래스인 경우 해당 클래스 이름을 소스 심볼 테이블의 이너클래스 항목(표 3 참조)에 기록한다.When the parsed partial source code contains a class or interface declaration syntax, the
파싱된 부분 소스 코드에 콘스트럭터 선언 구문이 포함되어 있는 경우, 소스 파싱 모듈(202)은 해당 콘스트럭터의 하나 이상의 파라미터가 포함되어 있는지의 여부를 판단하고, 포함되어 있는 경우 각 파라미터 타입들을 생성자 메소드 이름과 함께 소스 심볼 테이블의 메소드 항목(표 6 및 7 참조)에 기록한다.When the parsed partial source code includes a constructor declaration syntax, the
파싱된 부분 소스 코드에 필드 선언 구문이 포함되어 있는 경우, 소스 파싱 모듈(202)은 선언된 타입에 대한 FQCN을 확인하고 필드 이름 및 FQCN을 소스 심볼 데이블의 필드 항목(표 4 참조)에 기록한다. 또한 소스 파싱 모듈(202)은 상기 확인된 FQCN을 더미클래스 후보 리스트에 등록한다.If the parsed partial source code includes a field declaration syntax, the
파싱된 부분 소스 코드에 메소드 호출 구문이 포함되어 있는 경우, 소스 파싱 모듈(202)은 해당 메소드 호출이 복합 방식의 호출인지의 여부를 판단한다. 이때 복합 방식의 호출(composite call) 이란 메소드 호출의 결과에 대하여 다시 메소드를 호출하는 방식(예를 들어, data.first().second(); 등과 같은 호출 방식)을 의미한다. 만약 복합 방식 호출인 경우, 소스 파싱 모듈(202)은 해당 호출에 대응되는 익명 클래스(anonymous class)를 생성하고, 생성된 익명 클래스의 FQCN을 더미클래스 후보 리스트에 등록한다. 이때, 소스 파싱 모듈(202)은 전체 부분 소스 코드에 대하여 하나의 익명 클래스를 사용할 수도 있고, 클래스별로 서로 다른 익명 클래스를 사용할 수도 있고, 또는 각 복합 방식의 호출별로 서로 다른 익명 클래스를 사용할 수도 있다. 즉, 생성할 메소드의 이름, 파라미터 개수, 파라미터 유형에 따라 새로운 익명 클래스를 생성하여 이를 더미클래스 후보 리스트에 등록할 수 있다. 또한 소스 파싱 모듈(202)은 상기와 같이 익명 클래스가 더미클래스 후보 리스트에 등록된 경우 해당 복합 메소드 호출을 변수 하여 익명 클래스의 FQCN과 함께 소스 심볼 테이블의 Variables 항목(표 5 참조)에 기록한다. 예를 들어 다음과 같은 복합 호출 구문이 포함되어 있다고 가정하자.When the parsed partial source code includes a method call syntax, the
data.first.second();data.first.second();
이 경우 소스 심볼 테이블의 Variable 항목에 기록되는 variable 이름 및 FQCN은 다음과 같이 구성될 수 있다.In this case, the variable name and FQCN recorded in the Variable item of the source symbol table can be composed as follows.
variable 이름: data.first()variable name: data.first()
FQCN: anonymous.Anonymous (생성된 익명 클래스의 FQCN에 대한 예시)FQCN: anonymous.Anonymous (example of FQCN of generated anonymous class)
파싱된 부분 소스 코드에 메소드 선언 구문이 포함되어 있는 경우, 소스 파싱 모듈(202)은 선언된 메소드 이름과 파라미터 타입을 소스 심볼 테이블의 Methods 항목(표 6 및 7 참조)에 기록한다.When a method declaration syntax is included in the parsed partial source code, the
파싱된 부분 소스 코드에 파라미터 선언 구문이 포함되어 있는 경우, 소스 파싱 모듈(202)은 선언된 파라미터 타입에 대한 FQCN을 소스 심볼 테이블로부터 획득한다. 상기 FQCN이 획득되면, 소스 파싱 모듈(202)은 파라미터 이름을 변수 이름으로 하여 상기 FQCN과 함께 소스 심볼 항목의 Variables 항목(표 5 참조)에 기록한다. 또한 소스 파싱 모듈(202)은 상기 획득된 파라미터 타입에 대한 FQCN을 더미클래스 후보 리스트에 등록한다.When the parsed partial source code includes a parameter declaration syntax, the
파싱된 부분 소스 코드에 변수 선언 구문이 포함되어 있는 경우, 소스 파싱 모듈(202)은 선언된 변수의 타입에 대한 FQCN을 소스 심볼 테이블로부터 획득하고, 변수 이름 및 획득된 FQCN을 소스 심볼 항목의 Variables 항목(표 5 참조)에 기록한다. 또한 소스 파싱 모듈(202)은 상기 획득된 변수 타입에 대한 FQCN을 더미클래스 후보 리스트에 등록한다.When the parsed partial source code includes a variable declaration syntax, the
파싱된 부분 소스 코드에 어노테이션 지정 구문이 포함되어 있는 경우, 소스 파싱 모듈(202)은 지정된 어노테이션의 타입에 대한 FQCN을 소스 심볼 테이블로부터 획득하고 상기 획득된 어노테이션 타입에 대한 FQCN을 더미클래스 후보 리스트에 등록한다.When the parsed partial source code includes an annotation specification syntax, the
다음으로, 단계 304에서 타겟 식별 모듈(204)은 상기 더미클래스 후보 리스트에 포함된 더미클래스 후보들 중 실제로 더미클래스를 생성할 대상 클래스의 리스트(Dummy Class Target List)를 생성한다. 구체적으로 타겟 식별 모듈 단계 302에서 생성된 더미클래스 후보 리스트에 포함된 후보 클래스들 각각에 대하여 더미클래스 생성 필요성이 있는지의 여부를 판단한다. 일 실시예에서, 사용자는 특정 참조 클래스 또는 라이브러리를 더미클래스 작성 제외 대상으로 지정할 수 있다. 예를 들어, 부분 소스 코드의 실행에 반드시 필요한 프로그램 코드를 포함하는 참조 클래스 또는 라이브러리의 경우, 더미클래스만으로는 부분 소스 코드를 실행하는 것이 불가능하다. 따라서 이와 같은 경우 사용자는 필요한 참조 클래스 또는 라이브러리를 더미클래스 작성 대상에서 제외할 수 있으며, 이 경우 타겟 식별 모듈(204)은 지정된 참조 클래스 또는 라이브러리를 제외한 나머지 클래스 또는 라이브러리에 대해서만 더미클래스 생성 대상(target)으로 지정하게 된다.Next, in
도 4는 일 실시예에 따른 더미클래스 대상 리스트 생성 과정을 설명하기 위한 흐름도이다. 4 is a flowchart illustrating a process of generating a dummy class target list according to an embodiment.
단계 402에서, 타겟 식별 모듈(204)은 소스 파싱 모듈(202)에서 생성된 더미클래스 후보 리스트를 입력받는다.In
단계 404에서, 타겟 식별 모듈(204)은 더미클래스 후보 리스트에 포함된 더미클래스 후보 중 하나를 선택한다.In
단계 406에서, 타겟 식별 모듈(204)은 선택된 더미클래스 후보가 자바 가상 머신(JVM)에서 제공되는 클래스인지의 여부를 판단한다.In
만약 상기 판단 결과 자바 가상 머신에서 제공되는 클래스가 아닌 경우, 다음으로 단계 408에서, 타겟 식별 모듈(204)은 선택된 더미클래스 후보가 부분 소스 코드에 포함된 클래스인지의 여부를 판단한다.If the determination result is not the class provided by the Java virtual machine, next in
만약 상기 판단 결과 부분 소스 코드에 포함된 클래스가 아닌 경우, 다음으로 단계 410에서, 타겟 식별 모듈(204)은 사용자에 의해 예외 대상으로 지정된 참조 클래스 또는 라이브러리에 포함된 클래스인지의 여부를 판단한다.If the determination result is not a class included in the partial source code, next in
만약 상기 판단 결과 지정된 참조 클래스 또는 라이브러리에 포함된 클래스가 아닌 경우, 단계 412에서 타겟 식별 모듈(204)은 선택된 더미클래스 후보를 더미클래스 대상 리스트에 추가한다.If the determination result is not the designated reference class or the class included in the library, the
그러나 이와 달리 선택된 클래스가 자바 가상 머신에서 제공되는 클래스이거나, 부분 소스 코드에 포함된 클래스이거나, 또는 예외 대상으로 지정된 참조 클래스 또는 라이브러리에 포함된 클래스인 경우, 타겟 식별 모듈(204)은 선택된 더미클래스 후보를 삭제하고 단계 414로 이동한다.However, if the selected class is a class provided by the Java virtual machine, a class included in the partial source code, or a class included in a reference class or library designated as an exception target, the
단계 414에서, 타겟 식별 모듈(204)은 더미클래스 후보 리스트에 남은 더미클래스 후보가 존재하는지의 여부를 판단한다. 만약 존재하는 경우 404 단계로 이동하여 남은 더미클래스 후보에 대하여 406 단계 이하를 반복 수행하고, 존재하지 않는 경우 본 과정은 종료된다.In
다음으로 단계 306에서, 더미클래스 정보 생성 모듈(206)은 부분 소스 코드를 2차 파싱하고 이로부터 더미클래스 정보 리스트(Dummy Class Information List)를 생성한다. 일 실시예에서, 더미클래스 정보 생성 모듈(206)은 소스 심볼 테이블 및 더미클래스 대상 리스트를 참조하여 상기 부분 소스 코드를 2차 파싱함으로써 상기 더미클래스 정보 리스트를 생성할 수 있다.Next, in
더미클래스 정보 생성 모듈(206)에서 부분 소스 코드를 재차 파싱(2차 파싱)하는 이유는, 소스 파싱 모듈(202)에서의 1차 파싱만으로는 부분 소스 코드의 전체 구조를 파악하는 데 한계가 있기 때문이다. 예를 들어, 부분 소스 코드 중 A 구문이 B 메소드를 호출한다고 가정하자. 소스 코드의 파싱은 순차적으로 이루어지므로, 아직 B 메소드가 파싱되기 전일 경우에는 B 메소드의 상세 정보를 알 수 없다. 따라서 소스 파싱 모듈(202)은 소스 코드에 대한 1차 파싱을 통해 2차 파싱에 필요한 참조 정보를 소스 심볼 테이블에 기록하고, 더미클래스 정보 생성 모듈(206)은 상기 소스 심볼 테이블을 참조하여 더미클래스 정보 리스트를 생성하게 된다.The reason for parsing the partial source code again (secondary parsing) in the dummy class information generating module 206 is that there is a limit to grasping the entire structure of the partial source code only by the primary parsing in the
표 9는 일 실시예에 따른 더미클래스 정보 리스트(Dummy Class Information List)를 설명하기 위한 예시이다. 표 9에 기재된 바와 같이, 더미클래스 정보 리스트는 각각의 더미클래스 생성 대상 클래스의 패키지 이름, 클래스 이름, 상위클래스 이름, 선언이 필요한 인터페이스 목록, 제네릭스(Generics)의 타입 인수(Type Arguments) 목록, 생성자 목록, 어노테이션 클래스 여부, 예외 클래스 여부, 필드 정의 필요 목록, 메소드 정의 필요 목록 등이 포함된다.Table 9 is an example for explaining a dummy class information list according to an embodiment. As shown in Table 9, the dummy class information list includes the package name, class name, superclass name, interface list that requires declaration, the type argument list of generics of each dummy class creation target class, It contains a list of constructors, whether it is annotated class, whether it is an exception class, a list that requires field definitions, and a list that requires method definitions.
표 10은 표 9에 기재된 더미클래스 정보 리스트의 Interfaces 항목과 연결된 리스트를 예시한 것이다.Table 10 illustrates a list connected to the Interfaces item of the dummy class information list shown in Table 9.
표 11은 표 9에 기재된 더미클래스 정보 리스트의 타입 인수(Type Arguments) 항목과 연결된 리스트를 예시한 것이다.Table 11 exemplifies a list connected with the Type Arguments item of the dummy class information list shown in Table 9.
표 12는 표 9에 기재된 더미클래스 정보 리스트의 생성자(Constructors) 항목과 연결된 리스트를 예시한 것이다.Table 12 exemplifies a list connected to the Constructors item of the dummy class information list shown in Table 9.
표 13은 표 9에 기재된 더미클래스 정보 리스트의 메소드(Methods) 항목과 연결된 리스트를 예시한 것이다.Table 13 illustrates a list connected to the Methods item of the dummy class information list in Table 9.
표 14는 표 12 및 표 13에 기재된 리스트의 Parameters 항목과 각각 연결된 리스트를 예시한 것이다.Table 14 exemplifies a list connected to the Parameters item of the list listed in Tables 12 and 13, respectively.
표 15는 표 13에 기재된 리스트의 Exceptions 항목과 연결된 리스트를 예시한 것이다.Table 15 illustrates a list connected to the Exceptions item of the list listed in Table 13.
표 16은 표 9에 기재된 더미클래스 정보 리스트의 필드(Fields) 항목과 연계된 리스트를 예시한 것이다.Table 16 illustrates a list associated with the Fields item of the dummy class information list shown in Table 9.
더미클래스 정보 생성 모듈(206)은 부분 소스 코드의 2차 파싱을 통해 부분 소스 코드 중 임포트(Import) 구문, 필드(Field) 선언 구문, 객체(Object) 생성 구문, 메소드(Method) 호출 구문, 파라미터(Parameter) 선언 구문, 변수(Variable) 선언 구문 및 어노테이션(Annotation) 지정 구문을 식별하고, 각 구문 별 처리를 통하여 더미클래스 정보 리스트를 생성한다.The dummy class information generation module 206 performs the import syntax, the field declaration syntax, the object creation syntax, the method call syntax, and parameters among the partial source code through secondary parsing of the partial source code. (Parameter) declaration syntax, variable (Variable) declaration syntax, and annotation designation syntax are identified, and a dummy class information list is created through processing for each syntax.
도 5는 일 실시예에 따른 더미클래스 정보 리스트 생성 과정 중 임포트 구문에 대한 처리 과정을 상세히 설명하기 위한 흐름도이다.5 is a flowchart for describing in detail a process for an import statement during a process of generating a dummy class information list according to an embodiment.
단계 502에서, 더미클래스 정보 생성 모듈(206)은 부분 소스 코드 내의 임포트 구문을 식별한다.In
단계 504에서, 더미클래스 정보 생성 모듈(206)은 식별된 임포트 구문 내의 임포트된 클래스가 더미클래스 생성 대상인지의 여부를 판단한다. 구체적으로, 더미클래스 정보 생성 모듈(206)은 더미클래스 대상 리스트를 참조하여, 임포트된 클래스가 더미클래스 대상 리스트에 포함된 클래스인 경우 더미클래스 생성 대상으로 판단하게 된다. 만약 상기 판단 결과 더미클래스 생성 대상이 아닌 경우 본 과정은 종료된다.In
상기 판단 결과 더미클래스 생성 대상인 경우, 단계 506에서 더미클래스 정보 생성 모듈(206)은 해당 클래스에 대한 정보를 더미클래스 정보 리스트에 추가한다. 구체적으로 더미클래스 정보 생성 모듈(206)은 504 단계에서 더미클래스 생성 대상으로 판단된 클래스에 대한 정보가 더미클래스 정보 리스트에 기 존재하는지 여부를 판단하고, 존재하지 않는 경우 해당 클래스 정보를 더미클래스 정보 리스트에 추가하게 된다.If it is determined as a result of the determination that the dummy class is to be generated, the dummy class information generating module 206 adds information about the corresponding class to the dummy class information list in
도 6는 일 실시예에 따른 더미클래스 정보 리스트 생성 과정 중 필드 선언 구문에 대한 처리 과정을 상세히 설명하기 위한 흐름도이다.6 is a flowchart illustrating in detail a process for a field declaration syntax during a process of generating a dummy class information list according to an embodiment.
단계 602에서, 더미클래스 정보 생성 모듈(206)은 부분 소스 코드 내의 필드 선언 구문을 식별한다.In
단계 604에서, 더미클래스 정보 생성 모듈(206)은 식별된 필드 선언 구문에서 선언된 타입(type)에 대한 FQCN을 소스 심볼 테이블로부터 획득한다.In
단계 606에서, 더미클래스 정보 생성 모듈(206)은 획득된 FQCN이 더미클래스 생성 대상인지의 여부를 판단한다. 구체적으로, 더미클래스 정보 생성 모듈(206)은 더미클래스 대상 리스트를 참조하여, 획득된 FQCN이 더미클래스 대상 리스트에 포함된 클래스인 경우 더미클래스 생성 대상으로 판단하게 된다. 만약 상기 판단 결과 더미클래스 생성 대상이 아닌 경우 본 과정은 종료된다.In
상기 판단 결과 더미클래스 생성 대상인 경우, 단계 608에서 더미클래스 정보 생성 모듈(206)은 해당 클래스에 대한 정보를 더미클래스 정보 리스트에 추가한다. 구체적으로 더미클래스 정보 생성 모듈(206)은 606 단계에서 더미클래스 생성 대상으로 판단된 클래스에 대한 정보가 더미클래스 정보 리스트에 기 존재하는지 여부를 판단하고, 존재하지 않는 경우 해당 클래스 정보를 더미클래스 정보 리스트에 추가하게 된다.As a result of the determination, if the dummy class is to be generated, the dummy class information generating module 206 adds information about the corresponding class to the dummy class information list in
도 7 내지 9는 일 실시예에 따른 더미클래스 정보 리스트 생성 과정 중 객체(Object) 생성 구문에 대한 처리 과정을 상세히 설명하기 위한 흐름도이다.7 to 9 are flowcharts for explaining in detail a processing process for an object creation syntax during a dummy class information list creation process according to an embodiment.
단계 702에서, 더미클래스 정보 생성 모듈(206)은 부분 소스 코드 내의 객체 생성 구문을 식별한다.In
단계 704에서, 더미클래스 정보 생성 모듈(206)은 식별된 객체 생성 구문에서 선언된 타입(type)에 대한 FQCN을 소스 심볼 테이블로부터 획득한다.In
단계 706에서, 더미클래스 정보 생성 모듈(206)은 획득된 FQCN이 더미클래스 생성 대상인지의 여부를 판단한다. 구체적으로, 더미클래스 정보 생성 모듈(206)은 더미클래스 대상 리스트를 참조하여, 획득된 FQCN이 더미클래스 대상 리스트에 포함된 클래스인 경우 더미클래스 생성 대상으로 판단하게 된다. 만약 상기 판단 결과 더미클래스 생성 대상이 아닌 경우 본 과정은 종료된다.In
상기 판단 결과 더미클래스 생성 대상인 경우, 단계 708에서 더미클래스 정보 생성 모듈(206)은 해당 객체 생성 구문의 생성자에 제네릭스(Generics)의 타입 인수(Type Parameter)가 존재하는지 여부를 판단한다. 자바에서 제네릭스의 타입 인수는 ArrayList<String>과 같이 <>을 이용하여 지정될 수 있다. As a result of the determination, if the dummy class is to be generated, in
만약 상기 708 단계의 판단 결과 제네릭스의 타입 인수가 존재하는 경우, 단계 710에서 더미클래스 정보 생성 모듈(206)은 706 단계에서 더미클래스 생성 대상으로 판단된 클래스에 대한 정보를 더미클래스 정보 리스트에 생성한다. 만약 상기 708 단계의 판단 결과 제네릭스의 타입 인수가 존재하지 않는 경우에는 718 단계로 이동한다.If it is determined in
단계 712에서, 더미클래스 정보 생성 모듈(206)은 객체 생성 구문으로부터 제네릭스의 타입 인수를 획득한다.In
단계 714에서, 더미클래스 정보 생성 모듈(206)은 712 단계에서 획득된 제네릭스의 타입 인수로부터 선언된 타입의 FQCN을 획득한다.In
단계 716에서, 더미클래스 정보 생성 모듈(206)은 714 단계에서 획득된 FQCN을 이용하여 더미클래스 정보 리스트의 타입 인수(Type Arguments) 항목을 등록한다(표 11 참조).In
단계 718에서, 더미클래스 정보 생성 모듈(206)은 해당 객체 생성 구문의 생성자에 파라미터(parameter)가 존재하는지 여부를 판단한다.In
만약 상기 718 단계의 판단 결과 파라미터가 존재하는 경우, 단계 720에서 더미클래스 정보 생성 모듈(206)은 706 단계에서 더미클래스 생성 대상으로 판단된 클래스에 대한 정보를 더미클래스 정보 리스트에 생성한다. 만약 상기 710 단계를 통하여 해당 클래스 정보가 기 생성된 경우 본 과정은 생략될 수 있다. 만약 상기 718 단계의 판단 결과 파라미터가 존재하지 않는 경우에는 728 단계로 이동한다.If the parameter exists as a result of the determination in
단계 722에서, 더미클래스 정보 생성 모듈(206)은 객체 생성 구문으로부터 파라미터의 타입 정보를 획득한다. In
단계 724에서, 더미클래스 정보 생성 모듈(206)은 722 단계에서 획득된 파라미터의 타입 정보로부터 선언된 타입의 FQCN을 획득한다. 만약 파라미터의 FQCN을 알 수 없는 경우, 더미클래스 생성 모듈은 모든 객체의 최상위 객체인 “java.lang.Object”를 지정할 수 있다.In
단계 726에서, 더미클래스 정보 생성 모듈(206)은 724 단계에서 획득된 FQCN을 이용하여 더미클래스 정보 리스트의 파라미터(Parameters) 항목을 등록한다(표 12 및 표 14 참조).In
단계 728에서, 더미클래스 정보 생성 모듈(206)은 해당 객체 생성 구문이 익명클래스 생성 방식으로 생성되었는지 여부를 판단한다.In
만약 상기 728 단계의 판단 결과 익명클래스 생성 방식으로 생성된 경우, 단계 730에서 더미클래스 정보 생성 모듈(206)은 706 단계에서 더미클래스 생성 대상으로 판단된 클래스에 대한 정보를 더미클래스 정보 리스트에 생성한다. 만약 상기 710 단계 또는 720 단계를 통하여 해당 클래스 정보가 기 생성된 경우 본 과정은 생략될 수 있다. 만약 상기 728 단계의 판단 결과 익명 클래스 생성 방식으로 생성되지 않은 경우 본 단계는 종료된다.If it is determined in
단계 732에서, 더미클래스 정보 생성 모듈(206)은 부분 소스 코드 중 익명클래스의 정의(body) 부분을 탐색한다.In
단계 734에서, 더미클래스 정보 생성 모듈(206)은 탐색된 정의 부분이 메소드 선언 구문인지의 여부를 판단한다. 만약 상기 판단 결과 탐색된 정의 부분이 메소드 선언 구문이 아닌 경우 본 단계는 종료된다.In
만약 상기 판단 결과 탐색된 정의 부분이 메소드 선언 구문인 경우, 단계 736에서 더미클래스 정보 생성 모듈(206)은 해당 메소드의 선언된 파라미터 타입(parameter type), 리턴 타입(return type) 및 예외 타입(exception type)의 FQCN을 획득한다.If the found definition part is a method declaration syntax as a result of the determination, in
단계 738에서, 더미클래스 정보 생성 모듈(206)은 상기 736 단계에서 획득된 FQCN들을 이용하여 더미클래스 정보 리스트의 메소드(Methods) 항목을 등록한다(표 13 내지 15 참조).In
도 10 내지 13은 일 실시예에 따른 더미클래스 정보 리스트 생성 과정 중 메소드(Method) 호출 구문에 대한 처리 과정을 상세히 설명하기 위한 흐름도이다.10 to 13 are flowcharts for explaining in detail a process for a method call syntax during a process of generating a dummy class information list according to an embodiment.
단계 1002에서, 더미클래스 정보 생성 모듈(206)은 부분 소스 코드 내의 메소드 호출 구문을 식별한다.In
단계 1004에서, 더미클래스 정보 생성 모듈(206)은 식별된 메소드 호출 구문에서 메소드를 소유한 대상을 식별한다. In
단계 1006에서, 더미클래스 정보 생성 모듈(206)은 식별된 대상이 클래스 또는 객체인지의 여부를 판단한다. In
만약 상기 판단 결과 식별된 대상이 클래스 또는 객체인 경우, 다음으로 단계 1008에서 더미클래스 정보 생성 모듈(206)은 식별된 대상이 임포트된 클래스인지의 여부를 판단한다.If the identified target is a class or object as a result of the determination, then, in
만약 상기 판단 결과 식별된 대상이 임포트된 클래스인 경우, 다음으로 단계 1010에서 더미클래스 정보 생성 모듈(206)은 해당 임포트된 클래스의 선언된 타입에 대한 FQCN을 소스 심볼 테이블로부터 획득한다.If the identified object is an imported class as a result of the determination, then, in
단계 1012에서, 더미클래스 정보 생성 모듈(206)은 획득된 FQCN이 더미클래스 생성 대상인지의 여부를 판단한다. 만약 상기 판단 결과 더미클래스 생성 대상인 경우 본 과정은 종료된다.In
단계 1014에서, 더미클래스 정보 생성 모듈(206)은 식별된 메소드의 정보를 더미클래스 정보 리스트에 등록한다. 구체적으로, 더미클래스 정보 생성 모듈(206)은 메소드 소유 대상인 클래스의 Methods 항목(표 13 내지 15 참조)에 해당 메소드의 정보를 등록하게 된다. 등록되는 정보에는 메소드의 파라미터 타입(parameter type), 리턴 타입(return type), 예외 타입(exception type) 정보를 포함한다. 만약 예외 타입이 더미클래스 생성 대상인 경우, 더미클래스 정보 생성 모듈(206)은 해당 예외 타입에 대응되는 더미클래스 정보를 더미클래스 정보 리스트에 등록한다. 이 경우 더미클래스 정보 중 예외 클래스 정보는 True로 기록된다(Exception=True).In
한편, 상기 1006 단계에서의 판단 결과 식별된 대상이 클래스 또는 객체가 아닌 경우, 단계 1016에서 더미클래스 정보 생성 모듈(206)은 식별된 대상이 다른 메소드의 리턴 객체인지의 여부를 판단한다(즉, 복합 방식 호출인 경우).On the other hand, if the identified target is not a class or object as a result of the determination in
상기 판단 결과 식별된 대상이 다른 메소드의 리턴 객체인 경우, 단계 1018에서 더미클래스 정보 생성 모듈(206)은 리턴 객체의 FQCN을 획득한다.If the identified target is a return object of another method as a result of the determination, the dummy class information generation module 206 acquires the FQCN of the return object in
단계 1020에서 더미클래스 정보 생성 모듈(206)은 획득된 FQCN이 더미클래스 생성 대상인지의 여부를 판단한다. 만약 상기 판단 결과 더미클래스 생성 대상인 경우 본 과정은 종료된다.In
단계 1022에서, 더미클래스 정보 생성 모듈(206)은 식별된 메소드의 정보를 더미클래스 정보 리스트에 등록한다. 메소드 정보를 더미클래스 정보 리스트에 등록하는 과정은 상기 단계 1014에서 설명한 것과 동일하다.In
한편, 상기 1008 단계에서의 판단 결과 식별된 대상이 임포트된 클래스가 아닌 경우, 단계 1024에서 더미클래스 정보 생성 모듈(206)은 식별된 대상이 변수인지의 여부를 판단한다.Meanwhile, if it is determined in
상기 판단 결과 식별된 대상이 변수인 경우, 단계 1026에서 더미클래스 정보 생성 모듈(206)은 대상 변수의 FQCN을 획득한다.If the identified target is a variable as a result of the determination, in
단계 1028에서 더미클래스 정보 생성 모듈(206)은 획득된 FQCN이 더미클래스 생성 대상인지의 여부를 판단한다. 만약 상기 판단 결과 더미클래스 생성 대상인 경우 본 과정은 종료된다.In
단계 1030에서, 더미클래스 정보 생성 모듈(206)은 식별된 메소드의 정보를 더미클래스 정보 리스트에 등록한다. 메소드 정보를 더미클래스 정보 리스트에 등록하는 과정은 상기 단계 1014에서 설명한 것과 동일하다.In
한편, 상기 1024 단계의 판단 결과 식별된 대상이 변수가 아닌 경우, 단계 1032에서 더미클래스 정보 생성 모듈(206)은 식별된 대상이 필드인지의 여부를 판단한다.Meanwhile, if it is determined in
상기 판단 결과 식별된 대상이 필드인 경우, 단계 1034에서 더미클래스 정보 생성 모듈(206)은 대상 필드의 FQCN을 획득한다.If the identified target is a field as a result of the determination, in
단계 1036에서 더미클래스 정보 생성 모듈(206)은 획득된 FQCN이 더미클래스 생성 대상인지의 여부를 판단한다. 만약 상기 판단 결과 더미클래스 생성 대상인 경우 본 과정은 종료된다.In
단계 1038에서, 더미클래스 정보 생성 모듈(206)은 식별된 메소드의 정보를 더미클래스 정보 리스트에 등록한다. 메소드 정보를 더미클래스 정보 리스트에 등록하는 과정은 상기 단계 1014에서 설명한 것과 동일하다.In
도 14는 일 실시예에 따른 더미클래스 정보 리스트 생성 과정 중 파라미터 선언 구문에 대한 처리 과정을 상세히 설명하기 위한 흐름도이다.14 is a flowchart for explaining in detail a process for a parameter declaration syntax during a process of generating a dummy class information list according to an embodiment.
단계 1402에서, 더미클래스 정보 생성 모듈(206)은 부분 소스 코드 내의 파라미터 선언 구문을 식별한다.In
단계 1404에서, 더미클래스 정보 생성 모듈(206)은 식별된 파라미터 선언 구문에서 선언된 타입(type)에 대한 FQCN을 소스 심볼 테이블로부터 획득한다.In
단계 1406에서, 더미클래스 정보 생성 모듈(206)은 획득된 FQCN이 더미클래스 생성 대상인지의 여부를 판단한다. 구체적으로, 더미클래스 정보 생성 모듈(206)은 더미클래스 대상 리스트를 참조하여, 획득된 FQCN이 더미클래스 대상 리스트에 포함된 클래스인 경우 더미클래스 생성 대상으로 판단하게 된다. 만약 상기 판단 결과 더미클래스 생성 대상이 아닌 경우 본 과정은 종료된다.In
상기 판단 결과 더미클래스 생성 대상인 경우, 단계 1408에서 더미클래스 정보 생성 모듈(206)은 해당 클래스에 대한 정보를 더미클래스 정보 리스트에 추가한다. 구체적으로 더미클래스 정보 생성 모듈(206)은 1406 단계에서 더미클래스 생성 대상으로 판단된 클래스에 대한 정보가 더미클래스 정보 리스트에 기 존재하는지 여부를 판단하고, 존재하지 않는 경우 해당 클래스 정보를 더미클래스 정보 리스트에 추가하게 된다.If it is determined as a result of the determination that the dummy class is to be generated, the dummy class information generation module 206 adds information about the corresponding class to the dummy class information list in
도 15는 일 실시예에 따른 더미클래스 정보 리스트 생성 과정 중 변수 선언 구문에 대한 처리 과정을 상세히 설명하기 위한 흐름도이다.15 is a flowchart illustrating in detail a process for a variable declaration syntax during a process of generating a dummy class information list according to an embodiment.
단계 1502에서, 더미클래스 정보 생성 모듈(206)은 부분 소스 코드 내의 변수 선언 구문을 식별한다.In
단계 1504에서, 더미클래스 정보 생성 모듈(206)은 식별된 변수 선언 구문에서 선언된 타입(type)에 대한 FQCN을 소스 심볼 테이블로부터 획득한다.In
단계 1506에서, 더미클래스 정보 생성 모듈(206)은 획득된 FQCN이 더미클래스 생성 대상인지의 여부를 판단한다. 구체적으로, 더미클래스 정보 생성 모듈(206)은 더미클래스 대상 리스트를 참조하여, 획득된 FQCN이 더미클래스 대상 리스트에 포함된 클래스인 경우 더미클래스 생성 대상으로 판단하게 된다. 만약 상기 판단 결과 더미클래스 생성 대상이 아닌 경우 본 과정은 종료된다.In
상기 판단 결과 더미클래스 생성 대상인 경우, 단계 1508에서 더미클래스 정보 생성 모듈(206)은 해당 클래스에 대한 정보를 더미클래스 정보 리스트에 추가한다. 구체적으로 더미클래스 정보 생성 모듈(206)은 1506 단계에서 더미클래스 생성 대상으로 판단된 클래스에 대한 정보가 더미클래스 정보 리스트에 기 존재하는지 여부를 판단하고, 존재하지 않는 경우 해당 클래스 정보를 더미클래스 정보 리스트에 추가하게 된다.As a result of the determination, if the dummy class is to be generated, the dummy class information generation module 206 adds information about the corresponding class to the dummy class information list in
단계 1510에서, 더미클래스 정보 생성 모듈(206)은 해당 변수 선언 구문에서 선언된 변수와 생성된 객체의 타입이 상이한지의 여부를 판단한다. 만약 상기 판단 결과 상이하지 않은 경우 본 과정은 종료된다.In
만약 상기 판단 결과 해당 변수 선언 구문에서 선언된 변수와 생성된 객체의 타입이 상이한 경우, 단계 1512에서 더미클래스 정보 생성 모듈(206)은 생성된 객체의 타입을 획득한다.If, as a result of the determination, the type of the created object is different from the variable declared in the corresponding variable declaration syntax, the dummy class information generating module 206 acquires the type of the created object in
단계 1514에서, 더미클래스 정보 생성 모듈(206)은 획득된 타입에 대한 FQCN을 획득한다.In
단계 1516에서, 더미클래스 정보 생성 모듈(206)은 1508 단계에서 생성된 더미클래스 정보 중 더미클래스의 상위클래스 정보를 상기 1514 단계에서 획득한 FQCN으로 변경한다.In
도 16은 일 실시예에 따른 더미클래스 정보 리스트 생성 과정 중 어노테이션 지정 구문에 대한 처리 과정을 상세히 설명하기 위한 흐름도이다.16 is a flowchart for describing in detail a process for an annotation designation syntax during a process of generating a dummy class information list according to an embodiment.
단계 1602에서, 더미클래스 정보 생성 모듈(206)은 부분 소스 코드 내의 어노테이션 지정 구문을 식별한다.In
단계 1604에서, 더미클래스 정보 생성 모듈(206)은 식별된 어노테이션 지정 구문에서 선언된 타입(type)에 대한 FQCN을 소스 심볼 테이블로부터 획득한다.In
단계 1606에서, 더미클래스 정보 생성 모듈(206)은 획득된 FQCN이 더미클래스 생성 대상인지의 여부를 판단한다. 구체적으로, 더미클래스 정보 생성 모듈(206)은 더미클래스 대상 리스트를 참조하여, 획득된 FQCN이 더미클래스 대상 리스트에 포함된 클래스인 경우 더미클래스 생성 대상으로 판단하게 된다. 만약 상기 판단 결과 더미클래스 생성 대상이 아닌 경우 본 과정은 종료된다.In
상기 판단 결과 더미클래스 생성 대상인 경우, 단계 1608에서 더미클래스 정보 생성 모듈(206)은 해당 클래스에 대한 정보를 더미클래스 정보 리스트에 추가한다. 구체적으로 더미클래스 정보 생성 모듈(206)은 1606 단계에서 더미클래스 생성 대상으로 판단된 클래스에 대한 정보가 더미클래스 정보 리스트에 기 존재하는지 여부를 판단하고, 존재하지 않는 경우 해당 클래스 정보를 더미클래스 정보 리스트에 추가하게 된다. 한편 이 경우 해당 더미클래스 정보에서 어노테이션 클래스 여부는 True로 지정된다.If it is determined as a result of the determination that the dummy class is to be generated, the dummy class information generation module 206 adds information about the corresponding class to the dummy class information list in
다시 도 3으로 돌아가서, 단계 308에서 더미클래스 작성 모듈(208)은 더미클래스 정보 생성 모듈(206)에서 생성된 더미클래스 정보 리스트를 참조하여 실제 더미클래스를 생성한다. 더미클래스 작성 모듈(208)에서 생성되는 더미클래스는 실제 클래스와 동일한 외형 및 구조를 가지는 일종의 껍데기 클래스이다. 구체적으로, 더미클래스 작성 모듈(208)은 더미클래스 정보 리스트에 포함된 각각의 더미클래스 정보를 참조하여 각 더미클래스에 대한 바이트코드를 파일로 기록한다. Referring back to FIG. 3 , in
일 실시예에서, 더미클래스 작성 모듈(208)은 더미클래스 정보 리스트에 포함된 클래스 중 익명 클래스가 존재하는 경우, 익명 클래스에 대한 바이트코드를 먼저 작성하고, 익명 클래스의 작성이 완료된 이후 비 익명 클래스에 대한 바이트코드를 작성하도록 구성될 수 있다. 익명 클래스를 먼저 기록하는 이유는 다른 더미 클래스에서 익명 클래스를 참조하기 때문이다. In one embodiment, the dummy
마지막으로 단계 310에서, 컴파일 모듈(210)은 상기 더미클래스를 이용하여 상기 부분 소스 코드에 대한 컴파일을 수행한다.Finally, in
도 17은 전술한 컴파일 장치에서 컴파일 가능한 부분 소스 파일을 예시한 것이다. 도 17에 도시된 Main.java 소스 코드에 대하여 소스 파싱 모듈은 다음과 같이 소스 심볼 테이블을 생성할 수 있다.17 exemplifies partial source files that can be compiled by the above-described compilation device. For the Main.java source code shown in FIG. 17 , the source parsing module may generate a source symbol table as follows.
Main.java 소스를 파싱한 이후, 타겟 식별 모듈에 의하여 더미 클래스 대상으로 식별된 클래스는 org.library.Address 및 org.library.Node의 2개인다.After parsing the Main.java source, the classes identified as dummy class targets by the target identification module are org.library.Address and org.library.Node.
표 18은 org.library.Address의 더미클래스 정보를 나타낸 것이다.Table 18 shows dummy class information of org.library.Address.
표 19는 org.library.Node의 더미클래스 정보를 나타낸 것이다.Table 19 shows dummy class information of org.library.Node.
도 18은 예시적인 실시예들에서 사용되기에 적합한 컴퓨팅 장치를 포함하는 컴퓨팅 환경(10)을 예시하여 설명하기 위한 블록도이다. 도시된 실시예에서, 각 컴포넌트들은 이하에 기술된 것 이외에 상이한 기능 및 능력을 가질 수 있고, 이하에 기술되지 것 이외에도 추가적인 컴포넌트를 포함할 수 있다.18 is a block diagram illustrating and describing a
도시된 컴퓨팅 환경(10)은 컴퓨팅 장치(12)를 포함한다. 일 실시예에서, 컴퓨팅 장치(12)는 본 발명의 실시예들에 따른 컴파일 장치일 수 있다. 컴퓨팅 장치(12)는 적어도 하나의 프로세서(14), 컴퓨터 판독 가능 저장 매체(16) 및 통신 버스(18)를 포함한다. 프로세서(14)는 컴퓨팅 장치(12)로 하여금 앞서 언급된 예시적인 실시예에 따라 동작하도록 할 수 있다. 예컨대, 프로세서(14)는 컴퓨터 판독 가능 저장 매체(16)에 저장된 하나 이상의 프로그램들을 실행할 수 있다. 상기 하나 이상의 프로그램들은 하나 이상의 컴퓨터 실행 가능 명령어를 포함할 수 있으며, 상기 컴퓨터 실행 가능 명령어는 프로세서(14)에 의해 실행되는 경우 컴퓨팅 장치(12)로 하여금 예시적인 실시예에 따른 동작들을 수행하도록 구성될 수 있다.The illustrated
컴퓨터 판독 가능 저장 매체(16)는 컴퓨터 실행 가능 명령어 내지 프로그램 코드, 프로그램 데이터 및/또는 다른 적합한 형태의 정보를 저장하도록 구성된다. 컴퓨터 판독 가능 저장 매체(16)에 저장된 프로그램(20)은 프로세서(14)에 의해 실행 가능한 명령어의 집합을 포함한다. 일 실시예에서, 컴퓨터 판독 가능 저장 매체(16)는 메모리(랜덤 액세스 메모리와 같은 휘발성 메모리, 비휘발성 메모리, 또는 이들의 적절한 조합), 하나 이상의 자기 디스크 저장 디바이스들, 광학 디스크 저장 디바이스들, 플래시 메모리 디바이스들, 그 밖에 컴퓨팅 장치(12)에 의해 액세스되고 원하는 정보를 저장할 수 있는 다른 형태의 저장 매체, 또는 이들의 적합한 조합일 수 있다.Computer-
통신 버스(18)는 프로세서(14), 컴퓨터 판독 가능 저장 매체(16)를 포함하여 컴퓨팅 장치(12)의 다른 다양한 컴포넌트들을 상호 연결한다.
컴퓨팅 장치(12)는 또한 하나 이상의 입출력 장치(24)를 위한 인터페이스를 제공하는 하나 이상의 입출력 인터페이스(22) 및 하나 이상의 네트워크 통신 인터페이스(26)를 포함할 수 있다. 입출력 인터페이스(22) 및 네트워크 통신 인터페이스(26)는 통신 버스(18)에 연결된다. 입출력 장치(24)는 입출력 인터페이스(22)를 통해 컴퓨팅 장치(12)의 다른 컴포넌트들에 연결될 수 있다. 예시적인 입출력 장치(24)는 포인팅 장치(마우스 또는 트랙패드 등), 키보드, 터치 입력 장치(터치패드 또는 터치스크린 등), 음성 또는 소리 입력 장치, 다양한 종류의 센서 장치 및/또는 촬영 장치와 같은 입력 장치, 및/또는 디스플레이 장치, 프린터, 스피커 및/또는 네트워크 카드와 같은 출력 장치를 포함할 수 있다. 예시적인 입출력 장치(24)는 컴퓨팅 장치(12)를 구성하는 일 컴포넌트로서 컴퓨팅 장치(12)의 내부에 포함될 수도 있고, 컴퓨팅 장치(12)와는 구별되는 별개의 장치로 컴퓨팅 장치(102)와 연결될 수도 있다.
한편, 본 발명의 실시예는 본 명세서에서 기술한 방법들을 컴퓨터상에서 수행하기 위한 프로그램, 및 상기 프로그램을 포함하는 컴퓨터 판독 가능 기록매체를 포함할 수 있다. 상기 컴퓨터 판독 가능 기록매체는 프로그램 명령, 로컬 데이터 파일, 로컬 데이터 구조 등을 단독으로 또는 조합하여 포함할 수 있다. 상기 매체는 본 발명을 위하여 특별히 설계되고 구성된 것들이거나, 또는 컴퓨터 소프트웨어 분야에서 통상적으로 사용 가능한 것일 수 있다. 컴퓨터 판독 가능 기록매체의 예에는 하드 디스크, 플로피 디스크 및 자기 테이프와 같은 자기 매체, CD-ROM, DVD와 같은 광 기록 매체, 및 롬, 램, 플래시 메모리 등과 같은 프로그램 명령을 저장하고 수행하도록 특별히 구성된 하드웨어 장치가 포함된다. 상기 프로그램의 예는 컴파일러에 의해 만들어지는 것과 같은 기계어 코드뿐만 아니라 인터프리터 등을 사용해서 컴퓨터에 의해서 실행될 수 있는 고급 언어 코드를 포함할 수 있다.Meanwhile, an embodiment of the present invention may include a program for performing the methods described in this specification on a computer, and a computer-readable recording medium including the program. The computer-readable recording medium may include program instructions, local data files, local data structures, etc. alone or in combination. The medium may be specially designed and configured for the present invention, or may be commonly used in the field of computer software. Examples of computer-readable recording media include hard disks, magnetic media such as floppy disks and magnetic tapes, optical recording media such as CD-ROMs and DVDs, and program instructions specially configured to store and execute program instructions such as ROMs, RAMs, flash memories, and the like. Hardware devices are included. Examples of the program may include not only machine language codes such as those generated by a compiler, but also high-level language codes that can be executed by a computer using an interpreter or the like.
이상에서 본 발명의 대표적인 실시예들을 상세하게 설명하였으나, 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자는 상술한 실시예에 대하여 본 발명의 범주에서 벗어나지 않는 한도 내에서 다양한 변형이 가능함을 이해할 것이다. 그러므로 본 발명의 권리범위는 설명된 실시예에 국한되어 정해져서는 안 되며, 후술하는 특허청구범위뿐만 아니라 이 특허청구범위와 균등한 것들에 의해 정해져야 한다.Although representative embodiments of the present invention have been described in detail above, those of ordinary skill in the art to which the present invention pertains will understand that various modifications are possible within the limits without departing from the scope of the present invention with respect to the above-described embodiments. . Therefore, the scope of the present invention should not be limited to the described embodiments, and should be defined by the claims described below as well as the claims and equivalents.
200: 부분 소스 코드의 컴파일 장치
202: 소스 파싱 모듈
204: 타겟 식별 모듈
206: 더미클래스 정보 생성 모듈
208: 더미클래스 작성 모듈
210: 컴파일 모듈200: compilation device of partial source code
202: source parsing module
204: target identification module
206: dummy class information generation module
208: Dummy class creation module
210: compilation module
Claims (16)
상기 더미클래스 후보 리스트에 포함된 하나 이상의 더미클래스 후보 클래스들 중 실제 더미클래스 생성이 필요한 대상 클래스를 식별하여 더미클래스 대상 리스트를 생성하는 타겟 식별 모듈;
식별된 상기 대상 클래스들의 정보를 획득하고, 이로부터 더미클래스 정보 리스트를 생성하는 더미클래스 정보 생성 모듈;
상기 더미클래스 정보 리스트를 참조하여 하나 이상의 더미클래스를 생성하는 더미클래스 작성 모듈; 및
생성된 상기 더미클래스를 이용하여 상기 부분 소스 코드에 대한 컴파일을 수행하는 컴파일 모듈을 포함하는 부분 소스 코드의 컴파일 장치.
a source parsing module that parses the partial source code and generates a source symbol table and a dummy class candidate list therefrom;
a target identification module for generating a dummy class target list by identifying a target class requiring actual dummy class generation among one or more dummy class candidate classes included in the dummy class candidate list;
a dummy class information generating module for obtaining information of the identified target classes and generating a dummy class information list therefrom;
a dummy class creation module for generating one or more dummy classes by referring to the dummy class information list; and
and a compilation module that compiles the partial source code using the generated dummy class.
상기 더미클래스 후보 리스트는, 상기 부분 소스 코드에서 사용되는 하나 이상의 클래스들의 FQCN(Fully-Qualified Class Name)을 포함하는, 부분 소스 코드의 컴파일 장치.
The method according to claim 1,
The dummy class candidate list includes a Fully-Qualified Class Name (FQCN) of one or more classes used in the partial source code.
상기 소스 파싱 모듈은,
상기 부분 소스 코드에 복합 방식의 메소드 호출 구문이 포함되어 있는 경우, 상기 메소드 호출에 대응되는 익명 클래스(anonymous class)를 생성하고, 생성된 익명 클래스의 FQCN을 상기 더미클래스 후보 리스트에 등록하는, 부분 소스 코드의 컴파일 장치.
3. The method according to claim 2,
The source parsing module,
When the partial source code includes a complex method call syntax, an anonymous class corresponding to the method call is created, and the FQCN of the generated anonymous class is registered in the dummy class candidate list. Source code compilation device.
상기 소스 파싱 모듈은,
상기 더미클래스 후보 클래스가 자바 가상 머신에서 제공되는 클래스, 상기 부분 소스 코드에 포함된 클래스, 또는 기 설정된 더미클래스 제외 대상 클래스 중 하나 이상에 포함되는 경우 해당 클래스를 상기 대상 클래스에서 제외하는, 부분 소스 코드의 컴파일 장치.
The method according to claim 1,
The source parsing module,
When the dummy class candidate class is included in one or more of a class provided by the Java virtual machine, a class included in the partial source code, or a preset dummy class exclusion target class, the corresponding class is excluded from the target class, partial source Compilation device for code.
상기 더미클래스 정보 생성 모듈은, 상기 소스 심볼 테이블 및 상기 더미클래스 대상 리스트를 참조하여 상기 부분 소스 코드를 2차 파싱함으로써 상기 더미클래스 정보 리스트를 생성하는, 부분 소스 코드의 컴파일 장치.
The method according to claim 1,
The dummy class information generating module generates the dummy class information list by secondary parsing the partial source code with reference to the source symbol table and the dummy class target list.
상기 더미클래스 정보 리스트는, 상기 대상 클래스 각각의 패키지 이름, 클래스 이름, 상위클래스 이름, 선언이 필요한 인터페이스 목록, 제네릭스(Generics)의 타입 인수(Type Arguments) 목록, 생성자 목록, 어노테이션 클래스 여부, 예외 클래스 여부, 필드 정의 필요 목록, 메소드 정의 필요 목록을 포함하는, 부분 소스 코드의 컴파일 장치.
6. The method of claim 5,
The dummy class information list includes a package name of each target class, a class name, a superclass name, a list of interfaces requiring declaration, a list of type arguments of generics, a list of constructors, whether an annotation class, an exception A compilation device for partial source code, including whether it is a class, a list of field definitions required, and a list of method definitions required.
상기 더미클래스 정보 생성 모듈은, 상기 부분 소스 코드에 객체 생성 구문이 포함되어 있는 경우, 상기 객체 생성 구문에 포함된 파라미터의 FQCN을 획득하여 상기 더미클래스 정보 리스트에 등록하되, 상기 부분 소스 코드로부터 상기 파라미터의 FQCN을 획득할 수 없는 경우에는 최상위 객체(java.lang.Object)를 상기 더미클래스 정보 리스트에 등록하는, 부분 소스 코드의 컴파일 장치.
6. The method of claim 5,
The dummy class information generation module is, when the partial source code includes an object creation syntax, obtains an FQCN of a parameter included in the object creation syntax and registers it in the dummy class information list, from the partial source code A device for compiling partial source code, wherein when the FQCN of the parameter cannot be obtained, a top-level object (java.lang.Object) is registered in the dummy class information list.
상기 더미클래스 작성 모듈은, 상기 더미클래스 정보 리스트에 익명 클래스가 포함되어 있는 경우, 상기 익명 클래스에 대한 바이트코드를 먼저 작성하고, 상기 익명 클래스의 작성이 완료된 이후 비 익명 클래스에 대한 바이트코드를 작성하는, 부분 소스 코드의 컴파일 장치.
The method according to claim 1,
The dummy class creation module, when an anonymous class is included in the dummy class information list, first writes the bytecode for the anonymous class, and writes the bytecode for the non-anonymous class after the creation of the anonymous class is completed. , which is a compilation device of partial source code.
상기 하나 이상의 프로세서들에 의해 실행되는 하나 이상의 프로그램들을 저장하는 메모리를 구비한 컴퓨팅 장치에서 수행되는 방법으로서,
부분 소스 코드를 파싱하고, 이로부터 소스 심볼 테이블 및 더미클래스 후보 리스트를 생성하는 단계;
상기 더미클래스 후보 리스트에 포함된 하나 이상의 더미클래스 후보 클래스들 중 실제 더미클래스 생성이 필요한 대상 클래스를 식별하여 더미클래스 대상 리스트를 생성하는 단계;
식별된 상기 대상 클래스들의 정보를 획득하고, 이로부터 더미클래스 정보 리스트를 생성하는 단계;
상기 더미클래스 정보 리스트를 참조하여 하나 이상의 더미클래스를 생성하는 더미클래스 작성 단계; 및
생성된 상기 더미클래스를 이용하여 상기 부분 소스 코드에 대한 컴파일을 수행하는 단계를 포함하는 부분 소스 코드의 컴파일 방법.
one or more processors, and
A method performed in a computing device having a memory storing one or more programs to be executed by the one or more processors, the method comprising:
parsing the partial source code and generating a source symbol table and a dummy class candidate list therefrom;
generating a dummy class target list by identifying a target class for which actual dummy class generation is required among one or more dummy class candidate classes included in the dummy class candidate list;
obtaining information of the identified target classes, and generating a dummy class information list therefrom;
a dummy class creation step of creating one or more dummy classes with reference to the dummy class information list; and
and performing compilation on the partial source code using the generated dummy class.
상기 더미클래스 후보 리스트는, 상기 부분 소스 코드에서 사용되는 하나 이상의 클래스들의 FQCN(Fully-Qualified Class Name)을 포함하는, 부분 소스 코드의 컴파일 방법.
10. The method of claim 9,
The dummy class candidate list includes a Fully-Qualified Class Name (FQCN) of one or more classes used in the partial source code.
상기 더미클래스 후보 리스트를 생성하는 단계는,
상기 부분 소스 코드에 복합 방식의 메소드 호출 구문이 포함되어 있는 경우, 상기 메소드 호출에 대응되는 익명 클래스(anonymous class)를 생성하고, 생성된 익명 클래스의 FQCN을 상기 더미클래스 후보 리스트에 등록하도록 구성되는, 부분 소스 코드의 컴파일 방법.
11. The method of claim 10,
The step of generating the dummy class candidate list comprises:
When the partial source code includes a method call syntax of a complex method, an anonymous class corresponding to the method call is created, and the FQCN of the generated anonymous class is registered in the dummy class candidate list , how to compile partial source code.
상기 더미클래스 후보 리스트를 생성하는 단계는,
상기 더미클래스 후보 클래스가 자바 가상 머신에서 제공되는 클래스, 상기 부분 소스 코드에 포함된 클래스, 또는 기 설정된 더미클래스 제외 대상 클래스 중 하나 이상에 포함되는 경우 해당 클래스를 상기 대상 클래스에서 제외하도록 구성되는, 부분 소스 코드의 컴파일 방법.
10. The method of claim 9,
The step of generating the dummy class candidate list comprises:
When the dummy class candidate class is included in one or more of a class provided by the Java virtual machine, a class included in the partial source code, or a preset dummy class exclusion target class, configured to exclude the corresponding class from the target class, How to compile partial source code.
상기 더미클래스 정보를 생성하는 단계는,
상기 소스 심볼 테이블 및 상기 더미클래스 대상 리스트를 참조하여 상기 부분 소스 코드를 2차 파싱함으로써 상기 더미클래스 정보 리스트를 생성하도록 구성되는, 부분 소스 코드의 컴파일 방법.
10. The method of claim 9,
The step of generating the dummy class information includes:
and generate the dummy class information list by secondary parsing the partial source code with reference to the source symbol table and the dummy class target list.
상기 더미클래스 정보 리스트는, 상기 대상 클래스 각각의 패키지 이름, 클래스 이름, 상위클래스 이름, 선언이 필요한 인터페이스 목록, 제네릭스(Generics)의 타입 인수(Type Arguments) 목록, 생성자 목록, 어노테이션 클래스 여부, 예외 클래스 여부, 필드 정의 필요 목록, 메소드 정의 필요 목록을 포함하는, 부분 소스 코드의 컴파일 방법.
14. The method of claim 13,
The dummy class information list includes a package name of each target class, a class name, a superclass name, a list of interfaces requiring declaration, a list of type arguments of generics, a list of constructors, whether an annotation class, an exception How to compile partial source code, including whether it is a class, a list of field definitions required, and a list of method definitions required.
상기 더미클래스 정보를 생성하는 단계는,
상기 부분 소스 코드에 객체 생성 구문이 포함되어 있는 경우, 상기 객체 생성 구문에 포함된 파라미터의 FQCN을 획득하여 상기 더미클래스 정보 리스트에 등록하되, 상기 부분 소스 코드로부터 상기 파라미터의 FQCN을 획득할 수 없는 경우에는 최상위 객체(java.lang.Object)를 상기 더미클래스 정보 리스트에 등록하는, 부분 소스 코드의 컴파일 방법.
14. The method of claim 13,
The step of generating the dummy class information includes:
When the partial source code includes an object creation syntax, the FQCN of the parameter included in the object creation syntax is obtained and registered in the dummy class information list, but the FQCN of the parameter cannot be obtained from the partial source code In this case, a method of compiling a partial source code, in which the top-level object (java.lang.Object) is registered in the dummy class information list.
상기 더미클래스 작성 단계는,
상기 더미클래스 정보 리스트에 익명 클래스가 포함되어 있는 경우, 상기 익명 클래스에 대한 바이트코드를 먼저 작성하고, 상기 익명 클래스의 작성이 완료된 이후 비 익명 클래스에 대한 바이트코드를 작성하는, 부분 소스 코드의 컴파일 방법.10. The method of claim 9,
The dummy class creation step is
Compilation of partial source code in which, when an anonymous class is included in the dummy class information list, the bytecode for the anonymous class is first written, and the bytecode for the non-anonymous class is written after the creation of the anonymous class is completed Way.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| KR1020180127727A KR102439456B1 (en) | 2018-10-24 | 2018-10-24 | Compilation device and method of partial source code |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| KR1020180127727A KR102439456B1 (en) | 2018-10-24 | 2018-10-24 | Compilation device and method of partial source code |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| KR20200046499A KR20200046499A (en) | 2020-05-07 |
| KR102439456B1 true KR102439456B1 (en) | 2022-09-02 |
Family
ID=70733189
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| KR1020180127727A Active KR102439456B1 (en) | 2018-10-24 | 2018-10-24 | Compilation device and method of partial source code |
Country Status (1)
| Country | Link |
|---|---|
| KR (1) | KR102439456B1 (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111722849B (en) * | 2020-07-17 | 2024-06-25 | 思客云(北京)软件技术有限公司 | JAVA language virtual compiling realization method, system and device |
| KR20220068006A (en) | 2020-11-18 | 2022-05-25 | 삼성에스디에스 주식회사 | Apparatus and method for compiling source code for homomorphic encryption application |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2000099345A (en) | 1998-09-24 | 2000-04-07 | Digital Vision Laboratories:Kk | Program conversion method |
| JP2004280794A (en) | 2003-03-14 | 2004-10-07 | Hewlett-Packard Development Co Lp | Method for implanting software |
| JP2010079400A (en) | 2008-09-24 | 2010-04-08 | Hitachi Information Systems Ltd | System, method and program for property file reading |
| JP2010134643A (en) | 2008-12-03 | 2010-06-17 | Hitachi Software Eng Co Ltd | Test case selection method and selection system |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR101412614B1 (en) | 2012-01-13 | 2014-06-27 | 주식회사 오비고 | METHOD, TERMINAL AND COMPUTER-READABLE RECORDING MEDIA FOR COMPILING JAVASCRIPT INCLUDED IN WEB APPLICATION USING AOT (Ahead Of Time) |
-
2018
- 2018-10-24 KR KR1020180127727A patent/KR102439456B1/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2000099345A (en) | 1998-09-24 | 2000-04-07 | Digital Vision Laboratories:Kk | Program conversion method |
| JP2004280794A (en) | 2003-03-14 | 2004-10-07 | Hewlett-Packard Development Co Lp | Method for implanting software |
| JP2010079400A (en) | 2008-09-24 | 2010-04-08 | Hitachi Information Systems Ltd | System, method and program for property file reading |
| JP2010134643A (en) | 2008-12-03 | 2010-06-17 | Hitachi Software Eng Co Ltd | Test case selection method and selection system |
Also Published As
| Publication number | Publication date |
|---|---|
| KR20200046499A (en) | 2020-05-07 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11036614B1 (en) | Data control-oriented smart contract static analysis method and system | |
| Würthinger et al. | Practical partial evaluation for high-performance dynamic language runtimes | |
| US7703075B2 (en) | Programmable annotation inference | |
| US5854924A (en) | Static debugging tool and method | |
| JP5893038B2 (en) | Compile-time boundary checking for user-defined types | |
| US7350198B2 (en) | Creating and checking runtime data types | |
| US8549502B2 (en) | Compiler with user-defined type inference rules | |
| US9928156B2 (en) | Missing include suggestions for external files | |
| US20080178149A1 (en) | Inferencing types of variables in a dynamically typed language | |
| US10705814B2 (en) | Systems and/or methods for generating reassemblable disassemblies of binaries using declarative logic | |
| US10409559B2 (en) | Single-source-base compilation for multiple target environments | |
| US9563412B2 (en) | Statically extensible types | |
| Córdoba-Sánchez et al. | Ann: A domain-specific language for the effective design and validation of Java annotations | |
| US8276111B2 (en) | Providing access to a dataset in a type-safe manner | |
| US10983771B1 (en) | Quality checking inferred types in a set of code | |
| KR102439456B1 (en) | Compilation device and method of partial source code | |
| Maidl et al. | A formalization of Typed Lua | |
| US20060212861A1 (en) | Typed intermediate representation for object-oriented languages | |
| Baziotis et al. | Dias: Dynamic Rewriting of Pandas Code | |
| Fritzson et al. | Metamodelica–a symbolic-numeric modelica language and comparison to julia | |
| US20160062748A1 (en) | Embedded domain specific languages as first class code artifacts | |
| Kotselidis et al. | Cross-ISA debugging in meta-circular VMs | |
| Lezuo et al. | CASM: Implementing an abstract state machine based programming language | |
| Wang et al. | On the pursuit of staticness and coherence | |
| Grigorev et al. | String-embedded language support in integrated development environment |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PA0109 | Patent application |
St.27 status event code: A-0-1-A10-A12-nap-PA0109 |
|
| PG1501 | Laying open of application |
St.27 status event code: A-1-1-Q10-Q12-nap-PG1501 |
|
| A201 | Request for examination | ||
| PA0201 | Request for examination |
St.27 status event code: A-1-2-D10-D11-exm-PA0201 |
|
| D13-X000 | Search requested |
St.27 status event code: A-1-2-D10-D13-srh-X000 |
|
| D14-X000 | Search report completed |
St.27 status event code: A-1-2-D10-D14-srh-X000 |
|
| E902 | Notification of reason for refusal | ||
| PE0902 | Notice of grounds for rejection |
St.27 status event code: A-1-2-D10-D21-exm-PE0902 |
|
| P11-X000 | Amendment of application requested |
St.27 status event code: A-2-2-P10-P11-nap-X000 |
|
| P13-X000 | Application amended |
St.27 status event code: A-2-2-P10-P13-nap-X000 |
|
| R17-X000 | Change to representative recorded |
St.27 status event code: A-3-3-R10-R17-oth-X000 |
|
| E701 | Decision to grant or registration of patent right | ||
| PE0701 | Decision of registration |
St.27 status event code: A-1-2-D10-D22-exm-PE0701 |
|
| GRNT | Written decision to grant | ||
| PR0701 | Registration of establishment |
St.27 status event code: A-2-4-F10-F11-exm-PR0701 |
|
| PR1002 | Payment of registration fee |
St.27 status event code: A-2-2-U10-U11-oth-PR1002 Fee payment year number: 1 |
|
| PG1601 | Publication of registration |
St.27 status event code: A-4-4-Q10-Q13-nap-PG1601 |
|
| PR1001 | Payment of annual fee |
St.27 status event code: A-4-4-U10-U11-oth-PR1001 Fee payment year number: 4 |