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