Manifold Systems Manifold Versions Save

Manifold is a Java compiler plugin, its features include Metaprogramming, Properties, Extension Methods, Operator Overloading, Templates, a Preprocessor, and more.

v2023.1.33

4 months ago

Release v2023.1.33

Type-safe SQL

  • Query types are instantly available as you type native SQL of any complexity in your Java code
  • Schema types are automatically derived from your database, providing type-safe CRUD, decoupled TX, and more
  • No ORM, No DSL, No wiring, and No code generation build steps

img_3.png

Tuple expressions

Tuple expressions provide concise syntax to group named data items in a lightweight structure.

var t = (name: "Bob", age: "35");
System.out.println("Name: " + t.name + " Age: " + t.age);

var t = (person.name, person.age);
System.out.println("Name: " + t.name + " Age: " + t.age);

Forwarding and True Delegation

Favor composition over inheritance. Use @link and @part for automatic interface implementation forwarding and delegation.

class MyClass implements MyInterface {
  @link MyInterface myInterface; // transfers calls on MyInterface to myInterface

  public MyClass(MyInterface myInterface) {
    this.myInterface = myInterface; // dynamically configure behavior
  }

  // No need to implement MyInterface here, but you can override myInterface as needed
}

auto type inference

  • auto type inference for local vars, fields, and method return types
  • Enables multiple return values for methods
import manifold.ext.rt.api.auto;

var result = findMinMax(data);
System.out.println("Minimum: " + result.min + " Maximum: " + result.max);

auto findMinMax(int[] data) {
  if(data == null || data.length == 0) return null;
  int min = Integer.MAX_VALUE;
  int max = Integer.MIN_VALUE;
  for(int i: data) {
    if(i < min) min = i;
    if(i > max) max = i;
  }
  return min, max;
} 

Multidimensional index operator

Property inference on record types

Java 21 Support

IntelliJ IDEA & Android Studio plugin improvements

  • Comprehensive support for all new features including type-safe SQL, forwarding & delegation, tuples, etc.
  • Many performance improvements and bug fixes toward an improved user experience in the IDE
  • Support IDEA Chinese Language Pack

Fixes & feature requests

#536: manifold-graphql: override java-graphql ParserOptions which are not applicable to compile-time use e.g., maxTokens #535: Intellij plugin: suppress "non-final field 'x' in enum..." issues re @val usage #533: Intellij plugin: suppress false positive errors re manifold string templates #532: Intellij plugin: string template processing is disabled in annotations due to wide usage of ${} templating in many annotation libraries #531: Fix ProcessCanceledExceptions, forward exceptions directly during "slow operations" handling, esp. ProcessCanceledException #529: Suppress error/warning messages in Chinese as well as English, translate/map message filters to Chinese (Simplified) Language Pack. #528: Use private tags to execute "slow operations", centralize how/where these are executed #525: Preprocessor: Enable IDE to use SymbolProviders according to module dependencies #520: Provide error message when attempting to use a method ref for a method returning auto, must use lambda in this case (for now) #516: Fix NoClassDefFoundError: com/intellij/lang/java/parser/BasicStatementParser (affected IJ versions: 2023.2.2, 2023.2.3) #497: IntelliJ plugin: Complete JDK 21 support #495: IntelliJ plugin: Improve performance and stability of manifold fragments in IntelliJ #494: IntelliJ plugin: Fix fragment error reporting #489: Fix "cannot implement" interface error using delegation with @link in JDK 21 #488: Fix tuple expr passed directly as argument to method (was broken in jdk 11+) #483: Unintended behavior for manifold-prop annotation parameters #479: Unintended behavior when using both manifold-delegation and manifold-props #478: Support abstract enum methods with manifold-ext #477: Field access from inside the class on a @set field #476: Fix issue with using annotation processors e.g., lombok, mixed with manifold #474: Fix regression in 2023.1.15 where new fragment delimiters can interfere with string templates #473: Change fragment delimiters #471: Change return type to be compatible with SequencedCollection#reversed #470: Support "short" runtime methods #468: Avoid adding bootstrap block to sidecar classes #467: IntelliJ plugin: support error/warning highlights in fragments (in prep for manifold-sql) #466: IntelliJ plugin: Deprecated class usage results in compilation error in IntelliJ IDEA #451: IntelliJ plugin: Invalid warning message re older manifold version in project than in intellij plugin #449: Remedy a java symbol resolve issue where a field and an inner class share the same name #446: Use MathContext.128 for big decimal division #436: Fix mapstruct handling of default interface methods #422: Fix self type bug with arrays #423: Add support for forwarding and delegation #421: IntelliJ plugin: auto, like var, should be highlighted as a keyword #418: Compiling from IntelliJ can cause UnsupportedClassVersionError using the preprocessor and using pre-JDK 17 #417: Class cannot be converted Issue #416: Unqualified static varargs extension method call results in compiler error #414: Using JDK 17+ in preview mode + using an annotation processor causes NPE #412: "Variable expected" error involving multidimensional index operator in assignment #411: Intermittent "Incorrect CachedValue use" errors #400: Support getter/setter extension methods as property access for manifold-props #409: Intellij plugin: fix generic extension method type parameter inference regression #408: Support Valhalla EA Jdk releases #407: Fix compile error using latest JDK 20 EA release (build 28) #406: IntelliJ plugin: "Incorrect CachedValue use:" errors reported with property and extension caching #405: IntelliJ plugin: many issues in latest 2022.3 release with renaming files/elements, other related issues #404: Using ReflectUtil with JDK 19 cannot set value on static final field on an interface #403: Extension methods on inner classes not working in some cases #402: IntelliJ plugin: Exception when using tuple expressions without adding manifold-tuple/manifold-tuple-rt #396: Handle expression in foreach stmt where the expression type structurally implements Iterator and a class extension exists that makes Iterable structural #395: Support property inference on record types #394: Support EA release of JDK 20 #393: Java 17+: fix $ escape char for string templates #392: Cast as raw generic type #387: Tree is null for module-info file, do not process #380: Fix regression involving fields as structurally equivalent to get/set methods #382: Fix instanceof pattern matching issue related to parser changes in latest IntelliJ release #376: Support an explicit typed variable having an implicit typed initializer expression #375: Policy change: support only LTS versions of JDKs and the latest release #373: New Feature: multiple return types via auto and enhanced tuple expressions #372: New Feature: type-safe tuple expressions #371: New Feature: auto type inference for local vars, fields, and method return types #364: Add @Expires annotation to prevent extension methods from duplicating JDK methods #355: fix instanceof Pattern Matching within if-statement condition (Cannot Find Symbol) #351: Increment/decrement operators on properties cause compiler exception in Java 11+ #349: Support non-public extension methods #348: @ThisClass extension method receiver, provides the calling class of static method #345: Allow Jailbreak to work when casting

v2022.1.5

2 years ago

Release v2022.1.5

Java 17 Support

  • Manifold fully supports Java 17 and Java 18 (Early Access)
  • Support extensions on record classes

IntelliJ IDEA & Android Studio plugin improvements

  • Many performance improvements and bug fixes toward an improved user experience in the IDE

Update for ManTL Templates

  • Fix rendering issues relating to recent IntelliJ IDEA platform changes. Other minor improvements.

Improvements for Structural Interfaces

  • Support structural interface implementation via Extension Class without having to manually create an IProxyFactory service impl. A powerful feature for overlaying APIs onto external systems.
  • Support operator overloading via default interface methods in structural interface
  • Support proxies on a structural interface with default methods with ReflectUtil.invokeDefault()

Improvements for Preprocessor

  • Implement the SymbolProvider SPI to augment the environment definitions with your own custom environment symbols.
  • Improved Android support:

The manifold-preprocessor-android-syms library implements the service to provide direct access to Android build variant symbols. You can add the library as a dependency to gain automatic access to familiar Android BuildConfig symbols:

DEBUG
BUILD_TYPE // current build variant  
FLAVOR // flavor of current build variant
etc. 

