diff options
author | Stephan Herrmann | 2010-04-02 03:29:32 +0000 |
---|---|---|
committer | Stephan Herrmann | 2010-04-02 03:29:32 +0000 |
commit | e5d6be89e15a96492d4f4e9c63a2d2aa53f53492 (patch) | |
tree | 61fc9bff256de4278b57515af0df7bcb0a9d75d1 /org.eclipse.jdt.core/model/org/eclipse/jdt/core | |
parent | 8cb8512b19883a3f28bbacdea5a1c04c9b1ff51e (diff) | |
download | org.eclipse.objectteams-e5d6be89e15a96492d4f4e9c63a2d2aa53f53492.tar.gz org.eclipse.objectteams-e5d6be89e15a96492d4f4e9c63a2d2aa53f53492.tar.xz org.eclipse.objectteams-e5d6be89e15a96492d4f4e9c63a2d2aa53f53492.zip |
update jdt.core to v_A39 using patch from the corresponding update in old svn for 1.4.0
Diffstat (limited to 'org.eclipse.jdt.core/model/org/eclipse/jdt/core')
8 files changed, 160 insertions, 9 deletions
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathEntry.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathEntry.java index 37258233f..8c882fda5 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathEntry.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathEntry.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -418,6 +418,28 @@ public interface IClasspathEntry { */ IPath getSourceAttachmentRootPath(); + + /** + * Returns the classpath entry that is making a reference to this classpath entry. For entry kinds + * {@link #CPE_LIBRARY}, the return value is the entry that is representing the JAR that includes + * <code>this</code> in the MANIFEST.MF file's Class-Path section. For entry kinds other than + * {@link #CPE_LIBRARY}, this returns <code>null</code>. For those entries that are on the raw classpath already, + * this returns <code>null</code>. + * <p> + * It is possible that multiple library entries refer to the same entry + * via the MANIFEST.MF file. In those cases, this method returns the first classpath entry + * that appears in the raw classpath. However, this does not mean that the other referencing + * entries do not relate to their referenced entries. + * See {@link JavaCore#getReferencedClasspathEntries(IClasspathEntry, IJavaProject)} for + * more details. + * </p> + * + * @return the classpath entry that is referencing this entry or <code>null</code> if + * not applicable. + * @since 3.6 + */ + IClasspathEntry getReferencingEntry(); + /** * Returns whether this entry is exported to dependent projects. * Always returns <code>false</code> for source entries (kind diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModelMarker.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModelMarker.java index b3fe18dd7..dbc6e55c7 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModelMarker.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModelMarker.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.jdt.core; +import org.eclipse.core.resources.IMarker; + /** * Markers used by the Java model. * <p> @@ -60,9 +62,14 @@ public interface IJavaModelMarker { * Id marker attribute (value <code>"arguments"</code>). Arguments are * concatenated into one String, prefixed with an argument count (followed * with colon separator) and separated with '#' characters. For example: { - * "foo", "bar" } is encoded as "2:foo#bar", { } is encoded as "0: " - * + * "foo", "bar" } is encoded as "2:foo#bar", { } is encoded as "0:". + * <p>Empty argument is encoded as three spaces (" ").</p> + * <p>If the argument contains a '#', the character is doubled.<br> + * {"foo#test", "bar" } is encoded as "2:foo##test#bar" + * </p> + * * @since 2.0 + * @see CorrectionEngine#getProblemArguments(IMarker) */ String ARGUMENTS = "arguments"; //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaProject.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaProject.java index c932b11bc..5283cf49a 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaProject.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaProject.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -1008,6 +1008,56 @@ public interface IJavaProject extends IParent, IJavaElement, IOpenable { void setRawClasspath(IClasspathEntry[] entries, boolean canModifyResources, IProgressMonitor monitor) throws JavaModelException; /** + * Works similar to {@link #setRawClasspath(IClasspathEntry[], IPath, IProgressMonitor)} and + * additionally allows persisting the given array of referenced entries for this project. + * The referenced entries and their attributes are stored in the .classpath file of this + * project. For details on referenced entries, see + * {@link JavaCore#getReferencedClasspathEntries(IClasspathEntry, IJavaProject)} + * and {@link IClasspathEntry#getReferencingEntry()}. + * <p> + * Since the referenced entries are stored in the .classpath file, clients can store additional + * information that belong to these entries and retrieve them across sessions, though the referenced + * entries themselves may not be present in the raw classpath. By passing a <code>null</code> + * referencedEntries, clients can choose not to modify the already persisted referenced entries, + * which is fully equivalent to {@link #setRawClasspath(IClasspathEntry[], IPath, IProgressMonitor)}. + * If an empty array is passed as referencedEntries, the already persisted referenced entries, + * if any, will be cleared. + * </p> <p> + * If there are duplicates of a referenced entry or if any of the <code>referencedEntries</code> + * is already present in the raw classpath(<code>entries</code>) those referenced entries will + * be excluded and not be persisted. + *</p> + * @param entries a list of classpath entries + * @param referencedEntries the list of referenced classpath entries to be persisted + * @param outputLocation the default output location + * @param monitor the given progress monitor + * @exception JavaModelException if the classpath could not be set. Reasons include: + * <ul> + * <li> This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li> + * <li> The classpath is being modified during resource change event notification (CORE_EXCEPTION) + * <li> The classpath failed the validation check as defined by {@link JavaConventions#validateClasspath(IJavaProject, IClasspathEntry[], IPath)} + * </ul> + * @see IClasspathEntry + * @see #getReferencedClasspathEntries() + * @since 3.6 + */ + void setRawClasspath(IClasspathEntry[] entries, IClasspathEntry[] referencedEntries, IPath outputLocation, + IProgressMonitor monitor) throws JavaModelException; + + /** + * Returns the list of referenced classpath entries stored in the .classpath file of <code>this</code> + * java project. Clients can store the referenced classpath entries using + * {@link #setRawClasspath(IClasspathEntry[], IClasspathEntry[], IPath, IProgressMonitor)} + * If the client has not stored any referenced entries for this project, an empty array is returned. + * + * @throws JavaModelException + * @return an array of referenced classpath entries stored for this java project or an empty array if none + * stored earlier. + * @since 3.6 + */ + IClasspathEntry[] getReferencedClasspathEntries() throws JavaModelException; + + /** * Sets the classpath of this project using a list of classpath entries. In particular such a classpath may contain * classpath variable entries. Classpath variable entries can be resolved individually ({@link JavaCore#getClasspathVariable(String)}), * or the full classpath can be resolved at once using the helper method {@link #getResolvedClasspath(boolean)}. diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IPackageFragmentRoot.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IPackageFragmentRoot.java index 535ad2358..c1ed588f2 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IPackageFragmentRoot.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IPackageFragmentRoot.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -311,6 +311,18 @@ public interface IPackageFragmentRoot * @since 2.0 */ IClasspathEntry getRawClasspathEntry() throws JavaModelException; + + /** + * Returns the first resolved classpath entry that corresponds to this package fragment root. + * A resolved classpath entry is said to correspond to a root if the path of the resolved + * entry is equal to the root's path. + * + * @return the first resolved classpath entry that corresponds to this package fragment root + * @throws JavaModelException if this element does not exist or if an + * exception occurs while accessing its corresponding resource. + * @since 3.6 + */ + IClasspathEntry getResolvedClasspathEntry() throws JavaModelException; /** * Returns the absolute path to the source archive attached to diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeParameter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeParameter.java index 0175f443a..2411a3669 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeParameter.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeParameter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 IBM Corporation and others. + * Copyright (c) 2004, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -42,6 +42,21 @@ public interface ITypeParameter extends IJavaElement, ISourceReference { String[] getBounds() throws JavaModelException; /** + * Returns the signatures for this type parameter's bounds. The type parameter may have + * been declared as part of a type or a method. The signatures represent only the individual + * bounds and do not include the type variable name or the <code>extends</code> keyword. + * The signatures may be either unresolved (for source types) or resolved (for binary types). + * See {@link Signature} for details. + * + * @return the signatures for the bounds of this formal type parameter + * @throws JavaModelException + * if this element does not exist or if an exception occurs while accessing its corresponding resource. + * @see Signature + * @since 3.6 + */ + String[] getBoundsSignatures() throws JavaModelException; + + /** * Returns the declaring member of this type parameter. This can be either an <code>IType</code> * or an <code>IMethod</code>. * <p> diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java index 6f7ae19fa..ad13e58af 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java @@ -83,6 +83,7 @@ * IBM Corporation - added getOptionForConfigurableSeverity(int) * Benjamin Muskalla - added COMPILER_PB_MISSING_SYNCHRONIZED_ON_INHERITED_METHOD * Stephan Herrmann - added COMPILER_PB_UNUSED_OBJECT_ALLOCATION + * Stephan Herrmann - added COMPILER_PB_SUPPRESS_OPTIONAL_ERRORS * * Fraunhofer FIRST - extended API and implementation * Technical University Berlin - extended API and implementation @@ -1438,6 +1439,21 @@ public final class JavaCore extends Plugin { */ public static final String COMPILER_PB_SUPPRESS_WARNINGS = PLUGIN_ID + ".compiler.problem.suppressWarnings"; //$NON-NLS-1$ /** + * Compiler option ID: Further Determining the Effect of <code>@SuppressWarnings</code> if also + * {@link #COMPILER_PB_SUPPRESS_WARNINGS} is enabled. + * <p>When enabled, the <code>@SuppressWarnings</code> annotation can additionally be used to suppress + * optional compiler diagnostics that have been configured as {@link #ERROR}. + * <p>When disabled, all <code>@SuppressWarnings</code> annotations only affects warnings. + * <dl> + * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors"</code></dd> + * <dt>Possible values:</dt><dd><code>{ "enabled", "disabled" }</code></dd> + * <dt>Default:</dt><dd><code>"disabled"</code></dd> + * </dl> + * @since 3.6 + * @category CompilerOptionID + */ + public static final String COMPILER_PB_SUPPRESS_OPTIONAL_ERRORS = PLUGIN_ID + ".compiler.problem.suppressOptionalErrors"; //$NON-NLS-1$ + /** * Compiler option ID: Reporting Unhandled Warning Token for <code>@SuppressWarnings</code>. * <p>When enabled, the compiler will issue an error or a warning when encountering a token * it cannot handle inside a <code>@SuppressWarnings</code> annotation. @@ -4601,6 +4617,33 @@ public final class JavaCore extends Plugin { false, // no access rules to combine extraAttributes); } + + /** + * Returns an array of classpath entries that are referenced directly or indirectly + * by a given classpath entry. For the entry kind {@link IClasspathEntry#CPE_LIBRARY}, + * the method returns the libraries that are included in the Class-Path section of + * the MANIFEST.MF file. If a referenced JAR file has further references to other library + * entries, they are processed recursively and added to the list. For entry kinds other + * than {@link IClasspathEntry#CPE_LIBRARY}, this method returns an empty array. + * <p> + * If a referenced entry has already been stored + * in the given project's .classpath, the stored attributes are populated in the corresponding + * referenced entry. For more details on storing referenced entries see + * see {@link IJavaProject#setRawClasspath(IClasspathEntry[], IClasspathEntry[], IPath, + * IProgressMonitor)}. + * </p> + * + * @param libraryEntry the library entry whose referenced entries are sought + * @param project project where the persisted referenced entries to be retrieved from + * @return an array of classpath entries that are referenced directly or indirectly by the given entry. + * If not applicable, returns an empty array. + * @since 3.6 + */ + public static IClasspathEntry[] getReferencedClasspathEntries(IClasspathEntry libraryEntry, IJavaProject project) { + JavaModelManager manager = JavaModelManager.getJavaModelManager(); + return manager.getReferencedClasspathEntries(libraryEntry, project); + } + /** * Removed the given classpath variable. Does nothing if no value was * set for this classpath variable. diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java index fc3f315d1..9e1a82870 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java @@ -162,6 +162,8 @@ public class ToolFactory { if (options == null) options = JavaCore.getOptions(); Map currentOptions = new HashMap(options); if (mode == M_FORMAT_NEW) { + // disable the option for not formatting comments starting on first column + currentOptions.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_LINE_COMMENT_STARTING_ON_FIRST_COLUMN, DefaultCodeFormatterConstants.TRUE); // disable the option for not indenting comments starting on first column currentOptions.put(DefaultCodeFormatterConstants.FORMATTER_NEVER_INDENT_BLOCK_COMMENTS_ON_FIRST_COLUMN, DefaultCodeFormatterConstants.FALSE); currentOptions.put(DefaultCodeFormatterConstants.FORMATTER_NEVER_INDENT_LINE_COMMENTS_ON_FIRST_COLUMN, DefaultCodeFormatterConstants.FALSE); diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/CompilationParticipant.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/CompilationParticipant.java index d9c11d57a..a2aa85127 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/CompilationParticipant.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/CompilationParticipant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2009 IBM Corporation and others. + * Copyright (c) 2005, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,7 +17,7 @@ package org.eclipse.jdt.core.compiler; import org.eclipse.jdt.core.IJavaProject; /** - * A compilation participant is notified of events occuring during the compilation process. + * A compilation participant is notified of events occurring during the compilation process. * The compilation process not only involves generating .class files (i.e. building), it also involves * cleaning the output directory, reconciling a working copy, etc. * So the notified events are the result of a build action, a clean action, a reconcile operation |