jdt core - build notes 3.1 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.
This present document covers all changes since Release 3.0 (also see a summary of API changes).
Maintenance of previous releases of JDT/Core is performed in parallel branches: R3.0.x, R2.1.x, R2.0.x, R1.0.x. |
NOTE:
All other warning tokens are not longer supported by @SuppressWarnings; considering that for some diagnosis, it is simpler to just fix the code than silence some warning. In Italic the old warning token is specified.
Warning tokens also supported by javac are in red (also see declared warning tokens).
"com/test/X.java"
is now an invalid access rule pattern, and
"com/test/X"
is a valid access rule pattern.Y<complete here> // p.q.X.Y is proposed.As all member types are proposed, code assist does not propose types of the wrong kind. Only classes are proposed inside an extends clause, only interfaces inside an implements clause and only annotations in annotation reference (It was necessary before to be able to propose a top level type which contains these types).
JavaCore#initializeAfterLoad(IProgressMonitor)
to allow
a client to force the initialization of internal structures.
COMPILER_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING
and
COMPILER_PB_MISSING_JAVADOC_TAGS_OVERRIDING
JavaCore options have been changed from "enabled" to "disabled".JavaCore.new*Entry
method have been updated to clearly specify this behavior:
* The extraAttributes
list contains name/value pairs that must be persisted with
* this entry. If no extra attributes are provided, an empty array must be passed in.
* Note that this list should not contain any duplicate name.
JavaConventions.validateClasspathEntry(IJavaProject,IClasspathEntry,boolean,boolean)
has been modified
to verify this point. It now returns an invalid status (new IJavaStatus(IJavaModelStatusConstants.NAME_COLLISION,...)
)
when duplicate names are found in extra attributes.
@SuppressWarnings
annotations.
Note that this warning can itself be turned off using @SuppressWarnings("warningToken").
* COMPILER / Reporting Unhandled Warning Token for @SuppressWarnings * When enabled, the compiler will issue an error or a warning when encountering a token * it cannot handle inside a @SuppressWarnings annotation. * - option id: "org.eclipse.jdt.core.compiler.problem.unhandledWarningToken" * - possible values: { "error", "warning", "ignore" } * - default: "warning"
p.q.X<<complete here>> // p.q.X<T,U> is proposed. p.q.X<Object, <complete here>> //p.q.X<T,U> is proposed
@Annot(<complete here>) // p.Annot is proposed. @Annot(foo1=0, <complete here>) // p.Annot is proposed.
X$1$A.class
, it will simply be X$1A.class"
.
@SuppressWarnings
annotations.
Note that this warning can itself be turned off using @SuppressWarnings("warningToken").
* COMPILER / Reporting Unhandled Warning Token for @SuppressWarnings * When enabled, the compiler will issue an error or a warning when encountering a token * it cannot handle inside a @SuppressWarnings annotation. * - option id: "org.eclipse.jdt.core.compiler.problem.unhandledWarningToken" * - possible values: { "error", "warning", "ignore" } * - default: "ignore"
* COMPILER / Determine whether @SuppressWarnings is effective * When enabled, the @SuppressWarnings annotation can be used to suppress some compiler warnings. * When disabled, all @SupressWarnings annotations are ignored; i.e., warnings are reported. * - option id: "org.eclipse.jdt.core.compiler.problem.suppressWarnings" * - possible values: { "enabled", "disabled" } * - default: "enabled"
CorrectionEngine
for computing the warning token corresponding to an optional warning ID.
/** * Returns a token which can be used to suppress a given warning using *@SuppressWarnings
annotation, for a given problem ID * ({@link IProblem }). If a particular problem is not suppressable, *null
will be returned. * * Note:@SuppressWarnings
can only suppress warnings, * which means that if some problems got promoted to ERROR using custom compiler * settings ({@link IJavaProject#setOption(String, String)}), the *@SuppressWarnings
annotation will be ineffective. * * Note:@SuppressWarnings
can be argumented with *"all"
so as to suppress all possible warnings at once. * * Note: The tokens returned are not necessarily standardized across Java * compilers. If you were to use one of these tokens in an @SuppressWarnings * annotation in the Java source code, the effects (if any) may vary from * compiler to compiler. * * @param problemID * the ID of a given warning to suppress * @return a String which can be used in@SuppressWarnings
annotation, * ornull
if unable to suppress this warning. * @since 3.1 */ public static String getWarningToken(int problemID)
@SuppressWarnings
, see list below. Note that
these are subject to changing in the near future.
SearchMatch#isImplicit()
SearchMatch#setImplicit(boolean)
"all"
, "deprecation"
,
"serial"
, "unchecked"
, "finally"
.
/* * CODEASSIST / Hide Proposals for Restricted Completions * When value is "never", never hide proposals for restricted completions. * When value is "error", hide proposals for restricted completions if insertion of these completions would create a compile error. * When value is "warning", hide proposals for restricted completions if insertion of these completions would create a compile error or warning. * To configure the severity of restrictions, "org.eclipse.jdt.core.compiler.problem.forbiddenReference" * option must be used for forbidden reference and "org.eclipse.jdt.core.compiler.problem.discouragedReference" * option must be used for discouraged reference. * - option id: "org.eclipse.jdt.core.codeComplete.restrictionsCheck" * - possible values: { "never", "error", "warning" } * - default: "error" */ public static final String CODEASSIST_HIDE_RESTRICTED_REFERENCES;
BindingKey#getDeclaringTypeSignature()
and
BindingKey#toSignature()
as they were found error prone. See bug 93105
for details.ListRewrite#createMoveTarget(first, last, replacingNode, editGroup)
).
See bug 91938 for details.
java.lang.RuntimeException
and java.lang.Error
eagerly
during compilation when assessing unchecked exception diagnosis. This allows Java class library developpers to be
more minimalistic.
org.eclipse.jdt.core/perf/completion=300
: add an entry to performance.log if CompletionEngine.complete() take more than 300msorg.eclipse.jdt.core/perf/selection=300
add an entry to performance.log if SelectionEngine.select() take more than 300msorg.eclipse.jdt.core/perf/javadeltalistener=500
add an entry to performance.log if the call to the listener take more than 500msorg.eclipse.jdt.core/perf/variableinitializer=5000
add an entry to performance.log if the initialization take more than 5000msorg.eclipse.jdt.core/perf/containerinitializer=5000
add an entry to performance.log if the initialization take more than 5000msorg.eclipse.jdt.core/perf/reconcile=1000
add an entry to performance.log if ComplationUnit.reconcile() take more than 1000ms@MyAnnotation(<complete here> @MyAnnotation(foo=<complete here>
org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_USE_TABS_ONLY_FOR_LEADING_INDENTATIONS
org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS
org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_INDENTATION_SIZE
org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#MIXED
. This new constant is used for the option:
org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_TAB_CHAR
.org.eclipse.jdt.core.dom.ITypeBinding#getDeclaringMethod()
. See bug 86580 for details.org.eclipse.jdt.core.formatter.CodeFormatter#K_SINGLE_LINE_COMMENT
org.eclipse.jdt.core.formatter.CodeFormatter#K_MULTI_LINE_COMMENT
org.eclipse.jdt.core.formatter.CodeFormatter#K_JAVA_DOC
org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_COMMENT_CLEAR_BLANK_LINES
org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_COMMENT_FORMAT_HEADER
org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_COMMENT_FORMAT_HTML
org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_COMMENT_FORMAT_SOURCE
org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_COMMENT_FORMAT
org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_COMMENT_INDENT_PARAMETER_DESCRIPTION
org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_COMMENT_INDENT_ROOT_TAGS
org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_COMMENT_INSERT_EMPTY_LINE_BEFORE_ROOT_TAGS
org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_COMMENT_INSERT_NEW_LINE_FOR_PARAMETER
org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants#FORMATTER_COMMENT_LINE_LENGTH
IClasspathAttribute#JAVADOC_LOCATION_ATTRIBUTE_NAME
.BindingKey#createArrayTypeBindingKey(String typeKey, int arrayDimension)
BindingKey#createTypeBindingKey(String typeName)
.BindingKey#createParameterizedTypeBindingKey(String genericTypeKey, String[] argumentTypeKeys)
.createTypeVariableBindingKey(String typeVariableName, String declaringKey)
BindingKey#createWildcardTypeBindingKey(String typeKey, char kind)
IField#isEnumConstant()
org.eclipse.jdt.core.IAccessRule
int K_ACCESSIBLE;
int K_NON_ACCESSIBLE;
int K_DISCOURAGED;
IPath getPattern();
int getKind();
org.eclipse.jdt.core.JavaCore
String COMPILER_PB_DISCOURAGED_REFERENCE;
IAccessRule newAccessRule(IPath pattern, int kind);
IClasspathEntry newContainerEntry(
IPath containerPath,
IAccessRule[] accessRules,
IClasspathAttribute[] extraAttributes,
boolean isExported);
IClasspathEntry newLibraryEntry(
IPath path,
IPath sourceAttachmentPath,
IPath sourceAttachmentRootPath,
IAccessRule[] accessRules,
IClasspathAttribute[] extraAttributes,
boolean isExported);
IClasspathEntry newProjectEntry(
IPath path,
IAccessRule[] accessRules,
boolean combineAccessRules,
IClasspathAttribute[] extraAttributes,
boolean isExported);
IClasspathEntry newVariableEntry(
IPath variablePath,
IPath variableSourceAttachmentPath,
IPath variableSourceAttachmentRootPath,
IAccessRule[] accessRules,
IClasspathAttribute[] extraAttributes,
boolean isExported);
org.eclipse.jdt.core.IClasspathEntry
boolean combineAccessRules();
IAccessRule[] getAccessRules();
MyClass
, in following Javadoc comment:
/** * @see MyClass This is my class */will open editor on MyClass.java file.
Colors c; swith(c) { case BLUE: case RED; // select RED }
Signature#WILDCARD_TYPE_SIGNATURE
.Signature#getTypeSignatureKind(char[])
and Signature#getTypeSignatureKind(String)
now return Signature#WILDCARD_TYPE_SIGNATURE
if the signature is a wildcard : * or +Ljava.lang.Object; or -Ljava.lang.Object;
X x = zzz<complete here>In this example the expected type is
X
. It is not mandatory to a proposal
to respect this expectation and it is possible that there is no completion proposal.
public class CompletionContext { public char[][] getExpectedTypesSignatures() {...} public char[][] getExpectedTypesKeys() {...} }Client must override
CompletionRequestor#acceptContext(..)
to know the context.
This method call ocurs after the call to beginReporting()
and before the call to any
accept(CompletionProposal)
method.
public class CompletionRequestor { ... public void acceptContext(CompletionContext context) {..} ... }
@Deprecated
annotations, and treats them equivalent
to doc comment /** @deprecated */
.
@Deprecated
annotation (to encourage using annotations instead of doc comment tag).
Corresponding problem IDs are: IProblem.FieldMissingDeprecatedAnnotation
,
IProblem.MethodMissingDeprecatedAnnotation
,
IProblem.TypeMissingDeprecatedAnnotation
.
* COMPILER / Reporting Missing @Deprecated Annotation * When enabled, the compiler will issue an error or a warning whenever encountering a declaration * carrying a @deprecated doc tag but has no corresponding @Deprecated annotation. * - option id: "org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation" * - possible values: { "error", "warning", "ignore" } * - default: "ignore"
MethodRefParameter
:
/** * The "varargs" structural property of this node type (added in JLS3 API). * @since 3.1 */ public static final SimplePropertyDescriptor VARARGS_PROPERTY; /** * Returns whether this method reference parameter is for * the last parameter of a variable arity method (added in JLS3 API). ** Note that the binding for the type
* * @returnFoo
in the vararg method * reference#fun(Foo...)
is always for the type as * written; i.e., the type binding forFoo
. However, if you * navigate from the MethodRef to its method binding to the * type binding for its last parameter, the type binding for the vararg * parameter is always an array type (i.e.,Foo[]
) reflecting * the way vararg methods get compiled. *true
if this is a variable arity parameter, * andfalse
otherwise * @exception UnsupportedOperationException if this operation is used in * a JLS2 AST * @since 3.1 */ public boolean isVarargs(); /** * Sets whether this method reference parameter is for the last parameter of * a variable arity method (added in JLS3 API). * * @param variableAritytrue
if this is a variable arity * parameter, andfalse
otherwise * @since 3.1 */ public void setVarargs(boolean variableArity);
IJavaSearchConstants
interface:
/** * Ignore declaring type while searching result. * Can be used in conjunction with any of the nature of match. * @since 3.1 */ int IGNORE_DECLARING_TYPE = 0x10; /** * Ignore return type while searching result. * Can be used in conjunction with any of the nature of match. * Note that: * - for fields search, pattern will ignore field type * - this flag will have no effect for types search * @since 3.1 */ int IGNORE_RETURN_TYPE = 0x20;Note that these flags are active only for search of declarations (ie.
IJavaSearchConstants.DECLARATIONS
and IJavaSearchConstants.ALL_OCCURRENCES
)
and while searching for IJavaElement (see doc of SearchPattern.createPattern(IJavaElement, int)
API method).
TypeNameRequestor
replaces interface ITypeNameRequestor
which is deprecated./** * Accepts a top-level or a member type. * * The default implementation of this method does nothing. * Subclasses should override. * * @param modifiers the modifier flags of the type. Note that for source type, * these flags may slightly differ from thoses get after resolution. * For example an interface defined byClients can now distinguish Annotation, Enum, Interface and Class usinginterface A {}
, although obviously public, * will be returned false byFlags.isPublic(modifiers)
due to the fact * that its declaration does not explicitely definepublic
flag. * @see org.eclipse.jdt.core.Flags * @param packageName the dot-separated name of the package of the type * @param simpleTypeName the simple name of the type * @param enclosingTypeNames if the type is a member type, * the simple names of the enclosing types from the outer-most to the * direct parent of the type (for example, if the class is x.y.A$B$C then * the enclosing types are [A, B]. This is an empty array if the type * is a top-level type. * @param path the full path to the resource containing the type. If the resource is a .class file * or a .java file, this is the full path in the workspace to this resource. If the * resource is an archive (that is, a .zip or .jar file), the path is composed of 2 paths separated * byIJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR
: * the first path is the full OS path to the archive (if it is an external archive), * or the workspace relativeIPath
to the archive (if it is an internal archive), * the second path is the path to the resource inside the archive. */ public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path)
Flags
API methods on modifiers
parameter.
JavaCore#newProjectEntry(IPath, IPath[], IPath[], boolean, IClasspathAttribute[], boolean)
that take a 'combineAccessRestrictions' flag to control whether access restrictions of exported libraries of the project
should be combined with the access restrictions of this project entry.
AST#newName(String qualifiedName)
for creating
SimpleName
or QualifiedName
nodes depending on the form of the given name string.
IProblem.MissingEnumConstantCase
* COMPILER / Reporting Incomplete Enum Switch * When enabled, the compiler will issue an error or a warning whenever an enum constant has * no corresponding case label in an enum switch statement * type has no case label matching an enum constant. * - option id: "org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch" * - possible values: { "error", "warning", "ignore" } * - default: "ignore"
org.eclipse.jdt.core.dom.CompilationUnit#getJavaElement()
to retrieve the compilation unit
or class file the compilation unit node was created from.
IMethodBinding#isSubsignature(IMethodBinding)
to find out if a method's signature
is a subsignature of another method.
@Override
annotation.
Corresponding problem ID is: IProblem.MissingOverrideAnnotation
* COMPILER / Reporting Missing @Override Annotation * When enabled, the compiler will issue an error or a warning whenever encountering a method * declaration which overrides a superclass method but has no @Override annotation. * - option id: "org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation" * - possible values: { "error", "warning", "ignore" } * - default: "ignore"
Colors c; swith(c) { case BLUE: case RED<complete here> }
@Annot(attr<complete here>=value)To propose this new completion kind a new API has been added: CompletionProposal.ANNOTATION_ATTRIBUTE_REF.
/** * Completion is a reference to annotation's attribute. * This kind of completion might occur in a context like * <code>"@Annot(attr^=value)"</code> and complete it to * <code>"@Annot(attribute^=value)"</code>. * <p> * The following additional context information is available * for this kind of completion proposal at little extra cost: * <ul> * <li>{@link #getDeclarationSignature()} - * the type signature of the annotation that declares the attribute that is referenced * </li> * <li>{@link #getFlags()} - * the modifiers flags of the attribute that is referenced * </li> * <li>{@link #getName()} - * the simple name of the attribute that is referenced * </li> * <li>{@link #getSignature()} - * the type signature of the attribute's type (as opposed to the * signature of the type in which the referenced attribute * is declared) * </li> * </ul> * </p> * * @see #getKind() */ public static final int ANNOTATION_ATTRIBUTE_REF = 13;
IClasspathEntry
: getAccessibleFiles()
and getNonAccessibleFiles()
.
These are valid only for library, project, container and variable entries. getInclusionPatterns()
and getExclusionPatterns()
temporary return the accessible files and non accessible files patterns for these entries.
IClasspathAttribute
). A classpath attribute
is created using JavaCore#newClasspathAttribute(String, String)
. Then one can associate this attribute with
a classpath entry using one of:
JavaCore#newContainerEntry(IPath containerPath, IPath[] accessibleFiles, IPath[] nonAccessibleFiles, IClasspathAttribute[] extraAttributes, boolean isExported)
JavaCore#newLibraryEntry(IPath path, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath, IPath[] accessibleFiles, IPath[] nonAccessibleFiles, IClasspathAttribute[] extraAttributes, boolean isExported)
JavaCore#newProjectEntry(IPath path, IPath[] accessibleFiles, IPath[] nonAccessibleFiles, IClasspathAttribute[] extraAttributes, boolean isExported)
JavaCore#newSourceEntry(IPath path, IPath[] inclusionPatterns, IPath[] exclusionPatterns, IPath specificOutputLocation, IClasspathAttribute[] extraAttributes)
JavaCore#newVariableEntry(IPath variablePath, IPath variableSourceAttachmentPath, IPath variableSourceAttachmentRootPath, IPath[] accessibleFiles, IPath[] nonAccessibleFiles, IClasspathAttribute[] extraAttributes, boolean isExported)
IProblem.TypeParameterHidingType
* COMPILER / Reporting Type Parameter Declaration Hiding another Type * When enabled, the compiler will issue an error or a warning whenever a type parameter * declaration is hiding some type. * - option id: "org.eclipse.jdt.core.compiler.problem.typeParameterHiding" * - possible values: { "error", "warning", "ignore" } * - default: "warning"
isInterface()
on Java element and DOM AST are now answering true
for annotation types. Indeed, annotation types are allowed to be implemented just like regular interfaces.
IProblem.AnnotationTypeUsedAsSuperInterface
* COMPILER / Reporting Use of Annotation Type as Super Interface * When enabled, the compiler will issue an error or a warning whenever an annotation type is used * as a super-interface. Though legal, this is discouraged. * - option id: "org.eclipse.jdt.core.compiler.problem.annotationSuperInterface" * - possible values: { "error", "warning", "ignore" } * - default: "warning"
IType#getKey()
, IField#getKey()
, IMethod#getKey()
that return a binding key for these Java elements.
IType#isResolved()
, IField#isResolved()
,
IMethod#isResolved()
that return whether these Java elements are resolved elements
and thus whether their key (see above) contains resolved information.
org.eclipse.jdt.core.BindingKey
to decode a binding key
obtained from IBinding#getKey()
or one of the getKey()
methods above.
SearchPattern.createPattern(IJavaElement,int,int)
providing searched ITypeParameter for IJavaElement parameter.
TypeParameter#resolveBinding()
now returns an ITypeBinding
instead of
an IBinding
public <U> void foo(U u){}
or <String>foo("")
for example).
This search can be done either selecting a JavaElement or using Java Search dialog.
JavaConventions#validateTypeVariableName(String)
.JavaCore#newTypeHierarchy(IRegion,WorkingCopyOwner,IProgressMonitor)
that creates a hierarchy
independently of a project.ASTParser#createBindings(IJavaElement[],IProgressMonitor)
to create the DOM bindings for the given
Java elements.IProblem.UnnecessaryArgumentCast
with IProblem.UnnecessaryCast
since it provided little additional value,
and was rather perceived as confusing. From now on, only IProblem.UnnecessaryCast
is reported.
IProblem.BoxingConversion
and IProblem.UnboxingConversion
.
* COMPILER / Reporting Boxing/Unboxing Conversion * When enabled, the compiler will issue an error or a warning whenever a boxing or an unboxing * conversion is performed. * - option id: "org.eclipse.jdt.core.compiler.problem.autoboxing" * - possible values: { "error", "warning", "ignore" } * - default: "ignore"
* COMPILER / Reporting Unchecked Type Operation * When enabled, the compiler will issue an error or a warning whenever an operation involves generic types, and potentially * invalidates type safety since involving raw types (e.g. invoking #foo(X<String>) with arguments (X)). * - option id: "org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation" * - possible values: { "error", "warning", "ignore" } * - default: "warning"
/** * Match rule: The search pattern matches search results as raw types or parameterized types with same erasure. * Example: * - pattern: List<Exception> * - match: List<Object> * Can be combined to all other match rules, e.g. {@link #R_CASE_SENSITIVE} | {@link #R_ERASURE_MATCH} * This rule is not activated by default, so raw types or parameterized types with same erasure will not be found * for pattern List<String>, * Note that with this pattern, the match selection will be only on the erasure even for parameterized types. * @since 3.1 */ public static final int R_ERASURE_MATCH = 16; /** * Match rule: The search pattern matches search results as raw types or parameterized types with equivalent type parameters. * Example: * - pattern: List<Exception> * - match: * + List<? extends Throwable> * + List<? super RuntimeException> * + List<?> * Can be combined to all other match rules, e.g. {@link #R_CASE_SENSITIVE} | {@link #R_EQUIVALENT_MATCH} * This rule is not activated by default, so raw types or equivalent parameterized types will not be found * for pattern List<String>, * This mode is overridden by {@link #R_ERASURE_MATCH} as erasure matches obviously include equivalent ones. * That means that pattern with rule set to {@link #R_EQUIVALENT_MATCH} | {@link #R_ERASURE_MATCH} * will return same results than rule only set with {@link #R_ERASURE_MATCH}. * @since 3.1 */ public static final int R_EQUIVALENT_MATCH = 32;Added new API method to make this flag settable even while creating pattern using a IJavaElement:
SearchPattern#createPattern(IJavaElement element, int limitTo, int matchRule)
SearchMatch#getRule()
SearchMatch#setRule(int)
public class List<T> {}
or List<String>
for example).
This search can of course be done either selecting a JavaElement (see following point) or using Java Search dialog.
ParameterizedSourceType
or ParameterizedBinaryType
.
When the result is a parameterized method invocation, the returned JavaElement is a
ParameterizedSourceMethod
or ParameterizedBinaryMethod
.
When the result is a field access to a generic type's field, the returned JavaElement is a
ParameterizedSourceField
or ParameterizedBinaryField
.
ITypeBinding#isAssignmentCompatible(ITypeBinding)
ITypeBinding#isCastCompatible(ITypeBinding)
ITypeBinding#isSubTypeCompatible(ITypeBinding)
IMethodBinding#overrides(IMethodBinding)
ASTParser#createASTs(ICompilationUnit[],String[],ASTRequestor,IProgressMonitor)
and ASTRequestor
.
METHOD_NAME_REFERENCE
.
This completion is a reference to a method name.
"import java.lang.Math.co^"
and complete it to
"import java.lang.Math.cos;"
.
ICompletionRequestor
was deprecated. Use CompletionRequestor
instead.
ASTParser#createASTs(ICompilationUnit[] compilationUnits, String[] bindingKeys, ASTRequestor requestor, IProgressMonitor monitor)
.
Note this API is still under development and subject to change without notice.
* COMPILER / Reporting Forbidden Reference to Type with Restricted Access * When enabled, the compiler will issue an error or a warning when referring to a type with restricted access, as defined according * to the access restriction specifications. * - option id: "org.eclipse.jdt.core.compiler.problem.forbiddenReference" * - possible values: { "error", "warning", "ignore" } * - default: "warning"
* CODEASSIST / Activate Access Restrictions Sensitive Completion * When active, completion doesn't show that is access restricted. * - option id: "org.eclipse.jdt.core.codeComplete.restrictionsCheck" * - possible values: { "enabled", "disabled" } * - default: "disabled"
org.eclipse.jdt.core.util.ClassFileBytesDisassembler#SYSTEM
field to support an extra-detailed output from the
disassembler. It can show constant pool contents.
org.eclipse.jdt.core.Signature
have been added to handle var args in the signature decoding.
Signature#toCharArray(char[],char[],char[][],boolean,boolean,boolean)
Signature#toString(String,String,String[],boolean,boolean,boolean)
IProblem.MethodVarargsArgumentNeedCast
& IProblem.ConstructorVarargsArgumentNeedCast
* COMPILER / Reporting Varargs Argument Needing a Cast in Method/Constructor Invocation * When enabled, the compiler will issue an error or a warning whenever a varargs arguments should be cast * when passed to a method/constructor invocation. (e.g. Class.getMethod(String name, Class ... args ) * invoked with arguments ("foo", null)). * - option id: "org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast" * - possible values: { "error", "warning", "ignore" } * - default: "warning"
* COMPILER / Reporting Invalid Javadoc Tags with Deprecated References * Specify whether the compiler will report deprecated references used in Javadoc tags. * Note that this diagnosis can be enabled based on the visibility of the construct associated with the Javadoc; * also see the setting "org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility". * - option id: "org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef" * - possible values: { "enabled", "disabled" } * - default: "enabled" * * COMPILER / Reporting Invalid Javadoc Tags with Not Visible References * Specify whether the compiler will report non-visible references used in Javadoc tags. * Note that this diagnosis can be enabled based on the visibility of the construct associated with the Javadoc; * also see the setting "org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility". * - option id: "org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef" * - possible values: { "enabled", "disabled" } * - default: "enabled" *
org.eclipse.jdt.core.dom.EnumDeclaration#enumConstants()
. The enum constants are now in a separate list
from the body declarations. The org.eclipse.jdt.core.dom.EnumDeclaration#getEnumConstants()
method has been deprecated and
will be removed after M3. See bug 76190 for further details.
CompletionRequestor
is implemented inside code assist engine.
IType
for new completion requestor support:
IType#codeComplete(char[],int,int,char[][],char[][],int[],boolean,CompletionRequestor,WorkingCopyOwner)
IType#codeComplete(char[],int,int,char[][],char[][],int[],boolean,CompletionRequestor)
IEvaluationContext
for new completion requestor support:
IEvaluationContext#codeComplete(String,int,CompletionRequestor, WorkingCopyOwner)
IEvaluationContext#codeComplete(String,int,CompletionRequestor)
Signature
to extract package name part or type name part of a type signature:
Signature#getSignatureQualifier(char[])
Signature#getSignatureQualifier(String)
Signature#getSignatureSimpleName(char[])
Signature#getSignatureSimpleName(String)
Flags.isVarargs(method.getFlags())
now returns whether the method is a varargs method.Problem: Libraries are usually packaged to contain both API for compile-time and implementation for runtime; and thus expose a superset of the API contract to client programs, allowing them to make forbidden assumptions on internals (a typical restriction for Eclipse developpers is to not use internal classes from prerequisite plug-ins). One solution for solving this issue is to separate the API from its implementation into 2 distinct libraries (compile-time/runtime) and then use the classpath rules to only include the API portion on the classpath for compiling. However, this usually proves to be unrealistic, since the API is often mixed with some implementation aspects (not officially part of the API) which are carrying references to its internals (supertype hierarchy, field or method signatures). When it happens, then the compiler needs the implementation also to be on the classpath in order to resolve all signatures appropriately; which goes back to the original problem of exposing too much to unaware clients.
Instead, we allowed classpath rules to be associated with some import restrictions so as to select portions
of prerequisite projects or libraries which are legal to use inside this project.
Access restrictions are expressed as inclusion/exclusion rules on classpath entries (using Ant fileset notation
for discriminating on package and/or file names, e.g. excluding='**/internal/'
would exclude
all types defined any internal
package),
and can be associated to project, library, classpath variable or classpath container classpath entries.
Note that restrictions are automatically combined along a classpath chain. For instance, if a classpath container entry is
associated with some restrictions, then when resolved to a set of entries, these will automatically inherit the
container restrictions (and could still provide further custom restrictions on a per entry basis).
When a forbidden reference to a restricted type is detected, the compiler will issue a problem which severity
can be controlled by JavaCore preference "org.eclipse.jdt.core.compiler.problem.forbiddenReference".
Corresponding problem marker ID is IProblem.ForbiddenReference
.
* COMPILER / Reporting Forbidden Reference to Type with Restricted Access * When enabled, the compiler will issue an error or a warning when referring to a type with restricted access, as defined according * to the access restriction specifications. * - option id: "org.eclipse.jdt.core.compiler.problem.forbiddenReference" * - possible values: { "error", "warning", "ignore" } * - default: "ignore"
In order to challenge this new functionality before leveraged in UI or PDE, Eclipse developpers need to perform the following two actions:
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>with
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins" excluding="**/internal/"/>
<workspace>\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.jdt.core.prefs
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warningNote: alternatively, it could be specified on a per project basis, by adding line to
<project>/.settings/org.eclipse.jdt.core.prefs
.
import static type.*; import static type.identifier;Java Search is also able to find referenced type, field and/or member in static imports but required the index version to be incremented.
List<String>
in Java Search text and search for type references.List<String> ls;Match(es) will be found if this field is used in the search scope.
java.lang.Math
.IBinding#getJavaElement()
to get the Java element corresponding to a
org.eclipse.jdt.core.dom.IBinding
.
ITypeParameter
s are no longer children of their IType
or IMethod
.
To get the type parameters of a type or a method use IType/IMethod#getTypeParameters()
.TypeParameter#ENABLED
has been removed.ICodeAssist#codeSelect()
) return a ITypeParameter
when a type
parameter is selected.* COMPILER / Reporting Usage of 'enum' Identifier * When enabled, the compiler will issue an error or a warning whenever 'enum' is * used as an identifier (reserved keyword in 1.5) * - option id: "org.eclipse.jdt.core.compiler.problem.enumIdentifier" * - possible values: { "error", "warning", "ignore" } * - default: "warning"
ITypeParameter
that represents a formal type parameter in a generic type or method.
Note types and methods should have type parameters as children, but this is currently disabled as JDT UI doesn't support
this kind of element yet.
To enable set org.eclipse.jdt.internal.core.TypeParameter#ENABLED
to true
.* COMPILER / Reporting Missing Declaration of serialVersionUID Field on Serializable Class * When enabled, the compiler will issue an error or a warning whenever a serializable class is missing a local declaration * of a serialVersionUID field. This field must be declared as static final and be of type long. * - option id: "org.eclipse.jdt.core.compiler.problem.missingSerialVersion" * - possible values: { "error", "warning", "ignore" } * - default: "warning"
isConstructor()
and isSynthetic()
getters to MethodReferenceMatch.
SearchRequestor
) accepts this kind of match,
it can now distinguish between method and constructor reference matches. It can also know
if a constructor reference match is a default constructor or use an implicit super call.
* COMPILER / Setting Compliance Level * Select the compliance level for the compiler. In "1.3" mode, source and target settings * should not go beyond "1.3" level. * - option id: "org.eclipse.jdt.core.compiler.compliance" * - possible values: { "1.3", "1.4", "1.5" } * - default: "1.4" * * COMPILER / Setting Source Compatibility Mode * Specify whether which source level compatibility is used. From 1.4 on, 'assert' is a keyword * reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM * level should be set to "1.4" and the compliance mode should be "1.4". * Source level 1.5 is necessary to enable generics, autoboxing, covariance, annotations, enumerations * enhanced for loop, static imports and varargs. Once toggled, the target VM level should be set to "1.5" * and the compliance mode should be "1.5". * - option id: "org.eclipse.jdt.core.compiler.source" * - possible values: { "1.3", "1.4", "1.5" } * - default: "1.3" * * COMPILER / Defining Target Java Platform * For binary compatibility reason, .class files can be tagged to with certain VM versions and later. * Note that "1.4" target require to toggle compliance mode to "1.4" too. Similarily, "1.5" target require * to toggle compliance mode to "1.5". * - option id: "org.eclipse.jdt.core.compiler.codegen.targetPlatform" * - possible values: { "1.1", "1.2", "1.3", "1.4", "1.5" } * - default: "1.2" * * COMPILER / Reporting Unsafe Type Operation * When enabled, the compiler will issue an error or a warning whenever an operation involves generic types, and potentially * invalidates type safety since involving raw types (e.g. invoking #foo(X<String>) with arguments (X)). * - option id: "org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation" * - possible values: { "error", "warning", "ignore" } * - default: "warning" * * COMPILER / Reporting final Bound for Type Parameter * When enabled, the compiler will issue an error or a warning whenever a generic type parameter is associated with a * bound corresponding to a final type; since final types cannot be further extended, the parameter is pretty useless. * - option id: "org.eclipse.jdt.core.compiler.problem.finalParameterBound" * - possible values: { "error", "warning", "ignore" } * - default: "ignore"