Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
puredanger committed Dec 18, 2023
1 parent 6672b55 commit 272b344
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions content/reference/java_interop.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ toc::[]
[%hardbreaks]
**Classname[$InnerClass][pass:[*]]**

Symbols representing class names are resolved to the Class instance. Inner or nested classes are separated from their outer class with a `$`. Fully-qualified class names are always valid. If a class is import`ed in the namespace, it may be used without qualification.
Symbols representing class names are resolved to the Class instance. Inner or nested classes are separated from their outer class with a `$`. Fully-qualified class names are always valid. If a class is import`ed in the namespace, it may be used without qualification. All classes in java.lang are automatically imported to every namespace.

Since 1.12, class symbols may end in one or more pass:[*]s to refer to an array of the class. The number of pass:[*]s indicates the array dimension. Array classes may also use a primitive component, e.g. `pass:[long*]`.

All classes in java.lang are automatically imported to every namespace.

[source,clojure-repl]
----
String
Expand Down Expand Up @@ -59,11 +57,7 @@ Math/PI
-> 3.141592653589793
----

The preferred idiomatic forms for accessing field or method members are given above. The instance member form works for both fields and methods. The instanceField form is preferred for fields and required if both a field and a 0-argument method of the same name exist.

Since Clojure 1.12, instance method symbols may be qualified with the Class name.

All idiomatic forms expand into calls to the dot operator (described below) at macroexpansion time. The expansions are as follows:
The preferred idiomatic forms for accessing field or method members are given above. The instance member form works for both fields and methods. The instanceField form is preferred for fields and required if both a field and a 0-argument method of the same name exist. Since Clojure 1.12, instance method symbols may be qualified with the Class name. They all expand into calls to the dot operator (described below) at macroexpansion time. The expansions are as follows:

[source,clojure]
----
Expand Down Expand Up @@ -97,6 +91,8 @@ If the second operand is a symbol and no args are supplied it is taken to be a f

If the second operand is a list, or args are supplied, it is taken to be a method call. The first element of the list must be a simple symbol, and the name of the method is the name of the symbol. The args, if any, are evaluated from left to right, and passed to the matching method, which is called, and its value returned. If the method has a void return type, the value of the expression will be _**nil**_. Note that placing the method name in a list with any args is optional in the canonic form, but can be useful to gather args in macros built upon the form.

Since Clojure 1.12,

Note that boolean return values will be turned into Booleans, chars will become Characters, and numeric primitives will become Numbers unless they are immediately consumed by a method taking a primitive.

The member access forms given at the top of this section are preferred for use in all cases other than in macros.
Expand Down

0 comments on commit 272b344

Please sign in to comment.