JP2013186779A - Information processor and program execution method - Google Patents

Information processor and program execution method Download PDF

Info

Publication number
JP2013186779A
JP2013186779A JP2012052638A JP2012052638A JP2013186779A JP 2013186779 A JP2013186779 A JP 2013186779A JP 2012052638 A JP2012052638 A JP 2012052638A JP 2012052638 A JP2012052638 A JP 2012052638A JP 2013186779 A JP2013186779 A JP 2013186779A
Authority
JP
Japan
Prior art keywords
class
name
storage unit
stored
fully qualified
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.)
Granted
Application number
JP2012052638A
Other languages
Japanese (ja)
Other versions
JP5895616B2 (en
Inventor
Masayoshi Ouchi
政義 大内
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP2012052638A priority Critical patent/JP5895616B2/en
Publication of JP2013186779A publication Critical patent/JP2013186779A/en
Application granted granted Critical
Publication of JP5895616B2 publication Critical patent/JP5895616B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

PROBLEM TO BE SOLVED: To solve the problem that it is necessary to rewrite a package name in advance to prevent the competition of fully qualified class names from being generated in order to use a plurality of classes having the same fully qualified class names by one application.SOLUTION: When the competition of fully qualified class names is generated in loading by a class loader, the package names of the competing classes are dynamically changed on a memory so that competition can be canceled. Also, the package names of fully qualified class names as reference destinations described in the other classes referring to the classes whose package names have been changed are changed in accordance with the above mentioned change so that the reference relationship can be maintained.

Description

本発明は、オブジェクト指向言語で作成されたプログラムをロードして実行する情報処理装置およびそのプログラム実行方法に関する。   The present invention relates to an information processing apparatus that loads and executes a program created in an object-oriented language and a program execution method thereof.

Java(登録商標)仮想マシンを備えた情報処理装置では、Javaアプリケーションを実行するとき、必要とするクラスを装置内あるいは装置外に存在するクラスライブラリ(単にライブラリとも称す)からロードする(例えば特許文献1参照)。このロードを司る部分は、クラスローダと呼ばれる。   In an information processing apparatus including a Java (registered trademark) virtual machine, when executing a Java application, a required class is loaded from a class library (also simply referred to as a library) existing inside or outside the apparatus (for example, Patent Literature). 1). The part responsible for this loading is called a class loader.

ライブラリは、或る特定の機能を持ったプログラムを一つのクラスとして部品化し、関連する複数のクラスを一つのファイルにまとめたものである。こうしたクラスはプログラムの部品として利用できるため、良く使われる汎用的なものをライブラリに集めておくことで、プログラミングの労力を軽減することができる。また、ライブラリは、パッケージと呼ばれる単位で機能ごとに分類されている。   A library is a program in which a program having a specific function is converted into one class, and a plurality of related classes are collected into one file. Since these classes can be used as program components, you can reduce the programming effort by collecting commonly used general-purpose items in a library. Libraries are classified by function in units called packages.

クラスのクラス名とそのクラスが属するパッケージのパッケージ名とを組み合わせた名前を、完全修飾クラス名と呼ぶ。完全修飾クラス名を使用することにより、同じクラス名を持つクラスであっても、パッケージ名によって区別することができる。Java仮想マシンでは、メモリにロードしたクラスのバイトコード上におけるクラス間の参照関係は完全修飾クラス名を使用して解決されている。   A combination of the class name of the class and the package name of the package to which the class belongs is called a fully qualified class name. By using fully qualified class names, even classes with the same class name can be distinguished by package name. In the Java virtual machine, the reference relationship between classes on the bytecode of a class loaded into memory is resolved using a fully qualified class name.

特開2007-206965号公報Japanese Unexamined Patent Publication No. 2007-206965

上述したようにJava仮想マシンでは、メモリにロードしたクラスのバイトコード上におけるクラス間の参照関係は完全修飾クラス名を使用して解決されている。従って、メモリにロードされる複数のクラスの完全修飾クラス名が全く同じ場合、クラス間の参照関係を一意に決定することができない。それ故、同じ完全修飾クラス名を持つ複数のクラスを一つのアプリケーションで利用する場合、事前に当該クラスのパッケージ名の変更が必要であった。例えば、パッケージ名およびクラス名が同じで、バージョンの異なる複数のライブラリを一つのアプリケーションで利用する場合、完全修飾クラス名の競合が発生しないように事前にライブラリの書き換えを行う必要があった。   As described above, in the Java virtual machine, the reference relationship between classes on the bytecode of the class loaded in the memory is resolved using the fully qualified class name. Therefore, when the fully qualified class names of a plurality of classes loaded in the memory are exactly the same, the reference relationship between the classes cannot be uniquely determined. Therefore, when using multiple classes with the same fully qualified class name in one application, it is necessary to change the package name of the class in advance. For example, when a plurality of libraries having the same package name and class name but different versions are used in one application, it is necessary to rewrite the library in advance so that a conflict of fully qualified class names does not occur.

本発明の目的は、上述した課題、すなわち、同じ完全修飾クラス名を持つ複数のクラスを一つのアプリケーションで使用するためには、完全修飾クラス名の競合が発生しないように事前にパッケージ名の書き換えが必要になる、という課題を解決する情報処理装置およびプログラム実行方法を提供することにある。   The object of the present invention is to rewrite the package name in advance so as not to cause a conflict of fully qualified class names in order to use the above-mentioned problem, that is, a plurality of classes having the same fully qualified class name in one application. It is an object of the present invention to provide an information processing apparatus and a program execution method that can solve the problem of the need for a program.

本発明の一形態にかかる情報処理装置は、
ロード済のクラスを記憶する第1の記憶部と、前記第1の記憶部に記憶されているクラスの完全修飾クラス名とロード元を示す格納場所情報と変更前パッケージ名との組を記憶する第2の記憶部と、前記第1および第2の記憶部に接続されたプロセッサとを備え、
前記プロセッサは、
前記第1の記憶部に記憶されているクラスから参照されているクラスが前記第1の記憶部に記憶されているか否かを、参照先のクラスの完全修飾クラス名に一致する完全修飾クラス名が上記第2の記憶部に記憶されており、且つ、当該記憶されている完全修飾クラス名と同じ組の格納場所情報と参照元のクラスの定義ファイルに記述されている参照先のクラスのロード元を示す格納場所情報とが一致するか否かによって判断し、
上記参照されているクラスが上記第1の記憶部に記憶されていない場合、参照元のクラスに対応する定義ファイルに記述されている参照先のクラスの格納場所情報で示される場所から参照先のクラスを上記第1の記憶部にロードし、
上記ロードした参照先のクラスの完全修飾クラス名が上記第2の記憶部に記憶されていれば、上記参照先のクラスのバイトコードに出現する、上記参照先のクラスの完全修飾クラス名におけるパッケージ名を、異なるパッケージ名に、上記第1の記憶部上で変更すると共に、上記参照元のクラスのバイトコードに出現する、上記参照先のクラスの完全修飾クラス名におけるパッケージ名を、上記異なるパッケージ名に、上記第1の記憶部上で変更し、
上記ロードした参照先のクラスに関して、当該クラスの完全修飾クラス名が上記第2の記憶部に記憶されていなかったならば、当該クラスの完全修飾クラス名とロード元を示す格納場所情報とを含み変更前パッケージ名を有しない組を上記第2の記憶部に記憶し、当該クラスの完全修飾クラス名が上記第2の記憶部に記憶されていたならば、当該クラスのパッケージ名変更後の完全修飾クラス名とロード元を示す格納場所情報と変更前パッケージ名との組を上記第2の記憶部に記憶する
ようにプログラムされている。
An information processing apparatus according to an aspect of the present invention includes:
A first storage unit that stores a loaded class, a fully qualified class name of a class stored in the first storage unit, storage location information indicating a load source, and a package name before change are stored A second storage unit; and a processor connected to the first and second storage units;
The processor is
A fully qualified class name that matches whether or not a class referenced from a class stored in the first storage unit is stored in the first storage unit and matches the fully qualified class name of the referenced class Is stored in the second storage unit, and the storage location information of the same set as the stored fully qualified class name and the load of the reference destination class described in the definition file of the reference source class Judgment by whether or not the storage location information indicating the original matches,
When the referenced class is not stored in the first storage unit, the reference destination is stored in the location indicated by the storage location information of the reference destination class described in the definition file corresponding to the reference source class. Load the class into the first storage,
If the fully qualified class name of the loaded reference destination class is stored in the second storage unit, the package in the fully qualified class name of the reference destination class that appears in the byte code of the reference destination class The name is changed to a different package name on the first storage unit, and the package name in the fully qualified class name of the reference destination class that appears in the bytecode of the reference source class is changed to the different package. Change the name on the first storage unit,
For the loaded reference destination class, if the fully qualified class name of the class is not stored in the second storage unit, the fully qualified class name of the class and storage location information indicating the load source are included. If the group having no package name before change is stored in the second storage unit and the fully qualified class name of the class is stored in the second storage unit, the complete package name after the change of the package name of the class is stored. It is programmed to store the combination of the qualified class name, the storage location information indicating the load source, and the package name before the change in the second storage unit.

本発明は上述した構成を有するため、同じ完全修飾クラス名を持つ複数のクラスを一つのアプリケーションで使用することができる。また、完全修飾クラス名の競合が発生しないように事前にパッケージ名を書き換える必要がない。   Since the present invention has the above-described configuration, a plurality of classes having the same fully qualified class name can be used in one application. In addition, it is not necessary to rewrite the package name in advance so that a fully qualified class name conflict does not occur.

