[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlrpc-dev
Subject:    Re: svn commit: r1070393 - /webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi
From:       Ruwan Linton <ruwan.linton () gmail ! com>
Date:       2011-02-15 3:22:41
Message-ID: AANLkTimre+M-v6uW9m-sDamPVS6O6GxOhA-Suu7Fw402 () mail ! gmail ! com
[Download RAW message or body]

Well, I did this to make sure IDEA catches any actual unused methods. I
think from the IDEA 9 or 10 they by default mark even the public API as
unused, which I think is a bug in IDEA, even on the interfaces it does that.
So probably there is a configuration to change this behaviour, which I
didn't come across.

Apart from that IDEA gives you a very handy set of warnings to improve your
code, just to clearly see the important warnings I have added this
supressWarning annotation.

Ruwan

On Tue, Feb 15, 2011 at 3:56 AM, Benson Margulies <bimargulies@gmail.com>wrote:

> Sadly, eclipse has this very stupid policy of warning all suppressions
> that it doesn't know. My favorite is
>
> @SuppressWarmings("PMD")
>
> Complain to the eclipse team, is my advice.
>
>
> On Mon, Feb 14, 2011 at 3:18 PM, Tom Jordahl <tjordahl@adobe.com> 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?  That is obnoxious.  They must
> be some way to turn this off, no?
> >
> > Tom Jordahl
> >
> >
> > -----Original Message-----
> > From: Daniel Kulp [mailto:dkulp@apache.org]
> > Sent: Monday, February 14, 2011 11:06 AM
> > To: dev@ws.apache.org
> > 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 ruwan@apache.org 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
> > dkulp@apache.org
> > http://dankulp.com/blog
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: dev-help@ws.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: dev-help@ws.apache.org
>
>


-- 
Ruwan Linton
Member, Apache Software Foundation; http://www.apache.org
Software Architect & Product Manager, WSO2 Inc.; http://wso2.org

phone: +1 408 754 7388 ext 51789
email: ruwan@wso2.com; cell: +94 77 341 3097
blog: http://blog.ruwan.org
linkedin: http://www.linkedin.com/in/ruwanlinton
google: http://www.google.com/profiles/ruwan.linton
tweet: http://twitter.com/ruwanlinton

[Attachment #3 (text/html)]

Well, I did this to make sure IDEA catches any actual unused methods. I think from \
the IDEA 9 or 10 they by default mark even the public API as unused, which I think is \
a bug in IDEA, even on the interfaces it does that. So probably there is a \
configuration to change this behaviour, which I didn&#39;t come across.<br> <br>Apart \
from that IDEA gives you a very handy set of warnings to improve your code, just to \
clearly see the important warnings I have added this supressWarning \
annotation.<br><br>Ruwan<br><br><div class="gmail_quote">On Tue, Feb 15, 2011 at 3:56 \
AM, Benson Margulies <span dir="ltr">&lt;<a \
href="mailto:bimargulies@gmail.com">bimargulies@gmail.com</a>&gt;</span> wrote:<br> \
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px \
solid rgb(204, 204, 204); padding-left: 1ex;">Sadly, eclipse has this very stupid \
policy of warning all suppressions<br> that it doesn&#39;t know. My favorite is<br>
<br>
@SuppressWarmings(&quot;PMD&quot;)<br>
<br>
Complain to the eclipse team, is my advice.<br>
<div><div></div><div class="h5"><br>
<br>
On Mon, Feb 14, 2011 at 3:18 PM, Tom Jordahl &lt;<a \
href="mailto:tjordahl@adobe.com">tjordahl@adobe.com</a>&gt; wrote:<br> &gt; Hey \
Dan,<br> &gt;<br>
&gt; This is a suppression added by IntelliJ IDEA to suppress the highlighting of \
unused methods or variables in a class.<br> &gt;<br>
&gt; Why would Eclipse object to this?  Is it trying to &#39;validate&#39; the \
contents of the annotation for some reason?  That is obnoxious.  They must be some \
way to turn this off, no?<br> &gt;<br>
&gt; Tom Jordahl<br>
&gt;<br>
&gt;<br>
&gt; -----Original Message-----<br>
&gt; From: Daniel Kulp [mailto:<a \
href="mailto:dkulp@apache.org">dkulp@apache.org</a>]<br> &gt; Sent: Monday, February \
14, 2011 11:06 AM<br> &gt; To: <a \
href="mailto:dev@ws.apache.org">dev@ws.apache.org</a><br> &gt; Subject: Re: svn \
commit: r1070393 - /webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java<br>
 &gt;<br>
&gt;<br>
&gt; Can I  ask what the purpose of the:<br>
&gt;<br>
&gt; @SuppressWarnings({&quot;UnusedDeclaration&quot;})<br>
&gt;<br>
&gt; lines are for?<br>
&gt;<br>
&gt; They are causing warnings in Eclipse and I don&#39;t see why they  should be<br>
&gt; there.<br>
&gt;<br>
&gt; Dan<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Monday 14 February 2011 1:30:01 AM <a \
href="mailto:ruwan@apache.org">ruwan@apache.org</a> wrote:<br> &gt;&gt; Author: \
ruwan<br> &gt;&gt; Date: Mon Feb 14 06:30:00 2011<br>
&gt;&gt; New Revision: 1070393<br>
&gt;&gt;<br>
&gt;&gt; URL: <a href="http://svn.apache.org/viewvc?rev=1070393&amp;view=rev" \
target="_blank">http://svn.apache.org/viewvc?rev=1070393&amp;view=rev</a><br> \
&gt;&gt; Log:<br> &gt;&gt; minor reformatting to improve the code, readability<br>
&gt;&gt;<br>
&gt;&gt; Modified:<br>
&gt;&gt;<br>
&gt;&gt; webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/P<br>
 &gt;&gt; olicyEngine.java<br>
&gt;&gt;<br>
&gt;&gt; Modified:<br>
&gt;&gt; webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/P<br>
 &gt;&gt; olicyEngine.java URL:<br>
&gt;&gt; <a href="http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/" \
target="_blank">http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/</a><br>
 &gt;&gt; main/java/org/apache/neethi/PolicyEngine.java?rev=1070393&amp;r1=1070392&amp;r2=107<br>
 &gt;&gt; 0393&amp;view=diff<br>
&gt;&gt; ==========================================================================<br>
 &gt;&gt; ==== ---<br>
&gt;&gt; webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/P<br>
 &gt;&gt; olicyEngine.java (original) +++<br>
&gt;&gt; webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/P<br>
 &gt;&gt; olicyEngine.java Mon Feb 14 06:30:00 2011 @@ -19,7 +19,6 @@<br>
&gt;&gt;<br>
&gt;&gt;  package org.apache.neethi;<br>
&gt;&gt;<br>
&gt;&gt; -<br>
&gt;&gt;  import java.io.InputStream;<br>
&gt;&gt;  import java.util.Iterator;<br>
&gt;&gt;  import java.util.Map;<br>
&gt;&gt; @@ -61,6 +60,7 @@ public class PolicyEngine {<br>
&gt;&gt;       *            the AssertionBuilder that can build assertions that \
of<br> &gt;&gt; &#39;qname&#39; *            type<br>
&gt;&gt;       */<br>
&gt;&gt; +    @SuppressWarnings({&quot;UnusedDeclaration&quot;})<br>
&gt;&gt;      public void registerBuilder(QName qname, AssertionBuilder builder) \
{<br> &gt;&gt;          factory.registerBuilder(qname, builder);<br>
&gt;&gt;      }<br>
&gt;&gt; @@ -72,9 +72,11 @@ public class PolicyEngine {<br>
&gt;&gt;       * PolicyRegistry.<br>
&gt;&gt;       * @return the default PolicyRegistry<br>
&gt;&gt;       */<br>
&gt;&gt; +    @SuppressWarnings({&quot;UnusedDeclaration&quot;})<br>
&gt;&gt;      public PolicyRegistry getPolicyRegistry() {<br>
&gt;&gt;          return defaultPolicyRegistry;<br>
&gt;&gt;      }<br>
&gt;&gt; +<br>
&gt;&gt;      public void setPolicyRegistry(PolicyRegistry reg) {<br>
&gt;&gt;          defaultPolicyRegistry = reg;<br>
&gt;&gt;      }<br>
&gt;&gt; @@ -97,6 +99,7 @@ public class PolicyEngine {<br>
&gt;&gt;          // TODO throw an IllegalArgumentException<br>
&gt;&gt;          return null;<br>
&gt;&gt;      }<br>
&gt;&gt; +<br>
&gt;&gt;      public Policy getPolicy(Element el) {<br>
&gt;&gt;          return getPolicyOperator(el);<br>
&gt;&gt;      }<br>
&gt;&gt; @@ -105,7 +108,6 @@ public class PolicyEngine {<br>
&gt;&gt;      public Policy getPolicy(XMLStreamReader reader) {<br>
&gt;&gt;          return getPolicyOperator(reader);<br>
&gt;&gt;      }<br>
&gt;&gt; -<br>
&gt;&gt;<br>
&gt;&gt;      /**<br>
&gt;&gt;       * Creates a Policy object from an element.<br>
&gt;&gt; @@ -117,8 +119,7 @@ public class PolicyEngine {<br>
&gt;&gt;      public Policy getPolicy(Object element) {<br>
&gt;&gt;          return getPolicyOperator(element);<br>
&gt;&gt;      }<br>
&gt;&gt; -<br>
&gt;&gt; -<br>
&gt;&gt; +<br>
&gt;&gt;      /**<br>
&gt;&gt;       * Creates a PolicyReference object.<br>
&gt;&gt;       *<br>
&gt;&gt; @@ -126,6 +127,7 @@ public class PolicyEngine {<br>
&gt;&gt;       *            the InputStream of the PolicyReference<br>
&gt;&gt;       * @return a PolicyReference object of the PolicyReference<br>
&gt;&gt;       */<br>
&gt;&gt; +    @SuppressWarnings({&quot;UnusedDeclaration&quot;})<br>
&gt;&gt;      public PolicyReference getPolicyReference(InputStream inputStream) \
{<br> &gt;&gt;          try {<br>
&gt;&gt;              XMLStreamReader reader =<br>
&gt;&gt; XMLInputFactory.newInstance().createXMLStreamReader(inputStream); @@<br>
&gt;&gt; -137,7 +139,6 @@ public class PolicyEngine {<br>
&gt;&gt;          return null;<br>
&gt;&gt;      }<br>
&gt;&gt;<br>
&gt;&gt; -<br>
&gt;&gt;      /**<br>
&gt;&gt;       * Creates a PolicyReference object from an element.<br>
&gt;&gt;       *<br>
&gt;&gt; @@ -155,10 +156,10 @@ public class PolicyEngine {<br>
&gt;&gt;<br>
&gt;&gt;          PolicyReference reference = new PolicyReference(this);<br>
&gt;&gt;<br>
&gt;&gt; -        Map&lt;QName, String&gt; attrs = \
converters.getAttributes(element);<br> &gt;&gt; +        Map&lt;QName, String&gt; \
attributes = converters.getAttributes(element);<br> &gt;&gt;<br>
&gt;&gt;          // setting the URI value<br>
&gt;&gt; -        reference.setURI(attrs.get(new QName(&quot;URI&quot;)));<br>
&gt;&gt; +        reference.setURI(attributes.get(new QName(&quot;URI&quot;)));<br>
&gt;&gt;          return reference;<br>
&gt;&gt;      }<br>
&gt;&gt;<br>
&gt;&gt; @@ -181,9 +182,9 @@ public class PolicyEngine {<br>
&gt;&gt;          if (Constants.TYPE_POLICY == operator.getType()) {<br>
&gt;&gt;              Policy policyOperator = (Policy) operator;<br>
&gt;&gt;<br>
&gt;&gt; -            Map&lt;QName, String&gt; attrs =<br>
&gt;&gt; converters.getAttributes(operationElement); +            Map&lt;QName,<br>
&gt;&gt; String&gt; attributes = converters.getAttributes(operationElement);<br>
&gt;&gt;<br>
&gt;&gt; -            for (Map.Entry&lt;QName, String&gt; ent : attrs.entrySet()) \
{<br> &gt;&gt; +            for (Map.Entry&lt;QName, String&gt; ent : \
attributes.entrySet()) {<br> &gt;&gt;                  \
policyOperator.addAttribute(ent.getKey(), ent.getValue());<br> &gt;&gt;              \
}<br> &gt;&gt;          }<br>
&gt;<br>
&gt; --<br>
&gt; Daniel Kulp<br>
&gt; <a href="mailto:dkulp@apache.org">dkulp@apache.org</a><br>
&gt; <a href="http://dankulp.com/blog" \
target="_blank">http://dankulp.com/blog</a><br> &gt;<br>
&gt; ---------------------------------------------------------------------<br>
&gt; To unsubscribe, e-mail: <a \
href="mailto:dev-unsubscribe@ws.apache.org">dev-unsubscribe@ws.apache.org</a><br> \
&gt; For additional commands, e-mail: <a \
href="mailto:dev-help@ws.apache.org">dev-help@ws.apache.org</a><br> &gt;<br>
&gt;<br>
<br>
---------------------------------------------------------------------<br>
To unsubscribe, e-mail: <a \
href="mailto:dev-unsubscribe@ws.apache.org">dev-unsubscribe@ws.apache.org</a><br> For \
additional commands, e-mail: <a \
href="mailto:dev-help@ws.apache.org">dev-help@ws.apache.org</a><br> <br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Ruwan \
Linton<div>Member, Apache Software Foundation; <a href="http://www.apache.org" \
target="_blank">http://www.apache.org</a><br>Software Architect &amp; Product \
Manager, WSO2 Inc.; <a href="http://wso2.org" \
target="_blank">http://wso2.org</a><div> <br>phone: +1 408 754 7388 ext \
51789<br>email: <a href="mailto:ruwan@wso2.com" target="_blank">ruwan@wso2.com</a>; \
cell: +94 77 341 3097<br>blog: <a href="http://blog.ruwan.org" \
                target="_blank">http://blog.ruwan.org</a><br>
linkedin: <a href="http://www.linkedin.com/in/ruwanlinton" \
target="_blank">http://www.linkedin.com/in/ruwanlinton</a><br>google: <a \
href="http://www.google.com/profiles/ruwan.linton" \
                target="_blank">http://www.google.com/profiles/ruwan.linton</a><br>
tweet: <a href="http://twitter.com/ruwanlinton" \
target="_blank">http://twitter.com/ruwanlinton</a></div></div><br>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic