[ 
https://issues.apache.org/jira/browse/BEAM-9252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17030897#comment-17030897
 ] 

Luke Cwik commented on BEAM-9252:
---------------------------------

ASM and javac both have bugs so I'm not surprised that shading exposed yet 
another one.

 

The *module-info.class* is invalid since it contains:
{code:java}
module com.google.gson {
 requires java.base;
 requires transitive java.sql;
 
 exports com.google.gson;
 exports com.google.gson.annotations;
 exports com.google.gson.reflect;
 exports com.google.gson.stream;
}{code}
 

 The decompiled *Main.class* looks like:
{code:java}
package org.apache.beam.vendor.grpc.v1p26p0.org.jboss.modules;

import java.io.File;
import java.security.AccessController;
import java.security.PrivilegedAction;

public final class Main {
  static {
    long start = StartTimeHolder.START_TIME;
  }
  
  private static final String[] NO_STRINGS = new String[0];
  
  private static void usage() {
    System.out.println("Usage: java [-jvmoptions...] -jar " + getJarName() + 
".jar [-options...] <module-spec> [args...]");
    System.out.println("       java [-jvmoptions...] -jar " + getJarName() + 
".jar [-options...] -jar <jar-name> [args...]");
    System.out.println("       java [-jvmoptions...] -jar " + getJarName() + 
".jar [-options...] -cp <class-path> <class-name> [args...]");
    System.out.println("       java [-jvmoptions...] -jar " + getJarName() + 
".jar [-options...] -class <class-name> [args...]");
    System.out.println("where <module-spec> is a valid module specification 
string");
    System.out.println("and options include:");
    System.out.println("    -help         Display this message");
    System.out.println("    -modulepath <search path of directories>");
    System.out.println("    -mp <search path of directories>");
    System.out.println("                  A list of directories, separated by 
'" + File.pathSeparator + "', where modules may be located");
    System.out.println("                  If not specified, the value of the 
\"module.path\" system property is used");
    System.out.println("    -class        Specify that the final argument is 
a");
    System.out.println("                  class to load from the class path; 
not compatible with -jar");
    System.out.println("    -cp,-classpath <search path of archives or 
directories>");
    System.out.println("                  A search path for class files; 
implies -class");
    System.out.println("    -dep,-dependencies 
<module-spec>[,<module-spec>,...]");
    System.out.println("                  A list of module dependencies to add 
to the class path;");
    System.out.println("                  requires -class or -cp");
    System.out.println("    -jar          Specify that the final argument is 
the name of a");
    System.out.println("                  JAR file to run as a module; not 
compatible with -class");
    System.out.println("    -config <config-location>");
    System.out.println("                  The location of the module 
configuration.  Either -mp or -config");
    System.out.println("                  may be specified, but not both");
    System.out.println("    -logmodule <module-name>");
    System.out.println("                  The module to use to load the system 
logmanager");
    System.out.println("    -version      Print version and exit\n");
  }
  
  public static void main(String[] args) throws Throwable {
    // Byte code:
    //   0: aload_0
    //   1: arraylength
    //   2: istore_1
    //   3: aconst_null
    //   4: astore_2
    //   5: getstatic 
org/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/Main.NO_STRINGS : 
[Ljava/lang/String;
    //   8: astore_3
    //   9: aconst_null
    //   10: astore #4
    //   12: aconst_null
    //   13: astore #5
    //   15: aconst_null
    //   16: astore #6
    //   18: iconst_0
    //   19: istore #7
    //   21: iconst_0
    //   22: istore #8
    //   24: iconst_0
    //   25: istore #9
    //   27: aconst_null
    //   28: astore #10
    //   30: aconst_null
    //   31: astore #11
    //   33: iconst_0
    //   34: istore #12
    //   36: iload_1
    //   37: istore #13
    //   39: iload #12
    //   41: iload #13
    //   43: if_icmpge -> 649
    //   46: aload_0
    //   47: iload #12
    //   49: aaload
    //   50: astore #14
    //   52: aload #14
    //   54: iconst_0
    //   55: invokevirtual charAt : (I)C
    //   58: bipush #45
    //   60: if_icmpne -> 580
    //   63: ldc '-version'
    //   65: aload #14
    //   67: invokevirtual equals : (Ljava/lang/Object;)Z
    //   70: ifeq -> 101
    //   73: getstatic java/lang/System.out : Ljava/io/PrintStream;
    //   76: new java/lang/StringBuilder
    //   79: dup
    //   80: invokespecial <init> : ()V
    //   83: ldc 'Module loader '
    //   85: invokevirtual append : 
(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   88: invokestatic getVersionString : ()Ljava/lang/String;
    //   91: invokevirtual append : 
(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   94: invokevirtual toString : ()Ljava/lang/String;
    //   97: invokevirtual println : (Ljava/lang/String;)V
    //   100: return
    //   101: ldc '-help'
    //   103: aload #14
    //   105: invokevirtual equals : (Ljava/lang/Object;)Z
    //   108: ifeq -> 115
    //   111: invokestatic usage : ()V
    //   114: return
    //   115: ldc '-modulepath'
    //   117: aload #14
    //   119: invokevirtual equals : (Ljava/lang/Object;)Z
    //   122: ifne -> 135
    //   125: ldc '-mp'
    //   127: aload #14
    //   129: invokevirtual equals : (Ljava/lang/Object;)Z
    //   132: ifeq -> 189
    //   135: aload #4
    //   137: ifnull -> 152
    //   140: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   143: ldc 'Module path may only be specified once'
    //   145: invokevirtual println : (Ljava/lang/String;)V
    //   148: iconst_1
    //   149: invokestatic exit : (I)V
    //   152: aload #5
    //   154: ifnull -> 169
    //   157: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   160: ldc 'Module path may not be specified with config path'
    //   162: invokevirtual println : (Ljava/lang/String;)V
    //   165: iconst_1
    //   166: invokestatic exit : (I)V
    //   169: aload_0
    //   170: iinc #12, 1
    //   173: iload #12
    //   175: aaload
    //   176: astore #4
    //   178: ldc 'module.path'
    //   180: aload #4
    //   182: invokestatic setProperty : 
(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //   185: pop
    //   186: goto -> 613
    //   189: ldc '-config'
    //   191: aload #14
    //   193: invokevirtual equals : (Ljava/lang/Object;)Z
    //   196: ifeq -> 245
    //   199: aload #5
    //   201: ifnull -> 216
    //   204: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   207: ldc 'Config file path may only be specified once'
    //   209: invokevirtual println : (Ljava/lang/String;)V
    //   212: iconst_1
    //   213: invokestatic exit : (I)V
    //   216: aload #4
    //   218: ifnull -> 233
    //   221: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   224: ldc 'Module path may not be specified with config path'
    //   226: invokevirtual println : (Ljava/lang/String;)V
    //   229: iconst_1
    //   230: invokestatic exit : (I)V
    //   233: aload_0
    //   234: iinc #12, 1
    //   237: iload #12
    //   239: aaload
    //   240: astore #5
    //   242: goto -> 613
    //   245: ldc '-logmodule'
    //   247: aload #14
    //   249: invokevirtual equals : (Ljava/lang/Object;)Z
    //   252: ifeq -> 270
    //   255: aload_0
    //   256: iinc #12, 1
    //   259: iload #12
    //   261: aaload
    //   262: invokestatic fromString : 
(Ljava/lang/String;)Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleIdentifier;
    //   265: astore #11
    //   267: goto -> 613
    //   270: ldc '-jar'
    //   272: aload #14
    //   274: invokevirtual equals : (Ljava/lang/Object;)Z
    //   277: ifeq -> 337
    //   280: iload #7
    //   282: ifeq -> 297
    //   285: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   288: ldc '-jar flag may only be specified once'
    //   290: invokevirtual println : (Ljava/lang/String;)V
    //   293: iconst_1
    //   294: invokestatic exit : (I)V
    //   297: iload #8
    //   299: ifeq -> 314
    //   302: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   305: ldc '-cp/-classpath may not be specified with -jar'
    //   307: invokevirtual println : (Ljava/lang/String;)V
    //   310: iconst_1
    //   311: invokestatic exit : (I)V
    //   314: iload #9
    //   316: ifeq -> 331
    //   319: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   322: ldc '-class may not be specified with -jar'
    //   324: invokevirtual println : (Ljava/lang/String;)V
    //   327: iconst_1
    //   328: invokestatic exit : (I)V
    //   331: iconst_1
    //   332: istore #7
    //   334: goto -> 613
    //   337: ldc '-cp'
    //   339: aload #14
    //   341: invokevirtual equals : (Ljava/lang/Object;)Z
    //   344: ifne -> 357
    //   347: ldc '-classpath'
    //   349: aload #14
    //   351: invokevirtual equals : (Ljava/lang/Object;)Z
    //   354: ifeq -> 438
    //   357: iload #8
    //   359: ifeq -> 374
    //   362: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   365: ldc '-cp or -classpath may only be specified once.'
    //   367: invokevirtual println : (Ljava/lang/String;)V
    //   370: iconst_1
    //   371: invokestatic exit : (I)V
    //   374: iload #9
    //   376: ifeq -> 391
    //   379: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   382: ldc '-class may not be specified with -cp/classpath'
    //   384: invokevirtual println : (Ljava/lang/String;)V
    //   387: iconst_1
    //   388: invokestatic exit : (I)V
    //   391: iload #7
    //   393: ifeq -> 408
    //   396: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   399: ldc '-cp/-classpath may not be specified with -jar'
    //   401: invokevirtual println : (Ljava/lang/String;)V
    //   404: iconst_1
    //   405: invokestatic exit : (I)V
    //   408: iconst_1
    //   409: istore #8
    //   411: aload_0
    //   412: iinc #12, 1
    //   415: iload #12
    //   417: aaload
    //   418: astore #6
    //   420: new 
org/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/PropertyWriteAction
    //   423: dup
    //   424: ldc 'java.class.path'
    //   426: aload #6
    //   428: invokespecial <init> : (Ljava/lang/String;Ljava/lang/String;)V
    //   431: invokestatic doPrivileged : 
(Ljava/security/PrivilegedAction;)Ljava/lang/Object;
    //   434: pop
    //   435: goto -> 613
    //   438: ldc '-dep'
    //   440: aload #14
    //   442: invokevirtual equals : (Ljava/lang/Object;)Z
    //   445: ifne -> 458
    //   448: ldc '-dependencies'
    //   450: aload #14
    //   452: invokevirtual equals : (Ljava/lang/Object;)Z
    //   455: ifeq -> 485
    //   458: aload_2
    //   459: ifnull -> 474
    //   462: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   465: ldc '-dep or -dependencies may only be specified once.'
    //   467: invokevirtual println : (Ljava/lang/String;)V
    //   470: iconst_1
    //   471: invokestatic exit : (I)V
    //   474: aload_0
    //   475: iinc #12, 1
    //   478: iload #12
    //   480: aaload
    //   481: astore_2
    //   482: goto -> 613
    //   485: ldc '-class'
    //   487: aload #14
    //   489: invokevirtual equals : (Ljava/lang/Object;)Z
    //   492: ifeq -> 552
    //   495: iload #9
    //   497: ifeq -> 512
    //   500: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   503: ldc '-class flag may only be specified once'
    //   505: invokevirtual println : (Ljava/lang/String;)V
    //   508: iconst_1
    //   509: invokestatic exit : (I)V
    //   512: iload #8
    //   514: ifeq -> 529
    //   517: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   520: ldc '-class may not be specified with -cp/classpath'
    //   522: invokevirtual println : (Ljava/lang/String;)V
    //   525: iconst_1
    //   526: invokestatic exit : (I)V
    //   529: iload #7
    //   531: ifeq -> 546
    //   534: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   537: ldc '-class may not be specified with -jar'
    //   539: invokevirtual println : (Ljava/lang/String;)V
    //   542: iconst_1
    //   543: invokestatic exit : (I)V
    //   546: iconst_1
    //   547: istore #9
    //   549: goto -> 613
    //   552: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   555: ldc 'Invalid option '%s'\\n'
    //   557: iconst_1
    //   558: anewarray java/lang/Object
    //   561: dup
    //   562: iconst_0
    //   563: aload #14
    //   565: aastore
    //   566: invokevirtual printf : 
(Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;
    //   569: pop
    //   570: invokestatic usage : ()V
    //   573: iconst_1
    //   574: invokestatic exit : (I)V
    //   577: goto -> 613
    //   580: aload #14
    //   582: astore #10
    //   584: iload_1
    //   585: iload #12
    //   587: isub
    //   588: iconst_1
    //   589: isub
    //   590: istore #15
    //   592: iload #15
    //   594: anewarray java/lang/String
    //   597: astore_3
    //   598: aload_0
    //   599: iload #12
    //   601: iconst_1
    //   602: iadd
    //   603: aload_3
    //   604: iconst_0
    //   605: iload #15
    //   607: invokestatic arraycopy : 
(Ljava/lang/Object;ILjava/lang/Object;II)V
    //   610: goto -> 649
    //   613: goto -> 643
    //   616: astore #15
    //   618: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   621: ldc 'Argument expected for option %s\\n'
    //   623: iconst_1
    //   624: anewarray java/lang/Object
    //   627: dup
    //   628: iconst_0
    //   629: aload #14
    //   631: aastore
    //   632: invokevirtual printf : 
(Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;
    //   635: pop
    //   636: invokestatic usage : ()V
    //   639: iconst_1
    //   640: invokestatic exit : (I)V
    //   643: iinc #12, 1
    //   646: goto -> 39
    //   649: aload_2
    //   650: ifnull -> 675
    //   653: iload #9
    //   655: ifne -> 675
    //   658: iload #8
    //   660: ifne -> 675
    //   663: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   666: ldc '-deps may only be specified when -cp/-classpath or -class is 
in use'
    //   668: invokevirtual println : (Ljava/lang/String;)V
    //   671: iconst_1
    //   672: invokestatic exit : (I)V
    //   675: aload #10
    //   677: ifnonnull -> 732
    //   680: iload #9
    //   682: ifne -> 690
    //   685: iload #8
    //   687: ifeq -> 701
    //   690: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   693: ldc 'No class name specified'
    //   695: invokevirtual println : (Ljava/lang/String;)V
    //   698: goto -> 725
    //   701: iload #7
    //   703: ifeq -> 717
    //   706: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   709: ldc 'No JAR specified'
    //   711: invokevirtual println : (Ljava/lang/String;)V
    //   714: goto -> 725
    //   717: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   720: ldc 'No module specified'
    //   722: invokevirtual println : (Ljava/lang/String;)V
    //   725: invokestatic usage : ()V
    //   728: iconst_1
    //   729: invokestatic exit : (I)V
    //   732: aload #5
    //   734: ifnull -> 754
    //   737: new java/io/File
    //   740: dup
    //   741: aload #5
    //   743: invokespecial <init> : (Ljava/lang/String;)V
    //   746: invokestatic parseModuleConfigXml : 
(Ljava/io/File;)Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleLoader;
    //   749: astore #13
    //   751: goto -> 759
    //   754: getstatic 
org/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/DefaultBootModuleLoaderHolder.INSTANCE
 : Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleLoader;
    //   757: astore #13
    //   759: iload #7
    //   761: ifeq -> 797
    //   764: new 
org/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/JarModuleLoader
    //   767: dup
    //   768: aload #13
    //   770: new java/util/jar/JarFile
    //   773: dup
    //   774: aload #10
    //   776: invokespecial <init> : (Ljava/lang/String;)V
    //   779: invokespecial <init> : 
(Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleLoader;Ljava/util/jar/JarFile;)V
    //   782: astore #12
    //   784: aload #12
    //   786: checkcast 
org/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/JarModuleLoader
    //   789: invokevirtual getMyIdentifier : 
()Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleIdentifier;
    //   792: astore #14
    //   794: goto -> 842
    //   797: iload #8
    //   799: ifne -> 807
    //   802: iload #9
    //   804: ifeq -> 831
    //   807: new 
org/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ClassPathModuleLoader
    //   810: dup
    //   811: aload #13
    //   813: aload #10
    //   815: aload #6
    //   817: aload_2
    //   818: invokespecial <init> : 
(Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleLoader;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    //   821: astore #12
    //   823: getstatic 
org/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleIdentifier.CLASSPATH
 : Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleIdentifier;
    //   826: astore #14
    //   828: goto -> 842
    //   831: aload #13
    //   833: astore #12
    //   835: aload #10
    //   837: invokestatic fromString : 
(Ljava/lang/String;)Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleIdentifier;
    //   840: astore #14
    //   842: aload #12
    //   844: invokestatic initBootModuleLoader : 
(Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleLoader;)V
    //   847: aload #11
    //   849: ifnull -> 1142
    //   852: aload #12
    //   854: aload #11
    //   856: invokevirtual loadModule : 
(Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleIdentifier;)Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/Module;
    //   859: invokevirtual getClassLoaderPrivate : 
()Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleClassLoader;
    //   862: astore #15
    //   864: aload #15
    //   866: ldc_w 'META-INF/services/java.util.logging.LogManager'
    //   869: invokevirtual getResourceAsStream : 
(Ljava/lang/String;)Ljava/io/InputStream;
    //   872: astore #16
    //   874: aload #16
    //   876: ifnull -> 1115
    //   879: new java/io/BufferedReader
    //   882: dup
    //   883: new java/io/InputStreamReader
    //   886: dup
    //   887: aload #16
    //   889: invokespecial <init> : (Ljava/io/InputStream;)V
    //   892: invokespecial <init> : (Ljava/io/Reader;)V
    //   895: astore #17
    //   897: aconst_null
    //   898: astore #18
    //   900: aload #17
    //   902: invokevirtual readLine : ()Ljava/lang/String;
    //   905: dup
    //   906: astore #19
    //   908: ifnull -> 961
    //   911: aload #19
    //   913: bipush #35
    //   915: invokevirtual indexOf : (I)I
    //   918: istore #20
    //   920: iload #20
    //   922: iconst_m1
    //   923: if_icmpeq -> 936
    //   926: aload #19
    //   928: iconst_0
    //   929: iload #20
    //   931: invokevirtual substring : (II)Ljava/lang/String;
    //   934: astore #19
    //   936: aload #19
    //   938: invokevirtual trim : ()Ljava/lang/String;
    //   941: astore #19
    //   943: aload #19
    //   945: invokevirtual length : ()I
    //   948: ifne -> 954
    //   951: goto -> 900
    //   954: aload #19
    //   956: astore #18
    //   958: goto -> 961
    //   961: aload #18
    //   963: ifnull -> 1057
    //   966: ldc_w 'java.util.logging.manager'
    //   969: aload #18
    //   971: invokestatic setProperty : 
(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //   974: pop
    //   975: aload #15
    //   977: invokestatic setContextClassLoader : 
(Ljava/lang/ClassLoader;)Ljava/lang/ClassLoader;
    //   980: astore #20
    //   982: invokestatic getLogManager : ()Ljava/util/logging/LogManager;
    //   985: invokevirtual getClass : ()Ljava/lang/Class;
    //   988: ldc_w java/util/logging/LogManager
    //   991: if_acmpne -> 1024
    //   994: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   997: new java/lang/StringBuilder
    //   1000: dup
    //   1001: invokespecial <init> : ()V
    //   1004: ldc_w 'WARNING: Failed to load the specified logmodule '
    //   1007: invokevirtual append : 
(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   1010: aload #11
    //   1012: invokevirtual append : 
(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    //   1015: invokevirtual toString : ()Ljava/lang/String;
    //   1018: invokevirtual println : (Ljava/lang/String;)V
    //   1021: goto -> 1034
    //   1024: new 
org/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/log/JDKModuleLogger
    //   1027: dup
    //   1028: invokespecial <init> : ()V
    //   1031: invokestatic setModuleLogger : 
(Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/log/ModuleLogger;)V
    //   1034: aload #20
    //   1036: invokestatic setContextClassLoader : 
(Ljava/lang/ClassLoader;)Ljava/lang/ClassLoader;
    //   1039: pop
    //   1040: goto -> 1054
    //   1043: astore #21
    //   1045: aload #20
    //   1047: invokestatic setContextClassLoader : 
(Ljava/lang/ClassLoader;)Ljava/lang/ClassLoader;
    //   1050: pop
    //   1051: aload #21
    //   1053: athrow
    //   1054: goto -> 1084
    //   1057: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   1060: new java/lang/StringBuilder
    //   1063: dup
    //   1064: invokespecial <init> : ()V
    //   1067: ldc_w 'WARNING: No log manager services defined in specified 
logmodule '
    //   1070: invokevirtual append : 
(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   1073: aload #11
    //   1075: invokevirtual append : 
(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    //   1078: invokevirtual toString : ()Ljava/lang/String;
    //   1081: invokevirtual println : (Ljava/lang/String;)V
    //   1084: aload #16
    //   1086: invokevirtual close : ()V
    //   1089: goto -> 1112
    //   1092: astore #17
    //   1094: goto -> 1112
    //   1097: astore #22
    //   1099: aload #16
    //   1101: invokevirtual close : ()V
    //   1104: goto -> 1109
    //   1107: astore #23
    //   1109: aload #22
    //   1111: athrow
    //   1112: goto -> 1142
    //   1115: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   1118: new java/lang/StringBuilder
    //   1121: dup
    //   1122: invokespecial <init> : ()V
    //   1125: ldc_w 'WARNING: No log manager service descriptor found in 
specified logmodule '
    //   1128: invokevirtual append : 
(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   1131: aload #11
    //   1133: invokevirtual append : 
(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    //   1136: invokevirtual toString : ()Ljava/lang/String;
    //   1139: invokevirtual println : (Ljava/lang/String;)V
    //   1142: aload #12
    //   1144: aload #14
    //   1146: invokevirtual loadModule : 
(Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleIdentifier;)Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/Module;
    //   1149: astore #15
    //   1151: goto -> 1169
    //   1154: astore #16
    //   1156: aload #16
    //   1158: getstatic java/lang/System.err : Ljava/io/PrintStream;
    //   1161: invokevirtual printStackTrace : (Ljava/io/PrintStream;)V
    //   1164: iconst_1
    //   1165: invokestatic exit : (I)V
    //   1168: return
    //   1169: invokestatic installMBeanServer : ()V
    //   1172: aload #15
    //   1174: aload_3
    //   1175: invokevirtual run : ([Ljava/lang/String;)V
    //   1178: goto -> 1189
    //   1181: astore #16
    //   1183: aload #16
    //   1185: invokevirtual getCause : ()Ljava/lang/Throwable;
    //   1188: athrow
    //   1189: return
    // Line number table:
    //   Java source line number -> byte code offset
    //   #95    -> 0
    //   #96    -> 3
    //   #97    -> 5
    //   #98    -> 9
    //   #99    -> 12
    //   #100    -> 15
    //   #101    -> 18
    //   #102    -> 21
    //   #103    -> 24
    //   #104    -> 27
    //   #105    -> 30
    //   #106    -> 33
    //   #107    -> 46
    //   #109    -> 52
    //   #111    -> 63
    //   #115    -> 108
    //   #116    -> 111
    //   #119    -> 135
    //   #120    -> 143
    //   #126    -> 162
    //   #133    -> 207
    //   #138    -> 234
    //   #142    -> 272
    //   #143    -> 280
    //   #150    -> 305
    //   #153    -> 316
    //   #154    -> 322
    //   #165    -> 384
    //   #167    -> 388
    //   #168    -> 391
    //   #170    -> 417
    //   #175    -> 450
    //   #177    -> 470
    //   #178    -> 475
    //   #185    -> 503
    //   #198    -> 555
    //   #199    -> 562
    //   #201    -> 580
    //   #204    -> 588
    //   #106    -> 613
    //   #211    -> 632
    //   #212    -> 640
    //   #217    -> 649
    //   #222    -> 685
    //   #224    -> 693
    //   #225    -> 695
    //   #232    -> 720
    //   #236    -> 729
    //   #237    -> 749
    //   #245    -> 807
    //   #247    -> 817
    //   #254    -> 864
    //   #259    -> 900
    //   #261    -> 918
    //   #262    -> 922
    //   #266    -> 938
    //   #268    -> 945
    //   #281    -> 1045
    //   #284    -> 1050
    //   #282    -> 1053
    //   #281    -> 1060
    //   #284    -> 1070
    //   #297    -> 1111
    //   #296    -> 1128
    //   #304    -> 1149
    // Local variable table:
    //   start    length    slot    name    descriptor
    //   562    64974    15    cnt    I
    //   588    25    15    e    Ljava/lang/IndexOutOfBoundsException;
    //   52    561    14    arg    Ljava/lang/String;
    //   36    65500    12    i    I
    //   39    65497    13    argsLength    I
    //   717    3    13    environmentLoader    
Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleLoader;
    //   749    64787    12    loader    
Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleLoader;
    //   759    64777    14    moduleIdentifier    
Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleIdentifier;
    //   0    0    12    loader    
Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleLoader;
    //   0    0    14    moduleIdentifier    
Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleIdentifier;
    //   0    0    20    i    I
    //   945    64591    20    old    Ljava/lang/ClassLoader;
    //   0    1045    17    reader    Ljava/io/BufferedReader;
    //   864    181    18    name    Ljava/lang/String;
    //   872    173    19    line    Ljava/lang/String;
    //   0    0    17    ignored    Ljava/io/IOException;
    //   1070    0    23    ignored    Ljava/io/IOException;
    //   0    0    15    classLoader    
Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleClassLoader;
    //   0    0    16    stream    Ljava/io/InputStream;
    //   0    0    16    e    
Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleNotFoundException;
    //   0    1149    16    e    Ljava/lang/reflect/InvocationTargetException;
    //   0    0    0    args    [Ljava/lang/String;
    //   3    65533    1    argsLen    I
    //   5    65531    2    deps    Ljava/lang/String;
    //   9    65527    3    moduleArgs    [Ljava/lang/String;
    //   12    65524    4    modulePath    Ljava/lang/String;
    //   15    65521    5    configPath    Ljava/lang/String;
    //   18    65518    6    classpath    Ljava/lang/String;
    //   21    65515    7    jar    Z
    //   24    65512    8    classpathDefined    Z
    //   27    65509    9    classDefined    Z
    //   30    65506    10    moduleIdentifierOrExeName    Ljava/lang/String;
    //   33    65503    11    logManagerModuleIdentifier    
Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleIdentifier;
    //   0    0    12    loader    
Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleLoader;
    //   0    0    13    environmentLoader    
Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleLoader;
    //   807    64729    14    moduleIdentifier    
Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleIdentifier;
    //   1111    64425    15    module    
Lorg/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/Module;
    // Exception table:
    //   from    to    target    type
    //   52    100    616    java/lang/IndexOutOfBoundsException
    //   101    114    616    java/lang/IndexOutOfBoundsException
    //   115    610    616    java/lang/IndexOutOfBoundsException
    //   879    1084    1097    finally
    //   982    1034    1043    finally
    //   1043    1045    1043    finally
    //   1084    1089    1092    java/io/IOException
    //   1097    1099    1097    finally
    //   1099    1104    1107    java/io/IOException
    //   1142    1151    1154    
org/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleNotFoundException
    //   1169    1178    1181    java/lang/reflect/InvocationTargetException
  }
  
  private static ClassLoader setContextClassLoader(final ClassLoader 
classLoader) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null)
      return AccessController.<ClassLoader>doPrivileged(new 
PrivilegedAction<ClassLoader>() {
            public ClassLoader run() {
              return Main.doSetContextClassLoader(classLoader);
            }
          }); 
    return doSetContextClassLoader(classLoader);
  }
  
  private static ClassLoader doSetContextClassLoader(ClassLoader classLoader) {
    try {
      return Thread.currentThread().getContextClassLoader();
    } finally {
      Thread.currentThread().setContextClassLoader(classLoader);
    } 
  }
  
  public static String getJarName() {
    return "jboss-modules";
  }
  
  public static String getVersionString() {
    return "1.1.0.Beta1";
  }
}
1107 java/io/IOException
 // 1142 1151 1154 
org/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/ModuleNotFoundException
 // 1169 1178 1181 java/lang/reflect/InvocationTargetException
 }
 
 private static ClassLoader setContextClassLoader(final ClassLoader 
classLoader) {
 SecurityManager sm = System.getSecurityManager();
 if (sm != null)
 return AccessController.<ClassLoader>doPrivileged(new 
PrivilegedAction<ClassLoader>() {
 public ClassLoader run() {
 return Main.doSetContextClassLoader(classLoader);
 }
 }); 
 return doSetContextClassLoader(classLoader);
 }
 
 private static ClassLoader doSetContextClassLoader(ClassLoader classLoader) {
 try {
 return Thread.currentThread().getContextClassLoader();
 } finally {
 Thread.currentThread().setContextClassLoader(classLoader);
 } 
 }
 
 public static String getJarName() {
 return "jboss-modules";
 }
 
 public static String getVersionString() {
 return "1.1.0.Beta1";
 }
}{code}
 

> Problem shading Beam pipeline with Beam 2.20.0-SNAPSHOT
> -------------------------------------------------------
>
>                 Key: BEAM-9252
>                 URL: https://issues.apache.org/jira/browse/BEAM-9252
>             Project: Beam
>          Issue Type: Bug
>          Components: build-system
>    Affects Versions: 2.20.0
>            Reporter: Ismaël Mejía
>            Priority: Blocker
>             Fix For: 2.20.0
>
>
> I was checking today a pipeline against the latest 2.20.0-SNAPSHOT and I 
> found that it works perfectly with version 2.19.0, but it is failing with a  
> shade related exception that refers to grpc 1.26.0:
> {{[ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-shade-plugin:3.2.1:shade (default) on project 
> EventsToIOs: Error creating shaded jar: Problem shading JAR 
> /home/ismael/.m2/repository/org/apache/beam/beam-vendor-grpc-1_26_0/0.1/beam-vendor-grpc-1_26_0-0.1.jar
>  entry org/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/Main.class: 
> org.apache.maven.plugin.MojoExecutionException: Error in ASM processing class 
> org/apache/beam/vendor/grpc/v1p26p0/org/jboss/modules/Main.class: 65536 -> 
> [Help 1]}}
> {{There is also a warning that is not present in the build against 2.19.0}}
> {{[WARNING] Discovered module-info.class. Shading will break its strong 
> encapsulation.}}
>  
> I wonder if we are not doing something wrong during our vendoring, can 
> someone take a look please.
> This is relatively easy to reproduce with the beam-samples repo, just clone 
> it and run:
> {{git clone https://github.com/jbonofre/beam-samples
> ]mvn clean verify -Pbeam-release-repo -Dbeam.version=2.20.0-SNAPSHOT}}
> Available logs of the latest run:
> [https://github.com/jbonofre/beam-samples/runs/427537544?check_suite_focus=true]
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to