本発明の第1の実施形態のブロック図である。It is a block diagram of a 1st embodiment of the present invention. 本発明の第1の実施形態における処理の一例を示すフローチャートである。It is a flowchart which shows an example of the process in the 1st Embodiment of this invention. 本発明の第1の実施形態における記憶部の或る時点の内容の一例を示す図である。It is a figure which shows an example of the content at the certain time of the memory | storage part in the 1st Embodiment of this invention. 本発明の第1の実施形態における記憶部の別の時点における内容の一例を示す図である。It is a figure which shows an example of the content in the different time of the memory | storage part in the 1st Embodiment of this invention. 本発明の第1の実施形態における記憶部の更に別の時点における内容の一例を示す図である。It is a figure which shows an example of the content in the further another time of the memory | storage part in the 1st Embodiment of this invention. 本発明の第2の実施形態の構成図である。It is a block diagram of the 2nd Embodiment of this invention. 本発明の第2の実施形態におけるライブラリの定義ファイルの内容例を示す図である。It is a figure which shows the example of the content of the definition file of the library in the 2nd Embodiment of this invention. 本発明の第2の実施形態における変更記録表の一例を示す図である。It is a figure which shows an example of the change recording table in the 2nd Embodiment of this invention. 本発明の第2の実施形態における処理の一例を示すフローチャートである。It is a flowchart which shows an example of the process in the 2nd Embodiment of this invention. 本発明の第3の実施形態におけるライブラリの定義ファイルの内容例を示す図である。It is a figure which shows the example of the content of the definition file of the library in the 3rd Embodiment of this invention. 本発明の第4の実施形態における処理の一例を示すフローチャートである。It is a flowchart which shows an example of the process in the 4th Embodiment of this invention. 本発明の第5の実施形態におけるライブラリの定義ファイルの内容例を示す図である。It is a figure which shows the example of the content of the definition file of the library in the 5th Embodiment of this invention. 本発明の第5の実施形態におけるパッケージ名の変更イメージの一例を示す図である。It is a figure which shows an example of the change image of the package name in the 5th Embodiment of this invention. 本発明の第6の実施形態におけるクラスローダの階層構造の一例を示す図である。It is a figure which shows an example of the hierarchical structure of the class loader in the 6th Embodiment of this invention.

次に本発明の実施の形態について図面を参照して詳細に説明する。
[第1の実施形態]
図1を参照すると、本発明の第1の実施形態にかかる情報処理装置は、記憶部101〜103と、記録媒体104と、記憶部101〜103および記録媒体104に接続されたプロセッサ105とを有する。また、通信I/F部(通信インターフェース部)106、操作入力部107、および画面操作部108を有していてもよい。
Next, embodiments of the present invention will be described in detail with reference to the drawings.
[First embodiment]
Referring to FIG. 1, an information processing apparatus according to a first embodiment of the present invention includes storage units 101 to 103, a recording medium 104, and a processor 105 connected to the storage units 101 to 103 and the recording medium 104. Have. Further, a communication I / F unit (communication interface unit) 106, an operation input unit 107, and a screen operation unit 108 may be included.

記憶部101は、例えばRAMで構成され、ロード済のクラスを記憶する。   The storage unit 101 is composed of, for example, a RAM, and stores loaded classes.

記憶部102は、例えばRAMで構成され、記憶部101にロード済のクラスの完全修飾クラス名と、当該クラスが格納されていたロード元の場所の情報(例えばファイル名)と、当該クラスの完全修飾クラス名がパッケージ名をロード時に変更して生成したものである場合には変更前のパッケージ名との組を記憶する。   The storage unit 102 is composed of, for example, a RAM, and includes a fully qualified class name of a class already loaded in the storage unit 101, information on a load source location where the class is stored (for example, a file name), and a complete class name. When the qualified class name is generated by changing the package name at the time of loading, the pair with the package name before the change is stored.

記憶部103は、ROMやハードディスク等で構成され、アプリケーション111とライブラリ112、113とを記憶する。アプリケーション111とライブラリ112、113は、Javaバイトコードで記述されている。   The storage unit 103 includes a ROM, a hard disk, and the like, and stores the application 111 and the libraries 112 and 113. The application 111 and the libraries 112 and 113 are described in Java bytecode.

アプリケーション111は、複数のクラス121〜123と、それぞれのクラス121〜123の定義ファイル131〜133とを有する。定義ファイル131〜133には、クラス121〜123から参照(利用)するクラスを格納している場所の情報(例えばファイル名)が記述されている。   The application 111 includes a plurality of classes 121 to 123 and definition files 131 to 133 of the respective classes 121 to 123. In the definition files 131 to 133, information (for example, file names) of locations storing classes to be referenced (used) from the classes 121 to 123 is described.

ライブラリ112は、クラス141を有し、ライブラリ113はクラス151を有する。   The library 112 has a class 141 and the library 113 has a class 151.

プロセッサ105は、CPU等のマイクロプロセッサとその周辺回路とを有し、装置全体を制御する機能を有する。   The processor 105 includes a microprocessor such as a CPU and its peripheral circuits, and has a function of controlling the entire apparatus.

記録媒体104は、半導体メモリ、CDROM、磁気ディスク等のコンピュータ読み取り可能は記録媒体であり、プログラム181を記憶する。記録媒体104に記録されたプログラム181は、プロセッサ105の起動時にプロセッサ105に読み取られ、プロセッサ105の動作を制御することにより、プロセッサ105上にJava仮想マシン161を生成する。   The recording medium 104 is a computer-readable recording medium such as a semiconductor memory, a CDROM, or a magnetic disk, and stores a program 181. The program 181 recorded in the recording medium 104 is read by the processor 105 when the processor 105 is activated, and the Java virtual machine 161 is generated on the processor 105 by controlling the operation of the processor 105.

Java仮想マシン161は、インタプリタ171とクラスローダ172とを有する。   The Java virtual machine 161 has an interpreter 171 and a class loader 172.

インタプリタ171は、Javaのバイトコードを解釈および実行する機能を有する。   The interpreter 171 has a function of interpreting and executing Java bytecodes.

また、インタプリタ171は、記憶部101に記憶されているクラスから参照されているクラスが記憶部101に記憶されているか否かを、参照先のクラスの完全修飾クラス名に一致する完全修飾クラス名が記憶部102に記憶されており、且つ、当該記憶されている完全修飾クラス名と同じ組の格納場所情報と参照元のクラスの定義ファイルに記述されている参照先のクラスのロード元を示す格納場所情報とが一致するか否かによって判断する機能を有する。   Also, the interpreter 171 determines whether or not a class referenced from a class stored in the storage unit 101 is stored in the storage unit 101, and the fully qualified class name that matches the fully qualified class name of the referenced class Is stored in the storage unit 102, and indicates the storage location information of the same set as the stored fully qualified class name and the load source of the reference destination class described in the definition file of the reference source class It has a function of determining whether or not the storage location information matches.

クラスローダ172は、アプリケーション111を実行するとき、必要とするクラスをアプリケーション111およびライブラリ112、113からロードする機能を有する。   The class loader 172 has a function of loading a necessary class from the application 111 and the libraries 112 and 113 when the application 111 is executed.

また、クラスローダ172は、インタプリタ171から要求されたクラスが記憶部101に記憶されていない場合、参照元のクラスに対応する定義ファイルに記述されている参照先のクラスの格納場所情報で示される場所から参照先のクラスを記憶部101にロードする機能を有する。   In addition, when the class requested from the interpreter 171 is not stored in the storage unit 101, the class loader 172 is indicated by the storage location information of the reference destination class described in the definition file corresponding to the reference source class. It has a function of loading a reference destination class from a place into the storage unit 101.

また、クラスローダ172は、ロードしたクラスの完全修飾クラス名が記憶部102に記憶されていれば(即ち、ロードしたクラスの完全修飾クラス名が既にロード済みの他のクラスの完全修飾クラス名と競合していれば)、記憶部101にロードした当該クラスのバイトコードに出現する、当該クラスの完全修飾クラス名におけるパッケージ名を、異なるパッケージ名に変更すると共に、当該クラスの参照元のクラスのバイトコードに出現する、当該クラスの完全修飾クラス名におけるパッケージ名を、上記異なるパッケージ名に変更する機能を有する。   Further, the class loader 172 may store the fully qualified class name of the loaded class in the storage unit 102 (that is, the fully qualified class name of the loaded class is the same as the fully qualified class name of another class already loaded). If there is a conflict, the package name in the fully qualified class name of the class that appears in the bytecode of the class loaded in the storage unit 101 is changed to a different package name, and the reference source class of the class is changed. It has a function of changing the package name in the fully qualified class name of the class appearing in the bytecode to the different package name.

また、クラスローダ172は、ロードしたクラスに関して、当該クラスの完全修飾クラス名が記憶部102に記憶されていなかったならば、当該クラスの完全修飾クラス名とロード元を示す格納場所情報とを含み、変更前パッケージ名は有しない組を記憶部102に記憶し、当該クラスの完全修飾クラス名が記憶部102に記憶されていたならば、当該クラスのパッケージ名変更後の完全修飾クラス名とロード元を示す格納場所情報と変更前パッケージ名との組を記憶部102に記憶する機能を有する。   Further, the class loader 172 includes the fully qualified class name of the class and storage location information indicating the load source if the fully qualified class name of the class is not stored in the storage unit 102 for the loaded class. If the storage unit 102 stores a set that does not have the package name before the change, and the fully qualified class name of the class is stored in the storage unit 102, the fully qualified class name and the load after the change of the package name of the class are loaded. The storage unit 102 has a function of storing a set of storage location information indicating the original and a package name before the change.

また好ましくは、クラスローダ172は、ロードしたクラスが参照する他のクラスに関して、当該他のクラスの完全修飾クラス名と同一となる変更前完全修飾クラス名に相当する完全修飾クラス名と変更前パッケージ名とを含む組であって、当該組の格納場所情報が当該ロードしたクラスの定義ファイルに記述されている当該他のクラスのロード元を示す格納場所情報と一致する組が存在するか否かを判断し、存在する場合、当該ロードしたクラスのバイトコードに出現する、参照している当該他のクラスの完全修飾クラス名を、上記存在した組における完全修飾クラス名に変更する機能を有する。但し、或るクラスが参照(依存)するクラスが、当該或るクラスのロード後にロードされる構成では、当該機能は省略してよい。   Preferably, the class loader 172 also includes a fully qualified class name corresponding to the fully qualified class name that is the same as the fully qualified class name of the other class and the package before the change, with respect to another class referenced by the loaded class. Whether or not there is a pair whose storage location information matches the storage location information indicating the load source of the other class described in the definition file of the loaded class. If it exists, it has a function of changing the fully qualified class name of the other referenced class appearing in the byte code of the loaded class to the fully qualified class name in the existing set. However, in a configuration in which a class referenced (dependent) by a certain class is loaded after the certain class is loaded, this function may be omitted.

