Class Util
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.util.Util
Provides convenient utility methods to other types in this package.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
static interface
-
Method Summary
Modifier and TypeMethodDescriptionstatic final String[]
arrayConcat
(String[] first, String second) Returns a new array adding the second array at the end of first array.static int
combineHashCodes
(int hashCode1, int hashCode2) Combines two hash codes to make a new one.static int
compare
(byte[] a, byte[] b) Compares two byte arrays.static int
compare
(char[] str1, char[] str2) Compares two strings lexicographically.static final char[]
concat
(char[] first, char[] second) static char[]
concatCompoundNameToCharArray
(String[] compoundName) Concatenate a String[] compound name to a continuous char[].static String
concatenateName
(String name1, String name2, char separator) static final String
concatWith
(String[] array, char separator) Returns the concatenation of the given array parts using the given separator between each part.static final String
concatWith
(String[] array, String name, char separator) Returns the concatenation of the given array parts using the given separator between each part and appending the given name at the end.static String
convertTypeSignature
(char[] sig, int start, int length) Converts a type signature from the IBinaryType representation to the DC representation.static String
static final String
editedString
(String original, org.eclipse.text.edits.TextEdit edit) Apply the given edit on the given string and return the updated string.static final boolean
endsWithIgnoreCase
(String str, String end) Returns true iff str.toLowerCase().endsWith(end.toLowerCase()) implementation is not creating extra strings.static boolean
equalArrays
(Object[] a, Object[] b, int len) Compares two arrays using equals() on the elements.static boolean
equalArraysOrNull
(int[] a, int[] b) Compares two arrays using equals() on the elements.static boolean
equalArraysOrNull
(Object[] a, Object[] b) Compares two arrays using equals() on the elements.static boolean
equalArraysOrNullSortFirst
(String[] a, String[] b) Compares two String arrays using equals() on the elements.static boolean
Compares two arrays using equals() on the elements.static boolean
equalOrNull
(Object a, Object b) Compares two objects using equals().static boolean
equalsIgnoreJavaLikeExtension
(String fileName, String string) static String
extractLastName
(String qualifiedName) Given a qualified name, extract the last component.static String[]
extractParameterTypes
(char[] sig) Extracts the parameter types from a method signature.static String
extractReturnType
(String sig) Extracts the return type from a method signature.static String
findLineSeparator
(char[] text) Finds the first line separator used by the given text.static IMethod
findMethod
(IType type, char[] selector, String[] paramTypeSignatures, boolean isConstructor) Finds the IMethod element corresponding to the given selector, without creating a new dummy instance of a binary method.static void
fixTaskTags
(Map defaultOptionsMap) static final char[][][]
getAllTypeArguments
(char[][] typeSignatures) Get all type arguments from an array of signatures.static IAnnotation
getAnnotation
(JavaElement parent, IBinaryAnnotation binaryAnnotation, String memberValuePairName) static Object
getAnnotationMemberValue
(JavaElement parent, MemberValuePair memberValuePair, Object binaryValue) static Object
getAnnotationMemberValue
(MemberValuePair memberValuePair, Constant constant) static IClassFileAttribute
getAttribute
(IClassFileReader classFileReader, char[] attributeName) static IClassFileAttribute
getAttribute
(ICodeAttribute codeAttribute, char[] attributeName) static IClassFileAttribute
getAttribute
(IComponentInfo componentInfo, char[] attributeName) static IClassFileAttribute
getAttribute
(IFieldInfo fieldInfo, char[] attributeName) static IClassFileAttribute
getAttribute
(IMethodInfo methodInfo, char[] attributeName) static String
static char[][]
Returns the registered Java like extensions.static long
getJdkLevel
(Object targetLibrary) Get the jdk level of this root.static String
getLineSeparator
(String text, IJavaProject project) Returns the line separator found in the given text.static String
getNameWithoutJavaLikeExtension
(String fileName) Returns the substring of the given file name, ending at the start of a Java like extension.static Object
getNegativeAnnotationMemberValue
(MemberValuePair memberValuePair, Constant constant) static IPackageFragment
getPackageFragment
(char[] fileName, int pkgEnd, int jarSeparator) static int
getParameterCount
(char[] sig) Returns the number of parameter types in a method signature.static String
getProblemArgumentsForMarker
(String[] arguments) Put all the arguments in one String.static String[]
getProblemArgumentsFromMarker
(String argumentsString) Separate all the arguments of a String made by getProblemArgumentsForMarkerstatic byte[]
getResourceContentsAsByteArray
(org.eclipse.core.resources.IFile file) Returns the given file's contents as a byte array.static char[]
getResourceContentsAsCharArray
(org.eclipse.core.resources.IFile file) Returns the given file's contents as a character array.static char[]
getResourceContentsAsCharArray
(org.eclipse.core.resources.IFile file, String encoding) static String
getSignature
(Type type) static String
getSourceAttachmentProperty
(org.eclipse.core.runtime.IPath path) static String[]
getTrimmedSimpleNames
(String name) Returns a trimmed version the simples names returned by Signature.static JavaElement
getUnresolvedJavaElement
(int localSourceStart, int localSourceEnd, JavaElement type) Returns the IInitializer that contains the given local variable in the given typestatic JavaElement
getUnresolvedJavaElement
(FieldBinding binding, WorkingCopyOwner workingCopyOwner, Util.BindingsToNodesMap bindingsToNodes) Return the java element corresponding to the given compiler binding.static JavaElement
getUnresolvedJavaElement
(MethodBinding methodBinding, WorkingCopyOwner workingCopyOwner, Util.BindingsToNodesMap bindingsToNodes) Return the java element corresponding to the given compiler binding.static JavaElement
getUnresolvedJavaElement
(RecordComponentBinding binding, WorkingCopyOwner workingCopyOwner, Util.BindingsToNodesMap bindingsToNodes) Return the java element corresponding to the given compiler binding.static JavaElement
getUnresolvedJavaElement
(TypeBinding typeBinding, WorkingCopyOwner workingCopyOwner, Util.BindingsToNodesMap bindingsToNodes) Return the java element corresponding to the given compiler binding.static int
indexOfEnclosingPath
(org.eclipse.core.runtime.IPath checkedPath, org.eclipse.core.runtime.IPath[] paths, int pathCount) static int
indexOfJavaLikeExtension
(String fileName) static int
indexOfMatchingPath
(org.eclipse.core.runtime.IPath checkedPath, org.eclipse.core.runtime.IPath[] paths, int pathCount) static int
indexOfNestedPath
(org.eclipse.core.runtime.IPath checkedPath, org.eclipse.core.runtime.IPath[] paths, int pathCount) protected static boolean
isAttributeSupported
(int attribute) Returns whether the local file system supports accessing and modifying the given attribute.static final boolean
isExcluded
(IJavaElement element) static final boolean
isExcluded
(org.eclipse.core.resources.IResource resource, char[][] inclusionPatterns, char[][] exclusionPatterns) static final boolean
isExcluded
(org.eclipse.core.runtime.IPath resourcePath, char[][] inclusionPatterns, char[][] exclusionPatterns, boolean isFolderPath) static final boolean
isJavaLikeFileName
(char[] fileName) Returns true if the given name ends with one of the known java like extension.static final boolean
isJavaLikeFileName
(String name) Returns true if the given name ends with one of the known java like extension.static boolean
isReadOnly
(org.eclipse.core.resources.IResource resource) Returns whether the given resource is read-only or not.static boolean
Returns whether the local file system supports accessing and modifying the read only flag.static boolean
isValidClassFileName
(String name, String sourceLevel, String complianceLevel) Validate the given .class file name.static boolean
isValidCompilationUnitName
(String name, String sourceLevel, String complianceLevel) Validate the given compilation unit name.static boolean
isValidFolderNameForPackage
(String folderName, String sourceLevel, String complianceLevel) Returns true if the given folder name is valid for a package, false if it is not.static boolean
Returns true if the given method signature is valid, false if it is not.static boolean
isValidTypeSignature
(String sig, boolean allowVoid) Returns true if the given type signature is valid, false if it is not.static String
localTypeName
(String binaryTypeName, int lastDollar, int end) static void
static void
static void
static void
log
(org.eclipse.core.runtime.IStatus status) static void
logRepeatedMessage
(String key, int statusErrorID, String message) static void
logRepeatedMessage
(String key, Exception e) Log a message that is potentially repeated in the same session.static ClassFileReader
newClassFileReader
(org.eclipse.core.resources.IResource resource) static char[]
normalizeCRs
(char[] text, char[] buffer) Normalizes the cariage returns in the given text.static String
normalizeCRs
(String text, String buffer) Normalizes the carriage returns in the given text.static String
packageName
(org.eclipse.core.runtime.IPath pkgPath, String sourceLevel, String complianceLevel) Converts the given relative path into a package name.static int
prefixLength
(char[] s1, char[] s2) Returns the length of the common prefix between s1 and s2.static int
prefixLength
(String s1, String s2) Returns the length of the common prefix between s1 and s2.static String
relativePath
(org.eclipse.core.runtime.IPath fullPath, int skipSegmentCount) Returns the toString() of the given full path minus the first given number of segments.static void
static int
scanTypeSignature
(char[] string, int start) Scans the given string for a type signature starting at the given index and returns the index of the last character.static void
setReadOnly
(org.eclipse.core.resources.IResource resource, boolean readOnly) Sets or unsets the given resource as read-only in the file system.static void
setSourceAttachmentProperty
(org.eclipse.core.runtime.IPath path, String property) static void
sort
(char[][] list) static void
sort
(int[] list) static void
sort
(Object[] objects, Util.Comparer comparer) Sorts an array of objects in place.static void
Sorts an array of strings in place using quicksort.static void
sort
(Util.Comparable[] objects) Sorts an array of Comparable objects in place.static Object[]
sortCopy
(Object[] objects, Util.Comparer comparer) Sorts an array of Strings, returning a new array with the sorted items.static String[]
Sorts an array of Strings, returning a new array with the sorted items.static IJavaElement[]
sortCopy
(IJavaElement[] elements) Sorts an array of Java elements based on their toStringWithAncestors(), returning a new array with the sorted items.static Util.Comparable[]
sortCopy
(Util.Comparable[] objects) Sorts an array of Comparable objects, returning a new array with the sorted items.static final String[]
Return a new array which is the split of the given string using the given divider.static final char[][]
splitTypeLevelsSignature
(String typeSignature) Split signatures of all levels from a type unique key.static boolean
startsWithIgnoreCase
(String[] compoundName, String[] prefix, boolean partialMatch) static char[]
toAnchor
(int startingIndex, char[] methodSignature, char[] methodName, boolean isVargArgs) static String
static char[][]
toCharArrays
(String[] a) Converts a String[] to char[][].static char[][]
Converts a String to char[][], where segments are separate by '.'.static File
toLocalFile
(URI uri, org.eclipse.core.runtime.IProgressMonitor monitor) static String
toString
(char[][] c) Converts a char[][] to String, where segments are separated by '.'.static String
toString
(char[][] c, char[] d) Converts a char[][] and a char[] to String, where segments are separated by '.'.static String
toString
(char[] declaringClass, char[] methodName, char[] methodSignature, boolean includeReturnType, boolean compact) static String[]
toStrings
(char[][] a) static String[]
static String
typeSignature
(TypeReference type) static void
Asserts that the given method signature is valid.static void
validateTypeSignature
(String sig, boolean allowVoid) Asserts that the given type signature is valid.
-
Method Details
-
arrayConcat
Returns a new array adding the second array at the end of first array. It answers null if the first and second are null. If the first array is null or if it is empty, then a new array is created with second. If the second array is null, then the first array is returned.
For example:first = null second = "a" => result = {"a"}
first = {"a"} second = null => result = {"a"}
first = {"a"} second = {"b"} => result = {"a", "b"}
- Parameters:
first
- the first array to concatenatesecond
- the array to add at the end of the first array- Returns:
- a new array adding the second array at the end of first array, or null if the two arrays are null.
-
combineHashCodes
public static int combineHashCodes(int hashCode1, int hashCode2) Combines two hash codes to make a new one. -
compare
public static int compare(byte[] a, byte[] b) Compares two byte arrays. Returns invalid input: '<'0 if a byte in a is less than the corresponding byte in b, or if a is shorter, or if a is null. Returns >0 if a byte in a is greater than the corresponding byte in b, or if a is longer, or if b is null. Returns 0 if they are equal or both null. -
compare
public static int compare(char[] str1, char[] str2) Compares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings.- Returns:
- the value
0
if the str1 is equal to str2; a value less than0
if str1 is lexicographically less than str2; and a value greater than0
if str1 is lexicographically greater than str2.
-
concatCompoundNameToCharArray
Concatenate a String[] compound name to a continuous char[]. -
concatenateName
-
concatWith
Returns the concatenation of the given array parts using the given separator between each part.
For example:
array = {"a", "b"} separator = '.' => result = "a.b"
array = {} separator = '.' => result = ""
- Parameters:
array
- the given arrayseparator
- the given separator- Returns:
- the concatenation of the given array parts using the given separator between each part
-
concatWith
Returns the concatenation of the given array parts using the given separator between each part and appending the given name at the end.
For example:
name = "c" array = { "a", "b" } separator = '.' => result = "a.b.c"
name = null array = { "a", "b" } separator = '.' => result = "a.b"
name = " c" array = null separator = '.' => result = "c"
- Parameters:
array
- the given arrayname
- the given nameseparator
- the given separator- Returns:
- the concatenation of the given array parts using the given separator between each part and appending the given name at the end
-
concat
public static final char[] concat(char[] first, char[] second) -
convertTypeSignature
Converts a type signature from the IBinaryType representation to the DC representation. -
defaultJavaExtension
-
editedString
Apply the given edit on the given string and return the updated string. Return the given string if anything wrong happen while applying the edit.- Parameters:
original
- the given stringedit
- the given edit- Returns:
- the updated string
-
endsWithIgnoreCase
Returns true iff str.toLowerCase().endsWith(end.toLowerCase()) implementation is not creating extra strings. -
equalArrays
Compares two arrays using equals() on the elements. Neither can be null. Only the first len elements are compared. Return false if either array is shorter than len. -
equalArraysOrNull
public static boolean equalArraysOrNull(int[] a, int[] b) Compares two arrays using equals() on the elements. Either or both arrays may be null. Returns true if both are null. Returns false if only one is null. If both are arrays, returns true iff they have the same length and all elements are equal. -
equalArraysOrNull
Compares two arrays using equals() on the elements. Either or both arrays may be null. Returns true if both are null. Returns false if only one is null. If both are arrays, returns true iff they have the same length and all elements compare true with equals. -
equalArraysOrNullSortFirst
Compares two arrays using equals() on the elements. The arrays are first sorted. Either or both arrays may be null. Returns true if both are null. Returns false if only one is null. If both are arrays, returns true iff they have the same length and iff, after sorting both arrays, all elements compare true with equals. The original arrays are left untouched. -
equalArraysOrNullSortFirst
Compares two String arrays using equals() on the elements. The arrays are first sorted. Either or both arrays may be null. Returns true if both are null. Returns false if only one is null. If both are arrays, returns true iff they have the same length and iff, after sorting both arrays, all elements compare true with equals. The original arrays are left untouched. -
equalOrNull
Compares two objects using equals(). Either or both array may be null. Returns true if both are null. Returns false if only one is null. Otherwise, return the result of comparing with equals(). -
equalsIgnoreJavaLikeExtension
-
extractLastName
Given a qualified name, extract the last component. If the input is not qualified, the same string is answered. -
extractParameterTypes
Extracts the parameter types from a method signature. -
extractReturnType
Extracts the return type from a method signature. -
findLineSeparator
Finds the first line separator used by the given text.- Returns:
- "\n" or "\r" or "\r\n",
or
null
if none found
-
getAttribute
public static IClassFileAttribute getAttribute(IClassFileReader classFileReader, char[] attributeName) -
getAttribute
-
getAttribute
-
getAttribute
-
getAttribute
-
getJavaLikeExtensions
public static char[][] getJavaLikeExtensions()Returns the registered Java like extensions. -
getJdkLevel
Get the jdk level of this root. The value can be:- majorinvalid input: '<'invalid input: '<'16 + minor : see predefined constants on ClassFileConstants
0 if the root is a source package fragment root or if a Java model exception occured
-
getNameWithoutJavaLikeExtension
Returns the substring of the given file name, ending at the start of a Java like extension. The entire file name is returned if it doesn't end with a Java like extension. -
getLineSeparator
Returns the line separator found in the given text. If it is null, or not found return the line delimiter for the given project. If the project is null, returns the line separator for the workspace. If still null, return the system line separator. -
getPackageFragment
-
getParameterCount
public static int getParameterCount(char[] sig) Returns the number of parameter types in a method signature. -
getProblemArgumentsForMarker
Put all the arguments in one String. -
getProblemArgumentsFromMarker
Separate all the arguments of a String made by getProblemArgumentsForMarker -
getResourceContentsAsByteArray
public static byte[] getResourceContentsAsByteArray(org.eclipse.core.resources.IFile file) throws JavaModelException Returns the given file's contents as a byte array.- Throws:
JavaModelException
-
getResourceContentsAsCharArray
public static char[] getResourceContentsAsCharArray(org.eclipse.core.resources.IFile file) throws JavaModelException Returns the given file's contents as a character array.- Throws:
JavaModelException
-
getResourceContentsAsCharArray
public static char[] getResourceContentsAsCharArray(org.eclipse.core.resources.IFile file, String encoding) throws JavaModelException - Throws:
JavaModelException
-
getSignature
-
getSourceAttachmentProperty
public static String getSourceAttachmentProperty(org.eclipse.core.runtime.IPath path) throws JavaModelException - Throws:
JavaModelException
-
setSourceAttachmentProperty
public static void setSourceAttachmentProperty(org.eclipse.core.runtime.IPath path, String property) -
getDeclaringTypeSignature
-
getTrimmedSimpleNames
Returns a trimmed version the simples names returned by Signature. -
getUnresolvedJavaElement
public static JavaElement getUnresolvedJavaElement(FieldBinding binding, WorkingCopyOwner workingCopyOwner, Util.BindingsToNodesMap bindingsToNodes) Return the java element corresponding to the given compiler binding. -
getUnresolvedJavaElement
public static JavaElement getUnresolvedJavaElement(RecordComponentBinding binding, WorkingCopyOwner workingCopyOwner, Util.BindingsToNodesMap bindingsToNodes) Return the java element corresponding to the given compiler binding. -
getUnresolvedJavaElement
public static JavaElement getUnresolvedJavaElement(int localSourceStart, int localSourceEnd, JavaElement type) Returns the IInitializer that contains the given local variable in the given type -
getUnresolvedJavaElement
public static JavaElement getUnresolvedJavaElement(MethodBinding methodBinding, WorkingCopyOwner workingCopyOwner, Util.BindingsToNodesMap bindingsToNodes) Return the java element corresponding to the given compiler binding. -
getUnresolvedJavaElement
public static JavaElement getUnresolvedJavaElement(TypeBinding typeBinding, WorkingCopyOwner workingCopyOwner, Util.BindingsToNodesMap bindingsToNodes) Return the java element corresponding to the given compiler binding. -
indexOfEnclosingPath
public static int indexOfEnclosingPath(org.eclipse.core.runtime.IPath checkedPath, org.eclipse.core.runtime.IPath[] paths, int pathCount) -
indexOfJavaLikeExtension
-
indexOfMatchingPath
public static int indexOfMatchingPath(org.eclipse.core.runtime.IPath checkedPath, org.eclipse.core.runtime.IPath[] paths, int pathCount) -
indexOfNestedPath
public static int indexOfNestedPath(org.eclipse.core.runtime.IPath checkedPath, org.eclipse.core.runtime.IPath[] paths, int pathCount) -
isAttributeSupported
protected static boolean isAttributeSupported(int attribute) Returns whether the local file system supports accessing and modifying the given attribute. -
isReadOnly
public static boolean isReadOnly(org.eclipse.core.resources.IResource resource) Returns whether the given resource is read-only or not.- Returns:
true
if the resource is read-only,false
if it is not or if the file system does not support the read-only attribute.
-
isReadOnlySupported
public static boolean isReadOnlySupported()Returns whether the local file system supports accessing and modifying the read only flag. -
isExcluded
-
isExcluded
public static final boolean isExcluded(org.eclipse.core.runtime.IPath resourcePath, char[][] inclusionPatterns, char[][] exclusionPatterns, boolean isFolderPath) -
isExcluded
public static final boolean isExcluded(org.eclipse.core.resources.IResource resource, char[][] inclusionPatterns, char[][] exclusionPatterns) -
isValidClassFileName
Validate the given .class file name. A .class file name must obey the following rules:- it must not be null
- it must include the
".class"
suffix - its prefix must be a valid identifier
- Parameters:
name
- the name of a .class filesourceLevel
- the source levelcomplianceLevel
- the compliance level- Returns:
- a status object with code
IStatus.OK
if the given name is valid as a .class file name, otherwise a status object indicating what is wrong with the name
-
isValidCompilationUnitName
public static boolean isValidCompilationUnitName(String name, String sourceLevel, String complianceLevel) Validate the given compilation unit name. A compilation unit name must obey the following rules:- it must not be null
- it must include the
".java"
suffix - its prefix must be a valid identifier
- Parameters:
name
- the name of a compilation unitsourceLevel
- the source levelcomplianceLevel
- the compliance level- Returns:
- a status object with code
IStatus.OK
if the given name is valid as a compilation unit name, otherwise a status object indicating what is wrong with the name
-
isValidFolderNameForPackage
public static boolean isValidFolderNameForPackage(String folderName, String sourceLevel, String complianceLevel) Returns true if the given folder name is valid for a package, false if it is not.- Parameters:
folderName
- the name of the foldersourceLevel
- the source levelcomplianceLevel
- the compliance level
-
isValidMethodSignature
Returns true if the given method signature is valid, false if it is not. -
isValidTypeSignature
Returns true if the given type signature is valid, false if it is not. -
localTypeName
-
log
-
logRepeatedMessage
Log a message that is potentially repeated in the same session. The first time this method is called with a given exception, the exception stack trace is written to the log.Only intended for use in debug statements.
- Parameters:
key
- the given keye
- the given exception- Throws:
IllegalArgumentException
- if the given key is null
-
logRepeatedMessage
-
log
-
log
public static void log(org.eclipse.core.runtime.IStatus status) -
log
-
newClassFileReader
public static ClassFileReader newClassFileReader(org.eclipse.core.resources.IResource resource) throws org.eclipse.core.runtime.CoreException, ClassFormatException, IOException - Throws:
org.eclipse.core.runtime.CoreException
ClassFormatException
IOException
-
normalizeCRs
public static char[] normalizeCRs(char[] text, char[] buffer) Normalizes the cariage returns in the given text. They are all changed to use the given buffer's line separator. -
normalizeCRs
Normalizes the carriage returns in the given text. They are all changed to use given buffer's line separator. -
packageName
public static String packageName(org.eclipse.core.runtime.IPath pkgPath, String sourceLevel, String complianceLevel) Converts the given relative path into a package name. Returns null if the path is not a valid package name.- Parameters:
pkgPath
- the package pathsourceLevel
- the source levelcomplianceLevel
- the compliance level
-
prefixLength
public static int prefixLength(char[] s1, char[] s2) Returns the length of the common prefix between s1 and s2. -
prefixLength
Returns the length of the common prefix between s1 and s2. -
relativePath
Returns the toString() of the given full path minus the first given number of segments. The returned string is always a relative path (it has no leading slash) -
resetJavaLikeExtensions
public static void resetJavaLikeExtensions() -
scanTypeSignature
public static int scanTypeSignature(char[] string, int start) Scans the given string for a type signature starting at the given index and returns the index of the last character.TypeSignature: | BaseTypeSignature | ArrayTypeSignature | ClassTypeSignature | TypeVariableSignature
- Parameters:
string
- the signature stringstart
- the 0-based character index of the first character- Returns:
- the 0-based character index of the last character
- Throws:
IllegalArgumentException
- if this is not a type signature
-
splitOn
Return a new array which is the split of the given string using the given divider. The given end is exclusive and the given start is inclusive.
For example:divider = 'b' string = "abbaba" start = 2 end = 5 result => { "", "a", "" }
- Parameters:
divider
- the given dividerstring
- the given stringstart
- the given starting indexend
- the given ending index- Returns:
- a new array which is the split of the given string using the given divider
- Throws:
ArrayIndexOutOfBoundsException
- if start is lower than 0 or end is greater than the array length
-
setReadOnly
public static void setReadOnly(org.eclipse.core.resources.IResource resource, boolean readOnly) Sets or unsets the given resource as read-only in the file system. It's a no-op if the file system does not support the read-only attribute.- Parameters:
resource
- The resource to set as read-onlyreadOnly
-true
to set it to read-only,false
to unset
-
sort
public static void sort(char[][] list) -
sort
Sorts an array of Comparable objects in place. -
sort
public static void sort(int[] list) -
sort
Sorts an array of objects in place. The given comparer compares pairs of items. -
sort
Sorts an array of strings in place using quicksort. -
sortCopy
Sorts an array of Comparable objects, returning a new array with the sorted items. The original array is left untouched. -
sortCopy
Sorts an array of Java elements based on their toStringWithAncestors(), returning a new array with the sorted items. The original array is left untouched. -
sortCopy
Sorts an array of Strings, returning a new array with the sorted items. The original array is left untouched. -
sortCopy
Sorts an array of Strings, returning a new array with the sorted items. The original array is left untouched. -
startsWithIgnoreCase
-
toCharArrays
Converts a String[] to char[][]. -
toCompoundChars
Converts a String to char[][], where segments are separate by '.'. -
toLocalFile
public static File toLocalFile(URI uri, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException - Throws:
org.eclipse.core.runtime.CoreException
-
toString
Converts a char[][] to String, where segments are separated by '.'. -
toString
Converts a char[][] and a char[] to String, where segments are separated by '.'. -
toStrings
-
toString
public static String toString(char[] declaringClass, char[] methodName, char[] methodSignature, boolean includeReturnType, boolean compact) -
typeParameterSignatures
-
typeSignature
-
validateMethodSignature
Asserts that the given method signature is valid. -
validateTypeSignature
Asserts that the given type signature is valid. -
isJavaLikeFileName
Returns true if the given name ends with one of the known java like extension. (implementation is not creating extra strings) -
isJavaLikeFileName
public static final boolean isJavaLikeFileName(char[] fileName) Returns true if the given name ends with one of the known java like extension. (implementation is not creating extra strings) -
getAllTypeArguments
public static final char[][][] getAllTypeArguments(char[][] typeSignatures) Get all type arguments from an array of signatures. Example: For following type Xinvalid input: '<'Y,V ,U>.A signatures is: [ ['L','X','invalid input: '<'','L','Y','invalid input: '<'','L','Z',';'>',';','L','V','invalid input: '<'','L','W',';'>',';','L','U',';',>',';'], ['L','A','invalid input: '<'','L','B',';','>',';'] ] - Parameters:
typeSignatures
- Array of signatures (one per each type levels)- Returns:
- char[][][] Array of type arguments for each signature
- Throws:
IllegalArgumentException
- If one of provided signature is malformed- See Also:
-
getAnnotation
public static IAnnotation getAnnotation(JavaElement parent, IBinaryAnnotation binaryAnnotation, String memberValuePairName) -
getAnnotationMemberValue
public static Object getAnnotationMemberValue(JavaElement parent, MemberValuePair memberValuePair, Object binaryValue) -
getAnnotationMemberValue
-
getNegativeAnnotationMemberValue
public static Object getNegativeAnnotationMemberValue(MemberValuePair memberValuePair, Constant constant) -
splitTypeLevelsSignature
Split signatures of all levels from a type unique key. Example: For following type Xinvalid input: '<'Y,V ,U>.A, unique key is: "LXinvalid input: '<'LYinvalid input: '<'LZ;>;LVinvalid input: '<'LW;>;LU;>.LAinvalid input: '<'LB;>;" The return splitted signatures array is: [ ['L','X','invalid input: '<'','L','Y','invalid input: '<'','L','Z',';'>',';','L','V','invalid input: '<'','L','W',';'>',';','L','U','>',';'], ['L','A','invalid input: '<'','L','B',';','>',';'] - Parameters:
typeSignature
- ParameterizedSourceType type signature- Returns:
- char[][] Array of signatures for each level of given unique key
-
toAnchor
-
toAnchor
public static char[] toAnchor(int startingIndex, char[] methodSignature, char[] methodName, boolean isVargArgs) -
fixTaskTags
-
findMethod
public static IMethod findMethod(IType type, char[] selector, String[] paramTypeSignatures, boolean isConstructor) throws JavaModelException Finds the IMethod element corresponding to the given selector, without creating a new dummy instance of a binary method.- Parameters:
type
- the type in which the method is declaredselector
- the method nameparamTypeSignatures
- the type signatures of the method argumentsisConstructor
- whether we're looking for a constructor- Returns:
- an IMethod if found, otherwise null
- Throws:
JavaModelException
-