diff --git a/biz.aQute.bndlib.tests/test/test/component/DSAnnotationTest.java b/biz.aQute.bndlib.tests/test/test/component/DSAnnotationTest.java index 02b2480f65..5f40904763 100644 --- a/biz.aQute.bndlib.tests/test/test/component/DSAnnotationTest.java +++ b/biz.aQute.bndlib.tests/test/test/component/DSAnnotationTest.java @@ -4586,7 +4586,7 @@ public void testConstructorInjectionErrorOnMissingDefaultNoArgConstructor() thro // expect error because class has no noArg constructor and if (!b.check( Pattern.quote( - "test.component.DSAnnotationTest$ConstructorInjectionMissingDefaultNoArgConstructor] The DS component class test.component.DSAnnotationTest$ConstructorInjectionMissingDefaultNoArgConstructor must declare a public no-arg constructor, or a public constructor annotated with @Activate."))) + "test.component.DSAnnotationTest$ConstructorInjectionMissingDefaultNoArgConstructor] The DS component class test.component.DSAnnotationTest$ConstructorInjectionMissingDefaultNoArgConstructor must be publicly accessible and have either a public no-arg constructor or a public constructor annotated with @Activate. Non-public classes, including public inner classes enclosed in non-public classes, are not supported."))) fail(); } } @@ -4605,7 +4605,7 @@ public void testConstructorInjectionErrorOnNonStaticInnerClassComponent() throws // cannot be instantiated if (!b.check( Pattern.quote( - "The DS component class test.component.constructorinjection.ConstructorInjectionErrorOnNonStaticInnerClassComponent$ConstructorInjectionErrorOnNonStaticInnerClassComponentInner must declare a public no-arg constructor, or a public constructor annotated with @Activate"))) + "The DS component class test.component.constructorinjection.ConstructorInjectionErrorOnNonStaticInnerClassComponent$ConstructorInjectionErrorOnNonStaticInnerClassComponentInner must be publicly accessible and have either a public no-arg constructor or a public constructor annotated with @Activate. Non-public classes, including public inner classes enclosed in non-public classes, are not supported."))) fail(); } } diff --git a/biz.aQute.bndlib/src/aQute/bnd/component/DSAnnotationReader.java b/biz.aQute.bndlib/src/aQute/bnd/component/DSAnnotationReader.java index 77922de2b6..38e1f683be 100644 --- a/biz.aQute.bndlib/src/aQute/bnd/component/DSAnnotationReader.java +++ b/biz.aQute.bndlib/src/aQute/bnd/component/DSAnnotationReader.java @@ -183,7 +183,7 @@ private ComponentDef getDef() throws Exception { DeclarativeServicesAnnotationError details = new DeclarativeServicesAnnotationError( implementationClass.getFQN(), null, null, ErrorType.INVALID_COMPONENT_TYPE); details.addError(analyzer, - "[%s] The DS component class %s must declare a public no-arg constructor, or a public constructor annotated with @Activate.", + "[%s] The DS component class %s must be publicly accessible and have either a public no-arg constructor or a public constructor annotated with @Activate. Non-public classes, including public inner classes enclosed in non-public classes, are not supported.", details.location(), implementationClass.getFQN()); } diff --git a/docs/_chapters/200-components.md b/docs/_chapters/200-components.md index b32737eb3f..7a0b79dda3 100644 --- a/docs/_chapters/200-components.md +++ b/docs/_chapters/200-components.md @@ -59,7 +59,7 @@ A DS component class must have **either**: If your component class has a constructor with parameters but no `@Activate` annotation, bnd will generate an error: ``` -The DS component class {className} must declare a public no-arg constructor, or a public constructor annotated with @Activate. +The DS component class {className} must be publicly accessible and have either a public no-arg constructor or a public constructor annotated with @Activate. Non-public classes, including public inner classes enclosed in non-public classes, are not supported. ``` **Examples of valid components:** diff --git a/docs/_chapters/920-faq.md b/docs/_chapters/920-faq.md index c2afe74a49..e8c30b9b18 100644 --- a/docs/_chapters/920-faq.md +++ b/docs/_chapters/920-faq.md @@ -125,7 +125,7 @@ Starting with bnd 7.3.0, bnd enforces the DS specification requirement that comp If you see this error: ``` -The DS component class {className} must declare a public no-arg constructor, or a public constructor annotated with @Activate. +The DS component class {className} must be publicly accessible and have either a public no-arg constructor or a public constructor annotated with @Activate. Non-public classes, including public inner classes enclosed in non-public classes, are not supported. ``` You need to either add a public no-arg constructor, use `@Activate` on your constructor, ensure your class is public, or make inner classes static.