[S2] upstream 동기 — 컷 af4f6f8 (charset 축, 충돌 5) - #13
Conversation
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.25.0 to 1.25.1. - [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md) - [Commits](Lokathor/bytemuck@v1.25.0...v1.25.1) --- updated-dependencies: - dependency-name: bytemuck dependency-version: 1.25.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Replace runtime panics with the matching Java exceptions An unwrap audit found panics reachable from ordinary Java code: - File.length() returns 0 for a missing file; isDirectory/isFile lose their guard-then-unwrap shape - FileImpl (native runtime) maps open/read/write/seek failures to IOError instead of panicking, so FileInputStream and RandomAccessFile guards actually produce FileNotFoundException; FileOutputStream gains the same guard - File I/O operations (read/write/seek/available/length/setLength) throw java.io.IOException on failure via a shared helper - Class.forName resolves the class and throws ClassNotFoundException (new runtime class) instead of panicking on any not-yet-loaded name - StringBuffer.append(char)/append(char[]) keep exact UTF-16 units so unpaired surrogates no longer panic and pairs built char by char survive; String.valueOf(char) builds through [C for the same reason - PrintStream.println(char) replaces an unpaired surrogate with '?' like the JDK charset encoder - ZipFile validates the archive in its constructor and throws java.util.zip.ZipException (new runtime class) for a malformed archive; getInputStream returns null for a missing entry Expected outputs for the new fixtures are generated by a real JVM. Remaining unwraps are invariants (interpreter stack discipline, thread attach), guarded lookups, or documented gaps (lenient calendar normalization, ClassFormatError plumbing). * Inline the IOException conversion at each I/O call site
Every attached thread now owns its java/lang/Thread instance: attach takes the instance for threads started via Thread.start (so currentThread() inside run() is the started Thread object) and creates one otherwise (bootstrap, external attachers). currentThread() returns the stored instance, and the GC roots it per thread. Also parse unrecognized classfile attributes as an opaque Unknown variant instead of failing — JVMS 4.7.1 requires silently ignoring them, and the anonymous-class fixture carries EnclosingMethod and Signature attributes the parser rejected. Expected output for the fixture is generated by a real JVM.
* Add Java primitive wrapper classes * Use Character digit semantics for numeric parsing
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.52.3 to 1.52.4. - [Release notes](https://github.com/tokio-rs/tokio/releases) - [Commits](tokio-rs/tokio@tokio-1.52.3...tokio-1.52.4) --- updated-dependencies: - dependency-name: tokio dependency-version: 1.52.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add CLDC 1.1 core API compatibility * Fix CI lint and improve CLDC coverage * Fix array assignability and reader progress
PR #11 was squash-merged, so upstream ancestry was lost: origin/main carries 1f356ae's content byte-for-byte (git diff 0bd4f80 origin/main -- '*.rs' '*.toml' '*.lock' is empty) but git still resolved the merge base to 62cf0c6, replaying all six upstream commits and re-conflicting 15 files instead of the predicted 5. This -s ours merge changes no tree bytes; it only records the parent so that S2..S7 merge against 1f356ae as base.
… API, PR dlunch#177) Conflicts (5, exactly as S1 predicted): - java/io.rs, java/io/unsupported_encoding_exception.rs, loader.rs: upstream side is a superset; took it, then restored our ClassFormatError registration that --theirs had dropped from loader.rs. - java/io/input_stream_reader.rs: kept our Charset abstraction (4 charsets vs upstream's inline 2) and adopted upstream's decode_length/end_of_input multibyte-boundary handling on top of it. - tests/.../test_input_stream_reader.rs: union of both sides' tests. Also fixed a silent auto-merge duplicate: both sides added a byte-identical Throwable::getMessage at different positions, so git merged both and the build failed with E0592. Kept upstream's placement. InputStreamReader's single-argument ctor stays lazy about the default charset (JDK does not declare it to throw UnsupportedEncodingException); only the (InputStream, String) ctor validates eagerly, as upstream added. cargo fmt/clippy/clippy-wasm32/test all rc=0; 191 passed / 0 failed.
…flicts 5, ancestry restore)
★CI red 고지 — 선재다. 실측으로 갈랐다.
내용: 선재 판정 — 주장이 아니라 대조: 로컬에 beta(
같은 수, 같은 파일 ⇒ 이 PR 이 만든 red 가 아니다. 교차 근거:
★stable 은 초록: 로컬 고치지 않은 이유: 로컬 green 재확인(stable 1.98.0, CI 4단계 그대로): fmt ✅ · clippy ✅ · wasm32 clippy ✅ · |
upstream 컷
af4f6f8(dlunch#177 CLDC 1.1 core API) 머지. 티켓rustjava-upstream-sync-s2.급소 — 조상이 끊겨 있었다
PR #11(S1)이 스쿼시 머지돼
origin/main에1f356ae가 조상으로 남지 않았다.코드 트리는 S1 머지 결과와 바이트 동일한데(
git diff 0bd4f80 origin/main -- '*.rs' '*.toml' '*.lock'빈 출력)merge-base 는 여전히
62cf0c6라,merge-tree가 6커밋을 통째로 재생하며 충돌 15건을 냈다 —전부 S1 이 이미 해소한 자리다.
git merge -s ours 1f356ae(트리 무변경, 부모만 기록)로 base 를 복원 → 충돌 5건,S1 이 예고한 파일 5개와 정확히 일치.
충돌 5건 — 무엇을 골랐고 왜
java/io.rsUnsupportedEncodingExceptionexport 유지 확인java/io/unsupported_encoding_exception.rsjava/loader.rsClassFormatError::as_proto()등록 1줄 복원(--theirs가 지웠다)java/io/input_stream_reader.rsCharset유지(4종 vs upstream 인라인 2종) + upstream 의 멀티바이트 경계 처리(decode_length·end_of_input) 채택tests/.../test_input_stream_reader.rs충돌 목록 «밖» 파손 2건
Throwable::getMessage조용한 중복 — 양쪽이 바이트 동일한 메서드를 다른 위치에 추가해git 이 둘 다 머지,
E0592 duplicate definitions로 빌드 실패. 충돌 마커도 clippy 도 못 잡고컴파일만이 잡는다. upstream 위치를 남기고 우리 사본을 제거.
loader.rs등록 1줄 유실 —--theirs통째 해소의 부작용.test_class_format3건이NoClassDefFoundError로 죽어서 발견. 이후 「base 이후 우리가 추가한 260줄이 머지 트리에살아 있는가」를 기계로 전수 대조(부재 2건은 의도한 해소임을 확인).
판단 1건 — 생성자별 charset 검사 시점
upstream 은 1인자 생성자를 2인자에 위임시켜 양쪽 다 생성 시점에 미지원 charset 을 던지게 만들었다.
그러면 PR #5 의 종단 픽스처(
test_data/UnsupportedCharset)가 깨진다 — 그 Java 소스는 생성자를try밖에 두어 read() 시점 throw 를 잠갔기 때문이다(이 맥에 JDK 부재라 재컴파일 불가).JDK 규격이 답을 준다: 1인자 생성자는
UnsupportedEncodingException을 선언하지 않고, 2인자는 한다.⇒ 필드 초기화를
init_fields로 빼고 2인자만 즉시 검증, 1인자는 기존대로 read() 시점.upstream 의 신규 테스트
test_input_stream_reader_rejects_unknown_encoding(2인자 사용)과우리
test_isr_unsupported_charset_throws(1인자 사용)가 둘 다 산다.green (CI
.github/workflows/rust.yml4단계 그대로)cargo fmt --all -- --checkcargo clippy --all -- -D warningscargo clippy --workspace --exclude test_utils --target wasm32-unknown-unknown -- -D warningscargo test --allupstream 신규 테스트가 실제로 돌았음 확인(이름으로):
test_input_stream_reader_*3건 ·test_reader_default_contract_and_lifecycle·test_output_stream_writer_*3건 ·test_print_stream_*2건 ·test_cldc11_*2건 ·test_date_*/test_random_*/test_calendar_*.charset.rsdead-code 예측 — ★발동하지 않았다S1 은 「S2 가
input_stream_reader.rs를 건드리므로charset.rs가 dead code 가 돼 clippy red」를예고했다. 실측: 호출자가 5 → 7건으로 늘었다(
git grep Charset::). 예측의 전제였던「upstream 판본을 통째로 취한다」가 성립하지 않았기 때문이다. clippy rc=0.
경계
머지 0(이 PR 은 OPEN 유지) · force-push 0 ·
--no-verify0 · upstream 발신 0(읽기 조회만) ·main무접촉 ·~/orchestrator무접촉 · 로컬 브랜치 위생 미실시(별건).