Repository navigation
Add an NRW Abitur version of the library - #36
Merged
Merged
Conversation
Courses in North Rhine-Westphalia work with the classes of the Zentralabitur, whose List sits in the default package of the student's project. A library cannot name that class, so find, getAll and getTouchingSprites could only ever hand out java.util.List, and List<Gegner> gegner = find(Gegner.class) did not compile. There is now a second JAR for these courses. mvn clean package -Pall,nrw builds scratch-<version>-nrw-all.jar, in which those three methods return the Abitur's List: List<Gegner> gegner = find(Gegner.class); The normal JAR is unchanged. Java cannot overload on the return type, so both versions of each method live in Stage.java and Sprite.java, the NRW one in "// nrw:" comments. src/tools/java/variants/NrwVariant.java swaps them into a copy of the sources, which the nrw profile compiles in place of src/main/java. At run time, internal/NrwList looks up the student's List through their class loader, fills it with append, and returns it as whatever type the assignment asks for. The Abiturklassen themselves are not bundled: they carry no licence, and a bundled List would clash with the copy teachers already put into the project. The release workflow attaches the NRW JARs to the GitHub release. The docs gain an Abiturklassen NRW page (setup, usage, how it works, troubleshooting), with links from Setup and Download. A test builds the NRW sources and compiles a student program against them, so the NRW JAR cannot break unnoticed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KLR5H7eqDSncYYkosKf8r5
mikebarkmin
force-pushed
the
ccr-3eca7a1f-ofkc4j
branch
from
September 30, 2026 14:33
c3d33c5 to
a89d116
Compare
mikebarkmin
added a commit
that referenced
this pull request
Sep 30, 2026
Fix the release workflow broken by #36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Courses in North Rhine-Westphalia use the classes of the Zentralabitur (
List,Queue,Stack,Graph, …). They sit in the default package of the student's project, which a library can't reference by name. Sofind,getAllandgetTouchingSpritescould only returnjava.util.List, and this didn't compile:What changes
There's now a second JAR. A course picks one by picking the JAR:
find,getAll,getTouchingSpritesreturnscratch-<version>-all.jarjava.util.List(unchanged)scratch-<version>-nrw-all.jarListThe rest of the API is the same in both, and the normal JAR's API doesn't change.
How it works
Stage.javaandSprite.javahold both versions of each of the three methods. The NRW one sits in// nrw:comments between// nrw-standard-begin/// nrw-standard-endmarkers.src/tools/java/variants/NrwVariant.javacopies the sources and swaps the two versions. The newnrwMaven profile compiles that copy instead ofsrc/main/java, somvn clean package -Pall,nrwproducesscratch-<version>-nrw-all.jarand-nrw-sources.jar. That build skips tests, examples and the reference docs, which are written forjava.util.List.internal/NrwListlooks up the class calledListthrough the student's class loader. It creates one, fills it withappend, and returns it as whatever type the student wrote on the left.Listwould also clash with the copy teachers already put in the project, since a class in the project takes priority over an import. The student's own copy is always the one used.Other changes
Release:
release.ymlbuilds the NRW JARs and attaches them to the GitHub release. Maven Central still gets only the normal version.Docs: a new Abiturklassen NRW page covers:
Queueexample;It's linked from Setup and Download.
Build:
pom.xmlgets thenrwprofile, and the shaded JAR's classifier is now configurable so the two fat JARs get different names.CLAUDE.md: documents the new build command.Changeset:
minor.Testing
mvn test: 184 tests pass. 2 are skipped because they need Java 25; they're unrelated to this change.NrwListTestcovers the runtime lookup, including a missingListand aListwithoutappend.NrwVariantTestchecks the rewrite. It also builds the NRW sources and compiles a student program against them, so a change that breaks the NRW version fails the normal test run.find,getAllandgetTouchingSpritesreturned the officialListwith the right sprites.Queue,StackandGraphwork alongside the library with every extension package imported, with no name clashes.Not tested: the release workflow change, which first runs on the next release, and running inside BlueJ itself.
🤖 Generated with Claude Code
https://claude.ai/code/session_01KLR5H7eqDSncYYkosKf8r5