< prev index next >
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 635,657 ****
printDocComment(tree);
if ((tree.mods.flags & ENUM) != 0) {
print("/*public static final*/ ");
print(tree.name);
if (tree.init != null) {
! if (sourceOutput && tree.init.hasTag(NEWCLASS)) {
! print(" /*enum*/ ");
JCNewClass init = (JCNewClass) tree.init;
if (init.args != null && init.args.nonEmpty()) {
print("(");
print(init.args);
print(")");
}
if (init.def != null && init.def.defs != null) {
print(" ");
printBlock(init.def.defs);
}
return;
}
print(" /* = ");
printExpr(tree.init);
print(" */");
}
--- 635,681 ----
printDocComment(tree);
if ((tree.mods.flags & ENUM) != 0) {
print("/*public static final*/ ");
print(tree.name);
if (tree.init != null) {
! if (tree.init.hasTag(NEWCLASS)) {
JCNewClass init = (JCNewClass) tree.init;
+ if (sourceOutput) {
+ print(" /*enum*/ ");
if (init.args != null && init.args.nonEmpty()) {
print("(");
print(init.args);
print(")");
}
if (init.def != null && init.def.defs != null) {
print(" ");
printBlock(init.def.defs);
}
return;
+ }else {
+ print(" /* = ");
+ print("new ");
+ if (!init.typeargs.isEmpty()) {
+ print("<");
+ printExprs(init.typeargs);
+ print(">");
+ }
+ if (init.def != null && init.def.mods.annotations.nonEmpty()) {
+ printTypeAnnotations(init.def.mods.annotations);
+ }
+ printExpr(init.clazz);
+ print("(");
+ printExprs(init.args);
+ print(")");
+ print(" */");
+ print(" /*enum*/ ");
+ if (init.def != null && init.def.defs != null) {
+ print(" ");
+ printBlock(init.def.defs);
+ }
+ return;
+ }
}
print(" /* = ");
printExpr(tree.init);
print(" */");
}
< prev index next >