Merge jdk7-b99

Fri, 18 Jun 2010 15:12:04 -0700

author
jrose
date
Fri, 18 Jun 2010 15:12:04 -0700
changeset 573
005bec70ca27
parent 570
ab1356297c67
parent 572
2a28dcbef3a7
child 574
9d02c4ce4275

Merge

src/share/classes/com/sun/tools/javac/code/Flags.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/code/Source.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/code/Symtab.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/comp/Attr.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/comp/MemberEnter.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/comp/Resolve.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/jvm/ClassReader.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/jvm/Gen.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/main/Main.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/util/Names.java file | annotate | diff | comparison | revisions
test/tools/javac/meth/InvokeDyn.java file | annotate | diff | comparison | revisions
test/tools/javac/meth/InvokeMH.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/javac/code/Flags.java	Thu Jun 17 16:28:21 2010 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Flags.java	Fri Jun 18 15:12:04 2010 -0700
     1.3 @@ -235,6 +235,12 @@
     1.4       */
     1.5      public static final long DISJOINT = 1L<<39;
     1.6  
     1.7 +    /**
     1.8 +     * Flag that marks a signature-polymorphic invoke method.
     1.9 +     * (These occur inside java.dyn.MethodHandle.)
    1.10 +     */
    1.11 +    public static final long POLYMORPHIC_SIGNATURE = 1L<<40;
    1.12 +
    1.13      /** Modifier masks.
    1.14       */
    1.15      public static final int
     2.1 --- a/src/share/classes/com/sun/tools/javac/code/Source.java	Thu Jun 17 16:28:21 2010 -0700
     2.2 +++ b/src/share/classes/com/sun/tools/javac/code/Source.java	Fri Jun 18 15:12:04 2010 -0700
     2.3 @@ -171,6 +171,10 @@
     2.4      public boolean allowStringsInSwitch() {
     2.5          return compareTo(JDK1_7) >= 0;
     2.6      }
     2.7 +    // JSR 292: recognize @PolymorphicSignature on java/dyn names
     2.8 +    public boolean allowPolymorphicSignature() {
     2.9 +        return compareTo(JDK1_7) >= 0;
    2.10 +    }
    2.11      public static SourceVersion toSourceVersion(Source source) {
    2.12          switch(source) {
    2.13          case JDK1_2:
     3.1 --- a/src/share/classes/com/sun/tools/javac/code/Symtab.java	Thu Jun 17 16:28:21 2010 -0700
     3.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symtab.java	Fri Jun 18 15:12:04 2010 -0700
     3.3 @@ -120,6 +120,7 @@
     3.4      public final Type cloneableType;
     3.5      public final Type serializableType;
     3.6      public final Type methodHandleType;
     3.7 +    public final Type polymorphicSignatureType;
     3.8      public final Type invokeDynamicType;
     3.9      public final Type throwableType;
    3.10      public final Type errorType;
    3.11 @@ -291,24 +292,6 @@
    3.12          }
    3.13      }
    3.14  
    3.15 -    public void synthesizeMHTypeIfMissing(final Type type) {
    3.16 -        final Completer completer = type.tsym.completer;
    3.17 -        if (completer != null) {
    3.18 -            type.tsym.completer = new Completer() {
    3.19 -                public void complete(Symbol sym) throws CompletionFailure {
    3.20 -                    try {
    3.21 -                        completer.complete(sym);
    3.22 -                    } catch (CompletionFailure e) {
    3.23 -                        sym.flags_field |= (PUBLIC | ABSTRACT);
    3.24 -                        ((ClassType) sym.type).supertype_field = objectType;
    3.25 -                        // do not bother to create MH.type if not visibly declared
    3.26 -                        // this sym just accumulates invoke(...) methods
    3.27 -                    }
    3.28 -                }
    3.29 -            };
    3.30 -        }
    3.31 -    }
    3.32 -
    3.33      public void synthesizeBoxTypeIfMissing(final Type type) {
    3.34          ClassSymbol sym = reader.enterClass(boxedName[type.tag]);
    3.35          final Completer completer = sym.completer;
    3.36 @@ -426,6 +409,7 @@
    3.37          throwableType = enterClass("java.lang.Throwable");
    3.38          serializableType = enterClass("java.io.Serializable");
    3.39          methodHandleType = enterClass("java.dyn.MethodHandle");
    3.40 +        polymorphicSignatureType = enterClass("java.dyn.MethodHandle$PolymorphicSignature");
    3.41          invokeDynamicType = enterClass("java.dyn.InvokeDynamic");
    3.42          errorType = enterClass("java.lang.Error");
    3.43          illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException");
    3.44 @@ -463,8 +447,7 @@
    3.45  
    3.46          synthesizeEmptyInterfaceIfMissing(cloneableType);
    3.47          synthesizeEmptyInterfaceIfMissing(serializableType);
    3.48 -        synthesizeMHTypeIfMissing(methodHandleType);
    3.49 -        synthesizeMHTypeIfMissing(invokeDynamicType);
    3.50 +        synthesizeEmptyInterfaceIfMissing(polymorphicSignatureType);
    3.51          synthesizeBoxTypeIfMissing(doubleType);
    3.52          synthesizeBoxTypeIfMissing(floatType);
    3.53          synthesizeBoxTypeIfMissing(voidType);
     4.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Jun 17 16:28:21 2010 -0700
     4.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Jun 18 15:12:04 2010 -0700
     4.3 @@ -122,7 +122,6 @@
     4.4          relax = (options.get("-retrofit") != null ||
     4.5                   options.get("-relax") != null);
     4.6          useBeforeDeclarationWarning = options.get("useBeforeDeclarationWarning") != null;
     4.7 -        allowInvokedynamic = options.get("invokedynamic") != null;
     4.8          enableSunApiLintControl = options.get("enableSunApiLintControl") != null;
     4.9      }
    4.10  
    4.11 @@ -155,10 +154,6 @@
    4.12       */
    4.13      boolean allowAnonOuterThis;
    4.14  
    4.15 -    /** Switch: allow invokedynamic syntax
    4.16 -     */
    4.17 -    boolean allowInvokedynamic;
    4.18 -
    4.19      /**
    4.20       * Switch: warn about use of variable before declaration?
    4.21       * RFE: 6425594
    4.22 @@ -1384,9 +1379,15 @@
    4.23              // as a special case, MethodHandle.<T>invoke(abc) and InvokeDynamic.<T>foo(abc)
    4.24              // has type <T>, and T can be a primitive type.
    4.25              if (tree.meth.getTag() == JCTree.SELECT && !typeargtypes.isEmpty()) {
    4.26 -              Type selt = ((JCFieldAccess) tree.meth).selected.type;
    4.27 -              if ((selt == syms.methodHandleType && methName == names.invoke) || selt == syms.invokeDynamicType) {
    4.28 +              JCFieldAccess mfield = (JCFieldAccess) tree.meth;
    4.29 +              if ((mfield.selected.type.tsym != null &&
    4.30 +                   (mfield.selected.type.tsym.flags() & POLYMORPHIC_SIGNATURE) != 0)
    4.31 +                  ||
    4.32 +                  (mfield.sym != null &&
    4.33 +                   (mfield.sym.flags() & POLYMORPHIC_SIGNATURE) != 0)) {
    4.34                    assert types.isSameType(restype, typeargtypes.head) : mtype;
    4.35 +                  assert mfield.selected.type == syms.methodHandleType
    4.36 +                      || mfield.selected.type == syms.invokeDynamicType;
    4.37                    typeargtypesNonRefOK = true;
    4.38                }
    4.39              }
     5.1 --- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Thu Jun 17 16:28:21 2010 -0700
     5.2 +++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Fri Jun 18 15:12:04 2010 -0700
     5.3 @@ -768,6 +768,12 @@
     5.4                  && s.owner.kind != MTH
     5.5                  && types.isSameType(c.type, syms.deprecatedType))
     5.6                  s.flags_field |= Flags.DEPRECATED;
     5.7 +            // Internally to java.dyn, a @PolymorphicSignature annotation
     5.8 +            // translates to a classfile attribute.
     5.9 +            if (!c.type.isErroneous()
    5.10 +                && types.isSameType(c.type, syms.polymorphicSignatureType)) {
    5.11 +                s.flags_field |= Flags.POLYMORPHIC_SIGNATURE;
    5.12 +            }
    5.13              if (!annotated.add(a.type.tsym))
    5.14                  log.error(a.pos, "duplicate.annotation");
    5.15          }
     6.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Jun 17 16:28:21 2010 -0700
     6.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Jun 18 15:12:04 2010 -0700
     6.3 @@ -67,7 +67,7 @@
     6.4      JCDiagnostic.Factory diags;
     6.5      public final boolean boxingEnabled; // = source.allowBoxing();
     6.6      public final boolean varargsEnabled; // = source.allowVarargs();
     6.7 -    public final boolean allowInvokedynamic; // = options.get("invokedynamic");
     6.8 +    public final boolean allowPolymorphicSignature;
     6.9      private final boolean debugResolve;
    6.10  
    6.11      public static Resolve instance(Context context) {
    6.12 @@ -105,7 +105,7 @@
    6.13          varargsEnabled = source.allowVarargs();
    6.14          Options options = Options.instance(context);
    6.15          debugResolve = options.get("debugresolve") != null;
    6.16 -        allowInvokedynamic = options.get("invokedynamic") != null;
    6.17 +        allowPolymorphicSignature = source.allowPolymorphicSignature() || options.get("invokedynamic") != null;
    6.18      }
    6.19  
    6.20      /** error symbols, which are returned when resolution fails
    6.21 @@ -301,6 +301,7 @@
    6.22                          boolean useVarargs,
    6.23                          Warner warn)
    6.24          throws Infer.InferenceException {
    6.25 +        assert ((m.flags() & (POLYMORPHIC_SIGNATURE|HYPOTHETICAL)) != POLYMORPHIC_SIGNATURE);
    6.26          if (useVarargs && (m.flags() & VARARGS) == 0) return null;
    6.27          Type mt = types.memberType(site, m);
    6.28  
    6.29 @@ -576,6 +577,14 @@
    6.30          if (sym.kind == ERR) return bestSoFar;
    6.31          if (!sym.isInheritedIn(site.tsym, types)) return bestSoFar;
    6.32          assert sym.kind < AMBIGUOUS;
    6.33 +        if ((sym.flags() & POLYMORPHIC_SIGNATURE) != 0 && allowPolymorphicSignature) {
    6.34 +            assert(site.tag == CLASS);
    6.35 +            // Never match a MethodHandle.invoke directly.
    6.36 +            if (useVarargs | allowBoxing | operator)
    6.37 +                return bestSoFar;
    6.38 +            // Supply an exactly-typed implicit method instead.
    6.39 +            sym = findPolymorphicSignatureInstance(env, sym.owner.type, sym.name, (MethodSymbol) sym, argtypes, typeargtypes);
    6.40 +        }
    6.41          try {
    6.42              if (rawInstantiate(env, site, sym, argtypes, typeargtypes,
    6.43                                 allowBoxing, useVarargs, Warner.noWarnings) == null) {
    6.44 @@ -746,6 +755,14 @@
    6.45                        boolean allowBoxing,
    6.46                        boolean useVarargs,
    6.47                        boolean operator) {
    6.48 +        Symbol bestSoFar = methodNotFound;
    6.49 +        if ((site.tsym.flags() & POLYMORPHIC_SIGNATURE) != 0 &&
    6.50 +            allowPolymorphicSignature &&
    6.51 +            site.tag == CLASS &&
    6.52 +            !(useVarargs | allowBoxing | operator)) {
    6.53 +            // supply an exactly-typed implicit method in java.dyn.InvokeDynamic
    6.54 +            bestSoFar = findPolymorphicSignatureInstance(env, site, name, null, argtypes, typeargtypes);
    6.55 +        }
    6.56          return findMethod(env,
    6.57                            site,
    6.58                            name,
    6.59 @@ -753,7 +770,7 @@
    6.60                            typeargtypes,
    6.61                            site.tsym.type,
    6.62                            true,
    6.63 -                          methodNotFound,
    6.64 +                          bestSoFar,
    6.65                            allowBoxing,
    6.66                            useVarargs,
    6.67                            operator);
    6.68 @@ -897,13 +914,14 @@
    6.69       *  @param argtypes  The method's value arguments.
    6.70       *  @param typeargtypes The method's type arguments
    6.71       */
    6.72 -    Symbol findImplicitMethod(Env<AttrContext> env,
    6.73 -                              Type site,
    6.74 -                              Name name,
    6.75 -                              List<Type> argtypes,
    6.76 -                              List<Type> typeargtypes) {
    6.77 -        assert allowInvokedynamic;
    6.78 -        assert site == syms.invokeDynamicType || (site == syms.methodHandleType && name == names.invoke);
    6.79 +    Symbol findPolymorphicSignatureInstance(Env<AttrContext> env,
    6.80 +                                            Type site,
    6.81 +                                            Name name,
    6.82 +                                            MethodSymbol spMethod,  // sig. poly. method or null if none
    6.83 +                                            List<Type> argtypes,
    6.84 +                                            List<Type> typeargtypes) {
    6.85 +        assert allowPolymorphicSignature;
    6.86 +        //assert site == syms.invokeDynamicType || site == syms.methodHandleType : site;
    6.87          ClassSymbol c = (ClassSymbol) site.tsym;
    6.88          Scope implicit = c.members().next;
    6.89          if (implicit == null) {
    6.90 @@ -918,12 +936,22 @@
    6.91                  return methodNotFound;
    6.92          }
    6.93          List<Type> paramtypes = Type.map(argtypes, implicitArgType);
    6.94 +        long flags;
    6.95 +        List<Type> exType;
    6.96 +        if (spMethod != null) {
    6.97 +            exType = spMethod.getThrownTypes();
    6.98 +            flags = spMethod.flags() & AccessFlags;
    6.99 +        } else {
   6.100 +            // make it throw all exceptions
   6.101 +            //assert(site == syms.invokeDynamicType);
   6.102 +            exType = List.of(syms.throwableType);
   6.103 +            flags = PUBLIC | STATIC;
   6.104 +        }
   6.105          MethodType mtype = new MethodType(paramtypes,
   6.106                                            restype,
   6.107 -                                          List.<Type>nil(),
   6.108 +                                          exType,
   6.109                                            syms.methodClass);
   6.110 -        int flags = PUBLIC | ABSTRACT;
   6.111 -        if (site == syms.invokeDynamicType)  flags |= STATIC;
   6.112 +        flags |= ABSTRACT | HYPOTHETICAL | POLYMORPHIC_SIGNATURE;
   6.113          Symbol m = null;
   6.114          for (Scope.Entry e = implicit.lookup(name);
   6.115               e.scope != null;
   6.116 @@ -1338,14 +1366,6 @@
   6.117              methodResolutionCache.put(steps.head, sym);
   6.118              steps = steps.tail;
   6.119          }
   6.120 -        if (sym.kind >= AMBIGUOUS &&
   6.121 -            allowInvokedynamic &&
   6.122 -            (site == syms.invokeDynamicType ||
   6.123 -             site == syms.methodHandleType && name == names.invoke)) {
   6.124 -            // lookup failed; supply an exactly-typed implicit method
   6.125 -            sym = findImplicitMethod(env, site, name, argtypes, typeargtypes);
   6.126 -            env.info.varArgs = false;
   6.127 -        }
   6.128          if (sym.kind >= AMBIGUOUS) {//if nothing is found return the 'first' error
   6.129              MethodResolutionPhase errPhase =
   6.130                      firstErroneousResolutionPhase();
     7.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Jun 17 16:28:21 2010 -0700
     7.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri Jun 18 15:12:04 2010 -0700
     7.3 @@ -1098,6 +1098,12 @@
     7.4                  }
     7.5              },
     7.6  
     7.7 +            new AttributeReader(names.PolymorphicSignature, V45_3/*S.B.V51*/, CLASS_OR_MEMBER_ATTRIBUTE) {
     7.8 +                void read(Symbol sym, int attrLen) {
     7.9 +                    sym.flags_field |= POLYMORPHIC_SIGNATURE;
    7.10 +                }
    7.11 +            },
    7.12 +
    7.13  
    7.14              // The following attributes for a Code attribute are not currently handled
    7.15              // StackMapTable
     8.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Thu Jun 17 16:28:21 2010 -0700
     8.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Fri Jun 18 15:12:04 2010 -0700
     8.3 @@ -651,6 +651,13 @@
     8.4              endAttr(alenIdx);
     8.5              acount++;
     8.6          }
     8.7 +        if ((flags & POLYMORPHIC_SIGNATURE) != 0) {
     8.8 +            if (target.majorVersion < 51)
     8.9 +                throw new AssertionError("PolymorphicSignature attributes in java/dyn must be written with -target 7 (required major version is 51, current is"+target.majorVersion+")");
    8.10 +            int alenIdx = writeAttr(names.PolymorphicSignature);
    8.11 +            endAttr(alenIdx);
    8.12 +            acount++;
    8.13 +        }
    8.14          return acount;
    8.15      }
    8.16  
     9.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Jun 17 16:28:21 2010 -0700
     9.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Fri Jun 18 15:12:04 2010 -0700
     9.3 @@ -121,7 +121,7 @@
     9.4              : options.get("-g:vars") != null;
     9.5          genCrt = options.get("-Xjcov") != null;
     9.6          debugCode = options.get("debugcode") != null;
     9.7 -        allowInvokedynamic = options.get("invokedynamic") != null;
     9.8 +        allowInvokedynamic = target.hasInvokedynamic() || options.get("invokedynamic") != null;
     9.9  
    9.10          generateIproxies =
    9.11              target.requiresIproxy() ||
    10.1 --- a/src/share/classes/com/sun/tools/javac/main/Main.java	Thu Jun 17 16:28:21 2010 -0700
    10.2 +++ b/src/share/classes/com/sun/tools/javac/main/Main.java	Fri Jun 18 15:12:04 2010 -0700
    10.3 @@ -281,9 +281,6 @@
    10.4                  }
    10.5              }
    10.6          }
    10.7 -        if (target.hasInvokedynamic()) {
    10.8 -            options.put("invokedynamic",  "invokedynamic");
    10.9 -        }
   10.10  
   10.11          // handle this here so it works even if no other options given
   10.12          String showClass = options.get("showClass");
    11.1 --- a/src/share/classes/com/sun/tools/javac/util/Names.java	Thu Jun 17 16:28:21 2010 -0700
    11.2 +++ b/src/share/classes/com/sun/tools/javac/util/Names.java	Fri Jun 18 15:12:04 2010 -0700
    11.3 @@ -103,6 +103,7 @@
    11.4      public final Name RuntimeInvisibleTypeAnnotations;
    11.5      public final Name RuntimeVisibleParameterAnnotations;
    11.6      public final Name RuntimeInvisibleParameterAnnotations;
    11.7 +    public final Name PolymorphicSignature;
    11.8      public final Name Value;
    11.9      public final Name EnclosingMethod;
   11.10      public final Name desiredAssertionStatus;
   11.11 @@ -115,7 +116,6 @@
   11.12      public final Name value;
   11.13      public final Name getMessage;
   11.14      public final Name getClass;
   11.15 -    public final Name invoke;
   11.16      public final Name TYPE;
   11.17      public final Name TYPE_USE;
   11.18      public final Name TYPE_PARAMETER;
   11.19 @@ -213,6 +213,7 @@
   11.20          RuntimeInvisibleTypeAnnotations = fromString("RuntimeInvisibleTypeAnnotations");
   11.21          RuntimeVisibleParameterAnnotations = fromString("RuntimeVisibleParameterAnnotations");
   11.22          RuntimeInvisibleParameterAnnotations = fromString("RuntimeInvisibleParameterAnnotations");
   11.23 +        PolymorphicSignature = fromString("PolymorphicSignature");
   11.24          Value = fromString("Value");
   11.25          EnclosingMethod = fromString("EnclosingMethod");
   11.26  
   11.27 @@ -227,7 +228,6 @@
   11.28          value = fromString("value");
   11.29          getMessage = fromString("getMessage");
   11.30          getClass = fromString("getClass");
   11.31 -        invoke = fromString("invoke");
   11.32  
   11.33          TYPE = fromString("TYPE");
   11.34          TYPE_USE = fromString("TYPE_USE");
    12.1 --- a/test/tools/javac/meth/InvokeDyn.java	Thu Jun 17 16:28:21 2010 -0700
    12.2 +++ b/test/tools/javac/meth/InvokeDyn.java	Fri Jun 18 15:12:04 2010 -0700
    12.3 @@ -47,7 +47,7 @@
    12.4  import java.dyn.InvokeDynamic;
    12.5  
    12.6  public class InvokeDyn {
    12.7 -    void test() {
    12.8 +    void test() throws Throwable {
    12.9          Object x = "hello";
   12.10          InvokeDynamic.greet(x, "world", 123);
   12.11          InvokeDynamic.greet(x, "mundus", 456);
    13.1 --- a/test/tools/javac/meth/InvokeMH.java	Thu Jun 17 16:28:21 2010 -0700
    13.2 +++ b/test/tools/javac/meth/InvokeMH.java	Fri Jun 18 15:12:04 2010 -0700
    13.3 @@ -48,28 +48,56 @@
    13.4      void test(MethodHandle mh_SiO,
    13.5                MethodHandle mh_vS,
    13.6                MethodHandle mh_vi,
    13.7 -              MethodHandle mh_vv) {
    13.8 +              MethodHandle mh_vv) throws Throwable {
    13.9          Object o; String s; int i;  // for return type testing
   13.10  
   13.11          // next five must have sig = (String,int)Object
   13.12 -        mh_SiO.invoke("world", 123);
   13.13 -        mh_SiO.invoke("mundus", 456);
   13.14 +        mh_SiO.invokeExact("world", 123);
   13.15 +        mh_SiO.invokeExact("mundus", 456);
   13.16          Object k = "kosmos";
   13.17 -        mh_SiO.invoke((String)k, 789);
   13.18 -        o = mh_SiO.invoke((String)null, 000);
   13.19 -        o = mh_SiO.<Object>invoke("arda", -123);
   13.20 +        mh_SiO.invokeExact((String)k, 789);
   13.21 +        o = mh_SiO.invokeExact((String)null, 000);
   13.22 +        o = mh_SiO.<Object>invokeExact("arda", -123);
   13.23  
   13.24          // sig = ()String
   13.25 -        s = mh_vS.<String>invoke();
   13.26 +        s = mh_vS.<String>invokeExact();
   13.27  
   13.28          // sig = ()int
   13.29 -        i = mh_vi.<int>invoke();
   13.30 -        o = mh_vi.<int>invoke();
   13.31 -        //s = mh_vi.<int>invoke(); //BAD
   13.32 -        mh_vi.<int>invoke();
   13.33 +        i = mh_vi.<int>invokeExact();
   13.34 +        o = mh_vi.<int>invokeExact();
   13.35 +        //s = mh_vi.<int>invokeExact(); //BAD
   13.36 +        mh_vi.<int>invokeExact();
   13.37  
   13.38          // sig = ()void
   13.39 -        //o = mh_vv.<void>invoke(); //BAD
   13.40 -        mh_vv.<void>invoke();
   13.41 +        //o = mh_vv.<void>invokeExact(); //BAD
   13.42 +        mh_vv.<void>invokeExact();
   13.43 +    }
   13.44 +
   13.45 +    void testGen(MethodHandle mh_SiO,
   13.46 +                 MethodHandle mh_vS,
   13.47 +                 MethodHandle mh_vi,
   13.48 +                 MethodHandle mh_vv) throws Throwable {
   13.49 +        Object o; String s; int i;  // for return type testing
   13.50 +
   13.51 +        // next five must have sig = (*,*)*
   13.52 +        mh_SiO.invokeGeneric((Object)"world", (Object)123);
   13.53 +        mh_SiO.<void>invokeGeneric((Object)"mundus", (Object)456);
   13.54 +        Object k = "kosmos";
   13.55 +        mh_SiO.invokeGeneric(k, 789);
   13.56 +        o = mh_SiO.invokeGeneric(null, 000);
   13.57 +        o = mh_SiO.<Object>invokeGeneric("arda", -123);
   13.58 +
   13.59 +        // sig = ()String
   13.60 +        o = mh_vS.invokeGeneric();
   13.61 +
   13.62 +        // sig = ()int
   13.63 +        i = mh_vi.<int>invokeGeneric();
   13.64 +        o = mh_vi.invokeGeneric();
   13.65 +        //s = mh_vi.<int>invokeGeneric(); //BAD
   13.66 +        mh_vi.<void>invokeGeneric();
   13.67 +
   13.68 +        // sig = ()void
   13.69 +        //o = mh_vv.<void>invokeGeneric(); //BAD
   13.70 +        o = mh_vv.invokeGeneric();
   13.71      }
   13.72  }

mercurial