Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Substitute OpenBeans for java.beans so Android tests work #1067

Open
wants to merge 1 commit into
base: release/2.x
Choose a base branch
from

Conversation

allenluce
Copy link

The Android implementation of java.beans does not include everything which gives rise to error messages like this:

E/TestRunner: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/beans/Introspector; at
  org.powermock.configuration.support.ConfigurationMapper.map(ConfigurationMapper.java:44) at
  org.powermock.configuration.support.ConfigurationBuilder$ConfigurationCreator.mapConfiguration(ConfigurationBuilder.java:80) at
  ...

While it's not clear to me why such abject fanciness is needed in the ConfigurationMapper to take care of a sum total of three properties, it is clear that this change represents a minimum of source changes to get to a working state on Android.

Fixes #1062

The Android implementation of java.beans does not include everything
which gives rise to error messages like this:

    E/TestRunner: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/beans/Introspector; at
       org.powermock.configuration.support.ConfigurationMapper.map(ConfigurationMapper.java:44) at
       org.powermock.configuration.support.ConfigurationBuilder$ConfigurationCreator.mapConfiguration(ConfigurationBuilder.java:80) at
       ...

While it's not clear to me why such abject fanciness is needed in the
ConfigurationMapper to take care of a sum total of three properties,
it is clear that this change represents a minimum of source changes to
get to a working state.

Fixes powermock#1062
Copy link
Member

@thekingn0thing thekingn0thing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that better approach is to rewrite ConfigurationMapper in a way that compatable both OpenJDK(Oracle Java) and Google Android JDK I don't know if Google Android JDK supports MethodHandlers but if it does support then MethodHandlers is a good candidate to use here.

@@ -1 +1,3 @@

dependencies {
compile("com.musala.atmosphere:openbeans-jxpath:0.0.1")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I can see the library is not being developed since 2016. Adding it as dependecies will bring it to all users of PowerMock but fix is needed only for Android users.

I think that better approach is to rewrite ConfigurationMapper in a way that compatable both OpenJDK(Oracle Java) and Google Android Java.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a perfectly valid approach. Let me know if you'd like me to review your PR for it.

@miroslawz81
Copy link

Is there a chance to give this change a 'critical' priority? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

java.lang.NoClassDefFoundError: Failed resolution of: Ljava/beans/Introspector;
3 participants