8282574: Cleanup unnecessary calls to Throwable.initCause() in jdk.compiler

Reviewed-by: darcy
This commit is contained in:
Andrey Turbanov 2022-03-19 13:29:49 +00:00
parent 10ccfffae1
commit e8caf84fb9
2 changed files with 4 additions and 9 deletions
src/jdk.compiler/share/classes/com/sun/tools/javac

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -300,10 +300,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
try {
processorIterator = List.of(new PrintingProcessor()).iterator();
} catch (Throwable t) {
AssertionError assertError =
new AssertionError("Problem instantiating PrintingProcessor.");
assertError.initCause(t);
throw assertError;
throw new AssertionError("Problem instantiating PrintingProcessor.", t);
}
} else if (processors != null) {
processorIterator = processors.iterator();

@ -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
@ -194,9 +194,7 @@ public class Pretty extends JCTree.Visitor {
tree.accept(this);
}
} catch (UncheckedIOException ex) {
IOException e = new IOException(ex.getMessage());
e.initCause(ex);
throw e;
throw new IOException(ex.getMessage(), ex);
} finally {
this.prec = prevPrec;
}