diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java index 8356c20bff204..70f1e54b2db8d 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocPretty.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2022, 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 @@ -26,6 +26,7 @@ package com.sun.tools.javac.tree; import java.io.IOException; +import java.io.UncheckedIOException; import java.io.Writer; import java.util.List; @@ -64,7 +65,7 @@ public void print(DocTree tree) throws IOException { tree.accept(this, null); } } catch (UncheckedIOException ex) { - throw new IOException(ex.getMessage(), ex); + throw ex.getCause(); } } @@ -116,14 +117,6 @@ protected void printTagName(DocTree node) throws IOException { * Traversal methods *************************************************************************/ - /** Exception to propagate IOException through visitXYZ methods */ - private static class UncheckedIOException extends Error { - static final long serialVersionUID = -4032692679158424751L; - UncheckedIOException(IOException e) { - super(e.getMessage(), e); - } - } - @Override @DefinedBy(Api.COMPILER_TREE) public Void visitAttribute(AttributeTree node, Void p) { try { diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java index bdfef06fd7c53..ab5f0d6c8ea23 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java @@ -170,14 +170,6 @@ public static String toSimpleString(JCTree tree, int maxLength) { * Traversal methods *************************************************************************/ - /** Exception to propagate IOException through visitXYZ methods */ - private static class UncheckedIOException extends Error { - static final long serialVersionUID = -4032692679158424751L; - UncheckedIOException(IOException e) { - super(e.getMessage(), e); - } - } - /** Visitor argument: the current precedence level. */ int prec; @@ -194,7 +186,7 @@ public void printExpr(JCTree tree, int prec) throws IOException { tree.accept(this); } } catch (UncheckedIOException ex) { - throw new IOException(ex.getMessage(), ex); + throw ex.getCause(); } finally { this.prec = prevPrec; }