Browse Source

Undo Java 8 refactoring changes of clone() method signature (relates to commit b7d1e9bde4)

master
Jaikiran Pai 7 years ago
parent
commit
2e78884913
28 changed files with 47 additions and 47 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
  2. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Chmod.java
  3. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Delete.java
  4. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  5. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/Manifest.java
  6. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Patch.java
  7. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Zip.java
  8. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  9. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java
  10. +3
    -3
      src/main/org/apache/tools/ant/types/AbstractFileSet.java
  11. +2
    -2
      src/main/org/apache/tools/ant/types/ArchiveFileSet.java
  12. +1
    -1
      src/main/org/apache/tools/ant/types/Commandline.java
  13. +1
    -1
      src/main/org/apache/tools/ant/types/CommandlineJava.java
  14. +2
    -2
      src/main/org/apache/tools/ant/types/DirSet.java
  15. +2
    -2
      src/main/org/apache/tools/ant/types/FileSet.java
  16. +1
    -1
      src/main/org/apache/tools/ant/types/PatternSet.java
  17. +2
    -2
      src/main/org/apache/tools/ant/types/Resource.java
  18. +2
    -2
      src/main/org/apache/tools/ant/types/TarFileSet.java
  19. +2
    -2
      src/main/org/apache/tools/ant/types/ZipFileSet.java
  20. +1
    -1
      src/main/org/apache/tools/ant/types/optional/depend/ClassfileSet.java
  21. +1
    -1
      src/main/org/apache/tools/ant/types/resources/Archives.java
  22. +1
    -1
      src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java
  23. +1
    -1
      src/main/org/apache/tools/ant/types/resources/Files.java
  24. +1
    -1
      src/main/org/apache/tools/ant/types/resources/MappedResourceCollection.java
  25. +1
    -1
      src/main/org/apache/tools/ant/types/resources/MultiRootFileSet.java
  26. +2
    -2
      src/main/org/apache/tools/ant/types/selectors/AbstractSelectorContainer.java
  27. +5
    -5
      src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
  28. +1
    -1
      src/main/org/apache/tools/ant/util/VectorSet.java

+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java View File

@@ -399,7 +399,7 @@ public abstract class AbstractCvsTask extends Task {
String c = this.getCommand();
Commandline cloned = null;
if (c != null) {
cloned = cmd.clone();
cloned = (Commandline) cmd.clone();
cloned.createArgument(true).setLine(c);
this.addConfiguredCommandline(cloned, true);
}


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Chmod.java View File

@@ -192,7 +192,7 @@ public class Chmod extends ExecuteOn {
} else if (isValidOs()) {
// we are chmodding the given directory
Execute execute = prepareExec();
Commandline cloned = cmdl.clone();
Commandline cloned = (Commandline) cmdl.clone();
cloned.createArgument().setValue(defaultSet.getDir(getProject())
.getPath());
try {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Delete.java View File

@@ -668,7 +668,7 @@ public class Delete extends MatchingTask {
if (fs.getProject() == null) {
log("Deleting fileset with no project specified; assuming executing project",
Project.MSG_VERBOSE);
fs = fs.clone();
fs = (FileSet) fs.clone();
fs.setProject(getProject());
}
final File fsDir = fs.getDir();


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Javadoc.java View File

@@ -1721,7 +1721,7 @@ public class Javadoc extends Task {

log("Generating Javadoc", Project.MSG_INFO);

final Commandline toExecute = cmd.clone();
final Commandline toExecute = (Commandline) cmd.clone();
if (executable != null) {
toExecute.setExecutable(executable);
} else {
@@ -2311,7 +2311,7 @@ public class Javadoc extends Task {
if (rc instanceof FileSet) {
final FileSet fs = (FileSet) rc;
if (!fs.hasPatterns() && !fs.hasSelectors()) {
final FileSet fs2 = fs.clone();
final FileSet fs2 = (FileSet) fs.clone();
fs2.createInclude().setName("**/*.java");
if (includeNoSourcePackages) {
fs2.createInclude().setName("**/package.html");


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/Manifest.java View File

@@ -701,7 +701,7 @@ public class Manifest {
* @since Ant 1.5.2
*/
@Override
public Section clone() {
public Object clone() {
Section cloned = new Section();
cloned.setName(name);
Enumeration<String> e = getAttributeKeys();
@@ -954,7 +954,7 @@ public class Manifest {
throws ManifestException {
if (other != null) {
if (overwriteMain) {
mainSection = other.mainSection.clone();
mainSection = (Section) other.mainSection.clone();
} else {
mainSection.merge(other.mainSection, mergeClassPaths);
}
@@ -971,7 +971,7 @@ public class Manifest {
= other.sections.get(sectionName);
if (ourSection == null) {
if (otherSection != null) {
addConfiguredSection(otherSection.clone());
addConfiguredSection((Section) otherSection.clone());
}
} else {
ourSection.merge(otherSection, mergeClassPaths);


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Patch.java View File

@@ -171,7 +171,7 @@ public class Patch extends Task {
throw new BuildException("patchfile argument is required",
getLocation());
}
Commandline toExecute = cmd.clone();
Commandline toExecute = (Commandline) cmd.clone();
toExecute.setExecutable(PATCH);

if (originalFile != null) {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Zip.java View File

@@ -659,7 +659,7 @@ public class Zip extends MatchingTask {
// collect filesets to pass them to getResourcesToAdd
final List<ResourceCollection> vfss = new ArrayList<>();
if (baseDir != null) {
final FileSet fs = getImplicitFileSet().clone();
final FileSet fs = (FileSet) getImplicitFileSet().clone();
fs.setDir(baseDir);
vfss.add(fs);
}


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -1022,7 +1022,7 @@ public class JUnitTask extends Task {
protected void execute(final JUnitTest arg, final int thread) throws BuildException {
validateTestName(arg.getName());

final JUnitTest test = arg.clone();
final JUnitTest test = (JUnitTest) arg.clone();
test.setThread(thread);

// set the default values if not specified
@@ -1165,7 +1165,7 @@ public class JUnitTask extends Task {

CommandlineJava cmd;
try {
cmd = getCommandline().clone();
cmd = (CommandlineJava) getCommandline().clone();
} catch (final CloneNotSupportedException e) {
throw new BuildException("This shouldn't happen", e, getLocation());
}
@@ -1563,7 +1563,7 @@ public class JUnitTask extends Task {
setupJUnitDelegate();
}

final JUnitTest test = arg.clone();
final JUnitTest test = (JUnitTest) arg.clone();
test.setProperties(getProject().getProperties());
if (dir != null) {
log("dir attribute ignored if running in the same VM",
@@ -2337,7 +2337,7 @@ public class JUnitTask extends Task {
* @see "https://issues.apache.org/bugzilla/show_bug.cgi?id=45227"
*/
private static JUnitTest createDummyTestForBatchTest(final JUnitTest test) {
final JUnitTest t = test.clone();
final JUnitTest t = (JUnitTest) test.clone();
final int index = test.getName().lastIndexOf('.');
// make sure test looks as if it was in the same "package" as
// the last test of the batch


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java View File

@@ -525,7 +525,7 @@ public class JUnitTest extends BaseTest implements Cloneable {
*/
@SuppressWarnings("unchecked")
@Override
public JUnitTest clone() {
public Object clone() {
try {
JUnitTest t = (JUnitTest) super.clone();
t.props = props == null ? null : (Properties) props.clone();


+ 3
- 3
src/main/org/apache/tools/ant/types/AbstractFileSet.java View File

@@ -898,13 +898,13 @@ public abstract class AbstractFileSet extends DataType
* @since Ant 1.6
*/
@Override
public synchronized AbstractFileSet clone() {
public synchronized Object clone() {
if (isReference()) {
return (getRef(getProject())).clone();
}
try {
AbstractFileSet fs = (AbstractFileSet) super.clone();
fs.defaultPatterns = defaultPatterns.clone();
fs.defaultPatterns = (PatternSet) defaultPatterns.clone();
fs.additionalPatterns = additionalPatterns.stream().map(
PatternSet::clone).map(PatternSet.class::cast).collect(Collectors.toList());
fs.selectors = new ArrayList<>(selectors);
@@ -951,7 +951,7 @@ public abstract class AbstractFileSet extends DataType
return getRef(p).mergePatterns(p);
}
dieOnCircularReference();
PatternSet ps = defaultPatterns.clone();
PatternSet ps = (PatternSet) defaultPatterns.clone();
additionalPatterns.forEach(pat -> ps.append(pat, p));
return ps;
}


+ 2
- 2
src/main/org/apache/tools/ant/types/ArchiveFileSet.java View File

@@ -505,12 +505,12 @@ public abstract class ArchiveFileSet extends FileSet {
* @since Ant 1.6
*/
@Override
public ArchiveFileSet clone() {
public Object clone() {
if (isReference()) {
return getCheckedRef(ArchiveFileSet.class, getDataTypeName(),
getProject()).clone();
}
return (ArchiveFileSet) super.clone();
return super.clone();
}

/**


+ 1
- 1
src/main/org/apache/tools/ant/types/Commandline.java View File

@@ -550,7 +550,7 @@ public class Commandline implements Cloneable {
* @return a clone of the contained object
*/
@Override
public Commandline clone() {
public Object clone() {
try {
Commandline c = (Commandline) super.clone();
c.arguments = new ArrayList<>(arguments);


+ 1
- 1
src/main/org/apache/tools/ant/types/CommandlineJava.java View File

@@ -720,7 +720,7 @@ public class CommandlineJava implements Cloneable {
* @throws CloneNotSupportedException never.
*/
@Override
public CommandlineJava clone() throws CloneNotSupportedException {
public Object clone() throws CloneNotSupportedException {
try {
CommandlineJava c = (CommandlineJava) super.clone();
c.vmCommand = (Commandline) vmCommand.clone();


+ 2
- 2
src/main/org/apache/tools/ant/types/DirSet.java View File

@@ -54,11 +54,11 @@ public class DirSet extends AbstractFileSet implements ResourceCollection {
* @return the cloned dirset.
*/
@Override
public DirSet clone() {
public Object clone() {
if (isReference()) {
return ((DirSet) getRef(getProject())).clone();
}
return (DirSet) super.clone();
return super.clone();
}

/**


+ 2
- 2
src/main/org/apache/tools/ant/types/FileSet.java View File

@@ -50,11 +50,11 @@ public class FileSet extends AbstractFileSet implements ResourceCollection {
* @return the cloned fileset
*/
@Override
public FileSet clone() {
public Object clone() {
if (isReference()) {
return ((FileSet) getRef(getProject())).clone();
}
return (FileSet) super.clone();
return super.clone();
}

/**


+ 1
- 1
src/main/org/apache/tools/ant/types/PatternSet.java View File

@@ -513,7 +513,7 @@ public class PatternSet extends DataType implements Cloneable {
* @return a clone of this patternset.
*/
@Override
public PatternSet clone() {
public Object clone() {
try {
PatternSet ps = (PatternSet) super.clone();
ps.includeList = new ArrayList<>(includeList);


+ 2
- 2
src/main/org/apache/tools/ant/types/Resource.java View File

@@ -256,9 +256,9 @@ public class Resource extends DataType implements Comparable<Resource>, Resource
* @return copy of this.
*/
@Override
public Resource clone() {
public Object clone() {
try {
return (Resource) super.clone();
return super.clone();
} catch (CloneNotSupportedException e) {
throw new UnsupportedOperationException(
"CloneNotSupportedException for a Resource caught. Derived classes must support cloning.");


+ 2
- 2
src/main/org/apache/tools/ant/types/TarFileSet.java View File

@@ -247,11 +247,11 @@ public class TarFileSet extends ArchiveFileSet {
* @return the cloned tarFileSet
*/
@Override
public TarFileSet clone() {
public Object clone() {
if (isReference()) {
return ((TarFileSet) getRef(getProject())).clone();
}
return (TarFileSet) super.clone();
return super.clone();
}

/**


+ 2
- 2
src/main/org/apache/tools/ant/types/ZipFileSet.java View File

@@ -93,11 +93,11 @@ public class ZipFileSet extends ArchiveFileSet {
* @return the cloned zipFileSet
*/
@Override
public ZipFileSet clone() {
public Object clone() {
if (isReference()) {
return ((ZipFileSet) getRef(getProject())).clone();
}
return (ZipFileSet) super.clone();
return super.clone();
}

}

+ 1
- 1
src/main/org/apache/tools/ant/types/optional/depend/ClassfileSet.java View File

@@ -162,7 +162,7 @@ public class ClassfileSet extends FileSet {
* @return a clone of the class file set.
*/
@Override
public ClassfileSet clone() {
public Object clone() {
return new ClassfileSet(isReference()
? (ClassfileSet) (getRef(getProject())) : this);
}


+ 1
- 1
src/main/org/apache/tools/ant/types/resources/Archives.java View File

@@ -134,7 +134,7 @@ public class Archives extends DataType
* @return a cloned instance.
*/
@Override
public Archives clone() {
public Object clone() {
try {
final Archives a = (Archives) super.clone();
a.zips = (Union) zips.clone();


+ 1
- 1
src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java View File

@@ -221,7 +221,7 @@ public abstract class BaseResourceCollectionContainer
* @return a cloned instance.
*/
@Override
public BaseResourceCollectionContainer clone() {
public Object clone() {
try {
BaseResourceCollectionContainer c
= (BaseResourceCollectionContainer) super.clone();


+ 1
- 1
src/main/org/apache/tools/ant/types/resources/Files.java View File

@@ -392,7 +392,7 @@ public class Files extends AbstractSelectorContainer
* @return a cloned Object.
*/
@Override
public synchronized Files clone() {
public synchronized Object clone() {
if (isReference()) {
return getRef().clone();
}


+ 1
- 1
src/main/org/apache/tools/ant/types/resources/MappedResourceCollection.java View File

@@ -174,7 +174,7 @@ public class MappedResourceCollection
* @return a cloned instance.
*/
@Override
public MappedResourceCollection clone() {
public Object clone() {
try {
MappedResourceCollection c =
(MappedResourceCollection) super.clone();


+ 1
- 1
src/main/org/apache/tools/ant/types/resources/MultiRootFileSet.java View File

@@ -112,7 +112,7 @@ public class MultiRootFileSet extends AbstractFileSet
* @return the cloned MultiRootFileSet.
*/
@Override
public MultiRootFileSet clone() {
public Object clone() {
if (isReference()) {
return ((MultiRootFileSet) getRef(getProject())).clone();
}


+ 2
- 2
src/main/org/apache/tools/ant/types/selectors/AbstractSelectorContainer.java View File

@@ -349,9 +349,9 @@ public abstract class AbstractSelectorContainer extends DataType
}
}

public synchronized AbstractSelectorContainer clone() {
public synchronized Object clone() {
if (isReference()) {
return getCheckedRef().clone();
return ((AbstractSelectorContainer) getCheckedRef()).clone();
}
try {
AbstractSelectorContainer sc =


+ 5
- 5
src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java View File

@@ -212,7 +212,7 @@ public class LayoutPreservingProperties extends Properties {
}

@Override
public LayoutPreservingProperties clone() {
public Object clone() {
final LayoutPreservingProperties dolly =
(LayoutPreservingProperties) super.clone();
dolly.keyedPairLines = new HashMap<>(this.keyedPairLines);
@@ -222,7 +222,7 @@ public class LayoutPreservingProperties extends Properties {
final LogicalLine line = dolly.logicalLines.get(j);
if (line instanceof Pair) {
final Pair p = (Pair) line;
dolly.logicalLines.set(j, p.clone());
dolly.logicalLines.set(j, (Pair) p.clone());
}
// no reason to clone other lines are they are immutable
}
@@ -705,10 +705,10 @@ public class LayoutPreservingProperties extends Properties {
}

@Override
public Pair clone() {
Pair dolly = null;
public Object clone() {
Object dolly = null;
try {
dolly = (Pair) super.clone();
dolly = super.clone();
} catch (final CloneNotSupportedException e) {
// should be fine
e.printStackTrace(); //NOSONAR


+ 1
- 1
src/main/org/apache/tools/ant/util/VectorSet.java View File

@@ -142,7 +142,7 @@ public final class VectorSet<E> extends Vector<E> {
}

@Override
public VectorSet<E> clone() {
public Object clone() {
@SuppressWarnings("unchecked")
final VectorSet<E> vs = (VectorSet<E>) super.clone();
vs.set.addAll(set);


Loading…
Cancel
Save