ckeditor / ckeditor4

The best enterprise-grade WYSIWYG editor. Fully customizable with countless features and plugins.
https://ckeditor.com/ckeditor-4
Other
5.79k stars 2.48k forks source link

./dev/builder/build.sh produces fatal errors on JDK 16 (previously warnings on earlier versions) #4883

Closed xjm closed 3 years ago

xjm commented 3 years ago

Type of report

Bug

Provide detailed reproduction steps (if any)

  1. Install an old version of JDK (I'm using openjdk@11 from Homebrew for this step).
  2. Clone the repo and check out the release/4.16.x branch.
  3. Run ./dev/builder/build.sh -s
  4. See the warning: WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.mozilla.javascript.MemberBox (file:/Users/xjm/git/ckeditor4/dev/builder/ckbuilder/2.3.2/ckbuilder.jar) to method sun.java2d.SunGraphics2D.drawImage(java.awt.Image,int,int,java.awt.image.ImageObserver) WARNING: Please consider reporting this to the maintainers of org.mozilla.javascript.MemberBox WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release
  5. Note that the build is successful despite the warning.
  6. Upgrade to JDK 16 (I used the current default version of openjdk from Homebrew for this step).
  7. Run ./dev/builder/build.sh -s
  8. See the error:

    Exception in thread "main" org.mozilla.javascript.WrappedException: Wrapped java.lang.IllegalAccessException: class org.mozilla.javascript.MemberBox cannot access class sun.java2d.SunGraphics2D (in module java.desktop) because module java.desktop does not export sun.java2d to unnamed module @3f0aaff5 (C:\ckbuilder\src/lib/image.js#282) at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1754) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:134) at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225) at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52) at ckbuilder.lib.image._c_anonymous_7(C:\ckbuilder\src/lib/image.js:282) at ckbuilder.lib.image.call(C:\ckbuilder\src/lib/image.js) at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52) at ckbuilder.lib.image._c_anonymous_4(C:\ckbuilder\src/lib/image.js:144) at ckbuilder.lib.image.call(C:\ckbuilder\src/lib/image.js) at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52) at ckbuilder.lib.builder._c_createPluginsSpriteImage_15(C:\ckbuilder\src/lib/builder.js:476) at ckbuilder.lib.builder.call(C:\ckbuilder\src/lib/builder.js) at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:74) at ckbuilder.lib.builder._c_anonymous_20(C:\ckbuilder\src/lib/builder.js:703) at ckbuilder.lib.builder.call(C:\ckbuilder\src/lib/builder.js) at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:85) at ckbuilder.lib.controller._c_anonymous_5(C:\ckbuilder\src/lib/controller.js:78) at ckbuilder.lib.controller.call(C:\ckbuilder\src/lib/controller.js) at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2430) at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:269) at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:97) at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52) at ckbuilder.lib.controller._c_anonymous_14(C:\ckbuilder\src/lib/controller.js:235) at ckbuilder.lib.controller.call(C:\ckbuilder\src/lib/controller.js) at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32) at ckbuilder.ckbuilder._c_script_0(C:\ckbuilder\src/ckbuilder.js:112) at ckbuilder.ckbuilder.call(C:\ckbuilder\src/ckbuilder.js) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091) at ckbuilder.ckbuilder.call(C:\ckbuilder\src/ckbuilder.js) at ckbuilder.ckbuilder.exec(C:\ckbuilder\src/ckbuilder.js) at org.mozilla.javascript.optimizer.OptRuntime$1.run(OptRuntime.java:218) at org.mozilla.javascript.Context.call(Context.java:489) at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:504) at org.mozilla.javascript.optimizer.OptRuntime.main(OptRuntime.java:206) at ckbuilder.ckbuilder.main(C:\ckbuilder\src/ckbuilder.js) Caused by: java.lang.IllegalAccessException: class org.mozilla.javascript.MemberBox cannot access class sun.java2d.SunGraphics2D (in module java.desktop) because module java.desktop does not export sun.java2d to unnamed module @3f0aaff5 at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:385) at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:687) at java.base/java.lang.reflect.Method.invoke(Method.java:559) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126) ... 34 more

Expected result

I would expect the same build following steps 2 and 7.

Actual result

On opendjk 16, the build process fatals and the release is not created.

JDK 11 and openjdk 11 are both EOL in 2024, after CKEditor 4's documented end-of-life, so maybe this isn't a serious issue. However, at a minimum the build script could output an error message to downgrade to an older version if the version is 16.0.0 or higher.

Other details

jacekbogdanski commented 3 years ago

Thanks, @xjm for letting us know about this issue.

JDK 11 and openjdk 11 are both EOL in 2024, after CKEditor 4's documented end-of-life, so maybe this isn't a serious issue.

Indeed it may be not worth investing time fixing the code to work with the newer versions of JDK due to similar EOL dates, although we will verify if it's something we can improve.

However, at a minimum the build script could output an error message to downgrade to an older version if the version is 16.0.0 or higher.

Not sure if it would require digging into our builder code which we treat mostly as a black box, in the worst case we could just do some sniffing from the bash.

wimleers commented 3 years ago

Can confirm this!

jacekbogdanski commented 3 years ago

We don't really want to dig into our builder as it's rather complicated, so let's just add information to readme about the correct JDK version requirement. We should also update https://github.com/ckeditor/ckeditor4-presets

jacekbogdanski commented 3 years ago

Moved back as I didn't notice it's about CKE4 builder, not the one in presets (although both are affected).

CKEditorBot commented 3 years ago

Closed in https://github.com/ckeditor/ckeditor4/pull/4932