← All documentation

Java Interop Reference for PTC-Lisp

Warning: This file is auto-generated by mix ptc.gen_docs from priv/java_interop.exs. Manual edits will be overwritten. Edit priv/java_interop.exs instead.

PTC-Lisp emulates a subset of Java interop for LLM compatibility. These are not real JVM calls — they are BEAM-native implementations that mirror the Java API surface LLMs are trained on.

40 interop entries covering 12 Java classes in 13 presentation groups.

See also: Function Reference | PTC-Lisp Specification | Namespace coverage: docs/conformance/index.md

java.lang.Boolean

NameKindSignatureDescriptionNotes
Boolean/parseBooleanStatic(Boolean/parseBoolean s)Parse "true"/"false" to booleanMatches java.lang.Boolean.parseBoolean: nil/null and every string other than case-insensitive "true" return false; non-string, non-nil inputs raise.

java.lang.Double

NameKindSignatureDescriptionNotes
Double/NEGATIVE_INFINITYConstantDouble/NEGATIVE_INFINITYNegative infinity constant (##-Inf)
Double/NaNConstantDouble/NaNNot-a-Number constant (##NaN)
Double/POSITIVE_INFINITYConstantDouble/POSITIVE_INFINITYPositive infinity constant (##Inf)
Double/parseDoubleStatic(Double/parseDouble s)Parse string to doubleUses Java syntax, whitespace, range, rounding, and bounded NumberFormatException/NullPointerException semantics.

java.lang.Float

NameKindSignatureDescriptionNotes
Float/parseFloatStatic(Float/parseFloat s)Parse string to floatUses Java syntax, whitespace, range, direct float rounding, and bounded NumberFormatException/NullPointerException semantics.

java.lang.Integer

NameKindSignatureDescriptionNotes
Integer/parseIntStatic(Integer/parseInt s)Parse string to integerUses Java decimal syntax, int range checks, and bounded NumberFormatException semantics.

java.lang.Long

NameKindSignatureDescriptionNotes
Long/parseLongStatic(Long/parseLong s)Parse string to integerUses Java decimal syntax, long range checks, and bounded NumberFormatException semantics.

java.lang.Math

NameKindSignatureDescriptionNotes
Math/absStatic(Math/abs x)Return the absolute value using a selected Java primitive overloadPreserves int, long, float, or double identity and Java minimum-value overflow.
Math/ceilStatic(Math/ceil x)Return the smallest double value not less than the argumentReturns a Java double and preserves signed zero and non-finite values.
Math/floorStatic(Math/floor x)Return the largest double value not greater than the argumentReturns a Java double and preserves signed zero and non-finite values.
Math/maxStatic(Math/max x y)Return the greater of two Java primitive valuesUses exact primitive overload selection plus Java NaN and signed-zero behavior.
Math/minStatic(Math/min x y)Return the smaller of two Java primitive valuesUses exact primitive overload selection plus Java NaN and signed-zero behavior.
Math/powStatic(Math/pow base exponent)Return the first argument raised to the power of the secondUses the Java double overload and its IEEE 754 special-case table.
Math/roundStatic(Math/round x)Round a float to int or double to long with ties toward positive infinityNaN becomes zero and infinities saturate to the selected integer primitive range.
Math/sqrtStatic(Math/sqrt x)Return the positive double square rootUses Java double semantics for negative, signed-zero, NaN, and infinite inputs.

java.lang.String

NameKindSignatureDescriptionNotes
.containsMethod(.contains s substr)Returns true if string contains substring
.endsWithMethod(.endsWith s suffix)Returns true if string ends with suffix
.indexOfMethod(.indexOf s substr), (.indexOf s substr from-index)Index of first occurrence of substring, or -1 if not foundReturns Java UTF-16 code-unit indexes.
.lastIndexOfMethod(.lastIndexOf s substr)Index of last occurrence of substring, or -1 if not foundReturns Java UTF-16 code-unit indexes.
.lengthMethod(.length s)Return the UTF-16 code-unit length of a stringUses Java UTF-16 code units; ordinary PTC count remains grapheme-based.
.startsWithMethod(.startsWith s prefix)Returns true if string starts with prefix
.substringMethod(.substring s start), (.substring s start end)Extract a substring by UTF-16 code-unit indexUses Java UTF-16 code-unit indexes. A range containing an unpaired surrogate returns invalid_java_string because PTC strings require valid UTF-8.
.trimMethod(.trim s)Remove leading and trailing code units from U+0000 through U+0020Uses Java String.trim semantics, not clojure.string/trim whitespace semantics.

java.lang.System

NameKindSignatureDescriptionNotes
System/currentTimeMillisStatic(System/currentTimeMillis)Return current time in milliseconds since Unix epoch

java.time.Duration

NameKindSignatureDescriptionNotes
.toDaysMethod(.toDays duration)Return duration length in whole daysPartial days truncate toward zero.
.toMillisMethod(.toMillis duration)Return duration length in millisecondsWorks on Duration values returned by Duration/between.
Duration/betweenStatic(Duration/between start-instant end-instant), (java.time.Duration/between start-instant end-instant)Return a native Duration between two InstantsRequires native Instant values; LocalDate, Date, and raw host temporal structs are rejected.

java.time.Instant

NameKindSignatureDescriptionNotes
.toEpochMilliMethod(.toEpochMilli instant)Return epoch milliseconds from an InstantPreserves nanoseconds natively and raises on Java long overflow.
Instant/parseStatic(Instant/parse iso-string), (java.time.Instant/parse iso-string)Parse strict ISO-8601 text to a native InstantAn explicit UTC or numeric offset is required; nanoseconds are retained.

java.time.LocalDate

NameKindSignatureDescriptionNotes
.minusDaysMethod(.minusDays local-date n)Subtract days from a LocalDateJava long coercion is applied to n.
.plusDaysMethod(.plusDays local-date n)Add days to a LocalDateJava long coercion is applied to n.
.toEpochDayMethod(.toEpochDay local-date)Return LocalDate epoch-day integerWorks on LocalDate values returned by LocalDate/parse.
LocalDate/parseStatic(LocalDate/parse date-string), (java.time.LocalDate/parse date-string)Parse strict ISO-8601 text to a native LocalDateDate-time text is rejected; class identity is retained natively.

java.time.LocalDate / java.time.Instant

NameKindSignatureDescriptionNotes
.isAfterMethod(.isAfter a b)Returns true if receiver comes strictly after argument (same-type only)Receiver-owned for LocalDate and Instant; mixed classes are rejected.
.isBeforeMethod(.isBefore a b)Returns true if receiver comes strictly before argument (same-type only)Receiver-owned for LocalDate and Instant; mixed classes are rejected.

java.util.Date

NameKindSignatureDescriptionNotes
.afterMethod(.after date other-date)Returns true if a legacy Date follows anotherOwned only by java.util.Date.
.beforeMethod(.before date other-date)Returns true if a legacy Date precedes anotherOwned only by java.util.Date.
.getTimeMethod(.getTime date)Return exact epoch milliseconds from a legacy DateOwned only by java.util.Date.
java.util.Date.Constructor(java.util.Date.), (java.util.Date. epoch-milliseconds), (java.util.Date. legacy-date-string)Construct a native legacy Date from current time, exact milliseconds, or legacy textInteger input is always Java epoch milliseconds. ISO-8601 strings and raw host temporal structs are not Date constructor overloads.