Skip to content

add nullaway (part 2)#16029

Closed
zeitlinger wants to merge 15 commits intoopen-telemetry:mainfrom
zeitlinger:nullaway2
Closed

add nullaway (part 2)#16029
zeitlinger wants to merge 15 commits intoopen-telemetry:mainfrom
zeitlinger:nullaway2

Conversation

@zeitlinger
Copy link
Copy Markdown
Member

@zeitlinger zeitlinger commented Jan 28, 2026

towards #15991

@zeitlinger zeitlinger force-pushed the nullaway2 branch 2 times, most recently from aa9eb2c to 2090146 Compare February 5, 2026 10:33
Comment thread muzzle/src/main/java/io/opentelemetry/javaagent/tooling/HelperInjector.java Outdated
Comment thread javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/util/Trie.java Outdated
Comment thread muzzle/src/main/java/io/opentelemetry/javaagent/tooling/TransformSafeLogger.java Outdated
@github-actions github-actions bot added the test native This label can be applied to PRs to trigger them to run native tests label Feb 27, 2026
@zeitlinger zeitlinger force-pushed the nullaway2 branch 3 times, most recently from f568edc to df96f82 Compare March 13, 2026 11:21
@zeitlinger zeitlinger force-pushed the nullaway2 branch 2 times, most recently from 77fdd7c to 3646240 Compare March 20, 2026 09:44
Rebased on latest main and addressed review comments:
- Trie: flip delegation so getOrDefault calls getOrNull
- TransformSafeLogger: pass logMessageQueue into constructor
- HelperInjector: align constructor with main (non-nullable params)
- MuzzleMatcher: fix race condition with AtomicReference
- SafeServiceLoader/SafeHasSuperTypeMatcher: throw NoSuchElementException
- AgentCachingPoolStrategy: remove unnecessary wrapper method

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
…ullAway

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
…TypeMatcher and remove isTransformingClass wrapper

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
…onAccessCustomizerProvider

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
The nullaway PR incorrectly replaced application.io.opentelemetry.api.*
imports with io.opentelemetry.api.* in 132 files. In the javaagent's
multi-classloader architecture, these are different classes — application.*
is the application classloader's view, while the unprefixed imports are
the agent's internal classes. This broke ExtendedOpenTelemetryTest and
many other tests.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
The OTel SDK 1.59 added VALUE to AttributeType and ValueType enums.
Add default cases to switch statements in older API bridge classes
to prevent MissingCasesInEnumSwitch errorprone warnings.
Also fix spotless formatting in JavaUtilLoggingHelper.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
These modules' application-side enums already cover all cases, so
adding default triggers UnnecessaryDefaultInEnumSwitch. Only the 1.0
Bridging.java genuinely needs a default for the new VALUE type.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
When declarative config is used, AutoConfigureUtil.getConfig() returns
null. The distribution-node PR added requireNonNull for sdkConfig in
AgentInstaller, causing NPE during agent startup.

Fix by providing empty DefaultConfigProperties as fallback in
OpenTelemetryInstaller when configProperties is null (declarative
config path), ensuring the returned AutoConfiguredOpenTelemetrySdk
always has non-null config.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
The rebase introduced several unrelated upstream changes and a botched
revert that swapped application.* imports in the wrong direction.

Reset to main:
- 130 files with incorrect application.* import swaps
- Javalin module restructuring (14 files)
- RxJava module rename rxjava-common-3.0 -> rxjava-3-common
- SqlQuerySanitizer -> SqlQueryAnalyzer rename
- Semconv import style changes
- RPC semconv changes, JDBC refactoring
- CI/config/doc changes (.fossa.yml, mise.toml, etc.)
- FlakyTestReporter transport change

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
The extensions class loader is intentionally null in test environments
(AgentInitializer returns null when agentStarter is not set). Instead of
wrapping the call in requireNonNull, inline Utils.getExtensionsClassLoader()
and annotate SafeServiceLoader parameters as @nullable since
ServiceLoader.load() handles null classloader (uses bootstrap classloader).
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
The nullaway PR accidentally removed the "deprecation" suppression from
convertExtendedAttributes. This suppression is needed because ExtendedAttributes
is deprecated and the custom OtelDeprecatedApiUsage error-prone check (which
accepts "deprecation" as an altName) flags it as a compilation error.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
…o extend()

InstrumentationLoader is instantiated by ServiceLoader (no-arg constructor),
at which point InstrumentationHolder.getInstrumentation() is still null.
Moving the requireNonNull + construction into extend() defers it to when
Instrumentation is guaranteed to be available, fixing the NPE.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger
Copy link
Copy Markdown
Member Author

Closing in favor of per-module PRs to make review easier. Each PR enables NullAway for one Gradle module independently:

Note: two files from the original PR (AdviceTransformer.java and IndyTypeTransformerImpl.java) were not carried over — AdviceTransformer.java no longer exists in main (refactored away), and IndyTypeTransformerImpl.java no longer has the field that needed @Nullable.

@zeitlinger zeitlinger closed this Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test native This label can be applied to PRs to trigger them to run native tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants