Skip to content

Releases: christian-schlichtherle/bali-di-java

Bali DI for Java 0.12.0

30 Mar 00:04
Compare
Choose a tag to compare

This release adds code generation for dependency setters. This can be used in test code to inject mocks etc. The declared method for the resolution of the dependency in the module has to be annotated with @Cache and a matching setter method must be declared, too. For example:

import bali.Module;
import java.util.Date;

@Module
interface MyModule {

    @Cache(setter = "setDate")
    Date getDate();

    void setDate(Date value);
}

This will generate code to implement the getDate()and setDate(Date) methods in the companion interface MyModule$ and the companion class MyModule$$.

If you omit the setter attribute of the @Cache annotation, then the setter method has the same name as the getter method:

import bali.Module;
import java.util.Date;

@Module
interface MyModule {

    @Cache
    Date date();

    void date(Date value);
}

Bali DI for Java 0.11.8

18 Aug 09:07
Compare
Choose a tag to compare

This release fixes an ambiguity in the generated code if a module is in the root package. Local class names are now suffixed with the $ character.

Bali DI for Java 0.11.7

18 Aug 09:06
Compare
Choose a tag to compare

This release fixes an ambiguity in the generated code.

Bali DI for Java 0.11.6

18 Aug 07:38
Compare
Choose a tag to compare

This release simplifies the generated code for companion classes in order to avoid unnecessary subclassing.

Bali DI for Java 0.11.5

18 Aug 06:37
Compare
Choose a tag to compare

This release generates local classes with meaningful names instead of anonymous classes for abstract component classes (or interfaces). The generated local classes have the simple name of the class or interface expected to be returned from the module method. Here is an example:

import bali.*

@Module
interface MyModule {

    @Make(RealFormatter.class)
    Formatter formattter();
}

Let's suppose RealFormatter is an abstract interface. Now in this release, the annotation processor would generate a local class with the simple name RealFormatter because that's the type which is expected to be returned from this method as requested by @Make(RealFormatter.class).

Bali DI for Java 0.11.4

01 Aug 10:53
Compare
Choose a tag to compare

This release fixes a ClassCastException thrown by the AnnotationProcessor on invalid source code.

Bali DI for Java 0.11.3

27 Aug 03:43
Compare
Choose a tag to compare

Fixed: @CacheNullable isn't respected for a non-abstract method in a dependency/component.

Bali DI for Java 0.11.2

08 Apr 17:32
Compare
Choose a tag to compare

This release adds @bali.Generated annotations to all generated source files instead of the previous comments.

Bali DI 0.11.1

21 Mar 17:22
Compare
Choose a tag to compare

Improves code generation so that the @CacheNullable annotation is ignored when the return value is a primitive type and @Cache is assumed instead.

Bali DI 0.11.0

21 Mar 15:57
Compare
Choose a tag to compare

This release adds support for caching the return values of methods with primitive return types.
Example:

package mypackage;

import bali.Cache;
import bali.Module;

import java.util.concurrent.ThreadLocalRandom;

import static bali.CachingStrategy.THREAD_LOCAL;

@Module
interface MyModule {

    @Cache(THREAD_LOCAL)
    default int randomInt() {
        return ThreadLocalRandom.current().nextInt();
    }
}

This release also improves the generated Java source code so that it doesn't contain package names of types in the same package. All other types still get fully qualified in order to avoid compile time errors resulting from ambiguities.