通信I/F部(通信インターフェース部)106は、専用のデータ通信回路からなり、通信回線を介して接続された各種装置との間でデータ通信を行う機能を有している。操作入力部107は、キーボードやマウスなどの操作入力装置からなり、オペレータの操作を検出してプロセッサ105に出力する機能を有している。画面表示部108は、LCDやPDPなどの画面表示装置からなり、プロセッサ105からの指示に応じて、各種情報を画面表示する機能を有している。   The communication I / F unit (communication interface unit) 106 includes a dedicated data communication circuit, and has a function of performing data communication with various devices connected via a communication line. The operation input unit 107 includes an operation input device such as a keyboard and a mouse, and has a function of detecting an operator operation and outputting the operation to the processor 105. The screen display unit 108 includes a screen display device such as an LCD or a PDP, and has a function of displaying various information on the screen in response to an instruction from the processor 105.

図2は、本実施形態におけるアプリケーションの実行手順の一例を示すフローチャートである。以下、図2のフローチャートを参照してアプリケーション111の実行手順の概要を説明する。   FIG. 2 is a flowchart illustrating an example of an application execution procedure according to this embodiment. The outline of the execution procedure of the application 111 will be described below with reference to the flowchart of FIG.

まずクラスローダ172は、アプリケーション111から最初に呼び出すクラス(アプリケーションクラス)を記憶部101にロードする(ステップS101)。次に、インタプリタ171は、実行するクラスを記憶部101から読み出し、解釈および実行する(ステップS102)。次に、インタプリタ171は、アプリケーション111が終了したか否かを判定し(ステップS103)、終了したら図2に示す実行手順を終了する。   First, the class loader 172 loads a class (application class) that is first called from the application 111 into the storage unit 101 (step S101). Next, the interpreter 171 reads the class to be executed from the storage unit 101, interprets and executes it (step S102). Next, the interpreter 171 determines whether or not the application 111 has ended (step S103). When the interpreter 171 ends, the execution procedure shown in FIG. 2 ends.

アプリケーション111が終了していない場合、インタプリタ171は、次の実行に必要なクラスが、記憶部101にロードされているか否かを判定する(ステップS104)。この判定方法の詳細については後述する。ロード済みの場合、インタプリタ171は、記憶部101からクラスを読み出して解釈および実行を行うステップS102に戻る。   If the application 111 has not ended, the interpreter 171 determines whether or not a class necessary for the next execution is loaded in the storage unit 101 (step S104). Details of this determination method will be described later. If it has been loaded, the interpreter 171 returns to step S102 where the class is read from the storage unit 101 to be interpreted and executed.

他方、必要なクラスがロード済でない場合、インタプリタ171は、クラスローダ172に対して当該必要なクラスのロードを要求する(ステップS105)。クラスローダ172は、この要求を受けて、要求されたクラスをライブラリ130、140等から記憶部101にロードする(ステップS106)。このロード時の詳細な動作は後述する。そして、そのクラスのロードが完了すると、ステップS102に戻り、インタプリタ171がそのクラスを解釈および実行する。   On the other hand, if the necessary class has not been loaded, the interpreter 171 requests the class loader 172 to load the necessary class (step S105). In response to this request, the class loader 172 loads the requested class from the libraries 130, 140, etc., into the storage unit 101 (step S106). The detailed operation at the time of loading will be described later. When the loading of the class is completed, the process returns to step S102, and the interpreter 171 interprets and executes the class.

次に、以下の事項を前提として、本実施形態の動作を詳細に説明する。   Next, the operation of this embodiment will be described in detail based on the following matters.

・ライブラリ112のパッケージ名はcom.abc、クラス141のクラス名はBとする。ライブラリ112は、フォルダlib配下に存在する、ファイル名が/lib/L1-1のフォルダに記憶されている。
・ライブラリ113のパッケージ名はcom.abc、クラス151のクラス名はBとする。即ち、ライブラリ112、113のクラス141、151は同じ完全修飾クラス名を持つ。このような例は、ライブラリ112、113がバージョンのみ相違するような場合にしばしば発生する。ライブラリ113は、フォルダlib配下に存在する、ファイル名が/lib/L1-2のフォルダに記憶されている。
・定義ファイル131は、クラス121がライブラリ112を使用することを、ライブラリ112の格納場所を示すファイル名/lib/L1-1をクラスパスとして記述することで明らかにしている。
・定義ファイル132は、クラス122がライブラリ113を使用することを、ライブラリ113の格納場所を示すファイル名/lib/L1-2をクラスパスとして記述することで明らかにしている。
・定義ファイル133は、クラス123がライブラリ113を使用することを、ライブラリ113の格納場所を示すファイル名/lib/L1-2をクラスパスとして記述することで明らかにしている。
・アプリケーション111の実行が既に開始されており、記憶部101、102の内容は図3に示すようになっているものとする。即ち、クラス121、このクラス121が使用するライブラリ112のクラス141、および、クラス122が、記憶部101にロードされており、記憶部102にクラス121、141、122の完全修飾クラス名とその格納場所情報との組が記憶されている。また、これらロード済のクラスのパッケージ名の変更は行われていないため、変更前パッケージ名は何れもNULLである。
-The package name of the library 112 is com.abc, and the class name of the class 141 is B. The library 112 is stored in a folder whose file name is / lib / L1-1, which exists under the folder lib.
-The package name of the library 113 is com.abc, and the class name of the class 151 is B. That is, the classes 141 and 151 of the libraries 112 and 113 have the same fully qualified class name. Such an example often occurs when the libraries 112 and 113 differ only in version. The library 113 is stored in a folder whose file name is / lib / L1-2, which exists under the folder lib.
The definition file 131 clarifies that the class 121 uses the library 112 by describing the file name / lib / L1-1 indicating the storage location of the library 112 as a class path.
The definition file 132 clarifies that the class 122 uses the library 113 by describing the file name / lib / L1-2 indicating the storage location of the library 113 as a class path.
The definition file 133 clarifies that the class 123 uses the library 113 by describing the file name / lib / L1-2 indicating the storage location of the library 113 as a class path.
It is assumed that the execution of the application 111 has already started and the contents of the storage units 101 and 102 are as shown in FIG. That is, the class 121, the class 141 of the library 112 used by the class 121, and the class 122 are loaded in the storage unit 101, and the fully qualified class names of the classes 121, 141, and 122 and the storage thereof are stored in the storage unit 102. A pair with location information is stored. Since the package names of these loaded classes have not been changed, the package names before the change are all NULL.

以上の前提の下、インタプリタ171がクラス122の実行に必要なライブラリ113のクラス151が記憶部101に記憶されているか否かを判断する場面から、本実施形態の動作を詳細に説明する。   Based on the above assumptions, the operation of the present embodiment will be described in detail from the scene where the interpreter 171 determines whether or not the class 151 of the library 113 necessary for executing the class 122 is stored in the storage unit 101.

インタプリタ171は、ステップS104において、クラス122のバイトコード上に出現している、参照するライブラリ113のクラス151の完全修飾クラス名com.abc.Bで記憶部102を検索すると、ライブラリ112のクラス141の完全修飾クラス名com.abc.Bを発見する。次に、インタプリタ171は、ステップS104において、この発見した完全修飾クラス名com.abc.Bに対応して記憶部102に記憶されているクラス141の格納場所情報であるファイル名/lib/L1-1と、クラス122に対応する定義ファイル132に記述されているライブラリ113の格納場所情報であるファイル名/lib/L1-2とを比較する。この結果、双方のファイル名が相違するので、インタプリタ171は、クラス122の実行に必要なライブラリ113のクラス151は記憶部101にロードされていないと判断し、ステップS105において、クラスローダ172に対して、クラス122から参照しているクラス151の完全修飾クラス名com.abc.Bを指定してロードを要求する。   When the interpreter 171 searches the storage unit 102 with the fully qualified class name com.abc.B of the class 151 of the library 113 to be referenced that appears on the byte code of the class 122 in step S104, the interpreter 171 searches for the class 141 of the library 112. Discover the fully qualified class name com.abc.B. Next, in step S104, the interpreter 171 stores the file name / lib / L1- that is the storage location information of the class 141 stored in the storage unit 102 corresponding to the found fully qualified class name com.abc.B. 1 is compared with the file name / lib / L1-2, which is the storage location information of the library 113 described in the definition file 132 corresponding to the class 122. As a result, both file names are different, and therefore the interpreter 171 determines that the class 151 of the library 113 necessary for executing the class 122 is not loaded in the storage unit 101, and in step S105, the class loader 172 Thus, the fully qualified class name com.abc.B of the class 151 referenced from the class 122 is specified to request loading.

クラスローダ172は、クラス122に対応する定義ファイル132に記述されているファイル名/lib/L1-2のファイルから、ライブラリ113のクラス151を読み出して、図4に示すように記憶部101にロードする。   The class loader 172 reads the class 151 of the library 113 from the file name / lib / L1-2 described in the definition file 132 corresponding to the class 122, and loads it into the storage unit 101 as shown in FIG. To do.

次にクラスローダ172は、クラス151の完全修飾クラス名com.abc.Bが既に記憶部102に記憶されているので、クラス151の完全修飾クラス名のパッケージ名を、競合が解消される別のパッケージ名に変更する。ここでは、例えば、パッケージ名Xに変更したものとする。   Next, since the fully qualified class name com.abc.B of the class 151 is already stored in the storage unit 102, the class loader 172 changes the package name of the fully qualified class name of the class 151 to another one that resolves the conflict. Change to package name. Here, for example, it is assumed that the package name is changed to X.

次にクラスローダ172は、記憶部101にロードしたライブライ113のクラス151のバイトコードに出現する完全修飾クラス名com.abc.Bを、図4に示すようにcom.abc.Xに変更する。また、クラスローダ172は、記憶部101にロードされている、クラス151を参照するクラス122のバイトコードに出現する完全修飾クラス名com.abc.Bを、図4に示すように、com.abc.Xに変更する。これによって、クラス122とクラス151との間の参照関係が維持される。   Next, the class loader 172 changes the fully qualified class name com.abc.B appearing in the byte code of the class 151 of the library 113 loaded in the storage unit 101 to com.abc.X as shown in FIG. . Also, the class loader 172 converts the fully qualified class name com.abc.B appearing in the byte code of the class 122 that references the class 151 and loaded into the storage unit 101, as shown in FIG. Change to .X. Thereby, the reference relationship between the class 122 and the class 151 is maintained.

