Repository navigation
forked from projectlombok/lombok
Folders and files
Repository files navigation
This is fork of projectlombok for experiments.
Operator Overloading:
branch operatorOverloading
Implementation of (Scala-like) Operator Overloading for Java language.
Works with javac and Eclipse IDE.
Works partially with Netbeans on maven based projects.
Example (See also: ./usage_examples/OperatorOverload_post.jpage):
import java.math.BigInteger;
public class Test {
public static void main(String[] args) {
BigInteger a = BigInteger.valueOf(1),
b = BigInteger.valueOf(2),
c = a + b*a;
System.out.println(c);
}
}
Here `a+b*a` will be transformed to `a.add(b.multiply(a))`.
Map operator to method:
binary:
"+" - "add",
"-" - "subtract",
"*" - "multiply",
"/" - "divide",
"%" - "remainder",
"&" - "and",
"|" - "or",
"^" - "xor",
"<<" - "shiftLeft",
">>" - "shiftRight"
unary:
"-" - "negate"
"~" - "not"
compare:
"<","<=",">",">=" - "compareTo"
These methods exists in many java classes (ex:BigInteger) so you can
use operators on them "out of the box".
Methods inlining:
branch inline
outdated
Original README:
projectlombok makes java a spicier language by adding 'handlers' that know how to build and compile simple, boilerplate-free, not-quite-java code.
See LICENSE for the project lombok license.
To start, run:
ant -projecthelp
HINT: If you'd like to develop lombok in eclipse, run 'ant eclipse' first. It creates the necessary project infrastructure and downloads dependencies.
Project Authors:
Reinier Zwitserloot
twitter: @surial
home: http://zwitserloot.com/
Roel Spilker
twitter: @rspilker