prime/solution.java doesn't compile: public class PrimeCheck in solution.java, README requires Solution.java with a Solution class
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức phù hợp với người mới
- 82/100
Hướng nghiên cứu
Bản sửa nằm trong problems/prime/solution.java: đổi tên lớp public PrimeCheck thành Solution và làm cho isPrime thành static, nên tệp cũng phải đổi tên thành Solution.java. Hãy so sánh với problems/binary-search/Solution.java, mà mục Layout trong README nêu làm quy ước. Bắt đầu bằng cách chạy python3 run.py prime --lang java để tái hiện các lỗi biên dịch. Công việc hoàn tất khi kiểm tra số nguyên tố đạt và lời giải Java in ra prime hoặc not prime.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What I did
- Fresh checkout of
main(0c95800, "Add prime solution in Java (#23)"), JDK installed. - Ran the checker for the Java solutions of the prime problem exactly as the README describes:
python3 run.py prime --lang java
What I expected
The top-level README says: "Every solution reads its input from stdin and prints the answer. Java files are named Solution.java with a Solution class." (README.md, Layout). So problems/prime/solution.java should compile and java -cp <out> Solution should print prime or not prime, like problems/binary-search/Solution.java does.
What happened instead
prime
FAIL solution.java (0.000s)
didn't compile:
problems/prime/solution.java:3: error: class PrimeCheck is public, should be declared in a file named PrimeCheck.java
public class PrimeCheck {
^
problems/prime/solution.java:31: error: non-static method isPrime(long) cannot be referenced from a static context
if (isPrime(n)) {
^
2 errors
Summary: 0 passed, 1 failed, 0 skipped
Exit code 1. The file is named solution.java (lowercase) and declares public class PrimeCheck, and main calls the instance method isPrime without an object. Because run.py always runs java -cp <out> Solution, a class with any other name could not be run even if it compiled. This also makes every python3 run.py run red: the check on main @ 0c95800 failed, while the commit before (e440a8e) passed.
Environment
code-corner main @ 0c95800, JDK 17, Windows 11 (the compile errors are the same on Linux).
I'd like to work on the fix: name the class Solution in Solution.java and make isPrime static, without changing the algorithm.
- Ngôn ngữ chính
- Python
- Star
- 1
- Fork
- 6
- Merge trung bình
- 17 giờ 52 phút
- Pull request đã merge (30 ngày)
- 14
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của techcsispit/code-corner
-
Prime solution in C++ incorrectly returns true for some composite numbersCó thể đã có người làm @paramsj đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 25/100
techcsispit/code-corner#38 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Failed compilations always report 0.000 secondsCó thể đã có người làm @Shivangi-singh18 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
techcsispit/code-corner#37 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
run.py: Python solutions are skipped on Windows when run via python instead of python3Có thể đã có người làm @tanujb03 đã nhận 1 ngày trước. Đang mởbug good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 15/100
techcsispit/code-corner#29 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fibonacci/solution.c: prints negative numbers for n of 47 or more (F(90) prints -1581614984)Có thể đã có người làm @tanujb03 đã nhận 1 ngày trước. Đang mởbug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
techcsispit/code-corner#27 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
binary-search/Solution.java: prints -1 when the target is the last element (`9 1 3 5 7 9`) or in a 1-element list (`5 5`)Có thể đã có người làm @tanujb03 đã nhận 1 ngày trước. Đang mởbug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 22/100
techcsispit/code-corner#26 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của techcsispit/code-corner
Issue tương tự
-
Broken links found in docsĐang mởdocs pydanty:is-working
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
pydantic/pydantic-ai#10113 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
GreedyBear-Project/GreedyBear#1727 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
ARM-software/CMSIS-DSP#354 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
kiat/codeAssist#391 ·
-
needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
darnitdevorg/darnit#587 ·
Maintainer thường phản hồi trong vòng 1 ngày