次にクラスローダ172は、記憶部101にロードしたライブラリ113のクラス151に関して、当該クラス151の完全修飾クラス名com.abc.Bと同一の完全修飾クラス名が記憶部102に記憶されていたので、図4に示すように、クラス151のパッケージ名変更後の完全修飾クラス名com.abc.Xと格納場所情報であるファイル名/lib/L1-2と変更前パッケージ名Bとの組を記憶部102に記憶する。そして、クラスローダ172は、制御をインタプリタ171に戻す。   Next, regarding the class 151 of the library 113 loaded in the storage unit 101, the class loader 172 stores the fully qualified class name identical to the fully qualified class name com.abc.B of the class 151 in the storage unit 102. As shown in FIG. 4, the combination of the fully qualified class name com.abc.X after changing the package name of class 151, the file name / lib / L1-2 as storage location information, and the package name B before change is stored. Store in unit 102. The class loader 172 then returns control to the interpreter 171.

インタプリタ171は、再び、クラス122が利用するライブラリ113のクラス151の完全修飾クラス名com.abc.Xで記憶部102を検索すると、ライブラリ113のクラス151の完全修飾クラス名com.abc.Xを発見する。次に、インタプリタ171は、この発見した完全修飾クラス名com.abc.Xに対応して記憶部102に記憶されているクラス151の格納場所情報であるファイル名/lib/L1-2と、クラス122に対応する定義ファイル132に記述されているライブラリ113の格納場所情報であるファイル名/lib/L1-2とを比較する。この結果、双方のファイル名が一致するので、インタプリタ171は、クラス122の実行に必要なライブラリ113のクラス151は記憶部101にロードされていると判断し、その実行を行う。これによって、クラス122からライブラリ113のクラス151を利用することができる。   When the interpreter 171 searches the storage unit 102 again with the fully qualified class name com.abc.X of the class 151 of the library 113 used by the class 122, the interpreter 171 obtains the fully qualified class name com.abc.X of the class 151 of the library 113. Discover. Next, the interpreter 171 receives the file name / lib / L1-2 which is the storage location information of the class 151 stored in the storage unit 102 corresponding to the found fully qualified class name com.abc.X, and the class The file name / lib / L1-2 which is the storage location information of the library 113 described in the definition file 132 corresponding to 122 is compared. As a result, since both file names match, the interpreter 171 determines that the class 151 of the library 113 necessary for executing the class 122 is loaded in the storage unit 101, and executes it. As a result, the class 151 from the class 122 can be used.

次に、パッケージ名を動的に変更されたライブラリ113のクラス151を参照するクラス123が、その後にロードされた時の動作を説明する。   Next, the operation when the class 123 that refers to the class 151 of the library 113 whose package name has been dynamically changed is loaded afterwards will be described.

クラスローダ172は、アプリケーション111のクラス123を図5に示すように記憶部101にロードすると、ロードしたクラス123が参照している他のクラス毎に、以下の処理を行う。   When the class loader 172 loads the class 123 of the application 111 to the storage unit 101 as shown in FIG. 5, the class loader 172 performs the following processing for each other class referred to by the loaded class 123.

まずクラスローダ172は、クラス123が参照している他のクラスの完全修飾クラス名と同一の完全修飾クラス名になる変更前完全修飾クラス名に相当する完全修飾クラス名と変更前パッケージ名とを含む組が記憶部102に存在するか否かを調べる。ここで、記憶部102には、完全修飾クラス名と、それがパッケージ名を変更したものである場合には変更前のパッケージ名とが記憶されているため、完全修飾クラス名中のパッケージ名を変更前のパッケージ名に置き換えれば、変更前の完全修飾クラス名になる。   First, the class loader 172 obtains the fully qualified class name corresponding to the fully qualified class name before the change and the package name before the change to be the same as the fully qualified class name of the other class referenced by the class 123. It is checked whether or not a set including the data exists in the storage unit 102. Here, since the storage unit 102 stores the fully qualified class name and the package name before the change when the package name is changed, the package name in the fully qualified class name is stored. If it is replaced with the package name before the change, it becomes the fully qualified class name before the change.

次にクラスローダ172は、上記のような組が記憶部102に記憶されている場合、当該組の格納場所情報がクラス123の定義ファイルに記述されている当該他のクラスのロード元を示す格納場所情報と一致するか否かを判断する。一致した場合、クラス123が参照している当該他のクラスは、パッケージ名を変更して記憶部101にロードされていることになる。そこで、クラスローダ172は、記憶部101上のクラス123のバイトコードに出現する、参照している当該他のクラスの完全修飾クラス名を、上記組における完全修飾クラス名に変更する。例えば、クラス123がライブラリ113のクラス151を参照している場合、クラス151の完全修飾クラス名は、図5に示すように、記憶部101上でcom.abc.Bからcom.abc.Xに変更されているので、それを参照するクラス123のバイトコードに出現するクラス151の完全修飾クラス名com.abc.Bを、図5に示すようにcom.abc.Xに変更する。これにより、パッケージ名を変更して記憶部101にロードされているライブラリ113のクラス151を参照するクラス123が、クラス151の後にロードされる場合であっても、クラス123とクラス151との参照関係が維持される。   Next, the class loader 172 stores, when the above set is stored in the storage unit 102, the storage location information of the set indicating the load source of the other class described in the definition file of the class 123 It is determined whether or not it matches the location information. If they match, the other class referenced by the class 123 is loaded in the storage unit 101 with the package name changed. Therefore, the class loader 172 changes the fully qualified class name of the referenced other class that appears in the bytecode of the class 123 on the storage unit 101 to the fully qualified class name in the above set. For example, when the class 123 refers to the class 151 of the library 113, the fully qualified class name of the class 151 is changed from com.abc.B to com.abc.X on the storage unit 101 as shown in FIG. Since it has been changed, the fully qualified class name com.abc.B of the class 151 that appears in the bytecode of the class 123 that refers to it is changed to com.abc.X as shown in FIG. Thus, even if the class 123 that changes the package name and refers to the class 151 of the library 113 loaded in the storage unit 101 is loaded after the class 151, the reference to the class 123 and the class 151 is performed. The relationship is maintained.

このように本実施形態によれば、事前にパッケージ名を書き換えることなく、同じ完全修飾クラス名を持つ複数のクラスを一つのアプリケーションで使用することができる。このため、同じ完全修飾クラス名を持つ複数のクラスが、ライブラリクラスの場合、事前にライブラリを書き換えることなく、同じ完全修飾クラス名を持つ複数のライブラリを一つのアプリケーションで使用することができる。   Thus, according to this embodiment, a plurality of classes having the same fully qualified class name can be used in one application without rewriting the package name in advance. Therefore, when a plurality of classes having the same fully qualified class name are library classes, a plurality of libraries having the same fully qualified class name can be used in one application without rewriting the library in advance.

本実施形態では、ライブラリ112、113にはそれぞれ1つのクラス141、151しか格納されていないが、それぞれ複数のクラスが格納されていてよい。また、ライブラリ113に格納されるクラス151以外のクラスのうち、ライブラリ112に格納されるクラスと完全修飾クラス名が競合するクラスについては、クラス151のロード時と同様にパッケージ名の動的な変更が行われる。また、ライブラリ113に格納されるクラス151以外のクラスのうち、ライブラリ112に格納されるクラスと完全修飾クラス名が競合しないクラスについては、パッケージ名の動的な変更は必要ないが、クラス151と同様にパッケージ名を変更してもよい。   In the present embodiment, only one class 141 and 151 are stored in the libraries 112 and 113, respectively, but a plurality of classes may be stored. Also, among classes other than class 151 stored in library 113, for classes whose fully qualified class names conflict with those stored in library 112, the package name is dynamically changed in the same way as when class 151 is loaded. Is done. Of the classes other than the class 151 stored in the library 113, the class whose class name does not conflict with the class stored in the library 112 does not need to be dynamically changed. Similarly, the package name may be changed.

次に本発明の他の実施形態について説明する。   Next, another embodiment of the present invention will be described.

[第2の実施形態]
[本実施形態が解決しようとする課題]
近年様々なコミュニティでオープンソースソフトウェア(OSS)の開発が盛んに行われており、ソフトウェア開発においてもそれらのソースコードの一部を使用したり、様々なライブラリ(成果物)を利用する機会が増えてきた。特にアプリケーションサーバでは、サーバ自体がそういったOSSのライブラリを使用するうえに、アプリケーションごとに使用するライブラリのバージョンが異なったりする構成をプロセス上で実行することがあるため、ライブラリの競合が問題となってきている。
[Second Embodiment]
[Problems to be solved by this embodiment]
In recent years, open source software (OSS) has been actively developed in various communities, and there are more opportunities to use part of the source code and various libraries (deliverables) in software development. I came. Especially in the application server, the server itself uses such an OSS library, and a configuration in which the version of the library used for each application is different may be executed in the process, so library contention becomes a problem. ing.

この問題に対する解決手段として、手動でパッケージ名を静的に変更することが考えられる。この方法は非常に有効な手段ではあるが、元となるOSSのバージョンアップの取り込みなど、OSSからの差分修正を取り込んだり修正を行うたびに考慮しなければならないこと、また変更量が莫大になってしまうことがあり、開発者による手動ではなく、動的に完全修飾クラス名の競合を回避する手段が望まれていた。   A possible solution to this problem is to manually change the package name statically. Although this method is a very effective means, it must be taken into consideration every time a difference correction from OSS, such as importing an original OSS upgrade, is taken in, and the amount of change becomes enormous. There was a need for a means of dynamically avoiding fully qualified class name conflicts rather than manually by the developer.

[本実施形態の概要]
オブジェクト指向言語において、クラスのパッケージ名の別名をあらかじめ定義しておき、クラスローダによるロードにおいて完全修飾クラス名の競合が発生した場合に動的に変更することで競合を回避して、同じ完全修飾クラス名を持つクラスを1つのクラスローダツリー上で同時に複数ロードすることを可能とする。
[Overview of this embodiment]
In an object-oriented language, aliases for class package names are defined in advance, and when a conflict with a fully qualified class name occurs during loading by the class loader, the conflict is avoided by dynamically changing the same fully qualified name. Allows multiple classes with class names to be loaded simultaneously on one class loader tree.

