This is an automated email from the git hooks/post-receive script. New commit to branch develop-2.x in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 4e186e2b5abb41662e080c65aa813ce97cfbab6d Author: Eric Chatellier <chatellier@codelutin.com> Date: Wed Apr 22 15:31:49 2020 +0200 fixes #1907: fix regression. For JScrollPane (for example), child were not added to viewport for was: $jscrollPane0.add(child) instead of $jscrollPane0.getViewport().add(child) --- .../java/jaxx/compiler/beans/JAXXIntrospector.java | 36 +++++++++++++--------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java index c7634aa8..4f2a4d1c 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java @@ -25,13 +25,14 @@ package jaxx.compiler.beans; import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorHelper; import jaxx.compiler.reflect.MethodDescriptor; +import jaxx.compiler.tags.DefaultComponentHandler; import java.beans.BeanDescriptor; import java.beans.BeanInfo; +import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyChangeListener; import java.beans.PropertyDescriptor; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Enumeration; import java.util.EventListener; @@ -86,10 +87,17 @@ public class JAXXIntrospector { PropertyDescriptor[] explicitProperties = explicitBeanInfo.getPropertyDescriptors(); for (PropertyDescriptor explicitProperty : explicitProperties) { Class<?> type = explicitProperty.getPropertyType(); + if (type == null) { + continue; + } Method readMethod = explicitProperty.getReadMethod(); Method writeMethod = explicitProperty.getWriteMethod(); try { - ClassDescriptor typeDescriptor = ClassDescriptorHelper.getClassDescriptor(type.getName(), type.getClassLoader()); + ClassDescriptor typeDescriptor = null; + if (writeMethod != null) { + type = writeMethod.getParameterTypes()[0]; + typeDescriptor = ClassDescriptorHelper.getClassDescriptor(writeMethod.getParameterTypes()[0].getName(), type.getClassLoader()); + } JAXXPropertyDescriptor propertyDescriptor = new JAXXPropertyDescriptor(classDescriptor, explicitProperty.getName(), readMethod != null ? classDescriptor.getMethodDescriptor(readMethod.getName()) : null, writeMethod != null ? classDescriptor.getMethodDescriptor(writeMethod.getName(), typeDescriptor) : null); @@ -159,7 +167,13 @@ public class JAXXIntrospector { explicitBeanDescriptor.attributeNames(); while (attributeNames.hasMoreElements()) { String name = attributeNames.nextElement(); - beanDescriptor.setValue(name, explicitBeanDescriptor.getValue(name)); + Object value = explicitBeanDescriptor.getValue(name); + if (DefaultComponentHandler.CONTAINER_DELEGATE_ATTRIBUTE.equals(name) && "".equals(value)) { + // empty on jdk > 8 + continue; + } + beanDescriptor.setValue(name, value); + } } } @@ -171,19 +185,11 @@ public class JAXXIntrospector { private static BeanInfo getExplicitBeanInfo(ClassDescriptor classDescriptor) { try { - Class<?> beanClass = Class.forName(classDescriptor.getName(), true, classDescriptor.getClassLoader()); // see if there is a class by that name in this package - Method findExplicitBeanInfo = Introspector.class.getDeclaredMethod("findExplicitBeanInfo", new Class[]{Class.class}); - findExplicitBeanInfo.setAccessible(true); - return (BeanInfo) findExplicitBeanInfo.invoke(null, beanClass); - } catch (ClassNotFoundException e) { + Class<?> beanClass = Class.forName(classDescriptor.getName(), true, classDescriptor.getClassLoader()); + return Introspector.getBeanInfo(beanClass); + } catch (ClassNotFoundException | NoClassDefFoundError e) { return null; // happens for uncompiled classes - } catch (NoClassDefFoundError e) { - return null; // wrong case, etc. - } catch (NoSuchMethodException e) { - throw new RuntimeException("Error: could not find method 'findExplicitBeanInfo' in java.beans.Introspector. You are most likely running a version of Java against which JAXX has not been tested."); - } catch (InvocationTargetException e) { - throw new RuntimeException(e); - } catch (IllegalAccessException e) { + } catch (IntrospectionException e) { throw new RuntimeException(e); } } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.