Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[scr 1.4] constructor for injection must be public #1218 Pull Request #1474

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -241,30 +241,45 @@ 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,
NLS.bind(
Messages.AnnotationProcessor_invalidCompImplClass_injectableConstructor,
type.getName().getIdentifier()),
type.getName().getIdentifier());
}
problemReporter.reportProblem(annotation, null,
NLS.bind(Messages.AnnotationProcessor_invalidCompImplClass_noDefaultConstructor,
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 @@ -47,6 +47,8 @@ public class Messages extends NLS {

public static String AnnotationProcessor_invalidCompImplClass_noDefaultConstructor;

public static String AnnotationProcessor_invalidCompImplClass_injectableConstructor;

public static String AnnotationProcessor_invalidCompImplClass_notPublic;

public static String AnnotationProcessor_invalidCompImplClass_notTopLevel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +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}'': 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
Loading