またそれらのクラスを使用するプログラムでは、ロード時に参照先パッケージ名を書き換えることで参照関係を保つ。   In a program that uses these classes, the reference relationship is maintained by rewriting the reference package name at the time of loading.

このように本実施形態では、完全修飾クラス名の競合が発生したときに、競合したクラスのパッケージ名を動的に変えることで解決する。変更するパッケージ名はあらかじめライブラリの定義ファイルに命名規則として定義しておき、その規則にしたがってロード時に置き換える。そのクラスを参照するクラスでは、クラスパスやライブラリの定義ファイルから依存していることを調べて、ロード時にバイトコード内の参照先パッケージ名を変更して参照関係を解決する。   As described above, in the present embodiment, when a fully qualified class name conflict occurs, the package name of the conflicting class is dynamically changed to solve the problem. The package name to be changed is defined in advance in the library definition file as a naming rule, and is replaced when loading according to the rule. The class that refers to the class is checked for dependency on the class path or library definition file, and the reference destination package name in the bytecode is changed at loading to resolve the reference relationship.

本実施形態では、プログラムAにおいて、クラスP1がライブラリL1-1を使用し、クラスP2がライブラリL1-2を競合を回避して使用する例を示す。   In the present embodiment, in the program A, an example is shown in which the class P1 uses the library L1-1 and the class P2 uses the library L1-2 while avoiding the conflict.

[本実施形態の構成]
本実施形態の構成図を図6に示す。図6を参照すると、アプリケーションプログラムがクラスP1,P2から構成されており(そのようなアプリケーションプログラムをAとする)、クラスP1はライブラリL1-1のAPIを呼び出して処理を行い、クラスP2はライブラリL1-2のAPIを呼び出して処理を行う。それぞれのクラスでは、そのクラスの定義ファイル内でクラスパスとしてライブラリL1-1とライブラリL1-2をそれぞれファイル名で指定しており、P1とL1-1、P2とL1-2はそれぞれ独立した環境では実行可能とする。
[Configuration of this embodiment]
A configuration diagram of this embodiment is shown in FIG. Referring to FIG. 6, an application program is composed of classes P1 and P2 (such an application program is A). Class P1 calls the API of library L1-1 for processing, and class P2 is a library. Call the L1-2 API for processing. In each class, library L1-1 and library L1-2 are specified by the file name as the class path in the definition file of that class, and P1 and L1-1, P2 and L1-2 are independent environments. Let's make it executable.

ライブラリL1-1とライブラリL1-2は、ライブラリL1のバージョン1とバージョン2で、ほぼ同じ機能を提供する。これらは内部的にもほぼ同じパッケージ名・クラス名構成で、同じフォルダF1(lib)に置かれている。ただし、ライブラリL1の定義ファイルには、パッケージの別名の命名規則が書かれている。図7は、ライブラリL1の定義ファイルの内容例である。この例では、ライブラリL1のパッケージの別名は、com.xyzである。   The library L1-1 and the library L1-2 provide almost the same function in the version 1 and the version 2 of the library L1. Internally, they have the same package name / class name structure and are placed in the same folder F1 (lib). However, a naming convention for package aliases is written in the definition file of library L1. FIG. 7 shows an example of the contents of the definition file of the library L1. In this example, the alias of the package of the library L1 is com.xyz.

本実施形態にかかるクラスローダCLは、アプリケーションプログラムA用に定義されている。クラスローダCLは、ロード済ライブラリ一覧LT1と変更履歴表T1との2種類の制御テーブルを参照更新して、アプリケーションAの実行に必要なクラスのロードを行う。また本実施形態では、クラスローダCLが第1の実施形態におけるインタプリタ171の機能を兼ね備えているものとして説明する。   The class loader CL according to the present embodiment is defined for the application program A. The class loader CL refers to and updates the two types of control tables, the loaded library list LT1 and the change history table T1, and loads classes necessary for executing the application A. In the present embodiment, the class loader CL will be described as having the function of the interpreter 171 in the first embodiment.

ロード済ライブラリ一覧LT1は、メモリにロードされているクラスの完全修飾クラス名とそのロード元を示す格納場所の情報との組を記録するテーブルである。また、変更履歴表T1は、メモリにロードされているクラスのロード元を示す格納場所とそのクラスの変更前パッケージ名との組を記録するテーブルである。これらのテーブルT1,LT1は、第1の実施形態における記憶部102に相当する。   The loaded library list LT1 is a table that records a set of a fully qualified class name of a class loaded in the memory and storage location information indicating the load source. The change history table T1 is a table for recording a set of a storage location indicating a load source of a class loaded in the memory and a package name before the change of the class. These tables T1 and LT1 correspond to the storage unit 102 in the first embodiment.

[本実施形態の動作]
プログラムAでクラスP1が実行されると、クラスローダCLはクラスP1の定義ファイルを確認し、依存するライブラリL1-1をロードして実行を完了する。
[Operation of this embodiment]
When class P1 is executed in program A, class loader CL confirms the definition file of class P1, loads dependent library L1-1, and completes execution.

さらに同プロセス内でクラスP2が実行されると、従来ではクラスローダCLがL1-2をロードしようとするが、ライブラリの完全修飾クラス名の競合のためエラーとなって終了する。本実施形態では、この課題を以下のように解決する。   Furthermore, when class P2 is executed in the same process, the class loader CL conventionally attempts to load L1-2, but ends with an error due to a conflict of the fully qualified class name of the library. In the present embodiment, this problem is solved as follows.

プログラムAでクラスP1が実行されたとき、クラスローダCLはライブラリL1-1をロードする。ロードが完了した時点で、ロード済みライブラリ一覧LT1にライブラリの完全修飾クラス名を追加する。   When class P1 is executed in program A, class loader CL loads library L1-1. When loading is completed, the fully qualified class name of the library is added to the loaded library list LT1.

プログラムAでクラスP2が実行されたとき、クラスローダCLはライブラリL1-2のロードを行う。このときロード中にライブラリL1-2内のクラスとロード済みライブラリ一覧LT1とを突き合わせて、完全修飾クラス名の競合を確認する。本実施形態ではこのとき競合が発生するので、以降ではライブラリL1-2のパッケージ名の変更を試みる。   When class P2 is executed in program A, class loader CL loads library L1-2. At this time, the class in the library L1-2 and the loaded library list LT1 are matched with each other during loading to check for a fully qualified class name conflict. In this embodiment, since a conflict occurs at this time, the package name of the library L1-2 is changed thereafter.

クラスローダCLは、ライブラリL1-2内の定義ファイルを確認し、パッケージの命名規則を見つける。見つかった命名規則を用いてライブラリL1-2に含まれるクラスのパッケージ名をロードしながらメモリ上で変更する。Javaの場合、仮想マシン仕様によると、パッケージ名はバイトコード内で完全修飾クラス名に展開されているので、バイトコードをロードしたときにライブラリL1-2のパッケージ名がclass宣言のクラス名、クラスファイルの位置、そして各クラスファイル内の相互参照箇所に現れた場合、それらを命名規則にしたがって置換する。   The class loader CL checks the definition file in the library L1-2 and finds the package naming convention. Using the found naming convention, the package name of the class included in the library L1-2 is loaded and changed on the memory. For Java, according to the virtual machine specification, the package name is expanded to the fully qualified class name in the bytecode, so when loading the bytecode, the package name of the library L1-2 is the class name and class of the class declaration. If it appears in the location of the file and in the cross-reference location within each class file, replace them according to the naming convention.

そしてクラスローダCLは、ライブラリL1-2のファイル名と命名規則とを変更記録表T1に追加する。また、クラスローダCLはパッケージ名変更後のライブラリ内のクラスファイル名を、ロード済みライブラリ一覧LT1に追加する。   Then, the class loader CL adds the file name and naming convention of the library L1-2 to the change record table T1. In addition, the class loader CL adds the class file name in the library after the package name change to the loaded library list LT1.

クラスローダCLは、他のライブラリをロードするたびに変更記録表T1とそのライブラリの定義ファイルを確認し、それがライブラリL1-2を参照するかを調べる。参照している場合、ライブラリロード時にライブラリL1-2への参照パッケージ名を、変更後のパッケージ名にあわせるように書き換える。   Each time the class loader CL loads another library, the class loader CL checks the change record table T1 and the definition file of the library, and checks whether it refers to the library L1-2. If it is referenced, rewrite the reference package name to the library L1-2 so that it matches the new package name when loading the library.

変更記録表T1の例を図8に示す。図8の1行目は、パッケージ名変更後のライブラリ内のクラスファイル名./lib/L1-2に格納されているクラスは、パッケージ名がcom.xyzに変更されていることを表している。2行目以降は、図6には表れていない別のクラスの変更記録を示す。   An example of the change record table T1 is shown in FIG. The first line in FIG. 8 indicates that the class name of the class file in the library after the package name change./lib/L1-2 has the package name changed to com.xyz. . In the second and subsequent lines, change records of other classes not shown in FIG. 6 are shown.

本実施形態のクラスローダLCの処理の流れを図9に示す。クラスローダLCは、或るクラスをロードすると(ステップS201)、当該クラスの定義ファイルに記述されている依存ライブラリのファイル名の確認を行い(ステップS201)、当該クラスの完全修飾クラス名とロード済みライブラリ一覧LT1中の完全修飾クラス名との比較結果、および当該クラスの依存ライブラリのファイル名とロード済みライブラリ一覧LT1中のファイル名との比較の結果に基づき、依存するライブラリがロード済か否かを判断する(S203)。   A processing flow of the class loader LC of the present embodiment is shown in FIG. When the class loader LC loads a certain class (step S201), the class loader LC checks the file name of the dependent library described in the definition file of the class (step S201), and has already loaded the fully qualified class name of the class. Whether the dependent library has been loaded based on the comparison result with the fully qualified class name in the library list LT1 and the comparison result between the file name of the dependent library of the class and the file name in the loaded library list LT1 Is determined (S203).

依存するライブラリがロード済みでなければ、当該依存するライブラリのクラスの完全修飾クラス名を確認し(ステップS204)、そのライブラリのクラスのロードを行う(ステップS205)。そして、ステップS205でロードしたライブラリクラスの完全修飾クラス名が既にロードされているライブラリクラスの完全修飾クラス名と競合したか否かを判定する(ステップS206)。競合していなければ、クラスの実行等の処理を行う(ステップS2139)。   If the dependent library has not been loaded, the fully qualified class name of the class of the dependent library is confirmed (step S204), and the class of the library is loaded (step S205). Then, it is determined whether or not the fully qualified class name of the library class loaded in step S205 conflicts with the fully qualified class name of the library class already loaded (step S206). If there is no conflict, processing such as class execution is performed (step S2139).

