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

Extracting String value using AutoCloseableSoftAssertion throws java.lang.ClassFormatError #1146

Closed
mavinkurve opened this issue Jan 5, 2018 · 10 comments
Labels
type: bug A general bug
Milestone

Comments

@mavinkurve
Copy link

Summary

Extracting string values from map throws following exception:

Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.assertj.core.internal.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:459)
at org.assertj.core.internal.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:336)
... 39 more
Caused by: java.lang.ClassFormatError: Duplicate method name&signature in class file org/assertj/core/api/ObjectArrayAssert$$EnhancerByCGLIB$$2a693b8d$$EnhancerByCGLIB$$e518c7e6
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
... 45 more

Example

        Map<String,String> data = new HashMap<>();
        data.put("one","1");
        data.put("two","2");
        data.put("three","3");
        try (final AutoCloseableSoftAssertions softly = new AutoCloseableSoftAssertions()) {
            softly.assertThat(data).extracting("one").containsExactly("1");
        }

Java 8 specific ?

No

  • YES : create Pull Request from the master branch
  • NO : create Pull Request from the 2.x branch
@joel-costigliola
Copy link
Member

@mavinkurve thanks for reporting this, which version are you using?

@joel-costigliola
Copy link
Member

joel-costigliola commented Jan 6, 2018

This is really hard to debug which poor exception information which does not tell what is the duplicated method :(

@mavinkurve
Copy link
Author

We started noticing this issue in version 3.9.0. It’s been working perfectly until the upgrade.

@joel-costigliola
Copy link
Member

Moving to byte buddy seems to resolve this issue #1093 but this comes with other challenges.

joel-costigliola added a commit to filiphr/assertj-core that referenced this issue Jan 7, 2018
@PascalSchumacher
Copy link
Member

Could be the same issue as https://stackoverflow.com/questions/39670735/classformaterror-duplicate-method-namesignature-from-enhancerbyspringcglib where Rafael Winterhalter says it is a cglib bug.

It could also be related to our shading of cglib, see jdbi/jdbi#26 for a similar issue.

@mavinkurve Which version were you using before upgrading to 3.9.0?

@mavinkurve
Copy link
Author

mavinkurve commented Jan 7, 2018 via email

@PascalSchumacher
Copy link
Member

The exceptions occurs in AbstractObjectArrayAssert. Sadly a lot of methods have been added to AbstractObjectArrayAssert between 3.8.0 and 3.9.0 :(.

@PascalSchumacher PascalSchumacher added the type: bug A general bug label Jan 8, 2018
@joel-costigliola
Copy link
Member

We are moving to byte buddy so this one is going to be fixed.

@mavinkurve
Copy link
Author

mavinkurve commented Jan 13, 2018 via email

joel-costigliola added a commit to filiphr/assertj-core that referenced this issue Jan 21, 2018
@filiphr
Copy link
Contributor

filiphr commented Jan 29, 2018

@joel-costigliola I think that with you merging #1093 this one is resolved.

@joel-costigliola joel-costigliola added this to the 3.9.1 milestone Jan 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants