[lombok-ast] 01/04: Build with libasm-java (>= 5.0) instead of libasm3-java/libasm4-java

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Fri Sep 29 15:18:09 UTC 2017


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to branch master
in repository lombok-ast.

commit 4b6bfcd13fe6017ed7577fe3958d4f28334a72c3
Author: Emmanuel Bourg <ebourg at apache.org>
Date:   Fri Sep 29 17:14:38 2017 +0200

    Build with libasm-java (>= 5.0) instead of libasm3-java/libasm4-java
---
 debian/changelog                       |   7 +
 debian/control                         |   3 +-
 debian/patches/asm-compatibility.patch | 311 +++++++++++++++++++++++++++++++++
 debian/patches/series                  |   1 +
 4 files changed, 320 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index e702368..a742cbd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+lombok-ast (0.2+ds-3) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * Build with libasm-java (>= 5.0) instead of libasm3-java/libasm4-java
+
+ -- Emmanuel Bourg <ebourg at apache.org>  Fri, 29 Sep 2017 09:31:04 +0200
+
 lombok-ast (0.2+ds-2) unstable; urgency=medium
 
   * Drop liblombok-ast-java.jlibs and use maven-repo-helper to install
diff --git a/debian/control b/debian/control
index eced85f..96a67db 100644
--- a/debian/control
+++ b/debian/control
@@ -12,8 +12,7 @@ Build-Depends:
  default-jdk,
  ivyplusplus,
  javahelper,
- libasm4-java,
- libasm3-java,
+ libasm-java (>= 5.0),
  libintellij-annotations-java,
  libecj-java,
  libguava-java,
