[S1] upstream 동기 — 컷 1f356ae (tracing 축, 충돌 2) - #11
Merged
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>
… (S1, tracing axis) Merge upstream/main up to 1f356ae (5 commits, PRs dlunch#173-dlunch#179) into origin/main. Conflicts (2, as re-measured): - java_runtime/src/classes/java/lang.rs: union. Ours added class_format_error (PR #3), upstream added the Java 1.2 wrapper classes (boolean/byte/character/double/float/long/number/short) and class_not_found_exception (PR dlunch#176). Both kept; the pub use block only conflicted because of rustfmt reflow. - java_runtime/src/classes/java/lang/thread.rs: upstream taken as the skeleton (attach_thread now takes the thread instance and is async; currentThread returns jvm.current_java_thread()). The single #[tracing::instrument] attribute is replaced by PR #4's manual tracing::info_span! + .instrument(span), and `use tracing::Instrument` is restored. Cargo.toml and java_runtime/Cargo.toml are untouched, so the `attributes` feature stays off and no tracing-attributes pin returns. Silent breakage outside the conflict set (found by running the suite): java/lang/System.setProperty. Our PR #5 corrected the descriptor to (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; because real javac bytecode (test_data/UnsupportedCharset.class constant pool) emits exactly that; upstream still declares ...)Ljava/lang/Object;. The merge keeps our JDK-correct descriptor, so upstream's six new call sites in test_boolean/test_integer/test_long were updated to match. Without this the three new wrapper tests fail with NoSuchMethodError. green: cargo fmt --all -- --check, cargo clippy --all -- -D warnings, cargo clippy --workspace --exclude test_utils --target wasm32-unknown-unknown -- -D warnings, cargo test --all (169 passed / 0 failed / 1 ignored).
…ng (conflicts 2, setProperty descriptor breakage)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
티켓:
rustjava-upstream-sync-s1-tracing-cut-1f356ae· 정본 계획docs/upstream-sync-approach.md§4·§6upstream
1f356ae(dlunch#173~dlunch#179 · 5커밋)를origin/main에 머지한다. 접근안이 정한 7회차 중 S1, 축은 tracing / PR #4.착수 시 충돌 재측정 (필수0)
git fetch upstream후git merge-tree --write-tree --name-only origin/main 1f356ae(2026-08-17 13:11 KST):java_runtime/src/classes/java/lang.rsjava_runtime/src/classes/java/lang/thread.rs⇒ 2개 그대로. 계획서 예측과 일치. (
origin/main은 PR #10 착지로85f294a→03438b0로 움직였고rev-list는10 33→11 33이 됐지만 충돌 집합은 불변.)충돌 해소
lang.rs— 양쪽 병합mod목록은 자동으로 합집합이 됐고,pub use블록만 rustfmt 재배치 때문에 충돌했다. 3-way 로 보면 의미 충돌이 아니라 양쪽이 서로 다른 항목을 추가한 것뿐이다.class_format_error::ClassFormatError1건 추가 (PR [rustjava-classfile-parse-error-propagation] fix: unreadable class files raise ClassFormatError instead of panicking #3)boolean·byte·character·double·float·long·number·short·class_not_found_exception10건 추가 (PR Add Java primitive wrapper classes dlunch/RustJava#176)⇒ 양쪽 전부 유지. 어느 쪽도 버리지 않았다.
thread.rs— upstream 뼈대 + PR #4 수동 spanupstream 시그니처 변경을 확인했다:
self.jvm.attach_thread()?→self.jvm.attach_thread(self.this.instance.clone()).await?(인자 추가 + async 화)current_thread: 매번 새Thread생성 →jvm.current_java_thread()(PR Return the same Thread object from Thread.currentThread() dlunch/RustJava#175 «같은 객체 반환»)⇒ 우리 본문은 쓸 수 없어 upstream 을 통째로 뼈대로 취한 뒤
#[tracing::instrument]한 줄만 PR #4 의 수동 span(tracing::info_span!+.instrument(span))으로 치환하고use tracing::Instrument;를 복원했다.Cargo.toml(root)·java_runtime/Cargo.toml무접촉 (git diff origin/main -- <두 파일>빈 출력) ⇒attributes피처 꺼진 채 유지,tracing-attributes핀 부활 없음git grep -n 'tracing::instrument\|tracing-attributes' -- '*.rs' '*.toml' '*.lock'→ 히트 1건이고 그것은 왜 수동 span 인지 설명하는 주석 한 줄이다. 살아 있는 속성 매크로·의존은 0.★충돌 목록 «밖»에서 깨진 것 —
System.setProperty서술자머지 직후
cargo test --all이 3 failed (test_boolean_property_and_primitive_value_of_exclusion·test_integer_rejects_invalid_forms_and_uses_property_defaults·test_long_api), 전부NoSuchMethodError.같은 컷을 순수 upstream 워크트리에서 돌리면 141 passed / 0 failed ⇒ 머지가 만든 파손이다.
원인:
java/lang/System.setProperty서술자62cf0c6(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;1f356ae…)Ljava/lang/Object;(불변)origin/main…)Ljava/lang/String;(PR #57fd0ad8가 변경)upstream 이 이 파일을 안 건드려 충돌 0으로 우리 쪽이 머지되는데, upstream PR dlunch#176 이 새로 들여온 테스트 6개 호출부가
Object서술자를 박아 두었다.어느 쪽이 옳은가: 우리 쪽이다. JDK
System.setProperty(String,String)은String을 반환하고, 이 저장소의 실제 javac 산출물test_data/UnsupportedCharset.class상수풀에도(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;가 그대로 박혀 있다(상수풀 파싱으로 확인). 즉 upstream 서술자를 되살리면 실제 바이트코드가 못 부른다.⇒ 우리 서술자를 유지하고 upstream 테스트 호출부 6곳(
test_boolean2 ·test_integer2 ·test_long2)을String으로 고쳤다. 그 6곳이 전부java/lang/System대상임을 확인했고,java/util/Properties.setProperty(JDK 상Object반환)는 손대지 않았다.계획서가 이름 붙인 나머지 2위험 — S1 에서는 «안» 터진다
tests/test_class_format.rs: 4/4 통과. upstream 의classfile/src/error.rs재작성은 S3 컷822504b에 오므로 S1 에서는 문구 단정이 그대로 성립한다.java_runtime/src/charset.rs: 호출자 2건(input_stream_reader.rs·string.rs) 생존 ⇒ dead code 아님,clippy -D warningsgreen.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 --all기준선 149 passed → 169 (+20, upstream 신규분).
경계
03438b0= 착수 시점origin/maingit fetch와 읽기 조회만) · PR [rustjava-claude-md-prune] docs: prune autonomous-sop, add self-report limits + Goal/Constraints/DoD #8 무접촉 ·main무접촉 · force-push 0 · 브랜치 삭제 0 ·git gc0 ·--no-verify0③-2/③-3무접촉