ステップS205でロードしたライブラリクラスの完全修飾クラス名が他のクラスと競合している場合、ステップS205でロードしたライブラリの定義ファイルでパッケージ名の命名規則を確認し(ステップS207)、その命名規則を用いて当該ロードしたライブラリクラスのバイトコードに出現する、当該ロードしたライブラリクラスのパッケージ名の変更を行う(ステップS208)。次に、当該ロードしたライブラリクラスを参照(依存)している、既にロード済みのクラスのバイトコードに出現する、当該ロードしたライブラリクラスのパッケージ名を変更する(ステップS209)。そして、変更記録表T1にパッケージ名を変更したクラスのライブラリファイル名と命名規則とを追加する(ステップS210)。そして、クラスの実行等の処理を行う(ステップS2139)。   If the fully qualified class name of the library class loaded in step S205 conflicts with another class, check the naming convention for the package name in the library definition file loaded in step S205 (step S207). The package name of the loaded library class that appears in the bytecode of the loaded library class is changed (step S208). Next, the package name of the loaded library class that appears in the bytecode of the already loaded class that references (depends on) the loaded library class is changed (step S209). Then, the library file name and the naming rule of the class whose package name has been changed are added to the change record table T1 (step S210). Then, processing such as class execution is performed (step S2139).

他方、ステップS201でロードしたクラスが依存するライブラリクラスがロード済みであれば、当該依存するライブラリクラスのパッケージ名が変更されているか否かを変更記録表T1に基づいて判断する(ステップS211)。そして、パッケージ名が変更されていれば、ステップS201でロードしたクラスのバイトコードに出現する、当該クラスが依存するクラスのパッケージ名を変更後のパッケージ名に変更する(ステップS212)。そして、ステップS201でロードしたクラスの事項等の処理を行う(ステップS213)。   On the other hand, if the library class on which the class loaded in step S201 depends has already been loaded, it is determined based on the change record table T1 whether the package name of the dependent library class has been changed (step S211). If the package name has been changed, the package name of the class that depends on the class that appears in the bytecode of the class loaded in step S201 is changed to the changed package name (step S212). Then, the class matters loaded in step S201 are processed (step S213).

[本実施形態の効果]
本実施形態によれば、ライブラリ間で完全修飾クラス名の競合が発生しても、実行時にパッケージ名を動的に置換することで競合を回避し、競合する両方のクラスの使用が可能となる。その結果、プログラム間で重複しないライブラリは共有でき、競合するライブラリは独立性が確保できる。
[Effect of this embodiment]
According to the present embodiment, even when a fully qualified class name conflict occurs between libraries, the conflict is avoided by dynamically replacing the package name at the time of execution, and both conflicting classes can be used. . As a result, non-overlapping libraries can be shared among programs, and independence of competing libraries can be ensured.

[第3の実施形態]
本実施形態は、ライブラリ内の定義ファイルに複数の別名を定義する例である。或る一つの別名に変更してもパッケージ名がなおも競合した場合に、さらに他の名前に変更して競合を回避する。
[Third embodiment]
This embodiment is an example in which a plurality of aliases are defined in a definition file in a library. If the package name still conflicts even if it is changed to one alias, it is further changed to another name to avoid the conflict.

この場合、競合するライブラリ間で双方のパッケージ名の変更可能性を確認し、変更できる方のパッケージ名の変更と、参照する他のクラスとの参照関係の修正を行う。   In this case, the possibility of changing both package names between competing libraries is confirmed, the package name that can be changed is changed, and the reference relationship with other classes to be referenced is corrected.

命名規則を複数記述した定義ファイルの例を図10に示す。この例では、com.xyzとcom.XYZとjp.coとの3つのパッケージ名の別名が定義されている。   An example of a definition file describing a plurality of naming rules is shown in FIG. In this example, three package name aliases com.xyz, com.XYZ, and jp.co are defined.

[第4の実施形態]
本実施形態は、ライブラリ内の定義ファイルではなく、外部定義ファイルにパッケージ名の命名規則を定義する例である。
[Fourth Embodiment]
This embodiment is an example in which a naming rule for package names is defined in an external definition file, not in a definition file in a library.

外部の定義ファイルに命名規則を定義することで、複数のライブラリの命名規則をまとめて定義することができ、また実行時にパッケージ名の変更によっても競合を解決できなかった場合に、ライブラリ本体の修正なしで容易に変更する手段を提供する。   By defining naming conventions in an external definition file, naming conventions for multiple libraries can be defined together, and if the conflict cannot be resolved by changing the package name at runtime, the library itself has been modified. Provides a means to change easily without.

外部設定ファイルには、ライブラリのファイルパス名と命名規則のペアとが表形式で書かれており、クラスローダは、完全修飾クラス名の競合を検知すると、外部設定ファイルを確認してからライブラリ内の設定ファイルを確認する。外部設定ファイルに対象となるライブラリの命名規則が書かれていた場合、ライブラリ内部の定義ファイルより優先してその命名規則を使用する。   In the external configuration file, the file path name and naming rule pair of the library are written in a table format. When the class loader detects a conflict of the fully qualified class name, the class loader checks the external configuration file and then in the library. Check the configuration file. When the naming convention of the target library is written in the external configuration file, the naming convention is used in preference to the definition file inside the library.

本実施形態におけるクラスローダの処理の流れを図11に示す。図9と相違する箇所は、ステップS301,S302である。   FIG. 11 shows the flow of processing of the class loader in this embodiment. Differences from FIG. 9 are steps S301 and S302.

[第5の実施形態]
本実施形態は、パッケージ名の変更をライブラリ内の全クラスではなく、条件に合う一部のパッケージのみに対して行う例である。
[Fifth Embodiment]
This embodiment is an example in which the package name is changed not for all classes in the library but only for some packages that meet the conditions.

ライブラリファイル内に複数の異なるパッケージが含まれているときに、命名規則に、置換対象とするパッケージ名の規則と置き換える先のパッケージ名のペアとを書くことで実現する。   When multiple different packages are included in the library file, this is realized by writing a rule for the name of the package to be replaced and a pair of the package name to be replaced in the naming rule.

本実施形態で使用するライブラリの定義ファイルの例を図12に示す。図12の命名規則では、=の左辺に置換対象(com.abc)を指定し、右辺に置換後のパッケージ名(com.xyz)を定義している。この命名規則を適用してパッケージ名を変更した変更イメージを図13に示す。   An example of a library definition file used in this embodiment is shown in FIG. In the naming rule of FIG. 12, the replacement target (com.abc) is specified on the left side of =, and the package name (com.xyz) after replacement is defined on the right side. FIG. 13 shows a change image in which the package name is changed by applying this naming rule.

[第6の実施形態]
本実施形態は、クラスローダが階層構成の委譲モデルの形を取っており、競合するライブラリL1-1,L1-2が異なるフォルダに置かれている場合の例である。
[Sixth Embodiment]
In this embodiment, the class loader is in the form of a hierarchical delegation model, and the conflicting libraries L1-1 and L1-2 are placed in different folders.

クラスローダが図14に示すような階層構成をとっており、ライブラリL1-1とL1-2が異なるクラスローダCL1,CL2が見る場所にそれぞれ置かれている。CL1とCL2は親子関係になっており、CL1がCL2の親である。クラスP1、クラスP2の定義ファイルにはL1-1、L1-2のパスが書かれているものとする。   The class loader has a hierarchical structure as shown in FIG. 14, and the libraries L1-1 and L1-2 are placed in places where different class loaders CL1 and CL2 are seen. CL1 and CL2 are in a parent-child relationship, and CL1 is the parent of CL2. It is assumed that the paths of L1-1 and L1-2 are written in the definition files of class P1 and class P2.

プログラムがクラスP1を実行するとき、クラスローダCL1がライブラリL1-1を探し、ロードする。クラスローダCL1は委譲モデルにより、システムクラスローダ、ブートストラップクラスローダまでさかのぼり、再びCL1まで戻ってCL1が見える場所に置かれているライブラリL1-1をロードするという動きとなる。   When the program executes class P1, class loader CL1 searches for library L1-1 and loads it. Based on the delegation model, the class loader CL1 goes back to the system class loader and the bootstrap class loader, returns to CL1 again, and loads the library L1-1 placed in a place where CL1 can be seen.

次にプログラムがクラスP2を実行すると、クラスローダCL2は、CL1,システムクラスローダ、ブートストラップクラスローダまでさかのぼり、CL1に戻ったところでパッケージ名から前のステップでロードされたL1-1を使用することとなる。しかし、クラスP2はL1-2を使うことを想定していたため、想定外のバージョンのライブラリを使用したことによりエラーとなってしまう。そこで、本実施形態ではこの問題を以下のように解決する。   Next, when the program executes class P2, the class loader CL2 goes back to CL1, the system class loader, and the bootstrap class loader. It becomes. However, since class P2 was supposed to use L1-2, using an unexpected version of the library resulted in an error. Therefore, this embodiment solves this problem as follows.

(1)プログラムがクラスP1を実行するとき、クラスローダCL1ではライブラリL1-1をロードし、ロード済みライブラリ一覧LT1にライブラリのファイルパス名とパッケージ名を追加する。
(2)クラスP1を実行する
(3)プログラムがクラスP2を実行するとき、クラスP2の定義ファイルから、必要とするライブラリL1-2を確認し、またロード済みライブラリ一覧を確認して、ライブラリL1-1がロードされていることを確認する。その後、クラスローダCL2からクラスのロードを委譲していき、CL1でロードしたライブラリL1-1のパッケージは無視して、クラスの探索を続ける。そしてクラスローダCL2でライブラリL1-2をロードする。このときL1-1とL1-2でライブラリの競合が発生するので、パッケージ名の置換を行い、競合を回避する。パッケージ名の置換後、変更記録表T1に置換を行ったライブラリファイルパス名と命名規則を追加する。
(4)クラスP2を実行する。
(1) When the program executes the class P1, the class loader CL1 loads the library L1-1, and adds the file path name and package name of the library to the loaded library list LT1.
(2) Execute class P1
(3) When the program executes class P2, check the required library L1-2 from the definition file of class P2, check the loaded library list, and check that library L1-1 is loaded Confirm. After that, class loading is delegated from the class loader CL2, the package of the library L1-1 loaded by CL1 is ignored, and the class search is continued. The library L1-2 is loaded by the class loader CL2. At this time, since a library conflict occurs between L1-1 and L1-2, the package name is replaced to avoid the conflict. After replacing the package name, add the replaced library file path name and naming convention to the change log table T1.
(4) Execute class P2.

