Read this when writing new Java code. See CLAUDE.md for the always-applied formatting rule.
- Spotless + palantir-java-format (
build.gradle). Run./gradlew spotlessApplybefore committing;./gradlew check(and CI) fails on unformatted code. Do not hand-tune whitespace to fight the formatter — let it decide. .editorconfig: 4-space indentation for*.java, 2-space for*.gradle, LF line endings, UTF-8, final newline required.- Target Java 8 language level — no
var, records, switch expressions, or other post-8 syntax insrc/.
Fern-generated files begin with:
/**
* This file was auto-generated by Fern from our API Definition.
*/Match the surrounding generated style only if you are (rarely) editing a generated file that is explicitly listed in .fernignore. Otherwise, do not touch generated files — see pitfalls.md.
- Builder entry points. Public clients are constructed via builders, not raw constructors:
AuthAPI.newBuilder(domain, clientId, clientSecret).build()(Authentication API, hand-maintained)ManagementApi.builder().domain(...).token(...).build()or.clientCredentials(clientId, clientSecret)(Management API)
Supplier-backed lazy resource clients.ManagementApiexposes each resource client as aSupplier<XxxClient>(e.g.usersClient,rolesClient) constructed lazily fromClientOptions. Follow this shape when extending the hand-maintained core.- Sync + Async pairs. Most Management resource clients have a mirror
AsyncXxxClientand aRawXxxClient(raw HTTP response) variant. Keep additions consistent across the trio when working in hand-maintained code. - Typed request/response objects. Management calls return typed response types (e.g.
GetUserResponseContent) rather than generic maps. - HTTP abstraction. All HTTP goes through the
com.auth0.netlayer over OkHttp; don't instantiate OkHttp clients directly in feature code.
Standard Java conventions: UpperCamelCase types, lowerCamelCase members, UPPER_SNAKE_CASE constants. wildcard_import_limit = 9999 in .editorconfig means wildcard imports are not collapsed — but palantir-java-format governs import ordering, so just run spotlessApply.