<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/making-jsr-305-work-on-java-9-rbqjhvbqo" -->

---
title: Making JSR 305 Work On Java 9 | daily.dev
description: Using JSR-305 annotations (@Nonnull, @Nullable) alongside javax.annotation package annotations (@Generated, @PostConstruct) on Java 9 causes a split package...
canonical: https://daily.dev/posts/making-jsr-305-work-on-java-9-rbqjhvbqo
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Making JSR 305 Work On Java 9 | daily.dev
og:description: Using JSR-305 annotations (@Nonnull, @Nullable) alongside javax.annotation package annotations (@Generated, @PostConstruct) on Java 9 causes a split package...
og:url: https://daily.dev/posts/making-jsr-305-work-on-java-9-rbqjhvbqo
og:image: https://api.daily.dev/og/posts/rBqjhvbqo.png
og:image:alt: Making JSR 305 Work On Java 9
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Making JSR 305 Work On Java 9

**[nipafx \(Nicolai Parlog\)](https://daily.dev/sources/nipafx)** · 7 min read · 0 upvotes · 0 comments

## Summary

Using JSR-305 annotations (@Nonnull, @Nullable) alongside javax.annotation package annotations (@Generated, @PostConstruct) on Java 9 causes a split package problem due to the Java Platform Module System. The issue arises because both jsr305-3.0.2.jar and the JDK's java.xml.ws.annotation module contain types in the javax.annotation package. For non-modular projects, the cleanest fix is adding javax.annotation:javax.annotation-api as a class path dependency alongside jsr305, keeping both splits on the class path where they cause no issues. Alternatively, --patch-module can merge the JSR-305 JAR into the platform module, but this only works until java.xml.ws.annotation is removed from the JDK. For modular projects, no clean solution exists without creating a combined artifact or using --patch-module. Moving away from JSR-305 annotations to alternatives like SpotBugs, Eclipse, or JetBrains annotations is recommended when possible.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://nipafx.dev/jsr-305-java-9>

## Similar posts on daily.dev

- [One Could Simply Add Nullability Check Support… Without Even Noticing It](https://daily.dev/posts/one-could-simply-add-nullability-check-support-without-even-noticing-it-t5jmmum79) · JetBrains · 7 upvotes · 0 comments
- [Upgrading from Java 21 to 25: What Actually Breaks](https://daily.dev/posts/upgrading-from-java-21-to-25-what-actually-breaks-6g9uey6re) · Foojay.io · 1 upvotes · 0 comments
- [adam bien's blog](https://daily.dev/posts/adam-bien-s-blog-loxrvqttn) · Adam Bien · 0 upvotes · 0 comments
- [Null-Safe applications with Spring Boot 4](https://daily.dev/posts/null-safe-applications-with-spring-boot-4-ufnxqhfid) · Spring · 133 upvotes · 0 comments
- [Java Weekly, Issue 623](https://daily.dev/posts/java-weekly-issue-623-1gfq283fv) · Baeldung · 1 upvotes · 0 comments

---

Tags: [#java](https://daily.dev/tags/java)

[View this post on daily.dev](https://daily.dev/posts/making-jsr-305-work-on-java-9-rbqjhvbqo)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Making JSR 305 Work On Java 9","url":"https://daily.dev/posts/making-jsr-305-work-on-java-9-rbqjhvbqo","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/making-jsr-305-work-on-java-9-rbqjhvbqo"},"datePublished":"2026-03-16T08:14:08.420Z","dateModified":"2026-03-16T08:27:40.025Z","description":"Using JSR-305 annotations (@Nonnull, @Nullable) alongside javax.annotation package annotations (@Generated, @PostConstruct) on Java 9 causes a split package...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/920149ba712fae60e91720644802802c?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/920149ba712fae60e91720644802802c?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"nipafx (Nicolai Parlog)","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"nipafx (Nicolai Parlog)","logo":"https://media.daily.dev/image/upload/s--H_Echo_u--/f_auto,q_auto/v1773648772/logos/nipafx?_a=BAMAMiiu0","url":"https://daily.dev/sources/nipafx"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/making-jsr-305-work-on-java-9-rbqjhvbqo","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"java","timeRequired":"PT7M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"nipafx (Nicolai Parlog)","item":"https://daily.dev/sources/nipafx"},{"@type":"ListItem","position":3,"name":"Making JSR 305 Work On Java 9"}]}
```