diff --git a/debian/patches/asm-compatibility.patch b/debian/patches/asm-compatibility.patch
new file mode 100644
index 0000000..0ba9d9e
--- /dev/null
+++ b/debian/patches/asm-compatibility.patch
@@ -0,0 +1,311 @@
+Description: Build with the latest version of ASM in Debian.
+ The changes were imported from the parboiled package.
+Author: Emmanuel Bourg <ebourg at apache.org>
+Forwarded: no
+--- a/src/main/org/parboiled/transform/InstructionGroupPreparer.java
++++ b/src/main/org/parboiled/transform/InstructionGroupPreparer.java
+@@ -21,7 +21,7 @@
+ import org.objectweb.asm.Label;
+ import org.objectweb.asm.Opcodes;
+ import org.objectweb.asm.Type;
+-import org.objectweb.asm.commons.EmptyVisitor;
++import org.objectweb.asm.MethodVisitor;
+ import org.objectweb.asm.tree.AbstractInsnNode;
+ import org.objectweb.asm.tree.FieldNode;
+ import org.objectweb.asm.tree.VarInsnNode;
+@@ -116,13 +116,14 @@
+         }
+     }
+ 
+-    private static class MD5Digester extends EmptyVisitor {
++    private static class MD5Digester extends MethodVisitor {
+         private static MessageDigest digest;
+         private static ByteBuffer buffer;
+         private final List<Label> labels = new ArrayList<Label>();
+         private final String parserClassName;
+ 
+         public MD5Digester(String parserClassName) {
++            super(Opcodes.ASM4);
+             this.parserClassName = parserClassName;
+             if (digest == null) {
+                 try {
+@@ -251,6 +252,12 @@
+             update(type);
+         }
+ 
++        public void visitField(FieldNode field) {
++            update(field.name);
++            update(field.desc);
++            update(field.signature);
++        }
++
+         private void update(int i) {
+             ensureRemaining(4);
+             buffer.putInt(i);
+@@ -293,4 +300,4 @@
+         }
+     }
+ 
+-}
+\ No newline at end of file
++}
+--- a/src/main/org/parboiled/transform/ClassNodeInitializer.java
++++ b/src/main/org/parboiled/transform/ClassNodeInitializer.java
+@@ -24,19 +24,20 @@
+ 
+ import org.jetbrains.annotations.NotNull;
+ import org.objectweb.asm.*;
+-import org.objectweb.asm.commons.EmptyVisitor;
++import org.objectweb.asm.ClassVisitor;
+ import org.objectweb.asm.tree.MethodNode;
+ import org.parboiled.support.Checks;
+ 
+ import java.io.IOException;
+ 
++import static org.objectweb.asm.Opcodes.*;
+ import static org.parboiled.transform.AsmUtils.createClassReader;
+ import static org.parboiled.transform.AsmUtils.getExtendedParserClassName;
+ 
+ /**
+  * Initializes the basic ParserClassNode fields and collects all methods.
+  */
+-class ClassNodeInitializer extends EmptyVisitor implements Opcodes, Types {
++class ClassNodeInitializer extends ClassVisitor {
+ 
+     private ParserClassNode classNode;
+     private Class<?> ownerClass;
+@@ -44,6 +45,10 @@
+     private boolean hasDontLabelAnnotation;
+     private boolean hasSkipActionsInPredicates;
+ 
++    public ClassNodeInitializer() {
++        super(Opcodes.ASM4);
++    }
++
+     public void process(@NotNull ParserClassNode classNode) throws IOException {
+         this.classNode = classNode;
+ 
+@@ -90,16 +95,16 @@
+ 
+     @Override
+     public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
+-        if (EXPLICIT_ACTIONS_ONLY_DESC.equals(desc)) {
++        if (Types.EXPLICIT_ACTIONS_ONLY_DESC.equals(desc)) {
+             hasExplicitActionOnlyAnnotation = true;
+             return null;
+         }
+-        if (DONT_LABEL_DESC.equals(desc)) {
++        if (Types.DONT_LABEL_DESC.equals(desc)) {
+             hasDontLabelAnnotation = true;
+             return null;
+         }
+ 
+-        if (SKIP_ACTIONS_IN_PREDICATES_DESC.equals(desc)) {
++        if (Types.SKIP_ACTIONS_IN_PREDICATES_DESC.equals(desc)) {
+             hasSkipActionsInPredicates = true;
+             return null;
+         }
+@@ -127,7 +132,7 @@
+         }
+ 
+         // only add non-native, non-abstract methods returning Rules
+-        if (!Type.getReturnType(desc).equals(RULE) || (access & (ACC_NATIVE | ACC_ABSTRACT)) > 0) {
++        if (!Type.getReturnType(desc).equals(Types.RULE) || (access & (ACC_NATIVE | ACC_ABSTRACT)) > 0) {
+             return null;
+         }
+ 
+--- a/src/main/org/parboiled/transform/InstructionGraphNode.java
++++ b/src/main/org/parboiled/transform/InstructionGraphNode.java
+@@ -27,7 +27,7 @@
+ import org.objectweb.asm.tree.AbstractInsnNode;
+ import org.objectweb.asm.tree.analysis.BasicValue;
+ import org.objectweb.asm.tree.analysis.Value;
+-import org.objectweb.asm.util.AbstractVisitor;
++import org.objectweb.asm.util.Printer;
+ 
+ import java.util.ArrayList;
+ import java.util.Collection;
+@@ -36,7 +36,7 @@
+ /**
+  * A node in the instruction dependency graph.
+  */
+-class InstructionGraphNode implements Value, Opcodes {
++class InstructionGraphNode extends BasicValue {
+ 
+     private AbstractInsnNode instruction;
+     private final BasicValue resultValue;
+@@ -52,6 +52,7 @@
+     private InstructionGroup group;
+ 
+     public InstructionGraphNode(AbstractInsnNode instruction, BasicValue resultValue) {
++        super(null);
+         this.instruction = instruction;
+         this.resultValue = resultValue;
+         this.isActionRoot = AsmUtils.isActionRoot(instruction);
+@@ -60,8 +61,8 @@
+         this.isContextSwitch = AsmUtils.isContextSwitch(instruction);
+         this.isCallOnContextAware = AsmUtils.isCallOnContextAware(instruction);
+         this.isCaptureGet = AsmUtils.isCaptureGet(instruction);
+-        this.isXLoad = ILOAD <= instruction.getOpcode() && instruction.getOpcode() < IALOAD;
+-        this.isXStore = ISTORE <= instruction.getOpcode() && instruction.getOpcode() < IASTORE;
++        this.isXLoad = Opcodes.ILOAD <= instruction.getOpcode() && instruction.getOpcode() < Opcodes.IALOAD;
++        this.isXStore = Opcodes.ISTORE <= instruction.getOpcode() && instruction.getOpcode() < Opcodes.IASTORE;
+     }
+ 
+     public int getSize() {
+@@ -136,8 +137,8 @@
+         return isXStore;
+     }
+ 
+-    public void addPredecessors(@NotNull Collection<Value> preds) {
+-        for (Value pred : preds) {
++    public void addPredecessors(@NotNull Collection<BasicValue> preds) {
++        for (BasicValue pred : preds) {
+             if (pred instanceof InstructionGraphNode) {
+                 addPredecessor(((InstructionGraphNode) pred));
+             }
+@@ -152,7 +153,7 @@
+ 
+     @Override
+     public String toString() {
+-        return instruction.getOpcode() != -1 ? AbstractVisitor.OPCODES[instruction.getOpcode()] : super.toString();
++        return instruction.getOpcode() != -1 ? Printer.OPCODES[instruction.getOpcode()] : super.toString();
+     }
+ 
+ }
+--- a/src/main/org/parboiled/transform/RuleMethodInterpreter.java
++++ b/src/main/org/parboiled/transform/RuleMethodInterpreter.java
+@@ -29,14 +29,13 @@
+ import org.objectweb.asm.tree.analysis.AnalyzerException;
+ import org.objectweb.asm.tree.analysis.BasicInterpreter;
+ import org.objectweb.asm.tree.analysis.BasicValue;
+-import org.objectweb.asm.tree.analysis.Value;
+ import org.parboiled.support.Checks;
+ 
+ import java.util.ArrayList;
+ import java.util.Arrays;
+ import java.util.List;
+ 
+-class RuleMethodInterpreter extends BasicInterpreter implements Types {
++class RuleMethodInterpreter extends BasicInterpreter {
+ 
+     private final RuleMethod method;
+     private final List<Edge> additionalEdges = new ArrayList<Edge>();
+@@ -46,8 +45,8 @@
+     }
+ 
+     @Override
+-    public Value newValue(Type type) {
+-        BasicValue basicValue = (BasicValue) super.newValue(type);
++    public BasicValue newValue(Type type) {
++        BasicValue basicValue = super.newValue(type);
+         if (basicValue == BasicValue.REFERENCE_VALUE) {
+             basicValue = new BasicValue(type); // record the exact type and not just "Ljava/lang/Object"
+         }
+@@ -55,27 +54,27 @@
+     }
+ 
+     @Override
+-    public Value newOperation(AbstractInsnNode insn) throws AnalyzerException {
++    public BasicValue newOperation(AbstractInsnNode insn) throws AnalyzerException {
+         return createNode(insn, super.newOperation(insn));
+     }
+ 
+     @Override
+-    public Value copyOperation(AbstractInsnNode insn, Value value) throws AnalyzerException {
++    public BasicValue copyOperation(AbstractInsnNode insn, BasicValue value) throws AnalyzerException {
+         return createNode(insn, super.copyOperation(insn, value), value);
+     }
+ 
+     @Override
+-    public Value unaryOperation(AbstractInsnNode insn, Value value) throws AnalyzerException {
++    public BasicValue unaryOperation(AbstractInsnNode insn, BasicValue value) throws AnalyzerException {
+         return createNode(insn, super.unaryOperation(insn, null), value);
+     }
+ 
+     @Override
+-    public Value binaryOperation(AbstractInsnNode insn, Value value1, Value value2) throws AnalyzerException {
++    public BasicValue binaryOperation(AbstractInsnNode insn, BasicValue value1, BasicValue value2) throws AnalyzerException {
+         return createNode(insn, super.binaryOperation(insn, null, null), value1, value2);
+     }
+ 
+     @Override
+-    public Value ternaryOperation(AbstractInsnNode insn, Value v1, Value v2, Value v3) throws AnalyzerException {
++    public BasicValue ternaryOperation(AbstractInsnNode insn, BasicValue v1, BasicValue v2, BasicValue v3) throws AnalyzerException {
+         // this method is only called for xASTORE instructions, parameter v1 is the value corresponding to the
+         // NEWARRAY, ANEWARRAY or MULTIANEWARRAY instruction having created the array, we need to insert a special
+         // dependency edge from the array creator to this xSTORE instruction
+@@ -85,25 +84,25 @@
+ 
+     @Override
+     @SuppressWarnings({"unchecked"})
+-    public Value naryOperation(AbstractInsnNode insn, List values) throws AnalyzerException {
+-        return createNode(insn, super.naryOperation(insn, null), (Value[]) values.toArray(new Value[values.size()]));
++    public BasicValue naryOperation(AbstractInsnNode insn, List values) throws AnalyzerException {
++        return createNode(insn, super.naryOperation(insn, null), (BasicValue[]) values.toArray(new BasicValue[values.size()]));
+     }
+ 
+     @Override
+-    public void returnOperation(AbstractInsnNode insn, Value value, Value expected) throws AnalyzerException {
++    public void returnOperation(AbstractInsnNode insn, BasicValue value, BasicValue expected) throws AnalyzerException {
+         Preconditions.checkState(insn.getOpcode() == Opcodes.ARETURN);
+-        Preconditions.checkState(unwrap(value).getType().equals(RULE));
+-        Preconditions.checkState(unwrap(expected).getType().equals(RULE));
++        Preconditions.checkState(unwrap(value).getType().equals(Types.RULE));
++        Preconditions.checkState(unwrap(expected).getType().equals(Types.RULE));
+         Preconditions.checkState(method.getReturnInstructionNode() == null);
+         method.setReturnInstructionNode(createNode(insn, null, value));
+     }
+ 
+-    private InstructionGraphNode createNode(AbstractInsnNode insn, Value resultValue, Value... prevNodes) {
++    private InstructionGraphNode createNode(AbstractInsnNode insn, BasicValue resultValue, BasicValue... prevNodes) {
+         return method.setGraphNode(insn, unwrap(resultValue), Arrays.asList(prevNodes));
+     }
+ 
+     @Override
+-    public Value merge(Value v, Value w) {
++    public BasicValue merge(BasicValue v, BasicValue w) {
+         // we don't actually merge values but use the control flow detection to deal with conditionals
+         return v;
+     }
+@@ -117,7 +116,7 @@
+         }
+     }
+ 
+-    private AbstractInsnNode findArrayCreatorPredecessor(Value value) {
++    private AbstractInsnNode findArrayCreatorPredecessor(BasicValue value) {
+         String errorMessage = "Internal error during analysis of rule method '" + method.name +
+                 "', please report this error to info at parboiled.org! Thank you!";
+         Checks.ensure(value instanceof InstructionGraphNode, errorMessage);
+@@ -146,9 +145,9 @@
+         return method.getGraphNodes().get(method.instructions.indexOf(insn));
+     }
+ 
+-    private BasicValue unwrap(Value resultValue) {
+-        return resultValue == null || resultValue instanceof BasicValue ?
+-                (BasicValue) resultValue : ((InstructionGraphNode) resultValue).getResultValue();
++    private BasicValue unwrap(BasicValue resultValue) {
++        return (resultValue != null && resultValue instanceof InstructionGraphNode) ?
++                ((InstructionGraphNode) resultValue).getResultValue() : resultValue;
+     }
+ 
+     private class Edge {
+--- a/src/main/org/parboiled/transform/RuleMethod.java
++++ b/src/main/org/parboiled/transform/RuleMethod.java
+@@ -33,7 +33,6 @@
+ import org.objectweb.asm.tree.LocalVariableNode;
+ import org.objectweb.asm.tree.MethodNode;
+ import org.objectweb.asm.tree.analysis.BasicValue;
+-import org.objectweb.asm.tree.analysis.Value;
+ import org.parboiled.BaseParser;
+ import org.parboiled.common.StringUtils;
+ import org.parboiled.support.Var;
+@@ -185,7 +184,7 @@
+         return name.charAt(0) == '$';
+     }
+ 
+-    public InstructionGraphNode setGraphNode(AbstractInsnNode insn, BasicValue resultValue, List<Value> predecessors) {
++    public InstructionGraphNode setGraphNode(AbstractInsnNode insn, BasicValue resultValue, List<BasicValue> predecessors) {
+         if (graphNodes == null) {
+             // initialize with a list of null values
+             graphNodes = new ArrayList<InstructionGraphNode>(
diff --git a/debian/patches/series b/debian/patches/series
index 5879227..9f6185a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 build.patch
+asm-compatibility.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/lombok-ast.git



More information about the pkg-java-commits mailing list