diff --git a/.classpath b/.classpath
index 7c6ac24..81721b0 100644
--- a/.classpath
+++ b/.classpath
@@ -1,12 +1,20 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
diff --git a/.project b/.project
index 8ca7972..653f020 100644
--- a/.project
+++ b/.project
@@ -1,14 +1,23 @@
units-inference
-
+
+
+
org.eclipse.jdt.core.javabuilder
-
+
+
+
+
+ org.eclipse.buildship.core.gradleprojectbuilder
+
+
org.eclipse.jdt.core.javanature
+ org.eclipse.buildship.core.gradleprojectnature
diff --git a/.settings/org.eclipse.buildship.core.prefs b/.settings/org.eclipse.buildship.core.prefs
new file mode 100644
index 0000000..e889521
--- /dev/null
+++ b/.settings/org.eclipse.buildship.core.prefs
@@ -0,0 +1,2 @@
+connection.project.dir=
+eclipse.preferences.version=1
diff --git a/annotated/Addition.java b/annotated/Addition.java
deleted file mode 100644
index 25cba68..0000000
--- a/annotated/Addition.java
+++ /dev/null
@@ -1,68 +0,0 @@
-import units.qual.m;
-import units.qual.Dimensionless;
-import units.qual.UnknownUnits;
-import units.qual.s;
-import units.qual.UnitsBottom;
-import units.UnitsTools;
-import units.qual.*;
-
-@Dimensionless
-class Addition {
- @m int m = UnitsTools.m;
- @s int s = UnitsTools.s;
- @UnknownUnits int top;
- @UnitsBottom int bot;
-
- void tops(@Dimensionless Addition this) {
- @UnknownUnits
- int a = top + top;
- @UnknownUnits
- int b = top + bot;
- @UnknownUnits
- int c = bot + top;
- @UnknownUnits
- int d = top + m;
- @UnknownUnits
- int e = s + top;
-
- // unsat cases:
- // @m int ua = top + top;
- // @m int ub = top + bot;
- // @m int uc = bot + top;
- // @m int ud = top + m;
- // @m int ue = s + top;
- }
-
- void bots(@Dimensionless Addition this) {
- @UnitsBottom
- int a = bot + bot;
- @m
- int b = bot + m;
- @s
- int c = s + bot;
- }
-
- void units(@Dimensionless Addition this) {
- @m
- int a = m + m;
- @UnknownUnits
- double b = Math.PI + m;
-
- // unsat cases:
- // @s int ua = m + m;
- // @s double ub = Math.PI + m;
- }
-
- void slots(@Dimensionless Addition this) {
- @m
- int a = m + m;
- @m
- int b = m + a;
- @m
- int c = a + m;
- @m
- int d = b + b;
- @m
- int e = b + c;
- }
-}
diff --git a/annotated/Casting.java b/annotated/Casting.java
deleted file mode 100644
index 159aac9..0000000
--- a/annotated/Casting.java
+++ /dev/null
@@ -1,25 +0,0 @@
-import units.qual.m;
-import units.qual.Dimensionless;
-import units.qual.*;
-
-@Dimensionless
-class Casting {
- // // :: fixable-error: (assignment.type.incompatible)
- // @m int primM2 = (int) 10.0f;
- // // :: fixable-error: (assignment.type.incompatible)
- // @s Integer primS = 30;
- //
- // int primDim = (int) 20.0f;
-
- @m
- int boxDim = ((@m int) (20));
- @m int boxM = (@m int) boxDim;
-
- // void cast() {
- // int x = 20;
- // @m int y = (@m int) x;
- //
- // Integer boxDim = 20;
- // @m Integer boxM = (@m Integer) boxDim;
- // }
-}
diff --git a/annotated/Conditional.java b/annotated/Conditional.java
deleted file mode 100644
index 97c2140..0000000
--- a/annotated/Conditional.java
+++ /dev/null
@@ -1,19 +0,0 @@
-import units.qual.Dimensionless;
-import units.qual.*;
-
-@Dimensionless
-class Conditional<@Dimensionless T extends @Dimensionless RealFieldElement<@Dimensionless T>> {
- public Conditional() {}
-
- public @Dimensionless Conditional compose(@Dimensionless Conditional<@Dimensionless T> this, final @Dimensionless boolean convention) {
- return convention ? composeInternal() : applyTo();
- }
-
- private @Dimensionless Conditional composeInternal(@Dimensionless Conditional<@Dimensionless T> this) {
- return new @Dimensionless Conditional<>();
- }
-
- private <@Dimensionless T extends @Dimensionless RealFieldElement<@Dimensionless T>> @Dimensionless Conditional applyTo(@Dimensionless Conditional<@Dimensionless T> this) {
- return new @Dimensionless Conditional<>();
- }
-}
diff --git a/annotated/Constructors.class b/annotated/Constructors.class
deleted file mode 100644
index a9c4999..0000000
Binary files a/annotated/Constructors.class and /dev/null differ
diff --git a/annotated/Constructors.java b/annotated/Constructors.java
deleted file mode 100644
index 8800d3c..0000000
--- a/annotated/Constructors.java
+++ /dev/null
@@ -1,46 +0,0 @@
-import units.qual.Dimensionless;
-import units.UnitsTools;
-import units.qual.*;
-
-@Dimensionless
-class PolyUnitClass {
- @PolyUnit PolyUnitClass(@PolyUnit int x) {}
-}
-
-@Dimensionless
-class NoAnnotClass {
- NoAnnotClass(@Dimensionless int x) {}
-}
-
-@Dimensionless
-class Constructors {
- // TODO: return check isn't quite correct for inner declared classes
-
-// void polyUnitConstructorTest() {
-// // propagate @m from assignment context
-// // :: fixable-error: (assignment.type.incompatible)
-// @m PolyUnitClass puc1 = new PolyUnitClass(5);
-//
-// // progagate @m from constructor arg
-// PolyUnitClass puc2 = new PolyUnitClass(5 * UnitsTools.m);
-//
-// // propagate @m from constructor return type
-// // :: fixable-error: (constructor.invocation.invalid)
-// PolyUnitClass puc3 = new @m PolyUnitClass(5);
-//
-// // :: fixable-error: (constructor.invocation.invalid)
-// @m PolyUnitClass puc4 = new @m PolyUnitClass(5);
-//
-// // :: fixable-error: (constructor.invocation.invalid)
-// PolyUnitClass puc5 = new @m PolyUnitClass(5 * UnitsTools.s);
-// }
-
- void nonPolyConstructorTest(@Dimensionless Constructors this) {
- // :: fixable-error: (assignment.type.incompatible)
-// @m Integer mc1 = new Integer(5);
-// // :: fixable-error: (constructor.invocation.invalid)
-// @m Integer mc2 = new @m Integer(5);
-
- @Dimensionless NoAnnotClass na1 = new @Dimensionless NoAnnotClass(((@Dimensionless int) (5)));
- }
-}
diff --git a/annotated/JavaUtilConcurrentTimeUnit.java b/annotated/JavaUtilConcurrentTimeUnit.java
deleted file mode 100644
index 95ee069..0000000
--- a/annotated/JavaUtilConcurrentTimeUnit.java
+++ /dev/null
@@ -1,76 +0,0 @@
-import units.qual.Dimensionless;
-import units.qual.ms;
-import units.qual.s;
-import units.qual.ns;
-import units.qual.us;
-import static java.util.concurrent.TimeUnit.*;
-
-import java.util.concurrent.TimeUnit;
-import units.qual.*;
-
-@Dimensionless
-class JavaUtilConcurrentTimeUnit {
-
- void test(@Dimensionless JavaUtilConcurrentTimeUnit this, @Dimensionless long time, @Dimensionless TimeUnit unit) throws Exception {
- @ms
- long milliseconds = unit.toMillis(time);
- Thread.sleep(milliseconds);
- }
-
- void test2(@Dimensionless JavaUtilConcurrentTimeUnit this) {
- @s
- TimeUnit s = TimeUnit.SECONDS;
-
- @ms
- TimeUnit ms = TimeUnit.MILLISECONDS;
-
- @us
- TimeUnit us = TimeUnit.MICROSECONDS;
-
- @ns
- TimeUnit ns = NANOSECONDS;
-
- @s long seconds = s.convert(((@Dimensionless long) (10L)), NANOSECONDS);
-
- // convert 10 minutes to milliseconds
- @ms long milliseconds = ms.convert(((@Dimensionless long) (10L)), TimeUnit.MINUTES);
-
- @us long microsec = us.convert(((@Dimensionless long) (10L)), TimeUnit.HOURS);
-
- @ns long nanosec = ns.convert(((@Dimensionless long) (10L)), TimeUnit.DAYS);
- }
-
- void testParams(@Dimensionless JavaUtilConcurrentTimeUnit this) {
- @s
- TimeUnit s_unit = TimeUnit.SECONDS;
- @ns
- TimeUnit ns_unit = NANOSECONDS;
-
- @ns
- long ns = ((@ns int) (1000));
- @s
- long s = ((@s int) (1000));
-
- // :: fixable-error: (argument.type.incompatible)
- TimeUnit.SECONDS.toMillis(s);
- // :: fixable-error: (argument.type.incompatible)
- TimeUnit.NANOSECONDS.toMillis(ns);
-
- // :: fixable-error: (argument.type.incompatible)
- ns_unit.toMillis(ns);
- // :: fixable-error: (argument.type.incompatible)
- s_unit.toMillis(s);
- }
-
- void testReturn(@Dimensionless JavaUtilConcurrentTimeUnit this, @s long s1, @s long s2) {
- @s
- TimeUnit s = TimeUnit.SECONDS;
- @ms
- TimeUnit ms = TimeUnit.MILLISECONDS;
-
- // :: fixable-error: (assignment.type.incompatible)
- s1 = s.convert(((@Dimensionless long) (10L)), NANOSECONDS);
- // :: fixable-error: (assignment.type.incompatible)
- s2 = TimeUnit.SECONDS.convert(((@Dimensionless long) (10L)), NANOSECONDS);
- }
-}
diff --git a/annotated/Methods.class b/annotated/Methods.class
deleted file mode 100644
index efa92f0..0000000
Binary files a/annotated/Methods.class and /dev/null differ
diff --git a/annotated/Methods.java b/annotated/Methods.java
deleted file mode 100644
index de4690e..0000000
--- a/annotated/Methods.java
+++ /dev/null
@@ -1,51 +0,0 @@
-import units.qual.Dimensionless;
-import units.qual.m;
-import units.UnitsTools;
-import units.qual.*;
-
-@Dimensionless
-class Methods {
-// @PolyUnit int polyUnitMethod(@PolyUnit int x) {
-// return x;
-// }
-
-// @PolyUnit int polyUnitMethod(@PolyUnit int x, @PolyUnit int y) {
-// return x + y;
-// }
-//
-// @m int meterMethod(@m int x) {
-// return x;
-// }
-
- @m
- int method(@Dimensionless Methods this) {
- return ((@m int) (5));
- }
-
- void testMethod(@Dimensionless Methods this) {
- // :: fixable-error: (assignment.type.incompatible)
- @m int num = method();
- }
-
-// void polyUnitMethodTest() {
-// // :: fixable-error: (assignment.type.incompatible)
-// @m int pum1 = polyUnitMethod(5);
-//
-//// @m int pum2 = polyUnitMethod(5 * UnitsTools.m);
-////
-//// // :: fixable-error: (assignment.type.incompatible)
-//// @m int pum3 = polyUnitMethod(5, 6);
-// }
-
-// void normalMethodTest() {
-// // :: fixable-error: (argument.type.incompatible)
-// int nm1 = meterMethod(5);
-// }
-//
-// void chainPolyUnitMethodTest() {
-// // :: fixable-error: (assignment.type.incompatible)
-// @m int cpum1 = polyUnitMethod(polyUnitMethod(5));
-//
-// int cpum2 = polyUnitMethod(polyUnitMethod(5 * UnitsTools.m));
-// }
-}
diff --git a/annotated/NoAnnotClass.class b/annotated/NoAnnotClass.class
deleted file mode 100644
index 5d66e4c..0000000
Binary files a/annotated/NoAnnotClass.class and /dev/null differ
diff --git a/annotated/PolyUnitClass.class b/annotated/PolyUnitClass.class
deleted file mode 100644
index 4c220d9..0000000
Binary files a/annotated/PolyUnitClass.class and /dev/null differ
diff --git a/annotated/RealFieldElement.java b/annotated/RealFieldElement.java
deleted file mode 100644
index bfa2b1e..0000000
--- a/annotated/RealFieldElement.java
+++ /dev/null
@@ -1,2 +0,0 @@
-import units.qual.Dimensionless;
-public interface RealFieldElement<@Dimensionless T extends @Dimensionless Object> {}
diff --git a/annotated/StaticFinalConstants.java b/annotated/StaticFinalConstants.java
deleted file mode 100644
index dd45ac9..0000000
--- a/annotated/StaticFinalConstants.java
+++ /dev/null
@@ -1,30 +0,0 @@
-import units.qual.rad;
-import units.qual.Dimensionless;
-import static java.lang.Math.*;
-
-import units.UnitsTools;
-import units.qual.*;
-
-@Dimensionless
-class StaticFinalConstants {
-
- @Dimensionless
- static class MyConstants {
- public static final @Dimensionless double X = ((@Dimensionless int) (10));
- public static final @rad Integer Y = ((@rad int) (Integer.MAX_VALUE));
-
- public static final @rad int HASUNIT = ((@Dimensionless int) (20)) * UnitsTools.rad;
-
- public MyConstants() {};
- }
-
- void inferRadians2(@Dimensionless StaticFinalConstants this) {
- // :: fixable-error: (argument.type.incompatible)
- sin(((@rad double) (MyConstants.X)));
-
- // :: fixable-error: (argument.type.incompatible)
- tan(MyConstants.Y);
-
- cos(MyConstants.HASUNIT);
- }
-}
diff --git a/annotated/Variables.java b/annotated/Variables.java
deleted file mode 100644
index 738639a..0000000
--- a/annotated/Variables.java
+++ /dev/null
@@ -1,79 +0,0 @@
-import units.qual.UnitsRep;
-import units.qual.Dimensionless;
-import units.qual.m;
-import units.qual.s;
-import units.qual.UnitsBottom;
-import units.UnitsTools;
-import units.qual.*;
-
-@Dimensionless
-class Variables {
-
- // primitive fields
- @UnknownUnits int puf = ((@Dimensionless int) (10));
- @Dimensionless int pdf = ((@Dimensionless int) (30));
-
- // :: fixable-error: (assignment.type.incompatible)
- @m int pmf = ((@m int) (10));
- // :: fixable-error: (assignment.type.incompatible)
- @s int psf = ((@s int) (20));
-
- void primitiveVars(@Dimensionless Variables this) {
- @UnknownUnits int puv = ((@Dimensionless int) (10));
- @Dimensionless int pdv = ((@Dimensionless int) (30));
-
- // :: fixable-error: (assignment.type.incompatible)
- @m int pmv = ((@m int) (10));
- // :: fixable-error: (assignment.type.incompatible)
- @s int psv = ((@s int) (20));
- }
-
- // boxed number fields
- @UnknownUnits Integer buf = ((@Dimensionless int) (10));
- @Dimensionless Integer bdf = ((@Dimensionless int) (20));
- @UnitsBottom Integer bbf = null;
- // :: fixable-error: (assignment.type.incompatible)
- @m Integer bmf = ((@m int) (10));
- // :: fixable-error: (assignment.type.incompatible)
- @s Integer bsf = ((@s int) (20));
-
- void boxedNumberVars(@Dimensionless Variables this) {
- @UnknownUnits Integer buv = ((@Dimensionless int) (10));
- @Dimensionless Integer bdv = ((@Dimensionless int) (20));
- @UnitsBottom Integer bbv = ((@UnitsBottom Object) (null));
- // :: fixable-error: (assignment.type.incompatible)
- @m Integer bmv = ((@m int) (10));
- // :: fixable-error: (assignment.type.incompatible)
- @s Integer bsv = ((@s int) (20));
- }
-
- void boxedConstructorCalls(@Dimensionless Variables this) {
- // :: fixable-error: (assignment.type.incompatible)
- @m Integer implicitValueOfCall = ((@m int) (10));
- // :: fixable-error: (assignment.type.incompatible)
- @m Integer explicitValueOfCall = ((@m Integer) (Integer.valueOf(((@m int) (10)))));
- // :: fixable-error: (constructor.invocation.invalid)
- @m Integer omittingConstructorArgType = ((@Dimensionless Integer) (new @m Integer(((@Dimensionless int) (10)))));
- @m Integer omittingConstructorReturnType = ((@Dimensionless Integer) (new @m Integer(((@UnitsRep(top=false, bot=false, prefixExponent=0, baseUnitComponents={@units.qual.BUC(unit="deg", exponent=0), @units.qual.BUC(unit="m", exponent=-1), @units.qual.BUC(unit="rad", exponent=0), @units.qual.BUC(unit="s", exponent=0)}) int) (10)) * UnitsTools.m)));
- // :: fixable-error: (assignment.type.incompatible)
- @m Integer omittingConstructorArgAndReturnType = ((@Dimensionless Integer) (new @m Integer(((@Dimensionless int) (10)))));
- }
-
- void boxedMethodCalls(@Dimensionless Variables this) {
- // :: fixable-error: (assignment.type.incompatible)
- @m Long staticPolyUnitMethod = ((@m long) (Integer.toUnsignedLong(((@m int) (10)))));
- }
-
- void customUnitForInsertion(@Dimensionless Variables this) {
- @UnitsRep(
- top = false,
- bot = false,
- prefixExponent = 4,
- baseUnitComponents = {
- @BUC(unit = "m", exponent = 12),
- @BUC(unit = "s", exponent = -34)
- })
- // :: fixable-error: (assignment.type.incompatible)
- Integer x = ((@UnitsRep(top=false, bot=false, prefixExponent=4, baseUnitComponents={@units.qual.BUC(unit="deg", exponent=0), @units.qual.BUC(unit="m", exponent=12), @units.qual.BUC(unit="rad", exponent=0), @units.qual.BUC(unit="s", exponent=-34)}) int) (50));
- }
-}
diff --git a/benchmarks/find_replace.sh b/benchmarks/find_replace.sh
new file mode 100755
index 0000000..9ede210
--- /dev/null
+++ b/benchmarks/find_replace.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+# find_replace.sh
+
+# echo "Find and replace in current directory!"
+# echo "Existing string?"
+# read existing
+# echo "Replacement string?"
+# read replacement
+# echo "Replacing all occurences of $existing with $replacement in files matching $filepattern"
+
+# find . -type f -name "*.java" -print0 | xargs -0 sed -i '' -e "s/$existing/$replacement/g"
+
+find . -type f -name "*.java" -print0 | xargs -0 sed -i '' -e "s/import si.uom.SI;/import units.UnitsTools;/g"
+find . -type f -name "*.java" -print0 | xargs -0 sed -i '' -e "s/SI.METRE/UnitsTools.m/g"
+find . -type f -name "*.java" -print0 | xargs -0 sed -i '' -e "s/SI.RADIAN/UnitsTools.rad/g"
+find . -type f -name "*.java" -print0 | xargs -0 sed -i '' -e "s/SI.SECOND/UnitsTools.s/g"
+find . -type f -name "*.java" -print0 | xargs -0 sed -i '' -e "s/SI.KILOMETER/UnitsTools.km/g"
+find . -type f -name "*.java" -print0 | xargs -0 sed -i '' -e "s/SI.DAY/UnitsTools.day/g"
+find . -type f -name "*.java" -print0 | xargs -0 sed -i '' -e "s/SI.YEAR/UnitsTools.year/g"
+
+find . -type f -name "*.java" -print0 | xargs -0 sed -i '' -e "s/import si.uom.NonSI;/import units.UnitsTools;/g"
+find . -type f -name "*.java" -print0 | xargs -0 sed -i '' -e "s/NonSI.DEGREE_ANGLE/UnitsTools.deg/g"
+
+find . -type f -name "*.java" -print0 | xargs -0 sed -i '' -e "s/import javax.measure.Unit;//g"
+find . -type f -name "*.java" -print0 | xargs -0 sed -i '' -e "s/Unit>/int/g"
+find . -type f -name "*.java" -print0 | xargs -0 sed -i '' -e "s/Unit/int/g"
+find . -type f -name "*.java" -print0 | xargs -0 sed -i '' -e "s/Unit/int/g"
+find . -type f -name "*.java" -print0 | xargs -0 sed -i '' -e "s/Unit