See manifold-preprocessor-android-syms for details.

Improvements for GraphQL

  • GraphQL generated code is less than 1/2 of its previous size. No API changes.
  • Added support for processing the raw GraphQL response to access custom key/value pairs etc.
  • Support multiple GraphQL schemas using .graphqlconfig files

Support dumping source

Manifold integrates directly with the Java parser, as such there are no intermediate files to manage. However, some tools may need to parse or otherwise analyze processed Java source separate from the Java compiler. In this case you can use the manifold.source.target compiler option to specify a directory where all source is copied as it is compiled, including preprocessed and generated source from Manifold.

Usage:

javac -Amanifold.source.target=<my-directory> ...

Bug fixes

  • #341 change strategy to address jdk12+ member filtering
  • #338 fix ManTL template issues that have piled up with recent JetBrains platform updates
  • #337 Support structural interface implementation via Extension Class without having to manually create an IProxyFactory service impl
  • #336 IntelliJ plugin: performing a clean build from maven/gradle tool causes perpetual refresh in UI
  • #334 handle case with ReflectUtil.invokeDefault() where the receiving default method has param type that is a structural interface
  • #333 handle structural overload operator methods
  • #332 fix issues with operator overloading relating to structural interfaces
  • #330 NPE in IntelliJ inside fileOpenedSync() when manifold-props not in use
  • #329 'Array index out of bounds' warning highlight in IJ editor for indexed access to Maps
  • #328 editing a graphql file in IntelliJ causes some graphql types not to resolve
  • #327 fix conflict with preprocessor build.properties and environment symbols
  • #326 Add a preprocessor SymbolProvider implementation for Android build variants
  • #325 Building on Android Studio with Gradle 7.0.3 and Java 11 causes internal compiler errors
  • #324 fix general lag in IJ editor after typing
  • #322 Add an SPI to augment the preprocessor's symbols dynamically
  • #319 Fix IJ plugin regarding manifold preprocessor when only the preprocessor is in use
  • #313 Fix default parameter values for graphql operations
  • #311 IJ plugin: Fix psi cache exception caused by intellij internals using WrappedLexer
  • #306 Support Java 17
  • #303 GQL Fields with Underscores producing incorrectly in 2021.1.23
  • #302 "Access is allowed from event dispatch thread only" exception thrown occasionally in IntelliJ
  • #301 GraphQL: Slim down generated source
  • #300 CCE at runtime when structural interface having a method that returns a structural interface
  • #297 IJ plugin: Some features of manifold-ext and manifold-props leak through to modules not depending on these artifacts, in such cases avoid applying these code paths
  • #296 AbstractMethodError using property syntax in an interface default method
  • #295 Support compiler option to dump [pre]processed and/or generated manifold sources to disk
  • #292 Compile with Java Operator Overloading inc() dec() error
  • #290 IJ plugin: Improve performance while editing, particularly where code completion involves manifold extensions, also avoid irrelevant code paths where possible e.g., type resolution involving manifold-ext where it is not used
  • #288 Incompatible types. required: 'manifold.rt.api.anno.any[]'
  • #286 Access is allowed from event dispatch thread only
  • #285 Sometimes causes code analysis failure
  • #284 IJ plugin: NullPointerException breaks menu items and Quick Fix suggestion
  • #283 Switch on Enum is probably broken IntelliJ Plugin
  • #282 Manifold incompatible with Lombok val/var locals
  • #281 IntelliJ 2021.2 Community Edition: Null Ptr Exceptions
  • #279 GraphQL: Bearer Authorization broken when calling graphQL server
  • #277 GraphQL: Add support for processing the raw GraphQL response to access custom key/value pairs etc.
  • #276 manifold-graphql: support a built-in "JSON" scalar
  • #273 IJ plugin: revise logic for protected property access
  • #270 don't pollute compiler output with warnings from generated code, particularly relevant with -Xlint:all usage
  • #268 manifold-strings: provide javac command line option to exclude simple $foo syntax from processing while still allowing ${foo}
  • #260 support extensions on record classes
  • #255 Fix issues with JDK 16 compatibility and manifold-props
  • #254 Inferred property silently shadows local captured reference from anonymous context
  • #253 using manifold-props with AWT/Swing app, cannot find symbols in sun.awt.util
  • #173 Fix race condition
  • #101 Support multiple GraphQL schemas using .graphqlconfig files

