サードパーティの瓶を包みたい。残念ながら、ベンダーは、1 つのメソッドを持つ 1 つのクラス (a.class) をデフォルト パッケージに配置しました。
を使用してリソースを含めようとするとInclude-Resource: @lib/acme-8.0.jar
、次のエラーが発生します。
The default package '.' is not permitted by the Import-Package syntax.
This can be caused by compile errors in Eclipse because Eclipse creates valid class files regardless of compile errors.
The following package(s) import from the default package [com.acme.util]
bnd print -all acme-8.0.jar
次の出力が得られます (短縮され、ベンダー名が acme に置き換えられます)
[API USES]
. []
com.acme.common []
com.acme.acmedrt [com.acme.acmedrt.types, com.acme.acmedrt.comm.jobtransport, com.acme.acmedrt.workflow.type
s]
com.acme.acmedrt.impl [com.acme.acmedrt, com.acme.acmedrt.types, org.apache.commons.logging, com.acme.acmedrt.imp
l.types, com.acme.acmedrt.comm.jobtransport, com.acme.acmedrt.pool, org.apache.commons.pool, com.acme.acmedrt.workflow.types]
com.acme.acmedrt.impl.types [com.acme.acmedrt.types, com.acme.acmedrt, com.acme.acmedrt.impl, org.xml.sax]
com.acme.acmedrt.notification [com.acme.acmedrt]
com.acme.acmedrt.pool [com.acme.acmedrt, com.acme.acmedrt.impl.types, com.acme.acmedrt.impl, com.acme.acmedrt.types,
org.apache.commons.pool, com.acme.acmedrt.workflow.types]
com.acme.acmedrt.types [com.acme.acmedrt, com.acme.common]
com.acme.acmedrt.util []
com.acme.acmedrt.workflow.types [com.acme.common]
com.acme.tools []
com.acme.util []
com.acme.util.xml []
[LIST]
a.class
META-INF
MANIFEST.MF
com
com <no contents>
com/acme
com/acme <no contents>
com/acme/common
Enum.class
com/acme/acmedrt
[...]
この出力を正しく理解していれば、いくつかのパッケージがデフォルトのパッケージを使用しています。それはどのように可能ですか?私の知る限り、デフォルトのパッケージからクラスをインポートすることはできません。
問題のあるクラスを移動するように要求して、既にベンダーに連絡しました。おそらく、彼は私の提案に従わないだろう.
デフォルト パッケージのクラスを処理するための回避策はありますか?