From fa0bff4ef49b117959beb96186d639954a3c0181 Mon Sep 17 00:00:00 2001
Date: Fri, 25 Jan 2019 21:32:55 +0200
Subject: [PATCH 5/6] Bug 543850 - Update artifactcomparator asm dep to 7.0

Update the asm version to 7.0 and switch to using Opcodes.ASM7 API in
ClassReader.

Change-Id: I957f79413e49424a9f82de99d541d75b3f2f99be
---
 tycho-artifactcomparator/pom.xml                     | 12 ++++++++++--
 .../zipcomparator/internal/ClassfileComparator.java  | 12 +++---------
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/tycho-artifactcomparator/pom.xml b/tycho-artifactcomparator/pom.xml
index f2c3c43..4831be1 100644
--- a/tycho-artifactcomparator/pom.xml
+++ b/tycho-artifactcomparator/pom.xml
@@ -19,13 +19,21 @@
     <version>1.3.0</version>
   </parent>
   <artifactId>tycho-artifactcomparator</artifactId>
+  <properties>
+    <asm-version>7.0</asm-version>
+  </properties>
 
   <dependencies>
     <dependency>
       <!-- XXX need to do CQ ritual -->
       <groupId>org.ow2.asm</groupId>
-      <artifactId>asm-debug-all</artifactId>
-      <version>5.0.3</version>
+      <artifactId>asm-tree</artifactId>
+      <version>${asm-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.ow2.asm</groupId>
+      <artifactId>asm-util</artifactId>
+      <version>${asm-version}</version>
     </dependency>
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
diff --git a/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/ClassfileComparator.java b/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/ClassfileComparator.java
index c69bd2c..52ba2dc 100644
--- a/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/ClassfileComparator.java
+++ b/tycho-artifactcomparator/src/main/java/org/eclipse/tycho/zipcomparator/internal/ClassfileComparator.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2012 Sonatype Inc. and others.
+ * Copyright (c) 2012, 2019 Sonatype Inc. and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -17,7 +17,6 @@ import java.io.StringWriter;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.Comparator;
 import java.util.List;
 
 import org.apache.maven.plugin.MojoExecution;
@@ -63,17 +62,12 @@ public class ClassfileComparator implements ContentsComparator {
     private String disassemble(byte[] bytes) {
         ClassReader reader = new ClassReader(bytes);
         ClassNode clazz = new ClassNode();
-        reader.accept(clazz, Opcodes.ASM5 | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
+        reader.accept(clazz, Opcodes.ASM6 | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
 
         // inner class list gets reordered during pack200 normalization
         if (clazz.innerClasses != null) {
             List<InnerClassNode> sorted = new ArrayList<>(clazz.innerClasses);
-            Collections.sort(sorted, new Comparator<InnerClassNode>() {
-                @Override
-                public int compare(InnerClassNode o1, InnerClassNode o2) {
-                    return o1.name.compareTo(o2.name);
-                }
-            });
+            Collections.sort(sorted, (o1, o2) -> o1.name.compareTo(o2.name));
             clazz.innerClasses = sorted;
         }
 
-- 
2.20.1

