[Git][java-team/javassist][upstream] New upstream version 3.27.0

Emmanuel Bourg gitlab at salsa.debian.org
Sun Jun 7 22:05:12 BST 2020



Emmanuel Bourg pushed to branch upstream at Debian Java Maintainers / javassist


Commits:
d7f2e612 by Emmanuel Bourg at 2020-06-07T23:02:17+02:00
New upstream version 3.27.0
- - - - -


14 changed files:

- README.md
- Readme.html
- build.xml
- pom.xml
- src/main/META-INF/MANIFEST.MF
- src/main/javassist/ClassPoolTail.java
- src/main/javassist/CtClass.java
- src/main/javassist/bytecode/ConstPool.java
- src/main/javassist/bytecode/InstructionPrinter.java
- src/main/javassist/bytecode/stackmap/Tracer.java
- src/main/javassist/compiler/MemberCodeGen.java
- src/main/javassist/compiler/Parser.java
- src/main/javassist/compiler/ast/ArrayInit.java
- src/test/javassist/JvstTest5.java


Changes:

=====================================
README.md
=====================================
@@ -1,7 +1,7 @@
 Java bytecode engineering toolkit
 ### [Javassist version 3](http://www.javassist.org)
 
-Copyright (C) 1999-2019 by Shigeru Chiba, All rights reserved.
+Copyright (C) 1999-2020 by Shigeru Chiba, All rights reserved.
 
 Javassist (JAVA programming ASSISTant) makes Java bytecode manipulation
 simple. It is a class library for editing bytecodes in Java; it enables Java


=====================================
Readme.html
=====================================
@@ -7,7 +7,7 @@
 
 <h1>Javassist version 3</h1>
 
-<h3>Copyright (C) 1999-2019 by Shigeru Chiba, All rights reserved.</h3>
+<h3>Copyright (C) 1999-2020 by Shigeru Chiba, All rights reserved.</h3>
 
 <p><br></p>
 
@@ -281,6 +281,11 @@ see javassist.Dump.
 
 <h2>Changes</h2>
 
+<p>-version 3.27 on March 19, 2020
+<ul>
+   <li>GitHub Issue #271 (PR #279), #280 (PR #281), #282, and PR #294.
+</ul>
+
 <p>-version 3.26 on October 3, 2019
 <ul>
    <li>GitHub Issue #270 (PR #272), #265 (PR #267), #271, #222, and #275.


=====================================
build.xml
=====================================
@@ -6,7 +6,7 @@
 
 <project name="javassist" default="jar" basedir=".">
 
-  <property name="dist-version" value="javassist-3.26.0-GA"/>
+  <property name="dist-version" value="javassist-3.27.0-GA"/>
 
   <property environment="env"/>
   <property name="target.jar" value="javassist.jar"/>


=====================================
pom.xml
=====================================
@@ -7,7 +7,7 @@
   	Javassist (JAVA programming ASSISTant) makes Java bytecode manipulation
     simple.  It is a class library for editing bytecodes in Java.
   </description>
-  <version>3.26.0-GA</version>
+  <version>3.27.0-GA</version>
   <name>Javassist</name>
   <url>http://www.javassist.org/</url>
 
@@ -202,7 +202,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-javadoc-plugin</artifactId>
-        <version>3.0.1</version>
+        <version>3.2.0</version>
 	<configuration>
 	  <attach>true</attach>
           <excludePackageNames>javassist.compiler:javassist.convert:javassist.scopedpool:javassist.bytecode.stackmap</excludePackageNames>
@@ -211,6 +211,7 @@ Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.</i>]]></bottom>
           <show>public</show>
           <nohelp>true</nohelp>
           <doclint>none</doclint>
+          <source>8</source>
 	</configuration>
       </plugin>
       <plugin>


=====================================
src/main/META-INF/MANIFEST.MF
=====================================
@@ -1,5 +1,5 @@
 Specification-Title: Javassist
 Specification-Vendor: Shigeru Chiba, www.javassist.org
-Specification-Version: 3.26.0-GA
+Specification-Version: 3.27.0-GA
 Main-Class: javassist.CtClass
 Automatic-Module-Name: org.javassist


=====================================
src/main/javassist/ClassPoolTail.java
=====================================
@@ -25,9 +25,9 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.ArrayList;
 import java.util.Collections;
