Readme.txt

Path: Readme.txt
Last Update: Mon May 18 11:56:18 +0200 2015

javaclass-rb by Peter 'Code Cop' Kofler

Description

javaclass-rb (Java Class File Parser for Ruby) is a parser and disassembler for Java class files, similar to the javap command. It provides access to the package, protected, and public fields and methods of the classes passed to it together with a list of all outgoing references.

Motivation

I am still doing Java most of the time. I used to be quite enthusiastic about it, but after 11 years I can see the advantages of being a polyglot. So I use Ruby for all kind of stuff, just for fun. When I needed some Java class analysis I wrote it in Ruby. As I am a puritan, I did not want to call javap from my script, so I started disassembling the class files, which might be the base for some serious static code analysis tools. (I started adding methods to that end and planned for some common metrics as well.)

Install

  sudo gem install javaclass

Documentation

Module JavaClass is the entry point for basic functions. All advanced functions are available in Object through the JavaClass::Dsl::Mixin. The main class or the parser is JavaClass::ClassFile::JavaClassHeader which provides access to all information of a Java class file.

I tried hard to rdoc all classes and public methods, so just read it.

Usage

See the various examples in the examples folder of the gem.

There is some experimental logic to recognize Java class name literals in Ruby which are mapped to JavaClass::JavaQualifiedName. Packages have to be suffixed with ".*" to be recognized. See JavaClass::Dsl::JavaNameFactory for its usage.

Dependencies

  • Ruby 1.8.7 (also tested under 1.9.3, 2.0.0 and 2.1.6)
  • rubyzip 0.9.1 (also tested with 0.9.6.1, 0.9.9, 1.0.0 and 1.1.7)
  • Originally Ruby 1.8.6 with rubyzip 0.9.1

References

License

Typically the licenses listed for the project are that of the project itself, and not of dependencies.

[Validate]