[rustjava-adopt-bound-bootstrap-method-attr-index-p0] feat(classfile): BootstrapMethods 를 「두 번」 선언한 클래스를 거부한다 - #53
Merged
Conversation
…: BootstrapMethods 를 두 번 선언한 클래스를 거부한다 JVMS 4.7.23 은 최대 한 개만 허용하는데, bootstrap_method_indices_resolve 의 find_map 은 첫 표를 쓰고 나머지를 조용히 무시했다 — 인덱스가 어느 표에 대해 경계 검사되는지가 임의였다. 참조 JVM(OpenJDK 26.0.1)은 같은 파일에 ClassFormatError: Multiple BootstrapMethods attributes 를 내고, 표가 하나뿐인 대조군은 rc=0 으로 로드한다. 술어를 옆에 두고 validate_class 에 이었다 — indices_resolve 는 「인덱스가 실재 항목을 가리키는가」 한 문장이고 「표가 몇 개인가」는 다른 문장이라, 접어 넣으면 이름까지 바꿔야 한다. 픽스처는 같은 유효한 표를 바이트 동일하게 두 번 써서 거부 원인을 「둘이라는 사실」로 고정했다. 개악 양방향(호출 제거 · 상수 통과) 전건 red · cargo test --all 571 passed.
…트③ 착지 기록 동봉 (PR #53 · --merge)
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.
채택 제안
2026-09-16-bound-bootstrap-method-attr-index#p0(운영자 tower 패널 채택 · worklog jsonadoptedProposals기록).ⓐ 제안이 «지금도» 참인가 — 재서 확인했다
원문이 지목한
find_map은classfile/src/validation.rs:117에 그대로 있다 ⇒ 제안 유효.JVMS 4.7.23 은
BootstrapMethods를 최대 한 개만 허용하는데, 종전에는 첫 표를 쓰고 나머지를 조용히 무시했다⇒ ★**
bootstrap_method_attr_index가 «어느 표»에 대해 경계 검사되는지가 임의**였고 그 사실이 어디에도 드러나지 않았다.전/후 — 그리고 ★참조 JVM
LdcDynamicDuplicateBSM(표 2개)UnsupportedOperationExceptionClassFormatError**ClassFormatError: Multiple BootstrapMethods attributes in class file**LdcDynamic(표 1개 · 대조군)UnsupportedOperationException⇒ 이 리니지의 문장 그대로다 — 「아직 못 한다」 → 「이 파일이 깨졌다」, 그리고 참조 구현과 일치한다.
★대조군 불변이 변경의 좁음을 보인다. ※
AGENTS.md허용 축(observable behavior)만 사용 · OpenJDK 소스 미참조.고친 자리 — 「한 곳」, 새 관용 0
validate_class의 거부 사슬에 술어 하나를 이었다(at_most_one_bootstrap_methods_attribute).★**
bootstrap_method_indices_resolve는 무접촉** — 그 doc 이 스스로 「인덱스가 실재 항목을 가리키는가」라는 한 문장임을선언하고 있고 「표가 몇 개인가」는 다른 문장이다(접어 넣으면 그 함수를 이름까지 바꿔야 하는데 이 회차 경계가 금한다).
세는 모양은 필드
ConstantValue·메서드Code가 이미 쓰는 그것이다.픽스처 — ★결함이 「하나」가 되게 지었다
LdcDynamicDuplicateBSM.class= 같은 유효한 표를 바이트 동일하게 두 번.어느 한 표만 있어도 정상 파일이라 ★거부 원인이 «둘이라는 사실»로 고정된다 — 둘째 표를 다르게 만들면
다른 규칙이 먼저 물어 테스트가 «이름과 다른 이유»로 통과한다. 구조를 측정했다:
속성
['BootstrapMethods','BootstrapMethods']· 두 본문 바이트 동일True. 재생성 멱등(기존 11 전건 바이트 동일).★★제안의 한 문장은 «과했다» — 「생성기가 만들 수 없는 픽스처가 필요하다」는 거짓이고 8줄 래퍼로 됐다
(속성 목록이 빌더에 그대로 전달된다). ⇒ 관측은 맞았고 «비용 추정»이 틀렸다.
개악 대조 — 양방향, 제품 «호출부»
|| !at_most_one_...(class)제거(= 제안 이전 상태)true(상수 통과) 로★⑵를 따로 돌린 이유: ⑴만으로는 「호출을 지웠다」만 잡고 ★**「검사가 상수로 뭉개졌다」는 못 잡는다**(이 저장소가 반복해 지적한 형태).
검증
cargo test --all571 passed / 0 failed / 1 ignored — ★27개 스위트 전건 합산(| tail -N미사용) · DoD 7명령 rc=0.★잃는 것: 지금까지 로드되던 파일 하나가 거부된다. 다만 그 형상은 어제 이 저장소가 잰 대로
javac·kotlinc·scalac·Lombok 산출물 5,479 클래스에 0이고 ASM 으로도 «일부러» 만들어야 나온다.