Skip to content

Commit

Permalink
has an injectable constructor that is not public. Please ensure const…
Browse files Browse the repository at this point in the history
…ructor is annotated with @activate.
  • Loading branch information
EverettHanke committed Nov 12, 2024
1 parent c08a305 commit b5cf2dd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,21 +241,29 @@ public boolean visit(TypeDeclaration type) {
|| (noDefaultConstructor = !(hasDefaultConstructor(type)
|| (hasInjectableConstructor = hasInjectableConstructor(type, problemReporter))))) {
// interfaces, abstract types, non-static/non-public nested types, or types with no default constructor cannot be components
if (!errorLevel.isIgnore()) {
if (isInterface) {
if (!errorLevel.isIgnore())
{
if (isInterface)
{
problemReporter.reportProblem(annotation, null, NLS.bind(Messages.AnnotationProcessor_invalidCompImplClass_interface, type.getName().getIdentifier()), type.getName().getIdentifier());
} else if (isAbstract) {
} else if (isAbstract)
{
problemReporter.reportProblem(annotation, null, NLS.bind(Messages.AnnotationProcessor_invalidCompImplClass_abstract, type.getName().getIdentifier()), type.getName().getIdentifier());
} else if (isNested) {
} else if (isNested)
{
problemReporter.reportProblem(annotation, null, NLS.bind(Messages.AnnotationProcessor_invalidCompImplClass_notTopLevel, type.getName().getIdentifier()), type.getName().getIdentifier());
} else if (noDefaultConstructor) {
if (specVersion.isEqualOrHigherThan(DSAnnotationVersion.V1_4)) {
} else if (noDefaultConstructor)
{
if (specVersion.isEqualOrHigherThan(DSAnnotationVersion.V1_4))
{
problemReporter.reportProblem(annotation, null,
NLS.bind(Messages.AnnotationProcessor_invalidCompImplClass_compatibleConstructor,
type.getName().getIdentifier()),
type.getName().getIdentifier());
} else {
if (hasInjectableConstructor) {
} else
{
if (hasInjectableConstructor)
{
// TODO we should add an error marker that offers a quickfix to upgrade the spec
// version to 1.4
problemReporter.reportProblem(annotation, null,
Expand All @@ -269,7 +277,9 @@ public boolean visit(TypeDeclaration type) {
type.getName().getIdentifier()),
type.getName().getIdentifier());
}
} else {
}
else
{
problemReporter.reportProblem(annotation, null, NLS.bind(Messages.AnnotationProcessor_invalidComponentImplementationClass, type.getName().getIdentifier()), type.getName().getIdentifier());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ AnnotationProcessor_invalidCompImplClass_annotation=Invalid component implementa
AnnotationProcessor_invalidCompImplClass_enumeration=Invalid component implementation class ''{0}'': enumeration type.
AnnotationProcessor_invalidCompImplClass_interface=Invalid component implementation class ''{0}'': interface type.
AnnotationProcessor_invalidCompImplClass_noDefaultConstructor=Invalid component implementation class ''{0}'': no default constructor.
AnnotationProcessor_invalidCompImplClass_injectableConstructor=Invalid component implementation class ''{0}'': injectable constructor.
AnnotationProcessor_invalidCompImplClass_injectableConstructor=Invalid component implementation class ''{0}'': has an injectable constructor that is not public. Please ensure constructor is annotated with @activate.
AnnotationProcessor_invalidCompImplClass_compatibleConstructor=Invalid component implementation class ''{0}'': no default or @Activate annotated constructor.
AnnotationProcessor_invalidCompImplClass_notPublic=Invalid component implementation class ''{0}'': not a public class.
AnnotationProcessor_invalidCompImplClass_notTopLevel=Invalid component implementation class ''{0}'': not a primary class or static class nested in primary type.
Expand Down

0 comments on commit b5cf2dd

Please sign in to comment.