diff options
Diffstat (limited to 'org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/InterfaceTypeImpl.java')
-rw-r--r-- | org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/InterfaceTypeImpl.java | 112 |
1 files changed, 65 insertions, 47 deletions
diff --git a/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/InterfaceTypeImpl.java b/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/InterfaceTypeImpl.java index ea59f9d12..ee2cf1cef 100644 --- a/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/InterfaceTypeImpl.java +++ b/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/InterfaceTypeImpl.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.jdi.internal; - import java.io.DataInputStream; import java.io.IOException; import java.util.ArrayList; @@ -26,75 +25,85 @@ import com.sun.jdi.InterfaceType; import com.sun.jdi.Value; /** - * this class implements the corresponding interfaces - * declared by the JDI specification. See the com.sun.jdi package - * for more information. - * + * this class implements the corresponding interfaces declared by the JDI + * specification. See the com.sun.jdi package for more information. + * */ -public class InterfaceTypeImpl extends ReferenceTypeImpl implements InterfaceType { +public class InterfaceTypeImpl extends ReferenceTypeImpl implements + InterfaceType { /** JDWP Tag. */ public static final byte typeTag = JdwpID.TYPE_TAG_INTERFACE; /** * Creates new InterfaceTypeImpl. */ - public InterfaceTypeImpl(VirtualMachineImpl vmImpl, JdwpInterfaceID interfaceID) { + public InterfaceTypeImpl(VirtualMachineImpl vmImpl, + JdwpInterfaceID interfaceID) { super("InterfaceType", vmImpl, interfaceID); //$NON-NLS-1$ } /** * Creates new InterfaceTypeImpl. */ - public InterfaceTypeImpl(VirtualMachineImpl vmImpl, JdwpInterfaceID interfaceID, String signature, String genericSignature) { + public InterfaceTypeImpl(VirtualMachineImpl vmImpl, + JdwpInterfaceID interfaceID, String signature, + String genericSignature) { super("InterfaceType", vmImpl, interfaceID, signature, genericSignature); //$NON-NLS-1$ } /** * @return Create a null value instance of the type. */ + @Override public Value createNullValue() { - return new ClassObjectReferenceImpl(virtualMachineImpl(), new JdwpClassObjectID(virtualMachineImpl())); + return new ClassObjectReferenceImpl(virtualMachineImpl(), + new JdwpClassObjectID(virtualMachineImpl())); } /** * @return Returns type tag. */ + @Override public byte typeTag() { return typeTag; } - + /** * Flushes all stored Jdwp results. */ + @Override public void flushStoredJdwpResults() { super.flushStoredJdwpResults(); - // For all reftypes that have this interface cached, this cache must be undone. - Iterator itr = virtualMachineImpl().allCachedRefTypes(); + // For all reftypes that have this interface cached, this cache must be + // undone. + Iterator<Object> itr = virtualMachineImpl().allCachedRefTypes(); while (itr.hasNext()) { - ReferenceTypeImpl refType = (ReferenceTypeImpl)itr.next(); - if (refType.fInterfaces != null && refType.fInterfaces.contains(this)) { + ReferenceTypeImpl refType = (ReferenceTypeImpl) itr.next(); + if (refType.fInterfaces != null + && refType.fInterfaces.contains(this)) { refType.flushStoredJdwpResults(); } } - + } - + /** - * @return Returns the currently prepared classes which directly implement this interface. + * @return Returns the currently prepared classes which directly implement + * this interface. */ - public List implementors() { + public List<ClassTypeImpl> implementors() { // Note that this information should not be cached. - List implementors = new ArrayList(); - Iterator itr = virtualMachineImpl().allRefTypes(); + List<ClassTypeImpl> implementors = new ArrayList<ClassTypeImpl>(); + Iterator<ReferenceTypeImpl> itr = virtualMachineImpl().allRefTypes(); while (itr.hasNext()) { - ReferenceTypeImpl refType = (ReferenceTypeImpl)itr.next(); + ReferenceTypeImpl refType = itr.next(); if (refType instanceof ClassTypeImpl) { try { - ClassTypeImpl classType = (ClassTypeImpl)refType; + ClassTypeImpl classType = (ClassTypeImpl) refType; List interfaces = classType.interfaces(); if (interfaces.contains(this)) { - implementors .add(classType); + implementors.add(classType); } } catch (ClassNotPreparedException e) { continue; @@ -103,19 +112,20 @@ public class InterfaceTypeImpl extends ReferenceTypeImpl implements InterfaceTyp } return implementors; } - + /** - * @return Returns the currently prepared interfaces which directly extend this interface. + * @return Returns the currently prepared interfaces which directly extend + * this interface. */ - public List subinterfaces() { + public List<InterfaceTypeImpl> subinterfaces() { // Note that this information should not be cached. - List implementors = new ArrayList(); - Iterator itr = virtualMachineImpl().allRefTypes(); + List<InterfaceTypeImpl> implementors = new ArrayList<InterfaceTypeImpl>(); + Iterator<ReferenceTypeImpl> itr = virtualMachineImpl().allRefTypes(); while (itr.hasNext()) { try { - ReferenceTypeImpl refType = (ReferenceTypeImpl)itr.next(); + ReferenceTypeImpl refType = itr.next(); if (refType instanceof InterfaceTypeImpl) { - InterfaceTypeImpl interFaceType = (InterfaceTypeImpl)refType; + InterfaceTypeImpl interFaceType = (InterfaceTypeImpl) refType; List interfaces = interFaceType.superinterfaces(); if (interfaces.contains(this)) { implementors.add(interFaceType); @@ -127,25 +137,28 @@ public class InterfaceTypeImpl extends ReferenceTypeImpl implements InterfaceTyp } return implementors; } - + /** - * @return Returns the interfaces directly extended by this interface. + * @return Returns the interfaces directly extended by this interface. */ public List superinterfaces() { return interfaces(); } - - /** + + /** * @return Returns true if this type has been initialized. */ + @Override public boolean isInitialized() { return isPrepared(); } /** - * @return Reads ID and returns known ReferenceTypeImpl with that ID, or if ID is unknown a newly created ReferenceTypeImpl. + * @return Reads ID and returns known ReferenceTypeImpl with that ID, or if + * ID is unknown a newly created ReferenceTypeImpl. */ - public static InterfaceTypeImpl read(MirrorImpl target, DataInputStream in) throws IOException { + public static InterfaceTypeImpl read(MirrorImpl target, DataInputStream in) + throws IOException { VirtualMachineImpl vmImpl = target.virtualMachineImpl(); JdwpInterfaceID ID = new JdwpInterfaceID(vmImpl); ID.read(in); @@ -156,19 +169,23 @@ public class InterfaceTypeImpl extends ReferenceTypeImpl implements InterfaceTyp if (ID.isNull()) { return null; } - - InterfaceTypeImpl mirror = (InterfaceTypeImpl)vmImpl.getCachedMirror(ID); + + InterfaceTypeImpl mirror = (InterfaceTypeImpl) vmImpl + .getCachedMirror(ID); if (mirror == null) { mirror = new InterfaceTypeImpl(vmImpl, ID); vmImpl.addCachedMirror(mirror); } return mirror; - } - + } + /** - * @return Reads ID and returns known ReferenceTypeImpl with that ID, or if ID is unknown a newly created ReferenceTypeImpl. + * @return Reads ID and returns known ReferenceTypeImpl with that ID, or if + * ID is unknown a newly created ReferenceTypeImpl. */ - public static InterfaceTypeImpl readWithSignature(MirrorImpl target, boolean withGenericSignature, DataInputStream in) throws IOException { + public static InterfaceTypeImpl readWithSignature(MirrorImpl target, + boolean withGenericSignature, DataInputStream in) + throws IOException { VirtualMachineImpl vmImpl = target.virtualMachineImpl(); JdwpInterfaceID ID = new JdwpInterfaceID(vmImpl); ID.read(in); @@ -177,15 +194,16 @@ public class InterfaceTypeImpl extends ReferenceTypeImpl implements InterfaceTyp } String signature = target.readString("signature", in); //$NON-NLS-1$ - String genericSignature= null; + String genericSignature = null; if (withGenericSignature) { - genericSignature= target.readString("generic signature", in); //$NON-NLS-1$ + genericSignature = target.readString("generic signature", in); //$NON-NLS-1$ } if (ID.isNull()) { return null; } - - InterfaceTypeImpl mirror = (InterfaceTypeImpl)vmImpl.getCachedMirror(ID); + + InterfaceTypeImpl mirror = (InterfaceTypeImpl) vmImpl + .getCachedMirror(ID); if (mirror == null) { mirror = new InterfaceTypeImpl(vmImpl, ID); vmImpl.addCachedMirror(mirror); @@ -193,5 +211,5 @@ public class InterfaceTypeImpl extends ReferenceTypeImpl implements InterfaceTyp mirror.setSignature(signature); mirror.setGenericSignature(genericSignature); return mirror; - } + } } |