Bug#845606: The Bytecode Should Not Be Targeting Java 1.2

殷啟聰 seamlikok at gmail.com
Fri Nov 25 05:44:22 UTC 2016


Package: libasm-java
Version: 5.1-1
Severity: important

The current package of libasm-java contains classes that targets the
ancient Java 1.2 where generics is not supported. When I was building
a package for Jack (Java Android Compiler Kit) which uses the generics
code in ASM, it yielded the following errors:

```
<somewhere>/android-toolchain-jack/jill/src/com/android/jill/frontend/java/MethodBodyWriter.java:196:
error: type Analyzer does not take parameters
  private final Analyzer<BasicValue> analyzer;
                        ^
```

But apparently `org.objectweb.asm.tree.analysis.Analyzer<V>` takes a
type parameter. FYI, `MethodBodyWriter.java` can be found at [1].

So I suspected this was caused by the Java version of the bytecodes,
and I found out that the classes in `asm-all.jar` is for Java 1.2.

By observing the build scripts of ASM I found that it was the
"shrinking" process [2] that changed the classes to Java 1.2 instead
of 1.5 as indicated by `build.xml`. After I applied
`-Dproduct.noshrink=true` to the build command, as the documentation
suggests, Jack was successfully built with the resulting
`asm-all.jar`.

Therefore, I wish the maintainers of this package turn off the
"shrinking" process. According to the ASM documentations [2],
"shrinking" is merely for reducing JAR size, which is not necessary in
this case.

[1]: https://android.googlesource.com/toolchain/jack/+/ub-jack-douarn-b8/jill/src/com/android/jill/frontend/java/MethodBodyWriter.java
[2]: http://asm.ow2.org/doc/developer-guide.html#building



More information about the pkg-java-maintainers mailing list