-import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 
@@ -128,15 +128,15 @@ final class JarDirClassPath implements ClassPath {
 }
 
 final class JarClassPath implements ClassPath {
-    List<String> jarfileEntries;
+    Set<String> jarfileEntries;
     String jarfileURL;
 
     JarClassPath(String pathname) throws NotFoundException {
         JarFile jarfile = null;
         try {
             jarfile = new JarFile(pathname);
-            jarfileEntries = new ArrayList<String>();
-            for (JarEntry je:Collections.list(jarfile.entries()))
+            jarfileEntries = new HashSet<String>();
+            for (JarEntry je: Collections.list(jarfile.entries()))
                 if (je.getName().endsWith(".class"))
                     jarfileEntries.add(je.getName());
             jarfileURL = new File(pathname).getCanonicalFile()


=====================================
src/main/javassist/CtClass.java
=====================================
@@ -69,7 +69,7 @@ public abstract class CtClass {
     /**
      * The version number of this release.
      */
-    public static final String version = "3.26.0-GA";
+    public static final String version = "3.27.0-GA";
 
     /**
      * Prints the version number and the copyright notice.
@@ -80,7 +80,7 @@ public abstract class CtClass {
      */
     public static void main(String[] args) {
         System.out.println("Javassist version " + CtClass.version);
-        System.out.println("Copyright (C) 1999-2019 Shigeru Chiba."
+        System.out.println("Copyright (C) 1999-2020 Shigeru Chiba."
                            + " All Rights Reserved.");
     }
 


=====================================
src/main/javassist/bytecode/ConstPool.java
=====================================
@@ -110,8 +110,10 @@ public final class ConstPool
     public static final int CONST_Dynamic = DynamicInfo.tag;
 
     /**
-     * <code>CONSTANT_InvokeDynamic</code>
+     * <code>CONSTANT_DynamicCallSite</code>,
+     * also known as <code>CONSTANT_InvokeDynamic</code>
      */
+    public static final int CONST_DynamicCallSite = InvokeDynamicInfo.tag;
     public static final int CONST_InvokeDynamic = InvokeDynamicInfo.tag;
 
     /**


=====================================
src/main/javassist/bytecode/InstructionPrinter.java
=====================================
@@ -285,7 +285,7 @@ public class InstructionPrinter implements Opcode {
             case ConstPool.CONST_Long:
                 return "#" + index + " = long " + pool.getLongInfo(index);
             case ConstPool.CONST_Double:
-                return "#" + index + " = int " + pool.getDoubleInfo(index);
+                return "#" + index + " = double " + pool.getDoubleInfo(index);
             case ConstPool.CONST_Class:
                 return classInfo(pool, index);
             default:


=====================================
src/main/javassist/bytecode/stackmap/Tracer.java
=====================================
@@ -263,6 +263,10 @@ public abstract class Tracer implements TypeTag {
         }
         else if (tag == ConstPool.CONST_Class)
             stackTypes[stackTop++] = new TypeData.ClassName("java.lang.Class");
+        else if (tag == ConstPool.CONST_Dynamic) {
+            String desc = cpool.getDynamicType(index);
+            pushMemberType(desc);
+        }
         else
             throw new RuntimeException("bad LDC: " + tag);
     }


=====================================
src/main/javassist/compiler/MemberCodeGen.java
=====================================
@@ -365,7 +365,7 @@ public class MemberCodeGen extends CodeGen {
                 sizeExpr.accept(this);
         else
             if (sizeExpr == null) {
-                int s = init.length();
+                int s = init.size();
                 bytecode.addIconst(s);
             }
             else
@@ -414,7 +414,7 @@ public class MemberCodeGen extends CodeGen {
         }
 
         if (init != null) {
-            int s = init.length();
+            int s = init.size();
             ASTList list = init;
             for (int i = 0; i < s; i++) {
                 bytecode.addOpcode(DUP);


=====================================
src/main/javassist/compiler/Parser.java
=====================================
@@ -681,6 +681,10 @@ public final class Parser implements TokenId {
         throws CompileError
     {
         lex.get();      // '{'
+        if(lex.lookAhead() == '}'){
+            lex.get();
+            return new ArrayInit(null);
+        }
         ASTree expr = parseExpression(tbl);
         ArrayInit init = new ArrayInit(expr);
         while (lex.lookAhead() == ',') {


=====================================
src/main/javassist/compiler/ast/ArrayInit.java
=====================================
@@ -25,10 +25,27 @@ public class ArrayInit extends ASTList {
     /** default serialVersionUID */
     private static final long serialVersionUID = 1L;
 
+    /**
+     * Constructs an object.
+     * @param firstElement      maybe null when the initializer is <code>{}</code> (empty).
+     */
     public ArrayInit(ASTree firstElement) {
         super(firstElement);
     }
 
+    /**
+     * Gets the number of the elements.  Don't call {@link #length()}.
+     *
+     * @return the number of the elements.
+     */
+    public int size() {
+        int s = length();
+        if (s == 1 && head() == null)
+            return 0;
+        else
+            return s;
+    }
+
     @Override
     public void accept(Visitor v) throws CompileError { v.atArrayInit(this); }
 


=====================================
src/test/javassist/JvstTest5.java
=====================================
@@ -558,4 +558,20 @@ public class JvstTest5 extends JvstTestRoot {
         Object obj = make(cc.getName());
         assertEquals(71 + 22, invoke(obj, "run"));
     }
+
+    // PR #294
+    public void testEmptyArrayInit() throws Exception {
+        CtClass cc = sloader.makeClass("test5.EmptyArrayInit");
+        CtMethod m = CtNewMethod.make("public int[] foo(){ int[] a = {}; return a; }", cc);
+        cc.addMethod(m);
+        CtMethod m2 = CtNewMethod.make("public int[] bar(){ int[] a = new int[]{}; return a; }", cc);
+        cc.addMethod(m2);
+        CtMethod m3 = CtNewMethod.make("public String[] baz(){ String[] a = { null }; return a; }", cc);
+        cc.addMethod(m3);
+        CtMethod m0 = CtNewMethod.make("public int run() { return foo().length + bar().length + baz().length; }", cc);
+        cc.addMethod(m0);
+        cc.writeFile();
+        Object obj = make(cc.getName());
+        assertEquals(1, invoke(obj, "run"));
+    }
 }



View it on GitLab: https://salsa.debian.org/java-team/javassist/-/commit/d7f2e612ae22db8d1367d326d67a03b709f82457

-- 
View it on GitLab: https://salsa.debian.org/java-team/javassist/-/commit/d7f2e612ae22db8d1367d326d67a03b709f82457
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20200607/44fc8933/attachment.html>


More information about the pkg-java-commits mailing list