|
114 | 114 | import org.graalvm.polyglot.io.IOAccess; |
115 | 115 | import org.graalvm.polyglot.io.MessageTransport; |
116 | 116 | import org.graalvm.polyglot.io.ProcessHandler; |
117 | | -import org.graalvm.polyglot.proxy.Proxy; |
118 | 117 | import org.graalvm.polyglot.proxy.ProxyArray; |
119 | 118 | import org.graalvm.polyglot.proxy.ProxyDate; |
120 | 119 | import org.graalvm.polyglot.proxy.ProxyDuration; |
@@ -943,21 +942,6 @@ static class APIAccessImpl extends AbstractPolyglotImpl.APIAccess { |
943 | 942 |
|
944 | 943 | private static final APIAccessImpl INSTANCE = new APIAccessImpl(); |
945 | 944 |
|
946 | | - private static final ProxyArray EMPTY = new ProxyArray() { |
947 | | - |
948 | | - public void set(long index, Value value) { |
949 | | - throw new ArrayIndexOutOfBoundsException(); |
950 | | - } |
951 | | - |
952 | | - public long getSize() { |
953 | | - return 0; |
954 | | - } |
955 | | - |
956 | | - public Object get(long index) { |
957 | | - throw new ArrayIndexOutOfBoundsException(); |
958 | | - } |
959 | | - }; |
960 | | - |
961 | 945 | APIAccessImpl() { |
962 | 946 | } |
963 | 947 |
|
@@ -1387,146 +1371,6 @@ public AbstractStackFrameImpl getStackFrameReceiver(Object value) { |
1387 | 1371 | return ((StackFrame) value).impl; |
1388 | 1372 | } |
1389 | 1373 |
|
1390 | | - @Override |
1391 | | - public boolean isProxyArray(Object proxy) { |
1392 | | - return proxy instanceof ProxyArray; |
1393 | | - } |
1394 | | - |
1395 | | - @Override |
1396 | | - public boolean isProxyDate(Object proxy) { |
1397 | | - return proxy instanceof ProxyDate; |
1398 | | - } |
1399 | | - |
1400 | | - @Override |
1401 | | - public boolean isProxyDuration(Object proxy) { |
1402 | | - return proxy instanceof ProxyDuration; |
1403 | | - } |
1404 | | - |
1405 | | - @Override |
1406 | | - public boolean isProxyExecutable(Object proxy) { |
1407 | | - return proxy instanceof ProxyExecutable; |
1408 | | - } |
1409 | | - |
1410 | | - @Override |
1411 | | - public boolean isProxyHashMap(Object proxy) { |
1412 | | - return proxy instanceof ProxyHashMap; |
1413 | | - } |
1414 | | - |
1415 | | - @Override |
1416 | | - public boolean isProxyInstant(Object proxy) { |
1417 | | - return proxy instanceof ProxyInstant; |
1418 | | - } |
1419 | | - |
1420 | | - @Override |
1421 | | - public boolean isProxyInstantiable(Object proxy) { |
1422 | | - return proxy instanceof ProxyInstantiable; |
1423 | | - } |
1424 | | - |
1425 | | - @Override |
1426 | | - public boolean isProxyIterable(Object proxy) { |
1427 | | - return proxy instanceof ProxyIterable; |
1428 | | - } |
1429 | | - |
1430 | | - @Override |
1431 | | - public boolean isProxyIterator(Object proxy) { |
1432 | | - return proxy instanceof ProxyIterator; |
1433 | | - } |
1434 | | - |
1435 | | - @Override |
1436 | | - public boolean isProxyNativeObject(Object proxy) { |
1437 | | - return proxy instanceof ProxyNativeObject; |
1438 | | - } |
1439 | | - |
1440 | | - @Override |
1441 | | - public boolean isProxyObject(Object proxy) { |
1442 | | - return proxy instanceof ProxyObject; |
1443 | | - } |
1444 | | - |
1445 | | - @Override |
1446 | | - public boolean isProxyTime(Object proxy) { |
1447 | | - return proxy instanceof ProxyTime; |
1448 | | - } |
1449 | | - |
1450 | | - @Override |
1451 | | - public boolean isProxyTimeZone(Object proxy) { |
1452 | | - return proxy instanceof ProxyTimeZone; |
1453 | | - } |
1454 | | - |
1455 | | - @Override |
1456 | | - public boolean isProxy(Object proxy) { |
1457 | | - return proxy instanceof Proxy; |
1458 | | - } |
1459 | | - |
1460 | | - @Override |
1461 | | - public Class<?> getProxyArrayClass() { |
1462 | | - return ProxyArray.class; |
1463 | | - } |
1464 | | - |
1465 | | - @Override |
1466 | | - public Class<?> getProxyDateClass() { |
1467 | | - return ProxyDate.class; |
1468 | | - } |
1469 | | - |
1470 | | - @Override |
1471 | | - public Class<?> getProxyDurationClass() { |
1472 | | - return ProxyDuration.class; |
1473 | | - } |
1474 | | - |
1475 | | - @Override |
1476 | | - public Class<?> getProxyExecutableClass() { |
1477 | | - return ProxyExecutable.class; |
1478 | | - } |
1479 | | - |
1480 | | - @Override |
1481 | | - public Class<?> getProxyHashMapClass() { |
1482 | | - return ProxyHashMap.class; |
1483 | | - } |
1484 | | - |
1485 | | - @Override |
1486 | | - public Class<?> getProxyInstantClass() { |
1487 | | - return ProxyInstant.class; |
1488 | | - } |
1489 | | - |
1490 | | - @Override |
1491 | | - public Class<?> getProxyInstantiableClass() { |
1492 | | - return ProxyInstantiable.class; |
1493 | | - } |
1494 | | - |
1495 | | - @Override |
1496 | | - public Class<?> getProxyIterableClass() { |
1497 | | - return ProxyIterable.class; |
1498 | | - } |
1499 | | - |
1500 | | - @Override |
1501 | | - public Class<?> getProxyIteratorClass() { |
1502 | | - return ProxyIterator.class; |
1503 | | - } |
1504 | | - |
1505 | | - @Override |
1506 | | - public Class<?> getProxyNativeObjectClass() { |
1507 | | - return ProxyNativeObject.class; |
1508 | | - } |
1509 | | - |
1510 | | - @Override |
1511 | | - public Class<?> getProxyObjectClass() { |
1512 | | - return ProxyObject.class; |
1513 | | - } |
1514 | | - |
1515 | | - @Override |
1516 | | - public Class<?> getProxyTimeClass() { |
1517 | | - return ProxyTime.class; |
1518 | | - } |
1519 | | - |
1520 | | - @Override |
1521 | | - public Class<?> getProxyTimeZoneClass() { |
1522 | | - return ProxyTimeZone.class; |
1523 | | - } |
1524 | | - |
1525 | | - @Override |
1526 | | - public Class<?> getProxyClass() { |
1527 | | - return Proxy.class; |
1528 | | - } |
1529 | | - |
1530 | 1374 | @Override |
1531 | 1375 | public Object callProxyExecutableExecute(Object proxy, Object[] objects) { |
1532 | 1376 | return ((ProxyExecutable) proxy).execute((Value[]) objects); |
@@ -1562,11 +1406,26 @@ public Object callProxyArraySize(Object proxy) { |
1562 | 1406 | return ((ProxyArray) proxy).getSize(); |
1563 | 1407 | } |
1564 | 1408 |
|
| 1409 | + private static final ProxyArray EMPTY_PROXY_ARRAY = new ProxyArray() { |
| 1410 | + |
| 1411 | + public void set(long index, Value value) { |
| 1412 | + throw new ArrayIndexOutOfBoundsException(); |
| 1413 | + } |
| 1414 | + |
| 1415 | + public long getSize() { |
| 1416 | + return 0; |
| 1417 | + } |
| 1418 | + |
| 1419 | + public Object get(long index) { |
| 1420 | + throw new ArrayIndexOutOfBoundsException(); |
| 1421 | + } |
| 1422 | + }; |
| 1423 | + |
1565 | 1424 | @Override |
1566 | 1425 | public Object callProxyObjectMemberKeys(Object proxy) { |
1567 | 1426 | Object result = ((ProxyObject) proxy).getMemberKeys(); |
1568 | 1427 | if (result == null) { |
1569 | | - result = EMPTY; |
| 1428 | + result = EMPTY_PROXY_ARRAY; |
1570 | 1429 | } |
1571 | 1430 | return result; |
1572 | 1431 | } |
|
0 commit comments