JDK_1_5-Merge with HEAD: v_419a
diff --git a/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties b/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
index 75c9703..d7978ee 100644
--- a/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
+++ b/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
@@ -12,7 +12,7 @@
### compiler
compiler.name = Eclipse Java Compiler
-compiler.version = 0.419_1.5
+compiler.version = 0.420_1.5
compiler.copyright = Copyright IBM Corp 2000, 2004. All rights reserved.
### scanning
diff --git a/buildnotes_jdt-core.html b/buildnotes_jdt-core.html
index 889144e..2fab5ff 100644
--- a/buildnotes_jdt-core.html
+++ b/buildnotes_jdt-core.html
@@ -96,6 +96,24 @@
[1.5] ArrayStoreException in 1.5 parser
+<a name="v_420"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes <br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M9 Build - ?th March 2004
+<br>Project org.eclipse.jdt.core v_420
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_420">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=56462">56462</a>
+[formatter] java profile; array initializer before closing brace
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=56449">56449</a>
+Need to know if a reference match is in Javadoc or in Code
+
<a name="v_419"></a>
<p><hr><h1>
Eclipse Platform Build Notes <br>
@@ -107,17 +125,16 @@
What's new in this drop</h2>
<ul>
<li>Replaced "name" property of ParameterizedType node (DOM/AST)
-by "type" property. The old methods and fields (added earlier in 3.0 cycle)
+with "type" property. The old methods and fields (added earlier in 3.0 cycle)
are deprecated and will be removed shortly.</li>
<li>Added typeParameters property to ClassInstanceCreation node (DOM/AST).</li>
+<li>Package org.eclipse.jdt.core.internal.dom.rewrite renamed to org.eclipse.jdt.internal.core.dom.rewrite.</li>
</ul>
<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55930">55930</a>
-File encoding should be used on save
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55478">55478</a>
-Unused import not reported in IDE
-
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=56316">56316</a>
+JavaProject exists should not populate
+
<a name="v_418"></a>
<p><hr><h1>
Eclipse Platform Build Notes <br>
diff --git a/dom/org/eclipse/jdt/core/dom/AST.java b/dom/org/eclipse/jdt/core/dom/AST.java
index 9bbeb05..5066834 100644
--- a/dom/org/eclipse/jdt/core/dom/AST.java
+++ b/dom/org/eclipse/jdt/core/dom/AST.java
@@ -1325,23 +1325,11 @@
return (CompilationUnit) result;
}
/**
- * Added this method back so that one can patch a I20040219 build.
- * @deprecated
- * TODO (jerome) remove before 3.0 M8
- */
- public static CompilationUnit parsePartialCompilationUnit(
- ICompilationUnit unit,
- int position,
- boolean resolveBindings) {
-
- return parsePartialCompilationUnit(unit, position, resolveBindings, null, null);
- }
- /**
* Parses the source string of the given Java model compilation unit element
* and creates and returns an abridged abstract syntax tree. This method
* differs from
- * {@link #parseCompilationUnit(ICompilationUnit,boolean,WorkingCopyOwner)
- * parseCompilationUnit(ICompilationUnit,boolean,WorkingCopyOwner)} only in
+ * {@link #parseCompilationUnit(ICompilationUnit,boolean,WorkingCopyOwner,IProgressMonitor)
+ * parseCompilationUnit(ICompilationUnit,boolean,WorkingCopyOwner,IProgressMonitor)} only in
* that the resulting AST does not have nodes for the entire compilation
* unit. Rather, the AST is only fleshed out for the node that include
* the given source position. This kind of limited AST is sufficient for
@@ -1373,8 +1361,8 @@
* </p>
* <p>
* In all other respects, this method works the same as
- * {@link #parseCompilationUnit(ICompilationUnit,boolean,WorkingCopyOwner)
- * parseCompilationUnit(ICompilationUnit,boolean,WorkingCopyOwner)}.
+ * {@link #parseCompilationUnit(ICompilationUnit,boolean,WorkingCopyOwner,IProgressMonitor)
+ * parseCompilationUnit(ICompilationUnit,boolean,WorkingCopyOwner,IProgressMonitor)}.
* The source string is obtained from the Java model element using
* <code>ICompilationUnit.getSource()</code>.
* </p>
diff --git a/dom/org/eclipse/jdt/core/dom/ClassInstanceCreation.java b/dom/org/eclipse/jdt/core/dom/ClassInstanceCreation.java
index 651a9dd..9fa4df8 100644
--- a/dom/org/eclipse/jdt/core/dom/ClassInstanceCreation.java
+++ b/dom/org/eclipse/jdt/core/dom/ClassInstanceCreation.java
@@ -28,8 +28,8 @@
* <pre>
* ClassInstanceCreation:
* [ Expression <b>.</b> ]
- * [ <b><</b> Type { <b>,</b> Type } <b>></b> ]
- * <b>new</b> Type <b>(</b> [ Expression { <b>,</b> Expression } ] <b>)</b>
+ * <b>new</b> [ <b><</b> Type { <b>,</b> Type } <b>></b> ]
+ * Type <b>(</b> [ Expression { <b>,</b> Expression } ] <b>)</b>
* [ AnonymousClassDeclaration ]
* </pre>
* <p>
@@ -395,7 +395,7 @@
return this.typeArguments;
}
-/**
+ /**
* Returns the name of the type instantiated in this class instance
* creation expression (2.0 API only).
*
diff --git a/dom/org/eclipse/jdt/core/dom/NumberLiteral.java b/dom/org/eclipse/jdt/core/dom/NumberLiteral.java
index aa1d085..65e5387 100644
--- a/dom/org/eclipse/jdt/core/dom/NumberLiteral.java
+++ b/dom/org/eclipse/jdt/core/dom/NumberLiteral.java
@@ -177,11 +177,11 @@
case TerminalTokens.TokenNameLongLiteral:
break;
default:
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("Invalid number literal : >" + token + "<"); //$NON-NLS-1$//$NON-NLS-2$
}
break;
default:
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("Invalid number literal : >" + token + "<");//$NON-NLS-1$//$NON-NLS-2$
}
} catch(InvalidInputException e) {
throw new IllegalArgumentException();
diff --git a/dom/org/eclipse/jdt/core/dom/rewrite/ITrackedNodePosition.java b/dom/org/eclipse/jdt/core/dom/rewrite/ITrackedNodePosition.java
index 4138e7d..55a0ee1 100644
--- a/dom/org/eclipse/jdt/core/dom/rewrite/ITrackedNodePosition.java
+++ b/dom/org/eclipse/jdt/core/dom/rewrite/ITrackedNodePosition.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.jdt.core.dom.rewrite;
-import org.eclipse.jdt.core.dom.ASTNode;
-
/**
* A tracked node position is returned when a rewrite change is
* requested to be tracked.
@@ -19,7 +17,7 @@
* This interface is not intended to be implemented by clients.
* </p>
*
- * @see ASTRewrite#track(ASTNode)
+ * @see ASTRewrite#track(org.eclipse.jdt.core.dom.ASTNode)
* @since 3.0
*/
public interface ITrackedNodePosition {
diff --git a/dom/org/eclipse/jdt/core/dom/rewrite/ListRewrite.java b/dom/org/eclipse/jdt/core/dom/rewrite/ListRewrite.java
index 3ad5122..7d1c8b9 100644
--- a/dom/org/eclipse/jdt/core/dom/rewrite/ListRewrite.java
+++ b/dom/org/eclipse/jdt/core/dom/rewrite/ListRewrite.java
@@ -16,7 +16,6 @@
import org.eclipse.text.edits.TextEditGroup;
import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.ChildListPropertyDescriptor;
import org.eclipse.jdt.core.dom.FieldDeclaration;
import org.eclipse.jdt.core.dom.Statement;
import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor;
@@ -32,7 +31,7 @@
* <p>
* This class is not intended to be subclassed.
* </p>
- * @see ASTRewrite#getListRewrite(ASTNode, ChildListPropertyDescriptor)
+ * @see ASTRewrite#getListRewrite(ASTNode, org.eclipse.jdt.core.dom.ChildListPropertyDescriptor)
* @since 3.0
*/
public final class ListRewrite {
diff --git a/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java b/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
index 8d12ae4..f0d9358 100644
--- a/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
+++ b/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
@@ -48,6 +48,7 @@
import org.eclipse.jdt.internal.core.dom.rewrite.NodeInfoStore.CopyPlaceholderData;
import org.eclipse.jdt.internal.core.dom.rewrite.NodeInfoStore.StringPlaceholderData;
import org.eclipse.jdt.internal.core.dom.rewrite.RewriteEventStore.CopySourceInfo;
+import org.eclipse.jdt.internal.core.util.Util;
/**
@@ -2600,7 +2601,7 @@
}
void handleException(Throwable e) {
+ Util.log(e, e.getMessage());
throw new RewriteRuntimeException(e);
}
-
}
diff --git a/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java b/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java
index 26e74d4..25338dd 100644
--- a/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java
+++ b/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java
@@ -1545,7 +1545,7 @@
this.insert_space_after_unary_operator = false;
this.insert_space_before_assignment_operator = true;
this.insert_space_before_binary_operator = true;
- this.insert_space_before_closing_brace_in_array_initializer = false;
+ this.insert_space_before_closing_brace_in_array_initializer = true;
this.insert_space_before_closing_bracket_in_array_allocation_expression = false;
this.insert_space_before_closing_bracket_in_array_reference = false;
this.insert_space_before_closing_paren_in_cast = false;
diff --git a/model/org/eclipse/jdt/core/CompletionProposal.java b/model/org/eclipse/jdt/core/CompletionProposal.java
new file mode 100644
index 0000000..743a0f6
--- /dev/null
+++ b/model/org/eclipse/jdt/core/CompletionProposal.java
@@ -0,0 +1,836 @@
+/*******************************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.compiler.CharOperation;
+
+/**
+ * Completion proposal.
+ * <p>
+ * In typical usage, the user working in a Java code editor issues
+ * a code assist command. This command results in a call to
+ * <code>ICodeAssist.codeComplete(position, completionRequestor)</code>
+ * passing the current position in the source code. The code assist
+ * engine analyzes the code in the buffer, determines what kind of
+ * Java language construct is at that position, and proposes ways
+ * to complete that construct. These proposals are instances of
+ * subclasses of <code>CompletionProposal</code>. These proposals,
+ * perhaps after sorting and filtering, are presented to the user
+ * to make a choice.
+ * </p>
+ * <p>
+ * The proposal is as follows: insert
+ * the {@linkplain #getCompletion() completion string} into the
+ * source file buffer, replacing the characters between
+ * {@linkplain #getReplaceStart()() the start}
+ * and {@linkplain #getReplaceEnd()() end}. The string
+ * can be arbitrary; for example, it might include not only the
+ * name of a method but a set of parentheses. Moreover, the source
+ * range may include source positions before or after the source
+ * position where <code>ICodeAssist.codeComplete</code> was invoked.
+ * The rest of the information associated with the proposal is
+ * to provide context that may help a user to choose from among
+ * competing proposals.
+ * </p>
+ *
+ * @see ICodeAssist#codeComplete(int, CompletionRequestor)
+ */
+public class CompletionProposal {
+
+ /**
+ * Completion is a declaration of an anonymous class.
+ * This kind of completion might occur in a context like
+ * <code>"new List^;"</code> and complete it to
+ * <code>"new List() {}"</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 type being implemented or subclassed
+ * </li>
+ * </li>
+ * <li>{@link #getSignature()} -
+ * the method signature of the constructor that is referenced
+ * </li>
+ * <li>{@link #getFlags()} -
+ * the modifiers flags of the constructor that is referenced
+ * </li>
+ * </ul>
+ * </p>
+ *
+ * @see #getKind()
+ */
+ public static final int ANONYMOUS_CLASS_DECLARATION = 1;
+
+ /**
+ * Completion is a reference to a field.
+ * This kind of completion might occur in a context like
+ * <code>"this.ref^ = 0;"</code> and complete it to
+ * <code>"this.refcount = 0;"</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 type that declares the field that is referenced
+ * </li>
+ * <li>{@link #getFlags()} -
+ * the modifiers flags (including ACC_ENUM) of the field that is referenced
+ * </li>
+ * <li>{@link #getName()} -
+ * the simple name of the field that is referenced
+ * </li>
+ * <li>{@link #getSignature()} -
+ * the type signature of the field's type (as opposed to the
+ * signature of the type in which the referenced field
+ * is declared)
+ * </li>
+ * </ul>
+ * </p>
+ *
+ * @see #getKind()
+ */
+ public static final int FIELD_REF = 2;
+
+ /**
+ * Completion is a keyword.
+ * This kind of completion might occur in a context like
+ * <code>"public cl^ Foo {}"</code> and complete it to
+ * <code>"public class Foo {}"</code>.
+ * <p>
+ * The following additional context information is available
+ * for this kind of completion proposal at little extra cost:
+ * <ul>
+ * <li>{@link #getName()} -
+ * the keyword token
+ * </li>
+ * <li>{@link #getFlags()} -
+ * the corresponding modifier flags if the keyword is a modifier
+ * </li>
+ * </ul>
+ * </p>
+ *
+ * @see #getKind()
+ */
+ public static final int KEYWORD = 3;
+
+ /**
+ * Completion is a reference to a label.
+ * This kind of completion might occur in a context like
+ * <code>"break lo^;"</code> and complete it to
+ * <code>"break loop;"</code>.
+ * <p>
+ * The following additional context information is available
+ * for this kind of completion proposal at little extra cost:
+ * <ul>
+ * <li>{@link #getName()} -
+ * the simple name of the label that is referenced
+ * </li>
+ * </ul>
+ * </p>
+ *
+ * @see #getKind()
+ */
+ public static final int LABEL_REF = 4;
+
+ /**
+ * Completion is a reference to a local variable.
+ * This kind of completion might occur in a context like
+ * <code>"ke^ = 4;"</code> and complete it to
+ * <code>"keys = 4;"</code>.
+ * <p>
+ * The following additional context information is available
+ * for this kind of completion proposal at little extra cost:
+ * <ul>
+ * <li>{@link #getFlags()} -
+ * the modifiers flags of the local variable that is referenced
+ * </li>
+ * <li>{@link #getName()} -
+ * the simple name of the local variable that is referenced
+ * </li>
+ * <li>{@link #getSignature()} -
+ * the type signature of the local variable's type
+ * </li>
+ * </ul>
+ * </p>
+ *
+ * @see #getKind()
+ */
+ public static final int LOCAL_VARIABLE_REF = 5;
+
+ /**
+ * Completion is a reference to a method.
+ * This kind of completion might occur in a context like
+ * <code>"System.out.pr^();"</code> and complete it to
+ * <code>""System.out.println();"</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 type that declares the method that is referenced
+ * </li>
+ * <li>{@link #getFlags()} -
+ * the modifiers flags of the method that is referenced
+ * </li>
+ * <li>{@link #getName()} -
+ * the simple name of the method that is referenced
+ * </li>
+ * <li>{@link #getSignature()} -
+ * the method signature of the method that is referenced
+ * </li>
+ * </ul>
+ * </p>
+ *
+ * @see #getKind()
+ */
+ public static final int METHOD_REF = 6;
+
+ /**
+ * Completion is a declaration of a method.
+ * This kind of completion might occur in a context like
+ * <code>"new List() {int si^};"</code> and complete it to
+ * <code>"new List() {public int size() {} };"</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 type that declares the abstract
+ * method that is being overridden or implemented
+ * </li>
+ * <li>{@link #getName()} -
+ * the simple name of the method that is being overridden
+ * or implemented
+ * </li>
+ * <li>{@link #getSignature()} -
+ * the method signature of the method that is being
+ * overridden or implemented
+ * </li>
+ * <li>{@link #getFlags()} -
+ * the modifiers flags of the method that is being
+ * overridden or implemented
+ * </li>
+ * </ul>
+ * </p>
+ *
+ * @see #getKind()
+ */
+ public static final int METHOD_DECLARATION = 7;
+
+ /**
+ * Completion is a reference to a package.
+ * This kind of completion might occur in a context like
+ * <code>"import java.u^.*;"</code> and complete it to
+ * <code>"import java.util.*;"</code>.
+ * <p>
+ * The following additional context information is available
+ * for this kind of completion proposal at little extra cost:
+ * <ul>
+ * <li>{@link #getDeclarationSignature()} -
+ * the dot-based package signature of the package that is referenced
+ * </li>
+ * </ul>
+ * </p>
+ *
+ * @see #getKind()
+ */
+ public static final int PACKAGE_REF = 8;
+
+ /**
+ * Completion is a reference to a type. Any kind of type
+ * is allowed, including primitive types, reference types,
+ * array types, parameterized types, and type variables.
+ * This kind of completion might occur in a context like
+ * <code>"public static Str^ key;"</code> and complete it to
+ * <code>"public static String key;"</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 type that is referenced
+ * </li>
+ * <li>{@link #getFlags()} -
+ * the modifiers flags (including Flags.AccInterface, AccEnum,
+ * and AccAnnotation) of the type that is referenced
+ * </li>
+ * </ul>
+ * </p>
+ *
+ * @see #getKind()
+ */
+ public static final int TYPE_REF = 9;
+
+ /**
+ * Completion is a declaration of a variable.
+ * <p>
+ * The following additional context information is available
+ * for this kind of completion proposal at little extra cost:
+ * <ul>
+ * <li>{@link #getName()} -
+ * the simple name of the local variable being declared
+ * </li>
+ * <li>{@link #getSignature()} -
+ * the type signature of the type of the local variable
+ * being declared
+ * </li>
+ * <li>{@link #getFlags()} -
+ * the modifiers flags of the local variable being declared
+ * </li>
+ * </ul>
+ * </p>
+ * TODO (jeem) - Add example of these
+ * @see #getKind()
+ */
+ public static final int VARIABLE_DECLARATION = 10;
+
+ /**
+ * Kind of completion request.
+ */
+ private int completionKind;
+
+ /**
+ * Offset in original buffer where ICodeAssist.codeComplete() was
+ * requested.
+ */
+ private int completionLocation;
+
+ /**
+ * Start position (inclusive) of source range in original buffer
+ * containing the relevant token
+ * defaults to empty subrange at [0,0).
+ */
+ private int tokenStart = 0;
+
+ /**
+ * End position (exclusive) of source range in original buffer
+ * containing the relevant token;
+ * defaults to empty subrange at [0,0).
+ */
+ private int tokenEnd = 0;
+
+ /**
+ * Completion string; defaults to empty string.
+ */
+ private char[] completion = CharOperation.NO_CHAR;
+
+ /**
+ * Start position (inclusive) of source range in original buffer
+ * to be replaced by completion string;
+ * defaults to empty subrange at [0,0).
+ */
+ private int replaceStart = 0;
+
+ /**
+ * End position (exclusive) of source range in original buffer
+ * to be replaced by completion string;
+ * defaults to empty subrange at [0,0).
+ */
+ private int replaceEnd = 0;
+
+ /**
+ * Relevance rating; positive; higher means better;
+ * defaults to minimum rating.
+ */
+ private int relevance = 1;
+
+ /**
+ * Signature of the relevant package or type declaration
+ * in the context, or <code>null</code> if none.
+ * Defaults to null.
+ */
+ private char[] declarationSignature = null;
+
+ /**
+ * Simple name of the method, field,
+ * member, or variable relevant in the context, or
+ * <code>null</code> if none.
+ * Defaults to null.
+ */
+ private char[] name = null;
+
+ /**
+ * Signature of the method, field type, member type,
+ * relevant in the context, or <code>null</code> if none.
+ * Defaults to null.
+ */
+ private char[] signature = null;
+
+ /**
+ * Modifier flags relevant in the context, or
+ * <code>Flags.AccDefault</code> if none.
+ * Defaults to <code>Flags.AccDefault</code>.
+ */
+ private int flags = Flags.AccDefault;
+
+ /**
+ * Creates a basic completion proposal. All instance
+ * field have plausible default values unless otherwise noted.
+ * <p>
+ * Note that the constructors for this class are internal to the
+ * Java model implementation. Clients cannot directly create
+ * CompletionProposal objects.
+ * </p>
+ *
+ * @param kind one of the kind constants declared on this class
+ * @param completionOffset original offset of code completion request
+ */
+ public CompletionProposal create(int kind, int completionOffset) {
+ return new CompletionProposal(kind, completionOffset);
+ }
+
+ /**
+ * Creates a basic completion proposal. All instance
+ * field have plausible default values unless otherwise noted.
+ * <p>
+ * Note that the constructors for this class are internal to the
+ * Java model implementation. Clients cannot directly create
+ * CompletionProposal objects.
+ * </p>
+ *
+ * @param kind one of the kind constants declared on this class
+ * @param completionLocation original offset of code completion request
+ */
+ CompletionProposal(int kind, int completionLocation) {
+ if ((kind < CompletionProposal.ANONYMOUS_CLASS_DECLARATION)
+ || (kind > CompletionProposal.VARIABLE_DECLARATION)) {
+ throw new IllegalArgumentException();
+ }
+ if (completion == null || completionLocation < 0) {
+ throw new IllegalArgumentException();
+ }
+ this.completionKind = kind;
+ this.completionLocation = completionLocation;
+ }
+
+ /**
+ * Returns the kind of completion being proposed.
+ * <p>
+ * The set of different kinds of completion proposals is
+ * expected to change over time. It is strongly recommended
+ * that clients do <b>not</b> assume that the kind is one of the
+ * ones they know about, and code defensively for the
+ * possibility of unexpected future growth.
+ * </p>
+ *
+ * @return the kind; one of the kind constants
+ * declared on this class, or possibly a kind unknown
+ * to the caller
+ */
+ public int getKind() {
+ return this.completionKind;
+ }
+
+ /**
+ * Returns the character index in the source file buffer
+ * where source completion was requested (the
+ * <code>offset</code>parameter to
+ * <code>ICodeAssist.codeComplete</code>.
+ *
+ * @return character index in source file buffer
+ * @see ICodeAssist#codeComplete(int,CompletionRequestor)
+ */
+ public int getCompletionLocation() {
+ return this.completionLocation;
+ }
+
+ /**
+ * 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)
+ */
+ public int getTokenStart() {
+ return this.tokenStart;
+ }
+
+ /**
+ * 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>getEndToken() == getStartToken()</code>).
+ *
+ * @return character index of token end position (exclusive)
+ */
+ public int getTokenEnd() {
+ return this.tokenEnd;
+ }
+
+ /**
+ * Sets the character indices 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 source range begins at original
+ * request offset and is empty.
+ * <p>
+ * If not set, defaults to empty subrange at [0,0).
+ * </p>
+ *
+ * @param startIndex character index of token start position (inclusive)
+ * @param endIndex character index of token end position (exclusive)
+ */
+ public void setTokenRange(int startIndex, int endIndex) {
+ if (startIndex < 0 || endIndex < startIndex) {
+ throw new IllegalArgumentException();
+ }
+ this.tokenStart = startIndex;
+ this.tokenEnd = endIndex;
+ }
+
+ /**
+ * Returns the proposed sequence of characters to insert into the
+ * source file buffer, replacing the characters at the specified
+ * source range. The string can be arbitrary; for example, it might
+ * include not only the name of a method but a set of parentheses.
+ * <p>
+ * The client must not modify the array returned.
+ * </p>
+ *
+ * @return the completion string
+ */
+ public char[] getCompletion() {
+ return this.completion;
+ }
+
+ /**
+ * Returns the proposed sequence of characters to insert into the
+ * source file buffer, replacing the characters at the specified
+ * source range. The string can be arbitrary; for example, it might
+ * include not only the name of a method but a set of parentheses.
+ * <p>
+ * If not set, defaults to an empty character array.
+ * </p>
+ *
+ * @param completion the completion string
+ */
+ public void setCompletion(char[] completion) {
+ this.completion = completion;
+ }
+
+ /**
+ * Returns the character index of the start of the
+ * subrange in the source file buffer to be replaced
+ * by the completion string. If the subrange is empty
+ * (<code>getReplaceEnd() == getReplaceStart()</code>),
+ * the completion string is to be inserted at this
+ * index.
+ * <p>
+ * Note that while the token subrange is precisely
+ * specified, the replacement range is loosely
+ * constrained and may not bear any direct relation
+ * to the original request offset. For example, a
+ * it would be possible for a type completion to
+ * propose inserting an import declaration at the
+ * top of the compilation unit; or the completion
+ * might include trailing parentheses and
+ * punctuation for a method completion.
+ * </p>
+ *
+ * @return replacement start position (inclusive)
+ */
+ public int getReplaceStart() {
+ return this.replaceStart;
+ }
+
+ /**
+ * Returns the character index of the end of the
+ * subrange in the source file buffer to be replaced
+ * by the completion string. If the subrange is empty
+ * (<code>getReplaceEnd() == getReplaceStart()</code>),
+ * the completion string is to be inserted at this
+ * index.
+ *
+ * @return replacement end position (exclusive)
+ */
+ public int getReplaceEnd() {
+ return this.replaceEnd;
+ }
+
+ /**
+ * Sets the character indices of the subrange in the
+ * source file buffer to be replaced by the completion
+ * string. If the subrange is empty
+ * (<code>startIndex == endIndex</code>),
+ * the completion string is to be inserted at this
+ * index.
+ * <p>
+ * If not set, defaults to empty subrange at [0,0).
+ * </p>
+ *
+ * @param startIndex character index of replacement start position (inclusive)
+ * @param endIndex character index of replacement end position (exclusive)
+ */
+ public void setReplaceRange(int startIndex, int endIndex) {
+ if (startIndex < 0 || endIndex < startIndex) {
+ throw new IllegalArgumentException();
+ }
+ this.replaceStart = startIndex;
+ this.replaceEnd = endIndex;
+ }
+
+ /**
+ * Returns the relative relevance rating of this proposal.
+ *
+ * @return relevance rating of this proposal; ratings are positive; higher means better
+ */
+ public int getRelevance() {
+ return this.relevance;
+ }
+
+ /**
+ * Sets the relative relevance rating of this proposal.
+ * <p>
+ * If not set, defaults to the lowest possible rating (1).
+ * </p>
+ *
+ * @param rating relevance rating of this proposal; ratings are positive; higher means better
+ */
+ public void setRelevance(int rating) {
+ if (rating <= 0) {
+ throw new IllegalArgumentException();
+ }
+ this.relevance = rating;
+ }
+
+ /**
+ * Returns the type or package signature of the relevant
+ * declaration in the context, or <code>null</code> if none.
+ * <p>
+ * This field is available for the following kinds of
+ * completion proposals:
+ * <ul>
+ * <li><code>ANONYMOUS_CLASS_DECLARATION</code> - type signature
+ * of the type that is being subclassed or implemented</li>
+ * <li><code>FIELD_REF</code> - type signature
+ * of the type that declares the field that is referenced</li>
+ * <li><code>METHOD_REF</code> - type signature
+ * of the type that declares the method that is referenced</li>
+ * <li><code>METHOD_DECLARATION</code> - type signature
+ * of the type that declares the method that is being
+ * implemented or overridden</li>
+ * <li><code>PACKAGE_REF</code> - dot-based package
+ * signature of the package that is referenced</li>
+ * <li><code>TYPE_REF</code> - type signature
+ * of the type that is referenced</li>
+ * </ul>
+ * For kinds of completion proposals, this method returns
+ * <code>null</code>. Clients must not modify the array
+ * returned.
+ * </p>
+ *
+ * @return the declaration signature, or
+ * <code>null</code> if none
+ * @see Signature
+ */
+ public char[] getDeclarationSignature() {
+ return this.declarationSignature;
+ }
+
+ /**
+ * Sets the type or package signature of the relevant
+ * declaration in the context, or <code>null</code> if none.
+ * <p>
+ * If not set, defaults to none.
+ * </p>
+ *
+ * @param signature the type or package signature, or
+ * <code>null</code> if none
+ */
+ public void setDeclarationSignature(char[] signature) {
+ this.declarationSignature = signature;
+ }
+
+ /**
+ * Returns the simple name of the method, field,
+ * member, or variable relevant in the context, or
+ * <code>null</code> if none.
+ * <p>
+ * This field is available for the following kinds of
+ * completion proposals:
+ * <ul>
+ * <li><code>FIELD_REF</code> - the name of the field</li>
+ * <li><code>KEYWORD</code> - the keyword</li>
+ * <li><code>LABEL_REF</code> - the name of the label</li>
+ * <li><code>LOCAL_VARIABLE_REF</code> - the name of the local variable</li>
+ * <li><code>METHOD_REF</code> - the name of the method</li>
+ * <li><code>METHOD_DECLARATION</code> - the name of the method</li>
+ * <li><code>VARIABLE_DECLARATION</code> - the name of the variable</li>
+ * </ul>
+ * For kinds of completion proposals, this method returns
+ * <code>null</code>. Clients must not modify the array
+ * returned.
+ * </p>
+ *
+ * @return the keyword, field, method, local variable, or member
+ * name, or <code>null</code> if none
+ */
+ public char[] getName() {
+ return this.name;
+ }
+
+
+ /**
+ * Sets the simple name of the method, field,
+ * member, or variable relevant in the context, or
+ * <code>null</code> if none.
+ * <p>
+ * If not set, defaults to none.
+ * </p>
+ *
+ * @param name the keyword, field, method, local variable,
+ * or member name, or <code>null</code> if none
+ */
+ public void setName(char[] name) {
+ this.name = name;
+ }
+
+ /**
+ * Returns the signature of the method, field type, member type,
+ * relevant in the context, or <code>null</code> if none.
+ * <p>
+ * This field is available for the following kinds of
+ * completion proposals:
+ * <ul>
+ * <li><code>ANONYMOUS_CLASS_DECLARATION</code> - method signature
+ * of the constructor that is being invoked</li>
+ * <li><code>FIELD_REF</code> - the type signature
+ * of the referenced field's type</li>
+ * <li><code>LOCAL_VARIABLE_REF</code> - the type signature
+ * of the referenced local variable's type</li>
+ * <li><code>METHOD_REF</code> - method signature
+ * of the method that is referenced</li>
+ * <li><code>METHOD_DECLARATION</code> - method signature
+ * of the method that is being implemented or overridden</li>
+ * <li><code>VARIABLE_DECLARATION</code> - the type signature
+ * of the type of the variable being declared</li>
+ * </ul>
+ * For kinds of completion proposals, this method returns
+ * <code>null</code>. Clients must not modify the array
+ * returned.
+ * </p>
+
+ * </p>
+ *
+ * @return the signature, or <code>null</code> if none
+ * @see Signature
+ */
+ public char[] getSignature() {
+ return this.signature;
+ }
+
+ /**
+ * Sets the signature of the method, field type, member type,
+ * relevant in the context, or <code>null</code> if none.
+ * <p>
+ * If not set, defaults to none.
+ * </p>
+ *
+ * @param signature the signature, or <code>null</code> if none
+ */
+ public void setSignature(char[] signature) {
+ this.signature = signature;
+ }
+
+ /**
+ * Returns the modifier flags relevant in the context, or
+ * <code>Flags.AccDefault</code> if none.
+ * <p>
+ * This field is available for the following kinds of
+ * completion proposals:
+ * <ul>
+ * <li><code>ANONYMOUS_CLASS_DECLARATION</code> - modifier flags
+ * of the constructor that is referenced</li>
+ * <li><code>FIELD_REF</code> - modifier flags
+ * of the field that is referenced;
+ * <code>Flags.AccEnum</code> can be used to recognize
+ * references to enum constants
+ * </li>
+ * <li><code>KEYWORD</code> - modifier flag
+ * corrresponding to the modifier keyword</li>
+ * <li><code>LOCAL_VARIABLE_REF</code> - modifier flags
+ * of the local variable that is referenced</li>
+ * <li><code>METHOD_REF</code> - modifier flags
+ * of the method that is referenced;
+ * <code>Flags.AccAnnotation</code> can be used to recognize
+ * references to annotation type members
+ * </li>
+ * <li><code>METHOD_DECLARATION</code> - modifier flags
+ * for the method that is being implemented or overridden</li>
+ * <li><code>TYPE_REF</code> - modifier flags
+ * of the type that is referenced; <code>Flags.AccInterface</code>
+ * can be used to recognize references to interfaces,
+ * <code>Flags.AccEnum</code> enum types,
+ * and <code>Flags.AccAnnotation</code> annotation types
+ * </li>
+ * <li><code>VARIABLE_DECLARATION</code> - modifier flags
+ * for the variable being declared</li>
+ * </ul>
+ * For kinds of completion proposals, this method returns
+ * <code>Flags.AccDefault</code>.
+ * </p>
+ *
+ * @return the modifier flags, or
+ * <code>Flags.AccDefault</code> if none
+ * @see Flags
+ */
+ public int getFlags() {
+ return this.flags;
+ }
+
+ /**
+ * Sets the modifier flags relevant in the context.
+ * <p>
+ * If not set, defaults to none.
+ * </p>
+ *
+ * @param flags the modifier flags, or
+ * <code>Flags.AccDefault</code> if none
+ */
+ public void setFlags(int flags) {
+ this.flags = flags;
+ }
+
+ /**
+ * Finds the method parameter names.
+ * This information is relevant to method reference (and
+ * method declaration proposals). Returns <code>null</code>
+ * if not available or not relevant.
+ * <p>
+ * The client must not modify the array returned.
+ * </p>
+ * <p>
+ * <b>Note that this is an expensive thing to compute, which may require
+ * parsing Java source files, etc. Use sparingly.
+ * </p>
+ *
+ * @param monitor the progress monitor, or <code>null</code> if none
+ * @return the parameter names, or <code>null</code> if none
+ * or not available or not relevant
+ */
+ public char[][] findParameterNames(IProgressMonitor monitor) {
+ // TODO (jerome) - Missing implementation
+ return null;
+ }
+}
diff --git a/model/org/eclipse/jdt/core/CompletionRequestor.java b/model/org/eclipse/jdt/core/CompletionRequestor.java
new file mode 100644
index 0000000..52dd36e
--- /dev/null
+++ b/model/org/eclipse/jdt/core/CompletionRequestor.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core;
+
+import org.eclipse.jdt.core.compiler.IProblem;
+
+/**
+ * Abstract base class for a completion requestor which is passed completion
+ * proposals as they are generated in response to a code assist request.
+ * <p>
+ * This class is intended to be subclassed by clients.
+ * </p>
+ * <p>
+ * The code assist engine normally invokes methods on completion
+ * requestors in the following sequence:
+ * <pre>
+ * requestor.beginReporting();
+ * requestor.accept(proposal_1);
+ * requestor.accept(proposal_2);
+ * ...
+ * requestor.endReporting();
+ * </pre>
+ * If, however, the engine is unable to offer completion proposals
+ * for whatever reason, <code>completionFailure</code> is called
+ * with a problem object describing why completions were unavailable.
+ * In this case, the sequence of calls is:
+ * <pre>
+ * requestor.beginReporting();
+ * requestor.completionFailure(problem);
+ * requestor.endReporting();
+ * </pre>
+ * In either case, the bracketing <code>beginReporting</code>
+ * <code>endReporting</code> calls are always made.
+ * </p>
+ * <p>
+ * The class was introduced in 3.0 as a more evolvable replacement
+ * for the <code>ICompletionRequestor</code> interface.
+ * </p>
+ *
+ * @see ICodeAssist
+ * @since 3.0
+ */
+public abstract class CompletionRequestor {
+
+ /**
+ * The set of CompletionProposal kinds that this requestor
+ * ignores; <code>0</code> means the set is empty.
+ * 1 << completionProposalKind
+ */
+ private int ignoreSet = 0;
+
+ /**
+ * Creates a new completion requestor.
+ * The requestor is interested in all kinds of completion
+ * proposals; none will be ignored.
+ */
+ public CompletionRequestor() {
+ // do nothing
+ }
+
+ /**
+ * Returns whether the given kind of completion proposal is ignored.
+ *
+ * @param completionProposalKind one of the kind constants declared
+ * on <code>CompletionProposal</code>
+ * @return <code>true</code> if the given kind of completion proposal
+ * is ignored by this requestor, and <code>false</code> if it is of
+ * interest
+ * @see #setIgnored(int, boolean)
+ * @see CompletionProposal#getKind()
+ */
+ public final boolean isIgnored(int completionProposalKind) {
+ if (completionProposalKind < CompletionProposal.ANONYMOUS_CLASS_DECLARATION
+ || completionProposalKind > CompletionProposal.VARIABLE_DECLARATION) {
+ throw new IllegalArgumentException();
+ }
+ return 0 != (this.ignoreSet & (1 << completionProposalKind));
+ }
+
+ /**
+ * Sets whether the given kind of completion proposal is ignored.
+ *
+ * @param completionProposalKind one of the kind constants declared
+ * on <code>CompletionProposal</code>
+ * @param ignore <code>true</code> if the given kind of completion proposal
+ * is ignored by this requestor, and <code>false</code> if it is of
+ * interest
+ * @see #isIgnored(int)
+ * @see CompletionProposal#getKind()
+ */
+ public final void setIgnored(int completionProposalKind, boolean ignore) {
+ if (completionProposalKind < CompletionProposal.ANONYMOUS_CLASS_DECLARATION
+ || completionProposalKind > CompletionProposal.VARIABLE_DECLARATION) {
+ throw new IllegalArgumentException();
+ }
+ if (ignore) {
+ this.ignoreSet |= (1 << completionProposalKind);
+ } else {
+ this.ignoreSet &= ~(1 << completionProposalKind);
+ }
+ }
+
+ /**
+ * Pro forma notification sent before reporting a batch of
+ * completion proposals.
+ * <p>
+ * The default implementation of this method does nothing.
+ * Clients may override.
+ * </p>
+ */
+ public void beginReporting() {
+ // do nothing
+ }
+
+ /**
+ * Pro forma notification sent after reporting a batch of
+ * completion proposals.
+ * <p>
+ * The default implementation of this method does nothing.
+ * Clients may override.
+ * </p>
+ */
+ public void endReporting() {
+ // do nothing
+ }
+
+ /**
+ * Notification of failure to produce any completions.
+ * The problem object explains what prevented completing.
+ * <p>
+ * The default implementation of this method does nothing.
+ * Clients may override to receive this kind of notice.
+ * </p>
+ *
+ * @param problem the problem object
+ */
+ public void completionFailure(IProblem problem) {
+ // default behavior is to ignore
+ }
+
+ /**
+ * Proposes a completion. Has no effect if the kind of proposal
+ * is being ignored by this requestor. Callers should consider
+ * checking {@link #isIgnored(int)} before avoid creating proposal
+ * objects that would only be ignored.
+ * <p>
+ * Similarly, implementers should check
+ * {@link #isIgnored(int) isIgnored(proposal.getKind())}
+ * and ignore proposals that have been declared as uninteresting.
+ * The proposal object passed in only valid for the duration of
+ * this call; implementors must not hang on to these objects.
+ *
+ * @param proposal the completion proposal
+ * @exception IllegalArgumentException if the proposal is null
+ */
+ public abstract void accept(CompletionProposal proposal);
+}
diff --git a/model/org/eclipse/jdt/core/CompletionRequestorAdapter.java b/model/org/eclipse/jdt/core/CompletionRequestorAdapter.java
index fe10ac4..b4a6ee5 100644
--- a/model/org/eclipse/jdt/core/CompletionRequestorAdapter.java
+++ b/model/org/eclipse/jdt/core/CompletionRequestorAdapter.java
@@ -15,11 +15,12 @@
/**
* Adapter of the requestor interface <code>ICompletionRequestor</code>.
* <p>
- * This class is intended to be instanciated and subclassed by clients.
+ * This class is intended to be instantiated and subclassed by clients.
* </p>
*
* @see ICompletionRequestor
* @since 2.0
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Subclass {@link CompletionRequestor} instead.
*/
public class CompletionRequestorAdapter implements ICompletionRequestor {
diff --git a/model/org/eclipse/jdt/core/Flags.java b/model/org/eclipse/jdt/core/Flags.java
index 4d19009..120abd7 100644
--- a/model/org/eclipse/jdt/core/Flags.java
+++ b/model/org/eclipse/jdt/core/Flags.java
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - added constant AccDefault
+ * IBM Corporation - added constants AccBridge and AccVarargs for J2SE 1.5
*******************************************************************************/
package org.eclipse.jdt.core;
@@ -110,24 +111,38 @@
* @since 2.0
*/
public static final int AccDeprecated = IConstants.AccDeprecated;
+
/**
- * Enumaration property flag. See The Java Virtual Machine Specification for more details.
- * @since 3.1
- */
- public static final int AccEnum = IConstants.AccEnum;
- /**
- * Bridge method property flag. See The Java Virtual Machine Specification for more details.
- * @since 3.1
+ * Bridge method property flag (added in J2SE 1.5). Used to flag a compiler-generated
+ * bridge methods.
+ * See The Java Virtual Machine Specification for more details.
+ * @since 3.0
*/
public static final int AccBridge = IConstants.AccBridge;
+
/**
- * Variable number of argument method property flag.
+ * Varargs method property flag (added in J2SE 1.5).
+ * Used to flag variable arity method declarations.
* See The Java Virtual Machine Specification for more details.
- * @since 3.1
+ * @since 3.0
*/
public static final int AccVarargs = IConstants.AccVarargs;
/**
+ * Enum property flag (added in J2SE 1.5).
+ * See The Java Virtual Machine Specification for more details.
+ * @since 3.0
+ */
+ public static final int AccEnum = 0x4000;
+
+ /**
+ * Annotation property flag (added in J2SE 1.5).
+ * See The Java Virtual Machine Specification for more details.
+ * @since 3.0
+ */
+ public static final int AccAnnotation = 0x2000;
+
+ /**
* Not instantiable.
*/
private Flags() {
@@ -262,10 +277,63 @@
public static boolean isVolatile(int flags) {
return (flags & AccVolatile) != 0;
}
+
+ /**
+ * Returns whether the given integer has the <code>AccBridge</code>
+ * bit set.
+ *
+ * @param flags the flags
+ * @return <code>true</code> if the <code>AccBridge</code> flag is included
+ * @see #AccBridge
+ * @since 3.0
+ */
+ public static boolean isBridge(int flags) {
+ return (flags & AccBridge) != 0;
+ }
+
+ /**
+ * Returns whether the given integer has the <code>AccVarargs</code>
+ * bit set.
+ *
+ * @param flags the flags
+ * @return <code>true</code> if the <code>AccVarargs</code> flag is included
+ * @see #AccVarargs
+ * @since 3.0
+ */
+ public static boolean isVarargs(int flags) {
+ return (flags & AccVarargs) != 0;
+ }
+
+ /**
+ * Returns whether the given integer has the <code>AccEnum</code>
+ * bit set.
+ *
+ * @param flags the flags
+ * @return <code>true</code> if the <code>AccEnum</code> flag is included
+ * @see #AccEnum
+ * @since 3.0
+ */
+ public static boolean isEnum(int flags) {
+ return (flags & AccEnum) != 0;
+ }
+
+ /**
+ * Returns whether the given integer has the <code>AccAnnotation</code>
+ * bit set.
+ *
+ * @param flags the flags
+ * @return <code>true</code> if the <code>AccAnnotation</code> flag is included
+ * @see #AccAnnotation
+ * @since 3.0
+ */
+ public static boolean isAnnotation(int flags) {
+ return (flags & AccAnnotation) != 0;
+ }
+
/**
* Returns a standard string describing the given modifier flags.
- * Only modifier flags are included in the output; the deprecated and
- * synthetic flags are ignored if set.
+ * Only modifier flags are included in the output; deprecated,
+ * synthetic, bridge, etc. flags are ignored.
* <p>
* The flags are output in the following order:
* <pre>
diff --git a/model/org/eclipse/jdt/core/ICodeAssist.java b/model/org/eclipse/jdt/core/ICodeAssist.java
index 66e9cca..018441a 100644
--- a/model/org/eclipse/jdt/core/ICodeAssist.java
+++ b/model/org/eclipse/jdt/core/ICodeAssist.java
@@ -36,8 +36,7 @@
* </ul>
*
* @exception IllegalArgumentException if <code>requestor</code> is <code>null</code>
- * @deprecated - use codeComplete(int, ICompletionRequestor) instead
- * TODO remove before 3.0
+ * @deprecated Use {@link #codeComplete(int, ICompletionRequestor)} instead.
*/
void codeComplete(int offset, ICodeCompletionRequestor requestor)
throws JavaModelException;
@@ -58,9 +57,63 @@
*
* @exception IllegalArgumentException if <code>requestor</code> is <code>null</code>
* @since 2.0
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link #codeComplete(int, CompletionRequestor)} instead.
*/
void codeComplete(int offset, ICompletionRequestor requestor)
throws JavaModelException;
+
+ /**
+ * Performs code completion at the given offset position in this compilation unit,
+ * reporting results to the given completion requestor. The <code>offset</code>
+ * is the 0-based index of the character, after which code assist is desired.
+ * An <code>offset</code> of -1 indicates to code assist at the beginning of this
+ * compilation unit.
+ *
+ * @param offset the given offset position
+ * @param requestor the given completion requestor
+ * @exception JavaModelException if code assist could not be performed. Reasons include:<ul>
+ * <li>This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
+ * <li> The position specified is < -1 or is greater than this compilation unit's
+ * source length (INDEX_OUT_OF_BOUNDS)
+ * </ul>
+ *
+ * @exception IllegalArgumentException if <code>requestor</code> is <code>null</code>
+ * @since 3.0
+ */
+ void codeComplete(int offset, CompletionRequestor requestor)
+ throws JavaModelException;
+
+ /**
+ * Performs code completion at the given offset position in this compilation unit,
+ * reporting results to the given completion requestor. The <code>offset</code>
+ * is the 0-based index of the character, after which code assist is desired.
+ * An <code>offset</code> of -1 indicates to code assist at the beginning of this
+ * compilation unit.
+ * It considers types in the working copies with the given owner first. In other words,
+ * the owner's working copies will take precedence over their original compilation units
+ * in the workspace.
+ * <p>
+ * Note that if a working copy is empty, it will be as if the original compilation
+ * unit had been deleted.
+ * </p>
+ *
+ * @param offset the given offset position
+ * @param requestor the given completion requestor
+ * @param owner the owner of working copies that take precedence over their original compilation units
+ * @exception JavaModelException if code assist could not be performed. Reasons include:<ul>
+ * <li>This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
+ * <li> The position specified is < -1 or is greater than this compilation unit's
+ * source length (INDEX_OUT_OF_BOUNDS)
+ * </ul>
+ *
+ * @exception IllegalArgumentException if <code>requestor</code> is <code>null</code>
+ * @since 3.0
+ * @deprecated Use {@link #codeComplete(int, ICompletionRequestor, WorkingCopyOwner)} instead.
+ * TODO (jeem) - remove after M8
+ */
+ void codeComplete(int offset, ICompletionRequestor requestor, WorkingCopyOwner owner)
+ throws JavaModelException;
+
/**
* Performs code completion at the given offset position in this compilation unit,
* reporting results to the given completion requestor. The <code>offset</code>
@@ -87,8 +140,9 @@
* @exception IllegalArgumentException if <code>requestor</code> is <code>null</code>
* @since 3.0
*/
- void codeComplete(int offset, ICompletionRequestor requestor, WorkingCopyOwner owner)
+ void codeComplete(int offset, CompletionRequestor requestor, WorkingCopyOwner owner)
throws JavaModelException;
+
/**
* Returns the Java elements correspondiing to the given selected text in this compilation unit.
* The <code>offset</code> is the 0-based index of the first selected character.
diff --git a/model/org/eclipse/jdt/core/ICodeCompletionRequestor.java b/model/org/eclipse/jdt/core/ICodeCompletionRequestor.java
index 9957892..d61e61e 100644
--- a/model/org/eclipse/jdt/core/ICodeCompletionRequestor.java
+++ b/model/org/eclipse/jdt/core/ICodeCompletionRequestor.java
@@ -20,7 +20,7 @@
* </p>
*
* @see ICodeAssist
- * @deprecated Use an ICompletionRequestor instead
+ * @deprecated Use {@link CompletionRequestor} instead.
*/
public interface ICodeCompletionRequestor {
/**
diff --git a/model/org/eclipse/jdt/core/ICompilationUnit.java b/model/org/eclipse/jdt/core/ICompilationUnit.java
index b7c396c..0cc51e6 100644
--- a/model/org/eclipse/jdt/core/ICompilationUnit.java
+++ b/model/org/eclipse/jdt/core/ICompilationUnit.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * IBM Corporation - added J2SE 1.5 support
*******************************************************************************/
package org.eclipse.jdt.core;
@@ -87,6 +88,29 @@
*/
void commitWorkingCopy(boolean force, IProgressMonitor monitor) throws JavaModelException;
/**
+ * Creates and returns an non-static import declaration in this compilation unit
+ * with the given name. This method is equivalent to
+ * <code>createImport(name, Flags.AccDefault, sibling, monitor)</code>.
+ *
+ * @param name the name of the import declaration to add as defined by JLS2 7.5. (For example: <code>"java.io.File"</code> or
+ * <code>"java.awt.*"</code>)
+ * @param sibling the existing element which the import declaration will be inserted immediately before (if
+ * <code> null </code>, then this import will be inserted as the last import declaration.
+ * @param monitor the progress monitor to notify
+ * @return the newly inserted import declaration (or the previously existing one in case attempting to create a duplicate)
+ *
+ * @throws JavaModelException if the element could not be created. Reasons include:
+ * <ul>
+ * <li> This Java element does not exist or the specified sibling does not exist (ELEMENT_DOES_NOT_EXIST)</li>
+ * <li> A <code>CoreException</code> occurred while updating an underlying resource
+ * <li> The specified sibling is not a child of this compilation unit (INVALID_SIBLING)
+ * <li> The name is not a valid import name (INVALID_NAME)
+ * </ul>
+ * @see #createImport(String, int, IJavaElement, IProgressMonitor)
+ */
+IImportDeclaration createImport(String name, IJavaElement sibling, IProgressMonitor monitor) throws JavaModelException;
+
+/**
* Creates and returns an import declaration in this compilation unit
* with the given name.
* <p>
@@ -103,11 +127,20 @@
* Importing <code>"java.lang.*"</code>, or the package in which the compilation unit
* is defined, are not treated as special cases. If they are specified, they are
* included in the result.
+ * <p>
+ * Note: Static imports are an experimental language feature
+ * under discussion in JSR-201 and under consideration for inclusion
+ * in the 1.5 release of J2SE. The support here is therefore tentative
+ * and subject to change.
+ * </p>
*
* @param name the name of the import declaration to add as defined by JLS2 7.5. (For example: <code>"java.io.File"</code> or
* <code>"java.awt.*"</code>)
* @param sibling the existing element which the import declaration will be inserted immediately before (if
* <code> null </code>, then this import will be inserted as the last import declaration.
+ * @param flags <code>Flags.AccStatic</code> for static imports, or
+ * <code>Flags.AccDefault</code> for regular imports; other modifier flags
+ * are ignored
* @param monitor the progress monitor to notify
* @return the newly inserted import declaration (or the previously existing one in case attempting to create a duplicate)
*
@@ -118,8 +151,11 @@
* <li> The specified sibling is not a child of this compilation unit (INVALID_SIBLING)
* <li> The name is not a valid import name (INVALID_NAME)
* </ul>
+ * @see Flags
+ * @since 3.0
*/
-IImportDeclaration createImport(String name, IJavaElement sibling, IProgressMonitor monitor) throws JavaModelException;
+IImportDeclaration createImport(String name, IJavaElement sibling, int flags, IProgressMonitor monitor) throws JavaModelException;
+
/**
* Creates and returns a package declaration in this compilation unit
* with the given package name.
@@ -466,46 +502,6 @@
*/
void reconcile(boolean forceProblemDetection, IProgressMonitor monitor) throws JavaModelException;
/**
- * Reconciles the contents of this working copy, and sends out a Java delta
- * notification indicating the nature of the change of the working copy since
- * the last time it was either reconciled or made consistent
- * (see <code>IOpenable#makeConsistent()</code>).
- * .<p>.
- * It performs the reconciliation by locally caching the contents of
- * the working copy, updating the contents, then creating a delta
- * over the cached contents and the new contents, and finally firing
- * this delta.
- * <p>
- * The boolean argument allows to force problem detection even if the
- * working copy is already consistent.
- * </p><p>
- * This functionality allows to specify a working copy owner which is used during problem detection.
- * All references contained in the working copy are resolved against other units; for which corresponding
- * owned working copies are going to take precedence over their original compilation units.
- * </p><p>
- * Compilation problems found in the new contents are notified through the
- * <code>IProblemRequestor</code> interface which was passed at
- * creation, and no longer as transient markers. Therefore this API answers
- * nothing.
- * </p><p>
- * Note: Since 3.0 added/removed/changed inner types generate change deltas.</p>
- * </p>
- *
- * @param forceProblemDetection boolean indicating whether problem should be recomputed
- * even if the source hasn't changed.
- * @param owner the owner of working copies that take precedence over the original compilation units
- * @param monitor a progress monitor
- * @throws JavaModelException if the contents of the original element
- * cannot be accessed. Reasons include:
- * <ul>
- * <li> The original Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
- * </ul>
- * @since 3.0
- * @deprecated Use reconcile(boolean, boolean, WorkingCopyOwner, IProgressMonitor) instead
- * TODO (jerome) remove after M8
- */
-void reconcile(boolean forceProblemDetection, WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException;
-/**
* Reconciles the contents of this working copy, sends out a Java delta
* notification indicating the nature of the change of the working copy since
* the last time it was either reconciled or made consistent
diff --git a/model/org/eclipse/jdt/core/ICompletionRequestor.java b/model/org/eclipse/jdt/core/ICompletionRequestor.java
index 30ab163..b2b99a2 100644
--- a/model/org/eclipse/jdt/core/ICompletionRequestor.java
+++ b/model/org/eclipse/jdt/core/ICompletionRequestor.java
@@ -21,13 +21,14 @@
*
* @see ICodeAssist
* @since 2.0
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor}, an abstract class
+ * with all the same methods (and more).
*/
public interface ICompletionRequestor {
/**
* Code assist notification of an anonymous type declaration completion.
* @param superTypePackageName Name of the package that contains the super type of this
- * new anonymous type declaration .
- *
+ * new anonymous type declaration.
* @param superTypeName Name of the super type of this new anonymous type declaration.
* @param parameterPackageNames Names of the packages in which the parameter types are declared.
* Should contain as many elements as parameterTypeNames.
@@ -54,6 +55,7 @@
* The default package is represented by an empty array.
*
* NOTE: parameter names can be retrieved from the source model after the user selects a specific method.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptAnonymousType(char[], char[], char[][], char[][], char[][], char[], int, int, int, int)} instead.
*/
void acceptAnonymousType(
char[] superTypePackageName,
@@ -84,6 +86,7 @@
* Package names are in the form "a.b.c".
* Nested type names are in the qualified form "A.M".
* The default package is represented by an empty array.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptClass(char[], char[], char[], int, int, int, int)} instead.
*/
void acceptClass(
char[] packageName,
@@ -103,6 +106,7 @@
* detected (might be in another compilation unit, if it was indirectly requested
* during the code assist process).
* Note: the problem knows its originating file name.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptError(IProblem)} instead.
*/
void acceptError(IProblem error);
/**
@@ -128,6 +132,7 @@
* Array types are in the qualified form "M[]" or "int[]".
* Nested type names are in the qualified form "A.M".
* The default package is represented by an empty array.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptField(char[], char[], char[], char[], char[], char[], int, int, int, int)} instead.
*/
void acceptField(
char[] declaringTypePackageName,
@@ -158,6 +163,7 @@
* Package names are in the form "a.b.c".
* Nested type names are in the qualified form "A.M".
* The default package is represented by an empty array.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptInterface(char[], char[], char[], int, int, int, int)} instead.
*/
void acceptInterface(
char[] packageName,
@@ -176,6 +182,7 @@
* It is a positive integer which are used for determine if this proposal is more relevant than another proposal.
* This value can only be used for compare relevance. A proposal is more relevant than another if his relevance
* value is higher.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptKeyword(char[], int, int, int)} instead.
*/
void acceptKeyword(char[] keywordName, int completionStart, int completionEnd, int relevance);
/**
@@ -188,6 +195,7 @@
* It is a positive integer which are used for determine if this proposal is more relevant than another proposal.
* This value can only be used for compare relevance. A proposal is more relevant than another if his relevance
* value is higher.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptLabel(char[], int, int, int)} instead.
*/
void acceptLabel(char[] labelName, int completionStart, int completionEnd, int relevance);
/**
@@ -210,6 +218,7 @@
* Array types are in the qualified form "M[]" or "int[]".
* Nested type names are in the qualified form "A.M".
* The default package is represented by an empty array.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptLocalVariable(char[], char[], char[], int, int, int, int)} instead.
*/
void acceptLocalVariable(
char[] name,
@@ -250,6 +259,7 @@
* The default package is represented by an empty array.
*
* NOTE: parameter names can be retrieved from the source model after the user selects a specific method.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptMethod(char[], char[], char[], char[][], char[][], char[][], char[], char[], char[], int, int, int, int)} instead.
*/
void acceptMethod(
char[] declaringTypePackageName,
@@ -297,6 +307,7 @@
* The default package is represented by an empty array.
*
* NOTE: parameter names can be retrieved from the source model after the user selects a specific method.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptMethodDeclaration(char[], char[], char[], char[][], char[][], char[][], char[], char[], char[], int, int, int, int)} instead.
*/
void acceptMethodDeclaration(
char[] declaringTypePackageName,
@@ -322,6 +333,7 @@
* It is a positive integer which are used for determine if this proposal is more relevant than another proposal.
* This value can only be used for compare relevance. A proposal is more relevant than another if his relevance
* value is higher.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptModifier(char[], int, int, int)} instead.
*/
void acceptModifier(char[] modifierName, int completionStart, int completionEnd, int relevance);
/**
@@ -339,6 +351,7 @@
* NOTE - All package names are presented in their readable form:
* Package names are in the form "a.b.c".
* The default package is represented by an empty array.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptPackage(char[], char[], int, int, int)} instead.
*/
void acceptPackage(
char[] packageName,
@@ -363,6 +376,7 @@
* Package names are in the form "a.b.c".
* Nested type names are in the qualified form "A.M".
* The default package is represented by an empty array.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptType(char[], char[], char[], int, int, int)} instead.
*/
void acceptType(
char[] packageName,
@@ -392,6 +406,7 @@
* Array types are in the qualified form "M[]" or "int[]".
* Nested type names are in the qualified form "A.M".
* The default package is represented by an empty array.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptTypeVariable(char[], int, int, int)} instead.
*/
void acceptVariableName(
char[] typePackageName,
diff --git a/model/org/eclipse/jdt/core/IField.java b/model/org/eclipse/jdt/core/IField.java
index e71e6dd..dafcfc6 100644
--- a/model/org/eclipse/jdt/core/IField.java
+++ b/model/org/eclipse/jdt/core/IField.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * IBM Corporation - added J2SE 1.5 support
*******************************************************************************/
package org.eclipse.jdt.core;
@@ -94,7 +95,9 @@
*/
String getElementName();
/**
- * Returns the type signature of this field.
+ * Returns the type signature of this field. For enum constants,
+ * this returns the signature of the declaring enum class.
+
*
* @return the type signature of this field.
* @exception JavaModelException if this element does not exist or if an
diff --git a/model/org/eclipse/jdt/core/IImportDeclaration.java b/model/org/eclipse/jdt/core/IImportDeclaration.java
index 69abdff..e7a7fff 100644
--- a/model/org/eclipse/jdt/core/IImportDeclaration.java
+++ b/model/org/eclipse/jdt/core/IImportDeclaration.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * IBM Corporation - added J2SE 1.5 support
*******************************************************************************/
package org.eclipse.jdt.core;
@@ -31,6 +32,7 @@
/**
* Returns the modifier flags for this import. The flags can be examined using class
* <code>Flags</code>. Only the static flag is meaningful for import declarations.
+ *
* @exception JavaModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
* @return the modifier flags for this import
diff --git a/model/org/eclipse/jdt/core/IMethod.java b/model/org/eclipse/jdt/core/IMethod.java
index 4643335..dd80f06 100644
--- a/model/org/eclipse/jdt/core/IMethod.java
+++ b/model/org/eclipse/jdt/core/IMethod.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * IBM Corporation - added J2SE 1.5 support
*******************************************************************************/
package org.eclipse.jdt.core;
@@ -43,6 +44,24 @@
* @see Signature
*/
String[] getExceptionTypes() throws JavaModelException;
+
+/**
+ * Returns the formal type parameter signatures for this method.
+ * Returns an empty array if this method has no formal type parameters.
+ *
+ * <p>For example, a source method with formal type parameters
+ * <code>"<D1,C1 extends A1 & B1>"</code>,
+ * would return the array <code>{"<D1:>", "<C1:QA1;:QB1;>"}</code>.
+ *
+ * @exception JavaModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ * @return the formal type parameter signatures of this method,
+ * in the order declared in the source, an empty array if none
+ * @see Signature
+ * @since 3.0
+ */
+String[] getTypeParameters() throws JavaModelException;
+
/**
* Returns the number of parameters of this method.
* This is a handle-only method.
@@ -58,6 +77,7 @@
*
* <p>For example, a method declared as <code>public void foo(String text, int length)</code>
* would return the array <code>{"text","length"}</code>.
+ * </p>
*
* @exception JavaModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
@@ -112,6 +132,7 @@
* @return true if this method is a constructor, false otherwise
*/
boolean isConstructor() throws JavaModelException;
+
/**
* Returns whether this method is a main method.
* It is a main method if:
diff --git a/model/org/eclipse/jdt/core/IOpenable.java b/model/org/eclipse/jdt/core/IOpenable.java
index 32c0690..b77a6eb 100644
--- a/model/org/eclipse/jdt/core/IOpenable.java
+++ b/model/org/eclipse/jdt/core/IOpenable.java
@@ -121,7 +121,7 @@
* <li>This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
* </ul>
* @see IOpenable#isConsistent()
- * @see ICompilationUnit#reconcile(boolean, IProgressMonitor)
+ * @see ICompilationUnit#reconcile(boolean, boolean, WorkingCopyOwner, IProgressMonitor)
*/
void makeConsistent(IProgressMonitor progress) throws JavaModelException;
/**
diff --git a/model/org/eclipse/jdt/core/IType.java b/model/org/eclipse/jdt/core/IType.java
index 7ef5c33..fd26ec1 100644
--- a/model/org/eclipse/jdt/core/IType.java
+++ b/model/org/eclipse/jdt/core/IType.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * IBM Corporation - added J2SE 1.5 support
*******************************************************************************/
package org.eclipse.jdt.core;
@@ -17,7 +18,8 @@
/**
* Represents either a source type in a compilation unit (either a top-level
* type, a member type, a local type or an anonymous type)
- * or a binary type in a class file.
+ * or a binary type in a class file. Enumeration classes and annotation
+ * types are subkinds of classes and interfaces, respectively.
* <p>
* Note that the element name of an anonymous source type is always empty.
* </p><p>
@@ -46,7 +48,7 @@
* @param insertion the position with in source where the snippet
* is inserted. This position must not be in comments.
* A possible value is -1, if the position is not known.
- * @param position the position with in snippet where the user
+ * @param position the position within snippet where the user
* is performing code assist.
* @param localVariableTypeNames an array (possibly empty) of fully qualified
* type names of local variables visible at the current scope
@@ -116,6 +118,8 @@
WorkingCopyOwner owner)
throws JavaModelException;
+
+
/**
* Creates and returns a field in this type with the
* given contents.
@@ -394,6 +398,11 @@
* For source types, the name as declared is returned, for binary types,
* the resolved, qualified name is returned.
* For anonymous types, the superclass name is the name appearing after the 'new' keyword'.
+ * If the superclass is a parameterized type, the string
+ * may include its type arguments enclosed in "<>".
+ * If the returned string is needed for anything other than display
+ * purposes, use {@link #getSuperclassType()} which returns
+ * a structured signature string containing more precise information.
*
* @exception JavaModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
@@ -402,6 +411,44 @@
String getSuperclassName() throws JavaModelException;
/**
+ * Returns the type signature of this type's superclass, or <code>null</code>
+ * for source types that do not specify a superclass.
+ * For interfaces, the superclass type is always <code>"Ljava.lang.Object;"</code>.
+ * For source types, the unresolved type signatuure is returned, for binary types,
+ * the resolved, qualified type signature is returned.
+ * For anonymous types, the superclass type signature is what appearing after the 'new' keyword'.
+ * For enum and annotation types, the result is unspecified.
+ *
+ * @exception JavaModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ * @return the type signature of this type's superclass, or <code>null</code> for
+ * source types that do not specify a superclass
+ * @since 3.0
+ */
+ String getSuperclassType() throws JavaModelException;
+
+ /**
+ * Returns the type signatures of the interfaces that this type
+ * implements or extends, in the order in which they are listed in the source.
+ * For classes, including enumerations, this gives the interfaces that this
+ * class implements. For interfaces, including annotation types,
+ * this gives the interfaces that this interface extends.
+ * An empty collection is returned if this type does not implement or
+ * extend any interfaces. For source types, unresolved type
+ * signatures are returned, for binary types, resolved type
+ * signatures are returned.
+ * For anonymous types, an empty collection is always returned.
+ *
+ * @exception JavaModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ * @return the type signatures of interfaces that this type implements
+ * or extends, in the order in which they are listed in the source,
+ * an empty collection if none
+ * @since 3.0
+ */
+ String[] getSuperInterfaceTypes() throws JavaModelException;
+
+ /**
* Returns the names of interfaces that this type implements or extends,
* in the order in which they are listed in the source.
* For classes, this gives the interfaces that this class implements.
@@ -410,6 +457,11 @@
* extend any interfaces. For source types, simple names are returned,
* for binary types, qualified names are returned.
* For anonymous types, an empty collection is always returned.
+ * If the list of supertypes includes parameterized types,
+ * the string may include type arguments enclosed in "<>".
+ * If the result is needed for anything other than display
+ * purposes, use {@link #getSuperInterfaceTypes()} which returns
+ * structured signature strings containing more precise information.
*
* @exception JavaModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
@@ -419,6 +471,24 @@
String[] getSuperInterfaceNames() throws JavaModelException;
/**
+ * Returns the formal type parameter signatures for this type.
+ * Returns an empty array if this type has no formal type parameters.
+ *
+ * <p>For example, a source type with formal type parameters
+ * <code>"<D1,C1 extends A1 & B1>"</code>,
+ * would return the array <code>{"<D1:>", "<C1:QA1;:QB1;>"}</code>.
+ * </p>
+ *
+ * @exception JavaModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ * @return the formal type parameter signatures of this type,
+ * in the order declared in the source, an empty array if none
+ * @see Signature
+ * @since 3.0
+ */
+ String[] getTypeParameters() throws JavaModelException;
+
+ /**
* Returns the member type declared in this type with the given simple name.
* This is a handle-only method. The type may or may not exist.
*
@@ -492,6 +562,11 @@
/**
* Returns whether this type represents a class.
+ * <p>
+ * Note that <code>isClass</code>, <code>isInterface</code>,
+ * <code>isEnum</code>, and <code>isAnnotation</code> are
+ * mutually exclusive.
+ * </p>
*
* @exception JavaModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
@@ -500,7 +575,28 @@
boolean isClass() throws JavaModelException;
/**
+ * Returns whether this type represents an enumeration class.
+ * <p>
+ * Note that <code>isClass</code>, <code>isInterface</code>,
+ * <code>isEnum</code>, and <code>isAnnotation</code> are
+ * mutually exclusive.
+ * </p>
+ *
+ * @exception JavaModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ * @return true if this type represents an enumeration class,
+ * false otherwise
+ * @since 3.0
+ */
+ boolean isEnum() throws JavaModelException;
+
+ /**
* Returns whether this type represents an interface.
+ * <p>
+ * Note that <code>isClass</code>, <code>isInterface</code>,
+ * <code>isEnum</code>, and <code>isAnnotation</code> are
+ * mutually exclusive.
+ * </p>
*
* @exception JavaModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
@@ -509,6 +605,22 @@
boolean isInterface() throws JavaModelException;
/**
+ * Returns whether this type represents an annotation type.
+ * <p>
+ * Note that <code>isClass</code>, <code>isInterface</code>,
+ * <code>isEnum</code>, and <code>isAnnotation</code> are
+ * mutually exclusive.
+ * </p>
+ *
+ * @exception JavaModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ * @return true if this type represents an annotation type,
+ * false otherwise
+ * @since 3.0
+ */
+ boolean isAnnotation() throws JavaModelException;
+
+ /**
* Returns whether this type represents a local type.
*
* @exception JavaModelException if this element does not exist or if an
diff --git a/model/org/eclipse/jdt/core/JavaConventions.java b/model/org/eclipse/jdt/core/JavaConventions.java
index a685773..5188437 100644
--- a/model/org/eclipse/jdt/core/JavaConventions.java
+++ b/model/org/eclipse/jdt/core/JavaConventions.java
@@ -137,11 +137,16 @@
return new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("convention.unit.notJavaName"), null); //$NON-NLS-1$
}
identifier = name.substring(0, index);
- IStatus status = validateIdentifier(identifier);
- if (!status.isOK()) {
- return status;
+ // JSR-175 metadata strongly recommends "package-info.java" as the
+ // file in which to store package annotations and
+ // the package-level spec (replaces package.html)
+ if (!identifier.equals("package-info")) { //$NON-NLS-1$
+ IStatus status = validateIdentifier(identifier);
+ if (!status.isOK()) {
+ return status;
+ }
}
- status = ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE);
+ IStatus status = ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE);
if (!status.isOK()) {
return status;
}
diff --git a/model/org/eclipse/jdt/core/Signature.java b/model/org/eclipse/jdt/core/Signature.java
index 8820815..2dd3d9d 100644
--- a/model/org/eclipse/jdt/core/Signature.java
+++ b/model/org/eclipse/jdt/core/Signature.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * IBM Corporation - added J2SE 1.5 support
*******************************************************************************/
package org.eclipse.jdt.core;
@@ -26,9 +27,18 @@
* | "S" // short
* | "V" // void
* | "Z" // boolean
- * | "L" + binaryTypeName + ";" // resolved named type (in compiled code)
- * | "Q" + sourceTypeName + ";" // unresolved named type (in source code)
+ * | "T" + typeVariableName + ";" // type variable
+ * | "L" + binaryTypeName + optionalTypeArguments + ";" // resolved named type (in compiled code)
+ * | "Q" + sourceTypeName + optionalTypeArguments + ";" // unresolved named type (in source code)
* | "[" + typeSignature // array of type denoted by typeSignature
+ * optionalTypeArguments ::=
+ * "<" + typeArgument+ + ">"
+ * |
+ * typeArgument ::=
+ * | typeSignature
+ * | "*"
+ * | "+" typeSignature
+ * | "-" typeSignature
* </pre>
* </p>
* <p>
@@ -39,14 +49,21 @@
* <li><code>"QString;"</code> denotes <code>String</code> in source code</li>
* <li><code>"Qjava.lang.String;"</code> denotes <code>java.lang.String</code> in source code</li>
* <li><code>"[QString;"</code> denotes <code>String[]</code> in source code</li>
+ * <li><code>"QMap<QString;*>;"</code> denotes <code>Map<String,?></code> in source code</li>
+ * <li><code>"Ljava.util.List<TV;>;"</code> denotes <code>java.util.List<V></code> in source code</li>
* </ul>
* </p>
* <p>
- * The syntax for a method signature is:
+ * The syntax for a method signature is:
* <pre>
- * methodSignature ::= "(" + paramTypeSignature* + ")" + returnTypeSignature
+ * methodSignature ::=
+ * optionalFormalTypeParameters + "(" + paramTypeSignature* + ")" + returnTypeSignature + throwsSignature*
* paramTypeSignature ::= typeSignature
* returnTypeSignature ::= typeSignature
+ * throwsSignature ::= "^" + typeSignature
+ * optionalFormalTypeParameters ::=
+ * "<" + formalTypeParameter+ + ">"
+ * |
* </pre>
* <p>
* Examples:
@@ -57,6 +74,25 @@
* </ul>
* </p>
* <p>
+ * The syntax for a format type parameter signature is:
+ * <pre>
+ * formalTypeParameter ::=
+ * typeVariableName + optionalClassBound + interfaceBound*
+ * optionalClassBound ::=
+ * ":"
+ * | ":" + typeSignature
+ * interfaceBound ::=
+ * ":" + typeSignature
+ * </pre>
+ * <p>
+ * Examples:
+ * <ul>
+ * <li><code>"X:"</code> denotes <code>X</code></li>
+ * <li><code>"X:QReader;"</code> denotes <code>X extends Reader</code> in compiled code</li>
+ * <li><code>"X:QReader;QSerializable;"</code> denotes <code>X extends Reader & Serializable</code> in source code</li>
+ * </ul>
+ * </p>
+ * <p>
* This class provides static methods and constants only; it is not intended to be
* instantiated or subclassed by clients.
* </p>
@@ -106,6 +142,13 @@
public static final char C_SEMICOLON = ';';
/**
+ * Character constant indicating the colon in a signature.
+ * Value is <code>':'</code>.
+ * @since 3.0
+ */
+ public static final char C_COLON = ':';
+
+ /**
* Character constant indicating the primitive type long in a signature.
* Value is <code>'J'</code>.
*/
@@ -123,6 +166,45 @@
*/
public static final char C_VOID = 'V';
+ /**
+ * Character constant indicating the start of a resolved type variable in a
+ * signature. Value is <code>'T'</code>.
+ * @since 3.0
+ */
+ public static final char C_TYPE_VARIABLE = 'T';
+
+ /**
+ * Character constant indicating a wildcard type argument
+ * in a signature.
+ * Value is <code>'*'</code>.
+ * @since 3.0
+ */
+ public static final char C_STAR = '*';
+
+ /**
+ * Character constant indicating the start of a bounded wildcard type argument
+ * in a signature.
+ * Value is <code>'+'</code>.
+ * @since 3.0
+ * TODO (jeem) - is this 'super' or 'extends' ?
+ */
+ public static final char C_PLUS = '+';
+
+ /**
+ * Character constant indicating the start of a bounded wildcard type argument
+ * in a signature. Value is <code>'-'</code>.
+ * @since 3.0
+ * TODO (jeem) - is this 'super' or 'extends' ?
+ */
+ public static final char C_MINUS = '-';
+
+ /**
+ * Character constant indicating the start of a thrown exception in a
+ * method signature. Value is <code>'^'</code>.
+ * @since 3.0
+ */
+ public static final char C_THROWS = '^';
+
/**
* Character constant indicating the dot in a signature.
* Value is <code>'.'</code>.
@@ -172,6 +254,20 @@
public static final char C_PARAM_END = ')';
/**
+ * Character constant indicating the start of a formal type parameter
+ * (or type argument) list in a signature. Value is <code>'<'</code>.
+ * @since 3.0
+ */
+ public static final char C_GENERIC_START = '<';
+
+ /**
+ * Character constant indicating the end of a generic type list in a
+ * signature. Value is <code>'%gt;'</code>.
+ * @since 3.0
+ */
+ public static final char C_GENERIC_END = '>';
+
+ /**
* String constant for the signature of the primitive type boolean.
* Value is <code>"Z"</code>.
*/
@@ -235,7 +331,8 @@
private static final char[] VOID = {'v', 'o', 'i', 'd'};
private static final String EMPTY = new String(CharOperation.NO_CHAR);
-
+ private static final String[] EMPTY_STRING_ARRAY = new String[0];
+
private Signature() {
// Not instantiable
}
@@ -357,34 +454,18 @@
}
/**
* Creates a method signature from the given parameter and return type
- * signatures. The encoded method signature is dot-based.
+ * signatures. The encoded method signature is dot-based. This method
+ * is equivalent to
+ * <code>createMethodSignature(new char[0][], parameterTypes, returnType, new char[0][])</code>.
*
* @param parameterTypes the list of parameter type signatures
* @param returnType the return type signature
* @return the encoded method signature
- *
+ * @see #createMethodSignature(char[][], char[][], char[], char[][])
* @since 2.0
*/
public static char[] createMethodSignature(char[][] parameterTypes, char[] returnType) {
- int parameterTypesLength = parameterTypes.length;
- int parameterLength = 0;
- for (int i = 0; i < parameterTypesLength; i++) {
- parameterLength += parameterTypes[i].length;
-
- }
- int returnTypeLength = returnType.length;
- char[] result = new char[1 + parameterLength + 1 + returnTypeLength];
- result[0] = C_PARAM_START;
- int index = 1;
- for (int i = 0; i < parameterTypesLength; i++) {
- char[] parameterType = parameterTypes[i];
- int length = parameterType.length;
- System.arraycopy(parameterType, 0, result, index, length);
- index += length;
- }
- result[index] = C_PARAM_END;
- System.arraycopy(returnType, 0, result, index+1, returnTypeLength);
- return result;
+ return createMethodSignature(parameterTypes, returnType, CharOperation.NO_CHAR_CHAR, CharOperation.NO_CHAR_CHAR);
}
/**
* Creates a method signature from the given parameter and return type
@@ -392,16 +473,118 @@
*
* @param parameterTypes the list of parameter type signatures
* @param returnType the return type signature
+ * @param formalTypeParameters the list of formal type parameter signatures
+ * @param thrownExceptions the list of type signatures for thrown exceptions
+ * @since 3.0
+ */
+public static char[] createMethodSignature(
+ char[][] parameterTypes,
+ char[] returnType,
+ char[][] formalTypeParameters,
+ char[][] thrownExceptions) {
+ int formalTypeParameterCount = formalTypeParameters.length;
+ int formalTypeLength = 0;
+ for (int i = 0; i < formalTypeParameterCount; i++) {
+ formalTypeLength += formalTypeParameters[i].length;
+ }
+ int parameterTypesCount = parameterTypes.length;
+ int parameterLength = 0;
+ for (int i = 0; i < parameterTypesCount; i++) {
+ parameterLength += parameterTypes[i].length;
+ }
+ int returnTypeLength = returnType.length;
+ int thrownExceptionsCount = thrownExceptions.length;
+ int exceptionsLength = 0;
+ for (int i = 0; i < thrownExceptionsCount; i++) {
+ exceptionsLength += thrownExceptions[i].length;
+ }
+ int extras = 2; // "(" and ")"
+ if (formalTypeParameterCount > 0) {
+ extras += 2; // "<" and ">"
+ }
+ if (thrownExceptionsCount > 0) {
+ extras += thrownExceptionsCount; // one "^" per
+ }
+ char[] result = new char[extras+ formalTypeLength + parameterLength + returnTypeLength + exceptionsLength];
+ int index = 0;
+ if (formalTypeParameterCount > 0) {
+ result[index++] = C_GENERIC_START;
+ for (int i = 0; i < formalTypeParameterCount; i++) {
+ char[] formalTypeParameter = formalTypeParameters[i];
+ int length = formalTypeParameter.length;
+ System.arraycopy(formalTypeParameter, 0, result, index, length);
+ index += length;
+ }
+ result[index++] = C_GENERIC_END;
+ }
+ result[index++] = C_PARAM_START;
+ for (int i = 0; i < parameterTypesCount; i++) {
+ char[] parameterType = parameterTypes[i];
+ int length = parameterType.length;
+ System.arraycopy(parameterType, 0, result, index, length);
+ index += length;
+ }
+ result[index++] = C_PARAM_END;
+ System.arraycopy(returnType, 0, result, index, returnTypeLength);
+ index += returnTypeLength;
+ if (thrownExceptionsCount > 0) {
+ for (int i = 0; i < thrownExceptionsCount; i++) {
+ result[index++] = C_THROWS;
+ char[] thrownException = thrownExceptions[i];
+ int length = thrownException.length;
+ System.arraycopy(thrownException, 0, result, index, length);
+ index += length;
+ }
+ }
+ return result;
+}
+
+/**
+ * Creates a method signature from the given parameter and return type
+ * signatures. The encoded method signature is dot-based. This method
+ * is equivalent to
+ * <code>createMethodSignature(new String[0], parameterTypes, returnType, new String[0])</code>.
+ *
+ * @param parameterTypes the list of parameter type signatures
+ * @param returnType the return type signature
* @return the encoded method signature
+ * @see Signature#createMethodSignature(String[], String[], String, String[])
*/
public static String createMethodSignature(String[] parameterTypes, String returnType) {
- int parameterTypesLenth = parameterTypes.length;
- char[][] parameters = new char[parameterTypesLenth][];
- for (int i = 0; i < parameterTypesLenth; i++) {
+ return createMethodSignature(parameterTypes, returnType, EMPTY_STRING_ARRAY, EMPTY_STRING_ARRAY);
+}
+
+/**
+ * Creates a method signature. The encoded method signature is dot-based.
+ *
+ * @param parameterTypes the list of parameter type signatures
+ * @param returnType the return type signature
+ * @param formalTypeParameters the list of formal type parameter signatures
+ * @param thrownExceptions the list of type signatures for thrown exceptions
+ * @return the encoded method signature
+ * @since 3.0
+ */
+public static String createMethodSignature(
+ String[] parameterTypes,
+ String returnType,
+ String[] formalTypeParameters,
+ String[] thrownExceptions) {
+ char[][] formalTypes = new char[formalTypeParameters.length][];
+ for (int i = 0; i < formalTypeParameters.length; i++) {
+ formalTypes[i] = formalTypeParameters[i].toCharArray();
+ }
+ char[][] parameters = new char[parameterTypes.length][];
+ for (int i = 0; i < parameterTypes.length; i++) {
parameters[i] = parameterTypes[i].toCharArray();
}
- return new String(createMethodSignature(parameters, returnType.toCharArray()));
+ char[][] exceptionTypes = new char[thrownExceptions.length][];
+ for (int i = 0; i < thrownExceptions.length; i++) {
+ exceptionTypes[i] = thrownExceptions[i].toCharArray();
+ }
+ return new String(createMethodSignature(parameters, returnType.toCharArray(), formalTypes, exceptionTypes));
}
+
+
/**
* Creates a new type signature from the given type name encoded as a character
* array. This method is equivalent to
@@ -438,7 +621,8 @@
* @since 2.0
*/
public static char[] createCharArrayTypeSignature(char[] typeName, boolean isResolved) {
-
+ // TODO (jerome) - needs to be reworked for parameterized types like List<String[]>[]
+
if (typeName == null) throw new IllegalArgumentException("null"); //$NON-NLS-1$
int length = typeName.length;
if (length == 0) throw new IllegalArgumentException(new String(typeName));
@@ -577,6 +761,10 @@
* createTypeSignature("String", false) -> "QString;"
* createTypeSignature("java.lang.String", false) -> "Qjava.lang.String;"
* createTypeSignature("int []", false) -> "[I"
+ * createTypeSignature("List<String>", false) -> "QList<QString;>;"
+ * createTypeSignature("List<?>", false) -> "QList<*>;"
+ * createTypeSignature("List<? extends EventListener>", false) -> "QList<-QEventListener;>;"
+ * createTypeSignature("List<? super Reader>", false) -> "QList<+QReader;>;"
* </code>
* </pre>
* </p>
@@ -587,10 +775,12 @@
* <code>false</code> if the type name is to be considered unresolved
* (for example, a type name found in source code)
* @return the encoded type signature
+ * TODO (jeem) - fundamental problem with resolve types involving type variables which are syntactically indistinguishable for type in default package
*/
public static String createTypeSignature(String typeName, boolean isResolved) {
return createTypeSignature(typeName == null ? null : typeName.toCharArray(), isResolved);
}
+
/**
* Returns the array count (array nesting depth) of the given type signature.
*
@@ -699,8 +889,10 @@
case C_VOID :
++count;
break;
+ case C_TYPE_VARIABLE :
case C_RESOLVED :
case C_UNRESOLVED :
+ // TODO (jeem) - rework to handle type arguments like QList<QString;>;
i = CharOperation.indexOf(C_SEMICOLON, methodSignature, i) + 1;
if (i == 0)
throw new IllegalArgumentException();
@@ -798,8 +990,10 @@
}
start = i;
break;
+ case C_TYPE_VARIABLE :
case C_RESOLVED :
case C_UNRESOLVED :
+ // TODO (jeem) - rework to handle type arguments like QList<QString;>;
i = CharOperation.indexOf(C_SEMICOLON, methodSignature, i) + 1;
if (i == 0)
throw new IllegalArgumentException();
@@ -834,6 +1028,106 @@
}
return result;
}
+
+/**
+ * Extracts the type variable name from the given formal type parameter
+ * signature. The signature is expected to be dot-based.
+ *
+ * @param formalTypeParameterSignature the formal type parameter signature
+ * @return the name of the type variable
+ * @exception IllegalArgumentException if the signature is syntactically
+ * incorrect
+ * @since 3.0
+ */
+public static String getTypeVariable(String formalTypeParameterSignature) throws IllegalArgumentException {
+ return new String(getTypeVariable(formalTypeParameterSignature.toCharArray()));
+}
+
+/**
+ * Extracts the type variable name from the given formal type parameter
+ * signature. The signature is expected to be dot-based.
+ *
+ * @param formalTypeParameterSignature the formal type parameter signature
+ * @return the name of the type variable
+ * @exception IllegalArgumentException if the signature is syntactically
+ * incorrect
+ * @since 3.0
+ */
+public static char[] getTypeVariable(char[] formalTypeParameterSignature) throws IllegalArgumentException {
+ int p = CharOperation.indexOf(C_COLON, formalTypeParameterSignature);
+ if (p < 0) {
+ // no ":" means can't be a formal type parameter signature
+ throw new IllegalArgumentException();
+ }
+ return CharOperation.subarray(formalTypeParameterSignature, 0, p);
+}
+
+/**
+ * Extracts the class and interface bounds from the given formal type
+ * parameter signature. The class bound, if present, is listed before
+ * the interface bounds. The signature is expected to be dot-based.
+ *
+ * @param formalTypeParameterSignature the formal type parameter signature
+ * @return the (possibly empty) list of type signatures for the bounds
+ * @exception IllegalArgumentException if the signature is syntactically
+ * incorrect
+ * @since 3.0
+ */
+public static char[][] getTypeParameterBounds(char[] formalTypeParameterSignature) throws IllegalArgumentException {
+ int p1 = CharOperation.indexOf(C_COLON, formalTypeParameterSignature);
+ if (p1 < 0) {
+ // no ":" means can't be a formal type parameter signature
+ throw new IllegalArgumentException();
+ }
+ if (p1 == formalTypeParameterSignature.length - 1) {
+ // no class or interface bounds
+ return CharOperation.NO_CHAR_CHAR;
+ }
+ int p2 = CharOperation.indexOf(C_COLON, formalTypeParameterSignature, p1 + 1);
+ char[] classBound;
+ if (p2 < 0) {
+ // no interface bounds
+ classBound = CharOperation.subarray(formalTypeParameterSignature, p1 + 1, formalTypeParameterSignature.length);
+ return new char[][] {classBound};
+ }
+ if (p2 == p1 + 1) {
+ // no class bound, but 1 or more interface bounds
+ classBound = null;
+ } else {
+ classBound = CharOperation.subarray(formalTypeParameterSignature, p1 + 1, p2);
+ }
+ char[][] interfaceBounds = CharOperation.splitOn(C_COLON, formalTypeParameterSignature, p2 + 1, formalTypeParameterSignature.length);
+ if (classBound == null) {
+ return interfaceBounds;
+ }
+ int resultLength = interfaceBounds.length + 1;
+ char[][] result = new char[resultLength][];
+ result[0] = classBound;
+ System.arraycopy(interfaceBounds, 0, result, 1, interfaceBounds.length);
+ return result;
+}
+
+/**
+ * Extracts the class and interface bounds from the given formal type
+ * parameter signature. The class bound, if present, is listed before
+ * the interface bounds. The signature is expected to be dot-based.
+ *
+ * @param formalTypeParameterSignature the formal type parameter signature
+ * @return the (possibly empty) list of type signatures for the bounds
+ * @exception IllegalArgumentException if the signature is syntactically
+ * incorrect
+ * @since 3.0
+ */
+public static String[] getTypeParameterBounds(String formalTypeParameterSignature) throws IllegalArgumentException {
+ char[][] bounds = getTypeParameterBounds(formalTypeParameterSignature.toCharArray());
+ int length = bounds.length;
+ String[] result = new String[length];
+ for (int i = 0; i < length; i++) {
+ result[i] = new String(bounds[i]);
+ }
+ return result;
+}
+
/**
* Returns a char array containing all but the last segment of the given
* dot-separated qualified name. Returns the empty char array if it is not qualified.
@@ -897,11 +1191,15 @@
* @since 2.0
*/
public static char[] getReturnType(char[] methodSignature) throws IllegalArgumentException {
+ // skip type parameters
int i = CharOperation.lastIndexOf(C_PARAM_END, methodSignature);
if (i == -1) {
throw new IllegalArgumentException();
}
- return CharOperation.subarray(methodSignature, i + 1, methodSignature.length);
+ // ignore any thrown exceptions
+ int j = CharOperation.indexOf(C_THROWS, methodSignature);
+ int last = (j == -1 ? methodSignature.length : j);
+ return CharOperation.subarray(methodSignature, i + 1, last);
}
/**
* Extracts the return type from the given method signature. The method signature is
@@ -1057,6 +1355,47 @@
* @since 2.0
*/
public static char[] toCharArray(char[] methodSignature, char[] methodName, char[][] parameterNames, boolean fullyQualifyTypeNames, boolean includeReturnType) {
+ return toCharArray(methodSignature, methodName, parameterNames, fullyQualifyTypeNames, includeReturnType, false, false);
+}
+
+/**
+ * Converts the given method signature to a readable form. The method signature is expected to
+ * be dot-based.
+ * <p>
+ * For example:
+ * <pre>
+ * <code>
+ * toString("([Ljava.lang.String;)V", "main", new String[] {"args"}, false, true) -> "void main(String[] args)"
+ * </code>
+ * </pre>
+ * </p>
+ *
+ * @param methodSignature the method signature to convert
+ * @param methodName the name of the method to insert in the result, or
+ * <code>null</code> if no method name is to be included
+ * @param parameterNames the parameter names to insert in the result, or
+ * <code>null</code> if no parameter names are to be included; if supplied,
+ * the number of parameter names must match that of the method signature
+ * @param fullyQualifyTypeNames <code>true</code> if type names should be fully
+ * qualified, and <code>false</code> to use only simple names
+ * @param includeReturnType <code>true</code> if the return type is to be
+ * included
+ * @param includeFormalTypeParameters <code>true</code> if any formal type
+ * parameters are to be included
+ * @param includeThrownExceptions <code>true</code> if any thrown exceptions
+ * are to be included
+ * @return the char array representation of the method signature
+ * @since 3.0
+ */
+public static char[] toCharArray(
+ char[] methodSignature,
+ char[] methodName,
+ char[][] parameterNames,
+ boolean fullyQualifyTypeNames,
+ boolean includeReturnType,
+ boolean includeFormalTypeParameters,
+ boolean includeThrownExceptions) {
+ // TODO (jeem) - needs to handle includeFormalTypeParameters and includeThrownExceptions
try {
int firstParen = CharOperation.indexOf(C_PARAM_START, methodSignature);
if (firstParen == -1) throw new IllegalArgumentException();
@@ -1207,6 +1546,8 @@
throw new IllegalArgumentException();
}
}
+
+
/**
* Converts the given type signature to a readable string. The signature is expected to
* be dot-based.
@@ -1239,7 +1580,7 @@
try {
int sigLength = signature.length;
- if (sigLength == 0 || signature[0] == C_PARAM_START) {
+ if (sigLength == 0 || signature[0] == C_PARAM_START || signature[0] == C_GENERIC_START) {
return toCharArray(signature, CharOperation.NO_CHAR, null, true, true);
}
@@ -1277,8 +1618,10 @@
case C_VOID :
resultLength += VOID.length;
break;
+ case C_TYPE_VARIABLE :
case C_RESOLVED :
case C_UNRESOLVED :
+ // TODO (jeem) - needs to handle type arguments
int end = CharOperation.indexOf(C_SEMICOLON, signature, index);
if (end == -1) throw new IllegalArgumentException();
int start = index + 1;
@@ -1401,12 +1744,41 @@
}
/**
* Converts the given method signature to a readable string. The method signature is expected to
+ * be dot-based. This method is equivalent to
+ * <code>toString(methodSignature, methodName, parameterNames, fullyQualifyTypeNames, includeReturnType, false, false)</code>.
+ *
+ * @param methodSignature the method signature to convert
+ * @param methodName the name of the method to insert in the result, or
+ * <code>null</code> if no method name is to be included
+ * @param parameterNames the parameter names to insert in the result, or
+ * <code>null</code> if no parameter names are to be included; if supplied,
+ * the number of parameter names must match that of the method signature
+ * @param fullyQualifyTypeNames <code>true</code> if type names should be fully
+ * qualified, and <code>false</code> to use only simple names
+ * @param includeReturnType <code>true</code> if the return type is to be
+ * included
+ * @see #toString(String, String, String[], boolean, boolean, boolean, boolean)
+ * @return the string representation of the method signature
+ */
+public static String toString(String methodSignature, String methodName, String[] parameterNames, boolean fullyQualifyTypeNames, boolean includeReturnType) {
+ return new String(toString(
+ methodSignature,
+ methodName,
+ parameterNames,
+ fullyQualifyTypeNames,
+ includeReturnType,
+ false,
+ false));
+}
+
+/**
+ * Converts the given method signature to a readable string. The method signature is expected to
* be dot-based.
* <p>
* For example:
* <pre>
* <code>
- * toString("([Ljava.lang.String;)V", "main", new String[] {"args"}, false, true) -> "void main(String[] args)"
+ * toString("([Ljava.lang.String;)V", "main", new String[] {"args"}, false, true, false, false) -> "void main(String[] args)"
* </code>
* </pre>
* </p>
@@ -1421,9 +1793,21 @@
* qualified, and <code>false</code> to use only simple names
* @param includeReturnType <code>true</code> if the return type is to be
* included
+ * @param includeFormalTypeParameters <code>true</code> if any formal type
+ * parameters are to be included
+ * @param includeThrownExceptions <code>true</code> if any thrown exceptions
+ * are to be included
* @return the string representation of the method signature
+ * @since 3.0
*/
-public static String toString(String methodSignature, String methodName, String[] parameterNames, boolean fullyQualifyTypeNames, boolean includeReturnType) {
+public static String toString(
+ String methodSignature,
+ String methodName,
+ String[] parameterNames,
+ boolean fullyQualifyTypeNames,
+ boolean includeReturnType,
+ boolean includeFormalTypeParameters,
+ boolean includeThrownExceptions) {
char[][] params;
if (parameterNames == null) {
params = null;
@@ -1434,6 +1818,14 @@
params[i] = parameterNames[i].toCharArray();
}
}
- return new String(toCharArray(methodSignature.toCharArray(), methodName == null ? null : methodName.toCharArray(), params, fullyQualifyTypeNames, includeReturnType));
+ return new String(toCharArray(
+ methodSignature.toCharArray(),
+ methodName == null ? null : methodName.toCharArray(),
+ params,
+ fullyQualifyTypeNames,
+ includeReturnType,
+ includeFormalTypeParameters,
+ includeThrownExceptions));
}
+
}
diff --git a/model/org/eclipse/jdt/core/compiler/ITerminalSymbols.java b/model/org/eclipse/jdt/core/compiler/ITerminalSymbols.java
index 960333d..fe192f6 100644
--- a/model/org/eclipse/jdt/core/compiler/ITerminalSymbols.java
+++ b/model/org/eclipse/jdt/core/compiler/ITerminalSymbols.java
@@ -15,126 +15,141 @@
* Maps each terminal symbol in the java-grammar into a unique integer.
* This integer is used to represent the terminal when computing a parsing action.
*
- * Disclaimer : These constant values are generated automatically using a Java
- * grammar, therefore their actual values are subject to change if new keywords
- * were added to the language (for instance, 'assert' is a keyword in 1.4).
- *
* @see IScanner
* @since 2.0
*/
public interface ITerminalSymbols {
- // special tokens not part of grammar - not autogenerated
- int
- TokenNameWHITESPACE = 1000,
- TokenNameCOMMENT_LINE = 1001,
- TokenNameCOMMENT_BLOCK = 1002,
- TokenNameCOMMENT_JAVADOC = 1003;
+ int TokenNameWHITESPACE = 1000;
+ int TokenNameCOMMENT_LINE = 1001;
+ int TokenNameCOMMENT_BLOCK = 1002;
+ int TokenNameCOMMENT_JAVADOC = 1003;
- int
- TokenNameIdentifier = 5,
- TokenNameabstract = 98,
- TokenNameassert = 118,
- TokenNameboolean = 18,
- TokenNamebreak = 119,
- TokenNamebyte = 19,
- TokenNamecase = 211,
- TokenNamecatch = 225,
- TokenNamechar = 20,
- TokenNameclass = 165,
- TokenNamecontinue = 120,
- TokenNamedefault = 212,
- TokenNamedo = 121,
- TokenNamedouble = 21,
- TokenNameelse = 213,
- TokenNameextends = 243,
- TokenNamefalse = 37,
- TokenNamefinal = 99,
- TokenNamefinally = 226,
- TokenNamefloat = 22,
- TokenNamefor = 122,
- TokenNameif = 123,
- TokenNameimplements = 268,
- TokenNameimport = 191,
- TokenNameinstanceof = 65,
- TokenNameint = 23,
- TokenNameinterface = 180,
- TokenNamelong = 24,
- TokenNamenative = 100,
- TokenNamenew = 32,
- TokenNamenull = 38,
- TokenNamepackage = 214,
- TokenNameprivate = 101,
- TokenNameprotected = 102,
- TokenNamepublic = 103,
- TokenNamereturn = 124,
- TokenNameshort = 25,
- TokenNamestatic = 94,
- TokenNamestrictfp = 104,
- TokenNamesuper = 33,
- TokenNameswitch = 125,
- TokenNamesynchronized = 85,
- TokenNamethis = 34,
- TokenNamethrow = 126,
- TokenNamethrows = 227,
- TokenNametransient = 105,
- TokenNametrue = 39,
- TokenNametry = 127,
- TokenNamevoid = 26,
- TokenNamevolatile = 106,
- TokenNamewhile = 117,
- TokenNameIntegerLiteral = 40,
- TokenNameLongLiteral = 41,
- TokenNameFloatingPointLiteral = 42,
- TokenNameDoubleLiteral = 43,
- TokenNameCharacterLiteral = 44,
- TokenNameStringLiteral = 45,
- TokenNamePLUS_PLUS = 1,
- TokenNameMINUS_MINUS = 2,
- TokenNameEQUAL_EQUAL = 35,
- TokenNameLESS_EQUAL = 66,
- TokenNameGREATER_EQUAL = 67,
- TokenNameNOT_EQUAL = 36,
- TokenNameLEFT_SHIFT = 14,
- TokenNameRIGHT_SHIFT = 11,
- TokenNameUNSIGNED_RIGHT_SHIFT = 12,
- TokenNamePLUS_EQUAL = 168,
- TokenNameMINUS_EQUAL = 169,
- TokenNameMULTIPLY_EQUAL = 170,
- TokenNameDIVIDE_EQUAL = 171,
- TokenNameAND_EQUAL = 172,
- TokenNameOR_EQUAL = 173,
- TokenNameXOR_EQUAL = 174,
- TokenNameREMAINDER_EQUAL = 175,
- TokenNameLEFT_SHIFT_EQUAL = 176,
- TokenNameRIGHT_SHIFT_EQUAL = 177,
- TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = 178,
- TokenNameOR_OR = 80,
- TokenNameAND_AND = 79,
- TokenNamePLUS = 3,
- TokenNameMINUS = 4,
- TokenNameNOT = 71,
- TokenNameREMAINDER = 9,
- TokenNameXOR = 63,
- TokenNameAND = 62,
- TokenNameMULTIPLY = 8,
- TokenNameOR = 70,
- TokenNameTWIDDLE = 72,
- TokenNameDIVIDE = 10,
- TokenNameGREATER = 68,
- TokenNameLESS = 69,
- TokenNameLPAREN = 7,
- TokenNameRPAREN = 86,
- TokenNameLBRACE = 110,
- TokenNameRBRACE = 95,
- TokenNameLBRACKET = 15,
- TokenNameRBRACKET = 166,
- TokenNameSEMICOLON = 64,
- TokenNameQUESTION = 81,
- TokenNameCOLON = 154,
- TokenNameCOMMA = 90,
- TokenNameDOT = 6,
- TokenNameEQUAL = 167,
- TokenNameEOF = 158,
- TokenNameERROR = 309;
+ int TokenNameIdentifier = 5;
+ int TokenNameabstract = 98;
+
+ /**
+ * "assert" token (added in J2SE 1.4).
+ */
+ int TokenNameassert = 118;
+ int TokenNameboolean = 18;
+ int TokenNamebreak = 119;
+ int TokenNamebyte = 19;
+ int TokenNamecase = 211;
+ int TokenNamecatch = 225;
+ int TokenNamechar = 20;
+ int TokenNameclass = 165;
+ int TokenNamecontinue = 120;
+ int TokenNamedefault = 212;
+ int TokenNamedo = 121;
+ int TokenNamedouble = 21;
+ int TokenNameelse = 213;
+ int TokenNameextends = 243;
+ int TokenNamefalse = 37;
+ int TokenNamefinal = 99;
+ int TokenNamefinally = 226;
+ int TokenNamefloat = 22;
+ int TokenNamefor = 122;
+ int TokenNameif = 123;
+ int TokenNameimplements = 268;
+ int TokenNameimport = 191;
+ int TokenNameinstanceof = 65;
+ int TokenNameint = 23;
+ int TokenNameinterface = 180;
+ int TokenNamelong = 24;
+ int TokenNamenative = 100;
+ int TokenNamenew = 32;
+ int TokenNamenull = 38;
+ int TokenNamepackage = 214;
+ int TokenNameprivate = 101;
+ int TokenNameprotected = 102;
+ int TokenNamepublic = 103;
+ int TokenNamereturn = 124;
+ int TokenNameshort = 25;
+ int TokenNamestatic = 94;
+ int TokenNamestrictfp = 104;
+ int TokenNamesuper = 33;
+ int TokenNameswitch = 125;
+ int TokenNamesynchronized = 85;
+ int TokenNamethis = 34;
+ int TokenNamethrow = 126;
+ int TokenNamethrows = 227;
+ int TokenNametransient = 105;
+ int TokenNametrue = 39;
+ int TokenNametry = 127;
+ int TokenNamevoid = 26;
+ int TokenNamevolatile = 106;
+ int TokenNamewhile = 117;
+ int TokenNameIntegerLiteral = 40;
+ int TokenNameLongLiteral = 41;
+ int TokenNameFloatingPointLiteral = 42;
+ int TokenNameDoubleLiteral = 43;
+ int TokenNameCharacterLiteral = 44;
+ int TokenNameStringLiteral = 45;
+ int TokenNamePLUS_PLUS = 1;
+ int TokenNameMINUS_MINUS = 2;
+ int TokenNameEQUAL_EQUAL = 35;
+ int TokenNameLESS_EQUAL = 66;
+ int TokenNameGREATER_EQUAL = 67;
+ int TokenNameNOT_EQUAL = 36;
+ int TokenNameLEFT_SHIFT = 14;
+ int TokenNameRIGHT_SHIFT = 11;
+ int TokenNameUNSIGNED_RIGHT_SHIFT = 12;
+ int TokenNamePLUS_EQUAL = 168;
+ int TokenNameMINUS_EQUAL = 169;
+ int TokenNameMULTIPLY_EQUAL = 170;
+ int TokenNameDIVIDE_EQUAL = 171;
+ int TokenNameAND_EQUAL = 172;
+ int TokenNameOR_EQUAL = 173;
+ int TokenNameXOR_EQUAL = 174;
+ int TokenNameREMAINDER_EQUAL = 175;
+ int TokenNameLEFT_SHIFT_EQUAL = 176;
+ int TokenNameRIGHT_SHIFT_EQUAL = 177;
+ int TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = 178;
+ int TokenNameOR_OR = 80;
+ int TokenNameAND_AND = 79;
+ int TokenNamePLUS = 3;
+ int TokenNameMINUS = 4;
+ int TokenNameNOT = 71;
+ int TokenNameREMAINDER = 9;
+ int TokenNameXOR = 63;
+ int TokenNameAND = 62;
+ int TokenNameMULTIPLY = 8;
+ int TokenNameOR = 70;
+ int TokenNameTWIDDLE = 72;
+ int TokenNameDIVIDE = 10;
+ int TokenNameGREATER = 68;
+ int TokenNameLESS = 69;
+ int TokenNameLPAREN = 7;
+ int TokenNameRPAREN = 86;
+ int TokenNameLBRACE = 110;
+ int TokenNameRBRACE = 95;
+ int TokenNameLBRACKET = 15;
+ int TokenNameRBRACKET = 166;
+ int TokenNameSEMICOLON = 64;
+ int TokenNameQUESTION = 81;
+ int TokenNameCOLON = 154;
+ int TokenNameCOMMA = 90;
+ int TokenNameDOT = 6;
+ int TokenNameEQUAL = 167;
+ int TokenNameEOF = 158;
+ int TokenNameERROR = 309;
+
+ /**
+ * "enum" keyword (added in J2SE 1.5).
+ * @since 3.0
+ */
+ int TokenNameenum = 400;
+
+ /**
+ * "@" token (added in J2SE 1.5).
+ * @since 3.0
+ */
+ int TokenNameAT = 401;
+
+ /**
+ * "..." token (added in J2SE 1.5).
+ * @since 3.0
+ */
+ int TokenNameELLIPSIS = 402;
}
diff --git a/model/org/eclipse/jdt/core/eval/IEvaluationContext.java b/model/org/eclipse/jdt/core/eval/IEvaluationContext.java
index c26abf2..5b2ded6 100644
--- a/model/org/eclipse/jdt/core/eval/IEvaluationContext.java
+++ b/model/org/eclipse/jdt/core/eval/IEvaluationContext.java
@@ -394,7 +394,6 @@
* length (INDEX_OUT_OF_BOUNDS)</li>
* </ul>
* @deprecated - use codeComplete(String, int, ICompletionRequestor) instead
- * TODO remove before 3.0
*/
public void codeComplete(
String codeSnippet,
diff --git a/model/org/eclipse/jdt/core/jdom/IDOMFactory.java b/model/org/eclipse/jdt/core/jdom/IDOMFactory.java
index d6a3a76..9c229c7 100644
--- a/model/org/eclipse/jdt/core/jdom/IDOMFactory.java
+++ b/model/org/eclipse/jdt/core/jdom/IDOMFactory.java
@@ -96,7 +96,7 @@
public IDOMField createField(String sourceCode);
/**
* Creates an empty import document fragment. Initially the import will have
- * name <code>"java.lang.*"</code>.
+ * name <code>"java.lang.*"</code> and be non-static.
*
* @return the new import
*/
diff --git a/model/org/eclipse/jdt/core/jdom/IDOMImport.java b/model/org/eclipse/jdt/core/jdom/IDOMImport.java
index 24af92c..8d91307 100644
--- a/model/org/eclipse/jdt/core/jdom/IDOMImport.java
+++ b/model/org/eclipse/jdt/core/jdom/IDOMImport.java
@@ -20,14 +20,6 @@
*/
public interface IDOMImport extends IDOMNode {
/**
- * Returns the flags for this member. The flags can be examined using the
- * <code>Flags</code> class.
- *
- * @return the flags
- * @see org.eclipse.jdt.core.Flags
- */
-public int getFlags();
-/**
* The <code>IDOMImport</code> refinement of this <code>IDOMNode</code>
* method returns the name of this import. The syntax for an import name
* corresponds to a fully qualified type name, or to an on-demand package name
@@ -42,6 +34,37 @@
* @return <code>true</code> if this in an on-demand import
*/
public boolean isOnDemand();
+
+/**
+ * Returns the modifier flags for this import. The flags can be examined using class
+ * <code>Flags</code>. Only the static flag is meaningful for import declarations.
+ * <p>
+ * Note: Static imports are an experimental language feature
+ * under discussion in JSR-201 and under consideration for inclusion
+ * in the 1.5 release of J2SE. The support here is therefore tentative
+ * and subject to change.
+ * </p>
+ * @return the modifier flags for this import
+ * @see Flags
+ * @since 3.0
+ */
+int getFlags();
+
+/**
+ * Sets the modifier flags for this import. The flags can be examined using class
+ * <code>Flags</code>. Only the static flag is meaningful for import declarations.
+ * <p>
+ * Note: Static imports are an experimental language feature
+ * under discussion in JSR-201 and under consideration for inclusion
+ * in the 1.5 release of J2SE. The support here is therefore tentative
+ * and subject to change.
+ * </p>
+ * @param flags the modifier flags for this import
+ * @see Flags
+ * @since 3.0
+ */
+void setFlags(int flags);
+
/**
* The <code>IDOMImport</code> refinement of this <code>IDOMNode</code>
* method sets the name of this import. The syntax for an import name
diff --git a/model/org/eclipse/jdt/core/jdom/IDOMMethod.java b/model/org/eclipse/jdt/core/jdom/IDOMMethod.java
index a9cadf7..ffb70fd 100644
--- a/model/org/eclipse/jdt/core/jdom/IDOMMethod.java
+++ b/model/org/eclipse/jdt/core/jdom/IDOMMethod.java
@@ -16,6 +16,7 @@
* ConstructorDeclaration (JLS2 8.8), and AbstractMethodDeclaration (JLS2 9.4).
* A method has no children and its parent is a type.
* Local classes are considered to be part of the body of a method, not a child.
+ * Annotation type members, added in J2SE 1.5, are represented as methods.
* <p>
* This interface is not intended to be implemented by clients.
* </p>
@@ -58,6 +59,25 @@
* example, for an abstract or native method)
*/
public String getBody();
+
+/**
+ * Sets the default value expression for an annotation type member.
+ *
+ * @param defaultValue the default value expression, or <code>null</code> indicating
+ * the member does not have a default value
+ * @since 3.0
+ */
+public void setDefault(String defaultValue);
+
+/**
+ * Returns the default value expression for an annotation type member.
+ *
+ * @return the default value expression, or <code>null</code> indicating
+ * the member does not have a default value
+ * @since 3.0
+ */
+public String getDefault();
+
/**
* Returns the names of the exception types this method throws
* in the order in which they are declared in the source, or an empty array
@@ -69,6 +89,21 @@
* @return the list of exception types
*/
public String[] getExceptions();
+
+/**
+ * Returns the formal type parameters for this method.
+ * Returns an empty array if this method has no formal type parameters.
+ * <p>Formal type parameters are as they appear in the source
+ * code; for example:
+ * <code>"X extends List<String> & Serializable"</code>.
+ * </p>
+ *
+ * @return the formal type parameters of this method,
+ * in the order declared in the source, an empty array if none
+ * @since 3.0
+ */
+String[] getTypeParameters();
+
/**
* The <code>IDOMMethod</code> refinement of this <code>IDOMNode</code>
* method returns the name of this method. Returns <code>null</code> for
@@ -110,12 +145,14 @@
* @return the return type
*/
public String getReturnType();
+
/**
* Returns whether this method is a constructor.
*
* @return <code>true</code> for constructors, and <code>false</code> for methods
*/
public boolean isConstructor();
+
/**
* Sets the body of this method. The method body includes all code following
* the method declaration, including the enclosing braces. No formatting or
@@ -142,6 +179,20 @@
* @param exceptionTypes the list of exception types
*/
public void setExceptions(String[] exceptionTypes);
+
+/**
+ * Sets the formal type parameters for this method.
+ * <p>Formal type parameters are given as they appear in the source
+ * code; for example:
+ * <code>"X extends List<String> & Serializable"</code>.
+ * </p>
+ *
+ * @param typeParameters the formal type parameters of this method,
+ * in the order to appear in the source, an empty array if none
+ * @since 3.0
+ */
+void setTypeParameters(String[] typeParameters);
+
/**
* The <code>IDOMMethod</code> refinement of this <code>IDOMNode</code>
* method sets the name of this method. The syntax for a method
@@ -171,6 +222,7 @@
* match, or if either argument is <code>null</code>
*/
public void setParameters(String[] types, String[] names) throws IllegalArgumentException;
+
/**
* Sets the return type name. This has no effect on constructors.
* The syntax for return type name corresponds to ReturnType in
@@ -182,4 +234,5 @@
* @exception IllegalArgumentException if <code>null</code> is specified
*/
public void setReturnType(String type) throws IllegalArgumentException;
+
}
diff --git a/model/org/eclipse/jdt/core/jdom/IDOMType.java b/model/org/eclipse/jdt/core/jdom/IDOMType.java
index 581d700..e74ed7b 100644
--- a/model/org/eclipse/jdt/core/jdom/IDOMType.java
+++ b/model/org/eclipse/jdt/core/jdom/IDOMType.java
@@ -13,6 +13,8 @@
/**
* Represents a source type in a compilation unit, either as a top-level type or a member type.
* The corresponding syntactic units are ClassDeclaration (JLS2 8.1) and InterfaceDeclaration (JLS2 9.1).
+ * Enumeration types and annotation types, added in J2SE 1.5, are represented as
+ * classes and interfaces, respectively.
* <p>
* Allowable child types for a type are <code>IDOMType</code>, <code>IDOMField</code>,
* <code>IDOMMethod</code>, and <code>IDOMInitializer</code>.
@@ -39,6 +41,21 @@
* @exception IllegalArgumentException if <code>null</code> is specified
*/
public void addSuperInterface(String interfaceName) throws IllegalArgumentException;
+
+/**
+ * Returns the formal type parameters for this type.
+ * Returns an empty array if this method has no formal type parameters.
+ * <p>Formal type parameters are as they appear in the source
+ * code; for example:
+ * <code>"X extends List<String> & Serializable"</code>.
+ * </p>
+ *
+ * @return the formal type parameters of this type,
+ * in the order declared in the source, an empty array if none
+ * @since 3.0
+ */
+String[] getTypeParameters();
+
/**
* The <code>IDOMType</code> refinement of this <code>IDOMNode</code>
* method returns the name of this type. The name of a class is defined by
@@ -53,6 +70,8 @@
* is specified by Super in ClassDeclaration (JLS2 8.1). Type names must be
* specified as they would appear in source code. For example:
* <code>"Object"</code>, or <code>"java.io.File"</code>.
+ * As of J2SE 1.5, the superclass may also include parameterized
+ * types like <code>"ArrayList<String>"</code>.
*
* @return the superclass name, or <code>null</code> if this type represents
* an interface or if no superclass has been assigned to this class
@@ -65,6 +84,8 @@
* defined by Interfaces in ClassDeclaration (JLS2 8.1). Type names appear
* as they would in source code. For example: <code>"Cloneable"</code>,
* or <code>"java.io.Serializable"</code>.
+ * As of J2SE 1.5, superinterfaces may also include parameterized
+ * types like <code>"List<String>"</code>.
* <p>
* For classes, this method returns the interfaces that this class implements.
* For interfaces, this method returns the interfaces that this interface extends.
@@ -79,6 +100,23 @@
* @return <code>true</code> for classes, and <code>false</code> for interfaces
*/
public boolean isClass();
+
+/**
+ * Returns whether this type represents an enumeration class ("enum" instead of "class").
+ *
+ * @return true if this type represents an enumeration class, false otherwise
+ * @since 3.0
+ */
+boolean isEnum();
+
+/**
+ * Returns whether this type represents an annotation type ("@interface" instead of "interface").
+ *
+ * @return true if this type represents an annotation type, false otherwise
+ * @since 3.0
+ */
+boolean isAnnotation();
+
/**
* Sets whether this type is a class or an interface. If this type is
* a class, and is changed to an interface, this type's superclass
@@ -90,6 +128,44 @@
* @param b <code>true</code> for classes, and <code>false</code> for interfaces
*/
public void setClass(boolean b);
+
+/**
+ * Sets whether this type represents an enumeration class.
+ * If this type is a class and is changed to an enum,
+ * this type's superclass becomes <code>null</code>.
+ * If this type is an interface (including an annotation type),
+ * and is changed to an enum, this type is also changed to a class.
+ *
+ * @param b <code>true</code> for enum classes, and <code>false</code> otherwise
+ * @since 3.0
+ */
+public void setEnum(boolean b);
+
+/**
+ * Sets whether this type represents an annotation type ("@interface" instead of "interface").
+ * If this type is a interface and is changed to an enum,
+ * this type's superclass becomes <code>null</code> and its superinterface list
+ * becomes empty. If this type is an class (including an enum),
+ * and is changed to an annotation type, this type is also changed to an interface.
+ *
+ * @param b <code>true</code> for an annotation type, and <code>false</code> otherwise
+ * @since 3.0
+ */
+public void setAnnotation(boolean b);
+
+/**
+ * Sets the formal type parameters for this type.
+ * <p>Formal type parameters are given as they appear in the source
+ * code; for example:
+ * <code>"X extends List<String> & Serializable"</code>.
+ * </p>
+ *
+ * @param typeParameters the formal type parameters of this type,
+ * in the order to appear in the source, an empty array if none
+ * @since 3.0
+ */
+void setTypeParameters(String[] typeParameters);
+
/**
* The <code>IDOMType</code> refinement of this <code>IDOMNode</code>
* method sets the name of this type. The name of a class is defined by
@@ -107,6 +183,8 @@
* The syntax for a superclass name is specified by Super in ClassDeclaration
* (JLS2 8.1). Type names must be specified as they would appear in source code.
* For example: <code>"Object"</code>, or <code>"java.io.File"</code>.
+ * As of J2SE 1.5, the superclass may also include parameterized
+ * types like <code>"ArrayList<String>"</code>.
*
* @param superclassName the superclass name, or <code>null</code> if this type
* should have to no explicitly specified superclass
@@ -119,6 +197,8 @@
* interface names is defined by Interfaces in ClassDeclaration (JLS2 8.1).
* Type names appear as they would in source code. For example:
* <code>"Cloneable"</code>, or <code>"java.io.Serializable"</code>.
+ * As of J2SE 1.5, superinterfaces may also include parameterized
+ * types like <code>"List<String>"</code>.
* <p>
* For classes, this method sets the interfaces that this class implements.
* For interfaces, this method sets the interfaces that this interface extends.
diff --git a/model/org/eclipse/jdt/core/jdom/package.html b/model/org/eclipse/jdt/core/jdom/package.html
index 4fa6750..c008219 100644
--- a/model/org/eclipse/jdt/core/jdom/package.html
+++ b/model/org/eclipse/jdt/core/jdom/package.html
@@ -7,11 +7,16 @@
<title>Package-level Javadoc</title>
</head>
<body>
-Provides a support for java document manipulation
+Provides a support for Java document manipulation
through the JDOM model.
<h2>
Package Specification</h2>
-This package provides a support for java document manipulation throught
+This package provides a support for Java document manipulation throught
the JDOM model.
+<p>
+The JDOM was made obsolete by the addition in 2.0 of the more
+powerful, fine-grained DOM/AST API found in the
+<code>org.eclipse.jdt.core.dom</code> package.
+</p>
</body>
</html>
diff --git a/model/org/eclipse/jdt/core/util/IAnnotation.java b/model/org/eclipse/jdt/core/util/IAnnotation.java
index 0196bdb..be700af 100644
--- a/model/org/eclipse/jdt/core/util/IAnnotation.java
+++ b/model/org/eclipse/jdt/core/util/IAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,7 +11,8 @@
package org.eclipse.jdt.core.util;
/**
- * Description of a annotation structure as described in the JVM specifications.
+ * Description of a annotation structure as described in the JVM specifications
+ * (added in J2SE 1.5).
*
* This interface may be implemented by clients.
*
diff --git a/model/org/eclipse/jdt/core/util/IAnnotationComponent.java b/model/org/eclipse/jdt/core/util/IAnnotationComponent.java
index 27f67c7..f1734bd 100644
--- a/model/org/eclipse/jdt/core/util/IAnnotationComponent.java
+++ b/model/org/eclipse/jdt/core/util/IAnnotationComponent.java
@@ -12,6 +12,7 @@
/**
* Description of an annotation component as described in the JVM specifications.
+ * (added in J2SE 1.5).
*
* This interface may be implemented by clients.
*
diff --git a/model/org/eclipse/jdt/core/util/IAnnotationComponentValue.java b/model/org/eclipse/jdt/core/util/IAnnotationComponentValue.java
index 9279b82..3402463 100644
--- a/model/org/eclipse/jdt/core/util/IAnnotationComponentValue.java
+++ b/model/org/eclipse/jdt/core/util/IAnnotationComponentValue.java
@@ -12,6 +12,7 @@
/**
* Description of an annotation component value as described in the JVM specifications.
+ * (added in J2SE 1.5).
*
* This interface may be implemented by clients.
*
diff --git a/model/org/eclipse/jdt/core/util/IAnnotationDefaultAttribute.java b/model/org/eclipse/jdt/core/util/IAnnotationDefaultAttribute.java
index dea1ba8..4cfd923 100644
--- a/model/org/eclipse/jdt/core/util/IAnnotationDefaultAttribute.java
+++ b/model/org/eclipse/jdt/core/util/IAnnotationDefaultAttribute.java
@@ -12,7 +12,7 @@
/**
* Description of a annotation default attribute as described in the JVM
- * specifications.
+ * specifications (added in J2SE 1.5).
*
* This interface may be implemented by clients.
*
diff --git a/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java b/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java
index ac52e0a..e3b6da2 100644
--- a/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java
+++ b/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java
@@ -18,45 +18,115 @@
* @since 2.0
*/
public interface IAttributeNamesConstants {
- char[] SYNTHETIC = new char[] {'S', 'y', 'n', 't', 'h', 'e', 't', 'i', 'c'};
- char[] CONSTANT_VALUE = new char[] {'C', 'o', 'n', 's', 't', 'a', 'n', 't', 'V', 'a', 'l', 'u', 'e'};
- char[] LINE_NUMBER= new char[] {'L', 'i', 'n', 'e', 'N', 'u', 'm', 'b', 'e', 'r', 'T', 'a', 'b', 'l', 'e'};
- char[] LOCAL_VARIABLE = new char[] {'L', 'o', 'c', 'a', 'l', 'V', 'a', 'r', 'i', 'a', 'b', 'l', 'e', 'T', 'a', 'b', 'l', 'e'};
- char[] INNER_CLASSES = new char[] {'I', 'n', 'n', 'e', 'r', 'C', 'l', 'a', 's', 's', 'e', 's'};
- char[] CODE = new char[] {'C', 'o', 'd', 'e'};
- char[] EXCEPTIONS = new char[] {'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n', 's'};
- char[] SOURCE = new char[] {'S', 'o', 'u', 'r', 'c', 'e', 'F', 'i', 'l', 'e'};
- char[] DEPRECATED = new char[] {'D', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd'};
/**
- * @since 3.1
+ * "Synthetic" attribute.
+ * <p>Note that prior to JDK 1.5, synthetic elements were always marked
+ * using an attribute; with 1.5, synthetic elements can also be marked
+ * using the {@link IModifierConstants#ACC_SYNTHETIC} flag.
+ * </p>
+ * @since 2.0
*/
- char[] SIGNATURE = new char[] {'S', 'i', 'g', 'n', 'a', 't', 'u', 'r', 'e'};
+ char[] SYNTHETIC = "Synthetic".toCharArray(); //$NON-NLS-1$
+
/**
- * @since 3.1
+ * "ConstantValue" attribute.
+ * @since 2.0
*/
- char[] ENCLOSING_METHOD = new char[] {'E', 'n', 'c', 'l', 'o', 's', 'i', 'n', 'g', 'M', 'e', 't', 'h', 'o', 'd'};
+ char[] CONSTANT_VALUE = "ConstantValue".toCharArray(); //$NON-NLS-1$
+
/**
- * @since 3.1
+ * "LineNumberTable" attribute.
+ * @since 2.0
*/
- char[] LOCAL_VARIABLE_TYPE_TABLE = new char[] {'L', 'o', 'c', 'a', 'l', 'V', 'a', 'r', 'i', 'a', 'b', 'l', 'e', 'T', 'y', 'p', 'e', 'T', 'a', 'b', 'l', 'e'};
+ char[] LINE_NUMBER = "LineNumberTable".toCharArray(); //$NON-NLS-1$
+
/**
- * @since 3.1
+ * "LocalVariableTable" attribute.
+ * @since 2.0
*/
- char[] RUNTIME_VISIBLE_ANNOTATIONS= "RuntimeVisibleAnnotations".toCharArray(); //$NON-NLS-1$
+ char[] LOCAL_VARIABLE = "LocalVariableTable".toCharArray(); //$NON-NLS-1$
+
/**
- * @since 3.1
+ * "InnerClasses" attribute.
+ * @since 2.0
*/
- char[] RUNTIME_INVISIBLE_ANNOTATIONS= "RuntimeInvisibleAnnotations".toCharArray();//$NON-NLS-1$
+ char[] INNER_CLASSES = "InnerClasses".toCharArray(); //$NON-NLS-1$
+
/**
- * @since 3.1
+ * "Code" attribute.
+ * @since 2.0
*/
- char[] RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS= "RuntimeVisibleParameterAnnotations".toCharArray();//$NON-NLS-1$
+ char[] CODE = "Code".toCharArray(); //$NON-NLS-1$
+
/**
- * @since 3.1
+ * "Exceptions" attribute.
+ * @since 2.0
*/
- char[] RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS= "RuntimeInvisibleParameterAnnotations".toCharArray();//$NON-NLS-1$
+ char[] EXCEPTIONS = "Exceptions".toCharArray(); //$NON-NLS-1$
+
/**
- * @since 3.1
+ * "SourceFile" attribute.
+ * @since 2.0
*/
- char[] ANNOTATION_DEFAULT = "AnnotationDefault".toCharArray();//$NON-NLS-1$
+ char[] SOURCE = "SourceFile".toCharArray(); //$NON-NLS-1$
+
+ /**
+ * "Deprecated" attribute.
+ * @since 2.0
+ */
+ char[] DEPRECATED = "Deprecated".toCharArray(); //$NON-NLS-1$
+
+ /**
+ * "Signature" attribute (added in J2SE 1.5).
+ * Class file readers which support J2SE 1.5 return
+ * attributes with this name represented by objects
+ * implementing {@link ISignatureAttribute}.
+ * @since 3.0
+ */
+ char[] SIGNATURE = "Signature".toCharArray(); //$NON-NLS-1$
+
+ /**
+ * "EnclosingMethod" attribute (added in J2SE 1.5).
+ * Class file readers which support J2SE 1.5 return
+ * attributes with this name represented by objects
+ * implementing {@link IEnclosingMethodAttribute}.
+ * @since 3.0
+ */
+ char[] ENCLOSING_METHOD = "EnclosingMethod".toCharArray(); //$NON-NLS-1$
+
+ /**
+ * "LocalVariableTypeTable" attribute (added in J2SE 1.5).
+ * @since 3.0
+ */
+ char[] LOCAL_VARIABLE_TYPE_TABLE = "LocalVariableTypeTable".toCharArray(); //$NON-NLS-1$
+
+ /**
+ * "RuntimeVisibleAnnotations" attribute (added in J2SE 1.5).
+ * @since 3.0
+ */
+ char[] RUNTIME_VISIBLE_ANNOTATIONS = "RuntimeVisibleAnnotations".toCharArray(); //$NON-NLS-1$
+
+ /**
+ * "RuntimeInvisibleAnnotations" attribute (added in J2SE 1.5).
+ * @since 3.0
+ */
+ char[] RUNTIME_INVISIBLE_ANNOTATIONS = "RuntimeInvisibleAnnotations".toCharArray(); //$NON-NLS-1$
+
+ /**
+ * "RuntimeVisibleParameterAnnotations" attribute (added in J2SE 1.5).
+ * @since 3.0
+ */
+ char[] RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS = "RuntimeVisibleParameterAnnotations".toCharArray(); //$NON-NLS-1$
+
+ /**
+ * "RuntimeInvisibleParameterAnnotations" attribute (added in J2SE 1.5).
+ * @since 3.0
+ */
+ char[] RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS = "RuntimeInvisibleParameterAnnotations".toCharArray(); //$NON-NLS-1$
+
+ /**
+ * "AnnotationDefault" attribute (added in J2SE 1.5).
+ * @since 3.0
+ */
+ char[] ANNOTATION_DEFAULT = "AnnotationDefault".toCharArray(); //$NON-NLS-1$
}
diff --git a/model/org/eclipse/jdt/core/util/IClassFileReader.java b/model/org/eclipse/jdt/core/util/IClassFileReader.java
index 0302898..c83aec5 100644
--- a/model/org/eclipse/jdt/core/util/IClassFileReader.java
+++ b/model/org/eclipse/jdt/core/util/IClassFileReader.java
@@ -13,6 +13,14 @@
/**
* Description of a .class file. This class reifies the internal structure of a .class
* file following the JVM specifications.
+ * <p>
+ * Note that several changes were introduced with J2SE 1.5.
+ * Class file reader implementations should use support these
+ * new class file attributes by returning objects implementing
+ * the appropriate specialized attribute interfaces. Class
+ * file reader clients can search for these new attributes
+ * and downcast to the new interfaces as appropriate.
+ * </p>
*
* This interface may be implemented by clients.
*
diff --git a/model/org/eclipse/jdt/core/util/IEnclosingMethodAttribute.java b/model/org/eclipse/jdt/core/util/IEnclosingMethodAttribute.java
index 2ae6a91..7cade9b 100644
--- a/model/org/eclipse/jdt/core/util/IEnclosingMethodAttribute.java
+++ b/model/org/eclipse/jdt/core/util/IEnclosingMethodAttribute.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,11 +11,12 @@
package org.eclipse.jdt.core.util;
/**
- * Description of an enclosing method attribute as described in the JVM specifications.
+ * Description of an enclosing method attribute as described in the JVM specifications
+ * (added in J2SE 1.5).
*
* This interface may be implemented by clients.
*
- * @since 3.1
+ * @since 3.0
*/
public interface IEnclosingMethodAttribute extends IClassFileAttribute {
diff --git a/model/org/eclipse/jdt/core/util/ILocalVariableTypeTableAttribute.java b/model/org/eclipse/jdt/core/util/ILocalVariableTypeTableAttribute.java
index 21a73d3..3f87909 100644
--- a/model/org/eclipse/jdt/core/util/ILocalVariableTypeTableAttribute.java
+++ b/model/org/eclipse/jdt/core/util/ILocalVariableTypeTableAttribute.java
@@ -11,11 +11,12 @@
package org.eclipse.jdt.core.util;
/**
- * Description of a local variable type attribute as described in the JVM specifications.
+ * Description of a local variable type attribute as described in the JVM specifications
+ * (added in J2SE 1.5).
*
* This interface may be implemented by clients.
*
- * @since 3.1
+ * @since 3.0
*/
public interface ILocalVariableTypeTableAttribute extends IClassFileAttribute {
diff --git a/model/org/eclipse/jdt/core/util/ILocalVariableTypeTableEntry.java b/model/org/eclipse/jdt/core/util/ILocalVariableTypeTableEntry.java
index 910d736..e1e58cf 100644
--- a/model/org/eclipse/jdt/core/util/ILocalVariableTypeTableEntry.java
+++ b/model/org/eclipse/jdt/core/util/ILocalVariableTypeTableEntry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,11 +11,12 @@
package org.eclipse.jdt.core.util;
/**
- * Description of a local variable type table entry as specified in the JVM specifications.
+ * Description of a local variable type table entry as specified in the JVM specifications
+ * (added in J2SE 1.5).
*
* This interface may be implemented by clients.
*
- * @since 3.1
+ * @since 3.0
*/
public interface ILocalVariableTypeTableEntry {
diff --git a/model/org/eclipse/jdt/core/util/IModifierConstants.java b/model/org/eclipse/jdt/core/util/IModifierConstants.java
index a7ee0a4..14319b7 100644
--- a/model/org/eclipse/jdt/core/util/IModifierConstants.java
+++ b/model/org/eclipse/jdt/core/util/IModifierConstants.java
@@ -27,17 +27,34 @@
int ACC_SUPER = 0x0020;
int ACC_SYNCHRONIZED = 0x0020;
int ACC_VOLATILE = 0x0040;
+
+ /**
+ * Indicates a bridge method (added in J2SE 1.5).
+ * @since 3.0
+ */
int ACC_BRIDGE = 0x0040;
int ACC_TRANSIENT = 0x0080;
+
+ /**
+ * Indicates a variable arity method (added in J2SE 1.5).
+ * @since 3.0
+ */
int ACC_VARARGS = 0x0080;
int ACC_NATIVE = 0x0100;
int ACC_INTERFACE = 0x0200;
int ACC_ABSTRACT = 0x0400;
- int ACC_STRICT = 0x0800;
- /** @since 3.1 */
+ int ACC_STRICT = 0x0800;
int ACC_SYNTHETIC = 0x1000;
- /** @since 3.1 */
+
+ /**
+ * Indicates an annotation (added in J2SE 1.5).
+ * @since 3.0
+ */
int ACC_ANNOTATION = 0x2000;
- /** @since 3.1 */
+
+ /**
+ * Indicates an enum (added in J2SE 1.5).
+ * @since 3.0
+ */
int ACC_ENUM = 0x4000;
}
diff --git a/model/org/eclipse/jdt/core/util/IParameterAnnotation.java b/model/org/eclipse/jdt/core/util/IParameterAnnotation.java
index a987ef0..1ed9b2c 100644
--- a/model/org/eclipse/jdt/core/util/IParameterAnnotation.java
+++ b/model/org/eclipse/jdt/core/util/IParameterAnnotation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,11 +11,12 @@
package org.eclipse.jdt.core.util;
/**
- * Description of a parameter annotation as described in the JVM specifications.
+ * Description of a parameter annotation as described in the JVM specifications
+ * (added in J2SE 1.5).
*
* This interface may be implemented by clients.
*
- * @since 3.1
+ * @since 3.0
*/
public interface IParameterAnnotation {
@@ -33,4 +34,4 @@
* @return the annotations
*/
IAnnotation[] getAnnotations();
-}
\ No newline at end of file
+}
diff --git a/model/org/eclipse/jdt/core/util/IRuntimeInvisibleAnnotationsAttribute.java b/model/org/eclipse/jdt/core/util/IRuntimeInvisibleAnnotationsAttribute.java
index 792e81b..4ccf75f 100644
--- a/model/org/eclipse/jdt/core/util/IRuntimeInvisibleAnnotationsAttribute.java
+++ b/model/org/eclipse/jdt/core/util/IRuntimeInvisibleAnnotationsAttribute.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,11 +11,12 @@
package org.eclipse.jdt.core.util;
/**
- * Description of a runtime invisible annotations attribute as described in the JVM specifications.
+ * Description of a runtime invisible annotations attribute as described in the JVM specifications
+ * (added in J2SE 1.5).
*
* This interface may be implemented by clients.
*
- * @since 3.1
+ * @since 3.0
*/
public interface IRuntimeInvisibleAnnotationsAttribute extends IClassFileAttribute {
@@ -32,4 +33,4 @@
* @return the annotations
*/
IAnnotation[] getAnnotations();
-}
\ No newline at end of file
+}
diff --git a/model/org/eclipse/jdt/core/util/IRuntimeInvisibleParameterAnnotationsAttribute.java b/model/org/eclipse/jdt/core/util/IRuntimeInvisibleParameterAnnotationsAttribute.java
index acd6b64..c02b751 100644
--- a/model/org/eclipse/jdt/core/util/IRuntimeInvisibleParameterAnnotationsAttribute.java
+++ b/model/org/eclipse/jdt/core/util/IRuntimeInvisibleParameterAnnotationsAttribute.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,11 +11,12 @@
package org.eclipse.jdt.core.util;
/**
- * Description of a runtime invisible parameter annotations attribute as described in the JVM specifications.
+ * Description of a runtime invisible parameter annotations attribute as described in the JVM specifications
+ * (added in J2SE 1.5).
*
* This interface may be implemented by clients.
*
- * @since 3.1
+ * @since 3.0
*/
public interface IRuntimeInvisibleParameterAnnotationsAttribute extends IClassFileAttribute {
@@ -32,4 +33,4 @@
* @return the parameter annotations. Answers an empty collection if none.
*/
IParameterAnnotation[] getParameterAnnotations();
-}
\ No newline at end of file
+}
diff --git a/model/org/eclipse/jdt/core/util/IRuntimeVisibleAnnotationsAttribute.java b/model/org/eclipse/jdt/core/util/IRuntimeVisibleAnnotationsAttribute.java
index d8e4c6d..471975c 100644
--- a/model/org/eclipse/jdt/core/util/IRuntimeVisibleAnnotationsAttribute.java
+++ b/model/org/eclipse/jdt/core/util/IRuntimeVisibleAnnotationsAttribute.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,11 +11,12 @@
package org.eclipse.jdt.core.util;
/**
- * Description of a runtime visible annotations attribute as described in the JVM specifications.
+ * Description of a runtime visible annotations attribute as described in the JVM specifications
+ * (added in J2SE 1.5).
*
* This interface may be implemented by clients.
*
- * @since 3.1
+ * @since 3.0
*/
public interface IRuntimeVisibleAnnotationsAttribute extends IClassFileAttribute {
@@ -32,4 +33,4 @@
* @return the annotations. Answers an empty collection if none.
*/
IAnnotation[] getAnnotations();
-}
\ No newline at end of file
+}
diff --git a/model/org/eclipse/jdt/core/util/IRuntimeVisibleParameterAnnotationsAttribute.java b/model/org/eclipse/jdt/core/util/IRuntimeVisibleParameterAnnotationsAttribute.java
index 5be7ddc..b761842 100644
--- a/model/org/eclipse/jdt/core/util/IRuntimeVisibleParameterAnnotationsAttribute.java
+++ b/model/org/eclipse/jdt/core/util/IRuntimeVisibleParameterAnnotationsAttribute.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,11 +11,12 @@
package org.eclipse.jdt.core.util;
/**
- * Description of a runtime visible parameter annotations attribute as described in the JVM specifications.
+ * Description of a runtime visible parameter annotations attribute as described in the JVM specification
+ * (added in J2SE 1.5).
*
* This interface may be implemented by clients.
*
- * @since 3.1
+ * @since 3.0
*/
public interface IRuntimeVisibleParameterAnnotationsAttribute extends IClassFileAttribute {
@@ -32,4 +33,4 @@
* @return the parameter annotations. Answers an empty collection if none.
*/
IParameterAnnotation[] getParameterAnnotations();
-}
\ No newline at end of file
+}
diff --git a/model/org/eclipse/jdt/core/util/ISignatureAttribute.java b/model/org/eclipse/jdt/core/util/ISignatureAttribute.java
index c5d6978..5322bc4 100644
--- a/model/org/eclipse/jdt/core/util/ISignatureAttribute.java
+++ b/model/org/eclipse/jdt/core/util/ISignatureAttribute.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,11 +11,12 @@
package org.eclipse.jdt.core.util;
/**
- * Description of a signature attribute as described in the JVM specifications.
+ * Description of a signature attribute as described in the JVM specifications
+ * (added in J2SE 1.5).
*
* This interface may be implemented by clients.
*
- * @since 3.1
+ * @since 3.0
*/
public interface ISignatureAttribute extends IClassFileAttribute {
diff --git a/model/org/eclipse/jdt/core/util/IVerificationTypeInfo.java b/model/org/eclipse/jdt/core/util/IVerificationTypeInfo.java
new file mode 100644
index 0000000..8f02d82
--- /dev/null
+++ b/model/org/eclipse/jdt/core/util/IVerificationTypeInfo.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.util;
+
+/**
+ * Description of a verification type info as described in the JVM specifications.
+ *
+ * This interface may be implemented by clients.
+ *
+ * @since 3.0
+ */
+public interface IVerificationTypeInfo {
+ /**
+ * Answer back the tag of this verification type info as described in the JVM specifications.
+ * <ul>
+ * <li>0 for the top type</li>
+ * <li>1 for the int type</li>
+ * <li>2 for the float type</li>
+ * <li>3 for the double type</li>
+ * <li>4 for the long type</li>
+ * <li>5 for the null type</li>
+ * <li>6 for the uninitialized this type</li>
+ * <li>7 for the object type</li>
+ * <li>8 for the uninitialized offset type</li>
+ * </ul>
+ *
+ * @return the tag of this verification type info as described in the JVM specifications
+ * @since 3.0
+ */
+ int getTag();
+
+ /**
+ * Answer back the offset of this verification type info as described in the JVM specifications.
+ * This makes sense only if the tag is 8.
+ *
+ * @return the offset of this verification type info as described in the JVM specifications
+ * @since 3.0
+ */
+ int getOffset();
+
+ /**
+ * Answer back the constant pool index of this verification type info as described in the JVM specifications.
+ * This makes sense only if the tag is 7.
+ *
+ * @return the constant pool index of this verification type info as described in the JVM specifications
+ * @since 3.0
+ */
+ int getConstantPoolIndex();
+
+ /**
+ * Answer back the name of the class type referenced by the index in the constant pool
+ * as described in the JVM specifications.
+ * This makes sense only if the tag is 7.
+ *
+ * @return the name of the class type referenced by the index in the constant pool
+ * as described in the JVM specifications
+ * @since 3.0
+ */
+ char[] getClassTypeName();
+}
diff --git a/model/org/eclipse/jdt/internal/core/BinaryMethod.java b/model/org/eclipse/jdt/internal/core/BinaryMethod.java
index 32509fc..4b9f57f 100644
--- a/model/org/eclipse/jdt/internal/core/BinaryMethod.java
+++ b/model/org/eclipse/jdt/internal/core/BinaryMethod.java
@@ -215,6 +215,16 @@
public String[] getParameterTypes() {
return this.parameterTypes;
}
+
+/**
+ * @see IMethod#getTypeParameters()
+ * @since 3.0
+ */
+public String[] getTypeParameters() throws JavaModelException {
+ // TODO (jerome) - missing implementation
+ return new String[0];
+}
+
/*
* @see IMethod
*/
diff --git a/model/org/eclipse/jdt/internal/core/BinaryType.java b/model/org/eclipse/jdt/internal/core/BinaryType.java
index 341d7e8..b5dc228 100644
--- a/model/org/eclipse/jdt/internal/core/BinaryType.java
+++ b/model/org/eclipse/jdt/internal/core/BinaryType.java
@@ -50,12 +50,14 @@
ClassFileInfo cfi = getClassFileInfo();
cfi.removeBinaryChildren();
}
+
/*
* @see IType#codeComplete(char[], int, int, char[][], char[][], int[], boolean, ICompletionRequestor)
*/
public void codeComplete(char[] snippet,int insertion,int position,char[][] localVariableTypeNames,char[][] localVariableNames,int[] localVariableModifiers,boolean isStatic,ICompletionRequestor requestor) throws JavaModelException {
codeComplete(snippet, insertion, position, localVariableTypeNames, localVariableNames, localVariableModifiers, isStatic, requestor, DefaultWorkingCopyOwner.PRIMARY);
}
+
/*
* @see IType#codeComplete(char[], int, int, char[][], char[][], int[], boolean, ICompletionRequestor, WorkingCopyOwner)
*/
@@ -89,6 +91,7 @@
engine.complete(this, snippet, position, localVariableTypeNames, localVariableNames, localVariableModifiers, isStatic);
}
}
+
/*
* @see IType#createField(String, IJavaElement, boolean, IProgressMonitor)
*/
@@ -383,6 +386,20 @@
Assert.isTrue(false); // should not happen
return null;
}
+
+/**
+ * @see IType#getSuperclassType()
+ * @since 3.0
+ */
+public String getSuperclassType() throws JavaModelException {
+ IBinaryType info = (IBinaryType) getElementInfo();
+ char[] superclassName = info.getSuperclassName();
+ if (superclassName == null) {
+ return null;
+ }
+ return new String(Signature.createTypeSignature(ClassFile.translatedName(superclassName), true));
+}
+
/*
* @see IType#getSuperclassName()
*/
@@ -411,6 +428,35 @@
}
return strings;
}
+
+/**
+ * @see IType#getSuperInterfaceTypes()
+ * @since 3.0
+ */
+public String[] getSuperInterfaceTypes() throws JavaModelException {
+ IBinaryType info = (IBinaryType) getElementInfo();
+ char[][] names= info.getInterfaceNames();
+ int length;
+ if (names == null || (length = names.length) == 0) {
+ return NO_STRINGS;
+ }
+ names= ClassFile.translatedNames(names);
+ String[] strings= new String[length];
+ for (int i= 0; i < length; i++) {
+ strings[i]= new String(Signature.createTypeSignature(names[i], true));
+ }
+ return strings;
+}
+
+/**
+ * @see IType#getTypeParameters()
+ * @since 3.0
+ */
+public String[] getTypeParameters() throws JavaModelException {
+ // TODO (jerome) - missing implementation
+ return new String[0];
+}
+
/*
* @see IType#getType(String)
*/
@@ -459,6 +505,7 @@
return array;
}
}
+
/*
* @see IType#isAnonymous()
*/
@@ -470,16 +517,37 @@
* @see IType#isClass()
*/
public boolean isClass() throws JavaModelException {
+ // TODO (jerome) - isClass should only return true for classes other than enum classes
return !isInterface();
}
+
+/**
+ * @see IType#isEnum()
+ * @since 3.0
+ */
+public boolean isEnum() throws JavaModelException {
+ // TODO (jerome) - missing implementation - should only return true for enum classes
+ return false;
+}
+
/*
* @see IType#isInterface()
*/
public boolean isInterface() throws JavaModelException {
IBinaryType info = (IBinaryType) getElementInfo();
+ // TODO (jerome) - isInterface should not return true for annotation types
return info.isInterface();
}
+/**
+ * @see IType#isAnnotation()
+ * @since 3.0
+ */
+public boolean isAnnotation() throws JavaModelException {
+ // TODO (jerome) - missing implementation - should only return true for annotation types
+ return false;
+}
+
/*
* @see IType#isLocal()
*/
diff --git a/model/org/eclipse/jdt/internal/core/ClassFile.java b/model/org/eclipse/jdt/internal/core/ClassFile.java
index c1f9972..a3d6ac4 100644
--- a/model/org/eclipse/jdt/internal/core/ClassFile.java
+++ b/model/org/eclipse/jdt/internal/core/ClassFile.java
@@ -112,6 +112,23 @@
codeComplete(cu, cu, offset, requestor, owner);
}
}
+
+/* (non-Javadoc)
+ * @see org.eclipse.jdt.core.ICodeAssist#codeComplete(int, org.eclipse.jdt.core.CompletionRequestor)
+ */
+public void codeComplete(int offset, CompletionRequestor requestor) throws JavaModelException {
+ // TODO (jerome) - Missing implementation
+ throw new RuntimeException("Not implemented yet"); //$NON-NLS-1$
+}
+
+/* (non-Javadoc)
+ * @see org.eclipse.jdt.core.ICodeAssist#codeComplete(int, org.eclipse.jdt.core.CompletionRequestor, org.eclipse.jdt.core.WorkingCopyOwner)
+ */
+public void codeComplete(int offset, CompletionRequestor requestor, WorkingCopyOwner wcowner) throws JavaModelException {
+ // TODO (jerome) - Missing implementation
+ throw new RuntimeException("Not implemented yet"); //$NON-NLS-1$
+}
+
/**
* @see ICodeAssist#codeSelect(int, int)
*/
@@ -144,8 +161,7 @@
return super.equals(o);
}
public boolean exists() {
- if (!isValidClassFile()) return false;
- return super.exists();
+ return super.exists() && isValidClassFile();
}
/**
@@ -310,11 +326,11 @@
* @see IJavaElement
*/
public IPath getPath() {
- PackageFragmentRoot root = this.getPackageFragmentRoot();
+ PackageFragmentRoot root = getPackageFragmentRoot();
if (root.isArchive()) {
return root.getPath();
} else {
- return this.getParent().getPath().append(this.getElementName());
+ return getParent().getPath().append(getElementName());
}
}
/*
diff --git a/model/org/eclipse/jdt/internal/core/ClassFileWorkingCopy.java b/model/org/eclipse/jdt/internal/core/ClassFileWorkingCopy.java
index b35b0a5..54b5d40 100644
--- a/model/org/eclipse/jdt/internal/core/ClassFileWorkingCopy.java
+++ b/model/org/eclipse/jdt/internal/core/ClassFileWorkingCopy.java
@@ -61,6 +61,19 @@
}
/*
+ * @see ICompilationUnit#createImport(String, IJavaElement, int, IProgressMonitor)
+ * @since 3.0
+ */
+ public IImportDeclaration createImport(
+ String name,
+ IJavaElement sibling,
+ int flags,
+ IProgressMonitor monitor)
+ throws JavaModelException {
+ throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST, this));
+ }
+
+ /*
* @see ICompilationUnit#createPackageDeclaration(String, IProgressMonitor)
*/
public IPackageDeclaration createPackageDeclaration(
@@ -527,17 +540,6 @@
}
/**
- * @see ICompilationUnit#reconcile(boolean, WorkingCopyOwner, IProgressMonitor)
- */
- public void reconcile(
- boolean forceProblemDetection,
- WorkingCopyOwner owner,
- IProgressMonitor monitor)
- throws JavaModelException {
- throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST, this));
- }
-
- /**
* @see org.eclipse.jdt.core.IWorkingCopy#restore()
*/
public void restore() throws JavaModelException {
@@ -627,6 +629,22 @@
throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST, this));
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.ICodeAssist#codeComplete(int, org.eclipse.jdt.core.CompletionRequestor)
+ */
+ public void codeComplete(int offset, CompletionRequestor requestor) throws JavaModelException {
+ // TODO (jerome) - Missing implementation
+ throw new RuntimeException("Not implemented yet"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.ICodeAssist#codeComplete(int, org.eclipse.jdt.core.CompletionRequestor, org.eclipse.jdt.core.WorkingCopyOwner)
+ */
+ public void codeComplete(int offset, CompletionRequestor requestor, WorkingCopyOwner wcowner) throws JavaModelException {
+ // TODO (jerome) - Missing implementation
+ throw new RuntimeException("Not implemented yet"); //$NON-NLS-1$
+ }
+
/**
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
*/
diff --git a/model/org/eclipse/jdt/internal/core/CompilationUnit.java b/model/org/eclipse/jdt/internal/core/CompilationUnit.java
index 6ad3453..3d729b5 100644
--- a/model/org/eclipse/jdt/internal/core/CompilationUnit.java
+++ b/model/org/eclipse/jdt/internal/core/CompilationUnit.java
@@ -269,6 +269,23 @@
}
});
}
+
+/* (non-Javadoc)
+ * @see org.eclipse.jdt.core.ICodeAssist#codeComplete(int, org.eclipse.jdt.core.CompletionRequestor)
+ */
+public void codeComplete(int offset, CompletionRequestor requestor) throws JavaModelException {
+ // TODO (jerome) - Missing implementation
+ throw new RuntimeException("Not implemented yet"); //$NON-NLS-1$
+}
+
+/* (non-Javadoc)
+ * @see org.eclipse.jdt.core.ICodeAssist#codeComplete(int, org.eclipse.jdt.core.CompletionRequestor, org.eclipse.jdt.core.WorkingCopyOwner)
+ */
+public void codeComplete(int offset, CompletionRequestor requestor, WorkingCopyOwner wcowner) throws JavaModelException {
+ // TODO (jerome) - Missing implementation
+ throw new RuntimeException("Not implemented yet"); //$NON-NLS-1$
+}
+
/**
* @see ICodeAssist#codeSelect(int, int)
*/
@@ -320,6 +337,15 @@
* @see ICompilationUnit#createImport(String, IJavaElement, IProgressMonitor)
*/
public IImportDeclaration createImport(String importName, IJavaElement sibling, IProgressMonitor monitor) throws JavaModelException {
+ return createImport(importName, sibling, Flags.AccDefault, monitor);
+}
+
+/**
+ * @see ICompilationUnit#createImport(String, IJavaElement, int, IProgressMonitor)
+ * @since 3.0
+ */
+public IImportDeclaration createImport(String importName, IJavaElement sibling, int flags, IProgressMonitor monitor) throws JavaModelException {
+ // TODO (jerome) - consult flags to create static imports
CreateImportOperation op = new CreateImportOperation(importName, this);
if (sibling != null) {
op.createBefore(sibling);
@@ -327,6 +353,7 @@
op.runOperation(monitor);
return getImport(importName);
}
+
/**
* @see ICompilationUnit#createPackageDeclaration(String, IProgressMonitor)
*/
@@ -426,7 +453,8 @@
// working copy always exists in the model until it is gotten rid of
if (getPerWorkingCopyInfo() != null) return true;
- return super.exists();
+ // if not a working copy, it exists only if it is a primary compilation unit
+ return isPrimary() && super.exists() && isValidCompilationUnit();
}
/**
* @see IWorkingCopy#findElements(IJavaElement)
@@ -1025,14 +1053,14 @@
* @deprecated
*/
public IMarker[] reconcile() throws JavaModelException {
- reconcile(false/*don't force problem detection*/, null/*use primary owner*/, null/*no progress monitor*/);
+ reconcile(false/*don't create AST*/, false/*don't force problem detection*/, null/*use primary owner*/, null/*no progress monitor*/);
return null;
}
/**
* @see ICompilationUnit#reconcile(boolean, IProgressMonitor)
*/
public void reconcile(boolean forceProblemDetection, IProgressMonitor monitor) throws JavaModelException {
- reconcile(forceProblemDetection, null/*use primary owner*/, monitor);
+ reconcile(false/*don't create AST*/, forceProblemDetection, null/*use primary owner*/, monitor);
}
/**
* @see ICompilationUnit#reconcile(boolean, boolean, WorkingCopyOwner, IProgressMonitor)
@@ -1052,17 +1080,6 @@
return op.ast;
}
/**
- * @see ICompilationUnit#reconcile(boolean, WorkingCopyOwner, IProgressMonitor)
- */
-public void reconcile(
- boolean forceProblemDetection,
- WorkingCopyOwner workingCopyOwner,
- IProgressMonitor monitor)
- throws JavaModelException {
-
- reconcile(false/*don't create AST*/, forceProblemDetection, workingCopyOwner, monitor);
-}
-/**
* @see ISourceManipulation#rename(String, boolean, IProgressMonitor)
*/
public void rename(String newName, boolean force, IProgressMonitor monitor) throws JavaModelException {
diff --git a/model/org/eclipse/jdt/internal/core/JavaProject.java b/model/org/eclipse/jdt/internal/core/JavaProject.java
index 099b547..25f4921 100644
--- a/model/org/eclipse/jdt/internal/core/JavaProject.java
+++ b/model/org/eclipse/jdt/internal/core/JavaProject.java
@@ -890,8 +890,7 @@
}
public boolean exists() {
- if (!hasJavaNature(this.project)) return false;
- return super.exists();
+ return hasJavaNature(this.project);
}
/**
diff --git a/model/org/eclipse/jdt/internal/core/Openable.java b/model/org/eclipse/jdt/internal/core/Openable.java
index 3e98b94..f0b2089 100644
--- a/model/org/eclipse/jdt/internal/core/Openable.java
+++ b/model/org/eclipse/jdt/internal/core/Openable.java
@@ -149,6 +149,20 @@
protected Object createElementInfo() {
return new OpenableElementInfo();
}
+/**
+ * @see IJavaElement
+ */
+public boolean exists() {
+ JavaModelManager manager = JavaModelManager.getJavaModelManager();
+ if (manager.getInfo(this) != null) return true;
+ if (!parentExists()) return false;
+ PackageFragmentRoot root = getPackageFragmentRoot();
+ if (root != null
+ && (root == this || !root.isArchive())) {
+ return resourceExists();
+ }
+ return super.exists();
+}
protected void generateInfos(Object info, HashMap newElements, IProgressMonitor monitor) throws JavaModelException {
if (JavaModelManager.VERBOSE){
diff --git a/model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java b/model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java
index fe5b443..2dd0ca7 100644
--- a/model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java
+++ b/model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java
@@ -329,10 +329,7 @@
* @see IJavaElement
*/
public boolean exists() {
- return
- parentExists()
- && resourceExists()
- && isOnClasspath();
+ return super.exists() && isOnClasspath();
}
public IClasspathEntry findSourceAttachmentRecommendation() {
diff --git a/model/org/eclipse/jdt/internal/core/SourceMethod.java b/model/org/eclipse/jdt/internal/core/SourceMethod.java
index dbbf5b5..54d1aed 100644
--- a/model/org/eclipse/jdt/internal/core/SourceMethod.java
+++ b/model/org/eclipse/jdt/internal/core/SourceMethod.java
@@ -136,6 +136,16 @@
public String[] getParameterTypes() {
return fParameterTypes;
}
+
+/**
+ * @see IMethod#getTypeParameters()
+ * @since 3.0
+ */
+public String[] getTypeParameters() throws JavaModelException {
+ // TODO (jerome) - missing implementation
+ return new String[0];
+}
+
/*
* @see JavaElement#getPrimaryElement(boolean)
*/
diff --git a/model/org/eclipse/jdt/internal/core/SourceType.java b/model/org/eclipse/jdt/internal/core/SourceType.java
index dad7efa..78ce51f 100644
--- a/model/org/eclipse/jdt/internal/core/SourceType.java
+++ b/model/org/eclipse/jdt/internal/core/SourceType.java
@@ -355,6 +355,20 @@
}
return new String(superclassName);
}
+
+/**
+ * @see IType#getSuperclassType()
+ * @since 3.0
+ */
+public String getSuperclassType() throws JavaModelException {
+ SourceTypeElementInfo info = (SourceTypeElementInfo) getElementInfo();
+ char[] superclassName= info.getSuperclassName();
+ if (superclassName == null) {
+ return null;
+ }
+ return new String(Signature.createTypeSignature(superclassName, false));
+}
+
/**
* @see IType
*/
@@ -370,6 +384,33 @@
}
return strings;
}
+
+/**
+ * @see IType#getSuperInterfaceTypes()
+ * @since 3.0
+ */
+public String[] getSuperInterfaceTypes() throws JavaModelException {
+ SourceTypeElementInfo info = (SourceTypeElementInfo) getElementInfo();
+ char[][] names= info.getInterfaceNames();
+ if (names == null) {
+ return fgEmptyList;
+ }
+ String[] strings= new String[names.length];
+ for (int i= 0; i < names.length; i++) {
+ strings[i]= new String(Signature.createTypeSignature(names[i], false));
+ }
+ return strings;
+}
+
+/**
+ * @see IType#getTypeParameters()
+ * @since 3.0
+ */
+public String[] getTypeParameters() throws JavaModelException {
+ // TODO (jerome) - missing implementation
+ return new String[0];
+}
+
/**
* @see IType
*/
@@ -418,19 +459,42 @@
public boolean isAnonymous() {
return this.name.length() == 0;
}
+
/**
* @see IType
*/
public boolean isClass() throws JavaModelException {
+ // TODO (jerome) - isClass should only return true for classes other than enum classes
return !isInterface();
}
+
+/**
+ * @see IType#isEnum()
+ * @since 3.0
+ */
+public boolean isEnum() throws JavaModelException {
+ // TODO (jerome) - missing implementation - should only return true for enum classes
+ return false;
+}
+
/**
* @see IType
*/
public boolean isInterface() throws JavaModelException {
SourceTypeElementInfo info = (SourceTypeElementInfo) getElementInfo();
+ // TODO (jerome) - isInterface should not return true for annotation types
return info.isInterface();
}
+
+/**
+ * @see IType#isAnnotation()
+ * @since 3.0
+ */
+public boolean isAnnotation() throws JavaModelException {
+ // TODO (jerome) - missing implementation - should only return true for annotation types
+ return false;
+}
+
/**
* @see IType#isLocal()
*/
diff --git a/model/org/eclipse/jdt/internal/core/jdom/DOMImport.java b/model/org/eclipse/jdt/internal/core/jdom/DOMImport.java
index 31d0d06..aacc2dc 100644
--- a/model/org/eclipse/jdt/internal/core/jdom/DOMImport.java
+++ b/model/org/eclipse/jdt/internal/core/jdom/DOMImport.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jdt.internal.core.jdom;
+import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.jdom.IDOMImport;
@@ -22,19 +23,21 @@
*
* @see IDOMImport
* @see DOMNode
+ * TODO (jerome) - add implementation support for 1.5 features
*/
class DOMImport extends DOMNode implements IDOMImport {
/**
- * The modifier flags for this member that can be
- * analyzed with org.eclipse.jdt.core.Flags
- */
- protected int fFlags= 0;
-
- /**
* Indicates if this import is an on demand type import
*/
protected boolean fOnDemand;
+
+ /**
+ * Modifiers for this import.
+ * @since 3.0
+ */
+ protected int fFlags = Flags.AccDefault;
+
/**
* Creates a new empty IMPORT node.
*/
@@ -119,12 +122,6 @@
return (DOMNode)getFactory().createImport(getContents());
}
/**
- * @see org.eclipse.jdt.core.jdom.IDOMImport#getFlags()
- */
-public int getFlags() {
- return fFlags;
-}
-/**
* @see IDOMNode#getJavaElement
*/
public IJavaElement getJavaElement(IJavaElement parent) throws IllegalArgumentException {
@@ -169,4 +166,20 @@
public String toString() {
return "IMPORT: " + getName(); //$NON-NLS-1$
}
+
+/**
+ * @see org.eclipse.jdt.core.jdom.IDOMImport#getFlags()
+ * @since 3.0
+ */
+public int getFlags() {
+ return this.fFlags;
+}
+
+/**
+ * @see org.eclipse.jdt.core.jdom.IDOMImport#setFlags(int)
+ * @since 3.0
+ */
+public void setFlags(int flags) {
+ this.fFlags = flags;
+}
}
diff --git a/model/org/eclipse/jdt/internal/core/jdom/DOMMethod.java b/model/org/eclipse/jdt/internal/core/jdom/DOMMethod.java
index 09a399f..d42d719 100644
--- a/model/org/eclipse/jdt/internal/core/jdom/DOMMethod.java
+++ b/model/org/eclipse/jdt/internal/core/jdom/DOMMethod.java
@@ -23,8 +23,8 @@
*
* @see IDOMMethod
* @see DOMNode
+ * TODO (jerome) - add implementation support for 1.5 features
*/
-
class DOMMethod extends DOMMember implements IDOMMethod {
/**
@@ -110,6 +110,18 @@
*/
protected String[] fExceptions;
+ /**
+ * The formal type parameters.
+ * @since 3.0
+ */
+ protected String[] fTypeParameters = new String[0];
+
+ /**
+ * Default value for this attotation type member (only),
+ * or <code>null</code> if none.
+ * @since 3.0
+ */
+ protected String fDefaultValue = null;
/**
* Constructs an empty method node.
@@ -714,4 +726,36 @@
return "METHOD: " + getName(); //$NON-NLS-1$
}
}
+
+/**
+ * @see org.eclipse.jdt.core.jdom.IDOMMethod#setDefault(java.lang.String)
+ * @since 3.0
+ */
+public void setDefault(String defaultValue) {
+ this.fDefaultValue = defaultValue;
+}
+
+/**
+ * @see org.eclipse.jdt.core.jdom.IDOMMethod#getDefault()
+ * @since 3.0
+ */
+public String getDefault() {
+ return this.fDefaultValue;
+}
+
+/**
+ * @see org.eclipse.jdt.core.jdom.IDOMMethod#getTypeParameters()
+ * @since 3.0
+ */
+public String[] getTypeParameters() {
+ return this.fTypeParameters;
+}
+
+/**
+ * @see org.eclipse.jdt.core.jdom.IDOMMethod#setTypeParameters(java.lang.String[])
+ * @since 3.0
+ */
+public void setTypeParameters(String[] typeParameters) {
+ this.fTypeParameters = typeParameters;
+}
}
diff --git a/model/org/eclipse/jdt/internal/core/jdom/DOMType.java b/model/org/eclipse/jdt/internal/core/jdom/DOMType.java
index 897bb1a..be67009 100644
--- a/model/org/eclipse/jdt/internal/core/jdom/DOMType.java
+++ b/model/org/eclipse/jdt/internal/core/jdom/DOMType.java
@@ -29,8 +29,8 @@
*
* @see IDOMType
* @see DOMNode
- */
-
+ * TODO (jerome) - add implementation support for 1.5 features
+ */
/* package */ class DOMType extends DOMMember implements IDOMType {
private static final String[] EMPTY_SUPERINTERFACES = new String[] {};
@@ -117,6 +117,24 @@
protected String[] fSuperInterfaces= new String[0];
/**
+ * The formal type parameters.
+ * @since 3.0
+ */
+ protected String[] fTypeParameters = new String[0];
+
+ /**
+ * Indicates this type is an enum class.
+ * @since 3.0
+ */
+ protected boolean fIsEnum= false;
+
+ /**
+ * Indicates this type is an annotatation type (interface).
+ * @since 3.0
+ */
+ protected boolean fIsAnnotation= false;
+
+ /**
* This position is the position of the end of the last line separator before the closing brace starting
* position of the receiver.
*/
@@ -715,4 +733,63 @@
public String toString() {
return "TYPE: " + getName(); //$NON-NLS-1$
}
+
+/**
+ * @see org.eclipse.jdt.core.jdom.IDOMType#getTypeParameters()
+ * @since 3.0
+ */
+public String[] getTypeParameters() {
+ return this.fTypeParameters;
+}
+
+/**
+ * @see org.eclipse.jdt.core.jdom.IDOMType#isEnum()
+ * @since 3.0
+ */
+public boolean isEnum() {
+ return this.fIsEnum;
+}
+
+/**
+ * @see org.eclipse.jdt.core.jdom.IDOMType#isAnnotation()
+ * @since 3.0
+ */
+public boolean isAnnotation() {
+ return this.fIsAnnotation;
+}
+
+/**
+ * @see org.eclipse.jdt.core.jdom.IDOMType#setEnum(boolean)
+ * @since 3.0
+ */
+public void setEnum(boolean b) {
+ this.fIsEnum = b;
+ if (this.fIsEnum) {
+ // enums are always classes with no superclass
+ setClass(true);
+ setSuperclass(null);
+ }
+}
+
+/**
+ * @see org.eclipse.jdt.core.jdom.IDOMType#setAnnotation(boolean)
+ * @since 3.0
+ */
+public void setAnnotation(boolean b) {
+ this.fIsAnnotation= b;
+ if (this.fIsAnnotation) {
+ // annotation types are always interface with no superclass or superinterfaces
+ setClass(false);
+ setSuperclass(null);
+ setSuperInterfaces(new String[0]);
+ }
+}
+
+/**
+ * @see org.eclipse.jdt.core.jdom.IDOMType#setTypeParameters(java.lang.String[])
+ * @since 3.0
+ */
+public void setTypeParameters(String[] typeParameters) {
+ this.fTypeParameters = typeParameters;
+}
}
diff --git a/search/org/eclipse/jdt/core/search/FieldReferenceMatch.java b/search/org/eclipse/jdt/core/search/FieldReferenceMatch.java
index 571037a..1019fb9 100644
--- a/search/org/eclipse/jdt/core/search/FieldReferenceMatch.java
+++ b/search/org/eclipse/jdt/core/search/FieldReferenceMatch.java
@@ -19,14 +19,21 @@
*/
public class FieldReferenceMatch extends JavaSearchMatch {
+ private boolean insideDocComment;
private boolean isReadAccess;
private boolean isWriteAccess;
- public FieldReferenceMatch(IJavaElement element, int accuracy, int sourceStart, int sourceEnd, boolean isReadAccess, boolean isWriteAccess, SearchParticipant participant, IResource resource) {
+
+ public FieldReferenceMatch(IJavaElement element, int accuracy, int sourceStart, int sourceEnd, boolean isReadAccess, boolean isWriteAccess, boolean insideDocComment, SearchParticipant participant, IResource resource) {
super(element, accuracy, sourceStart, sourceEnd, participant, resource);
this.isReadAccess = isReadAccess;
this.isWriteAccess = isWriteAccess;
+ this.insideDocComment = insideDocComment;
}
+ public boolean insideDocComment() {
+ return this.insideDocComment;
+ }
+
// important point is that a match can be read & write at once in case of compound assignments: e.g. i += 0;
public boolean isReadAccess() {
return this.isReadAccess;
@@ -35,4 +42,5 @@
public boolean isWriteAccess() {
return this.isWriteAccess;
}
+
}
diff --git a/search/org/eclipse/jdt/core/search/JavaSearchMatch.java b/search/org/eclipse/jdt/core/search/JavaSearchMatch.java
index 6439fb0..5405567 100644
--- a/search/org/eclipse/jdt/core/search/JavaSearchMatch.java
+++ b/search/org/eclipse/jdt/core/search/JavaSearchMatch.java
@@ -46,4 +46,12 @@
public IJavaElement getJavaElement() {
return this.element;
}
+
+ /**
+ * Returns whether this Java search match is inside a doc comment.
+ */
+ public boolean insideDocComment() {
+ // default is outside a doc comment
+ return false;
+ }
}
diff --git a/search/org/eclipse/jdt/core/search/MethodReferenceMatch.java b/search/org/eclipse/jdt/core/search/MethodReferenceMatch.java
index 809ee34..7b27dd0 100644
--- a/search/org/eclipse/jdt/core/search/MethodReferenceMatch.java
+++ b/search/org/eclipse/jdt/core/search/MethodReferenceMatch.java
@@ -19,8 +19,15 @@
*/
public class MethodReferenceMatch extends JavaSearchMatch {
- public MethodReferenceMatch(IJavaElement element, int accuracy, int sourceStart, int sourceEnd, SearchParticipant participant, IResource resource) {
+ private boolean insideDocComment;
+
+ public MethodReferenceMatch(IJavaElement element, int accuracy, int sourceStart, int sourceEnd, boolean insideDocComment, SearchParticipant participant, IResource resource) {
super(element, accuracy, sourceStart, sourceEnd, participant, resource);
+ this.insideDocComment = insideDocComment;
}
+ public boolean insideDocComment() {
+ return this.insideDocComment;
+ }
+
}
diff --git a/search/org/eclipse/jdt/core/search/TypeReferenceMatch.java b/search/org/eclipse/jdt/core/search/TypeReferenceMatch.java
index ce91b31..767249e 100644
--- a/search/org/eclipse/jdt/core/search/TypeReferenceMatch.java
+++ b/search/org/eclipse/jdt/core/search/TypeReferenceMatch.java
@@ -19,7 +19,14 @@
*/
public class TypeReferenceMatch extends JavaSearchMatch {
- public TypeReferenceMatch(IJavaElement enclosingElement, int accuracy, int sourceStart, int sourceEnd, SearchParticipant participant, IResource resource) {
+ private boolean insideDocComment;
+
+ public TypeReferenceMatch(IJavaElement enclosingElement, int accuracy, int sourceStart, int sourceEnd, boolean insideDocComment, SearchParticipant participant, IResource resource) {
super(enclosingElement, accuracy, sourceStart, sourceEnd, participant, resource);
+ this.insideDocComment = insideDocComment;
+ }
+
+ public boolean insideDocComment() {
+ return this.insideDocComment;
}
}
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java b/search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java
index 39b4ae0..67e10f8 100644
--- a/search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java
+++ b/search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java
@@ -126,7 +126,7 @@
SearchMatch match = locator.newFieldReferenceMatch(element, accuracy, ((int) (position >>> 32)), ((int) position)+1, fieldReference);
locator.report(match);
} else if (reference instanceof SingleNameReference) {
- SearchMatch match = locator.newFieldReferenceMatch(element, accuracy, reference.sourceStart, reference.sourceEnd+1, (SingleNameReference)reference);
+ SearchMatch match = locator.newFieldReferenceMatch(element, accuracy, reference.sourceStart, reference.sourceEnd+1, reference);
locator.report(match);
} else if (reference instanceof QualifiedNameReference) {
QualifiedNameReference qNameRef = (QualifiedNameReference) reference;
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/LocalVariableLocator.java b/search/org/eclipse/jdt/internal/core/search/matching/LocalVariableLocator.java
index 4f11a89..c0bb821 100644
--- a/search/org/eclipse/jdt/internal/core/search/matching/LocalVariableLocator.java
+++ b/search/org/eclipse/jdt/internal/core/search/matching/LocalVariableLocator.java
@@ -44,16 +44,16 @@
}
protected void matchReportReference(ASTNode reference, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException {
if (reference instanceof SingleNameReference) {
- SearchMatch match = locator.newReferenceMatch(IJavaElement.LOCAL_VARIABLE, element, accuracy, reference.sourceStart, reference.sourceEnd+1);
+ SearchMatch match = locator.newLocalVariableReferenceMatch(element, accuracy, reference.sourceStart, reference.sourceEnd+1, reference);
locator.report(match);
} else if (reference instanceof QualifiedNameReference) {
QualifiedNameReference qNameRef = (QualifiedNameReference) reference;
long sourcePosition = qNameRef.sourcePositions[0];
- SearchMatch match = locator.newReferenceMatch(IJavaElement.LOCAL_VARIABLE, element, accuracy, ((int) (sourcePosition >>> 32)), ((int) sourcePosition)+1);
+ SearchMatch match = locator.newLocalVariableReferenceMatch(element, accuracy, ((int) (sourcePosition >>> 32)), ((int) sourcePosition)+1, reference);
locator.report(match);
} else if (reference instanceof LocalDeclaration) {
LocalVariable localVariable = getLocalVariable();
- SearchMatch match = locator.newReferenceMatch(IJavaElement.LOCAL_VARIABLE, localVariable, accuracy, localVariable.nameStart, localVariable.nameEnd+1);
+ SearchMatch match = locator.newLocalVariableReferenceMatch(localVariable, accuracy, localVariable.nameStart, localVariable.nameEnd+1, reference);
locator.report(match);
}
}
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java b/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java
index 7faab24..d1157c3 100644
--- a/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java
+++ b/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java
@@ -900,39 +900,68 @@
int accuracy,
int sourceStart,
int sourceEnd,
- Reference reference) {
+ ASTNode reference) {
int bits = reference.bits;
boolean isCoupoundAssigned = (bits & ASTNode.IsCompoundAssignedMASK) != 0;
boolean isReadAccess = isCoupoundAssigned || (bits & ASTNode.IsStrictlyAssignedMASK) == 0;
boolean isWriteAccess = isCoupoundAssigned || (bits & ASTNode.IsStrictlyAssignedMASK) != 0;
+ boolean insideDocComment = reference instanceof JavadocFieldReference || reference instanceof JavadocSingleNameReference;
SearchParticipant participant = getParticipant();
IResource resource = this.currentPossibleMatch.resource;
- return new FieldReferenceMatch(enclosingElement, accuracy, sourceStart, sourceEnd, isReadAccess, isWriteAccess, participant, resource);
+ return new FieldReferenceMatch(enclosingElement, accuracy, sourceStart, sourceEnd, isReadAccess, isWriteAccess, insideDocComment, participant, resource);
}
-public JavaSearchMatch newReferenceMatch(
- int referenceType,
+public JavaSearchMatch newLocalVariableReferenceMatch(
IJavaElement enclosingElement,
int accuracy,
int sourceStart,
- int sourceEnd) {
+ int sourceEnd,
+ ASTNode reference) {
SearchParticipant participant = getParticipant();
IResource resource = this.currentPossibleMatch.resource;
- switch (referenceType) {
- case IJavaElement.PACKAGE_FRAGMENT:
- return new PackageReferenceMatch(enclosingElement, accuracy, sourceStart, sourceEnd, participant, resource);
- case IJavaElement.TYPE:
- return new TypeReferenceMatch(enclosingElement, accuracy, sourceStart, sourceEnd, participant, resource);
- //case IJavaElement.FIELD:
- // handled by newFieldReferenceMatch
- case IJavaElement.METHOD:
- return new MethodReferenceMatch(enclosingElement, accuracy, sourceStart, sourceEnd, participant, resource);
- case IJavaElement.LOCAL_VARIABLE:
- return new LocalVariableReferenceMatch(enclosingElement, accuracy, sourceStart, sourceEnd, participant, resource);
- default:
- return null;
- }
+ return new LocalVariableReferenceMatch(enclosingElement, accuracy, sourceStart, sourceEnd, participant, resource);
}
+
+public JavaSearchMatch newMethodReferenceMatch(
+ IJavaElement enclosingElement,
+ int accuracy,
+ int sourceStart,
+ int sourceEnd,
+ ASTNode reference) {
+ SearchParticipant participant = getParticipant();
+ IResource resource = this.currentPossibleMatch.resource;
+ boolean insideDocComment = reference instanceof JavadocMessageSend;
+ return new MethodReferenceMatch(enclosingElement, accuracy, sourceStart, sourceEnd, insideDocComment, participant, resource);
+}
+
+public JavaSearchMatch newPackageReferenceMatch(
+ IJavaElement enclosingElement,
+ int accuracy,
+ int sourceStart,
+ int sourceEnd,
+ ASTNode reference) {
+ SearchParticipant participant = getParticipant();
+ IResource resource = this.currentPossibleMatch.resource;
+ return new PackageReferenceMatch(enclosingElement, accuracy, sourceStart, sourceEnd, participant, resource);
+}
+
+public JavaSearchMatch newTypeReferenceMatch(
+ IJavaElement enclosingElement,
+ int accuracy,
+ int sourceStart,
+ int sourceEnd,
+ ASTNode reference) {
+ SearchParticipant participant = getParticipant();
+ IResource resource = this.currentPossibleMatch.resource;
+ boolean insideDocComment =
+ reference instanceof JavadocArrayQualifiedTypeReference
+ || reference instanceof JavadocArraySingleTypeReference
+ || reference instanceof JavadocQualifiedTypeReference
+ || reference instanceof JavadocSingleNameReference
+ || reference instanceof JavadocSingleTypeReference;
+ return new TypeReferenceMatch(enclosingElement, accuracy, sourceStart, sourceEnd, insideDocComment, participant, resource);
+}
+
/*
* Process a compilation unit already parsed and build.
*/
@@ -1061,12 +1090,12 @@
// ignore
}
if (token == TerminalTokens.TokenNameIdentifier && this.pattern.matchesName(name, scanner.getCurrentTokenSource())) {
- SearchMatch match = newReferenceMatch(IJavaElement.TYPE, element, accuracy, currentPosition, scanner.currentPosition);
+ SearchMatch match = newTypeReferenceMatch(element, accuracy, currentPosition, scanner.currentPosition, typeRef);
report(match);
return;
}
} while (token != TerminalTokens.TokenNameEOF);
- SearchMatch match = newReferenceMatch(IJavaElement.TYPE, element, accuracy, sourceStart, sourceEnd+1);
+ SearchMatch match = newTypeReferenceMatch(element, accuracy, sourceStart, sourceEnd+1, typeRef);
report(match);
}
/**
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java b/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java
index 68caacc..bd9aaa7 100644
--- a/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java
+++ b/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java
@@ -146,10 +146,10 @@
reportDeclaration(((MessageSend) reference).binding, locator, declPattern.knownMethods);
} else if (this.pattern.findReferences && reference instanceof MessageSend) {
int sourceStart = (int) (((MessageSend) reference).nameSourcePosition >>> 32);
- SearchMatch match = locator.newReferenceMatch(IJavaElement.METHOD, element, accuracy, sourceStart, reference.sourceEnd+1);
+ SearchMatch match = locator.newMethodReferenceMatch(element, accuracy, sourceStart, reference.sourceEnd+1, reference);
locator.report(match);
} else {
- SearchMatch match = locator.newReferenceMatch(IJavaElement.METHOD, element, accuracy, reference.sourceStart, reference.sourceEnd+1);
+ SearchMatch match = locator.newMethodReferenceMatch(element, accuracy, reference.sourceStart, reference.sourceEnd+1, reference);
locator.report(match);
}
}
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java b/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java
index 6909d10..bd1b9a7 100644
--- a/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java
+++ b/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java
@@ -128,7 +128,7 @@
if (pkgBinding != null)
last = pkgBinding.compoundName.length;
}
- SearchMatch match = locator.newReferenceMatch(IJavaElement.PACKAGE_FRAGMENT, element, accuracy, ((int) (positions[0] >>> 32)), ((int) positions[last - 1])+1);
+ SearchMatch match = locator.newPackageReferenceMatch(element, accuracy, ((int) (positions[0] >>> 32)), ((int) positions[last - 1])+1, importRef);
locator.report(match);
}
}
@@ -189,7 +189,7 @@
}
int sourceStart = (int) (positions[0] >>> 32);
int sourceEnd = ((int) positions[last - 1])+1;
- SearchMatch match = locator.newReferenceMatch(IJavaElement.PACKAGE_FRAGMENT, element, accuracy, sourceStart, sourceEnd);
+ SearchMatch match = locator.newPackageReferenceMatch(element, accuracy, sourceStart, sourceEnd, reference);
locator.report(match);
}
protected int referenceType() {
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java b/search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java
index f6c7fa7..c611625 100644
--- a/search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java
+++ b/search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java
@@ -226,8 +226,28 @@
* Reports the match of the given reference.
*/
protected void matchReportReference(ASTNode reference, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException {
- SearchMatch match = locator.newReferenceMatch(referenceType(), element, accuracy, reference.sourceStart, reference.sourceEnd+1);
- locator.report(match);
+ SearchMatch match = null;
+ int referenceType = referenceType();
+ switch (referenceType) {
+ case IJavaElement.PACKAGE_FRAGMENT:
+ match = locator.newPackageReferenceMatch(element, accuracy, reference.sourceStart, reference.sourceEnd+1, reference);
+ break;
+ case IJavaElement.TYPE:
+ match = locator.newTypeReferenceMatch(element, accuracy, reference.sourceStart, reference.sourceEnd+1, reference);
+ break;
+ case IJavaElement.FIELD:
+ match = locator.newFieldReferenceMatch(element, accuracy, reference.sourceStart, reference.sourceEnd+1, reference);
+ break;
+ case IJavaElement.METHOD:
+ match = locator.newMethodReferenceMatch(element, accuracy, reference.sourceStart, reference.sourceEnd+1, reference);
+ break;
+ case IJavaElement.LOCAL_VARIABLE:
+ match = locator.newLocalVariableReferenceMatch(element, accuracy, reference.sourceStart, reference.sourceEnd+1, reference);
+ break;
+ }
+ if (match != null) {
+ locator.report(match);
+ }
}
protected int referenceType() {
return 0; // defaults to unknown (a generic JavaSearchMatch will be created)
diff --git a/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java b/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java
index 39b3d80..ee9fe8c 100644
--- a/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java
+++ b/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java
@@ -137,7 +137,7 @@
if (resolveLevelForType(this.pattern.simpleName, this.pattern.qualification, typeBinding) == ACCURATE_MATCH) {
if (locator.encloses(element)) {
long[] positions = importRef.sourcePositions;
- SearchMatch match = locator.newReferenceMatch(IJavaElement.TYPE, element, accuracy, ((int) ((positions[this.pattern.qualification == null ? lastIndex : 0]) >>> 32)), ((int) positions[lastIndex])+1);
+ SearchMatch match = locator.newTypeReferenceMatch(element, accuracy, ((int) ((positions[this.pattern.qualification == null ? lastIndex : 0]) >>> 32)), ((int) positions[lastIndex])+1, importRef);
locator.report(match);
}
return;
@@ -151,7 +151,7 @@
protected void matchReportReference(ArrayTypeReference arrayRef, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException {
if (this.pattern.simpleName == null) {
if (locator.encloses(element)) {
- SearchMatch match = locator.newReferenceMatch(IJavaElement.TYPE, element, accuracy, arrayRef.sourceStart, arrayRef.sourceEnd+1);
+ SearchMatch match = locator.newTypeReferenceMatch(element, accuracy, arrayRef.sourceStart, arrayRef.sourceEnd+1, arrayRef);
locator.report(match);
}
} else
@@ -171,7 +171,7 @@
else if (reference instanceof ArrayTypeReference)
matchReportReference((ArrayTypeReference) reference, element, accuracy, locator);
else {
- SearchMatch match = locator.newReferenceMatch(IJavaElement.TYPE, element, accuracy, reference.sourceStart, reference.sourceEnd+1);
+ SearchMatch match = locator.newTypeReferenceMatch(element, accuracy, reference.sourceStart, reference.sourceEnd+1, reference);
locator.report(match);
}
}
@@ -212,7 +212,7 @@
if (resolveLevelForType(this.pattern.simpleName, this.pattern.qualification, refBinding) == ACCURATE_MATCH) {
if (locator.encloses(element)) {
long[] positions = qNameRef.sourcePositions;
- SearchMatch match = locator.newReferenceMatch(IJavaElement.TYPE, element, accuracy, ((int) ((positions[this.pattern.qualification == null ? lastIndex : 0]) >>> 32)), ((int) positions[lastIndex])+1);
+ SearchMatch match = locator.newTypeReferenceMatch(element, accuracy, ((int) ((positions[this.pattern.qualification == null ? lastIndex : 0]) >>> 32)), ((int) positions[lastIndex])+1, qNameRef);
locator.report(match);
}
return;
@@ -240,7 +240,7 @@
if (resolveLevelForType(this.pattern.simpleName, this.pattern.qualification, refBinding) == ACCURATE_MATCH) {
if (locator.encloses(element)) {
long[] positions = qTypeRef.sourcePositions;
- SearchMatch match = locator.newReferenceMatch(IJavaElement.TYPE, element, accuracy, ((int) ((positions[this.pattern.qualification == null ? lastIndex : 0]) >>> 32)), ((int) positions[lastIndex])+1);
+ SearchMatch match = locator.newTypeReferenceMatch(element, accuracy, ((int) ((positions[this.pattern.qualification == null ? lastIndex : 0]) >>> 32)), ((int) positions[lastIndex])+1, qTypeRef);
locator.report(match);
}
return;