Releases: christian-schlichtherle/bali-di-java
Bali DI for Java 0.12.0
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
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
This release fixes an ambiguity in the generated code.
Bali DI for Java 0.11.6
This release simplifies the generated code for companion classes in order to avoid unnecessary subclassing.
Bali DI for Java 0.11.5
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
This release fixes a ClassCastException thrown by the AnnotationProcessor on invalid source code.
Bali DI for Java 0.11.3
Fixed: @CacheNullable isn't respected for a non-abstract method in a dependency/component.
Bali DI for Java 0.11.2
This release adds @bali.Generated
annotations to all generated source files instead of the previous comments.
Bali DI 0.11.1
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
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.