jdt core - build notes 3.2 stream |
java development tooling core |
Here are the build notes for the Eclipse JDT/Core plug-in project
org.eclipse.jdt.core,
describing bug resolution and substantial changes in the HEAD branch.
For more information on 3.2 planning, please refer to JDT/Core release plan,
the next milestone plan,
the overall official plan,
or the build schedule.
This present document covers all changes since Release 3.1 (also see a summary of API changes).
Maintenance of previous releases of JDT/Core is performed in parallel branches: R3.1.x, R3.0.x, R2.1.x, R2.0.x, R1.0.x. |
/** * Answers true if the pattern matches the given name using CamelCase rules, or false otherwise. * CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently case sensitive. * * CamelCase denotes the convention of writing compound names without spaces, and capitalizing every term. * This function recognizes both upper and lower CamelCase, depending whether the leading character is capitalized * or not. The leading part of an upper CamelCase pattern is assumed to contain a sequence of capitals which are appearing * in the matching name; e.g. 'NPE' will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern * uses a lowercase first character. In Java, type names follow the upper CamelCase convention, whereas method or field * names follow the lower CamelCase convention. * * The pattern may contain trailing lowercase characters, which will be match in a case sensitive way. These characters must * appear in sequence in the name, after the last matching capital of the pattern. For instance, 'NPExcep' will match * 'NullPointerException', but not 'NullPointerExCEPTION'. * * For example: * - pattern = "NPE" * name = NullPointerException * result => true * - pattern = "npe" * name = NullPointerException * result => false * * @see CharOperation#camelCaseMatch(char[], char[]) * Implementation has been entirely copied from this method except for array lengthes * which were obviously replaced with calls to {@link String#length()}. * * @param pattern the given pattern * @param name the given name * @return true if the pattern matches the given name, false otherwise */ public static final boolean camelCaseMatch(String pattern, String name) /** * Answers true if a sub-pattern matches the subpart of the given name using CamelCase rules, or false otherwise. * CamelCase matching does NOT accept explicit wild-cards '*' and '?' and is inherently case sensitive. * Can match only subset of name/pattern, considering end positions as non-inclusive. * The subpattern is defined by the patternStart and patternEnd positions. * * CamelCase denotes the convention of writing compound names without spaces, and capitalizing every term. * This function recognizes both upper and lower CamelCase, depending whether the leading character is capitalized * or not. The leading part of an upper CamelCase pattern is assumed to contain a sequence of capitals which are appearing * in the matching name; e.g. 'NPE' will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern * uses a lowercase first character. In Java, type names follow the upper CamelCase convention, whereas method or field * names follow the lower CamelCase convention. * * The pattern may contain trailing lowercase characters, which will be match in a case sensitive way. These characters must * appear in sequence in the name, after the last matching capital of the pattern. For instance, 'NPExcep' will match * 'NullPointerException', but not 'NullPointerExCEPTION'. * * For example: * - pattern = "NPE" * patternStart = 1 * patternEnd = 3 * name = NullPointerException * nameStart = 0 * nameEnd = 20 * result => true * - pattern = "npe" * patternStart = 1 * patternEnd = 3 * name = NullPointerException * nameStart = 0 * nameEnd = 20 * result => false * * @see CharOperation#camelCaseMatch(char[], int, int, char[], int, int) * Implementation has been entirely copied from this method except for array lengthes * which were obviously replaced with calls to {@link String#length()} and * for array direct access which were replaced with calls to {@link String#charAt(int)}. * * @param pattern the given pattern * @param patternStart the given pattern start * @param patternEnd the given pattern end * @param name the given name * @param nameStart the given name start * @param nameEnd the given name end * @return true if a sub-pattern matches the subpart of the given name, false otherwise */ public static final boolean camelCaseMatch(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd) /** * Validate compatibility between given string pattern and match rule. * * Optimized (ie. returned match rule is modified) combinations are: * - {@link #R_PATTERN_MATCH} without any '*' or '?' in string pattern: * pattern match bit is unset, * - {@link #R_PATTERN_MATCH} and {@link #R_PREFIX_MATCH} bits simultaneously set: * prefix match bit is unset, * - {@link #R_PATTERN_MATCH} and {@link #R_CAMELCASE_MATCH} bits simultaneously set: * camel case match bit is unset, * - {@link #R_CAMELCASE_MATCH} with invalid combination of uppercase and lowercase characters: * camel case match bit is unset and replaced with prefix match pattern, * - {@link #R_CAMELCASE_MATCH} combined with {@link #R_PREFIX_MATCH} and {@link #R_CASE_SENSITIVE} * bits is reduced to only {@link #R_CAMELCASE_MATCH} as Camel Case search is already prefix and case sensitive. * * Rejected (ie. returned match rule -1) combinations are: * - {@link #R_REGEXP_MATCH} with any other match mode bit set. * * @param stringPattern The string pattern * @param matchRule The match rule * @return Optimized valid match rule or -1 if an incompatibility was detected. */ public static int validateMatchRule(String stringPattern, int matchRule) {
/** * CODEASSIST / Activate Camel Case Sensitive Completion * When active, completion show proposals whose name match to the CamelCase pattern. * - option id: "org.eclipse.jdt.core.codeComplete.camelCaseMatch" * - possible values: { "enabled", "disabled" } * - default: "disabled" */ JavaCore#CODEASSIST_CAMEL_CASE_MATCHCurrently this option is disabled by default. The default value of this option will be set to enabled when JDT/Text will be able to manage this kind of proposal (see bug 114098)
@pa|
will give @param
proposal only in javadoc of method or generic type declarations,{@co|
will give {@code }
proposal only if your compiler compliance has been set to 1.5 or over,@see
, @throws
, @exception
, {@link}
,
{@linplain}
or {@value}
tags will behave like completion in java code. Type qualification for
types will be inserted depending on "Add import instead of qualified name" Code Assist preferences.
/** * This is an example of completion inside text area: S| */ public class Sample {}will propose both
String
and Sample
, but also {@link String }
and
{@link Sample }
.
Currently each proposal is available either as java code type name or direclty inserted as a {@link} tag.
This part is still under work and final behavior should depend on a new JDT/UI preferences.../** * This is an example of completion inside text area: #m| */ public class Sample { void method() {} }will propose
{@link #method() }
.
CompletionContext
:
/** * Tell user whether completion takes place in a javadoc comment or not. * * @return boolean true if completion takes place in a javadoc comment, false otherwise. * @since 3.2 */ public boolean isInJavadoc() {...} /** * Tell user whether completion takes place in text area of a javadoc comment or not. * * @return boolean true if completion takes place in a text area of a javadoc comment, false otherwise. * @since 3.2 */ public boolean isInJavadocText() {...} /** * Tell user whether completion takes place in a formal reference of a javadoc tag or not. * Tags with formal reference are: * - @see * - @throws * - @exception * - {@link Object} * - {@linkplain Object} * - {@value} when compiler compliance is set at leats to 1.5 * * @return boolean true if completion takes place in formal reference of a javadoc tag, false otherwise. * @since 3.2 */ public boolean isInJavadocFormalReference() {...}
org.eclipse.jdt.core.IMember#ISourceRange getJavadocRange() throws JavaModelException
. This API can be used
to retrieve the source range of a javadoc comment attached to the corresponding member.
* COMPILER / Treating Optional Error as Fatal * When enabled, optional errors (i.e. optional problems which severity is set to "error") will be treated as standard * compiler errors, yielding problem methods/types preventing from running offending code until the issue got resolved. * When disabled, optional errors are only considered as warnings, still carrying an error indication to make them more * severe. Note that by default, errors are fatal, whether they are optional or not. * - option id: "org.eclipse.jdt.core.compiler.problem.fatalOptionalError" * - possible values: { "enabled", "disabled" } * - default: "enabled"
IJavaElementDelta#F_CATEGORIES
. This flag is set when one or more categories of an element
are added/changed/removed.SearchPattern
(see bug 110060):
/** * Match rule: The search pattern contains a Camel Case expression. * For example,NPE
type string pattern will match *NullPointerException
type. * @see CharOperation#camelCaseMatch(char[], char[]) for a detailed explanation * of Camel Case matching. * * Can be combined to {@link #R_PREFIX_MATCH} match rule. For example, * when prefix match rule is combined with Camel Case match rule, *"nPE"
pattern will matchnPException
. * * Match rule {@link #R_PATTERN_MATCH} may also be combined but both rules * will not be used simultaneously as they are mutually exclusive. * Used match rule depends on whether string pattern contains specific pattern * characters (e.g. '*' or '?') or not. If it does, then only Pattern match rule * will be used, otherwise only Camel Case match will be used. * For example, with"NPE"
string pattern, search will only use * Camel Case match rule, but withN*P*E*
string pattern, it will * use only Pattern match rule. * * @since 3.2 */ public static final int R_CAMELCASE_MATCH = 0x0080;
* COMPILER / Reporting Unreferenced Label * When enabled, the compiler will issue an error or a warning when encountering a labeled statement which label * is never explicitly referenced. A label is considered to be referenced if its name explicitly appears behind a break * or continue statement; for instance the following label would be considered unreferenced; LABEL: { break; } * - option id: "org.eclipse.jdt.core.compiler.problem.unusedLabel" * - possible values: { "error", "warning", "ignore" } * - default: "warning"
org.eclipse.jdt.core.ToolFactory#createDefaultClassFileReader(java.io.InputStream,int)
that allows to the creation of an org.eclipse.jdt.core.util.IClassFileReader object using an input stream.
JavaCore#addPreProcessingResourceChangedListener(IResourceChangeListener,int)
that allows to register an IResourceChangedListener
for a given event type that runs
before JDT Core.IMember#getCategories()
and to get the children of a type for a given category
IType#getChildrenForCategory(String)
.* Answers true if the pattern matches the given name using CamelCase rules, or false otherwise. * char[] CamelCase matching does NOT accept explicit wild-cards '*' and '?'. * * CamelCase denotes the convention of writing compound names without spaces, and capitalizing every term. * This function recognizes both upper and lower CamelCase, depending whether the leading character is capitalized * or not. The leading part of an upper CamelCase pattern is assumed to contain a sequence of capitals which are appearing * in the matching name; e.g. 'NPE' will match 'NullPointerException', but not 'NewPerfData'. A lower CamelCase pattern * uses a lowercase first character. In Java, type names follow the upper CamelCase convention, whereas method or field * names follow the lower CamelCase convention. * * The pattern may contain trailing lowercase characters, which will be match in a case sensitive way. These characters must * appear in sequence in the name, after the last matching capital of the pattern. For instance, 'NPExcep' will match * 'NullPointerException', but not 'NullPointerExCEPTION'. public static final boolean camelCaseMatch(char[] pattern, char[] name) public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd)
@SuppressWarnings("unchecked")
* COMPILER / Reporting Raw Type Reference * When enabled, the compiler will issue an error or a warning when detecting references to raw types. Raw types are * discouraged, and are intended to help interfacing with legacy code. In the future, the language specification may * reject raw references to generic types. * - option id: "org.eclipse.jdt.core.compiler.problem.rawTypeReference" * - possible values: { "error", "warning", "ignore" } * - default: "ignore"
CategorizedProblem
to extend IProblem
definitions with notion of
problem category and marker type. This will enable other pluggable tool to participate in various compilation stages
and report domain specific problems through the existing API (IProblem
based). It is recommended that
clients do not directly implement IProblem
but instead do extend the abstract class CategorizedProblem
.
/**
* Returns an integer identifying the category of this problem. Categories, like problem IDs are
* defined in the context of some marker type. Custom implementations of CategorizedProblem
* may choose arbitrary values for problem/category IDs, as long as they are associated with a different
* marker type.
* @return id - an integer identifying the category of this problem
*/
public abstract int getCategoryID();
/** * Returns the marker type associated to this problem, if it was persisted into a marker by the JavaBuilder * Standard Java problems are associated to marker type "org.eclipse.jdt.core.problem"), standard tasks * are associated to marker type "org.eclipse.jdt.core.task". * @return the type of the marker which would be associated to the problem * @see org.eclipse.jdt.core.IJavaModelMarker#JAVA_MODEL_PROBLEM_MARKER * @see org.eclipse.jdt.core.IJavaModelMarker#TASK_MARKER */ public abstract String getMarkerType();
IJavaElementDelta#F_AST_AFFECTED
and IJavaElementDelta#getCompilationUnitAST()
.
The Java element delta's flag is set to F_AST_AFFECTED
when a reconcile operation affects the AST
created in the last reconcile operation. In this case the AST should be re-acquired using getCompilationUnitAST()
.
IJavaProject#encodeClasspathEntry(IClasspathEntry)
and decodeClasspathEntry(String)
.
IClassFile#becomeWorkingCopy(...)
that returns an ICompilationUnit
in working copy mode on the given class file. See its Javadoc for more details.List l = (ArrayList) someList;
List foo(List someList) { return (ArrayList) someList;}
* COMPILER / Reporting Raw Type Reference * When enabled, the compiler will signal references to raw types. Raw types are discouraged, and are intended to help interfacing * with legacy code. In the future, the language specification may reject raw references to generic types. * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation". * - option id: "org.eclipse.jdt.core.compiler.problem.rawTypeReference" * - possible values: { "enabled", "disabled" } * - default: "disabled"
...
// System.out.println(""); //$NON-NLS-1$
...
String s = "Hello, World"; //$NON-NLS-1$ This won't be removed //$NON-NLS-2$ at all
becomes:
String s = "Hello, World"; //$NON-NLS-1$ This won't be removed at all