diff --git a/build.gradle.kts b/build.gradle.kts index d4b2e27..65d8007 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,8 +8,6 @@ repositories { } dependencies { - api("javax.inject:javax.inject:1") - testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2") } diff --git a/docs/config/bindings.md b/docs/config/bindings.md index 5b9a9d7..9214371 100644 --- a/docs/config/bindings.md +++ b/docs/config/bindings.md @@ -12,7 +12,7 @@ provider is called ### Direct Binding A direct binding is a binding of a type to a provider function -(`javax.inject.Provider`) +(`team.unnamed.inject.Provider`) ```java binder.bind(Database.class).toProvider(() -> { diff --git a/docs/dependency-injection.md b/docs/dependency-injection.md index 43018ff..2ec1559 100644 --- a/docs/dependency-injection.md +++ b/docs/dependency-injection.md @@ -52,7 +52,7 @@ and re-usable Here is an example that uses dependency injection with `unnamed/inject` ```java -import javax.inject.Inject; +import team.unnamed.inject.Inject; public class UserDao { diff --git a/docs/getting-started.md b/docs/getting-started.md index e72be97..6f09fac 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -3,7 +3,7 @@ Welcome to the `inject` documentation `unnamed/inject` is a zero-dependency, lightweight and fast runtime dependency -injection library compatible with the JSR-330 specification for Java 8+ +injection library for Java 8+ ### Features diff --git a/docs/installation.md b/docs/installation.md index 7989d66..1129d3f 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -18,7 +18,7 @@ Add the dependency ```kotlin dependencies { - implementation("team.unnamed:inject:1.0.2") + implementation("team.unnamed:inject:2.0.0") } ``` @@ -39,6 +39,6 @@ Add the dependency team.unnamed inject - 1.0.2 + 2.0.0 ``` \ No newline at end of file diff --git a/readme.md b/readme.md index db4adfc..86dd248 100644 --- a/readme.md +++ b/readme.md @@ -4,8 +4,7 @@ [![Discord](https://img.shields.io/discord/683899335405994062)](https://discord.gg/xbba2fy) `unnamed/inject` is a zero-dependency, lightweight and fast runtime dependency -injection library based on [Google's Guice](https://github.com/google/guice), -compatible with the JSR-330 specification for Java 8+ +injection library based on [Google's Guice](https://github.com/google/guice) for Java 8+ By not having to worry about manually injecting dependencies, this library will potentially increase your programming productivity diff --git a/src/main/java/team/unnamed/inject/Binder.java b/src/main/java/team/unnamed/inject/Binder.java index 0550920..5cc9809 100644 --- a/src/main/java/team/unnamed/inject/Binder.java +++ b/src/main/java/team/unnamed/inject/Binder.java @@ -10,7 +10,6 @@ import team.unnamed.inject.scope.Scope; import team.unnamed.inject.scope.Scopes; -import javax.inject.Provider; import java.lang.annotation.Annotation; import java.util.ArrayList; import java.util.Arrays; diff --git a/src/main/java/team/unnamed/inject/Delegated.java b/src/main/java/team/unnamed/inject/Delegated.java index 270f096..7ee0e7a 100644 --- a/src/main/java/team/unnamed/inject/Delegated.java +++ b/src/main/java/team/unnamed/inject/Delegated.java @@ -1,6 +1,5 @@ package team.unnamed.inject; -import javax.inject.Qualifier; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/src/main/java/team/unnamed/inject/Inject.java b/src/main/java/team/unnamed/inject/Inject.java new file mode 100644 index 0000000..409d166 --- /dev/null +++ b/src/main/java/team/unnamed/inject/Inject.java @@ -0,0 +1,17 @@ +package team.unnamed.inject; + + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.CONSTRUCTOR; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.FIELD; + +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target({METHOD, CONSTRUCTOR, FIELD}) +public @interface Inject { +} diff --git a/src/main/java/team/unnamed/inject/Injector.java b/src/main/java/team/unnamed/inject/Injector.java index c4aec3a..a80090e 100644 --- a/src/main/java/team/unnamed/inject/Injector.java +++ b/src/main/java/team/unnamed/inject/Injector.java @@ -4,7 +4,6 @@ import team.unnamed.inject.impl.InjectorImpl; import team.unnamed.inject.key.TypeReference; -import javax.inject.Provider; import java.util.Arrays; public interface Injector { diff --git a/src/main/java/team/unnamed/inject/Module.java b/src/main/java/team/unnamed/inject/Module.java index fe3a22e..31b1a9b 100644 --- a/src/main/java/team/unnamed/inject/Module.java +++ b/src/main/java/team/unnamed/inject/Module.java @@ -5,7 +5,7 @@ * configuration. A module is usually used to bind abstractions * (interfaces, abstract classes) to implementations (concrete * classes). To just add a scope to a class, you can use scope - * annotations like {@link javax.inject.Singleton}. + * annotations like {@link Singleton}. * You can also use annotations to bind abstractions to implementations * like {@link Targetted} and {@link ProvidedBy}. * @@ -13,7 +13,7 @@ * *

You can also create provider methods (methods used as providers) and * annotate it with {@link Provides}. Annotate the method with - * {@link javax.inject.Inject} if the object creation has dependencies.

+ * {@link Inject} if the object creation has dependencies.

* *

There's an extension for users to create bindings in a pretty way * using {@link AbstractModule}.

diff --git a/src/main/java/team/unnamed/inject/Named.java b/src/main/java/team/unnamed/inject/Named.java new file mode 100644 index 0000000..bd78d7f --- /dev/null +++ b/src/main/java/team/unnamed/inject/Named.java @@ -0,0 +1,14 @@ +package team.unnamed.inject; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Qualifier +@Documented +@Retention(RetentionPolicy.RUNTIME) +public @interface Named { + + String value() default ""; + +} diff --git a/src/main/java/team/unnamed/inject/ProvidedBy.java b/src/main/java/team/unnamed/inject/ProvidedBy.java index c5ce9e4..dcea56c 100644 --- a/src/main/java/team/unnamed/inject/ProvidedBy.java +++ b/src/main/java/team/unnamed/inject/ProvidedBy.java @@ -1,6 +1,5 @@ package team.unnamed.inject; -import javax.inject.Provider; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/src/main/java/team/unnamed/inject/Provider.java b/src/main/java/team/unnamed/inject/Provider.java new file mode 100644 index 0000000..17b1def --- /dev/null +++ b/src/main/java/team/unnamed/inject/Provider.java @@ -0,0 +1,7 @@ +package team.unnamed.inject; + +public interface Provider { + + T get(); + +} diff --git a/src/main/java/team/unnamed/inject/Qualifier.java b/src/main/java/team/unnamed/inject/Qualifier.java new file mode 100644 index 0000000..22d552f --- /dev/null +++ b/src/main/java/team/unnamed/inject/Qualifier.java @@ -0,0 +1,13 @@ +package team.unnamed.inject; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.ANNOTATION_TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface Qualifier { +} diff --git a/src/main/java/team/unnamed/inject/Scope.java b/src/main/java/team/unnamed/inject/Scope.java new file mode 100644 index 0000000..ce86045 --- /dev/null +++ b/src/main/java/team/unnamed/inject/Scope.java @@ -0,0 +1,13 @@ +package team.unnamed.inject; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.ANNOTATION_TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface Scope { +} diff --git a/src/main/java/team/unnamed/inject/Singleton.java b/src/main/java/team/unnamed/inject/Singleton.java new file mode 100644 index 0000000..3d42d7a --- /dev/null +++ b/src/main/java/team/unnamed/inject/Singleton.java @@ -0,0 +1,11 @@ +package team.unnamed.inject; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Scope +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface Singleton { +} diff --git a/src/main/java/team/unnamed/inject/impl/AnnotationScanner.java b/src/main/java/team/unnamed/inject/impl/AnnotationScanner.java index abd12b6..6ed5933 100644 --- a/src/main/java/team/unnamed/inject/impl/AnnotationScanner.java +++ b/src/main/java/team/unnamed/inject/impl/AnnotationScanner.java @@ -1,6 +1,8 @@ package team.unnamed.inject.impl; import team.unnamed.inject.ProvidedBy; +import team.unnamed.inject.Provider; +import team.unnamed.inject.Singleton; import team.unnamed.inject.Targetted; import team.unnamed.inject.key.Key; import team.unnamed.inject.key.TypeReference; @@ -9,8 +11,6 @@ import team.unnamed.inject.scope.Scope; import team.unnamed.inject.scope.Scopes; -import javax.inject.Provider; -import javax.inject.Singleton; import java.lang.reflect.Modifier; /** diff --git a/src/main/java/team/unnamed/inject/impl/Annotations.java b/src/main/java/team/unnamed/inject/impl/Annotations.java index d0ef69d..e499d03 100644 --- a/src/main/java/team/unnamed/inject/impl/Annotations.java +++ b/src/main/java/team/unnamed/inject/impl/Annotations.java @@ -1,8 +1,8 @@ package team.unnamed.inject.impl; +import team.unnamed.inject.Named; import team.unnamed.inject.util.Validate; -import javax.inject.Named; import java.lang.annotation.Annotation; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; diff --git a/src/main/java/team/unnamed/inject/impl/BinderImpl.java b/src/main/java/team/unnamed/inject/impl/BinderImpl.java index 036d7af..49849f9 100644 --- a/src/main/java/team/unnamed/inject/impl/BinderImpl.java +++ b/src/main/java/team/unnamed/inject/impl/BinderImpl.java @@ -2,6 +2,7 @@ import team.unnamed.inject.Binder; import team.unnamed.inject.Module; +import team.unnamed.inject.Provider; import team.unnamed.inject.error.BindingException; import team.unnamed.inject.error.ErrorAttachableImpl; import team.unnamed.inject.key.Key; @@ -13,7 +14,6 @@ import team.unnamed.inject.provision.std.generic.impl.TypeReferenceGenericProvider; import team.unnamed.inject.util.Validate; -import javax.inject.Provider; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/team/unnamed/inject/impl/BindingBuilderImpl.java b/src/main/java/team/unnamed/inject/impl/BindingBuilderImpl.java index 50a711e..ddfeaa1 100644 --- a/src/main/java/team/unnamed/inject/impl/BindingBuilderImpl.java +++ b/src/main/java/team/unnamed/inject/impl/BindingBuilderImpl.java @@ -1,14 +1,13 @@ package team.unnamed.inject.impl; import team.unnamed.inject.Binder; +import team.unnamed.inject.Provider; import team.unnamed.inject.key.Key; import team.unnamed.inject.key.TypeReference; import team.unnamed.inject.provision.Providers; import team.unnamed.inject.scope.Scope; import team.unnamed.inject.util.Validate; -import javax.inject.Provider; - class BindingBuilderImpl implements Binder.QualifiedBindingBuilder, KeyBuilder, T>, diff --git a/src/main/java/team/unnamed/inject/impl/InjectorImpl.java b/src/main/java/team/unnamed/inject/impl/InjectorImpl.java index fc1306b..d1b0624 100644 --- a/src/main/java/team/unnamed/inject/impl/InjectorImpl.java +++ b/src/main/java/team/unnamed/inject/impl/InjectorImpl.java @@ -1,6 +1,7 @@ package team.unnamed.inject.impl; import team.unnamed.inject.Injector; +import team.unnamed.inject.Provider; import team.unnamed.inject.error.InjectionException; import team.unnamed.inject.key.InjectedKey; import team.unnamed.inject.key.Key; @@ -11,7 +12,6 @@ import team.unnamed.inject.resolve.solution.InjectableMember; import team.unnamed.inject.util.Validate; -import javax.inject.Provider; import java.util.List; public class InjectorImpl implements Injector { diff --git a/src/main/java/team/unnamed/inject/impl/LinkedBuilder.java b/src/main/java/team/unnamed/inject/impl/LinkedBuilder.java index 3324c16..7580454 100644 --- a/src/main/java/team/unnamed/inject/impl/LinkedBuilder.java +++ b/src/main/java/team/unnamed/inject/impl/LinkedBuilder.java @@ -1,6 +1,7 @@ package team.unnamed.inject.impl; import team.unnamed.inject.Binder; +import team.unnamed.inject.Provider; import team.unnamed.inject.assisted.ValueFactory; import team.unnamed.inject.assisted.provision.ToFactoryProvider; import team.unnamed.inject.key.Key; @@ -10,8 +11,6 @@ import team.unnamed.inject.provision.std.generic.ToGenericProvider; import team.unnamed.inject.util.Validate; -import javax.inject.Provider; - public interface LinkedBuilder extends Binder.Linked { Key key(); diff --git a/src/main/java/team/unnamed/inject/key/Key.java b/src/main/java/team/unnamed/inject/key/Key.java index 54cf036..fbbb594 100644 --- a/src/main/java/team/unnamed/inject/key/Key.java +++ b/src/main/java/team/unnamed/inject/key/Key.java @@ -1,10 +1,10 @@ package team.unnamed.inject.key; +import team.unnamed.inject.Qualifier; import team.unnamed.inject.key.Types.CompositeType; import team.unnamed.inject.util.ElementFormatter; import team.unnamed.inject.util.Validate; -import javax.inject.Qualifier; import java.io.Serializable; import java.lang.annotation.Annotation; import java.util.Objects; @@ -169,7 +169,7 @@ public int hashCode() { * marked with @Marker * * - * If a class name starts with {@code java} or {@code javax}, + * If a class name starts with {@code java}, * it isn't used, the used name is now {@link Class#getSimpleName()} * * @return The key information as string diff --git a/src/main/java/team/unnamed/inject/multibinding/CollectionBoundProvider.java b/src/main/java/team/unnamed/inject/multibinding/CollectionBoundProvider.java index b2ae849..a39a4f9 100644 --- a/src/main/java/team/unnamed/inject/multibinding/CollectionBoundProvider.java +++ b/src/main/java/team/unnamed/inject/multibinding/CollectionBoundProvider.java @@ -1,12 +1,12 @@ package team.unnamed.inject.multibinding; +import team.unnamed.inject.Provider; import team.unnamed.inject.impl.InjectorImpl; import team.unnamed.inject.impl.ProvisionStack; import team.unnamed.inject.key.Key; import team.unnamed.inject.key.TypeReference; import team.unnamed.inject.provision.StdProvider; -import javax.inject.Provider; import java.util.Collection; import java.util.Collections; diff --git a/src/main/java/team/unnamed/inject/multibinding/CollectionMultiBindingBuilderImpl.java b/src/main/java/team/unnamed/inject/multibinding/CollectionMultiBindingBuilderImpl.java index ea9b37c..2bd64dc 100644 --- a/src/main/java/team/unnamed/inject/multibinding/CollectionMultiBindingBuilderImpl.java +++ b/src/main/java/team/unnamed/inject/multibinding/CollectionMultiBindingBuilderImpl.java @@ -1,6 +1,7 @@ package team.unnamed.inject.multibinding; import team.unnamed.inject.Binder; +import team.unnamed.inject.Provider; import team.unnamed.inject.impl.BinderImpl; import team.unnamed.inject.impl.LinkedBuilder; import team.unnamed.inject.key.Key; @@ -9,7 +10,6 @@ import team.unnamed.inject.scope.Scope; import team.unnamed.inject.util.Validate; -import javax.inject.Provider; import java.util.Collection; /** diff --git a/src/main/java/team/unnamed/inject/multibinding/MapBoundProvider.java b/src/main/java/team/unnamed/inject/multibinding/MapBoundProvider.java index c352342..877dc11 100644 --- a/src/main/java/team/unnamed/inject/multibinding/MapBoundProvider.java +++ b/src/main/java/team/unnamed/inject/multibinding/MapBoundProvider.java @@ -1,11 +1,11 @@ package team.unnamed.inject.multibinding; +import team.unnamed.inject.Provider; import team.unnamed.inject.impl.InjectorImpl; import team.unnamed.inject.impl.ProvisionStack; import team.unnamed.inject.provision.Providers; import team.unnamed.inject.provision.StdProvider; -import javax.inject.Provider; import java.util.Collections; import java.util.Map; diff --git a/src/main/java/team/unnamed/inject/multibinding/MapMultiBindingBuilderImpl.java b/src/main/java/team/unnamed/inject/multibinding/MapMultiBindingBuilderImpl.java index 39d7bf2..12ee644 100644 --- a/src/main/java/team/unnamed/inject/multibinding/MapMultiBindingBuilderImpl.java +++ b/src/main/java/team/unnamed/inject/multibinding/MapMultiBindingBuilderImpl.java @@ -1,6 +1,7 @@ package team.unnamed.inject.multibinding; import team.unnamed.inject.Binder; +import team.unnamed.inject.Provider; import team.unnamed.inject.impl.BinderImpl; import team.unnamed.inject.impl.LinkedBuilder; import team.unnamed.inject.key.Key; @@ -9,7 +10,6 @@ import team.unnamed.inject.scope.Scope; import team.unnamed.inject.util.Validate; -import javax.inject.Provider; import java.util.Map; class MapMultiBindingBuilderImpl implements Binder.MapMultiBindingBuilder { diff --git a/src/main/java/team/unnamed/inject/provision/DelegatingStdProvider.java b/src/main/java/team/unnamed/inject/provision/DelegatingStdProvider.java index 2426afb..c5244aa 100644 --- a/src/main/java/team/unnamed/inject/provision/DelegatingStdProvider.java +++ b/src/main/java/team/unnamed/inject/provision/DelegatingStdProvider.java @@ -1,5 +1,6 @@ package team.unnamed.inject.provision; +import team.unnamed.inject.Provider; import team.unnamed.inject.impl.BinderImpl; import team.unnamed.inject.impl.InjectorImpl; import team.unnamed.inject.impl.ProvisionStack; @@ -7,7 +8,6 @@ import team.unnamed.inject.scope.Scope; import team.unnamed.inject.util.Validate; -import javax.inject.Provider; import java.util.Objects; /** diff --git a/src/main/java/team/unnamed/inject/provision/Providers.java b/src/main/java/team/unnamed/inject/provision/Providers.java index ca4a83f..468009c 100644 --- a/src/main/java/team/unnamed/inject/provision/Providers.java +++ b/src/main/java/team/unnamed/inject/provision/Providers.java @@ -1,5 +1,6 @@ package team.unnamed.inject.provision; +import team.unnamed.inject.Provider; import team.unnamed.inject.impl.InjectorImpl; import team.unnamed.inject.impl.ProvisionStack; import team.unnamed.inject.key.Key; @@ -10,8 +11,6 @@ import team.unnamed.inject.provision.std.ScopedProvider; import team.unnamed.inject.util.Validate; -import javax.inject.Provider; - /** * Collection of static factory methods to create providers */ diff --git a/src/main/java/team/unnamed/inject/provision/StdProvider.java b/src/main/java/team/unnamed/inject/provision/StdProvider.java index c62140f..73466de 100644 --- a/src/main/java/team/unnamed/inject/provision/StdProvider.java +++ b/src/main/java/team/unnamed/inject/provision/StdProvider.java @@ -1,5 +1,6 @@ package team.unnamed.inject.provision; +import team.unnamed.inject.Provider; import team.unnamed.inject.assisted.provision.ToFactoryProvider; import team.unnamed.inject.impl.BinderImpl; import team.unnamed.inject.impl.InjectorImpl; @@ -8,8 +9,6 @@ import team.unnamed.inject.provision.std.ScopedProvider; import team.unnamed.inject.scope.Scope; -import javax.inject.Provider; - public abstract class StdProvider implements Provider { protected boolean injected; // TODO: Make this atomic diff --git a/src/main/java/team/unnamed/inject/provision/std/InstanceProvider.java b/src/main/java/team/unnamed/inject/provision/std/InstanceProvider.java index 39f4b52..2d232eb 100644 --- a/src/main/java/team/unnamed/inject/provision/std/InstanceProvider.java +++ b/src/main/java/team/unnamed/inject/provision/std/InstanceProvider.java @@ -1,12 +1,11 @@ package team.unnamed.inject.provision.std; +import team.unnamed.inject.Provider; import team.unnamed.inject.key.Key; import team.unnamed.inject.provision.StdProvider; import team.unnamed.inject.scope.Scope; import team.unnamed.inject.scope.Scopes; -import javax.inject.Provider; - /** * Represents an instance binding. The key is bound to a * specific instance. For example: diff --git a/src/main/java/team/unnamed/inject/provision/std/MethodAsProvider.java b/src/main/java/team/unnamed/inject/provision/std/MethodAsProvider.java index ec29f6f..151200f 100644 --- a/src/main/java/team/unnamed/inject/provision/std/MethodAsProvider.java +++ b/src/main/java/team/unnamed/inject/provision/std/MethodAsProvider.java @@ -1,5 +1,6 @@ package team.unnamed.inject.provision.std; +import team.unnamed.inject.Provider; import team.unnamed.inject.Provides; import team.unnamed.inject.error.BindingException; import team.unnamed.inject.error.ErrorAttachable; @@ -13,7 +14,6 @@ import team.unnamed.inject.scope.Scope; import team.unnamed.inject.scope.Scopes; -import javax.inject.Provider; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/team/unnamed/inject/provision/std/ProviderTypeProvider.java b/src/main/java/team/unnamed/inject/provision/std/ProviderTypeProvider.java index bf8a47c..78014e3 100644 --- a/src/main/java/team/unnamed/inject/provision/std/ProviderTypeProvider.java +++ b/src/main/java/team/unnamed/inject/provision/std/ProviderTypeProvider.java @@ -1,13 +1,12 @@ package team.unnamed.inject.provision.std; import team.unnamed.inject.Injector; +import team.unnamed.inject.Provider; import team.unnamed.inject.impl.InjectorImpl; import team.unnamed.inject.impl.ProvisionStack; import team.unnamed.inject.key.TypeReference; import team.unnamed.inject.provision.StdProvider; -import javax.inject.Provider; - /** * Represents a provider that gets instantiated the first * time that gets called, then the instance is saved. diff --git a/src/main/java/team/unnamed/inject/provision/std/ScopedProvider.java b/src/main/java/team/unnamed/inject/provision/std/ScopedProvider.java index 1ee72db..5981b32 100644 --- a/src/main/java/team/unnamed/inject/provision/std/ScopedProvider.java +++ b/src/main/java/team/unnamed/inject/provision/std/ScopedProvider.java @@ -1,5 +1,6 @@ package team.unnamed.inject.provision.std; +import team.unnamed.inject.Provider; import team.unnamed.inject.impl.InjectorImpl; import team.unnamed.inject.impl.ProvisionStack; import team.unnamed.inject.key.Key; @@ -8,8 +9,6 @@ import team.unnamed.inject.scope.Scope; import team.unnamed.inject.util.Validate; -import javax.inject.Provider; - /** * It's a provider wrapped. Maintains the * unscoped provider, the scoped provider diff --git a/src/main/java/team/unnamed/inject/provision/std/generic/GenericProvider.java b/src/main/java/team/unnamed/inject/provision/std/generic/GenericProvider.java index e8032c5..0c92b11 100644 --- a/src/main/java/team/unnamed/inject/provision/std/generic/GenericProvider.java +++ b/src/main/java/team/unnamed/inject/provision/std/generic/GenericProvider.java @@ -1,9 +1,8 @@ package team.unnamed.inject.provision.std.generic; +import team.unnamed.inject.Provider; import team.unnamed.inject.key.Key; -import javax.inject.Provider; - /** * It's (indirectly) a {@link Provider} for not-bound * parameterized types diff --git a/src/main/java/team/unnamed/inject/provision/std/generic/ToGenericProvider.java b/src/main/java/team/unnamed/inject/provision/std/generic/ToGenericProvider.java index 21bd0be..7382934 100644 --- a/src/main/java/team/unnamed/inject/provision/std/generic/ToGenericProvider.java +++ b/src/main/java/team/unnamed/inject/provision/std/generic/ToGenericProvider.java @@ -1,5 +1,6 @@ package team.unnamed.inject.provision.std.generic; +import team.unnamed.inject.Provider; import team.unnamed.inject.impl.BinderImpl; import team.unnamed.inject.impl.InjectorImpl; import team.unnamed.inject.impl.ProvisionStack; @@ -9,8 +10,6 @@ import team.unnamed.inject.scope.Scope; import team.unnamed.inject.util.Validate; -import javax.inject.Provider; - public class ToGenericProvider extends ScopedProvider implements Provider { diff --git a/src/main/java/team/unnamed/inject/resolve/ConstructorResolver.java b/src/main/java/team/unnamed/inject/resolve/ConstructorResolver.java index 0ca27be..a2104d0 100644 --- a/src/main/java/team/unnamed/inject/resolve/ConstructorResolver.java +++ b/src/main/java/team/unnamed/inject/resolve/ConstructorResolver.java @@ -1,10 +1,10 @@ package team.unnamed.inject.resolve; +import team.unnamed.inject.Inject; import team.unnamed.inject.error.ErrorAttachable; import team.unnamed.inject.key.TypeReference; import team.unnamed.inject.resolve.solution.InjectableConstructor; -import javax.inject.Inject; import java.lang.annotation.Annotation; import java.lang.reflect.Constructor; diff --git a/src/main/java/team/unnamed/inject/resolve/FieldResolver.java b/src/main/java/team/unnamed/inject/resolve/FieldResolver.java index 3aa2377..fb1e038 100644 --- a/src/main/java/team/unnamed/inject/resolve/FieldResolver.java +++ b/src/main/java/team/unnamed/inject/resolve/FieldResolver.java @@ -1,12 +1,12 @@ package team.unnamed.inject.resolve; +import team.unnamed.inject.Inject; import team.unnamed.inject.InjectAll; import team.unnamed.inject.InjectIgnore; import team.unnamed.inject.key.InjectedKey; import team.unnamed.inject.key.TypeReference; import team.unnamed.inject.resolve.solution.InjectableField; -import javax.inject.Inject; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; @@ -52,7 +52,7 @@ public List resolve(TypeReference type) { ) { // iterate all fields, including private fields // exclude fields that aren't annotated with - // javax.inject.Inject + // team.unnamed.inject.Inject boolean injectAll = checking.isAnnotationPresent(InjectAll.class); for (Field field : checking.getDeclaredFields()) { if (injectAll) { diff --git a/src/main/java/team/unnamed/inject/resolve/KeyResolver.java b/src/main/java/team/unnamed/inject/resolve/KeyResolver.java index fc37021..23050c5 100644 --- a/src/main/java/team/unnamed/inject/resolve/KeyResolver.java +++ b/src/main/java/team/unnamed/inject/resolve/KeyResolver.java @@ -1,12 +1,12 @@ package team.unnamed.inject.resolve; +import team.unnamed.inject.Qualifier; import team.unnamed.inject.assisted.Assist; import team.unnamed.inject.impl.Annotations; import team.unnamed.inject.key.InjectedKey; import team.unnamed.inject.key.Key; import team.unnamed.inject.key.TypeReference; -import javax.inject.Qualifier; import java.lang.annotation.Annotation; import java.lang.reflect.Parameter; import java.lang.reflect.Type; diff --git a/src/main/java/team/unnamed/inject/resolve/MethodResolver.java b/src/main/java/team/unnamed/inject/resolve/MethodResolver.java index 4805057..d6bc07c 100644 --- a/src/main/java/team/unnamed/inject/resolve/MethodResolver.java +++ b/src/main/java/team/unnamed/inject/resolve/MethodResolver.java @@ -1,9 +1,9 @@ package team.unnamed.inject.resolve; +import team.unnamed.inject.Inject; import team.unnamed.inject.key.TypeReference; import team.unnamed.inject.resolve.solution.InjectableMethod; -import javax.inject.Inject; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.ArrayList; @@ -58,7 +58,7 @@ public List resolve( ) { // Iterate all methods, including private methods // exclude methods that aren't annotated with - // javax.inject.Inject and add to the methods list, + // @Inject and add to the methods list, // not to the members list for (Method method : checking.getDeclaredMethods()) { if (!method.isAnnotationPresent(annotation)) { diff --git a/src/main/java/team/unnamed/inject/resolve/solution/InjectableConstructor.java b/src/main/java/team/unnamed/inject/resolve/solution/InjectableConstructor.java index 4138eb5..9664318 100644 --- a/src/main/java/team/unnamed/inject/resolve/solution/InjectableConstructor.java +++ b/src/main/java/team/unnamed/inject/resolve/solution/InjectableConstructor.java @@ -14,7 +14,7 @@ /** * Represents an injectable constructor, a constructor - * annotated with {@link javax.inject.Inject} or a + * annotated with {@link team.unnamed.inject.Inject} or a * constructor with no parameters. */ public class InjectableConstructor implements InjectableMember { diff --git a/src/main/java/team/unnamed/inject/resolve/solution/InjectableField.java b/src/main/java/team/unnamed/inject/resolve/solution/InjectableField.java index a4e15b7..f7183ae 100644 --- a/src/main/java/team/unnamed/inject/resolve/solution/InjectableField.java +++ b/src/main/java/team/unnamed/inject/resolve/solution/InjectableField.java @@ -12,7 +12,7 @@ import java.util.Objects; /** - * Represents a Field annotated with {@link javax.inject.Inject} + * Represents a Field annotated with {@link team.unnamed.inject.Inject} * and that already has resolved a key, with its requirement level * defined too. */ diff --git a/src/main/java/team/unnamed/inject/resolve/solution/InjectableMethod.java b/src/main/java/team/unnamed/inject/resolve/solution/InjectableMethod.java index c86cabe..98c56f6 100644 --- a/src/main/java/team/unnamed/inject/resolve/solution/InjectableMethod.java +++ b/src/main/java/team/unnamed/inject/resolve/solution/InjectableMethod.java @@ -1,5 +1,6 @@ package team.unnamed.inject.resolve.solution; +import team.unnamed.inject.Inject; import team.unnamed.inject.impl.InjectorImpl; import team.unnamed.inject.impl.ProvisionStack; import team.unnamed.inject.key.InjectedKey; @@ -14,7 +15,7 @@ import java.util.List; /** - * Represents a Method annotated with {@link javax.inject.Inject} + * Represents a Method annotated with {@link Inject} * and that already has resolved its parameter keys, with its * requirement level defined too. */ diff --git a/src/main/java/team/unnamed/inject/scope/LazySingletonScope.java b/src/main/java/team/unnamed/inject/scope/LazySingletonScope.java index d4dee58..c1e5a95 100644 --- a/src/main/java/team/unnamed/inject/scope/LazySingletonScope.java +++ b/src/main/java/team/unnamed/inject/scope/LazySingletonScope.java @@ -1,8 +1,8 @@ package team.unnamed.inject.scope; +import team.unnamed.inject.Provider; import team.unnamed.inject.provision.StdProvider; -import javax.inject.Provider; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; diff --git a/src/main/java/team/unnamed/inject/scope/Scope.java b/src/main/java/team/unnamed/inject/scope/Scope.java index 0b6d982..b964f31 100644 --- a/src/main/java/team/unnamed/inject/scope/Scope.java +++ b/src/main/java/team/unnamed/inject/scope/Scope.java @@ -1,6 +1,6 @@ package team.unnamed.inject.scope; -import javax.inject.Provider; +import team.unnamed.inject.Provider; /** * Wraps providers diff --git a/src/main/java/team/unnamed/inject/scope/ScopeScanner.java b/src/main/java/team/unnamed/inject/scope/ScopeScanner.java index e2a5c28..ee1a4d2 100644 --- a/src/main/java/team/unnamed/inject/scope/ScopeScanner.java +++ b/src/main/java/team/unnamed/inject/scope/ScopeScanner.java @@ -1,8 +1,8 @@ package team.unnamed.inject.scope; +import team.unnamed.inject.Singleton; import team.unnamed.inject.util.Validate; -import javax.inject.Singleton; import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; import java.util.HashMap; @@ -27,7 +27,7 @@ public final class ScopeScanner { * *

Note that this method doesn't require * the {@code annotationType} to be annotated - * with {@link javax.inject.Scope}

+ * with {@link team.unnamed.inject.Scope}

*/ public void bind(Class annotationType, Scope scope) { Validate.notNull(annotationType, "annotationType"); diff --git a/src/main/java/team/unnamed/inject/scope/Scopes.java b/src/main/java/team/unnamed/inject/scope/Scopes.java index a405442..f9bf515 100644 --- a/src/main/java/team/unnamed/inject/scope/Scopes.java +++ b/src/main/java/team/unnamed/inject/scope/Scopes.java @@ -1,6 +1,6 @@ package team.unnamed.inject.scope; -import javax.inject.Provider; +import team.unnamed.inject.Provider; /** * Collection of built-in scopes diff --git a/src/test/java/team/unnamed/inject/AssistedInjectTest.java b/src/test/java/team/unnamed/inject/AssistedInjectTest.java index 6081c60..2ce82a0 100644 --- a/src/test/java/team/unnamed/inject/AssistedInjectTest.java +++ b/src/test/java/team/unnamed/inject/AssistedInjectTest.java @@ -7,8 +7,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import javax.inject.Inject; - public class AssistedInjectTest { @Test diff --git a/src/test/java/team/unnamed/inject/ComplexTypeVariableResolutionTest.java b/src/test/java/team/unnamed/inject/ComplexTypeVariableResolutionTest.java index e890981..446be51 100644 --- a/src/test/java/team/unnamed/inject/ComplexTypeVariableResolutionTest.java +++ b/src/test/java/team/unnamed/inject/ComplexTypeVariableResolutionTest.java @@ -4,8 +4,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import javax.inject.Inject; - // test for issue reported by pixeldev (github.com/pixeldev) public class ComplexTypeVariableResolutionTest { diff --git a/src/test/java/team/unnamed/inject/ConstructorInjectionTest.java b/src/test/java/team/unnamed/inject/ConstructorInjectionTest.java index 59ec513..78c2163 100644 --- a/src/test/java/team/unnamed/inject/ConstructorInjectionTest.java +++ b/src/test/java/team/unnamed/inject/ConstructorInjectionTest.java @@ -3,8 +3,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import javax.inject.Inject; - public class ConstructorInjectionTest { @Test diff --git a/src/test/java/team/unnamed/inject/CyclicInjectionTest.java b/src/test/java/team/unnamed/inject/CyclicInjectionTest.java index 1a76df5..37720bd 100644 --- a/src/test/java/team/unnamed/inject/CyclicInjectionTest.java +++ b/src/test/java/team/unnamed/inject/CyclicInjectionTest.java @@ -3,8 +3,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import javax.inject.Inject; - public class CyclicInjectionTest { @Test diff --git a/src/test/java/team/unnamed/inject/GenericInjectionTest.java b/src/test/java/team/unnamed/inject/GenericInjectionTest.java index 19f3c05..8ad5145 100644 --- a/src/test/java/team/unnamed/inject/GenericInjectionTest.java +++ b/src/test/java/team/unnamed/inject/GenericInjectionTest.java @@ -4,8 +4,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import javax.inject.Inject; - public class GenericInjectionTest { @Test diff --git a/src/test/java/team/unnamed/inject/InjectAllTest.java b/src/test/java/team/unnamed/inject/InjectAllTest.java index a6954e2..7781ca7 100644 --- a/src/test/java/team/unnamed/inject/InjectAllTest.java +++ b/src/test/java/team/unnamed/inject/InjectAllTest.java @@ -3,8 +3,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import javax.inject.Named; - public class InjectAllTest { @Test diff --git a/src/test/java/team/unnamed/inject/ManyProvidersInjectionTest.java b/src/test/java/team/unnamed/inject/ManyProvidersInjectionTest.java index 0d6dfce..c5c6e57 100644 --- a/src/test/java/team/unnamed/inject/ManyProvidersInjectionTest.java +++ b/src/test/java/team/unnamed/inject/ManyProvidersInjectionTest.java @@ -3,9 +3,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import javax.inject.Inject; -import javax.inject.Provider; - public class ManyProvidersInjectionTest { @Inject diff --git a/src/test/java/team/unnamed/inject/MultiBindTest.java b/src/test/java/team/unnamed/inject/MultiBindTest.java index 413c218..ab035b3 100644 --- a/src/test/java/team/unnamed/inject/MultiBindTest.java +++ b/src/test/java/team/unnamed/inject/MultiBindTest.java @@ -3,8 +3,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import javax.inject.Inject; -import javax.inject.Named; import java.util.List; import java.util.Map; import java.util.UUID; diff --git a/src/test/java/team/unnamed/inject/ProviderMethodsTest.java b/src/test/java/team/unnamed/inject/ProviderMethodsTest.java index ba791b5..68d9a85 100644 --- a/src/test/java/team/unnamed/inject/ProviderMethodsTest.java +++ b/src/test/java/team/unnamed/inject/ProviderMethodsTest.java @@ -3,9 +3,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; import java.util.UUID; public class ProviderMethodsTest { diff --git a/src/test/java/team/unnamed/inject/ProviderTest.java b/src/test/java/team/unnamed/inject/ProviderTest.java index 0fa3b87..f467174 100644 --- a/src/test/java/team/unnamed/inject/ProviderTest.java +++ b/src/test/java/team/unnamed/inject/ProviderTest.java @@ -4,9 +4,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import javax.inject.Inject; -import javax.inject.Provider; - public class ProviderTest { @Inject diff --git a/src/test/java/team/unnamed/inject/QualifiedAssistedInjectTest.java b/src/test/java/team/unnamed/inject/QualifiedAssistedInjectTest.java index 3778326..c1ae918 100644 --- a/src/test/java/team/unnamed/inject/QualifiedAssistedInjectTest.java +++ b/src/test/java/team/unnamed/inject/QualifiedAssistedInjectTest.java @@ -6,9 +6,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import javax.inject.Inject; -import javax.inject.Named; - public class QualifiedAssistedInjectTest { @Test diff --git a/src/test/java/team/unnamed/inject/QualifiedBindingTest.java b/src/test/java/team/unnamed/inject/QualifiedBindingTest.java index 32035dc..8bed2d5 100644 --- a/src/test/java/team/unnamed/inject/QualifiedBindingTest.java +++ b/src/test/java/team/unnamed/inject/QualifiedBindingTest.java @@ -3,9 +3,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import javax.inject.Inject; -import javax.inject.Named; - public class QualifiedBindingTest { @Test diff --git a/src/test/java/team/unnamed/inject/SingletonBindingTest.java b/src/test/java/team/unnamed/inject/SingletonBindingTest.java index 5018012..e4f1d13 100644 --- a/src/test/java/team/unnamed/inject/SingletonBindingTest.java +++ b/src/test/java/team/unnamed/inject/SingletonBindingTest.java @@ -3,7 +3,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import javax.inject.Inject; import java.util.UUID; public class SingletonBindingTest { diff --git a/src/test/java/team/unnamed/inject/StaticInjectionTest.java b/src/test/java/team/unnamed/inject/StaticInjectionTest.java index 60bfaac..2815607 100644 --- a/src/test/java/team/unnamed/inject/StaticInjectionTest.java +++ b/src/test/java/team/unnamed/inject/StaticInjectionTest.java @@ -3,8 +3,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import javax.inject.Inject; - public class StaticInjectionTest { @Test diff --git a/src/test/java/team/unnamed/inject/ToGenericProviderTest.java b/src/test/java/team/unnamed/inject/ToGenericProviderTest.java index 0c0a23e..b9f7643 100644 --- a/src/test/java/team/unnamed/inject/ToGenericProviderTest.java +++ b/src/test/java/team/unnamed/inject/ToGenericProviderTest.java @@ -5,7 +5,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import javax.inject.Inject; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; diff --git a/src/test/java/team/unnamed/inject/explore/ProxiedFactoryProviderExploreTest.java b/src/test/java/team/unnamed/inject/explore/ProxiedFactoryProviderExploreTest.java index 001519e..71a0001 100644 --- a/src/test/java/team/unnamed/inject/explore/ProxiedFactoryProviderExploreTest.java +++ b/src/test/java/team/unnamed/inject/explore/ProxiedFactoryProviderExploreTest.java @@ -1,6 +1,7 @@ package team.unnamed.inject.explore; import team.unnamed.inject.Injector; +import team.unnamed.inject.Provider; import team.unnamed.inject.assisted.Assist; import team.unnamed.inject.assisted.Assisted; import team.unnamed.inject.assisted.ValueFactory; @@ -9,8 +10,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import javax.inject.Provider; - public class ProxiedFactoryProviderExploreTest { @Test