[ 
https://issues.apache.org/jira/browse/THRIFT-2328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Roger Meier reopened THRIFT-2328:
---------------------------------

      Assignee:     (was: Jake Farrell)

[~jfarrell] we should keep this check:
{noformat}
<compilerarg value="-Xlint:unchecked"/>
{noformat}

Some input files use unchecked or unsafe operations.
> that's exactly the goal of this ticket ...



> Java: eliminate all compiler warnings
> -------------------------------------
>
>                 Key: THRIFT-2328
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2328
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Library
>            Reporter: Roger Meier
>             Fix For: 0.9.2
>
>
> I don't like compiler warnings such as these:
> {code}
>     [javac] Compiling 101 source files to /tmp/thrift-src/lib/java/build
>     [javac] warning: [options] bootstrap class path not set in conjunction 
> with -source 1.5
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/server/TServer.java:55: 
> warning: [unchecked] unchecked cast
>     [javac]       return (T) this;
>     [javac]                  ^
>     [javac]   required: T
>     [javac]   found:    AbstractServerArgs<T>
>     [javac]   where T is a type-variable:
>     [javac]     T extends AbstractServerArgs<T> declared in class 
> AbstractServerArgs
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/server/TServer.java:60: 
> warning: [unchecked] unchecked cast
>     [javac]       return (T) this;
>     [javac]                  ^
>     [javac]   required: T
>     [javac]   found:    AbstractServerArgs<T>
>     [javac]   where T is a type-variable:
>     [javac]     T extends AbstractServerArgs<T> declared in class 
> AbstractServerArgs
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/server/TServer.java:66: 
> warning: [unchecked] unchecked cast
>     [javac]       return (T) this;
>     [javac]                  ^
>     [javac]   required: T
>     [javac]   found:    AbstractServerArgs<T>
>     [javac]   where T is a type-variable:
>     [javac]     T extends AbstractServerArgs<T> declared in class 
> AbstractServerArgs
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/server/TServer.java:71: 
> warning: [unchecked] unchecked cast
>     [javac]       return (T) this;
>     [javac]                  ^
>     [javac]   required: T
>     [javac]   found:    AbstractServerArgs<T>
>     [javac]   where T is a type-variable:
>     [javac]     T extends AbstractServerArgs<T> declared in class 
> AbstractServerArgs
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/server/TServer.java:76: 
> warning: [unchecked] unchecked cast
>     [javac]       return (T) this;
>     [javac]                  ^
>     [javac]   required: T
>     [javac]   found:    AbstractServerArgs<T>
>     [javac]   where T is a type-variable:
>     [javac]     T extends AbstractServerArgs<T> declared in class 
> AbstractServerArgs
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/server/TServer.java:82: 
> warning: [unchecked] unchecked cast
>     [javac]       return (T) this;
>     [javac]                  ^
>     [javac]   required: T
>     [javac]   found:    AbstractServerArgs<T>
>     [javac]   where T is a type-variable:
>     [javac]     T extends AbstractServerArgs<T> declared in class 
> AbstractServerArgs
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/server/TServer.java:87: 
> warning: [unchecked] unchecked cast
>     [javac]       return (T) this;
>     [javac]                  ^
>     [javac]   required: T
>     [javac]   found:    AbstractServerArgs<T>
>     [javac]   where T is a type-variable:
>     [javac]     T extends AbstractServerArgs<T> declared in class 
> AbstractServerArgs
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/server/TServer.java:92: 
> warning: [unchecked] unchecked cast
>     [javac]       return (T) this;
>     [javac]                  ^
>     [javac]   required: T
>     [javac]   found:    AbstractServerArgs<T>
>     [javac]   where T is a type-variable:
>     [javac]     T extends AbstractServerArgs<T> declared in class 
> AbstractServerArgs
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/TBaseAsyncProcessor.java:84: 
> warning: [unchecked] unchecked call to start(I,T,AsyncMethodCallback<R>) as a 
> member of the raw type AsyncProcessFunction
>     [javac]         fn.start(iface, args,fn.getResultHandler(fb,msg.seqid));
>     [javac]                 ^
>     [javac]   where I,T,R are type-variables:
>     [javac]     I extends Object declared in class AsyncProcessFunction
>     [javac]     T extends Object declared in class AsyncProcessFunction
>     [javac]     R extends Object declared in class AsyncProcessFunction
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/TBaseHelper.java:126: warning: 
> [unchecked] unchecked call to compareTo(T) as a member of the raw type 
> Comparable
>     [javac]     return a.compareTo(b);
>     [javac]                       ^
>     [javac]   where T is a type-variable:
>     [javac]     T extends Object declared in interface Comparable
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/TBaseHelper.java:135: warning: 
> [unchecked] unchecked call to compare(T,T) as a member of the raw type 
> Comparator
>     [javac]       lastComparison = comparator.compare(a.get(i), b.get(i));
>     [javac]                                          ^
>     [javac]   where T is a type-variable:
>     [javac]     T extends Object declared in interface Comparator
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/TBaseHelper.java:148: warning: 
> [unchecked] unchecked call to TreeSet(Comparator<? super E>) as a member of 
> the raw type TreeSet
>     [javac]     SortedSet sortedA = new TreeSet(comparator);
>     [javac]                         ^
>     [javac]   where E is a type-variable:
>     [javac]     E extends Object declared in class TreeSet
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/TBaseHelper.java:149: warning: 
> [unchecked] unchecked call to addAll(Collection<? extends E>) as a member of 
> the raw type Set
>     [javac]     sortedA.addAll(a);
>     [javac]                   ^
>     [javac]   where E is a type-variable:
>     [javac]     E extends Object declared in interface Set
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/TBaseHelper.java:150: warning: 
> [unchecked] unchecked call to TreeSet(Comparator<? super E>) as a member of 
> the raw type TreeSet
>     [javac]     SortedSet sortedB = new TreeSet(comparator);
>     [javac]                         ^
>     [javac]   where E is a type-variable:
>     [javac]     E extends Object declared in class TreeSet
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/TBaseHelper.java:151: warning: 
> [unchecked] unchecked call to addAll(Collection<? extends E>) as a member of 
> the raw type Set
>     [javac]     sortedB.addAll(b);
>     [javac]                   ^
>     [javac]   where E is a type-variable:
>     [javac]     E extends Object declared in interface Set
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/TBaseHelper.java:158: warning: 
> [unchecked] unchecked call to compare(T,T) as a member of the raw type 
> Comparator
>     [javac]       lastComparison = comparator.compare(iterA.next(), 
> iterB.next());
>     [javac]                                          ^
>     [javac]   where T is a type-variable:
>     [javac]     T extends Object declared in interface Comparator
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/TBaseHelper.java:174: warning: 
> [unchecked] unchecked call to TreeMap(Comparator<? super K>) as a member of 
> the raw type TreeMap
>     [javac]     SortedMap sortedA = new TreeMap(comparator);
>     [javac]                         ^
>     [javac]   where K is a type-variable:
>     [javac]     K extends Object declared in class TreeMap
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/TBaseHelper.java:175: warning: 
> [unchecked] unchecked call to putAll(Map<? extends K,? extends V>) as a 
> member of the raw type Map
>     [javac]     sortedA.putAll(a);
>     [javac]                   ^
>     [javac]   where K,V are type-variables:
>     [javac]     K extends Object declared in interface Map
>     [javac]     V extends Object declared in interface Map
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/TBaseHelper.java:176: warning: 
> [unchecked] unchecked conversion
>     [javac]     Iterator<Map.Entry> iterA = sortedA.entrySet().iterator();
>     [javac]                                                            ^
>     [javac]   required: Iterator<Entry>
>     [javac]   found:    Iterator
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/TBaseHelper.java:177: warning: 
> [unchecked] unchecked call to TreeMap(Comparator<? super K>) as a member of 
> the raw type TreeMap
>     [javac]     SortedMap sortedB = new TreeMap(comparator);
>     [javac]                         ^
>     [javac]   where K is a type-variable:
>     [javac]     K extends Object declared in class TreeMap
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/TBaseHelper.java:178: warning: 
> [unchecked] unchecked call to putAll(Map<? extends K,? extends V>) as a 
> member of the raw type Map
>     [javac]     sortedB.putAll(b);
>     [javac]                   ^
>     [javac]   where K,V are type-variables:
>     [javac]     K extends Object declared in interface Map
>     [javac]     V extends Object declared in interface Map
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/TBaseHelper.java:179: warning: 
> [unchecked] unchecked conversion
>     [javac]     Iterator<Map.Entry> iterB = sortedB.entrySet().iterator();
>     [javac]                                                            ^
>     [javac]   required: Iterator<Entry>
>     [javac]   found:    Iterator
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/TBaseHelper.java:185: warning: 
> [unchecked] unchecked call to compare(T,T) as a member of the raw type 
> Comparator
>     [javac]       lastComparison = comparator.compare(entryA.getKey(), 
> entryB.getKey());
>     [javac]                                          ^
>     [javac]   where T is a type-variable:
>     [javac]     T extends Object declared in interface Comparator
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/TBaseHelper.java:189: warning: 
> [unchecked] unchecked call to compare(T,T) as a member of the raw type 
> Comparator
>     [javac]       lastComparison = comparator.compare(entryA.getValue(), 
> entryB.getValue());
>     [javac]                                          ^
>     [javac]   where T is a type-variable:
>     [javac]     T extends Object declared in interface Comparator
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/TBaseProcessor.java:39: 
> warning: [unchecked] unchecked call to process(int,TProtocol,TProtocol,I) as 
> a member of the raw type ProcessFunction
>     [javac]     fn.process(msg.seqid, in, out, iface);
>     [javac]               ^
>     [javac]   where I is a type-variable:
>     [javac]     I extends Object declared in class ProcessFunction
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/TNonblockingMultiFetchClient.java:162:
>  warning: [unchecked] unchecked call to FutureTask(Runnable,V) as a member of 
> the raw type FutureTask
>     [javac]     FutureTask<?> task = new FutureTask(multiFetch, null);
>     [javac]                          ^
>     [javac]   where V is a type-variable:
>     [javac]     V extends Object declared in class FutureTask
>     [javac] /tmp/thrift-src/lib/java/src/org/apache/thrift/TUnion.java:75: 
> warning: [unchecked] unchecked conversion
>     [javac]       return deepCopyMap((Map)o);
>     [javac]                          ^
>     [javac]   required: Map<Object,Object>
>     [javac]   found:    Map
>     [javac] /tmp/thrift-src/lib/java/src/org/apache/thrift/TUnion.java:84: 
> warning: [unchecked] unchecked call to put(K,V) as a member of the raw type 
> Map
>     [javac]       copy.put(deepCopyObject(entry.getKey()), 
> deepCopyObject(entry.getValue()));
>     [javac]               ^
>     [javac]   where K,V are type-variables:
>     [javac]     K extends Object declared in interface Map
>     [javac]     V extends Object declared in interface Map
>     [javac] /tmp/thrift-src/lib/java/src/org/apache/thrift/TUnion.java:92: 
> warning: [unchecked] unchecked call to add(E) as a member of the raw type Set
>     [javac]       copy.add(deepCopyObject(o));
>     [javac]               ^
>     [javac]   where E is a type-variable:
>     [javac]     E extends Object declared in interface Set
>     [javac] /tmp/thrift-src/lib/java/src/org/apache/thrift/TUnion.java:100: 
> warning: [unchecked] unchecked call to add(E) as a member of the raw type List
>     [javac]       copy.add(deepCopyObject(o));
>     [javac]               ^
>     [javac]   where E is a type-variable:
>     [javac]     E extends Object declared in interface List
>     [javac] /tmp/thrift-src/lib/java/src/org/apache/thrift/TUnion.java:138: 
> warning: [unchecked] unchecked call to read(TProtocol,T) as a member of the 
> raw type IScheme
>     [javac]     schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
>     [javac]                                                    ^
>     [javac]   where T is a type-variable:
>     [javac]     T extends TBase declared in interface IScheme
>     [javac] /tmp/thrift-src/lib/java/src/org/apache/thrift/TUnion.java:152: 
> warning: [unchecked] unchecked call to write(TProtocol,T) as a member of the 
> raw type IScheme
>     [javac]     schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
>     [javac]                                                     ^
>     [javac]   where T is a type-variable:
>     [javac]     T extends TBase declared in interface IScheme
>     [javac] /tmp/thrift-src/lib/java/src/org/apache/thrift/TUnion.java:208: 
> warning: [unchecked] getScheme() in TUnionStandardSchemeFactory implements 
> <S>getScheme() in SchemeFactory
>     [javac]     public TUnionStandardScheme getScheme() {
>     [javac]                                 ^
>     [javac]   return type requires unchecked conversion from 
> TUnionStandardScheme to S
>     [javac]   where S is a type-variable:
>     [javac]     S extends IScheme declared in method <S>getScheme()
>     [javac] /tmp/thrift-src/lib/java/src/org/apache/thrift/TUnion.java:217: 
> warning: [unchecked] unchecked assignment to variable setField_ as member of 
> raw type TUnion
>     [javac]       struct.setField_ = null;
>     [javac]             ^
>     [javac] /tmp/thrift-src/lib/java/src/org/apache/thrift/TUnion.java:226: 
> warning: [unchecked] unchecked assignment to variable setField_ as member of 
> raw type TUnion
>     [javac]         struct.setField_ = struct.enumForId(field.id);
>     [javac]               ^
>     [javac] /tmp/thrift-src/lib/java/src/org/apache/thrift/TUnion.java:243: 
> warning: [unchecked] unchecked call to getFieldDesc(F) as a member of the raw 
> type TUnion
>     [javac]       
> oprot.writeFieldBegin(struct.getFieldDesc(struct.setField_));
>     [javac]                                                ^
>     [javac]   where F is a type-variable:
>     [javac]     F extends TFieldIdEnum declared in class TUnion
>     [javac] /tmp/thrift-src/lib/java/src/org/apache/thrift/TUnion.java:252: 
> warning: [unchecked] getScheme() in TUnionTupleSchemeFactory implements 
> <S>getScheme() in SchemeFactory
>     [javac]     public TUnionTupleScheme getScheme() {
>     [javac]                              ^
>     [javac]   return type requires unchecked conversion from 
> TUnionTupleScheme to S
>     [javac]   where S is a type-variable:
>     [javac]     S extends IScheme declared in method <S>getScheme()
>     [javac] /tmp/thrift-src/lib/java/src/org/apache/thrift/TUnion.java:261: 
> warning: [unchecked] unchecked assignment to variable setField_ as member of 
> raw type TUnion
>     [javac]       struct.setField_ = null;
>     [javac]             ^
>     [javac] /tmp/thrift-src/lib/java/src/org/apache/thrift/TUnion.java:266: 
> warning: [unchecked] unchecked assignment to variable setField_ as member of 
> raw type TUnion
>     [javac]         struct.setField_ = struct.enumForId(fieldID);
>     [javac]               ^
>     [javac] 
> /tmp/thrift-src/lib/java/src/org/apache/thrift/async/TAsyncMethodCall.java:227:
>  warning: [unchecked] unchecked cast
>     [javac]     callback.onComplete((T)this);
>     [javac]                            ^
>     [javac]   required: T
>     [javac]   found:    TAsyncMethodCall<T>
>     [javac]   where T is a type-variable:
>     [javac]     T extends Object declared in class TAsyncMethodCall
>     [javac] 41 warnings
> {code}
> patches are welcome!
> -roger



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to