You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2013/04/25 12:08:37 UTC

svn commit: r1475687 - /felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java

Author: cziegeler
Date: Thu Apr 25 10:08:36 2013
New Revision: 1475687

URL: http://svn.apache.org/r1475687
Log:
FELIX-4033 :  Issue warning messages for redundant SCR annotation combinations 

Modified:
    felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java

Modified: felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java?rev=1475687&r1=1475686&r2=1475687&view=diff
==============================================================================
--- felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java (original)
+++ felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java Thu Apr 25 10:08:36 2013
@@ -467,7 +467,6 @@ public class SCRDescriptorGenerator {
         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 @@ public class SCRDescriptorGenerator {
         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 {