GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — PDE doesn't report invalid size() arguments as a logic error · Issue #1573 · processing/processing4

PDE doesn't report invalid size() arguments as a logic error #1573

New issue
Copy link
New issue
Copy link
Open
Open
PDE doesn't report invalid size() arguments as a logic error#1573
Copy link
Labels
bugSomething isn't workingSomething isn't working

Description

@letsmanuel
letsmanuel
opened on Sep 21, 2026
Issue body actions

Most appropriate sub-area of Processing 4?

PDE

Processing version

4.5.6

Operating system

Windows

Bug description

When size() is called from setup() using variables for its width and height, Processing reports the error only when the sketch is run/compiled:

size() cannot be used here, see https://processing.org/reference/size_.html

However, the PDE does not report this as a logic error while editing the sketch.

This is inconsistent with other invalid size() usage and makes the problem harder to identify before running the sketch.

For comparison, using the same variables from settings() works correctly, and arithmetic expressions such as size(400 + 400, 900 - 300) are accepted.

Expected behavior

The PDE should identify the invalid size() usage as a logic error while editing, before the sketch is run.

Actual behavior

The invalid usage is not reported as a PDE logic error while editing. The error is encountered when the sketch is processed/run.

Steps to reproduce this

  1. Open Processing 4.
  2. Create a new Java Mode sketch.
  3. Add the following code:
  4. Wait for the PDE to process the sketch.
  5. Observe that the invalid size() usage is not reported as a logic error in the editor.
  6. Run the sketch.
  7. Processing reports:

size() cannot be used here, see https://processing.org/reference/size_.html

For comparison, moving the size(width, height) call into settings() allows the sketch to run successfully.

snippet

int width = 800;
int height = 600;

void setup() {
  size(width, height);
}

Additional context

The issue appears to originate in the Java Mode preprocessing of size() arguments.

I investigated the existing sizeParamValid() handling and implemented a change that reports invalid size() arguments as a logic error during preprocessing. I also added regression tests for invalid method and variable arguments.

I manually verified the following cases:

  • size(width, height) in setup() → logic error
  • size(width, height) in settings() → works
  • size(400 + 400, 900 - 300) → works

The Java test suite passes with 194 tests and 0 failures on my local setup.

I would be interested in working on this issue and submitting the corresponding fix.

Would you like to work on the issue?

Yes, I’d like to help with this

Activity

  1. letsmanuel
    added
    bugSomething isn't workingSomething isn't working
    on Sep 21, 2026
  2. letsmanuel commented on Sep 25, 2026

    @letsmanuel
    letsmanuel
    on Sep 25, 2026
    Author
    More actions

    If it is possible, I would appreciate beeing assigned to this issue.

  3. chaitanya-bhardwaj commented on Sep 26, 2026

    @chaitanya-bhardwaj
    chaitanya-bhardwaj
    on Sep 26, 2026
    Contributor
    More actions

    @letsmanuel you need to leave your approach to solve the issue to get assigned
    see contributing.md

    Reacted by Raphaël de Courville and LetsManuel
  4. letsmanuel commented on Sep 27, 2026

    @letsmanuel
    letsmanuel
    on Sep 27, 2026
    Author
    More actions

    @letsmanuel you need to leave your approach to solve the issue to get assigned see contributing.md

    @Chaitanya-970 My approach to solving this issue was to add a new type of preprocessing error to the editor, called LogicError. Since the editor already detects that a size() call is invalid but doesn't display an error, the LogicError implementation will mark the invalid call and, when hovered over, simply display the error message that would normally only surface at runtime. This mostly reuses the syntax error highlighting logic, while keeping the internal data separate for simplicity and maintainability.

    Let me know if anything is unclear!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.