You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ru...@apache.org on 2011/02/14 07:30:01 UTC
svn commit: r1070393 -
/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
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/PolicyEngine.java
Modified: webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.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=1070393&view=diff
==============================================================================
--- webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java (original)
+++ webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.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());
}
}
RE: svn commit: r1070393 -
/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
Posted by Tom Jordahl <tj...@adobe.com>.
> How can an IDE come to the conclusion that a _public_ method is unused?
It analyzes all the classes in the project, including tests, etc.
In general IDEA does not flag public methods in public classes as unused, so perhaps this suppression was placed there in error? Although now that I say that, I checked and the latest version (10) seems to flag some public methods which I know it did not do before.
Any other IDEA users notice this? A quick check at the config doesn't find a way to turn off this new behavior.
Any Eclipse users know how to stop it from nosing in to the argument of @SupressWarnings()?
Tom Jordahl
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org
Re: svn commit: r1070393 - /webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
Posted by Andreas Veithen <an...@gmail.com>.
On Mon, Feb 14, 2011 at 21:18, Tom Jordahl <tj...@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.
How can an IDE come to the conclusion that a _public_ method is unused?
> 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
Re: svn commit: r1070393 - /webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
Posted by Ruwan Linton <ru...@gmail.com>.
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 <bi...@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 <tj...@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
Re: svn commit: r1070393 - /webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
Posted by Benson Margulies <bi...@gmail.com>.
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 <tj...@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
RE: svn commit: r1070393 -
/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
Posted by Tom Jordahl <tj...@adobe.com>.
> 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.
Agreed.
Tom Jordahl
Re: svn commit: r1070393 - /webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
Posted by Glen Daniels <gl...@thoughtcraft.com>.
On 2/14/11 3:28 PM, Daniel Kulp wrote:
> 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.
I think the idea (hahaha) of the warning is simply to note that you have
methods that are un-exercised in your project. Adding a test case for
such methods will cause IDEA to clear the warning - which is just that,
a warning. From my POV, I don't mind this, and in fact find it quite
useful.
Alas, apparently [1] Eclipse and IDEA don't play together well here. I
think you should be able to get Eclipse to stop complaining about these
by looking in Java -> Compiler -> Errors/Warnings -> Annotations ->
Unhandled Warning Token.
Sort of a catch-22, though, trading a warning for a warning.
--Glen
[1]
http://devnet.jetbrains.net/message/5282015;jsessionid=9EFA57EAD2DB40FB50E45830343A5267?tstart=0
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org
Re: svn commit: r1070393 - /webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
Posted by Daniel Kulp <dk...@apache.org>.
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: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
RE: svn commit: r1070393 -
/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
Posted by Tom Jordahl <tj...@adobe.com>.
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
Re: svn commit: r1070393 - /webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
Posted by Daniel Kulp <dk...@apache.org>.
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