boonproject / boon

Simple opinionated Java for the novice to expert level Java Programmer. Low Ceremony. High Productivity.
http://richardhightower.github.io/site/Boon/Welcome.html
Apache License 2.0
520 stars 102 forks source link

JDK 9 support #376

Open johnpoth opened 7 years ago

johnpoth commented 7 years ago

The project currently fails on JDK 9:

Caused by: java.lang.ClassCastException: [B cannot be cast to [C

To reproduce:

import org.boon.core.reflection.Reflection;
@Test
    public void testJdk9Support() throws Exception {
        Reflection.respondsTo(null, "dummy");
    }

The above fails in Reflection.java's nested static initializers. I've traced the problem to org.boon.core.reflection.FastStringUtils#toCharArray(java.lang.String) which seem to rely on sun.misc.unsafe. To checkout a full fledged example, see BoonConcurrentTest but I don't think it's needed to illustrate the problem.

Thanks!

RichardHightower commented 7 years ago

Yeah..Stephane Landelle reported this a few years ago. :) Then they added Unsafe back and then they took it out again. I guess it is time to fix it. I will try a fix that keeps perf for 1.8 but loses it only for 1.9. Thanks for reminding me. I am a bit under water now. But I will try to take a poke by end of May. BTW I accept PRs. :)

cristiammercado commented 6 years ago

Any update on this issue?

nilskp commented 6 years ago

Guess this project is dead.

konsultaner commented 5 years ago

@RichardHightower Are you going to let this project die because of this issue?

nhojpatrick commented 5 years ago

any update... or should I assume the project is dead?

for JDK 9 (9.0.4+11) I get;

Caused by: java.lang.ClassCastException: [B cannot be cast to [C
    at org.boon.core.reflection.FastStringUtils$StringImplementation$1.toCharArray(FastStringUtils.java:92)

for JDK 10 (10.0.2+13) I get;

Caused by: java.lang.ClassCastException: [B cannot be cast to [C
    at org.boon.core.reflection.FastStringUtils$StringImplementation$1.toCharArray(FastStringUtils.java:92)

for JDK 11 (11.0.2+9) I get;

Caused by: java.lang.ClassCastException: class [B cannot be cast to class [C ([B and [C are in module java.base of loader 'bootstrap')
    at org.boon.core.reflection.FastStringUtils$StringImplementation$1.toCharArray(FastStringUtils.java:92)

for JDK 12 (12+33) I get;

Caused by: java.lang.ClassCastException: class [B cannot be cast to class [C ([B and [C are in module java.base of loader 'bootstrap')
    at org.boon.core.reflection.FastStringUtils$StringImplementation$1.toCharArray(FastStringUtils.java:92)

for JDK 13 (13-ea+12) I get;

Caused by: java.lang.ClassCastException: class [B cannot be cast to class [C ([B and [C are in module java.base of loader 'bootstrap')
    at org.boon.core.reflection.FastStringUtils$StringImplementation$1.toCharArray(FastStringUtils.java:92)
konsultaner commented 5 years ago

@nhojpatrick Apparently jackson now has the same performance as boon. I exchanged boon with jackson and have not been disappointed by now. The only thing I had to be aware of was to configure the mapper to work as expected (as boon works)

public static final ObjectMapper MAPPER = new ObjectMapper(){{
    this.registerModule(new ParameterNamesModule());
    this.setVisibility(FIELD, ANY);
    this.setSerializationInclusion(JsonInclude.Include.NON_NULL);
    this.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false);
    this.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS,false);
    this.configure(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS,false);
}};
jsocola commented 4 years ago

@RichardHightower do you will continue with boon and qbit?

benjwarner commented 3 years ago

We have a legacy system that was having this problem.

Using the system property:

-Dorg.boon.faststringutils.disable=true

...seemed to fix the problem.