Declarations and signatures

Signatures come from the compiler, so they show exactly what JDK 25 accepts. Type names in signatures link to their documentation, here or in external Javadoc.

Generics, arrays and varargs

Bounds, wildcards and intersection types are kept as declared. Arrays and varargs keep their brackets and dots.

    /** Combines array and variable arguments.
     * @param values input arrays
     * @param labels labels
     * @return the labels
     */
    public String[] combine(int[][] values, String... labels) { return labels; }
public String[] combine(int[][] values, String... labels)[source]

Combines array and variable arguments.

Parameters:
  • values – input arrays

  • labels – labels

Returns:

the labels

Records

Record components appear in the signature and are documented by the record’s @param tags. The compiler-generated accessors are listed as members.

/** A timestamped location.
 * @param x horizontal coordinate
 * @param at time supplied by the standard-library dependency
 */
public record Point(int x, Instant at) implements Shape {}
public final record demo.Point(int x, Instant at) implements Shape[source]

A timestamped location.

Parameters:
  • x – horizontal coordinate

  • at – time supplied by the standard-library dependency

Constructors

public Point(int x, Instant at)[source]

Fields and constants

public Instant at
public int x

Methods

public Instant at()
public final boolean equals(Object o)
public final int hashCode()
public final String toString()
public int x()

Sealed types

sealed and the permits clause are part of the signature.

/** Something with a position; only {@link Point} implements it. */
public sealed interface Shape permits Point {
    /** Returns the horizontal coordinate.
     * @return the coordinate
     */
    int x();
}
public abstract sealed interface demo.Shape permits Point[source]

Something with a position; only Point implements it.

Methods

public abstract int x()[source]

Returns the horizontal coordinate.

Returns:

the coordinate

Enums

Enum constants are fields. The generated values() and valueOf(String) methods are listed too, but have no source line to link to.

/** Execution mode. */
public enum Mode {
    /** Quick processing. */ FAST,
    /** Careful processing. */ CAREFUL;
    /** Returns whether this mode is fast.
     * @return true for fast mode
     */
    public boolean isFast() { return this == FAST; }
}
public final enum demo.Mode[source]

Execution mode.

Fields and constants

public static final Mode CAREFUL[source]

Careful processing.

public static final Mode FAST[source]

Quick processing.

Methods

public boolean isFast()[source]

Returns whether this mode is fast.

Returns:

true for fast mode

public static Mode valueOf(String name)
public static Mode[] values()

Annotation types

Elements show their default values, and meta-annotations their arguments.

/** A source annotation. */
@Documented
@Retention(RetentionPolicy.SOURCE)
@Target({ElementType.TYPE, ElementType.PARAMETER})
public @interface Label {
    /** Human-readable label.
     * @return label text
     */
    String value() default "default";
}
@Documented @Retention(SOURCE) @Target({TYPE, PARAMETER}) public abstract @interface demo.Label extends Annotation[source]

A source annotation.

Methods

public abstract String value() default "default"[source]

Human-readable label.

Returns:

label text

Interfaces and default methods

Default methods carry the default modifier.

public abstract interface demo.Transformer<T>[source]

A generic transformation contract.

Parameters:

<T> – input and output type

Methods

public abstract T convert(T input) throws IllegalArgumentException[source]

Transforms a value using Widget#convert(int) when needed.

The result preserves <angle brackets>.

Parameters:

input – the value to transform

Returns:

the transformed value

Throws:

java.lang.IllegalArgumentException – if the value is invalid

if the value is empty

public default T twice(T input)[source]

Transforms a value twice.

API Note:

Use this when one pass is not enough.

Implementation Requirements:

The default implementation calls #convert(Object) twice.

Implementation Note:

This implementation does not cache the first result.

Parameters:

input – the value to transform

Returns:

the twice transformed value

Nested types

Nested types keep their qualified name, such as demo.Widget.Nested, and get their own generated page.

public static class demo.Widget.Nested[source]

A nested type with a stable qualified name.

Constructors

public Nested()[source]

Fields and constants

public static final boolean FLAG = true[source]

Flag visible through Widget.Nested#FLAG.