Release v2021.1.8

Properties

The manifold-props project is a compiler plugin to simplify declaring and using properties in Java. Use it to reduce the amount of code you would otherwise write and to improve your overall dev experience with properties.

public interface Book {
  @var String title;  // no more boilerplate code!
}
// refer to it directly by name
book.title = "Daisy";     // calls setter
String name = book.title; // calls getter 
book.title += " chain";   // calls getter & setter

Additionally, manifold-props automatically infers properties, both from your existing source files and from compiled classes your project uses.

java.time.ZonedDateTime zdt = ZonedDateTime.now();
String calendarType = zdt.chronology.calendarType; // access properties concisely & consistently throughout yor project

See Property inference.

Properties are fully integrated in both IntelliJ IDEA and Android Studio. Use the IDE's features to create new properties, verify property references, access properties with code completion, and more.

properties

Additional operator overloading support for:

  • prefix/postfix increment/decrement operators ++ and --
  • compound assignment: operators +=, -=, *=, /=, %=,
  • index operator [], both access and assignment

Please see Operator Overloading documentation for details.

Additional support for Structural Interfaces

  • support structural interfaces dynamically without having manifold-ext dependency at runtime. See #240.

Unit expressions improvements

New and binding constant:

  • use with Pair class to simplify syntax:
Pair<String, Integer> pair = "Moe" and 100;
  • add Map#mapOf extension method:
Map<String, Integer> scores = mapOf("Moe" and 100, "Larry" and 107, "Curly" and 111);

Preprocessor improvements

  • support relational expressions in the preprocessor. See #204.

Extension method improvements

Java 16 support

  • Adapt to API changes and changes resulting from JEP 396: Strongly Encapsulate JDK Internals by Default.

Release 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.

Release 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();
...

Release 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;

v2021.1.8

3 years ago

New Features (v2021.1.8)

Properties

The manifold-props project is a compiler plugin to simplify declaring and using properties in Java. Use it to reduce the amount of code you would otherwise write and to improve your overall dev experience with properties.

public interface Book {
  @var String title;  // no more boilerplate code!
}
// refer to it directly by name
book.title = "Daisy";     // calls setter
String name = book.title; // calls getter 
book.title += " chain";   // calls getter & setter

Additionally, manifold-props automatically infers properties, both from your existing source files and from compiled classes your project uses.

java.time.ZonedDateTime zdt = ZonedDateTime.now();
String calendarType = zdt.chronology.calendarType; // access properties concisely & consistently throughout yor project

See Property inference.

Properties are fully integrated in both IntelliJ IDEA and Android Studio. Use the IDE's features to create new properties, verify property references, access properties with code completion, and more.

properties

Additional operator overloading support for:

  • prefix/postfix increment/decrement operators ++ and --
  • compound assignment: operators +=, -=, *=, /=, %=,
  • index operator [], both access and assignment

Please see Operator Overloading documentation for details.

Additional support for Structural Interfaces

  • support structural interfaces dynamically without having manifold-ext dependency at runtime. See #240.

Unit expressions improvements

New and binding constant:

  • use with Pair class to simplify syntax:
Pair<String, Integer> pair = "Moe" and 100;
  • add Map#mapOf extension method:
Map<String, Integer> scores = mapOf("Moe" and 100, "Larry" and 107, "Curly" and 111);

Preprocessor improvements

  • support relational expressions in the preprocessor. See #204.

Extension method improvements

Java 16 support

  • Adapt to API changes and changes resulting from JEP 396: Strongly Encapsulate JDK Internals by Default.

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;

v2020.1.19

3 years ago

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;

v2020.1.17

3 years ago

New Features (v2020.1.17)

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;

v2019.1.29

4 years ago

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;

v2019.1.21

4 years ago

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;