{
install_bundle(
data_dir,
"java-usages",
- "1.16.0",
+ "1.17.0",
include_bytes!("../../../java/java-usages/openidea-java-usages.jar"),
)
}
diff --git a/java/java-usages/MANIFEST.MF b/java/java-usages/MANIFEST.MF
index 8380d7f7b..ca787adaf 100644
--- a/java/java-usages/MANIFEST.MF
+++ b/java/java-usages/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: OpenIDEA Java usages
Bundle-SymbolicName: ai.openidea.usages;singleton:=true
-Bundle-Version: 1.16.0
+Bundle-Version: 1.17.0
Bundle-RequiredExecutionEnvironment: JavaSE-21
Require-Bundle: org.eclipse.jdt.ls.core,org.eclipse.jdt.core,
org.eclipse.jdt.core.manipulation,org.eclipse.core.runtime,
diff --git a/java/java-usages/README.md b/java/java-usages/README.md
index f0d724a2d..5506ce55e 100644
--- a/java/java-usages/README.md
+++ b/java/java-usages/README.md
@@ -88,7 +88,7 @@ is not a claim of full IntelliJ feature parity.
## Rebuild and delivery
The checked-in jar is embedded by ide-sdk `include_bytes!`, installed as
-`java-usages-1.16.0.jar`, and added alongside existing initialization bundles.
+`java-usages-1.17.0.jar`, and added alongside existing initialization bundles.
Users need no compiler, Maven or Python. Manifest/install version must change
when replacing the bundle because OSGi caches bundles.
@@ -139,6 +139,9 @@ reproducible SHA-256 is `c29e5455c02c245523b2e7a5861e00ae670cefc66cda33ec19fdce2
Version 1.16.0 adds `openidea.java.generatedSources`, which puts Maven plugin output such as
protobuf and gRPC stubs on the project classpath; its reproducible SHA-256 is
`a5feda1cae11bdea1044fb311404840b048601af037f65685973721f1eefff8b`.
+Version 1.17.0 adds `openidea.java.exceptionType`, the exception class at a caret for the exception
+breakpoint intention; its reproducible SHA-256 is
+`d1c596b37dcb6bd402ad48b214fd2a7651dbd4472eeea49e2ce992ea2f1363e9`.
```sh
export PATH=/path/to/jdk25/bin:$PATH
@@ -169,6 +172,7 @@ python3 java/java-usages/tests/read-write.py /path/to/jdtls /path/to/lombok.jar
OPENIDEA_USAGES_INDEX_STRESS=1 python3 java/java-usages/tests/read-write.py /path/to/jdtls /path/to/lombok.jar > /tmp/read-write-indexed.json
python3 java/java-usages/tests/hierarchy.py /path/to/jdtls
python3 java/java-usages/tests/implementations.py /path/to/jdtls
+python3 java/java-usages/tests/exception-type.py /path/to/jdtls
```
The harnesses select the JDT LS configuration for the current platform. The first
@@ -185,6 +189,21 @@ listing, moving, declaring abstract, pulling up to an interface, conflicts repor
before any change, and a class without supertypes. Each edit is applied to a copy of
the fixture and compiled with javac.
+`exception-type.py` puts the caret on throws, catches (multi-catch too), qualified names, a
+thrown variable or call, a nested, local, unresolved or non-Throwable class, an import and a
+class declaration, and compares each answer with IntelliJ's.
+
+## Exception class at a caret
+
+`openidea.java.exceptionType(uri, line, column)` answers `{qualifiedName, displayName}` (the
+binary name, `app.Outer$Failure`, and the simple name) or `null`, as IntelliJ's
+`ControlExceptionBreakpointJVMSupport` decides: from the token right of the caret, else the one
+left of it, the nearest enclosing reference, class or throw statement. A reference gives the class
+it resolves to (a constructor's class; a variable, a method or a package gives nothing, and so does
+a call with a qualifier, which UAST sees as a reference to its method), a class gives itself only on
+its name, a throw statement the class of what it throws. The class must be a `Throwable` with a
+qualified name: not unresolved, local, anonymous or a type variable.
+
## Class-hierarchy refactorings
`openidea.java.hierarchy.members(uri, line, column, kind)` describes the class at the
diff --git a/java/java-usages/openidea-java-usages.jar b/java/java-usages/openidea-java-usages.jar
index a5dff7a48..053d57c1a 100644
Binary files a/java/java-usages/openidea-java-usages.jar and b/java/java-usages/openidea-java-usages.jar differ
diff --git a/java/java-usages/plugin.xml b/java/java-usages/plugin.xml
index b12450e05..fbab8c136 100644
--- a/java/java-usages/plugin.xml
+++ b/java/java-usages/plugin.xml
@@ -30,5 +30,8 @@
+
+
+
diff --git a/java/java-usages/src/ai/openidea/breakpoints/ExceptionTypeCommand.java b/java/java-usages/src/ai/openidea/breakpoints/ExceptionTypeCommand.java
new file mode 100644
index 000000000..8b56ddcb5
--- /dev/null
+++ b/java/java-usages/src/ai/openidea/breakpoints/ExceptionTypeCommand.java
@@ -0,0 +1,113 @@
+package ai.openidea.breakpoints;
+
+import ai.openidea.Documents;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.ITypeRoot;
+import org.eclipse.jdt.core.dom.*;
+import org.eclipse.jdt.core.manipulation.CoreASTProvider;
+import org.eclipse.jdt.ls.core.internal.IDelegateCommandHandler;
+import org.eclipse.jdt.ls.core.internal.JDTUtils;
+import org.eclipse.jdt.ls.core.internal.handlers.JsonRpcHelpers;
+
+/**
+ * The exception class a caret names, for the Create / Enable / Disable exception breakpoint intention.
+ *
+ * {@code openidea.java.exceptionType(uri, line, column)} answers {@code {qualifiedName, displayName}}
+ * ({@code qualifiedName} is the binary name, {@code app.Outer$Failure}) or {@code null}. It follows
+ * IntelliJ's {@code ControlExceptionBreakpointJVMSupport}: from the token right of the caret, else the
+ * one left of it, the nearest enclosing reference, class or throw statement decides. A reference gives
+ * the class it resolves to (a constructor's class; a variable, a method or a package gives nothing), a
+ * class gives itself only on its name, and a throw statement the class of the thrown expression. The
+ * class must be a {@link Throwable} with a qualified name: not unresolved, local, anonymous or a type
+ * variable.
+ */
+public final class ExceptionTypeCommand implements IDelegateCommandHandler {
+ @Override
+ public Object executeCommand(String command, List