processing / processing/processing4

Detect `InvocationTargetException` when initializing global variables outside setup

Đang mở
#252 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

enhancement help wanted
Ngôn ngữ chính
Java
Star
494
Fork
183
Merge trung bình
4 giờ 39 phút
Pull request đã merge (30 ngày)
3

Mô tả

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

  1. see code from https://discourse.processing.org/t/just-starting-to-code-and-code-returns-java-lang-reflect-invocationtargetexception-error/14615

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với bản tái hiện được liên kết trên Processing Forum và hành vi xử lý ngoại lệ hiện có của IDE. Xác định cách việc khởi tạo các biến toàn cục bên ngoài setup tạo ra InvocationTargetException, sau đó xác định cách IDE cần phát hiện điều này và hiển thị cảnh báo trỏ đến mã PDE của người dùng. Được xem là hoàn thành khi trường hợp được báo cáo nhận được chẩn đoán rõ ràng, dành riêng cho Processing.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
developer-experience
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.