Skip to content

Fix NPE on missing XSD documentation; update Gradle; move CI to GitHub Actions - #8

Open
Hubbitus wants to merge 12 commits into
masterfrom
claude/focused-keller-0vb3kc
Open

Hubbitus wants to merge 12 commits into
masterfrom
claude/focused-keller-0vb3kc

Conversation

@Hubbitus

@Hubbitus Hubbitus commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes #2, and modernizes the build so the project builds and tests on current JDKs.

Bug fix (#2), TDD

<xs:annotation> and <xs:documentation> are optional in XSD. When an annotation existed without documentation (e.g. only <xs:appinfo>), getDocumentation() returned null and .trim() threw an NPE, for both classes and fields.

  • Commit 1 adds a failing test with NoDocumentation.xsd (red: NPE).
  • Commit 2 fixes it with a shared null-safe resolveDescription; a missing description becomes an empty string. Unknown schema component types no longer fail on the field path.

Build / CI

  • Gradle wrapper 6.2 → 9.8.0 (needs JDK 17+ to run); maven/uploadArchives → maven-publish + signing; compile → api/implementation; UTF-8 for javac and javadoc.
  • Groovy 2.5.5 → 5.1.3 and Spock 1.2 → 2.4-groovy-5.0 (JUnit Platform); removes "illegal reflective access" warnings.
  • Bytecode is compiled with --release 11 (Java 8 is dropped); tests run on a chosen JVM via toolchains: ./gradlew test -PtestJavaVersion=11.
  • Travis replaced by GitHub Actions: Gradle runs on JDK 21, plugin is tested on JVM 11/17/21.
  • Added missing javadoc comments (explicit public constructor of the plugin, JStringLiteralUnescaped.str).
  • example-project-gradle: Gradle 9.8.0, Groovy 5 / Spock 2; org.unbroken-dome.xjc (unmaintained since 2020, fails on Gradle 9 with NoClassDefFoundError: org/gradle/util/GUtil) replaced by com.github.bjornvester.xjc (javax mode). It needs a plugin release containing the NPE when <annotation> is not provided in XSD #2 fix (published 1.1 hits the same NPE), so pluginVersion should be bumped after release; verified locally against a publishToMavenLocal build.

Not included

Publishing to Sonatype Central Portal (OSSRH is shut down): tracked in #9. The publishing config was only migrated to maven-publish, not tested against a real repository.

Testing

CI is green on JVM 11/17/21. Locally on Gradle 9.8.0: ./gradlew clean build passes with tests on JVM 11 and 21, bytecode major version 55 (Java 11); example project builds and its test passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01D89kKRuDGxgzFmg14g8dPM

Annotation and documentation are optional in XSD; treat missing ones as empty description.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D89kKRuDGxgzFmg14g8dPM
- maven plugin/uploadArchives -> maven-publish with signing
- compile/testCompile -> api/implementation/testImplementation
- Groovy 2.5.23 and Spock 1.3 so tests run on JDK 21
- Force UTF-8 for javac and javadoc

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D89kKRuDGxgzFmg14g8dPM
Example now needs a plugin release containing the fix for #2: published 1.1
fails on maven-4.0.0.xsd with NPE. Verified against locally published build.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D89kKRuDGxgzFmg14g8dPM
…ted sources

Removes accidentally committed src/main/generated-java and ignores it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D89kKRuDGxgzFmg14g8dPM
Run ./gradlew check on JDK 11, 17 and 21; replace Travis badge.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D89kKRuDGxgzFmg14g8dPM
@Hubbitus Hubbitus changed the title Fix NPE when XSD annotation has no documentation Fix NPE on missing XSD documentation; update Gradle; move CI to GitHub Actions Sep 28, 2026
…lchains

Gradle now needs JDK 17+, but bytecode is compiled with --release 11 and tests
run on the JVM selected by -PtestJavaVersion. CI matrix updated accordingly.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D89kKRuDGxgzFmg14g8dPM
…lugin

org.unbroken-dome.xjc 2.0.0 is unmaintained and fails on Gradle 9 (uses removed
org.gradle.util.GUtil). Sources are now generated into build/, so the
generated-java ignore entry is dropped.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D89kKRuDGxgzFmg14g8dPM
Removes 'illegal reflective access' warnings of Groovy 2.5 on newer JVMs.
Groovy test bytecode level is pinned to Java 11 so tests run on JVM 11.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D89kKRuDGxgzFmg14g8dPM
Released 1.1 contains the NPE of #2, so the example now uses 1.2-SNAPSHOT
(with -PuseMavenLocal) and a new CI job publishes the plugin built from the
same commit into mavenLocal and runs the example project check.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D89kKRuDGxgzFmg14g8dPM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NPE when <annotation> is not provided in XSD

2 participants