以上本発明の実施形態について説明したが、本発明は以上の実施形態にのみ限定されず、その他各種の付加変更が可能である。   Although the embodiment of the present invention has been described above, the present invention is not limited to the above embodiment, and various other additions and modifications can be made.

本発明は、Java等に代表されるオブジェクト指向言語で記述されたプログラムを実行する情報処理装置、特にアプリケーションサーバなどの基盤部分と他のアプリケーションが同プロセス上で実行され、複数のライブラリを使用する構成をとる情報処理装置に利用することができる。   The present invention is an information processing apparatus that executes a program described in an object-oriented language typified by Java or the like, in particular, a base part such as an application server and other applications are executed in the same process and use a plurality of libraries. The present invention can be used for an information processing apparatus having a configuration.

101〜103…記憶部
104…記録媒体
105…プロセッサ
106…通信I/F部
107…操作入力部
108…画面表示部
111…アプリケーション
112、113…ライブラリ
121、122、123…アプリケーションのクラス
131、132、133…定義ファイル
141、151…ライブラリのクラス
161…Java仮想マシン
171…インタプリタ
172…クラスローダ
101-103 ... Memory
104 ... Recording medium
105 ... Processor
106… Communication I / F section
107: Operation input section
108… Screen display
111… Application
112, 113 ... Library
121, 122, 123 ... Application classes
131, 132, 133 ... definition files
141, 151 ... Library classes
161 ... Java Virtual Machine
171 ... interpreter
172 ... Class loader

Claims (8)

ロード済のクラスを記憶する第1の記憶部と、前記第1の記憶部に記憶されているクラスの完全修飾クラス名とロード元を示す格納場所情報と変更前パッケージ名との組を記憶する第2の記憶部と、前記第1および第2の記憶部に接続されたプロセッサとを備え、
前記プロセッサは、
前記第1の記憶部に記憶されているクラスから参照されているクラスが前記第1の記憶部に記憶されているか否かを、参照先のクラスの完全修飾クラス名に一致する完全修飾クラス名が前記第2の記憶部に記憶されており、且つ、当該記憶されている完全修飾クラス名と同じ組の格納場所情報と参照元のクラスの定義ファイルに記述されている参照先のクラスのロード元を示す格納場所情報とが一致するか否かによって判断し、
前記参照されているクラスが前記第1の記憶部に記憶されていない場合、参照元のクラスに対応する定義ファイルに記述されている参照先のクラスの格納場所情報で示される場所から参照先のクラスを前記第1の記憶部にロードし、
前記ロードした参照先のクラスの完全修飾クラス名が前記第2の記憶部に記憶されていれば、前記参照先のクラスのバイトコードに出現する、前記参照先のクラスの完全修飾クラス名におけるパッケージ名を、異なるパッケージ名に、前記第1の記憶部上で変更すると共に、前記参照元のクラスのバイトコードに出現する、前記参照先のクラスの完全修飾クラス名におけるパッケージ名を、前記異なるパッケージ名に、前記第1の記憶部上で変更し、
前記ロードした参照先のクラスに関して、当該クラスの完全修飾クラス名が前記第2の記憶部に記憶されていなかったならば、当該クラスの完全修飾クラス名とロード元を示す格納場所情報とを含み変更前パッケージ名を有しない組を前記第2の記憶部に記憶し、当該クラスの完全修飾クラス名が前記第2の記憶部に記憶されていたならば、当該クラスのパッケージ名変更後の完全修飾クラス名とロード元を示す格納場所情報と変更前パッケージ名との組を前記第2の記憶部に記憶する
ようにプログラムされている、情報処理装置。
A first storage unit that stores a loaded class, a fully qualified class name of a class stored in the first storage unit, storage location information indicating a load source, and a package name before change are stored A second storage unit; and a processor connected to the first and second storage units;
The processor is
A fully qualified class name that matches whether or not a class referenced from a class stored in the first storage unit is stored in the first storage unit and matches the fully qualified class name of the referenced class Is stored in the second storage unit, and the storage location information of the same set as the stored fully qualified class name and the load of the reference destination class described in the definition file of the reference source class Judgment by whether or not the storage location information indicating the original matches,
When the referenced class is not stored in the first storage unit, the reference destination is stored in the location indicated by the storage location information of the reference destination class described in the definition file corresponding to the reference source class. Loading a class into the first storage unit;
If the fully qualified class name of the loaded reference destination class is stored in the second storage unit, the package in the fully qualified class name of the reference destination class that appears in the byte code of the reference destination class The name is changed to a different package name on the first storage unit, and the package name in the fully qualified class name of the reference destination class that appears in the bytecode of the reference source class is changed to the different package. Change the name on the first storage unit,
For the loaded reference destination class, if the fully qualified class name of the class is not stored in the second storage unit, the fully qualified class name of the class and storage location information indicating the load source are included. If a group having no package name before change is stored in the second storage unit and the fully qualified class name of the class is stored in the second storage unit, the complete package name after the change of the package name of the class is stored. An information processing apparatus programmed to store a combination of a qualified class name, storage location information indicating a load source, and a pre-change package name in the second storage unit.
前記プロセッサは、さらに、
前記ロードした参照先のクラスが参照する他のクラスに関して、当該他のクラスの完全修飾クラス名と同一となる変更前完全修飾クラス名に相当する完全修飾クラス名と変更前パッケージ名とを含む組であって、当該組の格納場所情報が前記ロードした参照先のクラスの定義ファイルに記述されている当該他のクラスのロード元を示す格納場所情報と一致する組が存在するか否かを判断し、存在する場合、前記ロードした参照先のクラスのバイトコードに出現する、参照している当該他のクラスの完全修飾クラス名を、前記第1の記憶部上で、前記存在した組における完全修飾クラス名に変更する
ようにプログラムされている請求項1に記載の情報処理装置。
The processor further includes:
A group including a fully qualified class name corresponding to the fully qualified class name before change that is the same as the fully qualified class name of the other class and the package name before change, with respect to the other class referenced by the loaded reference destination class Whether or not there is a set whose storage location information matches the storage location information indicating the load source of the other class described in the definition file of the loaded reference destination class. If present, the fully qualified class name of the referenced other class that appears in the bytecode of the loaded reference class is stored in the first storage unit as a complete name in the existing set. The information processing apparatus according to claim 1, wherein the information processing apparatus is programmed to change to a qualified class name.
前記パッケージ名の変更が行われるクラスは、クラスライブラリのクラスである
請求項1または2に記載の情報処理装置。
The information processing apparatus according to claim 1, wherein the class whose package name is changed is a class of a class library.
前記クラスライブラリの定義ファイルに、当該クラスライブラリのクラスのパッケージ名を変更する規則が記述されており、前記パッケージ名の変更では、前記規則に従って前記パッケージ名の変更を行う
請求項3に記載の情報処理装置。
4. The information according to claim 3, wherein a rule for changing a package name of a class of the class library is described in the definition file of the class library, and the package name is changed according to the rule when the package name is changed. Processing equipment.
外部定義ファイルに、前記クラスライブラリのクラスのパッケージ名を変更する規則が記述されており、前記パッケージ名の変更では、前記規則に従って前記パッケージ名の変更を行う
請求項1または2に記載の情報処理装置。
3. The information processing according to claim 1, wherein a rule for changing a package name of the class of the class library is described in an external definition file, and the change of the package name changes the package name according to the rule. apparatus.
前記規則が、複数種類記述されている
請求項4または5に記載の情報処理装置。
6. The information processing apparatus according to claim 4, wherein a plurality of types of rules are described.
ロード済のクラスを記憶する第1の記憶部と、前記第1の記憶部に記憶されているクラスの完全修飾クラス名とロード元を示す格納場所情報と変更前パッケージ名との組を記憶する第2の記憶部と、前記第1および第2の記憶部に接続されたプロセッサとを備え、
前記プロセッサが、
前記第1の記憶部に記憶されているクラスから参照されているクラスが前記第1の記憶部に記憶されているか否かを、参照先のクラスの完全修飾クラス名に一致する完全修飾クラス名が前記第2の記憶部に記憶されており、且つ、当該記憶されている完全修飾クラス名と同じ組の格納場所情報と参照元のクラスの定義ファイルに記述されている参照先のクラスのロード元を示す格納場所情報とが一致するか否かによって判断し、
前記参照されているクラスが前記第1の記憶部に記憶されていない場合、参照元のクラスに対応する定義ファイルに記述されている参照先のクラスの格納場所情報で示される場所から参照先のクラスを前記第1の記憶部にロードし、
前記ロードした参照先のクラスの完全修飾クラス名が前記第2の記憶部に記憶されていれば、前記参照先のクラスのバイトコードに出現する、前記参照先のクラスの完全修飾クラス名におけるパッケージ名を、異なるパッケージ名に、前記第1の記憶部上で変更すると共に、前記参照元のクラスのバイトコードに出現する、前記参照先のクラスの完全修飾クラス名におけるパッケージ名を、前記異なるパッケージ名に、前記第1の記憶部上で変更し、
前記ロードした参照先のクラスに関して、当該クラスの完全修飾クラス名が前記第2の記憶部に記憶されていなかったならば、当該クラスの完全修飾クラス名とロード元を示す格納場所情報とを含み変更前パッケージ名を有しない組を前記第2の記憶部に記憶し、当該クラスの完全修飾クラス名が前記第2の記憶部に記憶されていたならば、当該クラスのパッケージ名変更後の完全修飾クラス名とロード元を示す格納場所情報と変更前パッケージ名との組を前記第2の記憶部に記憶する
プログラム実行方法。
A first storage unit that stores a loaded class, a fully qualified class name of a class stored in the first storage unit, storage location information indicating a load source, and a package name before change are stored A second storage unit; and a processor connected to the first and second storage units;
The processor is
A fully qualified class name that matches whether or not a class referenced from a class stored in the first storage unit is stored in the first storage unit and matches the fully qualified class name of the referenced class Is stored in the second storage unit, and the storage location information of the same set as the stored fully qualified class name and the load of the reference destination class described in the definition file of the reference source class Judgment by whether or not the storage location information indicating the original matches,
When the referenced class is not stored in the first storage unit, the reference destination is stored in the location indicated by the storage location information of the reference destination class described in the definition file corresponding to the reference source class. Loading a class into the first storage unit;
If the fully qualified class name of the loaded reference destination class is stored in the second storage unit, the package in the fully qualified class name of the reference destination class that appears in the byte code of the reference destination class The name is changed to a different package name on the first storage unit, and the package name in the fully qualified class name of the reference destination class that appears in the bytecode of the reference source class is changed to the different package. Change the name on the first storage unit,
For the loaded reference destination class, if the fully qualified class name of the class is not stored in the second storage unit, the fully qualified class name of the class and storage location information indicating the load source are included. If a group having no package name before change is stored in the second storage unit and the fully qualified class name of the class is stored in the second storage unit, the complete package name after the change of the package name of the class is stored. A program execution method for storing a set of a qualified class name, storage location information indicating a load source, and a pre-change package name in the second storage unit.
ロード済のクラスを記憶する第1の記憶部と、前記第1の記憶部に記憶されているクラスの完全修飾クラス名とロード元を示す格納場所情報と変更前パッケージ名との組を記憶する第2の記憶部とに接続されたプロセッサに、
前記第1の記憶部に記憶されているクラスから参照されているクラスが前記第1の記憶部に記憶されているか否かを、参照先のクラスの完全修飾クラス名に一致する完全修飾クラス名が前記第2の記憶部に記憶されており、且つ、当該記憶されている完全修飾クラス名と同じ組の格納場所情報と参照元のクラスの定義ファイルに記述されている参照先のクラスのロード元を示す格納場所情報とが一致するか否かによって判断するステップと、
前記参照されているクラスが前記第1の記憶部に記憶されていない場合、参照元のクラスに対応する定義ファイルに記述されている参照先のクラスの格納場所情報で示される場所から参照先のクラスを前記第1の記憶部にロードするステップと、
前記ロードした参照先のクラスの完全修飾クラス名が前記第2の記憶部に記憶されていれば、前記参照先のクラスのバイトコードに出現する、前記参照先のクラスの完全修飾クラス名におけるパッケージ名を、異なるパッケージ名に、前記第1の記憶部上で変更すると共に、前記参照元のクラスのバイトコードに出現する、前記参照先のクラスの完全修飾クラス名におけるパッケージ名を、前記異なるパッケージ名に、前記第1の記憶部上で変更するステップと、
前記ロードした参照先のクラスに関して、当該クラスの完全修飾クラス名が前記第2の記憶部に記憶されていなかったならば、当該クラスの完全修飾クラス名とロード元を示す格納場所情報とを含み変更前パッケージ名を有しない組を前記第2の記憶部に記憶し、当該クラスの完全修飾クラス名が前記第2の記憶部に記憶されていたならば、当該クラスのパッケージ名変更後の完全修飾クラス名とロード元を示す格納場所情報と変更前パッケージ名との組を前記第2の記憶部に記憶するステップと
を行わせるためのプログラム。
A first storage unit that stores a loaded class, a fully qualified class name of a class stored in the first storage unit, storage location information indicating a load source, and a package name before change are stored A processor connected to the second storage unit;
A fully qualified class name that matches whether or not a class referenced from a class stored in the first storage unit is stored in the first storage unit and matches the fully qualified class name of the referenced class Is stored in the second storage unit, and the storage location information of the same set as the stored fully qualified class name and the load of the reference destination class described in the definition file of the reference source class Determining whether or not the storage location information indicating the source matches,
When the referenced class is not stored in the first storage unit, the reference destination is stored in the location indicated by the storage location information of the reference destination class described in the definition file corresponding to the reference source class. Loading a class into the first storage unit;
If the fully qualified class name of the loaded reference destination class is stored in the second storage unit, the package in the fully qualified class name of the reference destination class that appears in the byte code of the reference destination class The name is changed to a different package name on the first storage unit, and the package name in the fully qualified class name of the reference destination class that appears in the bytecode of the reference source class is changed to the different package. Changing to a name on the first storage unit;
For the loaded reference destination class, if the fully qualified class name of the class is not stored in the second storage unit, the fully qualified class name of the class and storage location information indicating the load source are included. If a group having no package name before change is stored in the second storage unit and the fully qualified class name of the class is stored in the second storage unit, the complete package name after the change of the package name of the class is stored. A program for causing the second storage unit to store a set of a qualified class name, storage location information indicating a load source, and a pre-change package name.
JP2012052638A 2012-03-09 2012-03-09 Information processing apparatus and program execution method Expired - Fee Related JP5895616B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012052638A JP5895616B2 (en) 2012-03-09 2012-03-09 Information processing apparatus and program execution method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012052638A JP5895616B2 (en) 2012-03-09 2012-03-09 Information processing apparatus and program execution method

