Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2013-02-02 15:22:13 +0000
committerStephan Herrmann2013-02-02 15:22:13 +0000
commit0363ef2a872fe8cfe60ddeaae6b223835db908ea (patch)
tree7999674561421066232e34c253ae5519e5bb22cb /org.eclipse.jdt.core/model
parent71aa4260bfba473935abfb2376f189d66c81b8da (diff)
downloadorg.eclipse.objectteams-0363ef2a872fe8cfe60ddeaae6b223835db908ea.tar.gz
org.eclipse.objectteams-0363ef2a872fe8cfe60ddeaae6b223835db908ea.tar.xz
org.eclipse.objectteams-0363ef2a872fe8cfe60ddeaae6b223835db908ea.zip
update jdt.core to v20130129-050623 (4.3M5).
Diffstat (limited to 'org.eclipse.jdt.core/model')
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaElement.java26
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java54
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java7
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java3
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java5
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java5
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BindingKeyParser.java21
7 files changed, 90 insertions, 31 deletions
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaElement.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaElement.java
index 37972698d..62b937236 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaElement.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -154,35 +154,35 @@ public interface IJavaElement extends IAdaptable {
boolean exists();
/**
- * Returns the first ancestor of this Java element that has the given type.
- * Returns <code>null</code> if no such an ancestor can be found.
+ * Returns this Java element or the first ancestor of this element that has the given type.
+ * Returns <code>null</code> if no such element can be found.
* This is a handle-only method.
*
* @param ancestorType the given type
- * @return the first ancestor of this Java element that has the given type, null if no such an ancestor can be found
+ * @return this Java element or the first ancestor of this element that has the given type, or <code>null</code> if no such element can be found
* @since 2.0
*/
IJavaElement getAncestor(int ancestorType);
/**
- * <p>Returns the Javadoc as an html source if this element has an attached javadoc,
- * null otherwise.</p>
- * <p>This should be used only for binary elements. Source elements will always return null.</p>
- * <p>The encoding used to read the javadoc is the one defined by the content type of the
- * file. If none is defined, then the project's encoding of this java element is used. If the project's
+ * <p>Returns the Javadoc as HTML source if this element has attached Javadoc,
+ * <code>null</code> otherwise.</p>
+ * <p>This should be used only for binary elements. Source elements will always return <code>null</code>.</p>
+ * <p>The encoding used to read the Javadoc is the one defined by the content type of the
+ * file. If none is defined, then the project's encoding of this Java element is used. If the project's
* encoding cannot be retrieved, then the platform encoding is used.</p>
- * <p>In case of the javadoc doesn't exist for this element, null is returned.</p>
+ * <p>In case the Javadoc doesn't exist for this element, <code>null</code> is returned.</p>
*
- * <p>The html is extracted from the attached javadoc and provided as is. No
+ * <p>The HTML is extracted from the attached Javadoc and provided as is. No
* transformation or validation is done.</p>
*
- * @param monitor the given progress monitor
+ * @param monitor the given progress monitor, can be <code>null</code>
* @exception JavaModelException if:<ul>
* <li>this element does not exist</li>
* <li>retrieving the attached javadoc fails (timed-out, invalid URL, ...)</li>
* <li>the format of the javadoc doesn't match expected standards (different anchors,...)</li>
* </ul>
- * @return the extracted javadoc from the attached javadoc, null if none
+ * @return the extracted javadoc from the attached javadoc, <code>null</code> if none
* @see IClasspathAttribute#JAVADOC_LOCATION_ATTRIBUTE_NAME
* @since 3.2
*/
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 b15a90667..63c740873 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
@@ -99,6 +99,8 @@
* COMPILER_PB_MISSING_ENUM_CASE_DESPITE_DEFAULT
* COMPILER_PB_SWITCH_MISSING_DEFAULT_CASE
* COMPILER_INHERIT_NULL_ANNOTATIONS
+ * COMPILER_PB_NONNULL_PARAMETER_ANNOTATION_DROPPED
+ * COMPILER_PB_SYNTACTIC_NULL_ANALYSIS_FOR_FIELDS
*******************************************************************************/
package org.eclipse.jdt.core;
@@ -1507,7 +1509,7 @@ public final class JavaCore extends Plugin {
* <p>If the annotation specified by this option is applied to a type in a method
* signature or variable declaration, this will be interpreted as a specification
* that <code>null</code> is a legal value in that position. Currently supported
- * positions are: method parameters, method return type and local variables.</p>
+ * positions are: method parameters, method return type, fields and local variables.</p>
* <p>If a value whose type
* is annotated with this annotation is dereferenced without checking for null,
* the compiler will trigger a diagnostic as further controlled by
@@ -1533,7 +1535,7 @@ public final class JavaCore extends Plugin {
* <p>If the annotation specified by this option is applied to a type in a method
* signature or variable declaration, this will be interpreted as a specification
* that <code>null</code> is <b>not</b> a legal value in that position. Currently
- * supported positions are: method parameters, method return type and local variables.</p>
+ * supported positions are: method parameters, method return type, fields and local variables.</p>
* <p>For values declared with this annotation, the compiler will never trigger a null
* reference diagnostic (as controlled by {@link #COMPILER_PB_POTENTIAL_NULL_REFERENCE}
* and {@link #COMPILER_PB_NULL_REFERENCE}), because the assumption is made that null
@@ -1557,8 +1559,8 @@ public final class JavaCore extends Plugin {
* <p>This option defines a fully qualified Java type name that the compiler may use
* to perform special null analysis.</p>
* <p>If the annotation is applied without an argument, all unannotated types in method signatures
- * within the annotated element will be treated as if they were specified with the non-null annotation
- * (see {@link #COMPILER_NONNULL_ANNOTATION_NAME}).</p>
+ * and field declarations within the annotated element will be treated as if they were specified
+ * with the non-null annotation (see {@link #COMPILER_NONNULL_ANNOTATION_NAME}).</p>
* <p>If the annotation is applied with the constant <code>false</code> as its argument
* all corresponding defaults at outer scopes will be canceled for the annotated element.</p>
* <p>This option only has an effect if the option {@link #COMPILER_ANNOTATION_NULL_ANALYSIS} is enabled.</p>
@@ -1609,6 +1611,9 @@ public final class JavaCore extends Plugin {
* for at least one of its parameters, tries to tighten that null contract by
* specifying a nonnull annotation for its corresponding parameter
* (prohibition of covariant parameters).</li>
+ * <li>A non-static field with a nonnull annotation is not definitely assigned at
+ * the end of each constructor.</li>
+ * <li>A static field with a nonnull annotation is not definitely assigned in static initializers.</li>
* </ol>
* In the above an expression is considered as <em>nullable</em> if
* either it is statically known to evaluate to the value <code>null</code>, or if it is
@@ -1705,6 +1710,20 @@ public final class JavaCore extends Plugin {
*/
public static final String COMPILER_PB_REDUNDANT_NULL_ANNOTATION = PLUGIN_ID + ".compiler.problem.redundantNullAnnotation"; //$NON-NLS-1$
/**
+ * Compiler option ID: Perform syntactic null analysis for fields.
+ * <p>When enabled, the compiler will detect certain syntactic constellations where a null
+ * related warning against a field reference would normally be raised but can be suppressed
+ * at low risk given that the same field reference was known to be non-null immediately before.</p>
+ * <dl>
+ * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields"</code></dd>
+ * <dt>Possible values:</dt><dd><code>{ "disabled", "enabled" }</code></dd>
+ * <dt>Default:</dt><dd><code>"disabled"</code></dd>
+ * </dl>
+ * @since 3.9
+ * @category CompilerOptionID
+ */
+ public static final String COMPILER_PB_SYNTACTIC_NULL_ANALYSIS_FOR_FIELDS = JavaCore.PLUGIN_ID+".compiler.problem.syntacticNullAnalysisForFields"; //$NON-NLS-1$
+ /**
* Compiler option ID: Inheritance of null annotations.
* <p>When enabled, the compiler will check for each method without any explicit null annotations:
* If it overrides a method which has null annotations, it will treat the
@@ -1725,6 +1744,32 @@ public final class JavaCore extends Plugin {
*/
public static final String COMPILER_INHERIT_NULL_ANNOTATIONS = JavaCore.PLUGIN_ID+".compiler.annotation.inheritNullAnnotations"; //$NON-NLS-1$
/**
+ * Compiler option ID: Reporting Dropped Nonnull Parameter Annotations.
+ * <p>When enabled, the compiler will issue an error or a warning against a parameter of
+ * a method that overrides an inherited method
+ * if all of the following hold:</p>
+ * <ul>
+ * <li>The overridden method declares the corresponding parameter as non-null (see {@link #COMPILER_NONNULL_ANNOTATION_NAME}).</li>
+ * <li>The parameter in the overriding method has no null annotation.</li>
+ * <li>The overriding method is not affected by a nullness default (see {@link #COMPILER_NONNULL_BY_DEFAULT_ANNOTATION_NAME}).</li>
+ * <li>Inheritance of null annotations is disabled (see {@link #COMPILER_INHERIT_NULL_ANNOTATIONS}).</li>
+ * </ul>
+ * <p>This particular situation bears the same inherent risk as any unannotated method parameter,
+ * because the compiler's null ananysis cannot decide wither <code>null</code> is or is not a legal value for this parameter.
+ * However, the annotation in the overridden method <em>suggests</em> that the parameter should also be annotated as non-null.
+ * If that is not intended or possible, it is recommended to annotate the parameter as nullable,
+ * in order to make this (legal) change of contract explicit.</p>
+ * <dl>
+ * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped"</code></dd>
+ * <dt>Possible values:</dt><dd><code>{ "error", "warning", "ignore" }</code></dd>
+ * <dt>Default:</dt><dd><code>"warning"</code></dd>
+ * </dl>
+ * @since 3.9
+ * @category CompilerOptionID
+ */
+ public static final String COMPILER_PB_NONNULL_PARAMETER_ANNOTATION_DROPPED = JavaCore.PLUGIN_ID+".compiler.problem.nonnullParameterAnnotationDropped"; //$NON-NLS-1$
+
+ /**
* Compiler option ID: Setting Source Compatibility Mode.
* <p>Specify whether which source level compatibility is used. From 1.4 on, <code>'assert'</code> is a keyword
* reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
@@ -5600,5 +5645,4 @@ public final class JavaCore extends Plugin {
super.start(context);
JavaModelManager.getJavaModelManager().startup();
}
-
} \ No newline at end of file
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java
index 50cfb6b78..5f42ba94e 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -370,11 +370,6 @@ public IBuffer getBuffer() throws JavaModelException {
if (status.isOK()) {
return super.getBuffer();
} else {
- // .class file not on classpath, create a new buffer to be nice (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=41444)
- Object info = ((ClassFile) getClassFile()).getBinaryTypeInfo((IFile) resource());
- IBuffer buffer = openBuffer(null, info);
- if (buffer != null && !(buffer instanceof NullBuffer))
- return buffer;
switch (status.getCode()) {
case IJavaModelStatusConstants.ELEMENT_NOT_ON_CLASSPATH: // don't throw a JavaModelException to be able to open .class file outside the classpath (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=138507 )
case IJavaModelStatusConstants.INVALID_ELEMENT_TYPES: // don't throw a JavaModelException to be able to open .class file in proj==src case without source (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=221904 )
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
index 02ccb62ea..fc7e58e6f 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -1487,6 +1487,7 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis
propertyName.equals(JavaCore.CORE_INCOMPLETE_CLASSPATH) ||
propertyName.equals(JavaCore.CORE_CIRCULAR_CLASSPATH) ||
propertyName.equals(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL) ||
+ propertyName.equals(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM) ||
propertyName.equals(JavaCore.CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE)) {
JavaModelManager manager = JavaModelManager.getJavaModelManager();
IJavaModel model = manager.getJavaModel();
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
index f96e87aa0..205bfefac 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -1560,7 +1560,8 @@ public class JavaProject
propertyName.equals(JavaCore.CORE_INCOMPLETE_CLASSPATH) ||
propertyName.equals(JavaCore.CORE_CIRCULAR_CLASSPATH) ||
propertyName.equals(JavaCore.CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE) ||
- propertyName.equals(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL))
+ propertyName.equals(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL) ||
+ propertyName.equals(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM))
{
manager.deltaState.addClasspathValidation(JavaProject.this);
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java
index 19890befc..5408aef33 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -27,7 +27,6 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaModelStatusConstants;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
@@ -484,7 +483,7 @@ public String getAttachedJavadoc(IProgressMonitor monitor) throws JavaModelExcep
if (monitor != null && monitor.isCanceled()) throw new OperationCanceledException();
String contents = getURLContents(String.valueOf(pathBuffer));
if (monitor != null && monitor.isCanceled()) throw new OperationCanceledException();
- if (contents == null) throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.CANNOT_RETRIEVE_ATTACHED_JAVADOC, this));
+ if (contents == null) return null;
contents = (new JavadocContents(contents)).getPackageDoc();
if (contents == null) contents = ""; //$NON-NLS-1$
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BindingKeyParser.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BindingKeyParser.java
index 124adaab7..aacd3e1de 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BindingKeyParser.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BindingKeyParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 2013 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
@@ -704,6 +704,25 @@ public class BindingKeyParser {
return;
}
break;
+ case Scanner.WILDCARD:
+ // support the '-' in "Lpack/package-info;", see bug 398920
+ if (!CharOperation.endsWith(this.scanner.getTokenSource(), new char[] {'/', 'p', 'a', 'c', 'k', 'a', 'g', 'e', '-'})) {
+ malformedKey();
+ return;
+ }
+
+ int start = this.scanner.start;
+ if (this.scanner.nextToken() == Scanner.TYPE) {
+ if (!CharOperation.equals(this.scanner.getTokenSource(), new char[] {'i', 'n', 'f', 'o'})) {
+ malformedKey();
+ return;
+ }
+ this.scanner.start = start;
+ this.keyStart = start-1;
+ consumeFullyQualifiedName(this.scanner.getTokenSource());
+ break;
+ }
+ break;
default:
malformedKey();
return;

Back to the top