On Monday 14 February 2011 3:18:17 PM Tom Jordahl wrote:
> Hey Dan,
> 
> This is a suppression added by IntelliJ IDEA to suppress the highlighting
> of unused methods or variables in a class.
> 
> Why would Eclipse object to this?  Is it trying to 'validate' the contents
> of the annotation for some reason?

Yea.  It doesn't understand it so it raises a warning about it.

> That is obnoxious.  They must be some
> way to turn this off, no?

Possible, I'd need to dig into eclipse warning levels a bit.

However, as Andreas just pointed out, the annotation is just plain wrong in 
this case.   It's a PUBLIC method on a PUBLIC class.   There is absolutely no 
way it should be marked as unused.

Dan



> 
> Tom Jordahl
> 
> 
> -----Original Message-----
> From: Daniel Kulp [mailto:[email protected]]
> Sent: Monday, February 14, 2011 11:06 AM
> To: [email protected]
> Subject: Re: svn commit: r1070393 -
> /webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/
> PolicyEngine.java
> 
> 
> Can I  ask what the purpose of the:
> 
> @SuppressWarnings({"UnusedDeclaration"})
> 
> lines are for?
> 
> They are causing warnings in Eclipse and I don't see why they  should be
> there.
> 
> Dan
> 
> On Monday 14 February 2011 1:30:01 AM [email protected] wrote:
> > Author: ruwan
> > Date: Mon Feb 14 06:30:00 2011
> > New Revision: 1070393
> > 
> > URL: http://svn.apache.org/viewvc?rev=1070393&view=rev
> > Log:
> > minor reformatting to improve the code, readability
> > 
> > Modified:
> > 
> > webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/
> > P olicyEngine.java
> > 
> > Modified:
> > webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/
> > P olicyEngine.java URL:
> > http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src
> > /
> > main/java/org/apache/neethi/PolicyEngine.java?rev=1070393&r1=1070392&r2=
> > 107 0393&view=diff
> > =========================================================================
> > = ==== ---
> > webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/
> > P olicyEngine.java (original) +++
> > webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/
> > P olicyEngine.java Mon Feb 14 06:30:00 2011 @@ -19,7 +19,6 @@
> > 
> >  package org.apache.neethi;
> > 
> > -
> > 
> >  import java.io.InputStream;
> >  import java.util.Iterator;
> >  import java.util.Map;
> > 
> > @@ -61,6 +60,7 @@ public class PolicyEngine {
> > 
> >       *            the AssertionBuilder that can build assertions that of
> > 
> > 'qname' *            type
> > 
> >       */
> > 
> > +    @SuppressWarnings({"UnusedDeclaration"})
> > 
> >      public void registerBuilder(QName qname, AssertionBuilder builder) {
> >      
> >          factory.registerBuilder(qname, builder);
> >      
> >      }
> > 
> > @@ -72,9 +72,11 @@ public class PolicyEngine {
> > 
> >       * PolicyRegistry.
> >       * @return the default PolicyRegistry
> >       */
> > 
> > +    @SuppressWarnings({"UnusedDeclaration"})
> > 
> >      public PolicyRegistry getPolicyRegistry() {
> >      
> >          return defaultPolicyRegistry;
> >      
> >      }
> > 
> > +
> > 
> >      public void setPolicyRegistry(PolicyRegistry reg) {
> >      
> >          defaultPolicyRegistry = reg;
> >      
> >      }
> > 
> > @@ -97,6 +99,7 @@ public class PolicyEngine {
> > 
> >          // TODO throw an IllegalArgumentException
> >          return null;
> >      
> >      }
> > 
> > +
> > 
> >      public Policy getPolicy(Element el) {
> >      
> >          return getPolicyOperator(el);
> >      
> >      }
> > 
> > @@ -105,7 +108,6 @@ public class PolicyEngine {
> > 
> >      public Policy getPolicy(XMLStreamReader reader) {
> >      
> >          return getPolicyOperator(reader);
> >      
> >      }
> > 
> > -
> > 
> >      /**
> >      
> >       * Creates a Policy object from an element.
> > 
> > @@ -117,8 +119,7 @@ public class PolicyEngine {
> > 
> >      public Policy getPolicy(Object element) {
> >      
> >          return getPolicyOperator(element);
> >      
> >      }
> > 
> > -
> > -
> > +
> > 
> >      /**
> >      
> >       * Creates a PolicyReference object.
> >       *
> > 
> > @@ -126,6 +127,7 @@ public class PolicyEngine {
> > 
> >       *            the InputStream of the PolicyReference
> >       * @return a PolicyReference object of the PolicyReference
> >       */
> > 
> > +    @SuppressWarnings({"UnusedDeclaration"})
> > 
> >      public PolicyReference getPolicyReference(InputStream inputStream) {
> >      
> >          try {
> >          
> >              XMLStreamReader reader =
> > 
> > XMLInputFactory.newInstance().createXMLStreamReader(inputStream); @@
> > -137,7 +139,6 @@ public class PolicyEngine {
> > 
> >          return null;
> >      
> >      }
> > 
> > -
> > 
> >      /**
> >      
> >       * Creates a PolicyReference object from an element.
> >       *
> > 
> > @@ -155,10 +156,10 @@ public class PolicyEngine {
> > 
> >          PolicyReference reference = new PolicyReference(this);
> > 
> > -        Map<QName, String> attrs = converters.getAttributes(element);
> > +        Map<QName, String> attributes =
> > converters.getAttributes(element);
> > 
> >          // setting the URI value
> > 
> > -        reference.setURI(attrs.get(new QName("URI")));
> > +        reference.setURI(attributes.get(new QName("URI")));
> > 
> >          return reference;
> >      
> >      }
> > 
> > @@ -181,9 +182,9 @@ public class PolicyEngine {
> > 
> >          if (Constants.TYPE_POLICY == operator.getType()) {
> >          
> >              Policy policyOperator = (Policy) operator;
> > 
> > -            Map<QName, String> attrs =
> > converters.getAttributes(operationElement); +            Map<QName,
> > String> attributes = converters.getAttributes(operationElement);
> > 
> > -            for (Map.Entry<QName, String> ent : attrs.entrySet()) {
> > +            for (Map.Entry<QName, String> ent : attributes.entrySet()) {
> > 
> >                  policyOperator.addAttribute(ent.getKey(),
> >                  ent.getValue());
> >              
> >              }
> >          
> >          }

-- 
Daniel Kulp
[email protected]
http://dankulp.com/blog

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to