Merge

Mon, 08 Aug 2016 15:40:58 -0700

author
asaha
date
Mon, 08 Aug 2016 15:40:58 -0700
changeset 3316
e3d17d092a61
parent 3315
6f0746b6de9f
parent 3273
ba1909159974
child 3317
19a21c4d3705

Merge

.hgtags file | annotate | diff | comparison | revisions
     1.1 --- a/.hgtags	Mon Jul 18 23:53:12 2016 +0300
     1.2 +++ b/.hgtags	Mon Aug 08 15:40:58 2016 -0700
     1.3 @@ -637,4 +637,16 @@
     1.4  f66a535fb6b3b41419c987cc90407507a64712b2 jdk8u111-b02
     1.5  386c8bc6dd3ea0d49ea483cbbe95f4b12b66db23 jdk8u111-b03
     1.6  fd9b6417c521c5ec26224129d90b38d40c04c54d jdk8u111-b04
     1.7 +5710d574a99aeff3600c49a4aed34fa1b373f7b8 jdk8u111-b05
     1.8 +9ce3a6ba45751aaf57cb50609f3fd64c02d66f51 jdk8u111-b06
     1.9 +405b1845ab3995b43efe0e770070b90f4c5c9080 jdk8u111-b07
    1.10 +8a30511b2ea4714f5868b33be07b0562bb1edbfb jdk8u111-b08
    1.11 +27503e49de52b54dde3a12af28e2d2de473192b3 jdk8u112-b00
    1.12 +60a0572cd449e33b7d48b5a40065222ab5accd36 jdk8u112-b01
    1.13 +6e20b82db75fbaf5a3e10455d1a28c17381f4be6 jdk8u112-b02
    1.14 +e87830f756786db50d89d77ee802f303cf42d0b1 jdk8u112-b03
    1.15 +03a192ef78d0ea77f1141174b29835b702f86793 jdk8u112-b04
    1.16 +27a15af81178d312748a45efa457e5ef1a76e088 jdk8u112-b06
    1.17 +35cb56e983d317fd319d2dbb17282264edea02e2 jdk8u112-b07
    1.18 +103e6e2225bbbe779435b2e122e1ff846be54759 jdk8u112-b08
    1.19  5710d574a99aeff3600c49a4aed34fa1b373f7b8 jdk8u121-b00
     2.1 --- a/LICENSE	Mon Jul 18 23:53:12 2016 +0300
     2.2 +++ b/LICENSE	Mon Aug 08 15:40:58 2016 -0700
     2.3 @@ -3,7 +3,7 @@
     2.4  Version 2, June 1991
     2.5  
     2.6  Copyright (C) 1989, 1991 Free Software Foundation, Inc.
     2.7 -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
     2.8 +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
     2.9  
    2.10  Everyone is permitted to copy and distribute verbatim copies of this license
    2.11  document, but changing it is not allowed.
    2.12 @@ -287,8 +287,8 @@
    2.13      more details.
    2.14  
    2.15      You should have received a copy of the GNU General Public License along
    2.16 -    with this program; if not, write to the Free Software Foundation, Inc., 59
    2.17 -    Temple Place, Suite 330, Boston, MA 02111-1307 USA
    2.18 +    with this program; if not, write to the Free Software Foundation, Inc.,
    2.19 +    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    2.20  
    2.21  Also add information on how to contact you by electronic and paper mail.
    2.22  
     3.1 --- a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Mon Jul 18 23:53:12 2016 +0300
     3.2 +++ b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Mon Aug 08 15:40:58 2016 -0700
     3.3 @@ -338,6 +338,11 @@
     3.4                  syntheticInits.append((JCExpression) captured_local);
     3.5              }
     3.6          }
     3.7 +        // add captured outer this instances (used only when `this' capture itself is illegal)
     3.8 +        for (Symbol fv : localContext.getSymbolMap(CAPTURED_OUTER_THIS).keySet()) {
     3.9 +            JCTree captured_local = make.QualThis(fv.type);
    3.10 +            syntheticInits.append((JCExpression) captured_local);
    3.11 +        }
    3.12  
    3.13          //then, determine the arguments to the indy call
    3.14          List<JCExpression> indy_args = translate(syntheticInits.toList(), localContext.prev);
    3.15 @@ -434,6 +439,32 @@
    3.16          }
    3.17      }
    3.18  
    3.19 +    /**
    3.20 +     * Translate qualified `this' references within a lambda to the mapped identifier
    3.21 +     * @param tree
    3.22 +     */
    3.23 +    @Override
    3.24 +    public void visitSelect(JCFieldAccess tree) {
    3.25 +        if (context == null || !analyzer.lambdaFieldAccessFilter(tree)) {
    3.26 +            super.visitSelect(tree);
    3.27 +        } else {
    3.28 +            int prevPos = make.pos;
    3.29 +            try {
    3.30 +                make.at(tree);
    3.31 +
    3.32 +                LambdaTranslationContext lambdaContext = (LambdaTranslationContext) context;
    3.33 +                JCTree ltree = lambdaContext.translate(tree);
    3.34 +                if (ltree != null) {
    3.35 +                    result = ltree;
    3.36 +                } else {
    3.37 +                    super.visitSelect(tree);
    3.38 +                }
    3.39 +            } finally {
    3.40 +                make.at(prevPos);
    3.41 +            }
    3.42 +        }
    3.43 +    }
    3.44 +
    3.45      @Override
    3.46      public void visitVarDef(JCVariableDecl tree) {
    3.47          LambdaTranslationContext lambdaContext = (LambdaTranslationContext)context;
    3.48 @@ -1126,6 +1157,11 @@
    3.49          private int lambdaCount = 0;
    3.50  
    3.51          /**
    3.52 +         * List of types undergoing construction via explicit constructor chaining.
    3.53 +         */
    3.54 +        private List<ClassSymbol> typesUnderConstruction;
    3.55 +
    3.56 +        /**
    3.57           * keep the count of lambda expression defined in given context (used to
    3.58           * generate unambiguous names for serializable lambdas)
    3.59           */
    3.60 @@ -1156,11 +1192,36 @@
    3.61  
    3.62          private JCClassDecl analyzeAndPreprocessClass(JCClassDecl tree) {
    3.63              frameStack = List.nil();
    3.64 +            typesUnderConstruction = List.nil();
    3.65              localClassDefs = new HashMap<Symbol, JCClassDecl>();
    3.66              return translate(tree);
    3.67          }
    3.68  
    3.69          @Override
    3.70 +        public void visitApply(JCMethodInvocation tree) {
    3.71 +            List<ClassSymbol> previousNascentTypes = typesUnderConstruction;
    3.72 +            try {
    3.73 +                Name methName = TreeInfo.name(tree.meth);
    3.74 +                if (methName == names._this || methName == names._super) {
    3.75 +                    typesUnderConstruction = typesUnderConstruction.prepend(currentClass());
    3.76 +                }
    3.77 +                super.visitApply(tree);
    3.78 +            } finally {
    3.79 +                typesUnderConstruction = previousNascentTypes;
    3.80 +            }
    3.81 +        }
    3.82 +            // where
    3.83 +            private ClassSymbol currentClass() {
    3.84 +                for (Frame frame : frameStack) {
    3.85 +                    if (frame.tree.hasTag(JCTree.Tag.CLASSDEF)) {
    3.86 +                        JCClassDecl cdef = (JCClassDecl) frame.tree;
    3.87 +                        return cdef.sym;
    3.88 +                    }
    3.89 +                }
    3.90 +                return null;
    3.91 +            }
    3.92 +
    3.93 +        @Override
    3.94          public void visitBlock(JCBlock tree) {
    3.95              List<Frame> prevStack = frameStack;
    3.96              try {
    3.97 @@ -1624,6 +1685,22 @@
    3.98          }
    3.99  
   3.100          /**
   3.101 +         *  This is used to filter out those select nodes that need to be adjusted
   3.102 +         *  when translating away lambda expressions - at the moment, this is the
   3.103 +         *  set of nodes that select `this' (qualified this)
   3.104 +         */
   3.105 +        private boolean lambdaFieldAccessFilter(JCFieldAccess fAccess) {
   3.106 +            LambdaTranslationContext lambdaContext =
   3.107 +                    context instanceof LambdaTranslationContext ?
   3.108 +                            (LambdaTranslationContext) context : null;
   3.109 +            return lambdaContext != null
   3.110 +                    && !fAccess.sym.isStatic()
   3.111 +                    && fAccess.name == names._this
   3.112 +                    && (fAccess.sym.owner.kind == TYP)
   3.113 +                    && !lambdaContext.translatedSymbols.get(CAPTURED_OUTER_THIS).isEmpty();
   3.114 +        }
   3.115 +
   3.116 +        /**
   3.117           * This is used to filter out those new class expressions that need to
   3.118           * be qualified with an enclosing tree
   3.119           */
   3.120 @@ -1797,6 +1874,7 @@
   3.121                  translatedSymbols.put(LOCAL_VAR, new LinkedHashMap<Symbol, Symbol>());
   3.122                  translatedSymbols.put(CAPTURED_VAR, new LinkedHashMap<Symbol, Symbol>());
   3.123                  translatedSymbols.put(CAPTURED_THIS, new LinkedHashMap<Symbol, Symbol>());
   3.124 +                translatedSymbols.put(CAPTURED_OUTER_THIS, new LinkedHashMap<Symbol, Symbol>());
   3.125                  translatedSymbols.put(TYPE_VAR, new LinkedHashMap<Symbol, Symbol>());
   3.126  
   3.127                  freeVarProcessedLocalClasses = new HashSet<>();
   3.128 @@ -1909,6 +1987,16 @@
   3.129                              }
   3.130                          };
   3.131                          break;
   3.132 +                    case CAPTURED_OUTER_THIS:
   3.133 +                        Name name = names.fromString(new String(sym.flatName().toString() + names.dollarThis));
   3.134 +                        ret = new VarSymbol(SYNTHETIC | FINAL | PARAMETER, name, types.erasure(sym.type), translatedSym) {
   3.135 +                            @Override
   3.136 +                            public Symbol baseSymbol() {
   3.137 +                                //keep mapping with original captured symbol
   3.138 +                                return sym;
   3.139 +                            }
   3.140 +                        };
   3.141 +                        break;
   3.142                      case LOCAL_VAR:
   3.143                          ret = new VarSymbol(sym.flags() & FINAL, sym.name, sym.type, translatedSym);
   3.144                          ((VarSymbol) ret).pos = ((VarSymbol) sym).pos;
   3.145 @@ -1929,6 +2017,14 @@
   3.146              }
   3.147  
   3.148              void addSymbol(Symbol sym, LambdaSymbolKind skind) {
   3.149 +                if (skind == CAPTURED_THIS && sym != null && sym.kind == TYP && !typesUnderConstruction.isEmpty()) {
   3.150 +                    ClassSymbol currentClass = currentClass();
   3.151 +                    if (currentClass != null && typesUnderConstruction.contains(currentClass)) {
   3.152 +                        // reference must be to enclosing outer instance, mutate capture kind.
   3.153 +                        Assert.check(sym != currentClass); // should have been caught right in Attr
   3.154 +                        skind = CAPTURED_OUTER_THIS;
   3.155 +                    }
   3.156 +                }
   3.157                  Map<Symbol, Symbol> transMap = getSymbolMap(skind);
   3.158                  if (!transMap.containsKey(sym)) {
   3.159                      transMap.put(sym, translate(sym, skind));
   3.160 @@ -1942,17 +2038,49 @@
   3.161              }
   3.162  
   3.163              JCTree translate(JCIdent lambdaIdent) {
   3.164 -                for (Map<Symbol, Symbol> m : translatedSymbols.values()) {
   3.165 -                    if (m.containsKey(lambdaIdent.sym)) {
   3.166 -                        Symbol tSym = m.get(lambdaIdent.sym);
   3.167 -                        JCTree t = make.Ident(tSym).setType(lambdaIdent.type);
   3.168 -                        tSym.setTypeAttributes(lambdaIdent.sym.getRawTypeAttributes());
   3.169 -                        return t;
   3.170 +                for (LambdaSymbolKind kind : LambdaSymbolKind.values()) {
   3.171 +                    Map<Symbol, Symbol> m = getSymbolMap(kind);
   3.172 +                    switch(kind) {
   3.173 +                        default:
   3.174 +                            if (m.containsKey(lambdaIdent.sym)) {
   3.175 +                                Symbol tSym = m.get(lambdaIdent.sym);
   3.176 +                                JCTree t = make.Ident(tSym).setType(lambdaIdent.type);
   3.177 +                                tSym.setTypeAttributes(lambdaIdent.sym.getRawTypeAttributes());
   3.178 +                                return t;
   3.179 +                            }
   3.180 +                            break;
   3.181 +                        case CAPTURED_OUTER_THIS:
   3.182 +                            if (lambdaIdent.sym.owner.kind == TYP && m.containsKey(lambdaIdent.sym.owner)) {
   3.183 +                                // Transform outer instance variable references anchoring them to the captured synthetic.
   3.184 +                                Symbol tSym = m.get(lambdaIdent.sym.owner);
   3.185 +                                JCExpression t = make.Ident(tSym).setType(lambdaIdent.sym.owner.type);
   3.186 +                                tSym.setTypeAttributes(lambdaIdent.sym.owner.getRawTypeAttributes());
   3.187 +                                t = make.Select(t, lambdaIdent.name);
   3.188 +                                t.setType(lambdaIdent.type);
   3.189 +                                TreeInfo.setSymbol(t, lambdaIdent.sym);
   3.190 +                                return t;
   3.191 +                            }
   3.192 +                            break;
   3.193                      }
   3.194                  }
   3.195                  return null;
   3.196              }
   3.197  
   3.198 +            /* Translate away qualified this expressions, anchoring them to synthetic parameters that
   3.199 +               capture the qualified this handle. `fieldAccess' is guaranteed to one such.
   3.200 +            */
   3.201 +            public JCTree translate(JCFieldAccess fieldAccess) {
   3.202 +                Assert.check(fieldAccess.name == names._this);
   3.203 +                Map<Symbol, Symbol> m = translatedSymbols.get(LambdaSymbolKind.CAPTURED_OUTER_THIS);
   3.204 +                if (m.containsKey(fieldAccess.sym.owner)) {
   3.205 +                    Symbol tSym = m.get(fieldAccess.sym.owner);
   3.206 +                    JCExpression t = make.Ident(tSym).setType(fieldAccess.sym.owner.type);
   3.207 +                    tSym.setTypeAttributes(fieldAccess.sym.owner.getRawTypeAttributes());
   3.208 +                    return t;
   3.209 +                }
   3.210 +                return null;
   3.211 +            }
   3.212 +
   3.213              /**
   3.214               * The translatedSym is not complete/accurate until the analysis is
   3.215               * finished.  Once the analysis is finished, the translatedSym is
   3.216 @@ -1990,6 +2118,10 @@
   3.217                      params.append(make.VarDef((VarSymbol) thisSym, null));
   3.218                      parameterSymbols.append((VarSymbol) thisSym);
   3.219                  }
   3.220 +                for (Symbol thisSym : getSymbolMap(CAPTURED_OUTER_THIS).values()) {
   3.221 +                    params.append(make.VarDef((VarSymbol) thisSym, null));
   3.222 +                    parameterSymbols.append((VarSymbol) thisSym);
   3.223 +                }
   3.224                  for (Symbol thisSym : getSymbolMap(PARAM).values()) {
   3.225                      params.append(make.VarDef((VarSymbol) thisSym, null));
   3.226                      parameterSymbols.append((VarSymbol) thisSym);
   3.227 @@ -2138,6 +2270,7 @@
   3.228          LOCAL_VAR,      // original to translated lambda locals
   3.229          CAPTURED_VAR,   // variables in enclosing scope to translated synthetic parameters
   3.230          CAPTURED_THIS,  // class symbols to translated synthetic parameters (for captured member access)
   3.231 +        CAPTURED_OUTER_THIS, // used when `this' capture is illegal, but outer this capture is legit (JDK-8129740)
   3.232          TYPE_VAR;       // original to translated lambda type variables
   3.233      }
   3.234  
     4.1 --- a/src/share/classes/com/sun/tools/javac/resources/javac_ja.properties	Mon Jul 18 23:53:12 2016 +0300
     4.2 +++ b/src/share/classes/com/sun/tools/javac/resources/javac_ja.properties	Mon Aug 08 15:40:58 2016 -0700
     4.3 @@ -1,5 +1,5 @@
     4.4  #
     4.5 -# Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
     4.6 +# Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
     4.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.8  #
     4.9  # This code is free software; you can redistribute it and/or modify it
    4.10 @@ -34,7 +34,7 @@
    4.11  javac.opt.classpath=\u30E6\u30FC\u30B6\u30FC\u30FB\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u304A\u3088\u3073\u6CE8\u91C8\u30D7\u30ED\u30BB\u30C3\u30B5\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3059\u308B
    4.12  javac.opt.sourcepath=\u5165\u529B\u30BD\u30FC\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3059\u308B
    4.13  javac.opt.bootclasspath=\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B
    4.14 -javac.opt.Xbootclasspath.p=\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306B\u4ED8\u52A0\u3059\u308B
    4.15 +javac.opt.Xbootclasspath.p=\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306E\u5148\u982D\u306B\u4ED8\u52A0
    4.16  javac.opt.Xbootclasspath.a=\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30D1\u30B9\u306B\u8FFD\u52A0\u3059\u308B
    4.17  javac.opt.endorseddirs=\u63A8\u5968\u898F\u683C\u30D1\u30B9\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B
    4.18  javac.opt.extdirs=\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u6E08\u62E1\u5F35\u6A5F\u80FD\u306E\u5834\u6240\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3059\u308B
     5.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Mon Jul 18 23:53:12 2016 +0300
     5.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Mon Aug 08 15:40:58 2016 -0700
     5.3 @@ -621,6 +621,12 @@
     5.4          return Ident(new VarSymbol(FINAL, names._this, t, t.tsym));
     5.5      }
     5.6  
     5.7 +    /** Create a tree representing qualified `this' given its type
     5.8 +     */
     5.9 +    public JCExpression QualThis(Type t) {
    5.10 +        return Select(Type(t), new VarSymbol(FINAL, names._this, t, t.tsym));
    5.11 +    }
    5.12 +
    5.13      /** Create a tree representing a class literal.
    5.14       */
    5.15      public JCExpression ClassLiteral(ClassSymbol clazz) {
     6.1 --- a/src/share/classes/com/sun/tools/javac/util/Names.java	Mon Jul 18 23:53:12 2016 +0300
     6.2 +++ b/src/share/classes/com/sun/tools/javac/util/Names.java	Mon Aug 08 15:40:58 2016 -0700
     6.3 @@ -176,6 +176,7 @@
     6.4      public final Name lambda;
     6.5      public final Name metafactory;
     6.6      public final Name altMetafactory;
     6.7 +    public final Name dollarThis;
     6.8  
     6.9      public final Name.Table table;
    6.10  
    6.11 @@ -234,6 +235,7 @@
    6.12          value = fromString("value");
    6.13          valueOf = fromString("valueOf");
    6.14          values = fromString("values");
    6.15 +        dollarThis = fromString("$this");
    6.16  
    6.17          // class names
    6.18          java_io_Serializable = fromString("java.io.Serializable");
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/test/tools/javac/lambda/T8129740/AllowEnclosingVarCaptureTest.java	Mon Aug 08 15:40:58 2016 -0700
     7.3 @@ -0,0 +1,59 @@
     7.4 +/*
     7.5 + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
     7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.7 + *
     7.8 + * This code is free software; you can redistribute it and/or modify it
     7.9 + * under the terms of the GNU General Public License version 2 only, as
    7.10 + * published by the Free Software Foundation.
    7.11 + *
    7.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    7.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    7.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    7.15 + * version 2 for more details (a copy is included in the LICENSE file that
    7.16 + * accompanied this code).
    7.17 + *
    7.18 + * You should have received a copy of the GNU General Public License version
    7.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    7.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    7.21 + *
    7.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    7.23 + * or visit www.oracle.com if you need additional information or have any
    7.24 + * questions.
    7.25 + */
    7.26 +
    7.27 +/*
    7.28 + * @test
    7.29 + * @bug 8129740 8133111 8157142
    7.30 + * @summary Incorrect class file created when passing lambda in inner class constructor
    7.31 + * @run main AllowEnclosingVarCaptureTest
    7.32 + */
    7.33 +
    7.34 +public class AllowEnclosingVarCaptureTest {
    7.35 +
    7.36 +    int var = 0;
    7.37 +
    7.38 +    void foo() {
    7.39 +        var *= 2;
    7.40 +    }
    7.41 +
    7.42 +    public static void main(String[] args) {
    7.43 +        new AllowEnclosingVarCaptureTest().new Inner(9764);
    7.44 +    }
    7.45 +
    7.46 +    public class Inner {
    7.47 +        public Inner(Runnable r) {
    7.48 +            r.run();
    7.49 +            if (var != 66704)
    7.50 +                throw new AssertionError("Unexpected output: " + var);
    7.51 +        }
    7.52 +
    7.53 +        public Inner(int x) {
    7.54 +            this(() -> {
    7.55 +                var = x + 1234;
    7.56 +                AllowEnclosingVarCaptureTest.this.var += 5678;
    7.57 +                foo();
    7.58 +                AllowEnclosingVarCaptureTest.this.foo();
    7.59 +            });
    7.60 +        }
    7.61 +    }
    7.62 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/test/tools/javac/lambda/T8129740/CaptureInCtorChainingTest.java	Mon Aug 08 15:40:58 2016 -0700
     8.3 @@ -0,0 +1,54 @@
     8.4 +/*
     8.5 + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
     8.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.7 + *
     8.8 + * This code is free software; you can redistribute it and/or modify it
     8.9 + * under the terms of the GNU General Public License version 2 only, as
    8.10 + * published by the Free Software Foundation.
    8.11 + *
    8.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    8.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    8.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    8.15 + * version 2 for more details (a copy is included in the LICENSE file that
    8.16 + * accompanied this code).
    8.17 + *
    8.18 + * You should have received a copy of the GNU General Public License version
    8.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    8.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    8.21 + *
    8.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    8.23 + * or visit www.oracle.com if you need additional information or have any
    8.24 + * questions.
    8.25 + */
    8.26 +
    8.27 +/*
    8.28 + * @test
    8.29 + * @bug 8129740 8133111 8157142
    8.30 + * @summary Incorrect class file created when passing lambda in inner class constructor
    8.31 + * @run main CaptureInCtorChainingTest
    8.32 + */
    8.33 +
    8.34 +import java.util.function.Consumer;
    8.35 +import java.util.function.Function;
    8.36 +
    8.37 +public class CaptureInCtorChainingTest {
    8.38 +
    8.39 +    CaptureInCtorChainingTest(Function<Function<Function<Consumer<Void>, Void>, Void>, Void> innerClass) {
    8.40 +        new InnerClass(innerClass);
    8.41 +    }
    8.42 +
    8.43 +    void foo(Void v) { }
    8.44 +
    8.45 +    class InnerClass {
    8.46 +
    8.47 +        InnerClass(Function<Function<Function<Consumer<Void>, Void>, Void>, Void> factory) {
    8.48 +            this(factory.apply(o -> o.apply(CaptureInCtorChainingTest.this::foo)));
    8.49 +        }
    8.50 +
    8.51 +        InnerClass(Void unused) { }
    8.52 +    }
    8.53 +
    8.54 +    public static void main(String[] args) {
    8.55 +        new CaptureInCtorChainingTest(o -> null);
    8.56 +    }
    8.57 +}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/test/tools/javac/lambda/T8129740/QualifiedThisAccessTest.java	Mon Aug 08 15:40:58 2016 -0700
     9.3 @@ -0,0 +1,157 @@
     9.4 +/*
     9.5 + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
     9.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.7 + *
     9.8 + * This code is free software; you can redistribute it and/or modify it
     9.9 + * under the terms of the GNU General Public License version 2 only, as
    9.10 + * published by the Free Software Foundation.
    9.11 + *
    9.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    9.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    9.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    9.15 + * version 2 for more details (a copy is included in the LICENSE file that
    9.16 + * accompanied this code).
    9.17 + *
    9.18 + * You should have received a copy of the GNU General Public License version
    9.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    9.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    9.21 + *
    9.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    9.23 + * or visit www.oracle.com if you need additional information or have any
    9.24 + * questions.
    9.25 + */
    9.26 +
    9.27 +/*
    9.28 + * @test
    9.29 + * @bug 8129740 8133111 8157142
    9.30 + * @summary Incorrect class file created when passing lambda in inner class constructor
    9.31 + * @run main QualifiedThisAccessTest
    9.32 + */
    9.33 +
    9.34 +public class QualifiedThisAccessTest { // Not referenced by lambda, so should not be captured.
    9.35 +
    9.36 +    public class Universe { // Not referenced by lambda, so should not be captured.
    9.37 +
    9.38 +        public String name;
    9.39 +        public int galaxiesCount;
    9.40 +
    9.41 +        public Universe(String name, int galaxiesCount) {
    9.42 +            this.name = name;
    9.43 +            this.galaxiesCount = galaxiesCount;
    9.44 +        }
    9.45 +
    9.46 +        public String toString() {
    9.47 +            return "Universe" + name + " of " + galaxiesCount + " galaxies";
    9.48 +        }
    9.49 +
    9.50 +        class Galaxy {
    9.51 +
    9.52 +            String name;
    9.53 +            private int starsCount;
    9.54 +
    9.55 +            Galaxy(String name, int starsCount) {
    9.56 +                this.name = name;
    9.57 +                this.starsCount = starsCount;
    9.58 +            }
    9.59 +
    9.60 +            public String toString() {
    9.61 +                return "galaxy " + name + " of " + starsCount + " solar systems";
    9.62 +            }
    9.63 +
    9.64 +            int starsCount() {
    9.65 +                return starsCount;
    9.66 +            }
    9.67 +
    9.68 +            private String name() {
    9.69 +                return name;
    9.70 +            }
    9.71 +
    9.72 +            class SolarSystem {
    9.73 +
    9.74 +                String name;
    9.75 +                int planetsCount;
    9.76 +
    9.77 +                SolarSystem(String name, int planetsCount) {
    9.78 +                    this.name = name;
    9.79 +                    this.planetsCount = planetsCount;
    9.80 +                }
    9.81 +
    9.82 +                public String toString() {
    9.83 +                    return "Solar System of " + name + " with " + planetsCount + " planets";
    9.84 +                }
    9.85 +
    9.86 +                int planetsCount() {
    9.87 +                    return planetsCount;
    9.88 +                }
    9.89 +
    9.90 +                SolarSystem copy(SolarSystem s) {
    9.91 +                    return s;
    9.92 +                }
    9.93 +
    9.94 +                class Planet {
    9.95 +
    9.96 +                    String name;
    9.97 +                    int moonsCount;
    9.98 +
    9.99 +                    Planet(String name, int moonsCount, Runnable r) {
   9.100 +                        this.name = name;
   9.101 +                        this.moonsCount = moonsCount;
   9.102 +                        r.run();
   9.103 +                    }
   9.104 +                    Planet (String name, int moonsCount) {
   9.105 +                        this(name, moonsCount, ()-> {
   9.106 +                            StringBuffer buf = new StringBuffer();
   9.107 +                            buf.append("This planet belongs to the galaxy "
   9.108 +                                        + Galaxy.this.name + " with " + starsCount + " stars\n");
   9.109 +                            buf.append("This planet belongs to the galaxy "
   9.110 +                                        + Universe.Galaxy.this.name + " with " + starsCount() + " stars\n");
   9.111 +                            buf.append("This planet belongs to the galaxy "
   9.112 +                                        + Galaxy.this.name() + " with " + starsCount() + " stars\n");
   9.113 +                            buf.append("This planet belongs to the galaxy "
   9.114 +                                        + Universe.Galaxy.this.name() + " with "
   9.115 +                                        + (Universe.Galaxy.this).starsCount() + " stars\n");
   9.116 +
   9.117 +                            buf.append("This planet belongs to the solar system "
   9.118 +                                        + SolarSystem.this.name + " with " + planetsCount + " planets\n");
   9.119 +                            buf.append("This planet belongs to the solar system "
   9.120 +                                        + Galaxy.SolarSystem.this.name + " with " + planetsCount() + " planets\n");
   9.121 +                            buf.append("This planet belongs to the solar system "
   9.122 +                                        + (SolarSystem.this).name + " with " + planetsCount + " planets\n");
   9.123 +                            buf.append("This planet belongs to the solar system "
   9.124 +                                        + Universe.Galaxy.SolarSystem.this.name + " with "
   9.125 +                                        + Universe.Galaxy.SolarSystem.this.planetsCount + " planets\n");
   9.126 +                            buf.append("This planet belongs to the solar system "
   9.127 +                                        + Universe.Galaxy.SolarSystem.this.name.toLowerCase().toUpperCase()
   9.128 +                                        + " with " + Universe.Galaxy.SolarSystem.this.planetsCount + " planets\n");
   9.129 +                            buf.append("This planet belongs to the solar system "
   9.130 +                                        + copy(Universe.Galaxy.SolarSystem.this).name.toLowerCase().toUpperCase()
   9.131 +                                        + " with " + Universe.Galaxy.SolarSystem.this.planetsCount + " planets\n");
   9.132 +                            if (!buf.toString().equals(output))
   9.133 +                                throw new AssertionError("Unexpected value\n" + buf);
   9.134 +                        });
   9.135 +                    }
   9.136 +
   9.137 +                    static final String output =
   9.138 +                        "This planet belongs to the galaxy Mily way with 23456789 stars\n" +
   9.139 +                        "This planet belongs to the galaxy Mily way with 23456789 stars\n" +
   9.140 +                        "This planet belongs to the galaxy Mily way with 23456789 stars\n" +
   9.141 +                        "This planet belongs to the galaxy Mily way with 23456789 stars\n" +
   9.142 +                        "This planet belongs to the solar system Sun with 9 planets\n" +
   9.143 +                        "This planet belongs to the solar system Sun with 9 planets\n" +
   9.144 +                        "This planet belongs to the solar system Sun with 9 planets\n" +
   9.145 +                        "This planet belongs to the solar system Sun with 9 planets\n" +
   9.146 +                        "This planet belongs to the solar system SUN with 9 planets\n" +
   9.147 +                        "This planet belongs to the solar system SUN with 9 planets\n";
   9.148 +
   9.149 +
   9.150 +                    public String toString() {
   9.151 +                        return "Planet " + name + " with " + moonsCount + " moon(s)";
   9.152 +                    }
   9.153 +                }
   9.154 +            }
   9.155 +        }
   9.156 +    }
   9.157 +    public static void main(String[] args) {
   9.158 +        new QualifiedThisAccessTest().new Universe("Universe", 12345678).new Galaxy("Mily way", 23456789).new SolarSystem("Sun", 9).new Planet("Earth", 1);
   9.159 +    }
   9.160 +}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/test/tools/javac/lambda/T8129740/SourceForTranslation.java	Mon Aug 08 15:40:58 2016 -0700
    10.3 @@ -0,0 +1,122 @@
    10.4 +    class Universe { // Not referenced by lambda, so should not be captured.
    10.5 +
    10.6 +        public String name;
    10.7 +        public int galaxiesCount;
    10.8 +
    10.9 +        public Universe(String name, int galaxiesCount) {
   10.10 +            this.name = name;
   10.11 +            this.galaxiesCount = galaxiesCount;
   10.12 +        }
   10.13 +
   10.14 +        public String toString() {
   10.15 +            return "Universe" + name + " of " + galaxiesCount + " galaxies";
   10.16 +        }
   10.17 +
   10.18 +        class Galaxy {
   10.19 +
   10.20 +            String name;
   10.21 +            private int starsCount;
   10.22 +
   10.23 +            Galaxy(String name, int starsCount) {
   10.24 +                this.name = name;
   10.25 +                this.starsCount = starsCount;
   10.26 +            }
   10.27 +
   10.28 +            public String toString() {
   10.29 +                return "galaxy " + name + " of " + starsCount + " solar systems";
   10.30 +            }
   10.31 +
   10.32 +            int starsCount() {
   10.33 +                return starsCount;
   10.34 +            }
   10.35 +
   10.36 +            private String name() {
   10.37 +                return name;
   10.38 +            }
   10.39 +
   10.40 +            class SolarSystem {
   10.41 +
   10.42 +                String name;
   10.43 +                int planetsCount;
   10.44 +
   10.45 +                SolarSystem(String name, int planetsCount) {
   10.46 +                    this.name = name;
   10.47 +                    this.planetsCount = planetsCount;
   10.48 +                }
   10.49 +
   10.50 +                public String toString() {
   10.51 +                    return "Solar System of " + name + " with " + planetsCount + " planets";
   10.52 +                }
   10.53 +
   10.54 +                int planetsCount() {
   10.55 +                    return planetsCount;
   10.56 +                }
   10.57 +
   10.58 +                SolarSystem copy(SolarSystem s) {
   10.59 +                    return s;
   10.60 +                }
   10.61 +
   10.62 +                class Planet {
   10.63 +
   10.64 +                    String name;
   10.65 +                    int moonsCount;
   10.66 +
   10.67 +                    Planet(String name, int moonsCount, Runnable r) {
   10.68 +                        this.name = name;
   10.69 +                        this.moonsCount = moonsCount;
   10.70 +                        r.run();
   10.71 +                    }
   10.72 +                    Planet (String name, int moonsCount) {
   10.73 +                        this(name, moonsCount, ()-> {
   10.74 +                            String n = name;
   10.75 +                            StringBuffer buf = new StringBuffer();
   10.76 +                            buf.append("This planet belongs to the galaxy "
   10.77 +                                        + Galaxy.this.name + " with " + starsCount + " stars\n");
   10.78 +                            buf.append("This planet belongs to the galaxy "
   10.79 +                                        + Universe.Galaxy.this.name + " with " + starsCount() + " stars\n");
   10.80 +                            buf.append("This planet belongs to the galaxy "
   10.81 +                                        + Galaxy.this.name() + " with " + starsCount() + " stars\n");
   10.82 +                            buf.append("This planet belongs to the galaxy "
   10.83 +                                        + Universe.Galaxy.this.name() + " with "
   10.84 +                                        + (Universe.Galaxy.this).starsCount() + " stars\n");
   10.85 +
   10.86 +                            buf.append("This planet belongs to the solar system "
   10.87 +                                        + SolarSystem.this.name + " with " + planetsCount + " planets\n");
   10.88 +                            buf.append("This planet belongs to the solar system "
   10.89 +                                        + Galaxy.SolarSystem.this.name + " with " + planetsCount() + " planets\n");
   10.90 +                            buf.append("This planet belongs to the solar system "
   10.91 +                                        + (SolarSystem.this).name + " with " + planetsCount + " planets\n");
   10.92 +                            buf.append("This planet belongs to the solar system "
   10.93 +                                        + Universe.Galaxy.SolarSystem.this.name + " with "
   10.94 +                                        + Universe.Galaxy.SolarSystem.this.planetsCount + " planets\n");
   10.95 +                            buf.append("This planet belongs to the solar system "
   10.96 +                                        + Universe.Galaxy.SolarSystem.this.name.toLowerCase().toUpperCase()
   10.97 +                                        + " with " + Universe.Galaxy.SolarSystem.this.planetsCount + " planets\n");
   10.98 +                            buf.append("This planet belongs to the solar system "
   10.99 +                                        + copy(Universe.Galaxy.SolarSystem.this).name.toLowerCase().toUpperCase()
  10.100 +                                        + " with " + Universe.Galaxy.SolarSystem.this.planetsCount + " planets\n");
  10.101 +                            if (!buf.toString().equals(output))
  10.102 +                                throw new AssertionError("Unexpected value\n" + buf);
  10.103 +                        });
  10.104 +                    }
  10.105 +
  10.106 +                    static final String output =
  10.107 +                        "This planet belongs to the galaxy Mily way with 23456789 stars\n" +
  10.108 +                        "This planet belongs to the galaxy Mily way with 23456789 stars\n" +
  10.109 +                        "This planet belongs to the galaxy Mily way with 23456789 stars\n" +
  10.110 +                        "This planet belongs to the galaxy Mily way with 23456789 stars\n" +
  10.111 +                        "This planet belongs to the solar system Sun with 9 planets\n" +
  10.112 +                        "This planet belongs to the solar system Sun with 9 planets\n" +
  10.113 +                        "This planet belongs to the solar system Sun with 9 planets\n" +
  10.114 +                        "This planet belongs to the solar system Sun with 9 planets\n" +
  10.115 +                        "This planet belongs to the solar system SUN with 9 planets\n" +
  10.116 +                        "This planet belongs to the solar system SUN with 9 planets\n";
  10.117 +
  10.118 +
  10.119 +                    public String toString() {
  10.120 +                        return "Planet " + name + " with " + moonsCount + " moon(s)";
  10.121 +                    }
  10.122 +                }
  10.123 +            }
  10.124 +        }
  10.125 +    }
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/test/tools/javac/lambda/T8129740/SourceToSourceTranslationTest.java	Mon Aug 08 15:40:58 2016 -0700
    11.3 @@ -0,0 +1,46 @@
    11.4 +/*
    11.5 + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
    11.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.7 + *
    11.8 + * This code is free software; you can redistribute it and/or modify it
    11.9 + * under the terms of the GNU General Public License version 2 only, as
   11.10 + * published by the Free Software Foundation.
   11.11 + *
   11.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   11.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   11.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   11.15 + * version 2 for more details (a copy is included in the LICENSE file that
   11.16 + * accompanied this code).
   11.17 + *
   11.18 + * You should have received a copy of the GNU General Public License version
   11.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   11.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   11.21 + *
   11.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   11.23 + * or visit www.oracle.com if you need additional information or have any
   11.24 + * questions.
   11.25 + */
   11.26 +
   11.27 +/*
   11.28 + * @test
   11.29 + * @bug 8129740 8133111 8157142
   11.30 + * @summary Incorrect class file created when passing lambda in inner class constructor
   11.31 + * @library /tools/javac/lib
   11.32 + * @build ToolBox
   11.33 + * @run compile -XD-printsource SourceForTranslation.java
   11.34 + * @run main SourceToSourceTranslationTest
   11.35 + */
   11.36 +
   11.37 +import java.nio.file.Path;
   11.38 +import java.nio.file.Paths;
   11.39 +import java.util.List;
   11.40 +
   11.41 +public class SourceToSourceTranslationTest {
   11.42 +
   11.43 +    public static void main(String[] args) throws Exception {
   11.44 +        Path path1 = Paths.get(System.getProperty("test.classes"), "Universe.java");
   11.45 +        Path path2 = Paths.get(System.getProperty("test.src"), "Universe.java.out");
   11.46 +        ToolBox.compareLines(path1, path2, null);
   11.47 +    }
   11.48 +
   11.49 +}
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/test/tools/javac/lambda/T8129740/Universe.java.out	Mon Aug 08 15:40:58 2016 -0700
    12.3 @@ -0,0 +1,98 @@
    12.4 +
    12.5 +class Universe {
    12.6 +    public String name;
    12.7 +    public int galaxiesCount;
    12.8 +    
    12.9 +    public Universe(String name, int galaxiesCount) {
   12.10 +        super();
   12.11 +        this.name = name;
   12.12 +        this.galaxiesCount = galaxiesCount;
   12.13 +    }
   12.14 +    
   12.15 +    public String toString() {
   12.16 +        return "Universe" + name + " of " + galaxiesCount + " galaxies";
   12.17 +    }
   12.18 +    
   12.19 +    class Galaxy {
   12.20 +        String name;
   12.21 +        private int starsCount;
   12.22 +        
   12.23 +        Galaxy(String name, int starsCount) {
   12.24 +            super();
   12.25 +            this.name = name;
   12.26 +            this.starsCount = starsCount;
   12.27 +        }
   12.28 +        
   12.29 +        public String toString() {
   12.30 +            return "galaxy " + name + " of " + starsCount + " solar systems";
   12.31 +        }
   12.32 +        
   12.33 +        int starsCount() {
   12.34 +            return starsCount;
   12.35 +        }
   12.36 +        
   12.37 +        private String name() {
   12.38 +            return name;
   12.39 +        }
   12.40 +        
   12.41 +        class SolarSystem {
   12.42 +            String name;
   12.43 +            int planetsCount;
   12.44 +            
   12.45 +            SolarSystem(String name, int planetsCount) {
   12.46 +                super();
   12.47 +                this.name = name;
   12.48 +                this.planetsCount = planetsCount;
   12.49 +            }
   12.50 +            
   12.51 +            public String toString() {
   12.52 +                return "Solar System of " + name + " with " + planetsCount + " planets";
   12.53 +            }
   12.54 +            
   12.55 +            int planetsCount() {
   12.56 +                return planetsCount;
   12.57 +            }
   12.58 +            
   12.59 +            SolarSystem copy(SolarSystem s) {
   12.60 +                return s;
   12.61 +            }
   12.62 +            
   12.63 +            class Planet {
   12.64 +                String name;
   12.65 +                int moonsCount;
   12.66 +                
   12.67 +                Planet(String name, int moonsCount, Runnable r) {
   12.68 +                    super();
   12.69 +                    this.name = name;
   12.70 +                    this.moonsCount = moonsCount;
   12.71 +                    r.run();
   12.72 +                }
   12.73 +                
   12.74 +                Planet(String name, int moonsCount) {
   12.75 +                    this(name, moonsCount, java.lang.invoke.LambdaMetafactory.metafactory(name, Universe.Galaxy.this, Universe.Galaxy.SolarSystem.this));
   12.76 +                }
   12.77 +                static final String output = "This planet belongs to the galaxy Mily way with 23456789 stars\nThis planet belongs to the galaxy Mily way with 23456789 stars\nThis planet belongs to the galaxy Mily way with 23456789 stars\nThis planet belongs to the galaxy Mily way with 23456789 stars\nThis planet belongs to the solar system Sun with 9 planets\nThis planet belongs to the solar system Sun with 9 planets\nThis planet belongs to the solar system Sun with 9 planets\nThis planet belongs to the solar system Sun with 9 planets\nThis planet belongs to the solar system SUN with 9 planets\nThis planet belongs to the solar system SUN with 9 planets\n";
   12.78 +                
   12.79 +                public String toString() {
   12.80 +                    return "Planet " + name + " with " + moonsCount + " moon(s)";
   12.81 +                }
   12.82 +                
   12.83 +                /*synthetic*/ private static void lambda$new$0(/*synthetic*/ final String name, /*synthetic*/ final Universe.Galaxy Universe$Galaxy$this, /*synthetic*/ final Universe.Galaxy.SolarSystem Universe$Galaxy$SolarSystem$this) {
   12.84 +                    String n = name;
   12.85 +                    StringBuffer buf = new StringBuffer();
   12.86 +                    buf.append("This planet belongs to the galaxy " + Universe$Galaxy$this.name + " with " + Universe$Galaxy$this.starsCount + " stars\n");
   12.87 +                    buf.append("This planet belongs to the galaxy " + Universe$Galaxy$this.name + " with " + Universe$Galaxy$this.starsCount() + " stars\n");
   12.88 +                    buf.append("This planet belongs to the galaxy " + Universe$Galaxy$this.name() + " with " + Universe$Galaxy$this.starsCount() + " stars\n");
   12.89 +                    buf.append("This planet belongs to the galaxy " + Universe$Galaxy$this.name() + " with " + (Universe$Galaxy$this).starsCount() + " stars\n");
   12.90 +                    buf.append("This planet belongs to the solar system " + Universe$Galaxy$SolarSystem$this.name + " with " + Universe$Galaxy$SolarSystem$this.planetsCount + " planets\n");
   12.91 +                    buf.append("This planet belongs to the solar system " + Universe$Galaxy$SolarSystem$this.name + " with " + Universe$Galaxy$SolarSystem$this.planetsCount() + " planets\n");
   12.92 +                    buf.append("This planet belongs to the solar system " + (Universe$Galaxy$SolarSystem$this).name + " with " + Universe$Galaxy$SolarSystem$this.planetsCount + " planets\n");
   12.93 +                    buf.append("This planet belongs to the solar system " + Universe$Galaxy$SolarSystem$this.name + " with " + Universe$Galaxy$SolarSystem$this.planetsCount + " planets\n");
   12.94 +                    buf.append("This planet belongs to the solar system " + Universe$Galaxy$SolarSystem$this.name.toLowerCase().toUpperCase() + " with " + Universe$Galaxy$SolarSystem$this.planetsCount + " planets\n");
   12.95 +                    buf.append("This planet belongs to the solar system " + Universe$Galaxy$SolarSystem$this.copy(Universe$Galaxy$SolarSystem$this).name.toLowerCase().toUpperCase() + " with " + Universe$Galaxy$SolarSystem$this.planetsCount + " planets\n");
   12.96 +                    if (!buf.toString().equals(output)) throw new AssertionError("Unexpected value\n" + buf);
   12.97 +                }
   12.98 +            }
   12.99 +        }
  12.100 +    }
  12.101 +}

mercurial