commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1697267 - in /commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6: classfile/ generic/ verifier/structurals/
Date Sun, 23 Aug 2015 22:46:13 GMT
On 23 August 2015 at 23:19,  <dbrosius@apache.org> wrote:
> Author: dbrosius
> Date: Sun Aug 23 22:19:04 2015
> New Revision: 1697267
>
> URL: http://svn.apache.org/r1697267
> Log:
> remove the need for casting at the clone() call site

-1

I was hoping to reduce the number of API changes to the minimum, so we
can potentially release a
version that is binary compatible with 5.2.
[Yes, I realise that the interface => class changes will have to be reverted]

Whilst this change is useful if we really must break binary compat, I
would rather it were postponed.

> Modified:
>     commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java
>     commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java
>     commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ClassGen.java
>     commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/CodeExceptionGen.java
>     commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/FieldGenOrMethodGen.java
>     commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LineNumberGen.java
>     commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LocalVariableGen.java
>     commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/LocalVariables.java
>     commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/OperandStack.java
>
> Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java
> URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java?rev=1697267&r1=1697266&r2=1697267&view=diff
> ==============================================================================
> --- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java
(original)
> +++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java
Sun Aug 23 22:19:04 2015
> @@ -306,7 +306,7 @@ public abstract class Attribute implemen
>       * @return shallow copy of this attribute
>       */
>      @Override
> -    public Object clone()
> +    public Attribute clone()
>      {
>          Attribute attr = null;
>          try
>
> Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java
> URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java?rev=1697267&r1=1697266&r2=1697267&view=diff
> ==============================================================================
> --- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java
(original)
> +++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java
Sun Aug 23 22:19:04 2015
> @@ -111,9 +111,9 @@ public abstract class Constant implement
>
>
>      @Override
> -    public Object clone() {
> +    public Constant clone() {
>          try {
> -            return super.clone();
> +            return (Constant) super.clone();
>          } catch (CloneNotSupportedException e) {
>              throw new Error("Clone Not Supported"); // never happens
>          }
>
> Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ClassGen.java
> URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ClassGen.java?rev=1697267&r1=1697266&r2=1697267&view=diff
> ==============================================================================
> --- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ClassGen.java
(original)
> +++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ClassGen.java
Sun Aug 23 22:19:04 2015
> @@ -556,9 +556,9 @@ public class ClassGen extends AccessFlag
>
>
>      @Override
> -    public Object clone() {
> +    public ClassGen clone() {
>          try {
> -            return super.clone();
> +            return (ClassGen) super.clone();
>          } catch (CloneNotSupportedException e) {
>              throw new Error("Clone Not Supported"); // never happens
>          }
>
> Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/CodeExceptionGen.java
> URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/CodeExceptionGen.java?rev=1697267&r1=1697266&r2=1697267&view=diff
> ==============================================================================
> --- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/CodeExceptionGen.java
(original)
> +++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/CodeExceptionGen.java
Sun Aug 23 22:19:04 2015
> @@ -177,9 +177,9 @@ public final class CodeExceptionGen impl
>
>
>      @Override
> -    public Object clone() {
> +    public CodeExceptionGen clone() {
>          try {
> -            return super.clone();
> +            return (CodeExceptionGen) super.clone();
>          } catch (CloneNotSupportedException e) {
>              throw new Error("Clone Not Supported"); // never happens
>          }
>
> Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/FieldGenOrMethodGen.java
> URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/FieldGenOrMethodGen.java?rev=1697267&r1=1697266&r2=1697267&view=diff
> ==============================================================================
> --- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/FieldGenOrMethodGen.java
(original)
> +++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/FieldGenOrMethodGen.java
Sun Aug 23 22:19:04 2015
> @@ -165,9 +165,9 @@ public abstract class FieldGenOrMethodGe
>
>
>      @Override
> -    public Object clone() {
> +    public FieldGenOrMethodGen clone() {
>          try {
> -            return super.clone();
> +            return (FieldGenOrMethodGen) super.clone();
>          } catch (CloneNotSupportedException e) {
>              throw new Error("Clone Not Supported"); // never happens
>          }
>
> Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LineNumberGen.java
> URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LineNumberGen.java?rev=1697267&r1=1697266&r2=1697267&view=diff
> ==============================================================================
> --- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LineNumberGen.java
(original)
> +++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LineNumberGen.java
Sun Aug 23 22:19:04 2015
> @@ -87,9 +87,9 @@ public class LineNumberGen implements In
>
>
>      @Override
> -    public Object clone() {
> +    public LineNumberGen clone() {
>          try {
> -            return super.clone();
> +            return (LineNumberGen) super.clone();
>          } catch (CloneNotSupportedException e) {
>              throw new Error("Clone Not Supported"); // never happens
>          }
>
> Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LocalVariableGen.java
> URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LocalVariableGen.java?rev=1697267&r1=1697266&r2=1697267&view=diff
> ==============================================================================
> --- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LocalVariableGen.java
(original)
> +++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/LocalVariableGen.java
Sun Aug 23 22:19:04 2015
> @@ -216,9 +216,9 @@ public class LocalVariableGen implements
>
>
>      @Override
> -    public Object clone() {
> +    public LocalVariableGen clone() {
>          try {
> -            return super.clone();
> +            return (LocalVariableGen) super.clone();
>          } catch (CloneNotSupportedException e) {
>              throw new Error("Clone Not Supported"); // never happens
>          }
>
> Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/LocalVariables.java
> URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/LocalVariables.java?rev=1697267&r1=1697266&r2=1697267&view=diff
> ==============================================================================
> --- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/LocalVariables.java
(original)
> +++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/LocalVariables.java
Sun Aug 23 22:19:04 2015
> @@ -49,7 +49,7 @@ public class LocalVariables implements C
>       * However, the Type objects in the array are shared.
>       */
>      @Override
> -    public Object clone(){
> +    public LocalVariables clone(){
>          LocalVariables lvs = new LocalVariables(locals.length);
>          for (int i=0; i<locals.length; i++){
>              lvs.locals[i] = this.locals[i];
>
> Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/OperandStack.java
> URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/OperandStack.java?rev=1697267&r1=1697266&r2=1697267&view=diff
> ==============================================================================
> --- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/OperandStack.java
(original)
> +++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/verifier/structurals/OperandStack.java
Sun Aug 23 22:19:04 2015
> @@ -62,12 +62,16 @@ public class OperandStack implements Clo
>       * shared.
>       */
>      @Override
> -    public Object clone(){
> -        OperandStack newstack = new OperandStack(this.maxStack);
> -        @SuppressWarnings("unchecked") // OK because this.stack is the same type
> -        final ArrayList<Type> clone = (ArrayList<Type>) this.stack.clone();
> -        newstack.stack = clone;
> -        return newstack;
> +    public OperandStack clone(){
> +        try {
> +            OperandStack newstack = (OperandStack) super.clone();
> +            @SuppressWarnings("unchecked") // OK because this.stack is the same type
> +            final ArrayList<Type> clone = (ArrayList<Type>) this.stack.clone();
> +            newstack.stack = clone;
> +            return newstack;
> +        } catch (CloneNotSupportedException e) {
> +            throw new Error("Clone Not Supported"); // never happens
> +        }
>      }
>
>      /**
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message