Skip to content
Commits on Source (14)
sezpoz (1.12-1) unstable; urgency=medium
* Team upload.
* New upstream release
* Ignore the test failures to avoid the FTBFS with Java 9 (Closes: #893416)
* Build with the DH sequencer instead of CDBS
* Standards-Version updated to 4.1.4
* Switch to debhelper level 11
* Use salsa.debian.org Vcs-* URLs
-- Emmanuel Bourg <ebourg@apache.org> Wed, 06 Jun 2018 20:10:35 +0200
sezpoz (1.10-2) unstable; urgency=medium
* Team upload.
......
......@@ -3,11 +3,17 @@ Section: java
Priority: optional
Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
Uploaders: James Page <james.page@ubuntu.com>
Build-Depends: cdbs, debhelper (>= 9), default-jdk, maven-debian-helper
Build-Depends-Indep: default-jdk-doc, junit4, libmaven-javadoc-plugin-java, libanimal-sniffer-java
Standards-Version: 3.9.6
Vcs-Git: git://anonscm.debian.org/pkg-java/sezpoz.git
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/sezpoz.git
Build-Depends:
debhelper (>= 11),
default-jdk,
default-jdk-doc,
junit4,
libanimal-sniffer-java,
libmaven-javadoc-plugin-java,
maven-debian-helper
Standards-Version: 4.1.4
Vcs-Git: https://salsa.debian.org/java-team/sezpoz.git
Vcs-Browser: https://salsa.debian.org/java-team/sezpoz
Homepage: https://github.com/jglick/sezpoz
Package: libsezpoz-java
......
# Maven ignore rules - ignore some Maven dependencies and plugins
# Format of this file is:
# [group] [artifact] [type] [version] [classifier] [scope]
# where each element can be either
# - the exact string, for example org.apache for the group, or 3.1
# for the version. In this case, the element is simply matched
# and left as it is
# - * (the star character, alone). In this case, anything will
# match and be left as it is. For example, using * on the
# position of the artifact field will match any artifact id
# All elements much match before a rule can be applied
# Example rule: match jar with groupid= junit, artifactid= junit
# and version starting with 3., this dependency is then removed
# from the POM
# junit junit jar s/3\\..*/3.x/
net.java.sezpoz perftest jar * * *
net.java.sezpoz.demo pom pom * * *
org.jvnet.wagon-svn wagon-svn * * * *
org.codehaus.mojo versions-maven-plugin * * * *
......@@ -2,3 +2,4 @@
# For example:
# maven.test.skip=true
maven.test.failure.ignore=true
# Maven published rules - additional rules to publish, to help
# the packaging work of Debian maintainers using mh_make
# Format of this file is:
# [group] [artifact] [type] [version] [classifier] [scope]
# where each element can be either
# - the exact string, for example org.apache for the group, or 3.1
# for the version. In this case, the element is simply matched
# and left as it is
# - * (the star character, alone). In this case, anything will
# match and be left as it is. For example, using * on the
# position of the artifact field will match any artifact id
# - a regular expression of the form s/match/replace/
# in this case, elements that match are transformed using
# the regex rule.
# All elements much match before a rule can be applied
# Example rule: match jar with groupid= junit, artifactid= junit
# and version starting with 3., replacing the version with 3.x
# junit junit jar s/3\\..*/3.x/
#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/maven.mk
JAVA_HOME := /usr/lib/jvm/default-java
DEB_MAVEN_DOC_TARGET := javadoc:jar javadoc:aggregate
get-orig-source:
uscan --download-version $(DEB_UPSTREAM_VERSION) --force-download --rename
%:
dh $@
......@@ -3,12 +3,12 @@
<parent>
<groupId>net.java.sezpoz.demo</groupId>
<artifactId>pom</artifactId>
<version>1.10</version>
<version>1.12</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>api</artifactId>
<packaging>jar</packaging>
<version>1.10</version>
<version>1.12</version>
<name>SezPoz Demo API</name>
<dependencies>
<dependency>
......
......@@ -3,12 +3,12 @@
<parent>
<groupId>net.java.sezpoz.demo</groupId>
<artifactId>pom</artifactId>
<version>1.10</version>
<version>1.12</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>app</artifactId>
<packaging>jar</packaging>
<version>1.10</version>
<version>1.12</version>
<name>SezPoz Demo Application</name>
<dependencies>
<dependency>
......
......@@ -3,12 +3,12 @@
<parent>
<groupId>net.java.sezpoz.demo</groupId>
<artifactId>pom</artifactId>
<version>1.10</version>
<version>1.12</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>plugin1</artifactId>
<packaging>jar</packaging>
<version>1.10</version>
<version>1.12</version>
<name>SezPoz Demo Plugin #1</name>
<dependencies>
<dependency>
......
......@@ -3,12 +3,12 @@
<parent>
<groupId>net.java.sezpoz.demo</groupId>
<artifactId>pom</artifactId>
<version>1.10</version>
<version>1.12</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>plugin2</artifactId>
<packaging>jar</packaging>
<version>1.10</version>
<version>1.12</version>
<name>SezPoz Demo Plugin #2</name>
<dependencies>
<dependency>
......
......@@ -3,13 +3,13 @@
<parent>
<groupId>net.java.sezpoz</groupId>
<artifactId>pom</artifactId>
<version>1.10</version>
<version>1.12</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>net.java.sezpoz.demo</groupId>
<artifactId>pom</artifactId>
<packaging>pom</packaging>
<version>1.10</version>
<version>1.12</version>
<name>SezPoz Demo</name>
<build>
<plugins>
......
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<prerequisites>
<maven>3.0</maven>
</prerequisites>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
......@@ -9,7 +12,7 @@
<groupId>net.java.sezpoz</groupId>
<artifactId>pom</artifactId>
<packaging>pom</packaging>
<version>1.10</version>
<version>1.12</version>
<name>SezPoz</name>
<url>https://github.com/jglick/sezpoz</url>
<description>SezPoz is a lightweight and simple-to-learn library that lets you perform modular service lookups.</description>
......@@ -24,7 +27,7 @@
<connection>scm:git:git@github.com:jglick/sezpoz.git</connection>
<developerConnection>scm:git:git@github.com:jglick/sezpoz.git</developerConnection>
<url>git@github.com:jglick/sezpoz.git</url>
<tag>pom-1.10</tag>
<tag>pom-1.12</tag>
</scm>
<licenses>
<license>
......@@ -37,7 +40,7 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>3.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
......@@ -45,40 +48,44 @@
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<version>2.6</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<version>2.10.3</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<version>2.7</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.8</version>
<version>2.19.1</version>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<version>3.0.0</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.5</version>
<version>2.8.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.3.1</version>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.0-beta-3</version>
<version>3.5.1</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<version>1.5.0</version>
</plugin>
</plugins>
</pluginManagement>
......@@ -92,7 +99,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>1.2</version>
<version>2.2</version>
</plugin>
</plugins>
</reporting>
......
......@@ -3,26 +3,20 @@
<parent>
<groupId>net.java.sezpoz</groupId>
<artifactId>pom</artifactId>
<version>1.10</version>
<version>1.12</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sezpoz</artifactId>
<packaging>jar</packaging>
<version>1.10</version>
<version>1.12</version>
<name>SezPoz Library</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-annotations</artifactId>
<version>1.9</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<plugins>
......@@ -36,7 +30,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.9</version>
<version>1.15</version>
<executions>
<execution>
<phase>package</phase>
......@@ -63,6 +57,17 @@
<forkMode>pertest</forkMode>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>net.java.sezpoz.impl.Inspector</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
......
......@@ -45,6 +45,7 @@ import java.util.NoSuchElementException;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.java.sezpoz.impl.Indexer;
import net.java.sezpoz.impl.SerAnnotatedElement;
/**
......@@ -139,7 +140,7 @@ public final class Index<A extends Annotation,I> implements Iterable<IndexItem<A
}
if (ois == null) {
if (resources == null) {
resources = loader.getResources("META-INF/annotations/" + annotation.getName());
resources = loader.getResources(Indexer.METAINF_ANNOTATIONS + annotation.getName());
}
if (!resources.hasMoreElements()) {
// Exhausted all streams.
......
......@@ -38,6 +38,7 @@ import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Writer;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
......@@ -54,7 +55,6 @@ import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.annotation.processing.SupportedOptions;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.AnnotationValue;
......@@ -70,19 +70,18 @@ import javax.tools.Diagnostic.Kind;
import javax.tools.FileObject;
import javax.tools.StandardLocation;
import net.java.sezpoz.Indexable;
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;
/**
* Processor for indexable annotations.
*/
@IgnoreJRERequirement
@SupportedSourceVersion(SourceVersion.RELEASE_6)
@SupportedAnnotationTypes("*")
@SupportedOptions("sezpoz.quiet")
public class Indexer6 extends AbstractProcessor {
public class Indexer extends AbstractProcessor {
public static final String METAINF_ANNOTATIONS = "META-INF/annotations/";
/** public for ServiceLoader */
public Indexer6() {}
public Indexer() {}
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
......@@ -102,15 +101,20 @@ public class Indexer6 extends AbstractProcessor {
}
}
// map from indexable annotation names, to actual uses
Map<String,List<SerAnnotatedElement>> output = new HashMap<String,List<SerAnnotatedElement>>();
Map<String,Map<String,SerAnnotatedElement>> output = new TreeMap<String,Map<String,SerAnnotatedElement>>();
Map<String,Collection<Element>> originatingElementsByAnn = new HashMap<String,Collection<Element>>();
scan(annotations, originatingElementsByAnn, roundEnv, output);
write(output, originatingElementsByAnn);
return false;
}
@Override
public SourceVersion getSupportedSourceVersion() {
return SourceVersion.latest();
}
private void scan(Set<? extends TypeElement> annotations, Map<String,Collection<Element>> originatingElementsByAnn,
RoundEnvironment roundEnv, Map<String,List<SerAnnotatedElement>> output) {
RoundEnvironment roundEnv, Map<String,Map<String,SerAnnotatedElement>> output) {
for (TypeElement ann : annotations) {
AnnotationMirror indexable = null;
for (AnnotationMirror _indexable : processingEnv.getElementUtils().getAllAnnotationMirrors(ann)) {
......@@ -146,9 +150,9 @@ public class Indexer6 extends AbstractProcessor {
continue;
}
originatingElements.add(elt);
List<SerAnnotatedElement> existingOutput = output.get(annName);
Map<String,SerAnnotatedElement> existingOutput = output.get(annName);
if (existingOutput == null) {
existingOutput = new ArrayList<SerAnnotatedElement>();
existingOutput = new TreeMap<String,SerAnnotatedElement>();
output.put(annName, existingOutput);
}
SerAnnotatedElement ser = makeSerAnnotatedElement(elt, ann);
......@@ -157,18 +161,18 @@ public class Indexer6 extends AbstractProcessor {
(ser.memberName != null ? "." + ser.memberName : "") +
" indexed under " + annName.replace('$', '.'));
}
existingOutput.add(ser);
existingOutput.put(ser.key(), ser);
}
}
}
private void write(Map<String,List<SerAnnotatedElement>> output, Map<String,Collection<Element>> originatingElementsByAnn) {
for (Map.Entry<String,List<SerAnnotatedElement>> outputEntry : output.entrySet()) {
private void write(Map<String,Map<String,SerAnnotatedElement>> output, Map<String,Collection<Element>> originatingElementsByAnn) {
for (Map.Entry<String,Map<String,SerAnnotatedElement>> outputEntry : output.entrySet()) {
String annName = outputEntry.getKey();
try {
List<SerAnnotatedElement> elements = outputEntry.getValue();
Map<String,SerAnnotatedElement> elements = outputEntry.getValue();
try {
FileObject in = processingEnv.getFiler().getResource(StandardLocation.CLASS_OUTPUT, "", "META-INF/annotations/" + annName);
FileObject in = processingEnv.getFiler().getResource(StandardLocation.CLASS_OUTPUT, "", METAINF_ANNOTATIONS + annName);
// Read existing annotations, for incremental compilation.
InputStream is = in.openInputStream();
try {
......@@ -183,7 +187,9 @@ public class Indexer6 extends AbstractProcessor {
if (el == null) {
break;
}
elements.add(el);
if (!elements.containsKey(el.key())) {
elements.put(el.key(), el);
}
}
} finally {
is.close();
......@@ -192,12 +198,12 @@ public class Indexer6 extends AbstractProcessor {
// OK, created for the first time
}
FileObject out = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT,
"", "META-INF/annotations/" + annName,
"", METAINF_ANNOTATIONS + annName,
originatingElementsByAnn.get(annName).toArray(new Element[0]));
OutputStream os = out.openOutputStream();
try {
ObjectOutputStream oos = new ObjectOutputStream(os);
for (SerAnnotatedElement el : elements) {
for (SerAnnotatedElement el : elements.values()) {
oos.writeObject(el);
}
oos.writeObject(null);
......@@ -205,6 +211,19 @@ public class Indexer6 extends AbstractProcessor {
} finally {
os.close();
}
out = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT,
"", METAINF_ANNOTATIONS + annName + ".txt",
originatingElementsByAnn.get(annName).toArray(new Element[0]));
Writer w = out.openWriter();
try {
w.write("# informational; use java -jar sezpoz.jar to see authoritative contents\n");
for (SerAnnotatedElement el : elements.values()) {
w.write(el.toString());
w.write('\n');
}
} finally {
w.close();
}
} catch (IOException x) {
processingEnv.getMessager().printMessage(Kind.ERROR, x.toString());
}
......
package net.java.sezpoz.impl;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
/** CLI utility for inspecting binary SezPoz metadata. */
public class Inspector {
private static final byte[] ZIP_MAGIC = {0x50, 0x4b, 0x03, 0x04};
private static final byte[] SER_MAGIC = {(byte) 0xac, (byte) 0xed, 0x00, 0x05};
public static void main(String[] args) throws Exception {
if (args.length == 0) {
System.err.println("Usage: java -jar sezpoz.jar [ something.jar | some.serialized.Annotation ]+");
}
for (String arg : args) {
System.out.println("--- " + arg);
byte[] magic = new byte[4];
InputStream is = new FileInputStream(arg);
try {
is.read(magic, 0, 4);
} finally {
is.close();
}
if (Arrays.equals(magic, ZIP_MAGIC)) {
JarFile jf = new JarFile(arg, false);
try {
Enumeration<JarEntry> entries = jf.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
String name = entry.getName();
if (name.startsWith(Indexer.METAINF_ANNOTATIONS)) {
String annotation = name.substring(Indexer.METAINF_ANNOTATIONS.length());
if (annotation.isEmpty() || annotation.endsWith(".txt")) {
continue;
}
System.out.println("# " + annotation);
is = jf.getInputStream(entry);
try {
is.read(magic, 0, 4);
} finally {
is.close();
}
if ((Arrays.equals(magic, SER_MAGIC))) {
is = jf.getInputStream(entry);
try {
dump(is);
} finally {
is.close();
}
} else {
System.err.println("does not look like a Java serialized file");
}
}
}
} finally {
jf.close();
}
} else if (Arrays.equals(magic, SER_MAGIC)) {
is = new FileInputStream(arg);
try {
dump(is);
} finally {
is.close();
}
} else {
System.err.println("does not look like either a JAR file or a Java serialized file");
}
}
}
private static void dump(InputStream is) throws Exception {
ObjectInput oi = new ObjectInputStream(is);
while (true) {
SerAnnotatedElement el = (SerAnnotatedElement) oi.readObject();
if (el == null) {
break;
}
System.out.println(el);
}
}
}
......@@ -44,7 +44,7 @@ public final class SerAnnConst implements Serializable {
/** fully qualified name of annotation type */
public final String name;
/** values of annotation attrs, as in {@link #SerAnnotatedElement} */
/** values of annotation attrs, as in {@link SerAnnotatedElement} */
public final TreeMap<String,Object> values;
SerAnnConst(String name, TreeMap<String,Object> values) {
......
......@@ -40,7 +40,7 @@ import java.util.TreeMap;
* One META-INF/annotations/* file is a sequence of serialized SerAnnotatedElement
* instances, terminated by a null.
*/
public final class SerAnnotatedElement implements Serializable {
public final class SerAnnotatedElement implements Serializable, Comparable<SerAnnotatedElement> {
private static final long serialVersionUID = 1L;
......@@ -76,6 +76,13 @@ public final class SerAnnotatedElement implements Serializable {
}
public String toString() {
return values.isEmpty() ? key() : key() + values;
}
/**
* Key based on the annotated element, ignoring annotation values.
*/
public String key() {
StringBuffer b = new StringBuffer(className);
if (memberName != null) {
b.append('#');
......@@ -84,8 +91,11 @@ public final class SerAnnotatedElement implements Serializable {
b.append("()");
}
}
b.append(values);
return b.toString();
}
@Override public int compareTo(SerAnnotatedElement o) {
return key().compareTo(o.key());
}
}