framework icon indicating copy to clipboard operation
framework copied to clipboard

ReflectTools depends on unaccessible class

Open tsuoanttila opened this issue 7 years ago • 10 comments
trafficstars

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.

tsuoanttila avatar Mar 21 '18 12:03 tsuoanttila

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.

Legioth avatar Mar 21 '18 13:03 Legioth

@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());

sam-ma avatar Oct 17 '18 05:10 sam-ma

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??

wencaiwulue avatar Nov 04 '19 07:11 wencaiwulue

It actually solves the problem. Would you please explain, why this works?

HasanAmmori avatar Jan 16 '20 22:01 HasanAmmori

not working

novboy avatar Feb 18 '20 12:02 novboy

I think another workaround is to use "--release 8" command line parameter in compilation.

TatuLund avatar Feb 18 '20 13:02 TatuLund

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

gv2011 avatar Sep 11 '20 07:09 gv2011

@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!

winter4666 avatar Oct 19 '20 07:10 winter4666

PR: https://github.com/vaadin/framework/pull/12134

mvysny avatar Oct 23 '20 08:10 mvysny

@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!!!

wences44 avatar Nov 15 '22 23:11 wences44