Coverage Report - com.sun.tools.javafx.tree.JavafxTreeMaker
 
Classes in this File Line Coverage Branch Coverage Complexity
JavafxTreeMaker
88%
177/200
82%
63/77
0
JavafxTreeMaker$1
100%
2/2
N/A
0
JavafxTreeMaker$JFXCompilationUnit
25%
2/8
N/A
0
 
 1  
 /*
 2  
  * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
 3  
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 4  
  *
 5  
  * This code is free software; you can redistribute it and/or modify it
 6  
  * under the terms of the GNU General Public License version 2 only, as
 7  
  * published by the Free Software Foundation.  Sun designates this
 8  
  * particular file as subject to the "Classpath" exception as provided
 9  
  * by Sun in the LICENSE file that accompanied this code.
 10  
  *
 11  
  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  
  * version 2 for more details (a copy is included in the LICENSE file that
 15  
  * accompanied this code).
 16  
  *
 17  
  * You should have received a copy of the GNU General Public License version
 18  
  * 2 along with this work; if not, write to the Free Software Foundation,
 19  
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  
  *
 21  
  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 22  
  * CA 95054 USA or visit www.sun.com if you need additional information or
 23  
  * have any questions.
 24  
  */
 25  
 
 26  
 package com.sun.tools.javafx.tree;
 27  
 
 28  
 import com.sun.javafx.api.JavafxBindStatus;
 29  
 import com.sun.javafx.api.tree.TimeLiteralTree.Duration;
 30  
 import com.sun.javafx.api.tree.TypeTree.Cardinality;
 31  
 import com.sun.tools.javac.code.*;
 32  
 import com.sun.tools.javac.code.Symbol.PackageSymbol;
 33  
 import com.sun.tools.javac.tree.JCTree;
 34  
 import com.sun.tools.javac.tree.JCTree.*;
 35  
 import com.sun.tools.javac.tree.TreeMaker;
 36  
 import com.sun.tools.javac.util.*;
 37  
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 38  
 import java.io.IOException;
 39  
 import java.io.StringWriter;
 40  
 import javax.tools.JavaFileObject;
 41  
 
 42  
 /* JavaFX version of tree maker
 43  
  */
 44  268673
 public class JavafxTreeMaker extends TreeMaker implements JavafxTreeFactory {
 45  
      /** Get the JavafxTreeMaker instance.
 46  
      */
 47  
     public static JavafxTreeMaker instance(Context context) {
 48  4395
         JavafxTreeMaker instance = (JavafxTreeMaker) context.get(treeMakerKey);
 49  4395
         if (instance == null)
 50  0
             instance = new JavafxTreeMaker(context);
 51  4395
         return instance;
 52  
     }
 53  
     
 54  
     public static void preRegister(final Context context) {
 55  798
         context.put(treeMakerKey, new Context.Factory<TreeMaker>() {
 56  
             @Override
 57  
             public TreeMaker make() {
 58  399
                 return new JavafxTreeMaker(context);
 59  
             }
 60  
         });
 61  399
     }
 62  
     
 63  
     /** Create a tree maker with null toplevel and NOPOS as initial position.
 64  
      */
 65  
     protected JavafxTreeMaker(Context context) {
 66  399
         this(null,
 67  
                 Name.Table.instance(context),
 68  
                 Types.instance(context),
 69  
                 Symtab.instance(context)
 70  
                 );
 71  399
         context.put(treeMakerKey, this);
 72  399
         this.pos = Position.NOPOS;
 73  399
     }
 74  
     
 75  
     /** Create a tree maker with a given toplevel and FIRSTPOS as initial position.
 76  
      */
 77  
     JavafxTreeMaker(JCCompilationUnit toplevel, Name.Table names, Types types, Symtab syms) {
 78  399
         super(toplevel, names, types, syms);
 79  399
     }
 80  
     
 81  
     /** Create a new tree maker for a given toplevel.
 82  
      */
 83  
     @Override
 84  
     public JavafxTreeMaker forToplevel(JCCompilationUnit toplevel) {
 85  0
         return new JavafxTreeMaker(toplevel, names, types, syms);
 86  
     }
 87  
 
 88  
     /** Reassign current position.
 89  
      */
 90  
     @Override
 91  
     public JavafxTreeMaker at(int pos) {
 92  56012
         this.pos = pos;
 93  56012
         return this;
 94  
     }
 95  
     
 96  
     /** Reassign current position.
 97  
      */
 98  
     @Override
 99  
     public JavafxTreeMaker at(DiagnosticPosition pos) {
 100  272278
         this.pos = (pos == null ? Position.NOPOS : pos.getStartPosition());
 101  272278
         return this;
 102  
     }
 103  
     
 104  
     public JFXClassDeclaration ClassDeclaration(JCModifiers mods,
 105  
             Name name,
 106  
             List<JCExpression> supertypes,
 107  
             List<JCTree> declarations) {
 108  1078
         JFXClassDeclaration tree = new JFXClassDeclaration(mods,
 109  
                 name,
 110  
                 supertypes,
 111  
                 declarations,
 112  
                 null);
 113  1078
         tree.pos = pos;
 114  1078
         return tree;
 115  
     }
 116  
     
 117  
     public JFXBindExpression BindExpression(JCExpression expr, JavafxBindStatus bindStatus) {
 118  4
         if (bindStatus == null)
 119  0
             bindStatus = JavafxBindStatus.UNBOUND;
 120  4
         JFXBindExpression tree = new JFXBindExpression(expr, bindStatus);
 121  4
         tree.pos = pos;
 122  4
         return tree;
 123  
     }
 124  
 
 125  
     public JCExpression MaybeBindExpression(JCExpression expr, JavafxBindStatus bindStatus) {
 126  766
         if (bindStatus == null || ! bindStatus.isBound())
 127  664
             return expr;
 128  102
         JFXBindExpression tree = new JFXBindExpression(expr, bindStatus);
 129  102
         tree.pos = pos;
 130  102
         return tree;
 131  
     }
 132  
 
 133  
     public JFXBlockExpression BlockExpression(long flags, List<JCStatement> stats, JCExpression value) {
 134  3131
         JFXBlockExpression tree = new JFXBlockExpression(flags, stats, value);
 135  3131
         tree.pos = pos;
 136  3131
         return tree;
 137  
     }
 138  
     
 139  
     public JFXFunctionDefinition FunctionDefinition(
 140  
             JCModifiers modifiers,
 141  
             Name name,
 142  
             JFXType restype,
 143  
             List<JFXVar> params, 
 144  
             JFXBlockExpression bodyExpression) {
 145  1073
         JFXFunctionDefinition tree = new JFXFunctionDefinition(
 146  
                 modifiers,
 147  
                 name,
 148  
                 restype,
 149  
                 params,
 150  
                 bodyExpression);
 151  1073
         tree.operation.definition = tree;
 152  1073
         tree.pos = pos;
 153  1073
         return tree;
 154  
     }
 155  
 
 156  
     public JFXFunctionValue FunctionValue(
 157  
             JFXType restype,
 158  
              List<JFXVar> params, 
 159  
             JFXBlockExpression bodyExpression) {
 160  174
         JFXFunctionValue tree = new JFXFunctionValue(
 161  
                 restype,
 162  
                 params,
 163  
                 bodyExpression);
 164  174
         tree.pos = pos;
 165  174
         return tree;
 166  
     }
 167  
 
 168  
     public JFXInitDefinition InitDefinition(
 169  
             JCBlock body) {
 170  30
         JFXInitDefinition tree = new JFXInitDefinition(
 171  
                 body);
 172  30
         tree.pos = pos;
 173  30
         return tree;
 174  
     }
 175  
     
 176  
     public JFXPostInitDefinition PostInitDefinition(JCBlock body) {
 177  10
         JFXPostInitDefinition tree = new JFXPostInitDefinition(body);
 178  10
         tree.pos = pos;
 179  10
         return tree;
 180  
     }
 181  
 
 182  
     public JFXSequenceEmpty EmptySequence() {
 183  54
         JFXSequenceEmpty tree = new JFXSequenceEmpty();
 184  54
         tree.pos = pos;
 185  54
         return tree;
 186  
     }
 187  
 
 188  
     public JFXSequenceRange RangeSequence(JCExpression lower, JCExpression upper, JCExpression stepOrNull, boolean exclusive) {
 189  212
         JFXSequenceRange tree = new JFXSequenceRange(lower, upper,  stepOrNull,  exclusive);
 190  212
         tree.pos = pos;
 191  212
         return tree;
 192  
     }
 193  
 
 194  
     public JFXSequenceExplicit ExplicitSequence(List<JCExpression> items) {
 195  411
         JFXSequenceExplicit tree = new JFXSequenceExplicit(items);
 196  411
         tree.pos = pos;
 197  411
         return tree;
 198  
     }
 199  
     
 200  
     public JFXSequenceIndexed SequenceIndexed(JCExpression sequence, JCExpression index) {
 201  492
         JFXSequenceIndexed tree = new JFXSequenceIndexed(sequence, index);
 202  492
         tree.pos = pos;
 203  492
         return tree;
 204  
     }
 205  
 
 206  
     public JFXSequenceSlice SequenceSlice(JCExpression sequence, JCExpression firstIndex, JCExpression lastIndex, int endKind) {
 207  66
         JFXSequenceSlice tree = new JFXSequenceSlice(sequence, firstIndex,
 208  
                 lastIndex, endKind);
 209  66
         tree.pos = pos;
 210  66
         return tree;
 211  
     }
 212  
 
 213  
     public JFXSequenceInsert SequenceInsert(JCExpression sequence, JCExpression element, JCExpression position, boolean after) {
 214  186
         JFXSequenceInsert tree = new JFXSequenceInsert(sequence, element, position, after);
 215  186
         tree.pos = pos;
 216  186
         return tree;
 217  
     }
 218  
 
 219  
     public JFXSequenceDelete SequenceDelete(JCExpression sequence) {
 220  98
         JFXSequenceDelete tree = new JFXSequenceDelete(sequence, null);
 221  98
         tree.pos = pos;
 222  98
         return tree;
 223  
     }
 224  
 
 225  
     public JFXSequenceDelete SequenceDelete(JCExpression sequence, JCExpression element) {
 226  25
         JFXSequenceDelete tree = new JFXSequenceDelete(sequence, element);
 227  25
         tree.pos = pos;
 228  25
         return tree;
 229  
     }
 230  
 
 231  
     public JFXStringExpression StringExpression(List<JCExpression> parts,
 232  
                                         String translationKey) {
 233  748
         JFXStringExpression tree = new JFXStringExpression(parts, translationKey);
 234  748
         tree.pos = pos;
 235  748
         return tree;
 236  
     }
 237  
     
 238  
     public JFXInstanciate Instanciate(JCExpression ident,
 239  
             List<JCExpression> args,
 240  
             List<JCTree> defs) {
 241  672
         ListBuffer<JFXObjectLiteralPart> partsBuffer = ListBuffer.lb();
 242  672
         ListBuffer<JCTree> defsBuffer = ListBuffer.lb();
 243  672
         ListBuffer<JFXVar> varsBuffer = ListBuffer.lb();
 244  672
         if (defs != null) {
 245  514
             for (JCTree def : defs) {
 246  832
                 if (def instanceof JFXObjectLiteralPart) {
 247  771
                     partsBuffer.append((JFXObjectLiteralPart) def);
 248  61
                 } else if (def instanceof JFXVar && ((JFXVar)def).isLocal()) {
 249  8
                     varsBuffer.append((JFXVar) def);
 250  
                 } else {
 251  53
                     defsBuffer.append(def);
 252  
                 }
 253  
             }
 254  
         }
 255  672
         JFXClassDeclaration klass = null;
 256  672
         if (defsBuffer.size() > 0) {
 257  26
             JCExpression id = ident;
 258  44
             while (id instanceof JCFieldAccess) id = ((JCFieldAccess)id).getExpression();
 259  26
             Name cname = syntheticClassName(((JCIdent)id).getName());
 260  26
             long innerClassFlags = Flags.SYNTHETIC | Flags.FINAL; // to enable, change to Flags.FINAL
 261  26
             klass = this.ClassDeclaration(this.Modifiers(innerClassFlags), cname, List.<JCExpression>of(ident), defsBuffer.toList());
 262  
         }
 263  
         
 264  672
         JFXInstanciate tree = new JFXInstanciate(ident, 
 265  
                 klass, 
 266  
                 args==null? List.<JCExpression>nil() : args, 
 267  
                 partsBuffer.toList(), 
 268  
                 varsBuffer.toList(), 
 269  
                 null);
 270  672
         tree.pos = pos;
 271  672
         return tree;
 272  
     }
 273  
     
 274  
     public JFXSetAttributeToObjectBeingInitialized SetAttributeToObjectBeingInitialized(Name name) {
 275  0
         JFXSetAttributeToObjectBeingInitialized tree = new JFXSetAttributeToObjectBeingInitialized(name, null);
 276  0
         tree.pos = pos;
 277  0
         return tree;
 278  
     }
 279  
     
 280  
     public JFXObjectLiteralPart ObjectLiteralPart(
 281  
             Name attrName,
 282  
             JCExpression expr,
 283  
             JavafxBindStatus bindStatus) {
 284  766
         return ObjectLiteralPart(attrName, MaybeBindExpression(expr, bindStatus));
 285  
     }
 286  
 
 287  
     public JFXObjectLiteralPart ObjectLiteralPart(
 288  
             Name attrName,
 289  
             JCExpression expr) {
 290  771
         JFXObjectLiteralPart tree =
 291  
                 new JFXObjectLiteralPart(attrName, expr, null);
 292  771
         tree.pos = pos;
 293  771
         return tree;
 294  
     }
 295  
 
 296  
     public JFXType  TypeAny(Cardinality cardinality) {
 297  0
         JFXType tree = new JFXTypeAny(cardinality);
 298  0
         tree.pos = pos;
 299  0
         return tree;
 300  
     }
 301  
     
 302  
     public JFXType  TypeUnknown() {
 303  2113
         JFXType tree = new JFXTypeUnknown();
 304  2113
         tree.pos = Position.NOPOS;
 305  2113
         return tree;
 306  
     }
 307  
     
 308  
     public JFXType  TypeClass(JCExpression className,Cardinality cardinality) {
 309  2827
         JFXType tree = new JFXTypeClass(className, cardinality, null);
 310  2827
         tree.pos = pos;
 311  2827
         return tree;
 312  
     }
 313  
     
 314  
     public JFXType TypeFunctional(List<JFXType> params,
 315  
             JFXType restype,
 316  
             Cardinality cardinality) {
 317  33
         JFXType tree = new JFXTypeFunctional(params,
 318  
                 restype,
 319  
                 cardinality);
 320  33
         tree.pos = pos;
 321  33
         return tree;
 322  
     }
 323  
     
 324  
     
 325  
     public JFXOverrideAttribute TriggerWrapper(JCIdent expr, JFXOnReplace onr) {
 326  0
         JFXOverrideAttribute tree = new JFXOverrideAttribute(expr, null, null, onr, null);
 327  0
         tree.pos = pos;
 328  0
         return tree;
 329  
     }
 330  
     
 331  
     public JFXOnReplace OnReplace(JFXVar oldValue, JCBlock body) {
 332  0
         JFXOnReplace tree = new JFXOnReplace(oldValue, body);
 333  0
         tree.pos = pos;
 334  0
         return tree;
 335  
     }
 336  
     
 337  
      public JFXOnReplace OnReplace(JFXVar oldValue, JFXVar firstIndex,
 338  
              JFXVar lastIndex, JFXVar newElements, JCBlock body) {
 339  126
          return OnReplace(oldValue, firstIndex, lastIndex,
 340  
                  JFXSequenceSlice.END_INCLUSIVE, newElements, body);
 341  
     }
 342  
 
 343  
      public JFXOnReplace OnReplace(JFXVar oldValue, JFXVar firstIndex,
 344  
              JFXVar lastIndex, int endKind, JFXVar newElements, JCBlock body) {
 345  252
          JFXOnReplace tree = new JFXOnReplace(oldValue, firstIndex, lastIndex,
 346  
                  endKind, newElements, body);
 347  252
         tree.pos = pos;
 348  252
         return tree;
 349  
     }
 350  
    
 351  
    
 352  
     public JFXVar Var(Name name,
 353  
             JFXType type,
 354  
             JCModifiers mods,
 355  
             boolean isLocal,
 356  
             JCExpression initializer,
 357  
             JavafxBindStatus bindStatus,
 358  
             JFXOnReplace onReplace) {
 359  1808
             JFXVar tree = new JFXVar(name, type, 
 360  
                mods, isLocal, initializer, bindStatus, onReplace, null);
 361  1808
         tree.pos = pos;
 362  1808
         return tree;
 363  
     }   
 364  
     public JFXOverrideAttribute OverrideAttribute(JCIdent expr, 
 365  
             JCExpression initializer,
 366  
             JavafxBindStatus bindStatus,
 367  
             JFXOnReplace onr) {
 368  9
         JFXOverrideAttribute tree = new JFXOverrideAttribute(expr, initializer, 
 369  
                 bindStatus, onr, null);
 370  9
         tree.pos = pos;
 371  9
         return tree;
 372  
     }
 373  
     
 374  
     public JFXVar Param(Name name,
 375  
             JFXType type) {
 376  1474
         JFXVar tree = new JFXVar(name, type, 
 377  
                 Modifiers(Flags.PARAMETER), true, null, JavafxBindStatus.UNBOUND, null, null);
 378  1474
         tree.pos = pos;
 379  1474
         return tree;
 380  
     }
 381  
     
 382  
     public JFXForExpression ForExpression(
 383  
             List<JFXForExpressionInClause> inClauses,
 384  
             JCExpression bodyExpr) {
 385  198
         JFXForExpression tree = new JFXForExpression(inClauses, bodyExpr);       
 386  198
         tree.pos = pos;
 387  198
         return tree;
 388  
     }
 389  
     
 390  
     public JFXForExpressionInClause InClause(
 391  
             JFXVar var, 
 392  
             JCExpression seqExpr,
 393  
             JCExpression whereExpr) {
 394  206
         JFXForExpressionInClause tree = new JFXForExpressionInClause(var, seqExpr, whereExpr);       
 395  206
         tree.pos = pos;
 396  206
         return tree;
 397  
     }
 398  
     
 399  
     public JCExpression Identifier(Name name) {
 400  2092
         String str = name.toString();
 401  2092
         if (str.indexOf('.') < 0 && str.indexOf('<') < 0) {
 402  36
             return Ident(name);
 403  
         }
 404  2056
         return Identifier(str);
 405  
     }
 406  
     
 407  
     public JCExpression Identifier(String str) {
 408  6471
         assert str.indexOf('<') < 0 : "attempt to parse a type with 'Identifier'.  Use TypeTree";
 409  6471
         JCExpression tree = null;
 410  
         int inx;
 411  6471
         int lastInx = 0;
 412  
         do {
 413  32483
             inx = str.indexOf('.', lastInx);
 414  
             int endInx;
 415  32483
             if (inx < 0) {
 416  6471
                 endInx = str.length();
 417  
             } else {
 418  26012
                 endInx = inx;
 419  
             }
 420  32483
             String part = str.substring(lastInx, endInx);
 421  32483
             Name partName = Name.fromString(names, part);
 422  32483
             tree = tree == null? 
 423  
                 Ident(partName) : 
 424  
                 Select(tree, partName);
 425  32483
             lastInx = endInx + 1;
 426  32483
         } while (inx >= 0);
 427  6471
         return tree;
 428  
     }
 429  
     
 430  
     public JFXInterpolate Interpolate(JCExpression var, List<JFXInterpolateValue> values) {
 431  0
         JFXInterpolate tree = new JFXInterpolate(var, values);
 432  0
         tree.pos = pos;
 433  0
         return tree;
 434  
     }
 435  
     
 436  
     public JFXInterpolateValue InterpolateValue(JCExpression attr, JCExpression v, JCExpression interp) {
 437  5
         JFXInterpolateValue tree = new JFXInterpolateValue(attr, v, interp);
 438  5
         tree.pos = pos;
 439  5
         return tree;
 440  
     }
 441  
     
 442  
     public JFXIndexof Indexof (Name name) {
 443  28
         JFXIndexof tree = new JFXIndexof(name);
 444  28
         tree.pos = pos;
 445  28
         return tree;
 446  
     }
 447  
     
 448  
     public JFXTimeLiteral TimeLiteral(String str) {
 449  22
         int i = 0;
 450  22
         char[] buf = str.toCharArray();
 451  61
         while (i < buf.length && (Character.isDigit(buf[i]) || buf[i] == '.'))
 452  39
             i++;
 453  22
         assert i > 0 && buf.length - i > 0; // lexer should only pass valid time strings
 454  22
         String dur = str.substring(i);
 455  22
         Duration duration = 
 456  
                 dur.equals("ms") ? Duration.MILLIS :
 457  
                 dur.equals("s") ? Duration.SECONDS :
 458  
                 dur.equals("m") ? Duration.MINUTES :
 459  
                 dur.equals("h") ? Duration.HOURS : null;
 460  22
         assert duration != null;
 461  
         Object value;
 462  
         try {
 463  22
             String s = str.substring(0, i);
 464  22
             if (s.indexOf('.') >= 0)
 465  1
                 value = Double.valueOf(s) * duration.getMultiplier();
 466  
             else 
 467  21
                 value = Integer.valueOf(s) * duration.getMultiplier();
 468  0
         } catch (NumberFormatException ex) {
 469  
             // error already reported in scanner
 470  0
             value = Double.NaN;
 471  22
         }
 472  22
         JCLiteral literal = Literal(value);
 473  22
         JFXTimeLiteral tree = new JFXTimeLiteral(literal, duration);
 474  22
         tree.pos = pos;
 475  22
         return tree;
 476  
     }
 477  
     
 478  
     public JFXKeyFrameLiteral KeyFrameLiteral(JFXTimeLiteral start, List<JFXInterpolate> exprs, JFXBlockExpression trigger) {
 479  0
         JFXKeyFrameLiteral tree = new JFXKeyFrameLiteral(start, exprs, trigger);
 480  0
         tree.pos = pos;
 481  0
         return tree;
 482  
     }
 483  
 
 484  
     @Override
 485  
     public JCUnary Unary(int opcode, JCExpression arg) {
 486  1022
         switch (opcode) {
 487  
             case JavafxTag.SIZEOF:
 488  
             case JavafxTag.REVERSE: {
 489  268
                 JCUnary tree = new JFXUnary(opcode, arg);
 490  268
                 tree.pos = pos;
 491  268
                 return tree;
 492  
             }
 493  
             default:
 494  754
                 return super.Unary(opcode, arg);
 495  
         }
 496  
     }
 497  
    
 498  399
     private int syntheticClassNumber = 0;
 499  
     
 500  
     Name syntheticClassName(Name superclass) {
 501  26
         return Name.fromString(names, superclass.toString() + "$anon" + ++syntheticClassNumber);
 502  
     }
 503  
     
 504  
     /**
 505  
      * Clone of javac's TreeMaker.TopLevel, minus the assertion check of defs types.
 506  
      */
 507  
     @Override
 508  
     public JCCompilationUnit TopLevel(List<JCAnnotation> packageAnnotations,
 509  
                                       JCExpression pid,
 510  
                                       List<JCTree> defs) {
 511  747
         assert packageAnnotations != null;
 512  747
         JCCompilationUnit tree = new JFXCompilationUnit(packageAnnotations, pid, defs,
 513  
                                      null, null, null, null);
 514  747
         tree.pos = pos;
 515  747
         return tree;
 516  
     }
 517  
     private static class JFXCompilationUnit extends JCCompilationUnit {
 518  
         protected JFXCompilationUnit(List<JCAnnotation> packageAnnotations,
 519  
                         JCExpression pid,
 520  
                         List<JCTree> defs,
 521  
                         JavaFileObject sourcefile,
 522  
                         PackageSymbol packge,
 523  
                         Scope namedImportScope,
 524  
                         Scope starImportScope) {
 525  747
             super(packageAnnotations, pid, defs, sourcefile, packge, namedImportScope, starImportScope);
 526  747
         }
 527  
         
 528  
         @Override
 529  
         public String toString() {
 530  0
             StringWriter s = new StringWriter();
 531  
             try {
 532  0
                 new JavafxPretty(s, false).printExpr(this);
 533  
             }
 534  0
             catch (IOException e) {
 535  
                 // should never happen, because StringWriter is defined
 536  
                 // never to throw any IOExceptions
 537  0
                 throw new AssertionError(e);
 538  0
             }
 539  0
             return s.toString();
 540  
         }
 541  
     }
 542  
     
 543  
     public JCExpression QualIdent(Symbol sym) {
 544  1261
         if (sym.kind ==Kinds.PCK && sym.owner == syms.rootPackage)
 545  417
             return Ident(sym);
 546  844
         return super.QualIdent(sym);
 547  
     }
 548  
 }