◀Table of Contents
Truffle DSL Warnings
Since version 23.0, Truffle DSL now produces significantly more warnings. These warnings are intended to guide the user to better DSL usage. The following sections describe how to handle and eventually suppress warnings.
All warnings of Truffle DSL can be suppressed using the -Atruffle.dsl.SuppressAllWarnings=true option.
If a language uses strict checks where warnings are treated as errors in their CI, it is recommended to add this option to the Java compilation command line. This can be useful to avoid CI failures when Truffle DSL adds new warning messages. Adding new warning messages in Truffle DSL is considered a compatible change.
Truffle DSL warnings can be suppressed just like Java warnings using the @SuppressWarnings annotation or with@SuppressPackageWarnings for entire packages.
The following warning keys are supported:
allall warnings emitted by the Java compiler or Truffle DSLtruffleall warnings emitted by Truffle DSLtruffle-sharingwarnings when the DSL recommends sharing between cached valuestruffle-inliningwarnings when the DSL recommends using node object inlining.truffle-neverdefaultwarnings for when cached initializers should be marked as never having a default value.truffle-limitwarnings when a specialization limit is recommended, but not specified.truffle-static-methodwarnings when the DSL recommends to use thestaticmodifier.truffle-unusedwarnings if a DSL attribute or annotation has no effect and is recommended to be removed.truffle-abstract-exportwarnings if an abstract message of a Truffle library is not exported.truffle-assumptionif the assumptions feature is used with a specialization that reaches a@Fallbackspecialization.truffle-guardif a guard uses methods where a@Idempotentor@NonIdempotentmethod may be beneficial for the generated code.
Specific warnings can also be suppressed globally using the -Atruffle.dsl.SuppressWarnings=truffle-inlining,truffle-neverdefault Java compiler processor option.
Note that also Java system properties can be used to configure the annotation processor. (e.g. by passing -J-Dtruffle.dsl.SuppressWarnings=truffle-inlining,truffle-neverdefault to javac)
Suppressing a specific warning should be preferred over suppressing all warnings. Find the latest list of warnings in the source code