framework
framework copied to clipboard
ReflectTools depends on unaccessible class
Attempting to compile the Vaadin Framework project on JDK9 or JDK10 I run into following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project vaadin-server: Compilation failure
[ERROR] server/src/main/java/com/vaadin/util/ReflectTools.java:[90,18] cannot access com.sun.beans.introspect.PropertyInfo
[ERROR] class file for com.sun.beans.introspect.PropertyInfo not found
The use of com.sun.beans.introspect should be replaced with something compatible with JDK 8, 9 and 10.
There were also some talks about using a separate bean introspection library instead of the one that is part of the JRE because of the way it requires using lots of extra parts from the Java 9+ modular JRE.
Also, I don't see any direct reference to e.g. com.sun.beans.introspect.PropertyInfo in the source file.
@tsuoanttila See JDK-8212636 I think it can be fixed by doing the following change in server/src/main/java/com/vaadin/util/ReflectTools.java.
Before:
Line 90: pd = new PropertyDescriptor(field.getName(), object.getClass());
After:
pd = new PropertyDescriptor((String)field.getName(), object.getClass());
yes, it's very weird, why add one more step to convert to string forcely works, can you explain it? difference between null and (String) null??
It actually solves the problem. Would you please explain, why this works?
not working
I think another workaround is to use "--release 8" command line parameter in compilation.
I had this problem on JDK 11 (Maven build fails): [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project flow-server: Compilation failure [ERROR] (...)/flow/flow-server/src/main/java/com/vaadin/flow/internal/ReflectTools.java:[115,18] cannot access com.sun.beans.introspect.PropertyInfo [ERROR] class file for com.sun.beans.introspect.PropertyInfo not found
@tsuoanttila See JDK-8212636 I think it can be fixed by doing the following change in
server/src/main/java/com/vaadin/util/ReflectTools.java. Before:Line 90: pd = new PropertyDescriptor(field.getName(), object.getClass());After:
pd = new PropertyDescriptor((String)field.getName(), object.getClass());
It definitely works, but I want to know why, really irrational!
PR: https://github.com/vaadin/framework/pull/12134
@tsuoanttila See JDK-8212636 I think it can be fixed by doing the following change in
server/src/main/java/com/vaadin/util/ReflectTools.java. Before:Line 90: pd = new PropertyDescriptor(field.getName(), object.getClass());After:
pd = new PropertyDescriptor((String)field.getName(), object.getClass());
Thank you @sam-ma for your solution, it worked for me!!!