Skip to content

Commit

Permalink
8285611: Retrofit (Doc)Pretty with java.io.UncheckedIOException
Browse files Browse the repository at this point in the history
Reviewed-by: jjg
  • Loading branch information
pavelrappo committed Apr 26, 2022
1 parent 9478696 commit e333cd3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;

Expand Down Expand Up @@ -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();
}
}

Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

1 comment on commit e333cd3

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.