On 5/22/2018 10:54 PM, breaux@ wrote:
> 2018-05-22 12:43:24,384 ERROR [freemarker.runtime]: error - Error executing
> FreeMarker template
> FreeMarker template error:
> Java method "AbstractCollection.size()" threw an exception when invoked on
> LinkedHashMap$LinkedKeySet object "[]"; see cause exception in the Java stack
> trace.
> Caused by: java.lang.AbstractMethodError: java/util/AbstractCollection.size()I
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
> at java.lang.reflect.Method.invoke(Method.java:508)
> at
> freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1487)
It seems IBM JDK 8 has different behavior than Oracle or OpenJDK 8. Your
exception claims that JDK is not able to call abstract method size on
LinkedKeySet but here, Oracle and OpenJDK 8 are able to run:
LinkedHashMap lhm = new LinkedHashMap();
Object ks = LinkedHashMap.class.getMethod("keySet").invoke(lhm);
System.out.println("COPY ME 1: " + ks.getClass());
Method m = AbstractCollection.class.getMethod("size");
System.out.println("COPY ME 2: " + m);
Object s = m.invoke(ks);
System.out.println("COPY ME 3: " + s);
They prints:
COPY ME 1: class java.util.LinkedHashMap$LinkedKeySet
COPY ME 2: public abstract int java.util.AbstractCollection.size()
COPY ME 3: 0
which means they're able! I don't know if IBM violates Java
Specification here or Oracle and OpenJDK do. Are you able to ask IBM why
above piece of code fails on their JDK 8 and pass on 7?
Thanks in advance!
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]