diff options
author | Noel Grandin <noel@peralex.com> | 2016-06-06 14:21:20 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-06-07 08:49:31 +0000 |
commit | 970b0ebb67d4033d70795e586a26c7a695c14194 (patch) | |
tree | 3ef0fa7f436539415055089188ad2f028f24cbaa /jurt | |
parent | f30aa6e51f7fe2fd3da47629de5a0dc13706e866 (diff) |
[API CHANGE] Drop deprecated I*Description interfaces
And make the fields of com.sun.star.uno.Type private
Change-Id: Ied7698b4157460e9726f271092c92b6b382239fd
Reviewed-on: https://gerrit.libreoffice.org/25971
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'jurt')
7 files changed, 54 insertions, 59 deletions
diff --git a/jurt/com/sun/star/lib/uno/environments/remote/Job.java b/jurt/com/sun/star/lib/uno/environments/remote/Job.java index f65ffff98ff0..8ec4492c4c01 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/Job.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/Job.java @@ -27,7 +27,6 @@ import java.lang.reflect.InvocationTargetException; import com.sun.star.lib.uno.typedesc.MethodDescription; import com.sun.star.uno.Any; -import com.sun.star.uno.IMethodDescription; import com.sun.star.uno.Type; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XCurrentContext; @@ -79,7 +78,7 @@ public class Job { if (_iMessage.isRequest()) { Object result = null; Throwable exception = null; - IMethodDescription md = _iMessage.getMethod(); + MethodDescription md = _iMessage.getMethod(); Object[] args = _iMessage.getArguments(); XCurrentContext oldCC = UnoRuntime.getCurrentContext(); UnoRuntime.setCurrentContext(_iMessage.getCurrentContext()); diff --git a/jurt/com/sun/star/lib/uno/environments/remote/Message.java b/jurt/com/sun/star/lib/uno/environments/remote/Message.java index 4a6921b080f2..b34295ae33be 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/Message.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/Message.java @@ -19,8 +19,8 @@ package com.sun.star.lib.uno.environments.remote; -import com.sun.star.uno.IMethodDescription; -import com.sun.star.uno.ITypeDescription; +import com.sun.star.lib.uno.typedesc.MethodDescription; +import com.sun.star.lib.uno.typedesc.TypeDescription; import com.sun.star.uno.XCurrentContext; /** @@ -29,7 +29,7 @@ import com.sun.star.uno.XCurrentContext; public class Message { public Message( ThreadId threadId, boolean request, String objectId, - ITypeDescription type, IMethodDescription method, boolean synchronous, + TypeDescription type, MethodDescription method, boolean synchronous, XCurrentContext currentContext, boolean abnormalTermination, Object result, Object[] arguments) { @@ -87,7 +87,7 @@ public class Message { * @return the (non-<code>null</code>) type for a request, <code>null</code> * for a reply. */ - public final ITypeDescription getType() { + public final TypeDescription getType() { return type; } @@ -95,13 +95,13 @@ public class Message { * Returns the method description of a request message. * * <p>Valid only for request messages. The returned - * <code>IMethodDescription</code> is consistent with the type of the + * <code>MethodDescription</code> is consistent with the type of the * message.</p> * * @return the (non-<code>null</code>) method description for a request, * <code>null</code> for a reply. */ - public final IMethodDescription getMethod() { + public final MethodDescription getMethod() { return method; } @@ -177,8 +177,8 @@ public class Message { private final ThreadId threadId; private final boolean request; private final String objectId; - private final ITypeDescription type; - private final IMethodDescription method; + private final TypeDescription type; + private final MethodDescription method; private final boolean synchronous; private final XCurrentContext currentContext; private final boolean abnormalTermination; diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/Marshal.java b/jurt/com/sun/star/lib/uno/protocols/urp/Marshal.java index b7425d80f590..106a8736cb31 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/Marshal.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/Marshal.java @@ -18,23 +18,23 @@ */ package com.sun.star.lib.uno.protocols.urp; +import java.io.ByteArrayOutputStream; +import java.io.DataOutput; +import java.io.DataOutputStream; +import java.io.IOException; +import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; + import com.sun.star.lib.uno.environments.remote.ThreadId; +import com.sun.star.lib.uno.typedesc.FieldDescription; import com.sun.star.lib.uno.typedesc.TypeDescription; import com.sun.star.uno.Any; import com.sun.star.uno.Enum; import com.sun.star.uno.IBridge; -import com.sun.star.uno.IFieldDescription; import com.sun.star.uno.Type; import com.sun.star.uno.TypeClass; import com.sun.star.uno.XInterface; -import java.io.ByteArrayOutputStream; -import java.io.DataOutput; -import java.io.DataOutputStream; -import java.io.IOException; -import java.lang.reflect.Array; -import java.lang.reflect.InvocationTargetException; - final class Marshal { public Marshal(IBridge bridge, short cacheSize) { this.bridge = bridge; @@ -281,7 +281,7 @@ final class Marshal { if (value == null) { writeCompressedNumber(0); } else { - TypeDescription ctype = (TypeDescription) type.getComponentType(); + TypeDescription ctype = type.getComponentType(); if (ctype.getTypeClass() == TypeClass.BYTE) { byte[] data = (byte[]) value; writeCompressedNumber(data.length); @@ -310,10 +310,10 @@ final class Marshal { } private void writeStructValue(TypeDescription type, Object value) throws IllegalAccessException { - IFieldDescription[] fields = type.getFieldDescriptions(); + FieldDescription[] fields = type.getFieldDescriptions(); for (int i = 0; i < fields.length; ++i) { writeValue( - (TypeDescription) fields[i].getTypeDescription(), + fields[i].getTypeDescription(), value == null ? null : fields[i].getField().get(value)); } } diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/PendingRequests.java b/jurt/com/sun/star/lib/uno/protocols/urp/PendingRequests.java index 9dca51cbe885..928cdcd63176 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/PendingRequests.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/PendingRequests.java @@ -19,11 +19,12 @@ package com.sun.star.lib.uno.protocols.urp; -import com.sun.star.lib.uno.environments.remote.ThreadId; -import com.sun.star.uno.IMethodDescription; import java.util.HashMap; import java.util.Stack; +import com.sun.star.lib.uno.environments.remote.ThreadId; +import com.sun.star.lib.uno.typedesc.MethodDescription; + final class PendingRequests { public synchronized void push(ThreadId tid, Item item) { @@ -46,7 +47,7 @@ final class PendingRequests { public static final class Item { public Item( - boolean internal, IMethodDescription function, Object[] arguments) + boolean internal, MethodDescription function, Object[] arguments) { this.internal = internal; this.function = function; @@ -54,7 +55,7 @@ final class PendingRequests { } public final boolean internal; - public final IMethodDescription function; + public final MethodDescription function; public final Object[] arguments; } diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java b/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java index 2aa97d9242b6..c16d19291356 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java @@ -30,10 +30,10 @@ import com.sun.star.lib.uno.typedesc.TypeDescription; import com.sun.star.uno.Any; import com.sun.star.uno.Enum; import com.sun.star.uno.IBridge; -import com.sun.star.uno.IFieldDescription; import com.sun.star.uno.Type; import com.sun.star.uno.TypeClass; import com.sun.star.uno.XInterface; +import com.sun.star.lib.uno.typedesc.FieldDescription; final class Unmarshal { public Unmarshal(IBridge bridge, int cacheSize) { @@ -329,10 +329,9 @@ final class Unmarshal { case TypeClass.SEQUENCE_value: { Object value = readSequenceValue(type); - TypeDescription ctype = (TypeDescription) - type.getComponentType(); + TypeDescription ctype = type.getComponentType(); while (ctype.getTypeClass() == TypeClass.SEQUENCE) { - ctype = (TypeDescription) ctype.getComponentType(); + ctype = ctype.getComponentType(); } switch (ctype.getTypeClass().getValue()) { case TypeClass.UNSIGNED_SHORT_value: @@ -377,7 +376,7 @@ final class Unmarshal { private Object readSequenceValue(TypeDescription type) throws IOException { int len = readCompressedNumber(); - TypeDescription ctype = (TypeDescription) type.getComponentType(); + TypeDescription ctype = type.getComponentType(); if (ctype.getTypeClass() == TypeClass.BYTE) { byte[] data = new byte[len]; readBytes(data); @@ -454,13 +453,13 @@ final class Unmarshal { } private void readFields(TypeDescription type, Object value) { - IFieldDescription[] fields = type.getFieldDescriptions(); + FieldDescription[] fields = type.getFieldDescriptions(); for (int i = 0; i < fields.length; ++i) { try { fields[i].getField().set( value, readValue( - (TypeDescription) fields[i].getTypeDescription())); + fields[i].getTypeDescription())); } catch (IllegalAccessException e) { throw new RuntimeException(e); } diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/UrpMessage.java b/jurt/com/sun/star/lib/uno/protocols/urp/UrpMessage.java index 5b4f2fd1e55f..34cdf7073902 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/UrpMessage.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/UrpMessage.java @@ -21,14 +21,14 @@ package com.sun.star.lib.uno.protocols.urp; import com.sun.star.lib.uno.environments.remote.Message; import com.sun.star.lib.uno.environments.remote.ThreadId; -import com.sun.star.uno.IMethodDescription; -import com.sun.star.uno.ITypeDescription; +import com.sun.star.lib.uno.typedesc.MethodDescription; +import com.sun.star.lib.uno.typedesc.TypeDescription; import com.sun.star.uno.XCurrentContext; final class UrpMessage extends Message { public UrpMessage( ThreadId threadId, boolean request, String objectId, - ITypeDescription type, IMethodDescription method, boolean synchronous, + TypeDescription type, MethodDescription method, boolean synchronous, XCurrentContext currentContext, boolean abnormalTermination, Object result, Object[] arguments, boolean internal) { diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/urp.java b/jurt/com/sun/star/lib/uno/protocols/urp/urp.java index 7a87306a577e..0ce9d35be75f 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/urp.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/urp.java @@ -30,8 +30,6 @@ import com.sun.star.lib.uno.typedesc.MethodDescription; import com.sun.star.lib.uno.typedesc.TypeDescription; import com.sun.star.uno.Any; import com.sun.star.uno.IBridge; -import com.sun.star.uno.IMethodDescription; -import com.sun.star.uno.ITypeDescription; import com.sun.star.uno.Type; import com.sun.star.uno.TypeClass; import com.sun.star.uno.UnoRuntime; @@ -159,7 +157,7 @@ public final class urp implements IProtocol { int header = HEADER_LONGHEADER; PendingRequests.Item pending = pendingIn.pop(tid); TypeDescription resultType; - ITypeDescription[] argTypes; + TypeDescription[] argTypes; Object[] args; if (exception) { header |= HEADER_EXCEPTION; @@ -167,8 +165,7 @@ public final class urp implements IProtocol { argTypes = null; args = null; } else { - resultType = (TypeDescription) - pending.function.getReturnSignature(); + resultType = pending.function.getReturnSignature(); argTypes = pending.function.getOutSignature(); args = pending.arguments; } @@ -187,7 +184,7 @@ public final class urp implements IProtocol { for (int i = 0; i < argTypes.length; ++i) { if (argTypes[i] != null) { marshal.writeValue( - (TypeDescription) argTypes[i].getComponentType(), + argTypes[i].getComponentType(), Array.get(args[i], 0)); } } @@ -417,13 +414,13 @@ public final class urp implements IProtocol { ? (XCurrentContext) unmarshal.readInterface( new Type(XCurrentContext.class)) : null; - IMethodDescription desc = inL1Type.getMethodDescription(functionId); + MethodDescription desc = inL1Type.getMethodDescription(functionId); if (desc == null) { throw new IOException( "read URP request with unsupported function ID " + functionId); } - ITypeDescription[] inSig = desc.getInSignature(); - ITypeDescription[] outSig = desc.getOutSignature(); + TypeDescription[] inSig = desc.getInSignature(); + TypeDescription[] outSig = desc.getOutSignature(); Object[] args = new Object[inSig.length]; for (int i = 0; i < args.length; ++i) { if (inSig[i] != null) { @@ -433,10 +430,10 @@ public final class urp implements IProtocol { Array.set( inout, 0, unmarshal.readValue( - (TypeDescription) outSig[i].getComponentType())); + outSig[i].getComponentType())); args[i] = inout; } else { - args[i] = unmarshal.readValue((TypeDescription) inSig[i]); + args[i] = unmarshal.readValue(inSig[i]); } } else { args[i] = Array.newInstance( @@ -459,7 +456,7 @@ public final class urp implements IProtocol { } PendingRequests.Item pending = pendingOut.pop(inL1Tid); TypeDescription resultType; - ITypeDescription[] argTypes; + TypeDescription[] argTypes; Object[] args; boolean exception = (header & HEADER_EXCEPTION) != 0; if (exception) { @@ -467,8 +464,7 @@ public final class urp implements IProtocol { argTypes = null; args = null; } else { - resultType = (TypeDescription) - pending.function.getReturnSignature(); + resultType = pending.function.getReturnSignature(); argTypes = pending.function.getOutSignature(); args = pending.arguments; } @@ -480,7 +476,7 @@ public final class urp implements IProtocol { Array.set( args[i], 0, unmarshal.readValue( - (TypeDescription) argTypes[i].getComponentType())); + argTypes[i].getComponentType())); } } } @@ -494,7 +490,7 @@ public final class urp implements IProtocol { ThreadId tid, Object[] arguments) throws IOException { - IMethodDescription desc = type.getMethodDescription(function); + MethodDescription desc = type.getMethodDescription(function); synchronized (output) { if (desc.getIndex() == MethodDescription.ID_RELEASE && releaseQueue.size() < MAX_RELEASE_QUEUE_SIZE) @@ -512,7 +508,7 @@ public final class urp implements IProtocol { private boolean writeRequest( boolean internal, String oid, TypeDescription type, - IMethodDescription desc, ThreadId tid, Object[] arguments, + MethodDescription desc, ThreadId tid, Object[] arguments, boolean flush) throws IOException { @@ -589,17 +585,17 @@ public final class urp implements IProtocol { UnoRuntime.getCurrentContext(), new Type(XCurrentContext.class)); } - ITypeDescription[] inSig = desc.getInSignature(); - ITypeDescription[] outSig = desc.getOutSignature(); + TypeDescription[] inSig = desc.getInSignature(); + TypeDescription[] outSig = desc.getOutSignature(); for (int i = 0; i < inSig.length; ++i) { if (inSig[i] != null) { if (outSig[i] != null) { marshal.writeValue( - (TypeDescription) outSig[i].getComponentType(), + outSig[i].getComponentType(), ((Object[]) arguments[i])[0]); } else { marshal.writeValue( - (TypeDescription) inSig[i], arguments[i]); + inSig[i], arguments[i]); } } } @@ -679,7 +675,7 @@ public final class urp implements IProtocol { private static final class QueuedRelease { public QueuedRelease( boolean internal, String objectId, TypeDescription type, - IMethodDescription method, ThreadId threadId) + MethodDescription method, ThreadId threadId) { this.internal = internal; this.objectId = objectId; @@ -691,7 +687,7 @@ public final class urp implements IProtocol { public final boolean internal; public final String objectId; public final TypeDescription type; - public final IMethodDescription method; + public final MethodDescription method; public final ThreadId threadId; } @@ -756,7 +752,7 @@ public final class urp implements IProtocol { private ThreadId outL1Tid = null; private String outL1Oid = null; - private ITypeDescription outL1Type = null; + private TypeDescription outL1Type = null; private final ArrayList<QueuedRelease> releaseQueue = new ArrayList<QueuedRelease>(); // of QueuedRelease } |