diff options
42 files changed, 2162 insertions, 524 deletions
diff --git a/.gitignore b/.gitignore index 8aefe0104..a3344aa9f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,8 @@ */bin +.vscode +.DS_Store aj-build/ +target/ +.classpath +.project +.settings diff --git a/ajde/src/main/java/org/aspectj/ajde/IconRegistry.java b/ajde/src/main/java/org/aspectj/ajde/IconRegistry.java index 4cdec89f2..c5a2202ec 100644 --- a/ajde/src/main/java/org/aspectj/ajde/IconRegistry.java +++ b/ajde/src/main/java/org/aspectj/ajde/IconRegistry.java @@ -14,6 +14,8 @@ package org.aspectj.ajde; +import java.net.URL; + import javax.swing.*; import org.aspectj.ajde.ui.*; @@ -149,10 +151,16 @@ public class IconRegistry extends AbstractIconRegistry { } protected AbstractIcon createIcon(String path) { - return new AbstractIcon(new ImageIcon(ClassLoader.getSystemResource(path))); + URL resource = IconRegistry.class.getClassLoader().getResource(path); + if (resource == null) { + throw new IllegalStateException("Unable to find icon resource: "+path); + } + return new AbstractIcon(new ImageIcon(resource)); +// return new AbstractIcon(new ImageIcon(ClassLoader.getSystemResource(path))); } protected Icon makeIcon(String iconPath) { - return new ImageIcon(ClassLoader.getSystemResource(RESOURCE_PATH + iconPath)); + return new ImageIcon(IconRegistry.class.getClassLoader().getResource(RESOURCE_PATH + iconPath)); +// return new ImageIcon(ClassLoader.getSystemResource(RESOURCE_PATH + iconPath)); } } diff --git a/build/installer-resources/properties.txt b/build/installer-resources/properties.txt deleted file mode 100644 index f2ee1b595..000000000 --- a/build/installer-resources/properties.txt +++ /dev/null @@ -1,7 +0,0 @@ -installer.main.class: @installer.main.class@ -installer.basedir: aspectj@build.version.majorminor@ -build.version.long: @build.version.long@ -build.version.short: @build.version.short@ -build.date: @build.date@ -build.time: @build.time@ -copyright.allRights.from1998: @copyright.allRights.from1998@ diff --git a/build/pom.xml b/build/pom.xml index 5dcf70b71..0099d02a0 100644 --- a/build/pom.xml +++ b/build/pom.xml @@ -1,33 +1,125 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.aspectj</groupId> - <artifactId>aspectj-parent</artifactId> - <version>1.9.3.BUILD-SNAPSHOT</version> - <relativePath>..</relativePath> - </parent> + <parent> + <groupId>org.aspectj</groupId> + <artifactId>aspectj-parent</artifactId> + <version>1.9.3.BUILD-SNAPSHOT</version> + <relativePath>..</relativePath> + </parent> - <artifactId>build</artifactId> - <packaging>jar</packaging> - <name>build</name> + <artifactId>build</artifactId> + <packaging>jar</packaging> + <name>build</name> - <dependencies> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>testing-util</artifactId> - <version>${project.version}</version> - </dependency> + <dependencies> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>testing-util</artifactId> + <version>${project.version}</version> + </dependency> - <dependency> - <groupId>ant</groupId> - <artifactId>ant</artifactId> - <version>1.0</version> - <scope>system</scope> - <systemPath>${project.basedir}/../lib/ant/lib/ant.jar</systemPath> - </dependency> - </dependencies> + <dependency> + <groupId>ant</groupId> + <artifactId>ant</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/../lib/ant/lib/ant.jar</systemPath> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.9.1</version> + <executions> + <execution> + <id>build.date</id> + <goals> + <goal>timestamp-property</goal> + </goals> + <configuration> + <name>build.date</name> + <pattern>E MMM d, YYYY</pattern> + <timeZone>Europe/Zurich</timeZone> + <!-- build.date: Monday Feb 4, 2019 --> + <timeZone>America/Los_Angeles</timeZone> + </configuration> + </execution> + <execution> + <id>build.time</id> + <goals> + <goal>timestamp-property</goal> + </goals> + <configuration> + <name>build.time</name> + <pattern>E MMM d, YYYY 'at' HH:MM:SS z</pattern> + <timeZone>America/Los_Angeles</timeZone> + <!-- build.time: Monday Feb 4, 2019 at 23:50:25 GMT --> + </configuration> + </execution> + <execution> + <id>year</id> + <goals> + <goal>timestamp-property</goal> + </goals> + <configuration> + <name>build.year</name> + <pattern>YYYY</pattern> + <timeZone>America/Los_Angeles</timeZone> + <!-- year: 2019 --> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + </resources> + <pluginManagement> + <plugins> + <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId> + org.codehaus.mojo + </groupId> + <artifactId> + build-helper-maven-plugin + </artifactId> + <versionRange> + [1.9.1,) + </versionRange> + <goals> + <goal> + timestamp-property + </goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore></ignore> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> </project> diff --git a/build/installer-resources/aspectjBanner.gif b/build/src/main/resources/$installer$/org/aspectj/resources/aspectjBanner.gif Binary files differindex 0a943c343..0a943c343 100644 --- a/build/installer-resources/aspectjBanner.gif +++ b/build/src/main/resources/$installer$/org/aspectj/resources/aspectjBanner.gif diff --git a/build/src/main/resources/$installer$/org/aspectj/resources/configure-auto.html b/build/src/main/resources/$installer$/org/aspectj/resources/configure-auto.html new file mode 100644 index 000000000..6da643ef5 --- /dev/null +++ b/build/src/main/resources/$installer$/org/aspectj/resources/configure-auto.html @@ -0,0 +1,17 @@ +<html> + +<head> +<title>auto configure</title> +</head> + +<body> + +<p>The installer has successfully found the path to your Java home (J2SE 1.4 or greater). +This path will be used as the default Java location when generating +script files for launching the AspectJ compiler and core tools. Unless +you know that this path is wrong, we suggest that you press +<b>Next</b> to continue.</p> + +</body> + +</html> diff --git a/build/src/main/resources/$installer$/org/aspectj/resources/configure-hand.html b/build/src/main/resources/$installer$/org/aspectj/resources/configure-hand.html new file mode 100644 index 000000000..888db63df --- /dev/null +++ b/build/src/main/resources/$installer$/org/aspectj/resources/configure-hand.html @@ -0,0 +1,21 @@ +<html> + +<head> +<title>configure</title> +</head> + +<body> + +<p>The installer cannot find the path to your Java home (J2SE 1.4 or greater). +Please try to find this directory on your path now. It will probably look +something like <code>jdk1.4.1</code>. If you can't find this +directory now, you may continue with the install, but you will have +to either edit your launch scripts by hand or to set the JAVA_HOME +environment variable to point to the right location. +</p> + +<p>Press <b>Next</b> when ready to continue.</p> + +</body> + +</html> diff --git a/build/installer-resources/contents.txt b/build/src/main/resources/$installer$/org/aspectj/resources/contents.txt index 275d2b4ff..275d2b4ff 100644 --- a/build/installer-resources/contents.txt +++ b/build/src/main/resources/$installer$/org/aspectj/resources/contents.txt diff --git a/build/src/main/resources/$installer$/org/aspectj/resources/finish.html b/build/src/main/resources/$installer$/org/aspectj/resources/finish.html new file mode 100644 index 000000000..204deb550 --- /dev/null +++ b/build/src/main/resources/$installer$/org/aspectj/resources/finish.html @@ -0,0 +1,28 @@ +<html> + +<head> +<title>finish</title> +</head> + +<body> + +<p>The automatic installation process is complete. +We recommend you complete the installation as follows:</p> +<ol> + <li>Add <b><code>${installer.output.aspectjrt}</code></b> + to your CLASSPATH. + This small .jar file contains classes required by any + program compiled with the ajc compiler. + </li> + <li>Modify your PATH to include + <code> <b>${installer.output.dir.bin}</b></code>. + This will make it easier to run ajc and ajbrowser. + </li> +</ol> + +<p>These steps are described in more detail in <code> +<b>${installer.output.readme}</b></code>.</p> + +</body> + +</html> diff --git a/build/src/main/resources/$installer$/org/aspectj/resources/install-finish.html b/build/src/main/resources/$installer$/org/aspectj/resources/install-finish.html new file mode 100644 index 000000000..14281a0bf --- /dev/null +++ b/build/src/main/resources/$installer$/org/aspectj/resources/install-finish.html @@ -0,0 +1,12 @@ +<html> + +<body> + +<p> </p> + +<p>The automatic installation process is complete. Press <b>Next </b>for +some important final instructions.</p> + +</body> + +</html> diff --git a/build/src/main/resources/$installer$/org/aspectj/resources/install-start.html b/build/src/main/resources/$installer$/org/aspectj/resources/install-start.html new file mode 100644 index 000000000..b375c68aa --- /dev/null +++ b/build/src/main/resources/$installer$/org/aspectj/resources/install-start.html @@ -0,0 +1,13 @@ +<html> + +<body> + +<p> </p> + +<p>Now installing to ${installer.output.dir}...</p> + +<p>Press <b>Cancel</b> to interrupt the installation.</p> + +</body> + +</html> diff --git a/build/src/main/resources/$installer$/org/aspectj/resources/intro.html b/build/src/main/resources/$installer$/org/aspectj/resources/intro.html new file mode 100644 index 000000000..b29bb9484 --- /dev/null +++ b/build/src/main/resources/$installer$/org/aspectj/resources/intro.html @@ -0,0 +1,25 @@ +<html> +<body> + +<h2 align="center">Installer for AspectJ 9 Development Kit<sup><small>TM</small></sup></h2> + +<p align="center">Version ${build.version.long} built on ${build.date}</p> +<p>This installs the complete AspectJ 9 Development Kit (AJDK) distribution, with +the compiler, aspect libraries, structure browser, ant tasks, +documentation, and examples. +This distribution is covered by the Eclipse Public License (see + http://www.eclipse.org/legal/epl-v10.html). +<p> +For IDE integrations or source code, see the project home page at +http://eclipse.org/aspectj</p> + + +<p>${copyright.allRights.from1998}</p> +<p></p> + +<p>Press <b>Next</b> to continue. At any time you may press <b>Cancel</b> +to exit the installation process.</p> + +</body> + +</html> diff --git a/build/src/main/resources/$installer$/org/aspectj/resources/location.html b/build/src/main/resources/$installer$/org/aspectj/resources/location.html new file mode 100644 index 000000000..0398ce4a5 --- /dev/null +++ b/build/src/main/resources/$installer$/org/aspectj/resources/location.html @@ -0,0 +1,11 @@ +<html> + +<body> + +<p>Please select a directory into which to install AspectJ.</p> +<p>Press <b>Install</b> to begin the installation process + to this directory.</p> + +</body> + +</html> diff --git a/build/src/main/resources/$installer$/org/aspectj/resources/properties.txt b/build/src/main/resources/$installer$/org/aspectj/resources/properties.txt new file mode 100644 index 000000000..f3abaf4f4 --- /dev/null +++ b/build/src/main/resources/$installer$/org/aspectj/resources/properties.txt @@ -0,0 +1,7 @@ +installer.main.class: $installer$.org.aspectj.ToolsInstaller +installer.basedir: aspectj${build.version.majorminor} +build.version.long: ${project.version} +build.version.short: ${project.version} +build.date: ${build.date} +build.time: ${build.time} +copyright.allRights.from1998: Copyright (c) 1998-2001 Xerox Corporation, 2002 Palo Alto Research Center, Incorporated, 2003-${build.year} Contributors. All rights reserved. diff --git a/description b/description deleted file mode 100644 index f58083e11..000000000 --- a/description +++ /dev/null @@ -1 +0,0 @@ -Main AspectJ modules (for matcher/weaver/etc) diff --git a/docs/.classpath b/docs/.classpath deleted file mode 100644 index 6b2a02da9..000000000 --- a/docs/.classpath +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/docs/build.xml b/docs/build.xml index 8b7c8812c..0ab8c562d 100644 --- a/docs/build.xml +++ b/docs/build.xml @@ -56,7 +56,7 @@ <!-- must specify (not *.gif) to not delete other gifs during build-in-place --> <!-- to find refs: gp ax imagedata | sed -n 's|.*\=\"\(..*\)\".*|\1|p' --> <property name="devguide.icons.dir" - location="${aspectj.modules.dir}/ajde/src/org/aspectj/ajde/resources/actions" + location="${aspectj.modules.dir}/ajde/src/main/resources/org/aspectj/ajde/resources/actions" /> <property name="include.devguide.icons" value="build.gif,openConfig.gif,browseroptions.gif" @@ -203,9 +203,12 @@ </target> <target name="do-local-dist" - depends="init,init-filters,api,faq,devguide,progguide, adk15guide, pdguide" + depends="init,init-filters,faq,devguide,progguide, adk15guide, pdguide" description="finish products by copying dist files and library sources" > +<!-- + depends="init,init-filters,api,faq,devguide,progguide, adk15guide, pdguide" +--> <copy todir="${docs.dist.dir}" filtering="on"> <fileset dir="${docs.src.dir}/dist" diff --git a/installer/aspectjinstaller-assembly.xml b/installer/aspectjinstaller-assembly.xml new file mode 100644 index 000000000..2927dd618 --- /dev/null +++ b/installer/aspectjinstaller-assembly.xml @@ -0,0 +1,49 @@ +<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd"> + + <id>aspectjinstaller</id> + <formats> + <format>jar</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>../build/target/classes</directory> + <outputDirectory>.</outputDirectory> + <excludes> + <exclude>org/**</exclude> + </excludes> + </fileSet> + <fileSet> + <directory>../aj-build/dist/docs</directory> + <outputDirectory>files</outputDirectory> + </fileSet> + + <fileSet> + <directory>../runtime/target/site/apidocs</directory> + <outputDirectory>files/doc/runtime-apidocs</outputDirectory> + </fileSet> + </fileSets> + + <files> + <file> + <source>../aspectjrt/target/aspectjrt-${project.version}.jar</source> + <outputDirectory>files/lib</outputDirectory> + <destName>aspectjrt.jar</destName> + </file> + <file> + <source>../aspectjweaver/target/aspectjweaver-${project.version}.jar</source> + <outputDirectory>files/lib</outputDirectory> + <destName>aspectjweaver.jar</destName> + </file> + <file> + <source>../aspectjtools/target/aspectjtools-${project.version}.jar</source> + <outputDirectory>files/lib</outputDirectory> + <destName>aspectjtools.jar</destName> + </file> + </files> + +</assembly> + diff --git a/installer/pom.xml b/installer/pom.xml new file mode 100644 index 000000000..61c94c054 --- /dev/null +++ b/installer/pom.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.aspectj</groupId> + <artifactId>aspectj-parent</artifactId> + <version>1.9.3.BUILD-SNAPSHOT</version> + </parent> + + <artifactId>installer</artifactId> + <packaging>pom</packaging> + <name>AspectJ Intaller</name> + + <dependencies> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>run-all-junit-tests</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <!-- skip creation of test-jar in here --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <executions> + <execution> + <id>test-jar</id> + <phase></phase> + </execution> + </executions> + </plugin> + + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>aspectjinstaller-assembly</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <finalName>aspectj-${project.version}</finalName> + <appendAssemblyId>false</appendAssemblyId> + <archive> + <manifestEntries> + <Main-Class>$installer$.org.aspectj.Main</Main-Class> + </manifestEntries> + </archive> + <descriptors> + <descriptor>aspectjinstaller-assembly.xml</descriptor> + </descriptors> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/java5/.project b/java5/.project deleted file mode 100644 index 5d08fe544..000000000 --- a/java5/.project +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>java5</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - </buildSpec> - <natures> - </natures> -</projectDescription> diff --git a/lib/jdiff/jdiff/text/FileLine.class b/lib/jdiff/jdiff/text/FileLine.class Binary files differnew file mode 100644 index 000000000..18015ba26 --- /dev/null +++ b/lib/jdiff/jdiff/text/FileLine.class diff --git a/lib/jdiff/jdiff/util/Diff$change.class b/lib/jdiff/jdiff/util/Diff$change.class Binary files differnew file mode 100644 index 000000000..97de44bf8 --- /dev/null +++ b/lib/jdiff/jdiff/util/Diff$change.class diff --git a/lib/jdiff/jdiff/util/Diff$file_data.class b/lib/jdiff/jdiff/util/Diff$file_data.class Binary files differnew file mode 100644 index 000000000..883d1bfee --- /dev/null +++ b/lib/jdiff/jdiff/util/Diff$file_data.class diff --git a/lib/jdiff/jdiff/util/Diff.class b/lib/jdiff/jdiff/util/Diff.class Binary files differnew file mode 100644 index 000000000..083f3c59b --- /dev/null +++ b/lib/jdiff/jdiff/util/Diff.class diff --git a/lib/jdiff/jdiff/util/DiffNormalOutput.class b/lib/jdiff/jdiff/util/DiffNormalOutput.class Binary files differnew file mode 100644 index 000000000..6f9f8ef7a --- /dev/null +++ b/lib/jdiff/jdiff/util/DiffNormalOutput.class diff --git a/lib/jdiff/jdiff/util/DiffOutput.class b/lib/jdiff/jdiff/util/DiffOutput.class Binary files differnew file mode 100644 index 000000000..f26fc3576 --- /dev/null +++ b/lib/jdiff/jdiff/util/DiffOutput.class diff --git a/lib/jdiff/jdiffReadme.txt b/lib/jdiff/jdiffReadme.txt new file mode 100644 index 000000000..bca69422f --- /dev/null +++ b/lib/jdiff/jdiffReadme.txt @@ -0,0 +1,2 @@ +The jdiff library is a component from the JDiffPlugin by Andre Kaplan +available from http://plugins.jedit.org/plugins/JDiffPlugin under the GPL. diff --git a/lib/jdiff/src/jf b/lib/jdiff/src/jf new file mode 100644 index 000000000..f17503c37 --- /dev/null +++ b/lib/jdiff/src/jf @@ -0,0 +1,4 @@ +text/FileLine.java
+util/Diff.java
+util/DiffNormalOutput.java
+util/DiffOutput.java
diff --git a/lib/jdiff/src/text/FileLine.java b/lib/jdiff/src/text/FileLine.java new file mode 100644 index 000000000..572f2e26a --- /dev/null +++ b/lib/jdiff/src/text/FileLine.java @@ -0,0 +1,64 @@ +/* + * FileLine.java + * Copyright (c) 2001 Andre Kaplan, original version (c) 2000 by Mike Dillon + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + + +package jdiff.text; + + +public class FileLine +{ + private String original; + private String canonical; + private int cachedHashCode; + + + public FileLine(String original, String canonical) { + this.original = original; + this.canonical = canonical; + } + + + public String getOriginalString() { + return this.original; + } + + + public int hashCode() { + if (this.cachedHashCode == 0) { + this.cachedHashCode = this.canonical.hashCode(); + } + + return this.cachedHashCode; + } + + + public boolean equals(Object o) { + if (this == o) { return true; } + if (o == null) { return false; } + if (!(o instanceof FileLine)) {return false; } + if (this.canonical == ((FileLine) o).canonical) { return true; } + + return this.canonical.equals(((FileLine) o).canonical); + } + + + public String toString() { + return this.original; + } +} diff --git a/lib/jdiff/src/util/Diff.java b/lib/jdiff/src/util/Diff.java new file mode 100644 index 000000000..a7d3ff84b --- /dev/null +++ b/lib/jdiff/src/util/Diff.java @@ -0,0 +1,848 @@ +package jdiff.util; + +import java.util.Hashtable; + +/** A class to compare vectors of objects. The result of comparison + is a list of <code>change</code> objects which form an + edit script. The objects compared are traditionally lines + of text from two files. Comparison options such as "ignore + whitespace" are implemented by modifying the <code>equals</code> + and <code>hashcode</code> methods for the objects compared. +<p> + The basic algorithm is described in: </br> + "An O(ND) Difference Algorithm and its Variations", Eugene Myers, + Algorithmica Vol. 1 No. 2, 1986, p 251. +<p> + This class outputs different results from GNU diff 1.15 on some + inputs. Our results are actually better (smaller change list, smaller + total size of changes), but it would be nice to know why. Perhaps + there is a memory overwrite bug in GNU diff 1.15. + + @author Stuart D. Gathman, translated from GNU diff 1.15 + Copyright (C) 2000 Business Management Systems, Inc. +<p> + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 1, or (at your option) + any later version. +<p> + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +<p> + You should have received a copy of the <a href=COPYING.txt> + GNU General Public License</a> + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + */ + +public class Diff +{ + + /** Prepare to find differences between two arrays. Each element of + the arrays is translated to an "equivalence number" based on + the result of <code>equals</code>. The original Object arrays + are no longer needed for computing the differences. They will + be needed again later to print the results of the comparison as + an edit script, if desired. + */ + public Diff(Object[] a,Object[] b) + { + Hashtable h = new Hashtable(a.length + b.length); + filevec[0] = new file_data(a,h); + filevec[1] = new file_data(b,h); + } + + /** 1 more than the maximum equivalence value used for this or its + sibling file. */ + private int equiv_max = 1; + + /** When set to true, the comparison uses a heuristic to speed it up. + With this heuristic, for files with a constant small density + of changes, the algorithm is linear in the file size. */ + public boolean heuristic = false; + + /** When set to true, the algorithm returns a guarranteed minimal + set of changes. This makes things slower, sometimes much slower. */ + public boolean no_discards = false; + + private int[] xvec, yvec; /* Vectors being compared. */ + private int[] fdiag; /* Vector, indexed by diagonal, containing + the X coordinate of the point furthest + along the given diagonal in the forward + search of the edit matrix. */ + private int[] bdiag; /* Vector, indexed by diagonal, containing + the X coordinate of the point furthest + along the given diagonal in the backward + search of the edit matrix. */ + private int fdiagoff, bdiagoff; + private final file_data[] filevec = new file_data[2]; + private int cost; + + /** Find the midpoint of the shortest edit script for a specified + portion of the two files. + + We scan from the beginnings of the files, and simultaneously from the ends, + doing a breadth-first search through the space of edit-sequence. + When the two searches meet, we have found the midpoint of the shortest + edit sequence. + + The value returned is the number of the diagonal on which the midpoint lies. + The diagonal number equals the number of inserted lines minus the number + of deleted lines (counting only lines before the midpoint). + The edit cost is stored into COST; this is the total number of + lines inserted or deleted (counting only lines before the midpoint). + + This function assumes that the first lines of the specified portions + of the two files do not match, and likewise that the last lines do not + match. The caller must trim matching lines from the beginning and end + of the portions it is going to specify. + + Note that if we return the "wrong" diagonal value, or if + the value of bdiag at that diagonal is "wrong", + the worst this can do is cause suboptimal diff output. + It cannot cause incorrect diff output. */ + + private int diag (int xoff, int xlim, int yoff, int ylim) + { + final int[] fd = fdiag; // Give the compiler a chance. + final int[] bd = bdiag; // Additional help for the compiler. + final int[] xv = xvec; // Still more help for the compiler. + final int[] yv = yvec; // And more and more . . . + final int dmin = xoff - ylim; // Minimum valid diagonal. + final int dmax = xlim - yoff; // Maximum valid diagonal. + final int fmid = xoff - yoff; // Center diagonal of top-down search. + final int bmid = xlim - ylim; // Center diagonal of bottom-up search. + int fmin = fmid, fmax = fmid; // Limits of top-down search. + int bmin = bmid, bmax = bmid; // Limits of bottom-up search. + /* True if southeast corner is on an odd + diagonal with respect to the northwest. */ + final boolean odd = (fmid - bmid & 1) != 0; + + fd[fdiagoff + fmid] = xoff; + bd[bdiagoff + bmid] = xlim; + + for (int c = 1;; ++c) + { + int d; /* Active diagonal. */ + boolean big_snake = false; + + /* Extend the top-down search by an edit step in each diagonal. */ + if (fmin > dmin) + fd[fdiagoff + --fmin - 1] = -1; + else + ++fmin; + if (fmax < dmax) + fd[fdiagoff + ++fmax + 1] = -1; + else + --fmax; + for (d = fmax; d >= fmin; d -= 2) + { + int x, y, oldx, tlo = fd[fdiagoff + d - 1], thi = fd[fdiagoff + d + 1]; + + if (tlo >= thi) + x = tlo + 1; + else + x = thi; + oldx = x; + y = x - d; + while (x < xlim && y < ylim && xv[x] == yv[y]) { + ++x; ++y; + } + if (x - oldx > 20) + big_snake = true; + fd[fdiagoff + d] = x; + if (odd && bmin <= d && d <= bmax && bd[bdiagoff + d] <= fd[fdiagoff + d]) + { + cost = 2 * c - 1; + return d; + } + } + + /* Similar extend the bottom-up search. */ + if (bmin > dmin) + bd[bdiagoff + --bmin - 1] = Integer.MAX_VALUE; + else + ++bmin; + if (bmax < dmax) + bd[bdiagoff + ++bmax + 1] = Integer.MAX_VALUE; + else + --bmax; + for (d = bmax; d >= bmin; d -= 2) + { + int x, y, oldx, tlo = bd[bdiagoff + d - 1], thi = bd[bdiagoff + d + 1]; + + if (tlo < thi) + x = tlo; + else + x = thi - 1; + oldx = x; + y = x - d; + while (x > xoff && y > yoff && xv[x - 1] == yv[y - 1]) { + --x; --y; + } + if (oldx - x > 20) + big_snake = true; + bd[bdiagoff + d] = x; + if (!odd && fmin <= d && d <= fmax && bd[bdiagoff + d] <= fd[fdiagoff + d]) + { + cost = 2 * c; + return d; + } + } + + /* Heuristic: check occasionally for a diagonal that has made + lots of progress compared with the edit distance. + If we have any such, find the one that has made the most + progress and return it as if it had succeeded. + + With this heuristic, for files with a constant small density + of changes, the algorithm is linear in the file size. */ + + if (c > 200 && big_snake && heuristic) + { + int best = 0; + int bestpos = -1; + + for (d = fmax; d >= fmin; d -= 2) + { + int dd = d - fmid; + if ((fd[fdiagoff + d] - xoff)*2 - dd > 12 * (c + (dd > 0 ? dd : -dd))) + { + if (fd[fdiagoff + d] * 2 - dd > best + && fd[fdiagoff + d] - xoff > 20 + && fd[fdiagoff + d] - d - yoff > 20) + { + int k; + int x = fd[fdiagoff + d]; + + /* We have a good enough best diagonal; + now insist that it end with a significant snake. */ + for (k = 1; k <= 20; k++) + if (xvec[x - k] != yvec[x - d - k]) + break; + + if (k == 21) + { + best = fd[fdiagoff + d] * 2 - dd; + bestpos = d; + } + } + } + } + if (best > 0) + { + cost = 2 * c - 1; + return bestpos; + } + + best = 0; + for (d = bmax; d >= bmin; d -= 2) + { + int dd = d - bmid; + if ((xlim - bd[bdiagoff + d])*2 + dd > 12 * (c + (dd > 0 ? dd : -dd))) + { + if ((xlim - bd[bdiagoff + d]) * 2 + dd > best + && xlim - bd[bdiagoff + d] > 20 + && ylim - (bd[bdiagoff + d] - d) > 20) + { + /* We have a good enough best diagonal; + now insist that it end with a significant snake. */ + int k; + int x = bd[bdiagoff + d]; + + for (k = 0; k < 20; k++) + if (xvec[x + k] != yvec[x - d + k]) + break; + if (k == 20) + { + best = (xlim - bd[bdiagoff + d]) * 2 + dd; + bestpos = d; + } + } + } + } + if (best > 0) + { + cost = 2 * c - 1; + return bestpos; + } + } + } + } + + /** Compare in detail contiguous subsequences of the two files + which are known, as a whole, to match each other. + + The results are recorded in the vectors filevec[N].changed_flag, by + storing a 1 in the element for each line that is an insertion or deletion. + + The subsequence of file 0 is [XOFF, XLIM) and likewise for file 1. + + Note that XLIM, YLIM are exclusive bounds. + All line numbers are origin-0 and discarded lines are not counted. */ + + private void compareseq (int xoff, int xlim, int yoff, int ylim) { + /* Slide down the bottom initial diagonal. */ + while (xoff < xlim && yoff < ylim && xvec[xoff] == yvec[yoff]) { + ++xoff; ++yoff; + } + /* Slide up the top initial diagonal. */ + while (xlim > xoff && ylim > yoff && xvec[xlim - 1] == yvec[ylim - 1]) { + --xlim; --ylim; + } + + /* Handle simple cases. */ + if (xoff == xlim) + while (yoff < ylim) + filevec[1].changed_flag[1+filevec[1].realindexes[yoff++]] = true; + else if (yoff == ylim) + while (xoff < xlim) + filevec[0].changed_flag[1+filevec[0].realindexes[xoff++]] = true; + else + { + /* Find a point of correspondence in the middle of the files. */ + + int d = diag (xoff, xlim, yoff, ylim); + int c = cost; + int f = fdiag[fdiagoff + d]; + int b = bdiag[bdiagoff + d]; + + if (c == 1) + { + /* This should be impossible, because it implies that + one of the two subsequences is empty, + and that case was handled above without calling `diag'. + Let's verify that this is true. */ + throw new IllegalArgumentException("Empty subsequence"); + } + else + { + /* Use that point to split this problem into two subproblems. */ + compareseq (xoff, b, yoff, b - d); + /* This used to use f instead of b, + but that is incorrect! + It is not necessarily the case that diagonal d + has a snake from b to f. */ + compareseq (b, xlim, b - d, ylim); + } + } + } + + /** Discard lines from one file that have no matches in the other file. + */ + + private void discard_confusing_lines() { + filevec[0].discard_confusing_lines(filevec[1]); + filevec[1].discard_confusing_lines(filevec[0]); + } + + private boolean inhibit = false; + + /** Adjust inserts/deletes of blank lines to join changes + as much as possible. + */ + + private void shift_boundaries() { + if (inhibit) + return; + filevec[0].shift_boundaries(filevec[1]); + filevec[1].shift_boundaries(filevec[0]); + } + + /** Scan the tables of which lines are inserted and deleted, + producing an edit script in reverse order. */ + + private change build_reverse_script() { + change script = null; + final boolean[] changed0 = filevec[0].changed_flag; + final boolean[] changed1 = filevec[1].changed_flag; + final int len0 = filevec[0].buffered_lines; + final int len1 = filevec[1].buffered_lines; + + /* Note that changedN[len0] does exist, and contains 0. */ + + int i0 = 0, i1 = 0; + + while (i0 < len0 || i1 < len1) + { + if (changed0[1+i0] || changed1[1+i1]) + { + int line0 = i0, line1 = i1; + + /* Find # lines changed here in each file. */ + while (changed0[1+i0]) ++i0; + while (changed1[1+i1]) ++i1; + + /* Record this change. */ + script = new change(line0, line1, i0 - line0, i1 - line1, script); + } + + /* We have reached lines in the two files that match each other. */ + i0++; i1++; + } + + return script; + } + + /** Scan the tables of which lines are inserted and deleted, + producing an edit script in forward order. */ + + private change build_script() { + change script = null; + final boolean[] changed0 = filevec[0].changed_flag; + final boolean[] changed1 = filevec[1].changed_flag; + final int len0 = filevec[0].buffered_lines; + final int len1 = filevec[1].buffered_lines; + int i0 = len0, i1 = len1; + + /* Note that changedN[-1] does exist, and contains 0. */ + + while (i0 >= 0 || i1 >= 0) + { + if (changed0[i0] || changed1[i1]) + { + int line0 = i0, line1 = i1; + + /* Find # lines changed here in each file. */ + while (changed0[i0]) --i0; + while (changed1[i1]) --i1; + + /* Record this change. */ + script = new change(i0, i1, line0 - i0, line1 - i1, script); + } + + /* We have reached lines in the two files that match each other. */ + i0--; i1--; + } + + return script; + } + + /* Report the differences of two files. DEPTH is the current directory + depth. */ + public change diff_2(final boolean reverse) { + + /* Some lines are obviously insertions or deletions + because they don't match anything. Detect them now, + and avoid even thinking about them in the main comparison algorithm. */ + + discard_confusing_lines (); + + /* Now do the main comparison algorithm, considering just the + undiscarded lines. */ + + xvec = filevec[0].undiscarded; + yvec = filevec[1].undiscarded; + + int diags = + filevec[0].nondiscarded_lines + filevec[1].nondiscarded_lines + 3; + fdiag = new int[diags]; + fdiagoff = filevec[1].nondiscarded_lines + 1; + bdiag = new int[diags]; + bdiagoff = filevec[1].nondiscarded_lines + 1; + + compareseq (0, filevec[0].nondiscarded_lines, + 0, filevec[1].nondiscarded_lines); + fdiag = null; + bdiag = null; + + /* Modify the results slightly to make them prettier + in cases where that can validly be done. */ + + shift_boundaries (); + + /* Get the results of comparison in the form of a chain + of `struct change's -- an edit script. */ + + if (reverse) + return build_reverse_script(); + else + return build_script(); + } + + /** The result of comparison is an "edit script": a chain of change objects. + Each change represents one place where some lines are deleted + and some are inserted. + + LINE0 and LINE1 are the first affected lines in the two files (origin 0). + DELETED is the number of lines deleted here from file 0. + INSERTED is the number of lines inserted here in file 1. + + If DELETED is 0 then LINE0 is the number of the line before + which the insertion was done; vice versa for INSERTED and LINE1. */ + + public static class change { + /** Previous or next edit command. */ + public change link; + /** # lines of file 1 changed here. */ + public final int inserted; + /** # lines of file 0 changed here. */ + public final int deleted; + /** Line number of 1st deleted line. */ + public final int line0; + /** Line number of 1st inserted line. */ + public final int line1; + + /** Cons an additional entry onto the front of an edit script OLD. + LINE0 and LINE1 are the first affected lines in the two files (origin 0). + DELETED is the number of lines deleted here from file 0. + INSERTED is the number of lines inserted here in file 1. + + If DELETED is 0 then LINE0 is the number of the line before + which the insertion was done; vice versa for INSERTED and LINE1. */ + change(int line0, int line1, int deleted, int inserted, change old) { + this.line0 = line0; + this.line1 = line1; + this.inserted = inserted; + this.deleted = deleted; + this.link = old; + //System.err.println(line0+","+line1+","+inserted+","+deleted); + } + } + + /** Data on one input file being compared. + */ + + class file_data { + + /** Allocate changed array for the results of comparison. */ + void clear() { + /* Allocate a flag for each line of each file, saying whether that line + is an insertion or deletion. + Allocate an extra element, always zero, at each end of each vector. + */ + changed_flag = new boolean[buffered_lines + 2]; + } + + /** Return equiv_count[I] as the number of lines in this file + that fall in equivalence class I. + @return the array of equivalence class counts. + */ + int[] equivCount() { + int[] equiv_count = new int[equiv_max]; + for (int i = 0; i < buffered_lines; ++i) + ++equiv_count[equivs[i]]; + return equiv_count; + } + + /** Discard lines that have no matches in another file. + + A line which is discarded will not be considered by the actual + comparison algorithm; it will be as if that line were not in the file. + The file's `realindexes' table maps virtual line numbers + (which don't count the discarded lines) into real line numbers; + this is how the actual comparison algorithm produces results + that are comprehensible when the discarded lines are counted. +<p> + When we discard a line, we also mark it as a deletion or insertion + so that it will be printed in the output. + @param f the other file + */ + void discard_confusing_lines(file_data f) { + clear(); + /* Set up table of which lines are going to be discarded. */ + final byte[] discarded = discardable(f.equivCount()); + + /* Don't really discard the provisional lines except when they occur + in a run of discardables, with nonprovisionals at the beginning + and end. */ + filterDiscards(discarded); + + /* Actually discard the lines. */ + discard(discarded); + } + + /** Mark to be discarded each line that matches no line of another file. + If a line matches many lines, mark it as provisionally discardable. + @see equivCount() + @param counts The count of each equivalence number for the other file. + @return 0=nondiscardable, 1=discardable or 2=provisionally discardable + for each line + */ + + private byte[] discardable(final int[] counts) { + final int end = buffered_lines; + final byte[] discards = new byte[end]; + final int[] equivs = this.equivs; + int many = 5; + int tem = end / 64; + + /* Multiply MANY by approximate square root of number of lines. + That is the threshold for provisionally discardable lines. */ + while ((tem = tem >> 2) > 0) + many *= 2; + + for (int i = 0; i < end; i++) + { + int nmatch; + if (equivs[i] == 0) + continue; + nmatch = counts[equivs[i]]; + if (nmatch == 0) + discards[i] = 1; + else if (nmatch > many) + discards[i] = 2; + } + return discards; + } + + /** Don't really discard the provisional lines except when they occur + in a run of discardables, with nonprovisionals at the beginning + and end. */ + + private void filterDiscards(final byte[] discards) { + final int end = buffered_lines; + + for (int i = 0; i < end; i++) + { + /* Cancel provisional discards not in middle of run of discards. */ + if (discards[i] == 2) + discards[i] = 0; + else if (discards[i] != 0) + { + /* We have found a nonprovisional discard. */ + int j; + int length; + int provisional = 0; + + /* Find end of this run of discardable lines. + Count how many are provisionally discardable. */ + for (j = i; j < end; j++) + { + if (discards[j] == 0) + break; + if (discards[j] == 2) + ++provisional; + } + + /* Cancel provisional discards at end, and shrink the run. */ + while (j > i && discards[j - 1] == 2) { + discards[--j] = 0; --provisional; + } + + /* Now we have the length of a run of discardable lines + whose first and last are not provisional. */ + length = j - i; + + /* If 1/4 of the lines in the run are provisional, + cancel discarding of all provisional lines in the run. */ + if (provisional * 4 > length) + { + while (j > i) + if (discards[--j] == 2) + discards[j] = 0; + } + else + { + int consec; + int minimum = 1; + int tem = length / 4; + + /* MINIMUM is approximate square root of LENGTH/4. + A subrun of two or more provisionals can stand + when LENGTH is at least 16. + A subrun of 4 or more can stand when LENGTH >= 64. */ + while ((tem = tem >> 2) > 0) + minimum *= 2; + minimum++; + + /* Cancel any subrun of MINIMUM or more provisionals + within the larger run. */ + for (j = 0, consec = 0; j < length; j++) + if (discards[i + j] != 2) + consec = 0; + else if (minimum == ++consec) + /* Back up to start of subrun, to cancel it all. */ + j -= consec; + else if (minimum < consec) + discards[i + j] = 0; + + /* Scan from beginning of run + until we find 3 or more nonprovisionals in a row + or until the first nonprovisional at least 8 lines in. + Until that point, cancel any provisionals. */ + for (j = 0, consec = 0; j < length; j++) + { + if (j >= 8 && discards[i + j] == 1) + break; + if (discards[i + j] == 2) { + consec = 0; discards[i + j] = 0; + } + else if (discards[i + j] == 0) + consec = 0; + else + consec++; + if (consec == 3) + break; + } + + /* I advances to the last line of the run. */ + i += length - 1; + + /* Same thing, from end. */ + for (j = 0, consec = 0; j < length; j++) + { + if (j >= 8 && discards[i - j] == 1) + break; + if (discards[i - j] == 2) { + consec = 0; discards[i - j] = 0; + } + else if (discards[i - j] == 0) + consec = 0; + else + consec++; + if (consec == 3) + break; + } + } + } + } + } + + /** Actually discard the lines. + @param discards flags lines to be discarded + */ + private void discard(final byte[] discards) { + final int end = buffered_lines; + int j = 0; + for (int i = 0; i < end; ++i) + if (no_discards || discards[i] == 0) + { + undiscarded[j] = equivs[i]; + realindexes[j++] = i; + } + else + changed_flag[1+i] = true; + nondiscarded_lines = j; + } + + file_data(Object[] data,Hashtable h) { + buffered_lines = data.length; + + equivs = new int[buffered_lines]; + undiscarded = new int[buffered_lines]; + realindexes = new int[buffered_lines]; + + for (int i = 0; i < data.length; ++i) { + Integer ir = (Integer)h.get(data[i]); + if (ir == null) + h.put(data[i],new Integer(equivs[i] = equiv_max++)); + else + equivs[i] = ir.intValue(); + } + } + + /** Adjust inserts/deletes of blank lines to join changes + as much as possible. + + We do something when a run of changed lines include a blank + line at one end and have an excluded blank line at the other. + We are free to choose which blank line is included. + `compareseq' always chooses the one at the beginning, + but usually it is cleaner to consider the following blank line + to be the "change". The only exception is if the preceding blank line + would join this change to other changes. + @param f the file being compared against + */ + + void shift_boundaries(file_data f) { + final boolean[] changed = changed_flag; + final boolean[] other_changed = f.changed_flag; + int i = 0; + int j = 0; + int i_end = buffered_lines; + int preceding = -1; + int other_preceding = -1; + + for (;;) + { + int start, end, other_start; + + /* Scan forwards to find beginning of another run of changes. + Also keep track of the corresponding point in the other file. */ + + while (i < i_end && !changed[1+i]) + { + while (other_changed[1+j++]) + /* Non-corresponding lines in the other file + will count as the preceding batch of changes. */ + other_preceding = j; + i++; + } + + if (i == i_end) + break; + + start = i; + other_start = j; + + for (;;) + { + /* Now find the end of this run of changes. */ + + while (i < i_end && changed[1+i]) i++; + end = i; + + /* If the first changed line matches the following unchanged one, + and this run does not follow right after a previous run, + and there are no lines deleted from the other file here, + then classify the first changed line as unchanged + and the following line as changed in its place. */ + + /* You might ask, how could this run follow right after another? + Only because the previous run was shifted here. */ + + if (end != i_end + && equivs[start] == equivs[end] + && !other_changed[1+j] + && end != i_end + && !((preceding >= 0 && start == preceding) + || (other_preceding >= 0 + && other_start == other_preceding))) + { + changed[1+end++] = true; + changed[1+start++] = false; + ++i; + /* Since one line-that-matches is now before this run + instead of after, we must advance in the other file + to keep in synch. */ + ++j; + } + else + break; + } + + preceding = i; + other_preceding = j; + } + } + + /** Number of elements (lines) in this file. */ + final int buffered_lines; + + /** Vector, indexed by line number, containing an equivalence code for + each line. It is this vector that is actually compared with that + of another file to generate differences. */ + private final int[] equivs; + + /** Vector, like the previous one except that + the elements for discarded lines have been squeezed out. */ + final int[] undiscarded; + + /** Vector mapping virtual line numbers (not counting discarded lines) + to real ones (counting those lines). Both are origin-0. */ + final int[] realindexes; + + /** Total number of nondiscarded lines. */ + int nondiscarded_lines; + + /** Array, indexed by real origin-1 line number, + containing true for a line that is an insertion or a deletion. + The results of comparison are stored here. */ + boolean[] changed_flag; + + } +} diff --git a/lib/jdiff/src/util/DiffNormalOutput.java b/lib/jdiff/src/util/DiffNormalOutput.java new file mode 100644 index 000000000..3ea03f450 --- /dev/null +++ b/lib/jdiff/src/util/DiffNormalOutput.java @@ -0,0 +1,84 @@ +/* + * DiffNormalOutput.java + * Copyright (c) 2001 Andre Kaplan + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + + +package jdiff.util; + +import java.io.IOException; + + +/** Print a change list in the standard diff format. */ +public class DiffNormalOutput extends DiffOutput { + public DiffNormalOutput(Object[] a, Object[] b) { + super(a, b); + } + + + public void writeScript(Diff.change script) throws IOException { + Diff.change hunk = script; + + for (; hunk != null; hunk = hunk.link) { + this.writeHunk(hunk); + } + + this.out.flush(); + } + + + /** Writes a hunk of a normal diff. */ + protected void writeHunk(Diff.change hunk) throws IOException { + int deletes = hunk.deleted; + int inserts = hunk.inserted; + + if (deletes == 0 && inserts == 0) { + return; + } + + // Determine range of line numbers involved in each file. + int first0 = hunk.line0; + int first1 = hunk.line1; + int last0 = hunk.line0 + hunk.deleted - 1; + int last1 = hunk.line1 + hunk.inserted - 1; + + // Write out the line number header for this hunk + this.writeNumberRange(',', first0, last0); + out.write(DiffOutput.changeLetter(inserts, deletes)); + this.writeNumberRange(',', first1, last1); + out.write(this.lineSeparator); + + // Write the lines that the first file has. + if (deletes != 0) { + for (int i = first0; i <= last0; i++) { + this.writeLine("< ", this.file0[i]); + } + } + + if (inserts != 0 && deletes != 0) { + out.write("---" + this.lineSeparator); + } + + // Write the lines that the second file has. + if (inserts != 0) { + for (int i = first1; i <= last1; i++) { + this.writeLine("> ", this.file1[i]); + } + } + } +} + diff --git a/lib/jdiff/src/util/DiffOutput.java b/lib/jdiff/src/util/DiffOutput.java new file mode 100644 index 000000000..06d058d4d --- /dev/null +++ b/lib/jdiff/src/util/DiffOutput.java @@ -0,0 +1,95 @@ +/* + * DiffOutput.java + * Copyright (c) 2001 Andre Kaplan + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + + +package jdiff.util; + +import java.io.IOException; +import java.io.Writer; +import java.io.OutputStreamWriter; + + + +/** A base class for printing edit scripts produced by Diff. */ +public abstract class DiffOutput { + /** Set to the lines of the files being compared. */ + protected Object[] file0; + protected Object[] file1; + + protected String lineSeparator; + protected Writer out; + + + protected DiffOutput(Object[] a,Object[] b) { + this.lineSeparator = System.getProperty("java.line.separator"); + this.out = new OutputStreamWriter(System.out); + this.file0 = a; + this.file1 = b; + } + + + public void setOut(Writer out) { + this.out = out; + } + + + public void setLineSeparator(String lineSeparator) { + this.lineSeparator = lineSeparator; + } + + + abstract public void writeScript(Diff.change script) throws IOException; + + + protected void writeLine(String prefix, Object line) throws IOException { + out.write(prefix + line.toString() + this.lineSeparator); + } + + + /** Write a pair of line numbers separated with sepChar. + If the two numbers are identical, print just one number. + + Args a and b are internal line numbers (ranging from 0) + We write the translated (real) line numbers ranging from 1). + */ + protected void writeNumberRange(char sepChar, int a, int b) throws IOException { + /* Note: we can have b < a in the case of a range of no lines. + In this case, we should write the line number before the range, + which is b. */ + if (++b > ++a) { + out.write(Integer.toString(a)); + out.write(sepChar); + out.write(Integer.toString(b)); + } else { + out.write(Integer.toString(b)); + } + } + + + public static char changeLetter(int inserts, int deletes) { + if (inserts == 0) { + return 'd'; + } else if (deletes == 0) { + return 'a'; + } else { + return 'c'; + } + } +} + diff --git a/loadtime/pom.xml b/loadtime/pom.xml index da12d06c4..f371698c7 100644 --- a/loadtime/pom.xml +++ b/loadtime/pom.xml @@ -1,80 +1,113 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.aspectj</groupId> - <artifactId>aspectj-parent</artifactId> - <version>1.9.3.BUILD-SNAPSHOT</version> - <relativePath>..</relativePath> - </parent> + <parent> + <groupId>org.aspectj</groupId> + <artifactId>aspectj-parent</artifactId> + <version>1.9.3.BUILD-SNAPSHOT</version> + <relativePath>..</relativePath> + </parent> - <artifactId>loadtime</artifactId> - <packaging>jar</packaging> - <name>loadtime</name> + <artifactId>loadtime</artifactId> + <packaging>jar</packaging> + <name>loadtime</name> - <dependencies> + <dependencies> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>asm</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>bridge</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>runtime</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>util</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>weaver</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>org.aspectj.matcher</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>testing-util</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>bcel-builder</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>xml-apis</groupId> + <artifactId>xml-apis</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/../lib/ant/lib/xml-apis.jar</systemPath> + </dependency> + <dependency> + <groupId>xercesImpl</groupId> + <artifactId>xercesImpl</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/../lib/ant/lib/xercesImpl.jar</systemPath> + </dependency> + <dependency> + <groupId>jrockit</groupId> + <artifactId>jrockit</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/../lib/ext/jrockit/jrockit.jar</systemPath> + </dependency> + <dependency> - <groupId>org.aspectj</groupId> - <artifactId>asm</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>bridge</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>runtime</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>util</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>weaver</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>org.aspectj.matcher</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>testing-util</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>bcel-builder</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>xml-apis</groupId> - <artifactId>xml-apis</artifactId> - <version>1.0</version> - <scope>system</scope> - <systemPath>${project.basedir}/../lib/ant/lib/xml-apis.jar</systemPath> - </dependency> - <dependency> - <groupId>xercesImpl</groupId> - <artifactId>xercesImpl</artifactId> - <version>1.0</version> - <scope>system</scope> - <systemPath>${project.basedir}/../lib/ant/lib/xercesImpl.jar</systemPath> - </dependency> - <dependency> - <groupId>jrockit</groupId> - <artifactId>jrockit</artifactId> + <groupId>ant</groupId> + <artifactId>ant</artifactId> <version>1.0</version> <scope>system</scope> - <systemPath>${project.basedir}/../lib/ext/jrockit/jrockit.jar</systemPath> + <systemPath>${project.basedir}/../lib/ant/lib/ant.jar</systemPath> </dependency> - </dependencies> + </dependencies> + +<!-- + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>3.0.1</version> + <configuration> + </configuration> + <executions> + <execution> + <id>javadoc</id> + <phase>package</phase> + <goals> + <goal>javadoc</goal> + </goals> + <configuration> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +--> </project> diff --git a/loadtime/src/main/java/org/aspectj/weaver/loadtime/Agent.java b/loadtime/src/main/java/org/aspectj/weaver/loadtime/Agent.java index eeca8aeef..6dbbf32db 100644 --- a/loadtime/src/main/java/org/aspectj/weaver/loadtime/Agent.java +++ b/loadtime/src/main/java/org/aspectj/weaver/loadtime/Agent.java @@ -37,7 +37,7 @@ public class Agent { * JSR-163 preMain Agent entry method * * @param options - * @param instrumentation + * @param instrumentation */ public static void premain(String options, Instrumentation instrumentation) { /* Handle duplicate agents */ diff --git a/loadtime/src/test/java/org/aspectj/weaver/loadtime/JRockitAgentTest.java b/loadtime/src/test/java/org/aspectj/weaver/loadtime/JRockitAgentTest.java index b13ebe421..9ed540d17 100644 --- a/loadtime/src/test/java/org/aspectj/weaver/loadtime/JRockitAgentTest.java +++ b/loadtime/src/test/java/org/aspectj/weaver/loadtime/JRockitAgentTest.java @@ -25,6 +25,7 @@ import java.util.jar.JarFile; import java.util.zip.ZipEntry; import org.aspectj.util.FileUtil; +import org.aspectj.util.LangUtil; import junit.framework.TestCase; @@ -53,6 +54,10 @@ public class JRockitAgentTest extends TestCase { } public void testJrockitRecursionProtection() { + if (LangUtil.is11VMOrGreater()) { + // Skip test, not castable to URLClassLoader + return; + } URLClassLoader thisLoader = (URLClassLoader) getClass().getClassLoader(); URL jrockit = FileUtil.getFileURL(new File("../lib/ext/jrockit/jrockit.jar")); URL[] urls = new URL[] {jrockit}; @@ -1,90 +1,137 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> - <properties> - <revision>1.9.3.BUILD-SNAPSHOT</revision> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> + <properties> + <revision>1.9.3.BUILD-SNAPSHOT</revision> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> - <groupId>org.aspectj</groupId> - <artifactId>aspectj-parent</artifactId> - <packaging>pom</packaging> - <version>1.9.3.BUILD-SNAPSHOT</version> - <name>AspectJ Parent Project</name> + <groupId>org.aspectj</groupId> + <artifactId>aspectj-parent</artifactId> + <packaging>pom</packaging> + <version>1.9.3.BUILD-SNAPSHOT</version> + <name>AspectJ Parent Project</name> - <modules> - <module>util</module> - <module>bridge</module> - <module>testing-util</module> - <module>org.aspectj.matcher</module> - <module>asm</module> - <module>testing-client</module> - <module>runtime</module> - <module>bcel-builder</module> - <module>weaver</module> - <module>loadtime</module> - <module>org.eclipse.jdt.core</module> - <module>org.aspectj.ajdt.core</module> - <module>ajde.core</module> - <module>ajde</module> - <module>ajdoc</module> - <module>taskdefs</module> - <module>testing</module> - <module>testing-drivers</module> - <module>tests</module> - <module>build</module> - <module>run-all-junit-tests</module> - </modules> + <modules> + <module>util</module> + <module>bridge</module> + <module>testing-util</module> + <module>org.aspectj.matcher</module> + <module>asm</module> + <module>testing-client</module> + <module>runtime</module> + <module>bcel-builder</module> + <module>weaver</module> + <module>loadtime</module> + <module>org.eclipse.jdt.core</module> + <module>org.aspectj.ajdt.core</module> + <module>ajde.core</module> + <module>ajde</module> + <module>ajdoc</module> + <module>taskdefs</module> + <module>testing</module> + <module>testing-drivers</module> + <module>tests</module> + <module>build</module> + <module>run-all-junit-tests</module> + <module>docs</module> - <build> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <testFailureIgnore>true</testFailureIgnore> -<excludes> -<exclude>**/*ModuleTests.java</exclude> -</excludes> - </configuration> - </plugin> - </plugins> - </pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <version>2.2</version> - <executions> - <execution> - <goals> - <goal>test-jar</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> + <!-- create the important artifacts we care about --> + <module>aspectjrt</module> + <module>aspectjweaver</module> + <module>aspectjtools</module> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> + <!-- build the java -jar'able installer --> + <module>installer</module> + </modules> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <testFailureIgnore>true</testFailureIgnore> + <excludes> + <exclude>**/*ModuleTests.java</exclude> + </excludes> + </configuration> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <addMavenDescriptor>false</addMavenDescriptor> + </archive> + </configuration> + <executions> + <execution> +<id>test-jar</id> + <goals> + <goal>test-jar</goal> + </goals> + </execution> + </executions> + </plugin> + + <!-- <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>3.1.1</version> + <configuration> <descriptors> <descriptor>assembly.xml</descriptor> </descriptors> + </configuration> </plugin> --> + + <plugin> + <artifactId>maven-clean-plugin</artifactId> + <version>3.1.0</version> + <configuration> + <filesets> + <fileset> + <directory>.</directory> + <includes> +<include>**/ajcore.*.txt</include> + + </includes> +<!-- +<excludes> <exclude>**/important.log</exclude> <exclude>**/another-important.log</exclude> + </excludes> --> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>aj-build</directory> + <!-- <includes> <include>**/*.tmp</include> <include>**/*.log</include> + </includes> <excludes> <exclude>**/important.log</exclude> <exclude>**/another-important.log</exclude> + </excludes> --> + <followSymlinks>false</followSymlinks> + </fileset> + </filesets> + </configuration> + </plugin> + + </plugins> + + </build> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> </project> diff --git a/run-all-junit-tests/pom.xml b/run-all-junit-tests/pom.xml index 0652458db..4bd5fd0c3 100644 --- a/run-all-junit-tests/pom.xml +++ b/run-all-junit-tests/pom.xml @@ -1,209 +1,275 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.aspectj</groupId> - <artifactId>aspectj-parent</artifactId> - <version>1.9.3.BUILD-SNAPSHOT</version> - <relativePath>..</relativePath> - </parent> + <parent> + <groupId>org.aspectj</groupId> + <artifactId>aspectj-parent</artifactId> + <version>1.9.3.BUILD-SNAPSHOT</version> + <relativePath>..</relativePath> + </parent> - <artifactId>run-all-junit-tests</artifactId> - <packaging>jar</packaging> - <name>run-all-junit-tests</name> + <artifactId>run-all-junit-tests</artifactId> + <packaging>jar</packaging> + <name>run-all-junit-tests</name> - <dependencies> + <dependencies> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>bcel-builder</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>util</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>util</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>ajde</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>ajde.core</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>asm</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>bridge</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>loadtime</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>runtime</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>ajdoc</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>weaver</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>taskdefs</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>testing-client</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>testing-drivers</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>testing-util</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>org.aspectj.matcher</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>build</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>build</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>util</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>util</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>ajde</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>ajde.core</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>asm</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>bridge</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>loadtime</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>runtime</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>ajdoc</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>weaver</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>taskdefs</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>testing-client</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>testing-drivers</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>testing-util</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>org.aspectj.matcher</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>build</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>bridge</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>asm</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>runtime</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>taskdefs</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>testing</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>testing-client</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>testing-drivers</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>testing-util</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>weaver</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>tests</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>org.aspectj.ajdt.core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>org.eclipse.jdt.core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>ajdoc</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>loadtime</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>ajde.core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>org.aspectj.matcher</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>ajde</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>ajbrowser</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>bridge</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>asm</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>runtime</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>taskdefs</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>testing</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>testing-client</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>testing-drivers</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>testing-util</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>weaver</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>tests</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>org.aspectj.ajdt.core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>org.aspectj.ajdt.core</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>org.eclipse.jdt.core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>ajdoc</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>loadtime</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>ajde.core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>org.aspectj.matcher</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>ajde</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>ajbrowser</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>testing</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>commons</groupId> + <artifactId>commons</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/../lib/commons/commons.jar</systemPath> + </dependency> + <dependency> + <groupId>ant</groupId> + <artifactId>ant</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/../lib/ant/lib/ant.jar</systemPath> + </dependency> + + <dependency> + <groupId>jrockit</groupId> + <artifactId>jrockit</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/../lib/ext/jrockit/jrockit.jar</systemPath> + </dependency> + <dependency> + <groupId>jdiff</groupId> + <artifactId>jdiff</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/../lib/jdiff/jdiff.jar</systemPath> + </dependency> + <dependency> + <groupId>ant</groupId> + <artifactId>ant-launcher</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/../lib/ant/lib/ant-launcher.jar</systemPath> + </dependency> + </dependencies> + + + <!-- <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> + <target>1.8</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> <configuration> <testFailureIgnore>true</testFailureIgnore> + <includes> <include>**/RunTheseBeforeYouCommitTests*</include> </includes> + </configuration> </plugin> </plugins> </pluginManagement> </build> --> </project> diff --git a/testing/pom.xml b/testing/pom.xml index d998c7d7d..eb546ebc6 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -32,6 +32,11 @@ </dependency> <dependency> <groupId>org.aspectj</groupId> + <artifactId>runtime</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> <artifactId>asm</artifactId> <version>${project.version}</version> </dependency> @@ -139,6 +144,13 @@ <scope>system</scope> <systemPath>${project.basedir}/../lib/commons/commons.jar</systemPath> </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>org.eclipse.jdt.core</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/../org.eclipse.jdt.core/jdtcore-for-aspectj.jar</systemPath> + </dependency> </dependencies> <build> diff --git a/testing/src/main/java/Empty.java b/testing/src/main/java/Empty.java new file mode 100644 index 000000000..9a9956e0e --- /dev/null +++ b/testing/src/main/java/Empty.java @@ -0,0 +1 @@ +public class Empty {} diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 11d052ad1..a898def3e 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -1,20 +1,20 @@ <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd" [ -<!ENTITY ajc10xTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/ajc10x/ajc10x-tests.xml"> -<!ENTITY ajc11Tests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/ajc11/ajc11-tests.xml"> -<!ENTITY ajc120Tests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/ajc120/ajc120-tests.xml"> -<!ENTITY ajc121Tests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/ajc121/ajc121-tests.xml"> -<!ENTITY aspectpathTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/aspectpath/aspectpath-tests.xml"> -<!ENTITY baseTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/base/baseTests-tests.xml"> +<!ENTITY ajc10xTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/ajc10x/ajc10x.xml"> +<!ENTITY ajc11Tests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/ajc11/ajc11.xml"> +<!ENTITY ajc120Tests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/ajc120/ajc120.xml"> +<!ENTITY ajc121Tests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/ajc121/ajc121.xml"> +<!ENTITY aspectpathTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/aspectpath/aspectpath.xml"> +<!ENTITY baseTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/base/baseTests.xml"> <!ENTITY designTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/design/designtest.xml"> -<!ENTITY incrementalTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/incremental/incremental-tests.xml"> -<!ENTITY inpathTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/inpath/inpath-tests.xml"> -<!ENTITY java14Tests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/java14/java14-tests.xml"> -<!ENTITY knownlimitationsTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/knownlimitations/knownLimitations-tests.xml"> -<!ENTITY optionsTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/options/options-tests.xml"> -<!ENTITY pre10xTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/pre10x/pre10x-tests.xml"> -<!ENTITY purejavaTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/purejava/pureJava-tests.xml"> -<!ENTITY serialVerUIDTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/serialVerUID/serialVerUID-tests.xml"> -<!ENTITY xlintTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/xlint/xlint-tests.xml"> +<!ENTITY incrementalTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/incremental/incremental.xml"> +<!ENTITY inpathTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/inpath/inpath.xml"> +<!ENTITY java14Tests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/java14/java14.xml"> +<!ENTITY knownlimitationsTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/knownlimitations/knownLimitations.xml"> +<!ENTITY optionsTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/options/options.xml"> +<!ENTITY pre10xTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/pre10x/pre10x.xml"> +<!ENTITY purejavaTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/purejava/pureJava.xml"> +<!ENTITY serialVerUIDTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/serialVerUID/serialVerUID.xml"> +<!ENTITY xlintTests SYSTEM "../tests/src/test/resources/org/aspectj/systemtest/xlint/xlint.xml"> ]> <!-- diff --git a/tests/pom.xml b/tests/pom.xml index 51273cdfd..78b34bd6a 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -1,107 +1,151 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.aspectj</groupId> - <artifactId>aspectj-parent</artifactId> - <version>1.9.3.BUILD-SNAPSHOT</version> - <relativePath>..</relativePath> - </parent> + <parent> + <groupId>org.aspectj</groupId> + <artifactId>aspectj-parent</artifactId> + <version>1.9.3.BUILD-SNAPSHOT</version> + <relativePath>..</relativePath> + </parent> - <artifactId>tests</artifactId> - <packaging>jar</packaging> - <name>tests</name> + <artifactId>tests</artifactId> + <packaging>jar</packaging> + <name>tests</name> - <dependencies> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>util</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>bridge</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>ajde.core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>asm</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>weaver</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>org.aspectj.matcher</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>org.aspectj.ajdt.core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>org.aspectj.ajdt.core</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>ajde.core</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>bcel-builder</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>testing</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>testing-drivers</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>testing-util</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>ant</groupId> - <artifactId>ant-launcher</artifactId> - <version>1.0</version> - <scope>system</scope> - <systemPath>${project.basedir}/../lib/ant/lib/ant-launcher.jar</systemPath> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>testing</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - </dependency> - <dependency> - <groupId>commons</groupId> - <artifactId>commons</artifactId> - <version>1.0</version> - <scope>system</scope> - <systemPath>${project.basedir}/../lib/commons/commons.jar</systemPath> - </dependency> - </dependencies> + <dependencies> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>util</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>bridge</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>ajde.core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>asm</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>runtime</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>weaver</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>org.aspectj.matcher</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>asm</groupId> + <artifactId>asm</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/../lib/asm/asm-7.0-beta.renamed.jar</systemPath> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>org.aspectj.ajdt.core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>org.eclipse.jdt.core</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/../org.eclipse.jdt.core/jdtcore-for-aspectj.jar</systemPath> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>org.aspectj.ajdt.core</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>ant</groupId> + <artifactId>ant</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/../lib/ant/lib/ant.jar</systemPath> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>ajde.core</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>bcel-builder</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>testing</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>testing</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>testing-drivers</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>testing-util</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>ant</groupId> + <artifactId>ant-launcher</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/../lib/ant/lib/ant-launcher.jar</systemPath> + </dependency> + <dependency> + <groupId>commons</groupId> + <artifactId>commons</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/../lib/commons/commons.jar</systemPath> + </dependency> + </dependencies> + + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration combine.self="override"> + <testFailureIgnore>true</testFailureIgnore> + <includes> + <include>**/TestsModuleTests*</include> + </includes> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> </project> diff --git a/tests/test.ser b/tests/test.ser Binary files differdeleted file mode 100644 index ad188ec55..000000000 --- a/tests/test.ser +++ /dev/null |