Giter Club home page Giter Club logo

jitescript's Introduction

Jitescript - Java API for Bytecode

This project is inspired by @headius's BiteScript. The goal is to produce a Java library with a similar API so that bytecode generation can be as nice in Java as BiteScript makes it in JRuby.

cloudbees rocks!

Quickstart

Just add the project maven dependency info:

<dependency>
  <groupId>me.qmx.jitescript</groupId>
  <artifactId>jitescript</artifactId>
  <version>0.3.0</version>
</dependency>

Then take a look at JiteClassTest example on how to use it.

How to get help

Join us on #dynjs channel at irc.freenode.net.

jitescript's People

Contributors

abstractj avatar bobmcwhirter avatar danielpassos avatar dependabot[bot] avatar fge avatar headius avatar jkutner avatar kishorkunal-raj avatar penberg avatar porcelli avatar qmx avatar tkoeppe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jitescript's Issues

Code needs modernization for recent Java versions

Modern Java complains about "raw types" when types such as Class or Enum are used; those should perhaps nowadays be spelled Class<?> and Enum<?>. Would you like a pull request for such a change?

Use `getDeclaredClass` on `Enum`

I don't know Java well, so I'd just like to leave this as a suggestion, without judgement:

Our static analysis suggests a change at https://github.com/qmx/jitescript/blob/master/src/main/java/me/qmx/jitescript/VisibleAnnotation.java#L34, to change value.getClass() to value.getDeclaredClass(). The former returns some derived class for enums that declare methods, whereas the latter returns the actual enum type.

I'm not sure if that's correct, but it was flagged as an error-prone pattern.

jitescript fails to build with asm-debug-all

Hi,

I noticed that jitescript fails to build if the dependency on asm-all is replaced by asm-debug-all. Here is the error displayed:

src/main/java/me/qmx/jitescript/MethodDefinition.java:[58,36] error: incompatible types: ArrayList<VisibleAnnotation> cannot be converted to List<AnnotationNode>
src/main/java/me/qmx/jitescript/FieldDefinition.java:[25,34] error: incompatible types: ArrayList<VisibleAnnotation> cannot be converted to List<AnnotationNode>

This error doesn't happen with asm-all because the classes are stripped from the debug symbols and the generic signatures.

Maybe VisibleAnnotation should extend AnnotationNode so the list contains the type expected?

Using jitescript to modify bytecode?

Followup to a discussion on IRC (freenode, channel `#dynjs).

I have taken on me to kickstart parboiled "1" development again, since it has halted two years ago, and have created grappa.

Basically: you write parsers in Java and create your parser with:

final MyParser parser = Parboiled.createParser(MyParser.class);

This does the following:

  • create a ParserClassNode containing the bytecode of MyParser);
  • create a name for the new class, since the instance returned is a class inheriting your parser class;
  • for each RuleMethod in the ParserClassNode, that is, methods defined in the base class returning a Rule, perform a given number of transformations; those transformations are defined here.

When you have a look at the classes defined here, what they all do (on the byte code copy) is to generate bytecode which is appended/prepended to the existing method bytecode.

And that is done using raw ASM...

Having googled around, I stumbled upon this library when watching a video on YouTube by the author of JRuby mentioning this library; but I don't see how I can use this library to modify existing bytecode?

An example of what I mean is here.

I know I'll have to modify this code one day (when I go Java 7 I want to go indy); but right now, I am looking for a library which can make it easier for me to generate that kind of "bytecode set", and there are many; a lot more such code extracts are available in the enclosing package. Can JiteScript help me here?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.