Skip to content

Stabilize the DocumentFactory2 line-number demo after clean builds #42

Description

@dbosk

Context

While implementing the review plan from ~/.claude/plans/dreamy-frolicking-widget.md, we fixed issues 1-4 in src/factory.nw, src/Makefile, and src/.gitignore, but intentionally skipped review issue 5 for separate follow-up.

Observation

The line-number-translation demo in src/factory.nw compiles DocumentFactory2.java and DocumentFactory3.java directly with javac, not through make.

Because DocumentFactory2.java currently references Document and PDFDocument, the demo output depends on prior build state: after successful builds the needed .class files may already exist, but after make clean the same commands can emit extra cannot find symbol errors unrelated to the intended undefinedMethod() contrast.

Why it matters

The section is supposed to teach line-number translation (DocumentFactory2.java vs factory.nw/noerr.pl), but incidental dependency errors can drown out the intended single-error contrast.

Evidence

  • src/factory.nw currently demonstrates direct commands like javac DocumentFactory2.java 2>&1
  • The demo class references Document and PDFDocument
  • In discussion during this task, a possible alternative was to make the Makefile guarantee prerequisites and change the demo to compile through make rather than raw javac

Suggested follow-up

Choose one of these approaches and update the chapter accordingly:

  • make the demo class self-contained so raw javac always yields only the intended error, or
  • add explicit Makefile-managed prerequisites for the demo and change the pedagogical commands to use make targets instead of invoking javac directly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions