| 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. |
NuPoEx type string pattern will match NullPointerException type but will not match NoPermissionException.
* BUILDER / Recreate Modified class files in Output Folder
* Indicate whether the JavaBuilder should check for any changes to .class files
* in the output folders while performing incremental build operations. If changes
* are detected to managed .class files, then a full build is performed, otherwise
* the changes are left as is. Tools further altering generated .class files, like optimizers,
* should ensure this option remains set in its default state of ignore.
* - option id: "org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder"
* - possible values: { "enabled", "ignore" }
* - default: "ignore"
BuildContext#recordNewProblems(...) now need to declare the problems
marker type as being managed for this problems to be persisted as markers by the Java builder. Declaring a managed marker type is
done using the 'managedMarker' sequence in the 'compilationParticipant' extension point.@SuppressWarnings("cast") for silencing unnecessary cast diagnostics.Preferences>Java>Compiler>Building>Treat configurable errors like fatal errors...int i = i = 0;i = i = 0;i = ++i;CategorizedProblem#getExtraMarkerAttributeNames() and getExtraMarkerAttributeValues() to allow to
specify extra attributes in problem markers.JAR files are now read more selectively, and thus interesting portions remain in the cache longer without consuming lots of memory. User editing experience is thus significantly improved on large workspaces containing big JARs. As a consequence, our experiments show that the memory requirement for developing Eclipse in Eclipse can be lowered to 128MB only (i.e. passing -Xmx128m to the VM) as opposed to 256MB as currently specified in the eclipse.ini file.
IMethodBinding#isOverriding() API introduced during 3.2 in DOM AST, as it doesn't meet
client expectation, who isn't even using it (also see bug 90660).
* COMPILER / Reporting Switch Fall-Through Case
* When enabled, the compiler will issue an error or a warning if a case may be
* entered by falling through previous case. Empty cases are allowed. *
* - option id: "org.eclipse.jdt.core.compiler.problem.fallthroughCase"
* - possible values: { "error", "warning", "ignore" }
* - default: "ignore"
Fall-through warnings can be silenced using @SuppressWarnings("fallthrough").
* CODEASSIST / Activate Deprecation Sensitive Completion
* When active, completion doesn't show deprecated members and types.
* - option id: "org.eclipse.jdt.core.codeComplete.deprecationCheck"
* - possible values: { "enabled", "disabled" }
* - default: "disable"
*
Window>Preferences>Java>Compiler>Errors/Warnings>Potential programming problems>Null reference.
Also see bug 110030 for details.
@SuppressWarnings("null").org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ANNOTATION_DECLARATION_HEADER
org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ANNOTATION_DECLARATION
org.eclipse.jdt.core.CorrectionEngine#getAllWarningTokens() to
get all the valid warning tokens, which can be used into @SuppressWarnings
annotations. See bug
126326 for details.@SuppressWarnings("restriction").
Note: if certain restrictions are configured as errors, the annotation has no effect. org.eclipse.jdt.core.formatter.CodeFormatter#createIndentationString(int) to return the indentation string corresponding to the given indentation level.org.eclipse.jdt.core.formatter.IndentManipulation to deal with indentations.org.eclipse.jdt.core.dom.IVariableBinding#isParameter() in order to fix bug 106545.BindingKey#toSignature() to transform a binding key into a resolved signature.WorkingCopyOwner#newWorkingCopy(String,IClasspathEntry[],IProblemRequestor,IProgressMonitor)
for editing compilation units outside the workspace.IClasspathAttribute#OPTIONAL
extra attribute. The possible values for this attribute are "true" or "false".
When not present, "false" is assumed. If the value of this attribute is "true",
the classpath entry is optional. ASTNode.RECOVEREDASTParser#setStatementsRecovery(boolean enabled)ICompilationUnit#reconcile(int astLevel, boolean forceProblemDetection, boolean enableStatementsRecovery, WorkingCopyOwner owner, IProgressMonitor monitor)discouraged and
forbidden, so as to suppress warnings about access rules restrictions.IAccessRule#IGNORE_IF_BETTER that indicates that the rule should be ignored if a better rule is found.
E.g. if a rule K_NON_ACCESSIBLE | IGNORE_IF_BETTER matches type p.X and a rule K_DISCOURAGED
that also matches p.X is found after the first one, then p.X will be reported as discouraged.ImportRewrite#setImportOrder(), ImportRewrite#setOnDemandImportThreshold() and
ImportRewrite#setStaticOnDemandImportThreshold(). For compatibility reasons the actual configuration option values stay in
JDT.UIorg.eclipse.jdt.core.dom.ImportRewrite). The import rewriter is used to add new imports according
to a user specified import order. See bug 73054 for details.org.eclipse.jdt.core.dom.Modifier#isPublic(), org.eclipse.jdt.core.dom.Modifier#isStatic(), ...). See bug 122460 for details.org.eclipse.jdt.core.IJavaElement#String getAttachedJavadoc(IProgressMonitor monitor). See bug 122506 for details.
The former API org.eclipse.jdt.core.IJavaElement#String getAttachedJavadoc(IProgressMonitor monitor, String defaultEncoding) has been deprecated.org.eclipse.jdt.core.dom.ITypeBinding#getComponentType() in order to retrieve the binding
corresponding to the component type of the array binding. See bug 120264 for details.
This API is still subject to change before 3.2 release.
* COMPILER / Reporting Parameter Assignment
* When enabled, the compiler will issue an error or a warning if a parameter is
* assigned to.
* - option id: "org.eclipse.jdt.core.compiler.problem.parameterAssignment"
* - possible values: { "error", "warning", "ignore" }
* - default: "ignore"
JavaCore.CODEASSIST_TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC has been deprecated and it will be removed
after M4. Use JavaCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC instead.
/**
* Same functionality as {@link #findType(String)} but also look for secondary
* types if given name does not match a compilation unit name.
*
* @param fullyQualifiedName the given fully qualified name
* @param progressMonitor the progress monitor to report progress to,
* or null if no progress monitor is provided
* @exception JavaModelException if this project does not exist or if an
* exception occurs while accessing its corresponding resource
* @return the first type found following this project's classpath
* with the given fully qualified name or null if none is found
* @see IType#getFullyQualifiedName(char)
* @since 3.2
*/
IType findType(String fullyQualifiedName, IProgressMonitor progressMonitor) throws JavaModelException;
/**
* Same functionality as {@link #findType(String, WorkingCopyOwner)}
* but also look for secondary types if given name does not match
* a compilation unit name.
*
* @param fullyQualifiedName the given fully qualified name
* @param owner the owner of the returned type's compilation unit
* @param progressMonitor the progress monitor to report progress to,
* or null if no progress monitor is provided
* @exception JavaModelException if this project does not exist or if an
* exception occurs while accessing its corresponding resource
* @return the first type found following this project's classpath
* with the given fully qualified name or null if none is found
* @see IType#getFullyQualifiedName(char)
* @since 3.2
*/
IType findType(String fullyQualifiedName, WorkingCopyOwner owner, IProgressMonitor progressMonitor) throws JavaModelException;
/**
* Same functionality as {@link #findType(String, String)} but also look for
* secondary types if given name does not match a compilation unit name.
*
* @param packageName the given package name
* @param typeQualifiedName the given type qualified name
* @param progressMonitor the progress monitor to report progress to,
* or null if no progress monitor is provided
* @exception JavaModelException if this project does not exist or if an
* exception occurs while accessing its corresponding resource
* @return the first type found following this project's classpath
* with the given fully qualified name or null if none is found
* @see IType#getFullyQualifiedName(char)
* @since 3.2
*/
IType findType(String packageName, String typeQualifiedName, IProgressMonitor progressMonitor) throws JavaModelException;
/**
* Same functionality as {@link #findType(String, String, WorkingCopyOwner)}
* but also look for secondary types if given name does not match a compilation unit name.
*
* @param packageName the given package name
* @param typeQualifiedName the given type qualified name
* @param owner the owner of the returned type's compilation unit
* @param progressMonitor the progress monitor to report progress to,
* or null if no progress monitor is provided
* @exception JavaModelException if this project does not exist or if an
* exception occurs while accessing its corresponding resource
* @return the first type found following this project's classpath
* with the given fully qualified name or null if none is found
* @see IType#getFullyQualifiedName(char)
* @since 3.2
*/
IType findType(String packageName, String typeQualifiedName, WorkingCopyOwner owner, IProgressMonitor progressMonitor) throws JavaModelException;
Note that previously existing find type API methods:
IJavaproject#findType(String)IJavaproject#findType(String, WorkingCopyOwner)IJavaproject#findType(String, String)IJavaproject#findType(String, String, WorkingCopyOwner)SearchParticipant#removeIndex(IPath) to remove both index file
from a given location and its corresponding Index in IndexManager cache.
IJavaProject#setRawClasspath(IClasspathEntry[], IPath, boolean, IProgressMonitor)
to change the output location as well as the classpath without touching resources.IJavaProject#setRawClasspath(IClasspathEntry[], boolean, IProgressMonitor)
to set the classpath without touching the .classpath file.org.eclipse.jdt.core.compiler.CharOperation#equals(char[], char[], int, int, boolean).org.eclipse.jdt.core.compiler.CharOperation#replace(char[], char[], char, int, int).IMember#getOccurrenceCount() to return the relative position of the member in the source.WorkingCopyOwner#newWorkingCopy(String,IProgressMonitor) to create a new working copy
without an underlying resource./** * Returns the local element of this search match. * This may be a local variable which declaring type is the referenced one * or a type parameter which extends it. * * @return the element of the search match, ornullif none or there's * no more specific local element than the element itself ({@link SearchMatch#getElement()}). */ public final IJavaElement getLocalElement() /** * Returns other enclosing elements of this search match. * * If {@link #getLocalElement()} is notnull, these may be other * local elements such as additional local variables of a multiple local * variables declaration. Otherwise, these may be other elements such as * additional fields of a multiple fields declaration. * * @return the other elements of the search match, ornullif none */ public final IJavaElement[] getOtherElements() /** * Sets the local element of this search match. * * @param localElement A more specific local element that corresponds to the match, * ornullif none */ public final void setLocalElement(IJavaElement localElement) /** * Sets the other elements of this search match. * * @param otherElements the other elements of the match, * ornullif none */ public final void setOtherElements(IJavaElement[] otherElements)
JavaCore#initializeAfterLoad(IProgressMonitor) used to schedule a job to do its work.
It now does it in the same thread. Note this is not an API change as the spec allows both scenarii.
JavaCore#getJavaLikeExtensions(), isJavaLikeFileName(String), and removeJavaLikeExtension(String)
to get the available Java-like extensions (from the Java source content-type), checking if a file is a Java-like file, and removing
the Java-like extension from a file name.
/** * Returns the column number corresponding to the given source character * position in the original source string. Column number are zero-based. * Return-1if it is beyond the valid range or-2* if the column number information is unknown. * * @param position a 0-based character position, possibly * negative or out of range * @return the 0-based column number, or-1if the character * position does not correspond to a source line in the original * source file or-2if column number information is unknown for this * compilation unit * @see ASTParser * @since 3.2 */ public int getColumnNumber(final int position) /** * Given a line number and column number, returns the corresponding * position in the original source string. * Returns -2 if no line number information is available for this * compilation unit. * Returns the total size of the source string ifline* is greater than the actual number lines in the unit. * Returns -1 ifcolumnis less than 0, * or the position of the last character of the line ifcolumn* is beyond the legal range, or the given line number is less than one. * * @param line the one-based line number * @param column the zero-based column number * @return the 0-based character position in the source string; *-2if line/column number information is not known * for this compilation unit or-1the inputs are not valid * @since 3.2 */ public int getPosition(int line, int column) /** * Returns the line number corresponding to the given source character * position in the original source string. The initial line of the * compilation unit is numbered 1, and each line extends through the * last character of the end-of-line delimiter. The very last line extends * through the end of the source string and has no line delimiter. * For example, the source stringclass A\n{\n}has 3 lines * corresponding to inclusive character ranges [0,7], [8,9], and [10,10]. * Returns -1 for a character position that does not correspond to any * source line, or -2 if no line number information is available for this * compilation unit. * * @param position a 0-based character position, possibly * negative or out of range * @return the 1-based line number, or-1if the character * position does not correspond to a source line in the original * source file or-2if line number information is not known for this * compilation unit * @see ASTParser * @since 3.2 */ public int getLineNumber(int position)
IMethod#getRawParameterNames() that returns the invented names arg0...argn for a binary method.IOpenable#findRecommendedLineSeparator() that finds the line separator for the given Java element.JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS: - old default value = "enabled" - new default value = "disabled" JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS__DEPRECATED_REF - old default value = "enabled" - new default value = "disabled" JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS__NOT_VISIBLE_REF - old default value = "enabled" - new default value = "disabled" JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS_VISIBILITY - old default value = "private" - new default value = "public" JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS_VISIBILITY - old default value = "private" - new default value = "public"
/**
* Return the index in the whole comments list {@link #getCommentList() }
* of the first leading comments associated with the given node.
*
* @param node the node
* @return 0-based index of first leading comment or -1 if node has
* no associated comment before its start position.
* @since 3.2
*/
public int firstLeadingCommentIndex(ASTNode node)
/**
* Return the index in the whole comments list {@link #getCommentList() }
* of the last trailing comments associated with the given node.
*
* @param node the node
* @return 0-based index of last trailing comment or -1 if node has
* no associated comment after its end position.
* @since 3.2
*/
public int lastTrailingCommentIndex(ASTNode node)
/**
* Returns the column number corresponding to the given source character
* position in the original source string. Column number are zero-based.
* Return zero if it is beyond the valid range.
*
* @param position a 0-based character position, possibly
* negative or out of range
* @return the 0-based coloumn number, or 0 if the character
* position does not correspond to a source line in the original
* source file or if column number information is not known for this
* compilation unit
* @see ASTParser
* @since 3.2
*/
public int columnNumber(final int position)
/**
* Given a line number and column number, returns the corresponding
* position in the original source string.
* Returns 0 if no line number information is available for this
* compilation unit or the requested line number is less than one.
* Returns the total size of the source string if line
* is greater than the actual number lines in the unit.
* Returns 0 if column is less than 0,
* or the position of the last character of the line if column
* is beyond the legal range.
*
* @param line the one-based line number
* @param column the zero-based column number
* @return the 0-based character position in the source string;
* returns 0 if line/column number information is not known
* for this compilation unit or the inputs are not valid
* @since 3.2
*/
public int getPosition(int line, int column)
This is matching the format of the JDT/Core buildnotes. But the code can be easily customized for a different format.
compilationParticipant extension point as well as
CompilationParticipant and ReconcileContext classes.)
Note that this support is still work in progress and it is subject to change.
Ability to participate in building will be added later.
/** * Returns the completed token. * This token is either the identifier or Java language keyword * or the string literal under, immediately preceding, * the original request offset. If the original request offset * is not within or immediately after an identifier or keyword or * a string literal then the returned value is <code>null</code>. * * @return completed token or <code>null</code> * @since 3.2 */ public char[] getToken() /** * Returns the kind of completion token being proposed. * * The set of different kinds of completion token is * expected to change over time. It is strongly recommended * that clients do not assume that the kind is one of the * ones they know about, and code defensively for the * possibility of unexpected future growth. * * @return the kind; one of the kind constants declared on * this class whose name starts with <code>TOKEN_KIND</code>, * or possibly a kind unknown to the caller * @since 3.2 */ public int getTokenKind() /** * Returns the character index of the start of the * subrange in the source file buffer containing the * relevant token being completed. This * token is either the identifier or Java language keyword * under, or immediately preceding, the original request * offset. If the original request offset is not within * or immediately after an identifier or keyword, then the * position returned is original request offset and the * token range is empty. * * @return character index of token start position (inclusive) * @since 3.2 */ public int getTokenStart() /** * Returns the character index of the end (exclusive) of the subrange * in the source file buffer containing the * relevant token. When there is no relevant token, the * range is empty * (<code>getTokenEnd() == getTokenStart()</code>). * * @return character index of token end position (exclusive) * @since 3.2 */ public int getTokenEnd() /** * Returns the offset position in the source file buffer * after which code assist is requested. * * @return offset position in the source file buffer * @since 3.2 */ public int getOffset()
/**
* 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_MATCH
Currently 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)