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 <[email protected]>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 <[email protected]> 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:[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] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- 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: [email protected]; 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
