Skip to content

v2020.1.19

Compare
Choose a tag to compare
@rsmckinney rsmckinney released this 09 Jul 04:08
· 878 commits to master since this release

New Features (v2020.1.19)

Android Studio Support

Manifold now fully supports Android Studio. Please see Android Setup to
learn more.

Kotlin Support

Use Manifold with Kotlin and other JVM languages! Please see Kotlin Support to
learn more.

Support Java 6 & 7

Manifold now supports Java -source and -target versions prior to 8 with core features and most extensions including
manifold-preprocessor.

For instance, using manifold-preprocessor
you can use builtin definitions like this:

#if JAVA_6
  public String perform() {
      return "java6";
  }
#elif JAVA_7
  public String perform() {
      return "java7";
  }
#elif JAVA_8_OR_LATER
  public String perform() {
      return "at least java8";
  }
#endif

Notes:

  • Although Manifold supports -source and -target levels below 8, you must use a Java 8 or later compiler in your build
  • Some type manifolds such as manifold-graphql and manifold-json are not supported with -source levels below 8

Pure Static Compilation

Manifold dependencies are now separated into compile-only and API (or implementation) modules. This change allows
projects to limit Manifold's compilation features to compile-time and eliminate most of Manifold's footprint from
runtime. This change is also at the heart of Manifold's support for Android and Kotlin.

Explicit Compilation

Similar to javac's source file list, Manifold provides -Amanifold.source.<ext>=<regex> javac command line options to
explicitly compile resources either by type name using regular expressions or by file name using file system paths.

See the Sample Kotlin App for an example of using
explicit resource compilation.

New Features (v2019.1.29)

Type-safe CSV Support

Comprehensive support for CSV, interchangeable with JSON, XML, and YAML.

// Type-safely use a CSV file in your resource directory, no code gen
import com.example.MyCsvData; // from resource file: com/example/MyCsvData.csv
import com.example.MyCsvData.MyCsvDataItem;
...
// Load data from the resource file
MyCsvData dataItems = MyCsvData.fromSource();
// Access rows of data type-safely
for (MyCsvData.MyCsvDataItem item: dataItems) {
  String name = item.getLastName();
  LocalDateTime startDate = item.getStartDate();
  ...
}

Type-safe XML Support

Comprehensive support for XML, interchangeable with JSON, YAML, and CSV.

// Type-safely use an XML file in your resource directory
import com.example.config.MyXmlConfig;
...
// Load data from the resource file
MyXmlConfig config = MyXmlConfig.fromSource();
// Access elements/attributes type-safely
var linesOfBusiness = config.getEnvironment().getLinesOfBusiness();
...

New Features (v2019.1.21)

Operator Overloading

Implement operator methods on any type to directly support arithmetic, relational, and unit operators.

// BigDecimal expressions
if (bigDec1 > bigDec2) {
  BigDecimal result = bigDec1 + bigDec2;
  ...
}
// Implemnet operators for any type
MyType value = myType1 + myType2;

Unit Expressions

Unit or binding operations are unique to the Manifold framework. They provide a powerfully concise syntax and can be applied to a wide range of applications.

import static manifold.science.util.UnitConstants.*; // kg, m, s, ft, etc
...
Length distance = 100 mph * 3 hr;
Force f = 5.2 kg m/s/s; // same as 5.2 N
Mass infant = 9 lb + 8.71 oz;

Ranges

Easily work with the Range API using unit expressions. Simply import the RangeFun constants to create ranges.

// imports the `to`, `step`, and other "binding" constants
import static manifold.collections.api.range.RangeFun.*;
...
for (int i: 1 to 5) {
  out.println(i);
}

for (Mass m: 0kg to 10kg step 22r unit g) {
  out.println(m);
}

Science

Use the manifold-science framework to type-safely incorporate units and precise measurements into your applications.

import static manifold.science.util.UnitConstants.*; // kg, m, s, ft, etc.
...
Velocity rate = 65mph;
Time time = 1min + 3.7sec;
Length distance = rate * time;