You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exception in thread "main" java.lang.ClassFormatError:Duplicate method name&signature in classfile test/B$
at java.lang.ClassLoader.defineClass1(NativeMethod)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(NativeMethod)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.getDeclaredMethods0(NativeMethod)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:125)
Interestingly, if we removed the "final" marker in object B, the code will run properly.
The text was updated successfully, but these errors were encountered:
@soc said (edited on Sep 25, 2015 5:04:25 PM UTC):
My first guess¹ would be that this is caused by the compiler's behavior of treating definitions of values with literals as constant types: some check in an earlier phase doesn't take this into account and then in the backend the constant type is again erased to the same signature as the other method from the parent.
will cause the following error when B is loaded:
Interestingly, if we removed the "final" marker in object B, the code will run properly.
The text was updated successfully, but these errors were encountered: