/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* A processor which prints out elements. Used to implement the
* -Xprint option; the included visitor class is used to implement
* Elements.printElements.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*/
@SupportedAnnotationTypes("*")
// TODO: Change to version 7 based visitors when available
public PrintingProcessor() {
super();
}
writer = new PrintWriter(w);
}
}
// Just print the elements, nothing more to do.
return true;
}
}
/**
* Used for the -Xprint option and called by Elements.printElements
*/
public static class PrintingElementVisitor
super();
this.writer = new PrintWriter(w);
this.elementUtils = elementUtils;
indentation = 0;
}
printDocComment(e);
printModifiers(e);
return this;
}
if (kind != STATIC_INIT &&
kind != INSTANCE_INIT) {
// Don't print out the constructor of an anonymous class
if (kind == CONSTRUCTOR &&
// Use an anonymous class to determine anonymity!
return e.getNestingKind();
}
return this;
defaultAction(e, true);
printFormalTypeParameters(e, true);
switch(kind) {
case CONSTRUCTOR:
// Print out simple name of the class
break;
case METHOD:
break;
}
printParameters(e);
if (defaultValue != null)
printThrows(e);
}
return this;
}
// Print out an anonymous class in the style of a
// class instance creation expression rather than a
// class declaration.
// If the anonymous class implements an interface
// print that name, otherwise print the superclass.
if (!interfaces.isEmpty())
else
// Anonymous classes that implement an interface can't
// have any constructor arguments.
if (interfaces.isEmpty()) {
// Print out the parameter list from the sole
// constructor. For now, don't try to elide any
// synthetic parameters by determining if the
// anonymous class is in a static context, etc.
if (!constructors.isEmpty())
}
} else {
if (nestingKind == TOP_LEVEL) {
}
defaultAction(e, true);
switch(kind) {
case ANNOTATION_TYPE:
break;
default:
}
printFormalTypeParameters(e, false);
// Print superclass information if informative
}
}
printInterfaces(e);
}
indentation++;
// Handle any enum constants specially before other entities.
}
if (!enumConstants.isEmpty()) {
int i;
}
}
} else {
}
indentation--;
indent();
return this;
}
defaultAction(e, newLine);
if (kind == ENUM_CONSTANT)
else {
if (constantValue != null) {
}
}
return this;
}
return this;
}
// Should we do more here?
defaultAction(e, false);
if (!e.isUnnamed())
else
return this;
}
public void flush() {
}
if (docComment != null) {
// Break comment into lines
"\n\r");
indent();
while(st.hasMoreTokens()) {
indent();
}
indent();
}
}
} else {
printAnnotations(e);
indent();
}
if (kind == ENUM_CONSTANT)
return;
switch (kind) {
case ANNOTATION_TYPE:
case INTERFACE:
break;
case ENUM:
break;
case METHOD:
case FIELD:
if (enclosingElement != null &&
}
break;
}
}
}
boolean pad) {
boolean first = true;
if (!first)
first = false;
}
if (pad)
}
}
}
}
indent();
}
}
// TODO: Refactor
switch (size) {
case 0:
break;
case 1:
if (e.isVarArgs() ) {
} else
}
break;
default:
{
int i = 1;
if (i == 2)
indentation++;
if (i > 1)
indent();
} else
if (i < size)
i++;
}
indentation--;
}
break;
}
}
if(kind != ANNOTATION_TYPE) {
boolean first = true;
if (!first)
first = false;
}
}
}
}
if (size != 0) {
int i = 1;
if (i == 1)
if (i == 2)
indentation++;
if (i >= 2)
indent();
if (i != size)
i++;
}
if (size >= 2)
indentation--;
}
}
"",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "
};
private void indent() {
int indentation = this.indentation;
if (indentation < 0)
return;
while (indentation > maxIndex) {
indentation -= maxIndex;
}
}
}
}