abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Snell <jasn...@gmail.com>
Subject Re: svn commit: r1214979 - in /abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities: client/ extra/ model/ model/objects/
Date Fri, 16 Dec 2011 03:18:43 GMT
Ugh those casts are annoying, and difficult to remember to include.
Thx for the fix.

Btw, another way to handle it is a generics call, e.g. "return (T)
post(uri,base,options);" can be "return
this.<T>post(uri,base,options);"

On Thu, Dec 15, 2011 at 3:04 PM,  <antelder@apache.org> wrote:
> Author: antelder
> Date: Thu Dec 15 23:04:44 2011
> New Revision: 1214979
>
> URL: http://svn.apache.org/viewvc?rev=1214979&view=rev
> Log:
> Add casts as i get compile errors when building with Maven without them
>
> Modified:
>    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesSession.java
>    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/Extra.java
>    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/PusherCollectionWriter.java
>    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/ASBase.java
>    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/AbstractCollectionWriter.java
>    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/IO.java
>    abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/objects/TaskObject.java
>
> Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesSession.java
> URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesSession.java?rev=1214979&r1=1214978&r2=1214979&view=diff
> ==============================================================================
> --- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesSession.java
(original)
> +++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/client/ActivitiesSession.java
Thu Dec 15 23:04:44 2011
> @@ -79,7 +79,7 @@ public class ActivitiesSession
>     final ASBase base) {
>     return new Callable<T>() {
>       public T call() throws Exception {
> -        return post(uri,base);
> +        return (T) post(uri,base);
>       }
>     };
>   }
> @@ -90,7 +90,7 @@ public class ActivitiesSession
>     final RequestOptions options) {
>     return new Callable<T>() {
>       public T call() throws Exception {
> -        return post(uri,base,options);
> +        return (T) post(uri,base,options);
>       }
>     };
>   }
> @@ -105,7 +105,7 @@ public class ActivitiesSession
>     final ASBase base) {
>     return new Callable<T>() {
>       public T call() throws Exception {
> -        return put(uri,base);
> +        return (T) put(uri,base);
>       }
>     };
>   }
> @@ -116,7 +116,7 @@ public class ActivitiesSession
>     final RequestOptions options) {
>     return new Callable<T>() {
>       public T call() throws Exception {
> -        return put(uri,base,options);
> +        return (T) put(uri,base,options);
>       }
>     };
>   }
>
> Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/Extra.java
> URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/Extra.java?rev=1214979&r1=1214978&r2=1214979&view=diff
> ==============================================================================
> --- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/Extra.java
(original)
> +++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/Extra.java
Thu Dec 15 23:04:44 2011
> @@ -1019,7 +1019,7 @@ public final class Extra {
>     final String charset) {
>     return new Function<InputStream,T>() {
>       public T apply(InputStream input) {
> -        return io.read(input,charset);
> +        return (T) io.read(input,charset);
>       }
>     };
>   }
> @@ -1032,7 +1032,7 @@ public final class Extra {
>     final IO io) {
>     return new Function<Reader,T>() {
>       public T apply(Reader input) {
> -        return io.read(input);
> +        return (T) io.read(input);
>       }
>     };
>   }
> @@ -1045,7 +1045,7 @@ public final class Extra {
>     final IO io) {
>     return new Function<String,T>() {
>       public T apply(String input) {
> -        return io.read(input);
> +        return (T) io.read(input);
>       }
>     };
>   }
> @@ -1107,7 +1107,7 @@ public final class Extra {
>     final String charset) {
>     return new Function<InputStream,T>() {
>       public T apply(InputStream input) {
> -        return io.readObject(input,charset);
> +        return (T) io.readObject(input,charset);
>       }
>     };
>   }
> @@ -1120,7 +1120,7 @@ public final class Extra {
>     final IO io) {
>     return new Function<Reader,T>() {
>       public T apply(Reader input) {
> -        return io.readObject(input);
> +        return (T) io.readObject(input);
>       }
>     };
>   }
> @@ -1133,7 +1133,7 @@ public final class Extra {
>     final IO io) {
>     return new Function<String,T>() {
>       public T apply(String input) {
> -        return io.readObject(input);
> +        return (T) io.readObject(input);
>       }
>     };
>   }
>
> Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/PusherCollectionWriter.java
> URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/PusherCollectionWriter.java?rev=1214979&r1=1214978&r2=1214979&view=diff
> ==============================================================================
> --- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/PusherCollectionWriter.java
(original)
> +++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/extra/PusherCollectionWriter.java
Thu Dec 15 23:04:44 2011
> @@ -71,12 +71,12 @@ public final class PusherCollectionWrite
>   }
>
>   public <X extends CollectionWriter> X writeHeader(Builder<?, ?> base)
{
> -    return writeHeader(base.get());
> +    return (X) writeHeader(base.get());
>   }
>
>   public <X extends CollectionWriter> X writeObject(
>       ASObject.Builder<?, ?> object) {
> -    return writeObject(object.get());
> +    return (X) writeObject(object.get());
>   }
>
>  }
>
> Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/ASBase.java
> URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/ASBase.java?rev=1214979&r1=1214978&r2=1214979&view=diff
> ==============================================================================
> --- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/ASBase.java
(original)
> +++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/ASBase.java
Thu Dec 15 23:04:44 2011
> @@ -276,7 +276,7 @@ public class ASBase
>     }
>     public <N>N extend(Class<N> as) {
>       checkArgument(as.isInterface(),"Extension is not an interface!");
> -      return Extra.extendBuilder(this,as);
> +      return (N) Extra.extendBuilder(this,as);
>     }
>     public M template() {
>       return bld.apply(array(map.build()));
> @@ -494,7 +494,7 @@ public class ASBase
>    */
>   public <T>T extend(Class<T> as) {
>     checkArgument(as.isInterface(),"Extension is not an interface!");
> -    return Extra.extend(this,as);
> +    return (T) Extra.extend(this,as);
>   }
>
>   public boolean has(String name) {
>
> Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/AbstractCollectionWriter.java
> URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/AbstractCollectionWriter.java?rev=1214979&r1=1214978&r2=1214979&view=diff
> ==============================================================================
> --- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/AbstractCollectionWriter.java
(original)
> +++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/AbstractCollectionWriter.java
Thu Dec 15 23:04:44 2011
> @@ -39,7 +39,7 @@ public abstract class AbstractCollection
>   public abstract void complete();
>
>   public <X extends CollectionWriter>X writeHeader(ASBase.Builder<?,?> base)
{
> -    return writeHeader(base.get());
> +    return (X) writeHeader(base.get());
>   }
>
>   public <X extends CollectionWriter>X writeHeader(ASBase base) {
> @@ -59,7 +59,7 @@ public abstract class AbstractCollection
>   }
>
>   public <X extends CollectionWriter>X writeObject(ASObject.Builder<?, ?>
object) {
> -    return writeObject(object.get());
> +    return (X) writeObject(object.get());
>   }
>
>   public <X extends CollectionWriter>X writeObject(ASObject object) {
>
> Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/IO.java
> URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/IO.java?rev=1214979&r1=1214978&r2=1214979&view=diff
> ==============================================================================
> --- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/IO.java
(original)
> +++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/IO.java
Thu Dec 15 23:04:44 2011
> @@ -325,7 +325,7 @@ public abstract class IO {
>         exec,
>         new Callable<X>() {
>           public X call() throws Exception {
> -            return read(reader);
> +            return (X) read(reader);
>           }
>         },
>         listener);
> @@ -338,7 +338,7 @@ public abstract class IO {
>         exec,
>         new Callable<X>() {
>           public X call() throws Exception {
> -            return read(reader);
> +            return (X) read(reader);
>           }
>         });
>   }
> @@ -352,7 +352,7 @@ public abstract class IO {
>         exec,
>         new Callable<X>() {
>           public X call() throws Exception {
> -            return readAs(reader,_class);
> +            return (X) readAs(reader,_class);
>           }
>         },
>         listener);
> @@ -366,7 +366,7 @@ public abstract class IO {
>         exec,
>         new Callable<X>() {
>           public X call() throws Exception {
> -            return readAs(reader,_class);
> +            return (X) readAs(reader,_class);
>           }
>         });
>   }
> @@ -381,7 +381,7 @@ public abstract class IO {
>         exec,
>         new Callable<X>() {
>           public X call() throws Exception {
> -            return read(reader);
> +            return (X) read(reader);
>           }
>         },
>         listener);
> @@ -395,7 +395,7 @@ public abstract class IO {
>         exec,
>         new Callable<X>() {
>           public X call() throws Exception {
> -            return read(reader);
> +            return (X) read(reader);
>           }
>         });
>   }
> @@ -410,7 +410,7 @@ public abstract class IO {
>         exec,
>         new Callable<X>() {
>           public X call() throws Exception {
> -            return readAs(reader,_class);
> +            return (X) readAs(reader,_class);
>           }
>         },
>         listener);
> @@ -425,7 +425,7 @@ public abstract class IO {
>         exec,
>         new Callable<X>() {
>           public X call() throws Exception {
> -            return readAs(reader,_class);
> +            return (X) readAs(reader,_class);
>           }
>         });
>   }
> @@ -440,7 +440,7 @@ public abstract class IO {
>         exec,
>         new Callable<X>() {
>           public X call() throws Exception {
> -            return read(in,charset);
> +            return (X) read(in,charset);
>           }
>         },
>         listener);
> @@ -455,7 +455,7 @@ public abstract class IO {
>         exec,
>         new Callable<X>() {
>           public X call() throws Exception {
> -            return read(in,charset);
> +            return (X) read(in,charset);
>           }
>         });
>   }
> @@ -471,7 +471,7 @@ public abstract class IO {
>         exec,
>         new Callable<X>() {
>           public X call() throws Exception {
> -            return readAs(in,charset,_class);
> +            return (X) readAs(in,charset,_class);
>           }
>         },
>         listener);
> @@ -487,7 +487,7 @@ public abstract class IO {
>         exec,
>         new Callable<X>() {
>           public X call() throws Exception {
> -            return readAs(in,charset,_class);
> +            return (X) readAs(in,charset,_class);
>           }
>         });
>   }
>
> Modified: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/objects/TaskObject.java
> URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/objects/TaskObject.java?rev=1214979&r1=1214978&r2=1214979&view=diff
> ==============================================================================
> --- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/objects/TaskObject.java
(original)
> +++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/model/objects/TaskObject.java
Thu Dec 15 23:04:44 2011
> @@ -35,11 +35,11 @@ public class TaskObject extends ASObject
>   }
>
>   public <X extends ASObject>X getObject() {
> -    return getProperty("for");
> +    return (X) getProperty("for");
>   }
>
>   public <X extends ASObject>X getActor() {
> -    return getProperty("actor");
> +    return (X) getProperty("actor");
>   }
>
>   public Iterable<String> getSupersedes() {
>
>

Mime
View raw message