Giter Site home page Giter Site logo

julianpeeters / artisanal-pickle-maker Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 1.0 1.45 MB

Make your own Scala pickled signatures. Takes class info as strings and gives back a pickled Scala signatures. For use with Java bytecode engineering libraries.

License: Apache License 2.0

Scala 100.00%

artisanal-pickle-maker's Introduction

Artisanal-Pickle-Maker

Make your own Scala pickled signatures.

Takes class info as strings and gives back pickled Scala signatures. For use with Java bytecode engineering libraries.

Why? Because existing Java bytecode-engineering tools can't see or alter a pickled Scala signature, thus the altered classes are incomplete in cases where Scala code has no Java equivalent. Artisanal-Pickle-Maker hopes to solve this by updating an altered class's Scala signtature to reflect changes made to the bytecode.

##Usage:## Available for Scala 2.11 (see branches for other supported versions). Build Status

Add the following dependency to your build.sbt file:

libraryDependencies += "com.julianpeeters" %% "artisanal-pickle-maker" % "0.10.1"

Get an artisanal.pickle.maker.ScalaSig with:

val scalaSig = new ScalaSig(List("case class"), List("mypackage", "MyRecord"), List(("x", "String"), ("y", "Option[Int]"))

scalaSig.bytes gives the encoded bytes as a UTF-8 String. This is the normal storage format of a natural pickled Scala signature.

Thus, scalaSig.bytes is identical to the encoded string that would be found in the ScalaSignature annotation of the conventionally defined class:

    `package models`
    `case class MyRecord(x: String, y: Option[Int])`

##Currently supports:## Are you generating or modifying Scala classes with ASM or another bytecode engineering library? Then add an updated pickled sig and make your class whole!

Classes - The generation of Scala sigs for regular and case classes that have value members only (signatures will not reflect user-defined defs, i.e., this doesn't yet support classes with defs due to concerns of hygiene).

Datatypes -

  • Byte
  • Short
  • Int
  • Long
  • Float
  • Double
  • Char
  • String
  • Boolean
  • Null
  • Nothing
  • Any
  • AnyRef
  • List
  • Option
  • user-defined (i.e. other classes)

##In the future:##

Datatypes - Support for more collections besides just List and Option

Extension - Support for flags that allow arbitrary extension (?)

Classes - Support for flags other than "case class" (?)

##Constructive advice is appreciated!##

artisanal-pickle-maker's People

Contributors

julianpeeters avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

dangrigore

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.