ClassCircularityError
If a class extends itself or an interface extends itself ClassCircularityError occur can occur
How can a class extends itself ?
Generally this does not happen . But is situation Where multiple version of same class exists in the library this kind of issue can occur
For example
in library Class Circular is available at two locations with different versions
com.org.online.Circular
com.org.offline.Circular
this classes are available in library defined for class Test.
So when Test class will be complied , ClassCircularityError might occur.
When is this error thrown?
java.lang.ClassCircularityError occurs when program overrides ClassLoader.loadClass and
call Class.getSimpleName().
-->If a class extends itself or an interface extends itself ClassCircularityError occur can occur
How can a class extends itself ?
Generally this does not happen . But is situation Where multiple version of same class exists in the library this kind of issue can occur
For example
in library Class Circular is available at two locations with different versions
com.org.online.Circular
com.org.offline.Circular
this classes are available in library defined for class Test.
So when Test class will be complied , ClassCircularityError might occur.
When is this error thrown?
java.lang.ClassCircularityError occurs when program overrides ClassLoader.loadClass and
call Class.getSimpleName().
Exception stack trace generally comes like
Exception in thread "main" java.lang.ClassCircularityError: app/Class1$ChildClass
at java.lang.Class.getDeclaringClass(Native Method)
at java.lang.Class.getEnclosingClass(Class.java:1085)
at java.lang.Class.getSimpleBinaryName(Class.java:1220)
at java.lang.Class.getSimpleName(Class.java:1112)
at server.ClassLoaderImpl.loadClass(ClassLoaderImpl.java:16)
Whhere does it fall in Error hierarchy?
Class ClassCircularityError java.lang.Object
java.lang.Throwable
java.lang.Error
java.lang.LinkageError
java.lang.ClassCircularityError
-->
No comments:
Post a Comment