You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ne...@apache.org on 2021/11/08 16:26:36 UTC
[netbeans] branch delivery updated: [NETBEANS-6171] Interpret
ClassCast as "interface unsupported"
This is an automated email from the ASF dual-hosted git repository.
neilcsmith pushed a commit to branch delivery
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/delivery by this push:
new 8940b50 [NETBEANS-6171] Interpret ClassCast as "interface unsupported"
new aebd0d9 Merge pull request #3302 from sdedic/sdedic/sdkengine-interface-cce
8940b50 is described below
commit 8940b50a81a6a04efd626fdb2c9ed8c086747055
Author: Svata Dedic <sv...@oracle.com>
AuthorDate: Thu Nov 4 13:28:50 2021 +0100
[NETBEANS-6171] Interpret ClassCast as "interface unsupported"
---
.../org/netbeans/libs/graalsdk/impl/GraalEngine.java | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/ide/libs.graalsdk/src/org/netbeans/libs/graalsdk/impl/GraalEngine.java b/ide/libs.graalsdk/src/org/netbeans/libs/graalsdk/impl/GraalEngine.java
index 15d8d35..6adc9cc 100644
--- a/ide/libs.graalsdk/src/org/netbeans/libs/graalsdk/impl/GraalEngine.java
+++ b/ide/libs.graalsdk/src/org/netbeans/libs/graalsdk/impl/GraalEngine.java
@@ -173,13 +173,17 @@ final class GraalEngine implements ScriptEngine, Invocable {
@Override
public <T> T getInterface(Object thiz, Class<T> clasz) {
- if (thiz instanceof Value) {
- return ((Value) thiz).as(clasz);
- }
- Value v = factory.ctx.ctx().asValue(thiz);
- T ret = v.as(clasz);
- if (ret != null) {
- return ret;
+ try {
+ if (thiz instanceof Value) {
+ return ((Value) thiz).as(clasz);
+ }
+ Value v = factory.ctx.ctx().asValue(thiz);
+ T ret = v.as(clasz);
+ if (ret != null) {
+ return ret;
+ }
+ } catch (ClassCastException ex) {
+ // the interface is not supported on the value object; ignore.
}
if (clasz.isInstance(thiz)) {
return clasz.cast(thiz);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists