This is an automated email from the ASF dual-hosted git repository. mbenson pushed a commit to branch java10 in repository https://gitbox.apache.org/repos/asf/commons-weaver.git
commit 69ef91e50a3fe3b736696c0ddc307e3c5bde0cb3 Author: Matt Benson <mben...@apache.org> AuthorDate: Thu Aug 30 18:06:47 2018 -0500 Build on Java 10; modification to public API requires major version bump --- ant/pom.xml | 2 +- build-tools/pom.xml | 2 +- dist/pom.xml | 2 +- maven-plugin/pom.xml | 2 +- modules/normalizer/pom.xml | 6 ++-- .../commons/weaver/normalizer/Normalizer.java | 4 +-- modules/pom.xml | 2 +- modules/privilizer/api/pom.xml | 2 +- modules/privilizer/pom.xml | 2 +- modules/privilizer/weaver/pom.xml | 2 +- .../commons/weaver/privilizer/Privilizer.java | 4 +-- parent/pom.xml | 2 +- pom.xml | 33 +++++++++++++++++++++- processor/pom.xml | 2 +- .../commons/weaver/model/WeaveEnvironment.java | 15 +++++----- 15 files changed, 54 insertions(+), 28 deletions(-) diff --git a/ant/pom.xml b/ant/pom.xml index 247b51f..4407ec4 100644 --- a/ant/pom.xml +++ b/ant/pom.xml @@ -22,7 +22,7 @@ under the License. <parent> <groupId>org.apache.commons</groupId> <artifactId>commons-weaver-parent</artifactId> - <version>1.4-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> <relativePath>../parent/pom.xml</relativePath> </parent> diff --git a/build-tools/pom.xml b/build-tools/pom.xml index f856c89..03ac52f 100644 --- a/build-tools/pom.xml +++ b/build-tools/pom.xml @@ -21,7 +21,7 @@ under the License. <parent> <groupId>org.apache.commons</groupId> <artifactId>commons-weaver-base</artifactId> - <version>1.4-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>commons-weaver-build-tools</artifactId> diff --git a/dist/pom.xml b/dist/pom.xml index 32b5cb5..2adc395 100644 --- a/dist/pom.xml +++ b/dist/pom.xml @@ -22,7 +22,7 @@ under the License. <parent> <groupId>org.apache.commons</groupId> <artifactId>commons-weaver-parent</artifactId> - <version>1.4-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> <relativePath>../parent/pom.xml</relativePath> </parent> diff --git a/maven-plugin/pom.xml b/maven-plugin/pom.xml index 2548342..4ddf85d 100644 --- a/maven-plugin/pom.xml +++ b/maven-plugin/pom.xml @@ -22,7 +22,7 @@ under the License. <parent> <groupId>org.apache.commons</groupId> <artifactId>commons-weaver-parent</artifactId> - <version>1.4-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> <relativePath>../parent/pom.xml</relativePath> </parent> diff --git a/modules/normalizer/pom.xml b/modules/normalizer/pom.xml index 9d5378e..fbf6403 100644 --- a/modules/normalizer/pom.xml +++ b/modules/normalizer/pom.xml @@ -22,7 +22,7 @@ under the License. <parent> <groupId>org.apache.commons</groupId> <artifactId>commons-weaver-modules-parent</artifactId> - <version>1.4-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </parent> <artifactId>commons-weaver-normalizer</artifactId> <name>Apache Commons Weaver Normalizer</name> @@ -206,9 +206,9 @@ under the License. <version>${ant.version}</version> </dependency> <dependency> - <groupId>org.eclipse.jdt.core.compiler</groupId> + <groupId>org.eclipse.jdt</groupId> <artifactId>ecj</artifactId> - <version>4.4.2</version> + <version>3.14.0</version> </dependency> </dependencies> </plugin> diff --git a/modules/normalizer/src/main/java/org/apache/commons/weaver/normalizer/Normalizer.java b/modules/normalizer/src/main/java/org/apache/commons/weaver/normalizer/Normalizer.java index 6d12d42..1bc29fd 100644 --- a/modules/normalizer/src/main/java/org/apache/commons/weaver/normalizer/Normalizer.java +++ b/modules/normalizer/src/main/java/org/apache/commons/weaver/normalizer/Normalizer.java @@ -32,8 +32,6 @@ import java.util.Map; import java.util.Set; import java.util.stream.Stream; -import javax.activation.DataSource; - import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.Conversion; import org.apache.commons.lang3.Validate; @@ -275,7 +273,7 @@ public class Normalizer { super.visitEnd(); final byte[] bytecode = ((ClassWriter) cv).toByteArray(); - final DataSource classfile = env.getClassfile(className); + final WeaveEnvironment.Resource classfile = env.getClassfile(className); env.debug("Writing class %s to %s", className, classfile.getName()); try (OutputStream outputStream = classfile.getOutputStream()) { outputStream.write(bytecode); diff --git a/modules/pom.xml b/modules/pom.xml index 127682d..ce924dd 100644 --- a/modules/pom.xml +++ b/modules/pom.xml @@ -22,7 +22,7 @@ under the License. <parent> <artifactId>commons-weaver-parent</artifactId> <groupId>org.apache.commons</groupId> - <version>1.4-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> <relativePath>../parent/pom.xml</relativePath> </parent> diff --git a/modules/privilizer/api/pom.xml b/modules/privilizer/api/pom.xml index b694280..5c6d26a 100644 --- a/modules/privilizer/api/pom.xml +++ b/modules/privilizer/api/pom.xml @@ -22,7 +22,7 @@ under the License. <parent> <groupId>org.apache.commons</groupId> <artifactId>commons-weaver-privilizer-parent</artifactId> - <version>1.4-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </parent> <artifactId>commons-weaver-privilizer-api</artifactId> diff --git a/modules/privilizer/pom.xml b/modules/privilizer/pom.xml index af7aedc..279ad8c 100644 --- a/modules/privilizer/pom.xml +++ b/modules/privilizer/pom.xml @@ -23,7 +23,7 @@ under the License. <parent> <groupId>org.apache.commons</groupId> <artifactId>commons-weaver-modules-parent</artifactId> - <version>1.4-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </parent> <artifactId>commons-weaver-privilizer-parent</artifactId> diff --git a/modules/privilizer/weaver/pom.xml b/modules/privilizer/weaver/pom.xml index 1119dc5..e9003a4 100644 --- a/modules/privilizer/weaver/pom.xml +++ b/modules/privilizer/weaver/pom.xml @@ -22,7 +22,7 @@ under the License. <parent> <groupId>org.apache.commons</groupId> <artifactId>commons-weaver-privilizer-parent</artifactId> - <version>1.4-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </parent> <artifactId>commons-weaver-privilizer</artifactId> diff --git a/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Privilizer.java b/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Privilizer.java index 218cea3..0799bb0 100644 --- a/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Privilizer.java +++ b/modules/privilizer/weaver/src/main/java/org/apache/commons/weaver/privilizer/Privilizer.java @@ -26,8 +26,6 @@ import java.io.StringWriter; import java.util.HashSet; import java.util.Set; -import javax.activation.DataSource; - import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; @@ -109,7 +107,7 @@ public class Privilizer { if (verify) { verify(className, bytecode); } - final DataSource classfile = env.getClassfile(className); + final WeaveEnvironment.Resource classfile = env.getClassfile(className); env.debug("Writing class %s to resource %s", className, classfile.getName()); try (OutputStream outputStream = classfile.getOutputStream()) { outputStream.write(bytecode); diff --git a/parent/pom.xml b/parent/pom.xml index 6acbe0d..e5f276c 100755 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -23,7 +23,7 @@ under the License. <parent> <groupId>org.apache.commons</groupId> <artifactId>commons-weaver-base</artifactId> - <version>1.4-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> </parent> <artifactId>commons-weaver-parent</artifactId> diff --git a/pom.xml b/pom.xml index 16d2759..6d4224c 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ under the License. </parent> <artifactId>commons-weaver-base</artifactId> - <version>1.4-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> <packaging>pom</packaging> <name>Apache Commons Weaver</name> @@ -58,6 +58,8 @@ under the License. <commons.scmPubUrl>https://svn.apache.org/repos/infra/websites/production/commons/content/proper/${commons.site.path}</commons.scmPubUrl> <commons.japicmp.version>0.11.1</commons.japicmp.version> + <!-- remove after 2.0 release: --> + <commons.japicmp.breakBuildOnBinaryIncompatibleModifications>false</commons.japicmp.breakBuildOnBinaryIncompatibleModifications> <!-- most Java-related items are defined in parent/pom.xml; define these here for the animal-sniffer config of commons-parent: --> @@ -362,6 +364,35 @@ under the License. <profiles> <profile> + <id>java10plus</id> + <activation> + <jdk>[10,)</jdk> + </activation> + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>com.github.siom79.japicmp</groupId> + <artifactId>japicmp-maven-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.glassfish.jaxb</groupId> + <artifactId>jaxb-runtime</artifactId> + <version>2.3.0.1</version> + </dependency> + <!-- needed temporarily to compare against the 1.x API --> + <dependency> + <groupId>javax.activation</groupId> + <artifactId>javax.activation-api</artifactId> + <version>1.2.0</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </pluginManagement> + </build> + </profile> + <profile> <id>release</id> <build> <plugins> diff --git a/processor/pom.xml b/processor/pom.xml index e68d99f..f3b7413 100644 --- a/processor/pom.xml +++ b/processor/pom.xml @@ -22,7 +22,7 @@ under the License. <parent> <groupId>org.apache.commons</groupId> <artifactId>commons-weaver-parent</artifactId> - <version>1.4-SNAPSHOT</version> + <version>2.0-SNAPSHOT</version> <relativePath>../parent/pom.xml</relativePath> </parent> diff --git a/processor/src/main/java/org/apache/commons/weaver/model/WeaveEnvironment.java b/processor/src/main/java/org/apache/commons/weaver/model/WeaveEnvironment.java index 955f2d4..5785dff 100644 --- a/processor/src/main/java/org/apache/commons/weaver/model/WeaveEnvironment.java +++ b/processor/src/main/java/org/apache/commons/weaver/model/WeaveEnvironment.java @@ -35,7 +35,10 @@ import org.apache.commons.weaver.spi.Weaver; * Encapsulates the environment in which a {@link Weaver} or {@link Cleaner} must operate. */ public abstract class WeaveEnvironment { - private class Resource implements DataSource { + /** + * Represents a {@link WeaveEnvironment} resource. + */ + public class Resource { private final String name; Resource(final String name) { @@ -46,7 +49,6 @@ public abstract class WeaveEnvironment { * Get the content type, always "application/octet-stream". * @return {@link String} */ - @Override public String getContentType() { return CONTENT_TYPE; } @@ -54,7 +56,6 @@ public abstract class WeaveEnvironment { /** * Get an {@link InputStream} for reading this {@link Resource}. */ - @Override public InputStream getInputStream() throws IOException { return classLoader.getResourceAsStream(name); } @@ -63,7 +64,6 @@ public abstract class WeaveEnvironment { * Get the name of this {@link Resource}. * @return {@link String} */ - @Override public String getName() { return name; } @@ -72,7 +72,6 @@ public abstract class WeaveEnvironment { * Get an {@link OutputStream} for writing to this {@link Resource}. * @return {@link OutputStream} */ - @Override public OutputStream getOutputStream() throws IOException { return WeaveEnvironment.this.getOutputStream(name); } @@ -177,7 +176,7 @@ public abstract class WeaveEnvironment { * @param cls type * @return {@link DataSource} */ - public final DataSource getClassfile(final Class<?> cls) { + public final Resource getClassfile(final Class<?> cls) { return getClassfile(cls.getName()); } @@ -186,7 +185,7 @@ public abstract class WeaveEnvironment { * @param classname of type * @return {@link DataSource} */ - public final DataSource getClassfile(final String classname) { + public final Resource getClassfile(final String classname) { return getResource(getResourceName(classname)); } @@ -195,7 +194,7 @@ public abstract class WeaveEnvironment { * @param name of resource * @return {@link DataSource} */ - public final DataSource getResource(final String name) { + public final Resource getResource(final String name) { return new Resource(name); }