Skip to content

[S1] upstream 동기 — 컷 1f356ae (tracing 축, 충돌 2) - #11

Merged
Jun025 merged 7 commits into
mainfrom
feat/rustjava-upstream-sync-s1
Aug 17, 2026
Merged

[S1] upstream 동기 — 컷 1f356ae (tracing 축, 충돌 2)#11
Jun025 merged 7 commits into
mainfrom
feat/rustjava-upstream-sync-s1

Conversation

@Jun025

@Jun025 Jun025 commented Aug 17, 2026

Copy link
Copy Markdown
Owner

티켓: rustjava-upstream-sync-s1-tracing-cut-1f356ae · 정본 계획 docs/upstream-sync-approach.md §4·§6

upstream 1f356ae(dlunch#173~dlunch#179 · 5커밋)를 origin/main 에 머지한다. 접근안이 정한 7회차 중 S1, 축은 tracing / PR #4.

착수 시 충돌 재측정 (필수0)

git fetch upstreamgit merge-tree --write-tree --name-only origin/main 1f356ae (2026-08-17 13:11 KST):

  • java_runtime/src/classes/java/lang.rs
  • java_runtime/src/classes/java/lang/thread.rs

2개 그대로. 계획서 예측과 일치. (origin/main 은 PR #10 착지로 85f294a03438b0 로 움직였고 rev-list10 3311 33 이 됐지만 충돌 집합은 불변.)

충돌 해소

lang.rs — 양쪽 병합

mod 목록은 자동으로 합집합이 됐고, pub use 블록만 rustfmt 재배치 때문에 충돌했다. 3-way 로 보면 의미 충돌이 아니라 양쪽이 서로 다른 항목을 추가한 것뿐이다.

⇒ 양쪽 전부 유지. 어느 쪽도 버리지 않았다.

thread.rs — upstream 뼈대 + PR #4 수동 span

upstream 시그니처 변경을 확인했다:

⇒ 우리 본문은 쓸 수 없어 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 --all3 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 서술자
base 62cf0c6 (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;
upstream 1f356ae …)Ljava/lang/Object; (불변)
우리 origin/main …)Ljava/lang/String; (PR #5 7fd0ad8 가 변경)

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_boolean 2 · test_integer 2 · test_long 2)을 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 warnings green.

green (CI .github/workflows/rust.yml 4단계와 동일)

명령 rc
cargo fmt --all -- --check 0
cargo clippy --all -- -D warnings 0
cargo clippy --workspace --exclude test_utils --target wasm32-unknown-unknown -- -D warnings 0
cargo test --all 0169 passed / 0 failed / 1 ignored

기준선 149 passed → 169 (+20, upstream 신규분).

경계

dependabot Bot and others added 7 commits July 13, 2026 19:56
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)
@Jun025
Jun025 merged commit 6bfe97c into main Aug 17, 2026
7 of 8 checks passed
@Jun025
Jun025 deleted the feat/rustjava-upstream-sync-s1 branch August 17, 2026 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants