1 11 package org.eclipse.jdt.internal.debug.eval.ast.engine; 12 13 import java.util.ArrayList ; 14 15 import org.eclipse.jdt.core.Signature; 16 import org.eclipse.jdt.core.compiler.CharOperation; 17 import org.eclipse.jdt.internal.core.util.Util; 18 19 public class SignatureExt { 20 21 public static char[][] getTypeSuperClassInterfaces(char[] typeSignature) throws IllegalArgumentException { 22 try { 23 int length = typeSignature.length; 24 if (length == 0) return CharOperation.NO_CHAR_CHAR; 25 int i = 0; 26 if (typeSignature[0] == Signature.C_GENERIC_START) { 27 i++; while (i < length && typeSignature[i] != Signature.C_GENERIC_END) { 29 i = CharOperation.indexOf(Signature.C_COLON, typeSignature, i); 30 if (i < 0 || i >= length) throw new IllegalArgumentException (); 31 nextBound: while (typeSignature[i] == ':') { 33 i++; if (typeSignature[i] == ':') { 35 continue nextBound; } 37 i = Util.scanTypeSignature(typeSignature, i); 38 i++; } 40 } 41 if (i < 0 || i >= length) throw new IllegalArgumentException (); 42 i++; } 44 ArrayList superList= new ArrayList (); 45 while (i < length) { 46 int superStart= i; 47 i= Util.scanTypeSignature(typeSignature, i); 48 i++; 49 superList.add(CharOperation.subarray(typeSignature, superStart, i)); 50 } 51 char[][] result; 52 superList.toArray(result = new char[superList.size()][]); 53 return result; 54 } catch (ArrayIndexOutOfBoundsException e) { 55 } 57 throw new IllegalArgumentException (); 58 } 59 60 public static String [] getTypeSuperClassInterfaces(String typeSignature) throws IllegalArgumentException { 61 char[][] params = getTypeSuperClassInterfaces(typeSignature.toCharArray()); 62 return CharOperation.toStrings(params); 63 } 64 } 65 | Popular Tags |