I am trying to figure out how to call a method staticwith no arguments in Clojure. Two (bad) examples: (sun.misc.Unsafe/getUnsafe)and (Object/getClass), both of which generate CompilerException, called NoSuchFieldException.
static
(sun.misc.Unsafe/getUnsafe)
(Object/getClass)
CompilerException
NoSuchFieldException
Yes, I know that there is an easier way to call getClass, and I should not use sun.misc.Unsafeat all - just wondering how to call the static no-arg method in Clojure at all.
getClass
sun.misc.Unsafe
Your examples do not work, but the following
(System/currentTimeMillis) > 1398285925298
So, the way to call the static no-arg method.
Object/getClass not displayed as a static method. It should have been called on an object, not on a class.
Object/getClass
Unsafe . - ; . Java Magic. 4: sun.misc.Unsafe . Clojure, :
Unsafe
(let [f (.getDeclaredField sun.misc.Unsafe "theUnsafe")] (.setAccessible f true) (.get f nil)) ;= #<Unsafe sun.misc.Unsafe@63124f52>
acomar WolfeFan, getClass - , Object , , :
Object
(.getClass the-unsafe) ; the-unsafe obtained as above ;= sun.misc.Unsafe
, (Foo/meth) Clojure.
(Foo/meth)
Source: https://habr.com/ru/post/1537778/More articles:Memory leak using Curl and OpenSSL - cBibTeX parsing library - javascriptHow can I change the opacity of an image without changing the contents of the div? - cssSet a new variable with a string name from an existing variable - bashsometimes javascript works perfect, and sometimes not in ruby ββon rails 4 - javascriptInvoking additional actions before the MST timeout expires process threads - c #Transferring data with a few actions - androidvb.net, javascript issue including strict mode - javascriptVisual Studio 2010 vs Visual Studio 2013 - Various Compiler Errors - Why? - vb.netC ++ memory platform for static vs member function static vs member function static - c ++All Articles