git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274622 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -668,4 +668,17 @@ public abstract class AbstractFileSet extends DataType implements Cloneable, | |||||
| return sb.toString(); | return sb.toString(); | ||||
| } | } | ||||
| /** | |||||
| * @since Ant 1.6 | |||||
| */ | |||||
| public Object clone() { | |||||
| try { | |||||
| AbstractFileSet fs = (AbstractFileSet) super.clone(); | |||||
| fs.setProject(getProject()); | |||||
| return fs; | |||||
| } catch (CloneNotSupportedException e) { | |||||
| throw new BuildException(e); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -427,10 +427,13 @@ public class Commandline implements Cloneable { | |||||
| } | } | ||||
| public Object clone() { | public Object clone() { | ||||
| Commandline c = new Commandline(); | |||||
| c.setExecutable(executable); | |||||
| c.addArguments(getArguments()); | |||||
| return c; | |||||
| try { | |||||
| Commandline c = (Commandline) super.clone(); | |||||
| c.arguments = (Vector) arguments.clone(); | |||||
| return c; | |||||
| } catch (CloneNotSupportedException e) { | |||||
| throw new BuildException(e); | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -440,20 +440,21 @@ public class CommandlineJava implements Cloneable { | |||||
| * @return a CommandlineJava object | * @return a CommandlineJava object | ||||
| */ | */ | ||||
| public Object clone() { | public Object clone() { | ||||
| CommandlineJava c = new CommandlineJava(); | |||||
| c.vmCommand = (Commandline) vmCommand.clone(); | |||||
| c.javaCommand = (Commandline) javaCommand.clone(); | |||||
| c.sysProperties = (SysProperties) sysProperties.clone(); | |||||
| c.maxMemory = maxMemory; | |||||
| if (classpath != null) { | |||||
| c.classpath = (Path) classpath.clone(); | |||||
| } | |||||
| if (bootclasspath != null) { | |||||
| c.bootclasspath = (Path) bootclasspath.clone(); | |||||
| try { | |||||
| CommandlineJava c = (CommandlineJava) super.clone(); | |||||
| c.vmCommand = (Commandline) vmCommand.clone(); | |||||
| c.javaCommand = (Commandline) javaCommand.clone(); | |||||
| c.sysProperties = (SysProperties) sysProperties.clone(); | |||||
| if (classpath != null) { | |||||
| c.classpath = (Path) classpath.clone(); | |||||
| } | |||||
| if (bootclasspath != null) { | |||||
| c.bootclasspath = (Path) bootclasspath.clone(); | |||||
| } | |||||
| return c; | |||||
| } catch (CloneNotSupportedException e) { | |||||
| throw new BuildException(e); | |||||
| } | } | ||||
| c.vmVersion = vmVersion; | |||||
| c.executeJar = executeJar; | |||||
| return c; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2002 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2002-2003 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -76,9 +76,9 @@ public class DirSet extends AbstractFileSet { | |||||
| */ | */ | ||||
| public Object clone() { | public Object clone() { | ||||
| if (isReference()) { | if (isReference()) { | ||||
| return new DirSet((DirSet) getRef(getProject())); | |||||
| return ((DirSet) getRef(getProject())).clone(); | |||||
| } else { | } else { | ||||
| return new DirSet(this); | |||||
| return super.clone(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
| * | * | ||||
| * Copyright (c) 2000-2002 The Apache Software Foundation. All rights | |||||
| * Copyright (c) 2000-2003 The Apache Software Foundation. All rights | |||||
| * reserved. | * reserved. | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
| @@ -81,9 +81,9 @@ public class FileSet extends AbstractFileSet { | |||||
| */ | */ | ||||
| public Object clone() { | public Object clone() { | ||||
| if (isReference()) { | if (isReference()) { | ||||
| return new FileSet((FileSet) getRef(getProject())); | |||||
| return ((FileSet) getRef(getProject())).clone(); | |||||
| } else { | } else { | ||||
| return new FileSet(this); | |||||
| return super.clone(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -487,9 +487,16 @@ public class FilterSet extends DataType implements Cloneable { | |||||
| public Object clone() throws BuildException { | public Object clone() throws BuildException { | ||||
| if (isReference()) { | if (isReference()) { | ||||
| return new FilterSet(getRef()); | |||||
| return ((FilterSet) getRef()).clone(); | |||||
| } else { | } else { | ||||
| return new FilterSet(this); | |||||
| try { | |||||
| FilterSet fs = (FilterSet) super.clone(); | |||||
| fs.filters = (Vector) getFilters().clone(); | |||||
| fs.setProject(getProject()); | |||||
| return fs; | |||||
| } catch (CloneNotSupportedException e) { | |||||
| throw new BuildException(e); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -457,9 +457,13 @@ public class Path extends DataType implements Cloneable { | |||||
| * Return a Path that holds the same elements as this instance. | * Return a Path that holds the same elements as this instance. | ||||
| */ | */ | ||||
| public Object clone() { | public Object clone() { | ||||
| Path p = new Path(getProject()); | |||||
| p.append(this); | |||||
| return p; | |||||
| try { | |||||
| Path p = (Path) super.clone(); | |||||
| p.elements = (Vector) elements.clone(); | |||||
| return p; | |||||
| } catch (CloneNotSupportedException e) { | |||||
| throw new BuildException(e); | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -310,9 +310,9 @@ public class ZipFileSet extends FileSet { | |||||
| */ | */ | ||||
| public Object clone() { | public Object clone() { | ||||
| if (isReference()) { | if (isReference()) { | ||||
| return new ZipFileSet((ZipFileSet) getRef(getProject())); | |||||
| return ((ZipFileSet) getRef(getProject())).clone(); | |||||
| } else { | } else { | ||||
| return new ZipFileSet(this); | |||||
| return super.clone(); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||