JOPA:用C++编写的Java编译器,Jikes已现代化至Java 6,并使用了Claude。
JOPA: Java compiler in C++, Jikes modernized to Java 6 with Claude

原始链接: https://github.com/7mind/jopa

这个项目是Jikes的现代化分支,Jikes是由IBM从1996-1999年开发的一种历史悠久、独立的Java编译器,也是IBM的首个开源项目。目标是将Jikes更新到Java 5 (J2SE 5.0)和Java 6 (Java SE 6)标准,包括泛型、增强型for循环、枚举、自动装箱/拆箱、注解和静态导入等特性。 更新后的Jikes生成Java 6字节码,并提供改进的调试功能。它需要CMake 3.20+和C++17编译器,以及可选的编码支持依赖项。虽然由于Java语言的变化,Jikes在2005年停止开发,但这个分支旨在将其复兴为一种潜在的启动工具,并作为编译器设计的一个有价值的研究对象——特别是其高效的C++实现和速度(历史上比`javac`快10-20倍)。该仓库包含编译器版本1.04到1.22。

## JOPA:用C++编写的现代化Java编译器 一位开发者成功利用Claude LLM(特别是Sonnet 4.5和Opus 4.5)对Jikes进行现代化改造,Jikes是一个最初用C++编写的Java编译器,使其支持Java 6并开始着手Java 7兼容性工作。这一成果是通过出乎意料的少量监督实现的,有时甚至采用“对抗”模式,即Claude编写代码,Codex进行审查。 该项目突显了LLM在复杂代码生成和适应方面的潜力,即使是在紧密耦合的遗留代码库中。成功的关键在于分解任务,并在模型遇到困难时提供帮助,同时利用可重现的环境(Nix)和强大的测试。 虽然该编译器的目标并非达到顶级性能,但其目标是为引导现代JDK(特别是ANT)创建一个可行的起点。开发者指出,Claude在完成这项任务时表现优于Codex和Gemini。相关的项目,例如OpenLDK(一个JVM字节码到Common Lisp的转译器)和bootstrappable.org的引导工作,也被讨论。
相关文章

原文

CI License: IBM-PL 1.0 Built with Nix

A totally Claude'd effort in modernizing jikes, the historical independent javac implementation in C++.

Could be useful for bootstrap purposes.

This fork adds comprehensive Java 5 (J2SE 5.0) and Java 6 (Java SE 6) language features:

  • Generics - Type erasure with generic classes, methods, and bounded type parameters
  • Enhanced For-Loop - For-each loops for arrays and Iterable collections
  • Varargs - Variable-length argument lists with automatic array creation
  • Enums - Enumerated types with synthetic methods (values(), valueOf())
  • Autoboxing/Unboxing - Automatic conversions between primitives and wrappers (assignments, method args, return values, arithmetic)
  • Static Imports - Import static members (single field, single method, wildcard)
  • Annotations - Marker, single-element, and full annotations
  • Class file version 50.0 - Generate Java 6 bytecode with -target 1.6
  • Debug information - Enhanced debugging with -g flag for parameter names and local variables
  • Requirements:

    • CMake 3.20+ and a C++17 compiler
    • iconv and/or ICU (uc) if encoding support stays enabled
    • Use the repo's nix/direnv setup (direnv exec . <cmd>) when available
  • With Nix:

    nix develop
    direnv exec . cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
    direnv exec . cmake --build build -j"$(nproc)"
    direnv exec . sh -c "cd build && ctest --output-on-failure"
    direnv exec . cmake --install build --prefix /usr/local
  • Generic CMake:

    cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
    cmake --build build
    cmake --install build --prefix /usr/local
  • Useful CMake options:

    • -DJIKES_ENABLE_DEBUG=ON — Enable internal compiler debugging hooks
    • -DJIKES_ENABLE_NATIVE_FP=OFF — Force emulated floating point
    • -DJIKES_ENABLE_ENCODING=OFF — Skip iconv/ICU; otherwise CMake fails if neither is present
    • -DJIKES_ENABLE_JVM_TESTS=OFF — Disable runtime validation tests (javap/JVM execution)

Jikes - a Java source code to bytecode compiler - was written by Philippe Charles and Dave Shields of IBM Research.

Jikes was written from scratch, from August 1996 to its first release on IBM's alphaWorks site in April 1997. Work continued until August, 1997, at which time the project was shut down so the authors could resume full-time work on the addition of support for inner classes.

The next release of Jikes was in March, 1998.

The availability of this release spurred new interest in a Linux version. The release of a Linux binary version in early July, 1998, set new single-day download records for IBM's alphaWorks site.

The availability of a Linux binary version was soon followed by requests for the source. IBM management approved the release in source form in September, 1998, followed by the release in early December, 1998.

Released in December, 1998, it was IBM's first open source project, and the first open-source project from IBMk to be included in a major Linux Distribution (Redhat, Fall 1999).

Jikes was notable both in its automatic error correction, in the quality of its error messages, and its compilation speed. It was routinely 10-20 times faster than javac, the standard compiler for Java when Jikes was released.

IBM's involvement in the Jikes project ended in late 1999. Work continued, first at IBM's Developerworks (where IBM was the original project in the Open Source Zone), and later at Sourceforge.

Active work on the project ceased in 2005. Changes in the Java language, most notably in the introduction of generics, made Jikes less attractive.

Jikes remains usable for beginners to the Java language, especially those interested in just the core features of the language.

The authors also believe Jikes to be of interest for its compiler designed and implementation, an believe it to be a suitable subject of study for an introductory compiler course.

Notable features include the following:

Written from scratch by two people. The only third-part code in the first version was used read Java binary class files, where were in Zip format.

No use of parser construction tools other than the Jikes Parser Generator, written by Philippe Charles.

Written in C++.

Includes a very efficient storage allocator and memory management.

The present repository includes Jikes versions 1.04 through 1.22. (Jikes 1.00 through 1.03 seem to have lost). The sources used were retrieved from the Sourcforge site in early July, 2012. Each version is identified by a git tag.

  • Originally written by Philippe Charles and David Shields of IBM Research.
  • Subsequent contributors include, but are not limited to:
    • Chris Abbey
    • C. Scott Ananian
    • Musachy Barroso
    • Joe Berkovitz
    • Eric Blake
    • Norris Boyd
    • Ian P. Cardenas
    • Pascal Davoust
    • Mo DeJong
    • Chris Dennis
    • Alan Donovan
    • Michael Ernst
    • Bu FeiMing
    • Max Gilead
    • Adam Hawthorne
    • Diane Holt
    • Elliott Hughes
    • Andrew M. Inggs
    • C. Brian Jones
    • Marko Kreen
    • David Lum
    • Phil Norman
    • Takashi Okamoto
    • Emil Ong
    • Andrew Pimlott
    • Daniel Resare
    • Mark Richters
    • Kumaran Santhanam
    • Gregory Steuck
    • Brian Sullivan
    • Andrew G. Tereschenko
    • Russ Trotter
    • Andrew Vajoczki
    • Jerry Veldhuis
    • Dirk Weigenand
    • Vadim Zaliva
    • Henner Zeller
联系我们 contact @ memedata.com