Skip to content

Commit 4aeeba7

Browse files
committed
Annotate all Ruby Throwable classes to make it easy to list them
1 parent 9f12660 commit 4aeeba7

13 files changed

+44
-17
lines changed

src/main/java/org/truffleruby/core/format/exceptions/FormatException.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
package org.truffleruby.core.format.exceptions;
1111

1212
import com.oracle.truffle.api.nodes.ControlFlowException;
13+
import org.truffleruby.language.control.RubyThrowable;
1314

1415
@SuppressWarnings("serial")
15-
public class FormatException extends ControlFlowException {
16+
public class FormatException extends ControlFlowException implements RubyThrowable {
1617

1718
private final String message;
1819

src/main/java/org/truffleruby/language/control/BreakException.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
*/
1010
package org.truffleruby.language.control;
1111

12-
import com.oracle.truffle.api.nodes.ControlFlowException;
1312

1413
@SuppressWarnings("serial")
15-
public final class BreakException extends ControlFlowException {
14+
public final class BreakException extends RubyControlFlowException {
1615

1716
private final BreakID breakID;
1817
private final Object result;

src/main/java/org/truffleruby/language/control/DynamicReturnException.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
*/
1010
package org.truffleruby.language.control;
1111

12-
import com.oracle.truffle.api.nodes.ControlFlowException;
1312

1413
@SuppressWarnings("serial")
15-
public final class DynamicReturnException extends ControlFlowException {
14+
public final class DynamicReturnException extends RubyControlFlowException {
1615

1716
private final ReturnID returnID;
1817
private final Object value;

src/main/java/org/truffleruby/language/control/KillException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/** Used by Thread#kill and to terminate threads. This does run code in ensure. */
2121
@ExportLibrary(InteropLibrary.class)
2222
@SuppressWarnings("serial")
23-
public final class KillException extends AbstractTruffleException {
23+
public final class KillException extends AbstractTruffleException implements RubyThrowable {
2424

2525
@TruffleBoundary
2626
private static RuntimeException javaStacktrace() {

src/main/java/org/truffleruby/language/control/LocalReturnException.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
*/
1010
package org.truffleruby.language.control;
1111

12-
import com.oracle.truffle.api.nodes.ControlFlowException;
1312

1413
@SuppressWarnings("serial")
15-
public final class LocalReturnException extends ControlFlowException {
14+
public final class LocalReturnException extends RubyControlFlowException {
1615

1716
private final Object value;
1817

src/main/java/org/truffleruby/language/control/NextException.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
*/
1010
package org.truffleruby.language.control;
1111

12-
import com.oracle.truffle.api.nodes.ControlFlowException;
1312

1413
@SuppressWarnings("serial")
15-
public final class NextException extends ControlFlowException {
14+
public final class NextException extends RubyControlFlowException {
1615

1716
private final Object result;
1817

src/main/java/org/truffleruby/language/control/RaiseException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/** A ControlFlowException holding a Ruby exception. */
2121
@SuppressWarnings("serial")
2222
@ExportLibrary(value = InteropLibrary.class, delegateTo = "exception")
23-
public final class RaiseException extends AbstractTruffleException {
23+
public final class RaiseException extends AbstractTruffleException implements RubyThrowable {
2424

2525
protected final RubyException exception;
2626

src/main/java/org/truffleruby/language/control/RedoException.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
*/
1010
package org.truffleruby.language.control;
1111

12-
import com.oracle.truffle.api.nodes.ControlFlowException;
1312

1413
@SuppressWarnings("serial")
15-
public final class RedoException extends ControlFlowException {
14+
public final class RedoException extends RubyControlFlowException {
1615
}

src/main/java/org/truffleruby/language/control/RetryException.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
*/
1010
package org.truffleruby.language.control;
1111

12-
import com.oracle.truffle.api.nodes.ControlFlowException;
1312

1413
@SuppressWarnings("serial")
15-
public final class RetryException extends ControlFlowException {
14+
public final class RetryException extends RubyControlFlowException {
1615
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved. This
3+
* code is released under a tri EPL/GPL/LGPL license. You can use it,
4+
* redistribute it and/or modify it under the terms of the:
5+
*
6+
* Eclipse Public License version 2.0, or
7+
* GNU General Public License version 2, or
8+
* GNU Lesser General Public License version 2.1.
9+
*/
10+
package org.truffleruby.language.control;
11+
12+
import com.oracle.truffle.api.nodes.ControlFlowException;
13+
14+
/** Superclass for exceptions which are used solely for control flow in Ruby (return, next, break, redo, retry) */
15+
@SuppressWarnings("serial")
16+
public abstract class RubyControlFlowException extends ControlFlowException implements RubyThrowable {
17+
}

0 commit comments

Comments
 (0)