processing / processing/processing4
Detect `InvocationTargetException` when initializing global variables outside setup
还没有人认领这个 Issue。
- 主要语言
- Java
- 星标
- 494
- 派生
- 183
- 平均合并
- 4 小时 39 分钟
- 30 天内合并 PR
- 3
描述
Created by: mglst
Current Behavior
Whilst coding I ran into RuntimeException: java.lang.reflect.InvocationTargetException. It only took a google search to find another user on the Processing Foundation Forum with the same issue, and a well explained fix: https://discourse.processing.org/t/just-starting-to-code-and-code-returns-java-lang-reflect-invocationtargetexception-error/14615/2.
There are many weird exception catching things that the Processing IDE already does to mitigate the most common of these Processing-specific oddities. The post that I link to has 2.1k, so I can safely say I'm neither the first nor last person to run into this. I find that the way Java errors are thrown is quite confusing. For instance, it complains about code at a specified line, but this refers to the 'java' file rather than the 'pde' file that I'm working on - this is not obvious and can be a source for more confusion still if I go looking for a bug at the wrong place in my code ("what even are .java files? and what do you mean I have to 'export' as application to get a glimpse at it?")
Steps to Reproduce
Your Environment
- Processing version: 4.0a5
- Operating System and OS version: macOS 12.0B5
Solutions
I would like the IDE to detect when making such errors and warn me that I'm likely doing something wrong by defining initialising global variables outside of setup - especially since this seems like something which is fine for ints, booleans, bytes, ... (as I understand, all primitives - although confusingly also Strings)
The fact that this is a RunTime error makes me believe that this might be a tricky suggestion to implement, but I'd hope that it would be a useful enough feature to be worth the cost
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从链接的 Processing Forum 复现案例以及 IDE 现有的异常处理行为入手。确定在 setup 之外初始化全局变量为何会产生 InvocationTargetException,然后定义 IDE 应如何检测到这一点,并显示指向用户 PDE 代码的警告。完成的标准是:所报告的案例能够获得清晰且针对 Processing 的诊断。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- developer-experience
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100