FELIX-4033 : Issue warning messages for redundant SCR annotation combinations
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1475687 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java
index 2d58eef..b52f65a 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java
@@ -467,7 +467,6 @@
if (org.osgi.framework.Constants.SERVICE_RANKING.equals(name)
|| org.osgi.framework.Constants.SERVICE_PID.equals(name)
|| org.osgi.framework.Constants.SERVICE_DESCRIPTION.equals(name)
- || org.osgi.framework.Constants.SERVICE_ID.equals(name)
|| org.osgi.framework.Constants.SERVICE_VENDOR.equals(name)
|| ConfigurationAdmin.SERVICE_BUNDLELOCATION.equals(name)
|| ConfigurationAdmin.SERVICE_FACTORYPID.equals(name) ) {
@@ -488,19 +487,20 @@
for(final PropertyDescription pd : current.getDescriptions(PropertyDescription.class)) {
if ( this.testProperty(current, component.getProperties(), pd, current == component.getClassDescription()) ) {
+ final String name = pd.getName();
+ if ( org.osgi.framework.Constants.SERVICE_ID.equals(name) ) {
+ iLog.addError("Class " + current.getDescribedClass().getName() + " is declaring " +
+ " the protected property 'service.id'.", current.getSource() );
+ continue;
+
+ }
if ( ocd != null) {
// metatype - is this property private?
final boolean isPrivate;
if ( pd.isPrivate() != null ) {
isPrivate = pd.isPrivate();
- if ( isPrivate && this.isPrivateProperty(pd.getName()) ) { // additional check (FELIX-4033)
- iLog.addWarning("Property " + pd.getName() + " in class "
- + current.getDescribedClass().getName() + " has redundant setting" +
- " for private (true). This property is private by default.", current.getSource() );
- }
} else {
- final String name = pd.getName();
if (isPrivateProperty(name) ) {
isPrivate = true;
} else {