lundi 21 décembre 2015

getParameters() should return an array and this code should succeed in the jdk 7 maven project

                private void setPropertiesToBasePojoMarkerImpl(Object obj, Method[] methods) {
                for (Method method : methods) {
                    if (method.getName().contains("get") && !method.isAnnotationPresent(Worker.class)
                            && !method.getName().contains("getClass") && isPojoMarkerMethod(method)
                            && method.getParameters().length == 0) {
// in the above condition it says the method getParameters() is undefined for type Method
                        try {
                            Serializable result = (Serializable) method.invoke(obj, new Object[0]);
                            if (result != null) {
                                if (staticRegistry.isReferencePresent(result) != null)
                                    result = staticRegistry.isReferencePresent(result);
                            }
                            String propname = method.getName().toString().substring(3).toLowerCase();
                            beanEnhancer.getServerBasePojoMarkerImpl().setProperty(propname, result);
                        } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
                            logger.log(Level.WARNING, "unable to invoke method with name" + method.getName() + " "
                                    + e);
                        }
                    }
                }

So the issue here is that its a maven project with JDK 7 source configuration. It builds flawlessly on linux and windows machines. On my mac book pro it consistently says the said method is unavailable for type Method.

I am certain this method should be available on all builds of JDK 7.

Any clues ?





Aucun commentaire:

Enregistrer un commentaire