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

ReflectTools depends on unaccessible class #10737

Open
tsuoanttila opened this issue Mar 21, 2018 · 10 comments
Open

ReflectTools depends on unaccessible class #10737

tsuoanttila opened this issue Mar 21, 2018 · 10 comments

Comments

@tsuoanttila
Copy link
Contributor

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.

@Legioth
Copy link
Member

Legioth commented Mar 21, 2018

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.

@sam-ma
Copy link

sam-ma commented Oct 17, 2018

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

@wencaiwulue
Copy link

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

@HasanAmmori
Copy link

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

@novboy
Copy link

novboy commented Feb 18, 2020

not working

@TatuLund
Copy link
Contributor

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

@gv2011
Copy link

gv2011 commented Sep 11, 2020

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

@winter4666
Copy link

winter4666 commented Oct 19, 2020

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

@mvysny
Copy link
Member

mvysny commented Oct 23, 2020

PR: #12134

@wences44
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.