changeset 3510:515df83430aa

Enhancement: add signature attribute support for any type-variables Prepend the special char '^' in front of any type-variable declarations in signature attributes.
author mcimadamore
date Wed, 15 Jun 2016 18:05:40 +0100
parents 6949c3d06e8f
children ca533bf26159
files src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Fri May 27 14:18:42 2016 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Wed Jun 15 18:05:40 2016 +0100
@@ -5708,6 +5708,9 @@
             append('<');
             for (List<Type> ts = typarams; ts.nonEmpty(); ts = ts.tail) {
                 Type.TypeVar tvar = (Type.TypeVar) ts.head;
+                if (types.isSpecializableTypeVar(tvar)) {
+                    append('^');
+                }
                 append(tvar.tsym.name);
                 List<Type> bounds = types.getBounds(tvar);
                 if ((bounds.head.tsym.flags() & INTERFACE) != 0) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri May 27 14:18:42 2016 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Wed Jun 15 18:05:40 2016 +0100
@@ -563,6 +563,9 @@
      */
     Type sigToTypeParam() {
         int start = sigp;
+        if (signature[sigp] == '^') {
+            start = ++sigp; //skip any type-var annotation
+        }
         while (signature[sigp] != ':') sigp++;
         Name name = names.fromUtf(signature, start, sigp - start);
         TypeVar tvar;