PDE doesn't report invalid size() arguments as a logic error
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 55/100
Direção de pesquisa
Start with the Java Mode preprocessing and the existing sizeParamValid() handling described in the issue. Run the Java test suite and inspect the added regression-test cases for invalid method and variable arguments. Done means invalid size(width, height) in setup() is reported as a PDE logic error, while settings() and arithmetic expressions remain valid.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Open Processing 4.
- Create a new Java Mode sketch.
- Add the following code:
- Wait for the PDE to process the sketch.
- Observe that the invalid
size()usage is not reported as a logic error in the editor. - Run the sketch.
- 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)insetup()→ logic errorsize(width, height)insettings()→ workssize(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
- Linguagem predominante
- Java
- Estrelas
- 497
- Forks
- 183
- Merge médio
- 4h 39min
- PRs com merge (30d)
- 3
Preparar o ambiente
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de processing/processing4
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 64/100
processing/processing4#1554 · 1 comentário ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
processing/processing4#1515 · 1 reação ·
-
startup errorAberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
processing/processing4#1569 · 7 comentários ·
-
Binaries under bin directory lack executable permissions for the snap and .deb packages for LinuxTalvez já em andamento @catilac assumiu há 9 dias. Abertabug
processing/processing4#1567 · 3 comentários · 1 reação · 1 responsável ·
-
lower priority
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 55/100
processing/processing4#1566 · 3 comentários ·
Todas as issues de processing/processing4
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
OpenAPITools/openapi-generator#25014 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
AloisSeckar/demos-java#380 ·
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
openhab/openhab-core#5847 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
appsmithorg/appsmith#42297 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100