update to JDT/Core v_B18
diff --git a/org.eclipse.jdt.core/META-INF/Bootstrap_MANIFEST.MF b/org.eclipse.jdt.core/META-INF/Bootstrap_MANIFEST.MF
index 5643053..1cbed53 100644
--- a/org.eclipse.jdt.core/META-INF/Bootstrap_MANIFEST.MF
+++ b/org.eclipse.jdt.core/META-INF/Bootstrap_MANIFEST.MF
@@ -3,7 +3,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.core; singleton:=true
-Bundle-Version: 3.7.0.v_B13a
+Bundle-Version: 3.7.0.v_B18
Bundle-Activator: org.eclipse.jdt.core.JavaCore
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java b/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java
index 44a8dac..966e175 100644
--- a/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java
+++ b/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java
@@ -119,8 +119,6 @@
}
}
- Path classpath = new Path(this.project);
-
/*
* Eclipse compiler doesn't support -extdirs.
* It is emulated using the classpath. We add extdirs entries after the
@@ -131,11 +129,17 @@
cmd.createArgument().setPath(this.extdirs);
}
+ Path classpath = new Path(this.project);
/*
* The java runtime is already handled, so we simply want to retrieve the
* ant runtime and the compile classpath.
*/
classpath.append(getCompileClasspath());
+ /*
+ * Set the classpath for the Eclipse compiler.
+ */
+ cmd.createArgument().setValue("-classpath"); //$NON-NLS-1$
+ createClasspathArgument(cmd, classpath);
// For -sourcepath, use the "sourcepath" value if present.
// Otherwise default to the "srcdir" value.
@@ -164,12 +168,8 @@
} else {
sourcepath = this.src;
}
- classpath.append(sourcepath);
- /*
- * Set the classpath for the Eclipse compiler.
- */
- cmd.createArgument().setValue("-classpath"); //$NON-NLS-1$
- createClasspathArgument(cmd, classpath);
+ cmd.createArgument().setValue("-sourcepath"); //$NON-NLS-1$
+ createClasspathArgument(cmd, sourcepath);
final String javaVersion = JavaEnvUtils.getJavaVersion();
String memoryParameterPrefix = javaVersion.equals(JavaEnvUtils.JAVA_1_1) ? "-J-" : "-J-X";//$NON-NLS-1$//$NON-NLS-2$
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/FileSystem.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/FileSystem.java
index 1d3d7b1..0052ed9 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/FileSystem.java
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/FileSystem.java
@@ -201,13 +201,33 @@
fileName = CharOperation.subarray(fileName, 0, lastIndexOf);
}
CharOperation.replace(fileName, '\\', '/');
+ boolean globalPathMatches = false;
+ // the most nested path should be the selected one
for (int j = 0, max = this.classpaths.length; j < max; j++) {
char[] matchCandidate = this.classpaths[j].normalizedPath();
- if (this.classpaths[j] instanceof ClasspathDirectory &&
- CharOperation.prefixEquals(matchCandidate, fileName) &&
- (matchingPathName == null ||
- matchCandidate.length < matchingPathName.length)) {
- matchingPathName = matchCandidate;
+ boolean currentPathMatch = false;
+ if (this.classpaths[j] instanceof ClasspathDirectory
+ && CharOperation.prefixEquals(matchCandidate, fileName)) {
+ currentPathMatch = true;
+ if (matchingPathName == null) {
+ matchingPathName = matchCandidate;
+ } else {
+ if (currentPathMatch) {
+ // we have a second source folder that matches the path of the source file
+ if (matchCandidate.length > matchingPathName.length) {
+ // we want to preserve the shortest possible path
+ matchingPathName = matchCandidate;
+ }
+ } else {
+ // we want to preserve the shortest possible path
+ if (!globalPathMatches && matchCandidate.length < matchingPathName.length) {
+ matchingPathName = matchCandidate;
+ }
+ }
+ }
+ if (currentPathMatch) {
+ globalPathMatches = true;
+ }
}
}
if (matchingPathName == null) {
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
index 2077bb1..435ab03 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
@@ -3373,7 +3373,12 @@
} else if (token.equals("charConcat") /*|| token.equals("noImplicitStringConversion")/*backward compatible*/) {//$NON-NLS-1$
setSeverity(CompilerOptions.OPTION_ReportNoImplicitStringConversion, severity, isEnabling);
return;
- }
+ } else if (token.equals("includeAssertNull")) { //$NON-NLS-1$
+ this.options.put(
+ CompilerOptions.OPTION_IncludeNullInfoFromAsserts,
+ isEnabling ? CompilerOptions.ENABLED : CompilerOptions.DISABLED);
+ return;
+ }
break;
case 'd' :
if (token.equals("deprecation")) { //$NON-NLS-1$
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
index 6ad427b..a7b4b8c 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
@@ -1,7 +1,7 @@
#Format: compiler.name = word1 word2 word3
compiler.name = Eclipse Compiler for Java(TM)
#Format: compiler.version = 0.XXX[, other words (don't forget the comma if adding other words)]
-compiler.version = 0.B14a, 3.7.0 M3
+compiler.version = 0.B18, 3.7.0 M3
compiler.copyright = Copyright IBM Corp 2000, 2010. All rights reserved.
###{ObjectTeams:
@@ -300,6 +300,8 @@
\ hashCode missing hashCode() method when overriding equals()\n\
\ hiding macro for fieldHiding, localHiding, typeHiding and\n\
\ maskedCatchBlock\n\
+\ includeAssertNull raise null warnings for variables\n\
+\ that got tainted in an assert expression\n\
\ incomplete-switch same as enumSwitch\n\
\ indirectStatic indirect reference to static member\n\
\ inferredcallout + a callout binding has to be inferred (OTJLD 3.1(j))\n\
diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html
index 7137c5e..7c64065 100644
--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html
+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html
@@ -40,11 +40,163 @@
</td>
</tr>
</table>
+<a name="v_B18"></a>
+<hr><h1>
+Eclipse Platform Build Notes<br>
+Java development tools core</h1>
+Eclipse SDK 3.7M3 - October 19, 2010 - 3.7.0 M3
+<br>Project org.eclipse.jdt.core v_B18
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B18">cvs</a>).
+<h2>What's new in this drop</h2>
+
+<h3>Problem Reports Fixed</h3>
+<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=327429">327429</a>
+Use Charset.name() instead of Charset.toString() to get the encoding
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=327817">327817</a>
+ecjsrc.zip should be ecjsrc.jar
+
+<a name="v_B17"></a>
+<hr><h1>
+Eclipse Platform Build Notes<br>
+Java development tools core</h1>
+Eclipse SDK 3.7M3 - October 12, 2010
+<br>Project org.eclipse.jdt.core v_B17
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B17">cvs</a>).
+<h2>What's new in this drop</h2>
+<ul>
+<li>New Javacore option org.eclipse.jdt.core.JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS_METHOD_TYPE_PARAMETERS added to enable or disable the missing Javadoc tag warning or error for a method
+ paramater without a corresponding <code>@param</code> tag. (see details in bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=322581">322581</a>):
+<pre>
+ /**
+ * Compiler option ID: Reporting Missing Javadoc Tags for Method Type Parameters.
+ * Specify whether a missing <code>@param</code> for a type parameter in a method declaration should be reported.
+ * When enabled, the compiler will issue a missing Javadoc tag error or warning for a type parameter without a
+ * corresponding <code>@param</code> tag.
+ *
+ * This option only has an effect if the compiler compliance is 1.5 or greater.
+ *
+ * Option id:<code>"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters"</code>
+ * Possible values:<code>{ "enabled", "disabled" }</code>
+ * Default:<code>"disabled"</code>
+ *
+ * @since 3.7
+ * @category CompilerOptionID
+ */
+ public static final String COMPILER_PB_MISSING_JAVADOC_TAGS_METHOD_TYPE_PARAMETERS = PLUGIN_ID + ".compiler.problem.missingJavadocTagsMethodTypeParameters";
+</pre>
+</li>
+<li>Added new API on org.eclipse.jdt.core.dom.rewrite.ASTRewrite to store properties (See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=325131">325131</a>).
+<pre>
+ /**
+ * Returns the value of the named property of this rewrite, or null if none.
+ *
+ * @param propertyName the property name
+ * @return the property value, or <code>null</code> if none
+ * @see #setProperty(String,Object)
+ * @throws IllegalArgumentException if the given property name is null
+ * @since 3.7
+ */
+ public final Object getProperty(String propertyName);
+</pre>
+<pre>
+ /**
+ * Sets the named property of this rewrite to the given value,
+ * or to null to clear it.
+ *
+ * Clients should employ property names that are sufficiently unique
+ * to avoid inadvertent conflicts with other clients that might also be
+ * setting properties on the same rewrite.
+ *
+ *
+ * Note that modifying a property is not considered a modification to the
+ * AST itself. This is to allow clients to decorate existing rewrites with
+ * their own properties without jeopardizing certain things (like the
+ * validity of bindings), which rely on the underlying tree remaining static.
+ *
+ *
+ * @param propertyName the property name
+ * @param data the new property value, or null if none
+ * @see #getProperty(String)
+ * @throws IllegalArgumentException if the given property name is null
+ * @since 3.7
+ */
+ public final void setProperty(String propertyName, Object data);
+</pre>
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=324367">324367</a>
+IJavaProject.findPackageFragmentRoots(IClasspathEntry cpe) returns empty list
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=311022">311022</a>
+NPE in InternalExtendedCompletionContext.getVisibleElement
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=325131">325131</a>
+ASTRewrite should offer get/setProperty() like ASTNode
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=322789">322789</a>
+package-info.java Won't Build On First Compile Pass
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=322581">322581</a>
+[5.0] Add Javadoc compiler option to (not) report missing tags for method type parameters
+
+<a name="v_B16"></a>
+<hr><h1>
+Eclipse Platform Build Notes<br>
+Java development tools core</h1>
+Eclipse SDK 3.7M3 - October 5, 2010 - 3.7.0 M3
+<br>Project org.eclipse.jdt.core v_B16
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B16">cvs</a>).
+<h2>What's new in this drop</h2>
+<ul>
+<li>New Javacore option org.eclipse.jdt.core.JavaCore.COMPILER_PB_INCLUDE_ASSERTS_IN_NULL_ANALYSIS added to give the user flexibility to see null related warning arising because of assert statements (see details in <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=325342">bug 325342</a>):
+<pre>
+ /**
+ * Compiler option ID: Raise null related errors or warnings arising because of assert statements.
+ * When enabled, the compiler will flag all null related errors or warnings that have been enabled by the user,
+ * irrespective of whether a variable occurred in an assert statement.
+ * When disabled, the compiler will not flag null related errors or warnings on variables that got marked as maybe or definitely
+ * <code>null</code> in an assert statement upstream.
+ *
+ * Option id:<code>"org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts"</code>
+ * Possible values:<code>{ "enabled", "disabled" }</code>
+ * Default:<code>"disabled"</code>
+ *
+ * @since 3.7
+ * @category CompilerOptionID
+ */
+ public static final String COMPILER_PB_INCLUDE_ASSERTS_IN_NULL_ANALYSIS = PLUGIN_ID + ".compiler.problem.includeNullInfoFromAsserts";
+</pre>
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=323012">323012</a>
+[jsr14][compiler] Class literal value is not cached when target is jsr14
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=325342">325342</a>
+Add new option for null analysis based on assert result.
+
+<a name="v_B15"></a>
+<hr><h1>
+Eclipse Platform Build Notes<br>
+Java development tools core</h1>
+Eclipse SDK 3.7M3 - September 28, 2010
+<br>Project org.eclipse.jdt.core v_B15
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B15">cvs</a>).
+<h2>What's new in this drop</h2>
+
+<h3>Problem Reports Fixed</h3>
+<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=312603">312603</a>
+[content assist] field being declared is proposed as a method argument inside initialization
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=325342">325342</a>
+Add new option for null analysis based on assert result.
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=325481">325481</a>
+[assist] fields declared after a particular field are proposed in its initialization
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=325633">325633</a>
+1.4 project confused when referencing a return type of generic array from 1.5 project
+
<a name="v_B14a"></a>
<hr><h1>
Eclipse Platform Build Notes<br>
Java development tools core</h1>
-Eclipse SDK 3.7M3 - September 21, 2010 - 3.7.0 M3
+Eclipse SDK 3.7M3 - September 21, 2010
<br>Project org.eclipse.jdt.core v_B14a
(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B14a">cvs</a>).
<h2>What's new in this drop</h2>
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
index bd88c29..d58b57d 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
@@ -6192,6 +6192,17 @@
int receiverEnd) {
ObjectVector newFieldsFound = new ObjectVector();
+ // if the proposal is being asked inside a field's initialization, we'll record its id
+ int fieldBeingCompletedId = -1;
+ for (int f = fields.length; --f >=0;) {
+ FieldBinding field = fields[f];
+ FieldDeclaration fieldDeclaration = field.sourceField();
+ if (fieldDeclaration != null && fieldDeclaration.initialization != null) {
+ // We're asking for a proposal inside this field's initialization. So record its id
+ fieldBeingCompletedId = field.id;
+ break;
+ }
+ }
// Inherited fields which are hidden by subclasses are filtered out
// No visibility checks can be performed without the scope & invocationSite
@@ -6205,6 +6216,14 @@
int fieldLength = fieldName.length;
next : for (int f = fields.length; --f >= 0;) {
FieldBinding field = fields[f];
+
+ // Content assist invoked inside some field's initialization.
+ // bug 310427 and 325481
+ if (fieldBeingCompletedId >= 0 && field.id >= fieldBeingCompletedId) {
+ // Don't propose field which is being declared currently
+ // Don't propose fields declared after the current field declaration statement
+ continue next;
+ }
//{ObjectTeams: filter out generated fields
if (!canBeCompleted(field.name)) continue next;
@@ -6234,15 +6253,6 @@
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=195346
if (this.assistNodeIsInsideCase && field.type instanceof ArrayBinding)
continue next;
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=310427
- // Don't propose field which is being declared currently
- // Don't propose fields declared after the current field declaration statement
- if (this.parser.assistNodeParent instanceof FieldDeclaration) {
- FieldDeclaration fieldDeclaration = (FieldDeclaration) this.parser.assistNodeParent;
- if (field.id >= fieldDeclaration.binding.id)
- continue next;
- }
//{ObjectTeams: additional check if method spec type already known:
if (expectedType != null && expectedType != field.type) continue next;
@@ -13159,6 +13169,7 @@
break;
}
}
+
private void proposeNewMethod(char[] token, ReferenceBinding reference) {
if(!this.requestor.isIgnored(CompletionProposal.POTENTIAL_METHOD_DECLARATION)) {
int relevance = computeBaseRelevance();
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java
index de5ec24..5e59fad 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java
@@ -198,6 +198,15 @@
if (this.visibleFields.size > 0 && this.visibleFields.contains(fieldDeclaration.binding)) {
this.visibleFields.remove(fieldDeclaration.binding);
}
+ int count = 0;
+ while (count < this.visibleFields.size) {
+ FieldBinding visibleField = (FieldBinding)this.visibleFields.elementAt(count);
+ if (visibleField.id > fieldDeclaration.binding.id) {
+ this.visibleFields.remove(visibleField);
+ continue;
+ }
+ count++;
+ }
break done;
}
/*(Incase fieldDeclaration != null is not sufficient to infer that
@@ -386,7 +395,7 @@
next : for (int i = 0; i < size; i++) {
try {
LocalVariableBinding binding = (LocalVariableBinding) this.visibleLocalVariables.elementAt(i);
- if (assignableTypeBinding != null && !binding.type.isCompatibleWith(assignableTypeBinding)) continue next;
+ if (binding.type == null || (assignableTypeBinding != null && !binding.type.isCompatibleWith(assignableTypeBinding))) continue next;
JavaElement localVariable = getJavaElement(binding);
if (localVariable != null) result[elementCount++] = localVariable;
} catch(AbortCompilation e) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java
index d1887e2..826bb1e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java
@@ -14,6 +14,7 @@
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.codegen.*;
import org.eclipse.jdt.internal.compiler.flow.*;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.impl.Constant;
import org.eclipse.jdt.internal.compiler.lookup.*;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
@@ -82,6 +83,11 @@
// change this if we need to carry null analysis results of the assert
// expression downstream
} else {
+ CompilerOptions compilerOptions = currentScope.compilerOptions();
+ if (!compilerOptions.includeNullInfoFromAsserts) {
+ // keep just the initializations info, don't include assert's null info
+ return flowInfo.addInitializationsFrom(assertInfo.nullInfoLessUnconditionalCopy());
+ }
return flowInfo.mergedWith(assertInfo.nullInfoLessUnconditionalCopy()).
addInitializationsFrom(assertWhenTrueInfo.discardInitializationInfo());
// keep the merge from the initial code for the definite assignment
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java
index edd5f83..d1af59c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java
@@ -68,7 +68,7 @@
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=22334
if (!sourceType.isInterface()
&& !this.targetType.isBaseType()
- && currentScope.compilerOptions().sourceLevel < ClassFileConstants.JDK1_5) {
+ && currentScope.compilerOptions().targetJDK < ClassFileConstants.JDK1_5) {
this.syntheticField = sourceType.addSyntheticFieldForClassLiteral(this.targetType, currentScope);
}
return flowInfo;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java
index 0d07305..c99e550 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 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
@@ -381,7 +381,7 @@
// @param tags
CompilerOptions compilerOptions = methScope.compilerOptions();
resolveParamTags(methScope, reportMissing, compilerOptions.reportUnusedParameterIncludeDocCommentReference /* considerParamRefAsUsage*/);
- resolveTypeParameterTags(methScope, reportMissing);
+ resolveTypeParameterTags(methScope, reportMissing && compilerOptions.reportMissingJavadocTagsMethodTypeParameters);
// @return tags
if (this.returnStatement == null) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java
index 4146e5a..c2d19d0 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java
@@ -1488,6 +1488,7 @@
throw new AssertionFailedException("COVERAGE 28"); //$NON-NLS-1$
}
}
+ combineNullStatusChangeInAssertInfo(otherInits);
return this;
}
if ((this.tagBits & UNREACHABLE) != 0) {
@@ -1496,6 +1497,7 @@
throw new AssertionFailedException("COVERAGE 29"); //$NON-NLS-1$
}
}
+ otherInits.combineNullStatusChangeInAssertInfo(this);
return (UnconditionalFlowInfo) otherInits.copy(); // make sure otherInits won't be affected
}
@@ -1783,6 +1785,7 @@
copy.potentialInits = this.potentialInits;
copy.tagBits = this.tagBits & ~NULL_FLAG_MASK;
copy.maxFieldCount = this.maxFieldCount;
+ copy.nullStatusChangedInAssert = this.nullStatusChangedInAssert;
if (this.extra != null) {
int length;
copy.extra = new long[extraLength][];
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
index d71dac5..d951cf3 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
@@ -86,6 +86,7 @@
public static final String OPTION_ReportMissingJavadocTags = "org.eclipse.jdt.core.compiler.problem.missingJavadocTags"; //$NON-NLS-1$
public static final String OPTION_ReportMissingJavadocTagsVisibility = "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility"; //$NON-NLS-1$
public static final String OPTION_ReportMissingJavadocTagsOverriding = "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding"; //$NON-NLS-1$
+ public static final String OPTION_ReportMissingJavadocTagsMethodTypeParameters = "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters"; //$NON-NLS-1$
public static final String OPTION_ReportMissingJavadocComments = "org.eclipse.jdt.core.compiler.problem.missingJavadocComments"; //$NON-NLS-1$
public static final String OPTION_ReportMissingJavadocTagDescription = "org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription"; //$NON-NLS-1$
public static final String OPTION_ReportMissingJavadocCommentsVisibility = "org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility"; //$NON-NLS-1$
@@ -141,6 +142,7 @@
public static final String OPTION_ReportDeadCodeInTrivialIfStatement = "org.eclipse.jdt.core.compiler.problem.deadCodeInTrivialIfStatement"; //$NON-NLS-1$
public static final String OPTION_ReportTasks = "org.eclipse.jdt.core.compiler.problem.tasks"; //$NON-NLS-1$
public static final String OPTION_ReportUnusedObjectAllocation = "org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation"; //$NON-NLS-1$
+ public static final String OPTION_IncludeNullInfoFromAsserts = "org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts"; //$NON-NLS-1$
//{ObjectTeams: sync with constants in OTDTPlugin:
public static final String OPTION_ReportNotExactlyOneBasecall =
@@ -420,6 +422,8 @@
public int reportMissingJavadocTagsVisibility;
/** Specify if need to flag missing javadoc tags for overriding method */
public boolean reportMissingJavadocTagsOverriding;
+ /** Specify if need to flag missing javadoc tags for method type parameters (java 1.5 and above)*/
+ public boolean reportMissingJavadocTagsMethodTypeParameters;
/** Only report missing javadoc comment above a given level of visibility of associated construct */
public int reportMissingJavadocCommentsVisibility;
/** Specify if need to flag missing javadoc comment for overriding method */
@@ -446,6 +450,8 @@
public boolean generateClassFiles;
/** Indicate if method bodies should be ignored */
public boolean ignoreMethodBodies;
+ /** Raise null related warnings for variables tainted inside an assert statement (java 1.5 and above)*/
+ public boolean includeNullInfoFromAsserts;
//{ObjectTeams: other configurable options of OT/J:
// verbosity of reporting decapsulation:
@@ -1134,6 +1140,7 @@
optionsMap.put(OPTION_ReportMissingJavadocTags, getSeverityString(MissingJavadocTags));
optionsMap.put(OPTION_ReportMissingJavadocTagsVisibility, getVisibilityString(this.reportMissingJavadocTagsVisibility));
optionsMap.put(OPTION_ReportMissingJavadocTagsOverriding, this.reportMissingJavadocTagsOverriding ? ENABLED : DISABLED);
+ optionsMap.put(OPTION_ReportMissingJavadocTagsMethodTypeParameters, this.reportMissingJavadocTagsMethodTypeParameters ? ENABLED : DISABLED);
optionsMap.put(OPTION_ReportMissingJavadocComments, getSeverityString(MissingJavadocComments));
optionsMap.put(OPTION_ReportMissingJavadocTagDescription, this.reportMissingJavadocTagDescription);
optionsMap.put(OPTION_ReportMissingJavadocCommentsVisibility, getVisibilityString(this.reportMissingJavadocCommentsVisibility));
@@ -1193,6 +1200,7 @@
optionsMap.put(OPTION_ReportDeadCodeInTrivialIfStatement, this.reportDeadCodeInTrivialIfStatement ? ENABLED : DISABLED);
optionsMap.put(OPTION_ReportTasks, getSeverityString(Tasks));
optionsMap.put(OPTION_ReportUnusedObjectAllocation, getSeverityString(UnusedObjectAllocation));
+ optionsMap.put(OPTION_IncludeNullInfoFromAsserts, this.includeNullInfoFromAsserts ? ENABLED : DISABLED);
//{ObjectTeams:
optionsMap.put(OPTION_Decapsulation, this.decapsulation);
@@ -1323,6 +1331,7 @@
// check missing javadoc tags
this.reportMissingJavadocTagsVisibility = ClassFileConstants.AccPublic;
this.reportMissingJavadocTagsOverriding = false;
+ this.reportMissingJavadocTagsMethodTypeParameters = false;
// check missing javadoc comments
this.reportMissingJavadocCommentsVisibility = ClassFileConstants.AccPublic;
@@ -1366,6 +1375,9 @@
// ignore method bodies
this.ignoreMethodBodies = false;
+
+ // allow null info from asserts to be considered downstream by default
+ this.includeNullInfoFromAsserts = false;
}
public void set(Map optionsMap) {
@@ -1572,6 +1584,13 @@
this.reportMissingOverrideAnnotationForInterfaceMethodImplementation = false;
}
}
+ if ((optionValue = optionsMap.get(OPTION_IncludeNullInfoFromAsserts)) != null) {
+ if (ENABLED.equals(optionValue)) {
+ this.includeNullInfoFromAsserts = true;
+ } else if (DISABLED.equals(optionValue)) {
+ this.includeNullInfoFromAsserts = false;
+ }
+ }
if ((optionValue = optionsMap.get(OPTION_ReportMethodWithConstructorName)) != null) updateSeverity(MethodWithConstructorName, optionValue);
if ((optionValue = optionsMap.get(OPTION_ReportOverridingPackageDefaultMethod)) != null) updateSeverity(OverriddenPackageDefaultMethod, optionValue);
if ((optionValue = optionsMap.get(OPTION_ReportDeprecation)) != null) updateSeverity(UsingDeprecatedAPI, optionValue);
@@ -1737,6 +1756,13 @@
this.reportMissingJavadocTagsOverriding = false;
}
}
+ if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocTagsMethodTypeParameters)) != null) {
+ if (ENABLED.equals(optionValue)) {
+ this.reportMissingJavadocTagsMethodTypeParameters = true;
+ } else if (DISABLED.equals(optionValue)) {
+ this.reportMissingJavadocTagsMethodTypeParameters = false;
+ }
+ }
if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocComments)) != null) {
updateSeverity(MissingJavadocComments, optionValue);
}
@@ -1814,6 +1840,7 @@
buf.append("\n\t\t+ visibility level to report invalid javadoc tags: ").append(getVisibilityString(this.reportInvalidJavadocTagsVisibility)); //$NON-NLS-1$
buf.append("\n\t\t+ missing javadoc tags: ").append(getSeverityString(MissingJavadocTags)); //$NON-NLS-1$
buf.append("\n\t\t+ visibility level to report missing javadoc tags: ").append(getVisibilityString(this.reportMissingJavadocTagsVisibility)); //$NON-NLS-1$
+ buf.append("\n\t\t+ report missing javadoc tags for method type parameters: ").append(this.reportMissingJavadocTagsMethodTypeParameters ? ENABLED : DISABLED); //$NON-NLS-1$
buf.append("\n\t\t+ report missing javadoc tags in overriding methods: ").append(this.reportMissingJavadocTagsOverriding ? ENABLED : DISABLED); //$NON-NLS-1$
buf.append("\n\t\t+ missing javadoc comments: ").append(getSeverityString(MissingJavadocComments)); //$NON-NLS-1$
buf.append("\n\t\t+ report missing tag description option: ").append(this.reportMissingJavadocTagDescription); //$NON-NLS-1$
@@ -1857,6 +1884,7 @@
buf.append("\n\t- missing @Override annotation for interface method implementation: ").append(this.reportMissingOverrideAnnotationForInterfaceMethodImplementation ? ENABLED : DISABLED); //$NON-NLS-1$
buf.append("\n\t- missing @Deprecated annotation: ").append(getSeverityString(MissingDeprecatedAnnotation)); //$NON-NLS-1$
buf.append("\n\t- incomplete enum switch: ").append(getSeverityString(IncompleteEnumSwitch)); //$NON-NLS-1$
+ buf.append("\n\t- raise null related warnings for variables tainted in assert statements: ").append(this.includeNullInfoFromAsserts ? ENABLED : DISABLED); //$NON-NLS-1$
buf.append("\n\t- suppress warnings: ").append(this.suppressWarnings ? ENABLED : DISABLED); //$NON-NLS-1$
buf.append("\n\t- suppress optional errors: ").append(this.suppressOptionalErrors ? ENABLED : DISABLED); //$NON-NLS-1$
buf.append("\n\t- unhandled warning token: ").append(getSeverityString(UnhandledWarningToken)); //$NON-NLS-1$
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java
index 648e84d..9f237be 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java
@@ -1099,9 +1099,9 @@
/**
* Primary field used in representing node properties efficiently.
* If <code>null</code>, this node has no properties.
- * If a <code>String</code>, this is the name of this node's sole property,
+ * If a {@link String}, this is the name of this node's sole property,
* and <code>property2</code> contains its value.
- * If a <code>HashMap</code>, this is the table of property name-value
+ * If a {@link Map}, this is the table of property name-value
* mappings; <code>property2</code>, if non-null is its unmodifiable
* equivalent.
* Initially <code>null</code>.
@@ -2212,7 +2212,7 @@
}
/**
- * Returns the named property of this node, or <code>null</code> if none.
+ * Returns the value of the named property of this node, or <code>null</code> if none.
*
* @param propertyName the property name
* @return the property value, or <code>null</code> if none
@@ -2257,6 +2257,7 @@
* @param propertyName the property name
* @param data the new property value, or <code>null</code> if none
* @see #getProperty(String)
+ * @throws IllegalArgumentException if the given property name is <code>null</code>
*/
public final void setProperty(String propertyName, Object data) {
if (propertyName == null) {
@@ -2280,11 +2281,12 @@
// node has only a single property
if (propertyName.equals(this.property1)) {
// we're in luck
- this.property2 = data;
if (data == null) {
// just deleted last property
this.property1 = null;
this.property2 = null;
+ } else {
+ this.property2 = data;
}
return;
}
@@ -2294,7 +2296,7 @@
}
// node already has one property - getting its second
// convert to more flexible representation
- HashMap m = new HashMap(2);
+ Map m = new HashMap(3);
m.put(this.property1, this.property2);
m.put(propertyName, data);
this.property1 = m;
@@ -2303,7 +2305,7 @@
}
// node has two or more properties
- HashMap m = (HashMap) this.property1;
+ Map m = (Map) this.property1;
if (data == null) {
m.remove(propertyName);
// check for just one property left
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ASTRewrite.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ASTRewrite.java
index 3729dc0..aeabf90 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ASTRewrite.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ASTRewrite.java
@@ -11,6 +11,7 @@
*******************************************************************************/
package org.eclipse.jdt.core.dom.rewrite;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -92,7 +93,6 @@
* @noextend This class is not intended to be subclassed by clients.
*/
public class ASTRewrite {
-
/** root node for the rewrite: Only nodes under this root are accepted */
private final AST ast;
@@ -105,6 +105,26 @@
* @since 3.1
*/
private TargetSourceRangeComputer targetSourceRangeComputer = null;
+
+ /**
+ * Primary field used in representing rewrite properties efficiently.
+ * If <code>null</code>, this rewrite has no properties.
+ * If a {@link String}, this is the name of this rewrite's sole property,
+ * and <code>property2</code> contains its value.
+ * If a {@link Map}, this is the table of property name-value
+ * mappings.
+ * Initially <code>null</code>.
+ *
+ * @see #property2
+ */
+ private Object property1 = null;
+
+ /**
+ * Auxiliary field used in representing rewrite properties efficiently.
+ *
+ * @see #property1
+ */
+ private Object property2 = null;
/**
* Creates a new instance for describing manipulations of
@@ -502,6 +522,36 @@
}
/**
+ * Returns the value of the named property of this rewrite, or <code>null</code> if none.
+ *
+ * @param propertyName the property name
+ * @return the property value, or <code>null</code> if none
+ * @see #setProperty(String,Object)
+ * @throws IllegalArgumentException if the given property name is <code>null</code>
+ * @since 3.7
+ */
+ public final Object getProperty(String propertyName) {
+ if (propertyName == null) {
+ throw new IllegalArgumentException();
+ }
+ if (this.property1 == null) {
+ // rewrite has no properties at all
+ return null;
+ }
+ if (this.property1 instanceof String) {
+ // rewrite has only a single property
+ if (propertyName.equals(this.property1)) {
+ return this.property2;
+ } else {
+ return null;
+ }
+ }
+ // otherwise rewrite has table of properties
+ Map m = (Map) this.property1;
+ return m.get(propertyName);
+ }
+
+ /**
* Returns an object that tracks the source range of the given node
* across the rewrite to its AST. Upon return, the result object reflects
* the given node's current source range in the AST. After
@@ -681,6 +731,87 @@
}
/**
+ * Sets the named property of this rewrite to the given value,
+ * or to <code>null</code> to clear it.
+ * <p>
+ * Clients should employ property names that are sufficiently unique
+ * to avoid inadvertent conflicts with other clients that might also be
+ * setting properties on the same rewrite.
+ * </p>
+ * <p>
+ * Note that modifying a property is not considered a modification to the
+ * AST itself. This is to allow clients to decorate existing rewrites with
+ * their own properties without jeopardizing certain things (like the
+ * validity of bindings), which rely on the underlying tree remaining static.
+ * </p>
+ *
+ * @param propertyName the property name
+ * @param data the new property value, or <code>null</code> if none
+ * @see #getProperty(String)
+ * @throws IllegalArgumentException if the given property name is <code>null</code>
+ * @since 3.7
+ */
+ public final void setProperty(String propertyName, Object data) {
+ if (propertyName == null) {
+ throw new IllegalArgumentException();
+ }
+ if (this.property1 == null) {
+ // rewrite has no properties at all
+ if (data == null) {
+ // rewrite already knows this
+ return;
+ }
+ // rewrite gets its fist property
+ this.property1 = propertyName;
+ this.property2 = data;
+ return;
+ }
+ if (this.property1 instanceof String) {
+ // rewrite has only a single property
+ if (propertyName.equals(this.property1)) {
+ // we're in luck
+ if (data == null) {
+ // just delete last property
+ this.property1 = null;
+ this.property2 = null;
+ } else {
+ this.property2 = data;
+ }
+ return;
+ }
+ if (data == null) {
+ // we already know this
+ return;
+ }
+ // rewrite already has one property - getting its second
+ // convert to more flexible representation
+ Map m = new HashMap(3);
+ m.put(this.property1, this.property2);
+ m.put(propertyName, data);
+ this.property1 = m;
+ this.property2 = null;
+ return;
+ }
+ // rewrite has two or more properties
+ Map m = (Map) this.property1;
+ if (data == null) {
+ m.remove(propertyName);
+ // check for just one property left
+ if (m.size() == 1) {
+ // convert to more efficient representation
+ Map.Entry[] entries = (Map.Entry[]) m.entrySet().toArray(new Map.Entry[1]);
+ this.property1 = entries[0].getKey();
+ this.property2 = entries[0].getValue();
+ }
+ return;
+ } else {
+ m.put(propertyName, data);
+ // still has two or more properties
+ return;
+ }
+ }
+
+ /**
* Sets a custom target source range computer for this AST rewriter. This is advanced feature to modify how
* comments are associated with nodes, which should be done only in special cases.
*
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 0ded9c2..87edc04 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
@@ -1219,6 +1219,21 @@
*/
public static final String COMPILER_PB_MISSING_JAVADOC_TAGS_OVERRIDING = PLUGIN_ID + ".compiler.problem.missingJavadocTagsOverriding"; //$NON-NLS-1$
/**
+ * Compiler option ID: Reporting Missing Javadoc Tags for Method Type Parameters.
+ * <p>Specify whether a missing <code>@param</code> for a type parameter in a method declaration should be reported.
+ * When enabled, the compiler will issue a missing Javadoc tag error or warning for a type parameter without a
+ * corresponding <code>@param</code> tag.</p>
+ * <p>This option only has an effect if the compiler compliance is 1.5 or greater.</p>
+ * <dl>
+ * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters"</code></dd>
+ * <dt>Possible values:</dt><dd><code>{ "enabled", "disabled" }</code></dd>
+ * <dt>Default:</dt><dd><code>"disabled"</code></dd>
+ * </dl>
+ * @since 3.7
+ * @category CompilerOptionID
+ */
+ public static final String COMPILER_PB_MISSING_JAVADOC_TAGS_METHOD_TYPE_PARAMETERS = PLUGIN_ID + ".compiler.problem.missingJavadocTagsMethodTypeParameters"; //$NON-NLS-1$
+ /**
* Compiler option ID: Reporting Missing Javadoc Comments.
* <p>This is the generic control for the severity of missing Javadoc comment problems.
* When enabled, the compiler will issue an error or a warning when Javadoc comments are missing.
@@ -1445,6 +1460,21 @@
*/
public static final String COMPILER_PB_SUPPRESS_WARNINGS = PLUGIN_ID + ".compiler.problem.suppressWarnings"; //$NON-NLS-1$
/**
+ * Compiler option ID: Raise null related errors or warnings arising because of assert statements.
+ * <p>When enabled, the compiler will flag all null related errors or warnings that have been enabled by the user,
+ * irrespective of whether a variable occurred in an assert statement.</p>
+ * <p>When disabled, the compiler will not flag null related errors or warnings on variables that got marked as maybe or definitely
+ * <code>null</code> in an assert statement upstream.</p>
+ * <dl>
+ * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts"</code></dd>
+ * <dt>Possible values:</dt><dd><code>{ "enabled", "disabled" }</code></dd>
+ * <dt>Default:</dt><dd><code>"disabled"</code></dd>
+ * </dl>
+ * @since 3.7
+ * @category CompilerOptionID
+ */
+ public static final String COMPILER_PB_INCLUDE_ASSERTS_IN_NULL_ANALYSIS = PLUGIN_ID + ".compiler.problem.includeNullInfoFromAsserts"; //$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
@@ -1491,7 +1521,9 @@
* Compiler option ID: Reporting Null Dereference.
* <p>When enabled, the compiler will issue an error or a warning whenever a
* variable that is statically known to hold a null value is used to
- * access a field or method.
+ * access a field or method.</p>
+ * <p>Assert statements are ignored unless {@link #COMPILER_PB_INCLUDE_ASSERTS_IN_NULL_ANALYSIS}
+ * is enabled.</p>
* <dl>
* <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.nullReference"</code></dd>
* <dt>Possible values:</dt><dd><code>{ "error", "warning", "ignore" }</code></dd>
@@ -1506,7 +1538,9 @@
* <p>When enabled, the compiler will issue an error or a warning whenever a
* variable that has formerly been tested against null but is not (no more)
* statically known to hold a non-null value is used to access a field or
- * method.
+ * method.</p>
+ * <p>Assert statements are ignored unless {@link #COMPILER_PB_INCLUDE_ASSERTS_IN_NULL_ANALYSIS}
+ * is enabled.</p>
* <dl>
* <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.potentialNullReference"</code></dd>
* <dt>Possible values:</dt><dd><code>{ "error", "warning", "ignore" }</code></dd>
@@ -1520,7 +1554,9 @@
* Compiler option ID: Reporting Redundant Null Check.
* <p>When enabled, the compiler will issue an error or a warning whenever a
* variable that is statically known to hold a null or a non-null value
- * is tested against null.
+ * is tested against null.</p>
+ * <p>Assert statements are ignored unless {@link #COMPILER_PB_INCLUDE_ASSERTS_IN_NULL_ANALYSIS}
+ * is enabled.</p>
* <dl>
* <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.redundantNullCheck"</code></dd>
* <dt>Possible values:</dt><dd><code>{ "error", "warning", "ignore" }</code></dd>
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/TypeConverter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/TypeConverter.java
index 05b0cd0..b787737 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/TypeConverter.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/TypeConverter.java
@@ -503,7 +503,7 @@
result.sourceEnd = end;
return result;
case '[' :
- if (dim == 0) nameFragmentEnd = this.namePos-1;
+ if (dim == 0 && nameFragmentEnd < 0) nameFragmentEnd = this.namePos-1;
dim++;
break;
case ']' :
@@ -516,19 +516,28 @@
identCount ++;
break;
case '<' :
- // convert 1.5 specific constructs only if compliance is 1.5 or above
- if (!this.has1_5Compliance)
- break typeLoop;
- if (fragments == null) fragments = new ArrayList(2);
+ /* We need to convert and preserve 1.5 specific constructs only if compliance is 1.5 or above,
+ but in all cases, we must skip over them to see if there are any applicable type fragments
+ after the type parameters: i.e we just aren't done having seen a '<' in 1.4 mode. Because of
+ the way type signatures are encoded, TypeConverter.decodeType(String, int, int, int) is immune
+ to this problem. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=325633
+ */
+ if (this.has1_5Compliance) {
+ if (fragments == null) fragments = new ArrayList(2);
+ }
nameFragmentEnd = this.namePos-1;
- char[][] identifiers = CharOperation.splitOn('.', typeName, nameFragmentStart, this.namePos);
- fragments.add(identifiers);
+ if (this.has1_5Compliance) {
+ char[][] identifiers = CharOperation.splitOn('.', typeName, nameFragmentStart, this.namePos);
+ fragments.add(identifiers);
+ }
this.namePos++; // skip '<'
TypeReference[] arguments = decodeTypeArguments(typeName, length, start, end); // positionned on '>' at end
- fragments.add(arguments);
- identCount = 0;
- nameFragmentStart = -1;
- nameFragmentEnd = -1;
+ if (this.has1_5Compliance) {
+ fragments.add(arguments);
+ identCount = 0;
+ nameFragmentStart = -1;
+ nameFragmentEnd = -1;
+ }
// next increment will skip '>'
break;
//{ObjectTeams: detecting the @anchor
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 59bcc27..577edfc 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
@@ -1214,10 +1214,12 @@
IClasspathEntry[] classpath = getRawClasspath();
for (int i = 0, length = classpath.length; i < length; i++) {
if (classpath[i].equals(entry)) { // entry may need to be resolved
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=324367
+ // consider referred projects as per API- IJavaProject#findPackageFragmentRoots
return
computePackageFragmentRoots(
resolveClasspath(new IClasspathEntry[] {entry}),
- false, // don't retrieve exported roots
+ true,
null); /*no reverse map*/
}
}
diff --git a/org.eclipse.jdt.core/scripts/export-ecj.xml b/org.eclipse.jdt.core/scripts/export-ecj.xml
index 8b27117..a54f7c1 100644
--- a/org.eclipse.jdt.core/scripts/export-ecj.xml
+++ b/org.eclipse.jdt.core/scripts/export-ecj.xml
Binary files differ