Publications (2)

Publication Number Publication Date
JP2013186779A true JP2013186779A (en) 2013-09-19
JP5895616B2 JP5895616B2 (en) 2016-03-30

Family

ID=49388124

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012052638A Expired - Fee Related JP5895616B2 (en) 2012-03-09 2012-03-09 Information processing apparatus and program execution method

Country Status (1)

Country Link
JP (1) JP5895616B2 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20170085979A (en) * 2016-01-15 2017-07-25 캐논 가부시끼가이샤 Information processing apparatus and resource management method
CN107423103A (en) * 2017-05-09 2017-12-01 成都市宏山科技有限公司 The cell phone system of multiple softwares is run simultaneously
CN110941443A (en) * 2019-12-12 2020-03-31 支付宝(杭州)信息技术有限公司 Method and device for modifying file name in SDK and electronic equipment
CN111198710A (en) * 2020-01-03 2020-05-26 厦门美图之家科技有限公司 Program installation package processing method and device, electronic equipment and computer readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000293377A (en) * 1999-04-08 2000-10-20 Nec Software Chubu Ltd Coexistence environment structuring method and recording medium where coexistence environment structuring program is recorded
JP2001154831A (en) * 1999-11-25 2001-06-08 Nec Software Hokkaido Ltd System and method for controlling dynamic link library, and recording medium
JP2003058378A (en) * 2001-08-20 2003-02-28 Canon Inc Information processor, program installing method, storage medium and program
JP2005301403A (en) * 2004-04-07 2005-10-27 Matsushita Electric Ind Co Ltd Program performance device and program performance method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000293377A (en) * 1999-04-08 2000-10-20 Nec Software Chubu Ltd Coexistence environment structuring method and recording medium where coexistence environment structuring program is recorded
JP2001154831A (en) * 1999-11-25 2001-06-08 Nec Software Hokkaido Ltd System and method for controlling dynamic link library, and recording medium
JP2003058378A (en) * 2001-08-20 2003-02-28 Canon Inc Information processor, program installing method, storage medium and program
JP2005301403A (en) * 2004-04-07 2005-10-27 Matsushita Electric Ind Co Ltd Program performance device and program performance method

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20170085979A (en) * 2016-01-15 2017-07-25 캐논 가부시끼가이샤 Information processing apparatus and resource management method
KR102090977B1 (en) 2016-01-15 2020-04-23 캐논 가부시끼가이샤 Information processing apparatus and resource management method
CN107423103A (en) * 2017-05-09 2017-12-01 成都市宏山科技有限公司 The cell phone system of multiple softwares is run simultaneously
CN110941443A (en) * 2019-12-12 2020-03-31 支付宝(杭州)信息技术有限公司 Method and device for modifying file name in SDK and electronic equipment
CN110941443B (en) * 2019-12-12 2023-03-17 支付宝(中国)网络技术有限公司 Method and device for modifying file name in SDK (software development kit) and electronic equipment
CN111198710A (en) * 2020-01-03 2020-05-26 厦门美图之家科技有限公司 Program installation package processing method and device, electronic equipment and computer readable storage medium
CN111198710B (en) * 2020-01-03 2022-08-26 厦门美图之家科技有限公司 Program installation package processing method and device and electronic equipment

Also Published As

Publication number Publication date
JP5895616B2 (en) 2016-03-30

Similar Documents

Publication Publication Date Title
CN110275722B (en) Method, apparatus, device and storage medium for upgrading application
RU2601198C2 (en) Runtime system
CN105723341B (en) Realization method and system for layout engine and the memory model of script engine
CN105159788B (en) Method and system for dynamically sharing resources between Android applications
US20080005719A1 (en) Methods, systems, and computer program products for providing a program execution environment
JP2006092544A (en) Dynamic link of module in pre-operating system environment
WO2019079080A1 (en) Using semantic annotations to control compatibility behaviors
JP5895616B2 (en) Information processing apparatus and program execution method
JP6338713B2 (en) Flexible metadata composition
CN103853535A (en) Method and device for modifying middleware
US9183011B2 (en) Method and system for runtime environment emulation
US8606766B2 (en) Method and system to handle java class versioning
WO2007145428A1 (en) Methods of generating, linking, and updating component-based software and information storage medium having such software recorded thereon
US20100058305A1 (en) Automatic Generation of Language Bindings for Libraries Using Data from Compiler Generated Debug Information
CN108228266B (en) Method and device for starting Fragment component between different plug-ins under Android plug-in framework
JP2007510211A (en) Mapping dynamic link libraries on computer equipment
US20120054470A1 (en) Optimization system, optimization method, and compiler program
US10922107B2 (en) Apparatus and method for realizing runtime system for programming language
JP5506936B2 (en) Object level compatibility and class resizing using semantic values
US10310871B2 (en) Non-transitory computer-readable recording medium storing control program, control device and control method
US7690007B2 (en) Mapping of dynamic link libraries in a computing device
JP6639238B2 (en) Programs and computers
US20080307446A1 (en) Interoperable Managed and Unmanaged Code in a Document Environment
US9778917B2 (en) Dynamically building subsections of locale objects at run-time
CN117111958A (en) Incremental compiling method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20150210

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20151007

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20151013

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20151210

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20160202

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20160215

R150 Certificate of patent or registration of utility model

Ref document number: 5895616

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees