使用使用java.beans中的类(内部检查,BeanInfo的或的PropertyDescriptor)罐beans、java、PropertyDescriptor、BeanInfo

2023-09-04 05:47:19 作者:AkumaのKim

我有第三方的jar(,我不能改变的),使用 java.beans.Introspector中 java.beans.BeanInfo中 java.beans.PropertyDescriptor中

我如何使用的jar在我的Andr​​oid应用程序?

它无法加载类(使用内部检查)来自届党的jar:

  WARN / dalvikvm(780):VFY:无法解析静态方法6325:Ljava /豆/内部检查; .getBeanInfo(Ljava /朗/类)Ljava /豆/ BeanInfo的;
WARN / dalvikvm(780):VFY:无法解决的异常类962(Ljava /豆/ IntrospectionException在;)
WARN / dalvikvm(780):验证拒绝类Lorg / thirdpartyjar / SomeClass的;
 

解决方案

唯一的解决方案是一个维护的噩梦:叉所有届党从源罐和重写他们,所以他们不使用的java.beans *类(可能通过更换他们openbeans)。

然后,每一次的届党罐中的一个发布修补程序(例如,用于关键的安全漏洞),这样做的一遍的。

I have 3rd party jar (which I can't change) that uses java.beans.Introspector, java.beans.BeanInfo and java.beans.PropertyDescriptor.

在 NetBeans 9 中启用 Java EE Jakarta EE 支持

How can I use that jar in my android application?

It fails loading the class (which uses Introspector) from the 3th party jar:

WARN/dalvikvm(780): VFY: unable to resolve static method 6325: Ljava/beans/Introspector;.getBeanInfo (Ljava/lang/Class;)Ljava/beans/BeanInfo;
WARN/dalvikvm(780): VFY: unable to resolve exception class 962 (Ljava/beans/IntrospectionException;)
WARN/dalvikvm(780): Verifier rejected class Lorg/thirdpartyjar/SomeClass;

解决方案

The only solution is a maintenance nightmare: Fork all 3th party jars from source and rewrite them so they don't use java.beans.* classes (possibly by replacing them for openbeans).

Then, every time one of those 3th party jars releases a hotfix (for example for a critical security bug), do that all over again.

 
精彩推荐
图片推荐