update to 3.8M2 using v_C10.
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 058af29..ec64bbe 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.C07, 3.8.0 M2
+compiler.version = 0.C10, 3.8.0 M2
compiler.copyright = Copyright IBM Corp 2000, 2011. All rights reserved.
###{ObjectTeams:
diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html
index 49a8e63..f1baf89 100644
--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html
+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html
@@ -42,11 +42,64 @@
</td>
</tr>
</table>
+<a name="v_C10"></a>
+<hr><h1>
+Eclipse Platform Build Notes<br>
+Java development tools core</h1>
+Eclipse SDK 3.8.0 - September 13, 2011 - 3.8.0 M2
+<br>Project org.eclipse.jdt.core v_C10
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_C10">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=357259">357259</a>
+[dom] AST#newArrayType(Type, int) should allow array type as argument
+
+<a name="v_C09"></a>
+<hr><h1>
+Eclipse Platform Build Notes<br>
+Java development tools core</h1>
+Eclipse SDK 3.8.0 - September 9, 2011
+<br>Project org.eclipse.jdt.core v_C09
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_C09">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=354332">354332</a>
+DeltaProcessor exhibits O(N∧2) behavior
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=355605">355605</a>
+NPE in HierarchyResolver
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=347396">347396</a>
+ASTParser returns empty or partial AST if we parse the the body contains empty for loop
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=356746">356746</a>
+ECJ accepts illegal unicode escape sequences
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=337935">337935</a>
+Test failures when run as an IDE (org.eclipse.sdk.ide)
+
+<a name="v_C08"></a>
+<hr><h1>
+Eclipse Platform Build Notes<br>
+Java development tools core</h1>
+Eclipse SDK 3.8.0 - September 6, 2011
+<br>Project org.eclipse.jdt.core v_C08
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_C08">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=356325">356325</a>
+[select] Open declaration on a constructor of a local class with type parameters doesn't work
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=24804">24804</a>
+Organize imports wipes comments between statements [code manipulation]
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=356363">356363</a>
+Many links to java.sun.com are broken
+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=346529">346529</a>
+Don't show "The method * from the type * is never used locally" warning for private methods annotated with standard annotations like @PostConstruct
+
<a name="v_C07"></a>
<hr><h1>
Eclipse Platform Build Notes<br>
Java development tools core</h1>
-Eclipse SDK 3.8.0 - August 30, 2011 - 3.8.0 M2
+Eclipse SDK 3.8.0 - August 30, 2011
<br>Project org.eclipse.jdt.core v_C07
(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_C07">cvs</a>).
<h2>What's new in this drop</h2>
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java
index bd74371..3e2cdd3 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java
@@ -556,13 +556,13 @@
}
}
- if ((c1 = ScannerHelper.getNumericValue(source[pos++])) > 15
+ if ((c1 = ScannerHelper.getHexadecimalValue(source[pos++])) > 15
|| c1 < 0
- || (c2 = ScannerHelper.getNumericValue(source[pos++])) > 15
+ || (c2 = ScannerHelper.getHexadecimalValue(source[pos++])) > 15
|| c2 < 0
- || (c3 = ScannerHelper.getNumericValue(source[pos++])) > 15
+ || (c3 = ScannerHelper.getHexadecimalValue(source[pos++])) > 15
|| c3 < 0
- || (c4 = ScannerHelper.getNumericValue(source[pos++])) > 15
+ || (c4 = ScannerHelper.getHexadecimalValue(source[pos++])) > 15
|| c4 < 0) {
return false;
} else {
@@ -1984,9 +1984,7 @@
/**
* Implements the "Algorithm for Inheriting Method Comments" as specified for
- * <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/javadoc.html#inheritingcomments">1.4.2</a>,
- * <a href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javadoc.html#inheritingcomments">1.5</a>, and
- * <a href="http://java.sun.com/javase/6/docs/technotes/tools/windows/javadoc.html#inheritingcomments">1.6</a>.
+ * <a href="http://download.oracle.com/javase/6/docs/technotes/tools/windows/javadoc.html#inheritingcomments">1.6</a>.
*
* <p>
* Unfortunately, the implementation is broken in Javadoc implementations since 1.5, see
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionScanner.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionScanner.java
index c4d1f9a..88a632d 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionScanner.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionScanner.java
@@ -589,13 +589,13 @@
while (this.source[this.currentPosition] == 'u') {
this.currentPosition++;
}
- if ((c1 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
+ if ((c1 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c1 < 0
- || (c2 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
+ || (c2 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c2 < 0
- || (c3 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
+ || (c3 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c3 < 0
- || (c4 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
+ || (c4 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c4 < 0) {
throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
} else {
@@ -622,13 +622,13 @@
while (this.source[this.currentPosition] == 'u') {
this.currentPosition++;
}
- if ((c1 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
+ if ((c1 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c1 < 0
- || (c2 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
+ || (c2 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c2 < 0
- || (c3 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
+ || (c3 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c3 < 0
- || (c4 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
+ || (c4 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c4 < 0) {
throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
} else {
@@ -660,13 +660,13 @@
}
//-------------unicode traitement ------------
int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
- if ((c1 = ScannerHelper.getNumericValue(this.source[index++])) > 15
+ if ((c1 = ScannerHelper.getHexadecimalValue(this.source[index++])) > 15
|| c1 < 0
- || (c2 = ScannerHelper.getNumericValue(this.source[index++])) > 15
+ || (c2 = ScannerHelper.getHexadecimalValue(this.source[index++])) > 15
|| c2 < 0
- || (c3 = ScannerHelper.getNumericValue(this.source[index++])) > 15
+ || (c3 = ScannerHelper.getHexadecimalValue(this.source[index++])) > 15
|| c3 < 0
- || (c4 = ScannerHelper.getNumericValue(this.source[index++])) > 15
+ || (c4 = ScannerHelper.getHexadecimalValue(this.source[index++])) > 15
|| c4 < 0) {
this.currentPosition = index;
throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java
index 4d9b543..669eccb 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java
@@ -179,6 +179,12 @@
tagBits |= TagBits.AnnotationInstantiation;
break;
// SH}
+ case TypeIds.T_JavaxAnnotationPostConstruct :
+ tagBits |= TagBits.AnnotationPostConstruct;
+ break;
+ case TypeIds.T_JavaxAnnotationPreDestroy :
+ tagBits |= TagBits.AnnotationPreDestroy;
+ break;
}
return tagBits;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java
index fe316fa..5b171fc 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java
@@ -135,8 +135,8 @@
* Switch on String code generation
* This assumes that hashCode() specification for java.lang.String is API
* and is stable.
- * @see "http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html"
- * @see "http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/lang/String.html"
+ *
+ * @see "http://download.oracle.com/javase/6/docs/api/java/lang/String.html"
*
* @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
* @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java
index d81ec1c..3357d7d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java
@@ -303,6 +303,10 @@
currentOffset += 2;
return readTargetValue(currentOffset);
}
+ if (CharOperation.equals(typeName, ConstantPool.JAVAX_ANNOTATION_PREDESTROY)) {
+ this.standardAnnotationTagBits |= TagBits.AnnotationPreDestroy;
+ return currentOffset;
+ }
break;
case 32:
if (CharOperation.equals(typeName, ConstantPool.JAVA_LANG_ANNOTATION_RETENTION)) {
@@ -313,6 +317,10 @@
this.standardAnnotationTagBits |= TagBits.AnnotationInherited;
return currentOffset;
}
+ if (CharOperation.equals(typeName, ConstantPool.JAVAX_ANNOTATION_POSTCONSTRUCT)) {
+ this.standardAnnotationTagBits |= TagBits.AnnotationPostConstruct;
+ return currentOffset;
+ }
break;
case 33:
if (CharOperation.equals(typeName, ConstantPool.JAVA_LANG_ANNOTATION_DOCUMENTED)) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java
index aca35f6..c875c9b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java
@@ -248,6 +248,8 @@
public static final char[] JAVA_LANG_SAFEVARARGS = "Ljava/lang/SafeVarargs;".toCharArray(); //$NON-NLS-1$
// java 7 java.lang.invoke.MethodHandle.invokeExact(..)/invokeGeneric(..)
public static final char[] JAVA_LANG_INVOKE_METHODHANDLE_POLYMORPHICSIGNATURE = "Ljava/lang/invoke/MethodHandle$PolymorphicSignature;".toCharArray(); //$NON-NLS-1$
+ public static final char[] JAVAX_ANNOTATION_POSTCONSTRUCT = "Ljavax/annotation/PostConstruct;".toCharArray(); //$NON-NLS-1$
+ public static final char[] JAVAX_ANNOTATION_PREDESTROY = "Ljavax/annotation/PreDestroy;".toCharArray(); //$NON-NLS-1$
public static final char[] HashCode = "hashCode".toCharArray(); //$NON-NLS-1$
public static final char[] HashCodeSignature = "()I".toCharArray(); //$NON-NLS-1$;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotationBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotationBinding.java
index 6fe4141..c88c4a1 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotationBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotationBinding.java
@@ -32,6 +32,9 @@
public static AnnotationBinding[] addStandardAnnotations(AnnotationBinding[] recordedAnnotations, long annotationTagBits, LookupEnvironment env) {
// NOTE: expect annotations to be requested just once so there is no need to store the standard annotations
// and all of the standard annotations created by this method are fully resolved since the sender is expected to use them immediately
+ if ((annotationTagBits & TagBits.AllStandardAnnotationsMask) == 0) {
+ return recordedAnnotations;
+ }
int count = 0;
if ((annotationTagBits & TagBits.AnnotationTargetMASK) != 0)
count++;
@@ -51,8 +54,11 @@
count++;
if ((annotationTagBits & TagBits.AnnotationSafeVarargs) != 0)
count++;
- if (count == 0)
- return recordedAnnotations;
+ if ((annotationTagBits & TagBits.AnnotationPostConstruct) != 0)
+ count++;
+ if ((annotationTagBits & TagBits.AnnotationPreDestroy) != 0)
+ count++;
+ // count must be different from 0
int index = recordedAnnotations.length;
AnnotationBinding[] result = new AnnotationBinding[index + count];
@@ -75,6 +81,10 @@
result[index++] = buildMarkerAnnotationForMemberType(TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE, env);
if ((annotationTagBits & TagBits.AnnotationSafeVarargs) != 0)
result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_SAFEVARARGS, env);
+ if ((annotationTagBits & TagBits.AnnotationPostConstruct) != 0)
+ result[index++] = buildMarkerAnnotation(TypeConstants.JAVAX_ANNOTATION_POSTCONSTRUCT, env);
+ if ((annotationTagBits & TagBits.AnnotationPreDestroy) != 0)
+ result[index++] = buildMarkerAnnotation(TypeConstants.JAVAX_ANNOTATION_PREDESTROY, env);
return result;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
index 053735d..c2d4e4f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
@@ -296,7 +296,7 @@
// attempt to find the enclosing type if it exists in the cache (otherwise - resolve it when requested)
this.enclosingType = environment.getTypeFromConstantPoolName(enclosingTypeName, 0, -1, true, null /* could not be missing */); // pretend parameterized to avoid raw
this.tagBits |= TagBits.MemberTypeMask; // must be a member type not a top-level or local type
- this.tagBits |= TagBits.HasUnresolvedEnclosingType;
+ this.tagBits |= TagBits.HasUnresolvedEnclosingType;
if (enclosingType().isStrictfp())
this.modifiers |= ClassFileConstants.AccStrictfp;
if (enclosingType().isDeprecated())
@@ -443,10 +443,11 @@
int size = memberTypeStructures.length;
if (size > 0) {
this.memberTypes = new ReferenceBinding[size];
- for (int i = 0; i < size; i++)
+ for (int i = 0; i < size; i++) {
// attempt to find each member type if it exists in the cache (otherwise - resolve it when requested)
this.memberTypes[i] = this.environment.getTypeFromConstantPoolName(memberTypeStructures[i].getName(), 0, -1, false, null /* could not be missing */);
- this.tagBits |= TagBits.HasUnresolvedMemberTypes;
+ }
+ this.tagBits |= TagBits.HasUnresolvedMemberTypes;
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
index 1698cc3..a427a23 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
@@ -543,14 +543,28 @@
return;
}
// SH}
- if (!CharOperation.equals(TypeConstants.JAVA, this.compoundName[0]))
+ if (!CharOperation.equals(TypeConstants.JAVA, this.compoundName[0])
+ && !CharOperation.equals(TypeConstants.JAVAX, this.compoundName[0]))
return;
-
+
char[] packageName = this.compoundName[1];
if (packageName.length == 0) return; // just to be safe
char[] typeName = this.compoundName[2];
if (typeName.length == 0) return; // just to be safe
// remaining types MUST be in java.*.*
+ if (CharOperation.equals(TypeConstants.JAVAX, this.compoundName[0])) {
+ if (CharOperation.equals(TypeConstants.ANNOTATION, this.compoundName[1])) {
+ switch (typeName[0]) {
+ case 'P' :
+ if (CharOperation.equals(typeName, TypeConstants.JAVAX_ANNOTATION_POSTCONSTRUCT[2]))
+ this.id = TypeIds.T_JavaxAnnotationPostConstruct;
+ if (CharOperation.equals(typeName, TypeConstants.JAVAX_ANNOTATION_PREDESTROY[2]))
+ this.id = TypeIds.T_JavaxAnnotationPreDestroy;
+ return;
+ }
+ }
+ return;
+ }
if (!CharOperation.equals(TypeConstants.LANG, this.compoundName[1])) {
switch (packageName[0]) {
case 'i' :
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java
index ad67306..2654ff6 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java
@@ -133,12 +133,17 @@
long AnnotationSafeVarargs = ASTNode.Bit52L;
/** @since 3.7 - java 7 MethodHandle.invokeExact(..)/invokeGeneric(..)*/
long AnnotationPolymorphicSignature = ASTNode.Bit53L;
+ /** @since 3.8 */
+ long AnnotationPreDestroy = ASTNode.Bit54L;
+ /** @since 3.8 */
+ long AnnotationPostConstruct = ASTNode.Bit55L;
//{ObjectTeams: one more standard annotation:
long AnnotationInstantiation = ASTNode.Bit21;
// SH}
- long AllStandardAnnotationsMask = AnnotationTargetMASK
+ long AllStandardAnnotationsMask =
+ AnnotationTargetMASK
| AnnotationRetentionMASK
| AnnotationDeprecated
| AnnotationDocumented
@@ -149,17 +154,18 @@
| AnnotationInstantiation
// SH}
| AnnotationSafeVarargs
- | AnnotationPolymorphicSignature;
+ | AnnotationPolymorphicSignature
+ | AnnotationPostConstruct
+ | AnnotationPreDestroy;
- long DefaultValueResolved = ASTNode.Bit54L;
+ long DefaultValueResolved = ASTNode.Bit56L;
// set when type contains non-private constructor(s)
- long HasNonPrivateConstructor = ASTNode.Bit55L;
+ long HasNonPrivateConstructor = ASTNode.Bit57L;
//{ObjectTeams:
// is parameterized type instantiated via tsuper-link?
- long IsViewedAsTSuper = ASTNode.Bit57L; // for role type bindings
- long IsCopyOfParameterized = ASTNode.Bit57L; // for method bindings
+ long IsViewedAsTSuper = ASTNode.Bit56L; // for role type bindings
// is it a wrapped role type?
long IsWrappedRole = ASTNode.Bit58L; // for role type bindings
@@ -170,6 +176,7 @@
// is it a dependent type?
long IsDependentType = ASTNode.Bit59L; // for type bindings
+ long IsCopyOfParameterized = ASTNode.Bit59L; // for method bindings
// had the baseclass field/playedBy problems?
long BaseclassHasProblems = ASTNode.Bit60L; // for type bindings (role)
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
index e75db5c..9a62cc0 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
@@ -14,6 +14,7 @@
public interface TypeConstants {
char[] JAVA = "java".toCharArray(); //$NON-NLS-1$
+ char[] JAVAX = "javax".toCharArray(); //$NON-NLS-1$
char[] LANG = "lang".toCharArray(); //$NON-NLS-1$
char[] IO = "io".toCharArray(); //$NON-NLS-1$
char[] UTIL = "util".toCharArray(); //$NON-NLS-1$
@@ -129,7 +130,7 @@
char[][] JAVA_IO_OBJECTINPUTSTREAM = new char[][] { JAVA, IO, "ObjectInputStream".toCharArray()}; //$NON-NLS-1$
// javax.rmi.CORBA.Stub
char[][] JAVAX_RMI_CORBA_STUB = new char[][] {
- "javax".toCharArray(), //$NON-NLS-1$
+ JAVAX,
"rmi".toCharArray(), //$NON-NLS-1$
"CORBA".toCharArray(), //$NON-NLS-1$
"Stub".toCharArray(), //$NON-NLS-1$
@@ -173,6 +174,18 @@
char[] SYNTHETIC_ACCESS_METHOD_PREFIX = "access$".toCharArray(); //$NON-NLS-1$
char[] SYNTHETIC_ENUM_CONSTANT_INITIALIZATION_METHOD_PREFIX = " enum constant initialization$".toCharArray(); //$NON-NLS-1$
char[] SYNTHETIC_STATIC_FACTORY = "<factory>".toCharArray(); //$NON-NLS-1$
+ char[][] JAVAX_ANNOTATION_POSTCONSTRUCT =
+ new char[][] {
+ JAVAX,
+ ANNOTATION,
+ "PostConstruct".toCharArray() //$NON-NLS-1$
+ };
+ char[][] JAVAX_ANNOTATION_PREDESTROY =
+ new char[][] {
+ JAVAX,
+ ANNOTATION,
+ "PreDestroy".toCharArray() //$NON-NLS-1$
+ };
// synthetic package-info name
public static final char[] PACKAGE_INFO_NAME = "package-info".toCharArray(); //$NON-NLS-1$
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java
index 6bb684a..8e3a647 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java
@@ -97,6 +97,11 @@
// java 7 java.lang.AutoCloseable
final int T_JavaLangAutoCloseable = 62;
+ // new in 3.8
+ final int T_JavaxAnnotationPostConstruct = 63;
+
+ final int T_JavaxAnnotationPreDestroy = 64;
+
final int NoId = Integer.MAX_VALUE;
public static final int IMPLICIT_CONVERSION_MASK = 0xFF;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java
index b64591e..8eae081 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java
@@ -1358,9 +1358,10 @@
idx++;
while (this.source[idx] == 'u')
idx++;
- if (!(((c1 = ScannerHelper.getNumericValue(this.source[idx++])) > 15 || c1 < 0)
- || ((c2 = ScannerHelper.getNumericValue(this.source[idx++])) > 15 || c2 < 0)
- || ((c3 = ScannerHelper.getNumericValue(this.source[idx++])) > 15 || c3 < 0) || ((c4 = ScannerHelper.getNumericValue(this.source[idx++])) > 15 || c4 < 0))) {
+ if (!(((c1 = ScannerHelper.getHexadecimalValue(this.source[idx++])) > 15 || c1 < 0)
+ || ((c2 = ScannerHelper.getHexadecimalValue(this.source[idx++])) > 15 || c2 < 0)
+ || ((c3 = ScannerHelper.getHexadecimalValue(this.source[idx++])) > 15 || c3 < 0)
+ || ((c4 = ScannerHelper.getHexadecimalValue(this.source[idx++])) > 15 || c4 < 0))) {
c = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
}
}
@@ -1477,9 +1478,10 @@
this.index++;
while (this.source[this.index] == 'u')
this.index++;
- if (!(((c1 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c1 < 0)
- || ((c2 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c2 < 0)
- || ((c3 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c3 < 0) || ((c4 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c4 < 0))) {
+ if (!(((c1 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c1 < 0)
+ || ((c2 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c2 < 0)
+ || ((c3 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c3 < 0)
+ || ((c4 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c4 < 0))) {
c = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
} else {
// TODO (frederic) currently reset to previous position, perhaps signal a syntax error would be more appropriate
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java
index 7fd1f08..639cd9a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java
@@ -386,9 +386,10 @@
this.index++;
while (this.source[this.index] == 'u')
this.index++;
- if (!(((c1 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c1 < 0)
- || ((c2 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c2 < 0)
- || ((c3 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c3 < 0) || ((c4 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c4 < 0))) {
+ if (!(((c1 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c1 < 0)
+ || ((c2 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c2 < 0)
+ || ((c3 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c3 < 0)
+ || ((c4 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c4 < 0))) {
first = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
} else {
this.index = pos;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
index 271692d..62e2908 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
@@ -3879,13 +3879,13 @@
pos--;
}
if (source[pos] == '\\' &&
- !((c1 = ScannerHelper.getNumericValue(source[this.endStatementPosition - 3])) > 15
+ !((c1 = ScannerHelper.getHexadecimalValue(source[this.endStatementPosition - 3])) > 15
|| c1 < 0
- || (c2 = ScannerHelper.getNumericValue(source[this.endStatementPosition - 2])) > 15
+ || (c2 = ScannerHelper.getHexadecimalValue(source[this.endStatementPosition - 2])) > 15
|| c2 < 0
- || (c3 = ScannerHelper.getNumericValue(source[this.endStatementPosition - 1])) > 15
+ || (c3 = ScannerHelper.getHexadecimalValue(source[this.endStatementPosition - 1])) > 15
|| c3 < 0
- || (c4 = ScannerHelper.getNumericValue(source[this.endStatementPosition])) > 15
+ || (c4 = ScannerHelper.getHexadecimalValue(source[this.endStatementPosition])) > 15
|| c4 < 0) &&
((char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4)) == ';'){
// we have a Unicode for the ';' (/u003B)
@@ -11250,11 +11250,11 @@
int c1, c2, c3, c4;
index[0]++;
while (comment[index[0]] == 'u') index[0]++;
- if (!(((c1 = ScannerHelper.getNumericValue(comment[index[0]++])) > 15
+ if (!(((c1 = ScannerHelper.getHexadecimalValue(comment[index[0]++])) > 15
|| c1 < 0)
- || ((c2 = ScannerHelper.getNumericValue(comment[index[0]++])) > 15 || c2 < 0)
- || ((c3 = ScannerHelper.getNumericValue(comment[index[0]++])) > 15 || c3 < 0)
- || ((c4 = ScannerHelper.getNumericValue(comment[index[0]++])) > 15 || c4 < 0))) {
+ || ((c2 = ScannerHelper.getHexadecimalValue(comment[index[0]++])) > 15 || c2 < 0)
+ || ((c3 = ScannerHelper.getHexadecimalValue(comment[index[0]++])) > 15 || c3 < 0)
+ || ((c4 = ScannerHelper.getHexadecimalValue(comment[index[0]++])) > 15 || c4 < 0))) {
nextCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
}
break;
@@ -12238,6 +12238,8 @@
boolean oldMethodRecoveryActivated = this.methodRecoveryActivated;
if(this.options.performMethodsFullRecovery) {
this.methodRecoveryActivated = true;
+ // we should not relocate bodyStart if there is a block within the statements
+ this.ignoreNextOpeningBrace = true;
}
initialize();
@@ -12535,6 +12537,8 @@
boolean oldMethodRecoveryActivated = this.methodRecoveryActivated;
if(this.options.performMethodsFullRecovery) {
+ // we should not relocate bodyStart if there is a block within the statements
+ this.ignoreNextOpeningBrace = true;
this.methodRecoveryActivated = true;
this.rParenPos = md.sourceEnd;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
index 610ee71..4085f4d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
@@ -1979,13 +1979,13 @@
this.currentPosition += (this.eofPosition - this.currentPosition);
throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
}
- if ((c1 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
+ if ((c1 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c1 < 0
- || (c2 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
+ || (c2 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c2 < 0
- || (c3 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
+ || (c3 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c3 < 0
- || (c4 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
+ || (c4 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c4 < 0){
throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
}
@@ -3269,18 +3269,18 @@
// OctalDigit OctalDigit
// ZeroToThree OctalDigit OctalDigit
- int number = ScannerHelper.getNumericValue(this.currentCharacter);
+ int number = ScannerHelper.getHexadecimalValue(this.currentCharacter);
if (number >= 0 && number <= 7) {
boolean zeroToThreeNot = number > 3;
if (ScannerHelper.isDigit(this.currentCharacter = this.source[this.currentPosition++])) {
- int digit = ScannerHelper.getNumericValue(this.currentCharacter);
+ int digit = ScannerHelper.getHexadecimalValue(this.currentCharacter);
if (digit >= 0 && digit <= 7) {
number = (number * 8) + digit;
if (ScannerHelper.isDigit(this.currentCharacter = this.source[this.currentPosition++])) {
if (zeroToThreeNot) {// has read \NotZeroToThree OctalDigit Digit --> ignore last character
this.currentPosition--;
} else {
- digit = ScannerHelper.getNumericValue(this.currentCharacter);
+ digit = ScannerHelper.getHexadecimalValue(this.currentCharacter);
if (digit >= 0 && digit <= 7){ // has read \ZeroToThree OctalDigit OctalDigit
number = (number * 8) + digit;
} else {// has read \ZeroToThree OctalDigit NonOctalDigit --> ignore last character
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java
index 69c1107..4ee486e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java
@@ -475,6 +475,50 @@
}
return Character.getNumericValue(c);
}
+public static int getHexadecimalValue(char c) {
+ switch(c) {
+ case '0' :
+ return 0;
+ case '1' :
+ return 1;
+ case '2' :
+ return 2;
+ case '3' :
+ return 3;
+ case '4' :
+ return 4;
+ case '5' :
+ return 5;
+ case '6' :
+ return 6;
+ case '7' :
+ return 7;
+ case '8' :
+ return 8;
+ case '9' :
+ return 9;
+ case 'A' :
+ case 'a' :
+ return 10;
+ case 'B' :
+ case 'b' :
+ return 11;
+ case 'C' :
+ case 'c' :
+ return 12;
+ case 'D' :
+ case 'd' :
+ return 13;
+ case 'E' :
+ case 'e' :
+ return 14;
+ case 'F' :
+ case 'f' :
+ return 15;
+ default:
+ return -1;
+ }
+}
public static char toUpperCase(char c) {
if (c < MAX_OBVIOUS) {
if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & ScannerHelper.C_UPPER_LETTER) != 0) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
index 7c009af..206854e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
@@ -8341,6 +8341,10 @@
&& CharOperation.equals(method.selector, TypeConstants.WRITEREPLACE)) {
return;
}
+ if ((method.tagBits & (TagBits.AnnotationPostConstruct | TagBits.AnnotationPreDestroy)) != 0) {
+ // PostConstruct and PreDestroy method are ignored
+ return;
+ }
this.handle(
IProblem.UnusedPrivateMethod,
new String[] {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
index 50beb8f..25e66af 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
@@ -1099,7 +1099,6 @@
* <ul>
* <li>the node belongs to a different AST</li>
* <li>the node already has a parent</li>
- * <li>a cycle in would be created</li>
* </ul>
*/
public ArrayType newArrayType(Type componentType) {
@@ -1110,28 +1109,26 @@
/**
* Creates and returns a new unparented array type node with the given
- * element type and number of dimensions.
+ * element type and number of (additional) dimensions.
* <p>
* Note that if the element type passed in is an array type, the
* element type of the result will not be the same as what was passed in.
* </p>
*
- * @param elementType the element type (never an array type)
+ * @param elementType the element type (can be an array type)
* @param dimensions the number of dimensions, a positive number
* @return a new unparented array type node
* @exception IllegalArgumentException if:
* <ul>
* <li>the node belongs to a different AST</li>
* <li>the node already has a parent</li>
- * <li>a cycle in would be created</li>
* <li>the element type is null</li>
- * <li>the element type is an array type</li>
* <li>the number of dimensions is lower than 1</li>
* <li>the number of dimensions is greater than 1000</li>
* </ul>
*/
public ArrayType newArrayType(Type elementType, int dimensions) {
- if (elementType == null || elementType.isArrayType()) {
+ if (elementType == null) {
throw new IllegalArgumentException();
}
if (dimensions < 1 || dimensions > 1000) {
@@ -1481,7 +1478,6 @@
* <ul>
* <li>the node belongs to a different AST</li>
* <li>the node already has a parent</li>
- * <li>a cycle in would be created</li>
* </ul>
*/
public ExpressionStatement newExpressionStatement(Expression expression) {
@@ -1521,7 +1517,6 @@
* <ul>
* <li>the node belongs to a different AST</li>
* <li>the node already has a parent</li>
- * <li>a cycle in would be created</li>
* <li>the given fragment is null</li>
* </ul>
*/
@@ -2487,7 +2482,6 @@
* <ul>
* <li>the node belongs to a different AST</li>
* <li>the node already has a parent</li>
- * <li>a cycle in would be created</li>
* </ul>
* @since 3.0
*/
@@ -2518,7 +2512,6 @@
* <ul>
* <li>the node belongs to a different AST</li>
* <li>the node already has a parent</li>
- * <li>a cycle in would be created</li>
* </ul>
*/
public TypeDeclarationStatement
@@ -2571,9 +2564,7 @@
* <ul>
* <li>the node belongs to a different AST</li>
* <li>the node already has a parent</li>
- * <li>a cycle in would be created</li>
* <li>the given fragment is null</li>
- * <li>a cycle in would be created</li>
* </ul>
*/
public VariableDeclarationExpression
@@ -2618,7 +2609,6 @@
* <ul>
* <li>the node belongs to a different AST</li>
* <li>the node already has a parent</li>
- * <li>a cycle in would be created</li>
* <li>the variable declaration fragment is null</li>
* </ul>
*/
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ListRewrite.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ListRewrite.java
index e74b3b0..a7ef8aa 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ListRewrite.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ListRewrite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2009 IBM Corporation and others.
+ * Copyright (c) 2004, 2011 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
@@ -164,7 +164,7 @@
/**
* Inserts the given node into the list after the given element.
- * The existing node must be in the list, either as an original or as a new
+ * The existing node <code>previousElement</code> must be in the list, either as an original or as a new
* node that has been inserted.
* The inserted node must either be brand new (not part of the original AST)
* or a placeholder node (for example, one created by
@@ -175,20 +175,20 @@
* a note that this node has been inserted into the list.
*
* @param node the node to insert
- * @param element the element after which the given node is to be inserted
+ * @param previousElement the element after which the given node is to be inserted
* @param editGroup the edit group in which to collect the corresponding
* text edits, or <code>null</code> if ungrouped
* @throws IllegalArgumentException if the node or element is null,
* or if the node is not part of this rewriter's AST, or if the inserted node
- * is not a new node (or placeholder), or if <code>element</code> is not a member
+ * is not a new node (or placeholder), or if <code>previousElement</code> is not a member
* of the list (original or new), or if the described modification is
* otherwise invalid
*/
- public void insertAfter(ASTNode node, ASTNode element, TextEditGroup editGroup) {
- if (node == null || element == null) {
+ public void insertAfter(ASTNode node, ASTNode previousElement, TextEditGroup editGroup) {
+ if (node == null || previousElement == null) {
throw new IllegalArgumentException();
}
- int index= getEvent().getIndex(element, ListRewriteEvent.BOTH);
+ int index= getEvent().getIndex(previousElement, ListRewriteEvent.BOTH);
if (index == -1) {
throw new IllegalArgumentException("Node does not exist"); //$NON-NLS-1$
}
@@ -197,7 +197,7 @@
/**
* Inserts the given node into the list before the given element.
- * The existing node must be in the list, either as an original or as a new
+ * The existing node <code>nextElement</code> must be in the list, either as an original or as a new
* node that has been inserted.
* The inserted node must either be brand new (not part of the original AST)
* or a placeholder node (for example, one created by
@@ -208,20 +208,20 @@
* a note that this node has been inserted into the list.
*
* @param node the node to insert
- * @param element the element before which the given node is to be inserted
+ * @param nextElement the element before which the given node is to be inserted
* @param editGroup the edit group in which to collect the corresponding
* text edits, or <code>null</code> if ungrouped
- * @throws IllegalArgumentException if the node or element is null,
+ * @throws IllegalArgumentException if the node or next element is null,
* or if the node is not part of this rewriter's AST, or if the inserted node
- * is not a new node (or placeholder), or if <code>element</code> is not a member
+ * is not a new node (or placeholder), or if <code>nextElement</code> is not a member
* of the list (original or new), or if the described modification is
* otherwise invalid
*/
- public void insertBefore(ASTNode node, ASTNode element, TextEditGroup editGroup) {
- if (node == null || element == null) {
+ public void insertBefore(ASTNode node, ASTNode nextElement, TextEditGroup editGroup) {
+ if (node == null || nextElement == null) {
throw new IllegalArgumentException();
}
- int index= getEvent().getIndex(element, ListRewriteEvent.BOTH);
+ int index= getEvent().getIndex(nextElement, ListRewriteEvent.BOTH);
if (index == -1) {
throw new IllegalArgumentException("Node does not exist"); //$NON-NLS-1$
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ImportRewriteAnalyzer.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ImportRewriteAnalyzer.java
index 2c5d21e..cfa0657 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ImportRewriteAnalyzer.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ImportRewriteAnalyzer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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
@@ -12,6 +12,9 @@
package org.eclipse.jdt.internal.core.dom.rewrite;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -27,8 +30,10 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.Comment;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.ImportDeclaration;
+import org.eclipse.jdt.core.dom.LineComment;
import org.eclipse.jdt.core.dom.PackageDeclaration;
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
import org.eclipse.jdt.core.search.IJavaSearchConstants;
@@ -60,6 +65,8 @@
private boolean useContextToFilterImplicitImports;
private boolean findAmbiguousImports;
+ private IRegion[] preserveExistingCommentsRanges;
+
private int flags= 0;
private static final int F_NEEDS_LEADING_DELIM= 2;
@@ -91,6 +98,9 @@
this.replaceRange= evaluateReplaceRange(root);
if (restoreExistingImports) {
addExistingImports(root);
+ } else {
+ // collect all existing comments inside imports and concatenate them
+ this.preserveExistingCommentsRanges = retrieveExistingCommentsInImports(root);
}
PackageEntry[] order= new PackageEntry[importOrder.length];
@@ -117,7 +127,7 @@
}
return 1;
}
-
+
private boolean insertSpaceBeforeSemicolon() {
return JavaCore.INSERT.equals(this.compilationUnit.getJavaProject().getOption(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON, true));
}
@@ -228,8 +238,8 @@
return testedName;
}
}
- } while (index >= 0);
- return name;
+ } while (index >= 0);
+ return name;
}
private static String getFullName(ImportDeclaration decl) {
@@ -266,12 +276,30 @@
int nextLength= next.getLength();
int nextOffsetLine= root.getLineNumber(nextOffset);
+ int extendedStart = root.getExtendedStartPosition(next);
+ int extendedLength = root.getExtendedLength(next);
// if next import is on a different line, modify the end position to the next line begin offset
if (currEndLine < nextOffsetLine) {
currEndLine++;
nextOffset= root.getPosition(currEndLine, 0);
}
- currPackage.add(new ImportDeclEntry(packName.length(), name, isStatic, new Region(currOffset, nextOffset - currOffset)));
+ // retrieve preceding and trailing comments if any
+ IRegion rangeBefore = null;
+ IRegion rangeAfter = null;
+ if (nextOffset != extendedStart) {
+ rangeBefore = new Region(extendedStart, extendedStart - nextOffset + 1);
+ }
+ if (nextLength != extendedLength) {
+ rangeAfter = new Region(nextOffset + nextLength, extendedLength - nextLength + 1);
+ }
+ currPackage.add(
+ new ImportDeclEntry(
+ packName.length(),
+ name,
+ isStatic,
+ new Region(currOffset, nextOffset - currOffset),
+ rangeBefore,
+ rangeAfter));
//{ObjectTeams: base import
if (isBase)
currPackage.getLast().setIsBase(true);
@@ -314,6 +342,102 @@
//SH}
}
+ private IRegion[] retrieveExistingCommentsInImports(CompilationUnit root) {
+ List/*ImportDeclaration*/ decls= root.imports();
+ if (decls.isEmpty()) {
+ return null;
+ }
+
+ List commentList = root.getCommentList();
+ int numberOfComments = commentList.size();
+ List regions = null;
+ int currentExtendedEnd = -1;
+ int currEndLine= -1;
+
+ /* for the first comment, we only take the trailing comment if any and the replace range doesn't
+ * include the preceding comment
+ */
+ for (int i= 0; i < decls.size(); i++) {
+ ImportDeclaration next= (ImportDeclaration) decls.get(i);
+ int nextOffset= next.getStartPosition();
+ int nextLength= next.getLength();
+
+ int extendedStart = root.getExtendedStartPosition(next);
+ int extendedLength = root.getExtendedLength(next);
+ int nextOffsetLine= root.getLineNumber(nextOffset);
+
+ if (nextOffset != extendedStart) {
+ // preceding comment
+ int lengthOfPrecedingComment = nextOffset - extendedStart;
+ if (i != 0) {
+ if (regions == null) {
+ regions = new ArrayList();
+ }
+ regions.add(new Region(extendedStart, lengthOfPrecedingComment));
+ }
+
+ if (extendedLength != (nextLength + lengthOfPrecedingComment)) {
+ // Preceding and trailing comments
+ int regionLength = extendedLength - (nextLength + lengthOfPrecedingComment);
+ if (regions == null) {
+ regions = new ArrayList();
+ }
+ regions.add(new Region(nextOffset + nextLength, regionLength));
+ }
+ } else if (nextLength != extendedLength) {
+ // no extended start - only trailing comment
+ int regionLength = extendedLength - nextLength;
+ if (regions == null) {
+ regions = new ArrayList();
+ }
+ regions.add(new Region(nextOffset + nextLength, regionLength));
+ }
+ if (i > 0) {
+ // record comments between the previous comment and the current one that are not part
+ // of any comment extended range.
+ if ((nextOffsetLine - currEndLine) > 1) {
+ // check for comments between the two imports
+ LineComment comment = root.getAST().newLineComment();
+ comment.setSourceRange(currentExtendedEnd + 1, 0);
+ int index = Collections.binarySearch(commentList, comment, new Comparator() {
+ public int compare(Object o1, Object o2) {
+ return ((Comment) o1).getStartPosition() - ((Comment) o2).getStartPosition();
+ }
+ });
+ // index = -(insertion point) - 1.
+ if (index < 0) {
+ loop: for (int j = -(index + 1); j < numberOfComments; j++) {
+ Comment currentComment = (Comment) commentList.get(j);
+ int commentStartPosition = currentComment.getStartPosition();
+ int commentLength = currentComment.getLength();
+ if ((commentStartPosition > currentExtendedEnd)
+ && ((commentStartPosition + commentLength - 1) < extendedStart)) {
+ if (regions == null) {
+ regions = new ArrayList();
+ }
+ regions.add(new Region(commentStartPosition, commentLength));
+ } else {
+ break loop;
+ }
+ }
+ }
+ }
+ }
+ currentExtendedEnd = extendedStart + extendedLength - 1;
+ currEndLine = root.getLineNumber(currentExtendedEnd);
+ }
+ if (regions == null) {
+ return null;
+ }
+ // sort regions according to their positions to restore comments in the same order
+ IRegion[] result = (IRegion[]) regions.toArray(new IRegion[regions.size()]);
+ Arrays.sort(result, new Comparator() {
+ public int compare(Object o1, Object o2) {
+ return ((IRegion) o1).getOffset() - ((IRegion) o2).getOffset();
+ }
+ });
+ return result;
+ }
/**
* Specifies that implicit imports (for types in <code>java.lang</code>, types in the same package as the rewrite
* compilation unit and types in the compilation unit's main type) should not be created, except if necessary to
@@ -325,10 +449,10 @@
* Note: {@link #ImportRewriteAnalyzer(ICompilationUnit, CompilationUnit, String[], int, int, boolean, boolean)} with true as the last
* parameter can be used to filter implicit imports when a context is used.
* </p>
- *
+ *
* @param filterImplicitImports
* if <code>true</code>, implicit imports will be filtered
- *
+ *
* @see #ImportRewriteAnalyzer(ICompilationUnit, CompilationUnit, String[], int, int, boolean, boolean)
*/
public void setFilterImplicitImports(boolean filterImplicitImports) {
@@ -712,7 +836,7 @@
boolean doStarImport= pack.hasStarImport(threshold, onDemandConflicts);
if (doStarImport && (pack.find("*") == null)) { //$NON-NLS-1$
- String[] imports = getNewImportStrings(pack, isStatic, lineDelim);
+ String[] imports = getNewImportStrings(buffer, pack, isStatic, lineDelim);
for (int j = 0, max = imports.length; j < max; j++) {
stringsToInsert.add(imports[j]);
}
@@ -756,8 +880,17 @@
} else if (doStarImport && !currDecl.isOnDemand()) {
String simpleName = currDecl.getTypeQualifiedName();
if (simpleName.indexOf('.') != -1) {
+ IRegion rangeBefore = currDecl.getPrecedingCommentRange();
+ if (rangeBefore != null) {
+ stringsToInsert.add(buffer.getText(rangeBefore.getOffset(), rangeBefore.getLength()));
+ }
+ IRegion rangeAfter = currDecl.getTrailingCommentRange();
+ String trailingComment = null;
+ if (rangeAfter != null) {
+ trailingComment = buffer.getText(rangeAfter.getOffset(), rangeAfter.getLength());
+ }
//{ObjectTeams: new 3. param:
- String str= getNewImportString(currDecl.getElementName(), isStatic, currDecl.isBase(), lineDelim);
+ String str= getNewImportString(currDecl.getElementName(), isStatic, currDecl.isBase(), trailingComment, lineDelim);
// SH}
if (stringsToInsert.indexOf(str) == -1) {
stringsToInsert.add(str);
@@ -767,6 +900,30 @@
}
}
+ // insert back all existing imports comments since existing imports were not preserved
+ if (this.preserveExistingCommentsRanges != null) {
+ for (int i = 0, max = this.preserveExistingCommentsRanges.length; i < max; i++) {
+ IRegion region = this.preserveExistingCommentsRanges[i];
+ String text = buffer.getText(region.getOffset(), region.getLength());
+ // remove preceding whitespaces
+ int index = 0;
+ int length = text.length();
+ loop: while (index < length) {
+ if (Character.isWhitespace(text.charAt(index))) {
+ index++;
+ } else {
+ break loop;
+ }
+ }
+ if (index != 0) {
+ text = text.substring(index);
+ }
+ if (!text.endsWith(lineDelim)) {
+ text += lineDelim;
+ }
+ stringsToInsert.add(text);
+ }
+ }
int end= importsStart + importsLen;
removeAndInsertNew(buffer, currPos, end, stringsToInsert, resEdit);
@@ -898,6 +1055,10 @@
//{ObjectTeams: added 3. parameter
private String getNewImportString(String importName, boolean isStatic, boolean isBase, String lineDelim) {
+ return getNewImportString(importName, isStatic, isBase, null, lineDelim);
+ }
+
+ private String getNewImportString(String importName, boolean isStatic, boolean isBase, String trailingComment, String lineDelim) {
// SH}
StringBuffer buf= new StringBuffer();
buf.append("import "); //$NON-NLS-1$
@@ -911,6 +1072,9 @@
buf.append(importName);
if (insertSpaceBeforeSemicolon()) buf.append(' ');
buf.append(';');
+ if (trailingComment != null) {
+ buf.append(trailingComment);
+ }
buf.append(lineDelim);
if (isStatic) {
@@ -920,25 +1084,54 @@
}
return buf.toString();
}
-
- private String[] getNewImportStrings(PackageEntry packageEntry, boolean isStatic, String lineDelim) {
+
+ private String[] getNewImportStrings(IBuffer buffer, PackageEntry packageEntry, boolean isStatic, String lineDelim) {
boolean isStarImportAdded = false;
List allImports = new ArrayList();
int nImports = packageEntry.getNumberOfImports();
+ StringBuffer allComments = null;
for (int i= 0; i < nImports; i++) {
ImportDeclEntry curr= packageEntry.getImportAt(i);
String simpleName = curr.getTypeQualifiedName();
if (simpleName.indexOf('.') != -1) {
// member type imports - we preserve it
+ IRegion rangeBefore = curr.getPrecedingCommentRange();
+ if (rangeBefore != null) {
+ allImports.add(buffer.getText(rangeBefore.getOffset(), rangeBefore.getLength()));
+ }
+ IRegion rangeAfter = curr.getTrailingCommentRange();
+ String trailingComment = null;
+ if (rangeAfter != null) {
+ trailingComment = buffer.getText(rangeAfter.getOffset(), rangeAfter.getLength());
+ }
//{ObjectTeams: added isBase(false) (2 occur)
- allImports.add(getNewImportString(curr.getElementName(), isStatic, false, lineDelim));
+ allImports.add(getNewImportString(curr.getElementName(), isStatic, false, trailingComment, lineDelim));
} else if (!isStarImportAdded) {
String starImportString= packageEntry.getName() + ".*"; //$NON-NLS-1$
allImports.add(getNewImportString(starImportString, isStatic, false, lineDelim));
// SH}
isStarImportAdded = true;
+ } else {
+ // collect all comments
+ IRegion rangeBefore = curr.getPrecedingCommentRange();
+ if (rangeBefore != null) {
+ if (allComments == null) {
+ allComments = new StringBuffer();
+ }
+ allComments.append(buffer.getText(rangeBefore.getOffset(), rangeBefore.getLength())).append(lineDelim);
+ }
+ IRegion rangeAfter = curr.getTrailingCommentRange();
+ if (rangeAfter != null) {
+ if (allComments == null) {
+ allComments = new StringBuffer();
+ }
+ allComments.append(buffer.getText(rangeAfter.getOffset(), rangeAfter.getLength())).append(lineDelim);
+ }
}
}
+ if (allComments != null) {
+ allImports.add(0, String.valueOf(allComments));
+ }
return (String[]) allImports.toArray(new String[allImports.size()]);
}
@@ -1000,6 +1193,20 @@
private boolean isBase = false;
// SH}
private int containerNameLength;
+ private IRegion precedingCommentRange;
+ private IRegion trailingCommentRange;
+
+ public ImportDeclEntry(
+ int containerNameLength,
+ String elementName,
+ boolean isStatic,
+ IRegion sourceRange,
+ IRegion precedingCommentRange,
+ IRegion trailingCommentRange) {
+ this(containerNameLength, elementName, isStatic, sourceRange);
+ this.precedingCommentRange = precedingCommentRange;
+ this.trailingCommentRange = trailingCommentRange;
+ }
public ImportDeclEntry(int containerNameLength, String elementName, boolean isStatic, IRegion sourceRange) {
this.elementName= elementName;
@@ -1030,7 +1237,7 @@
public String getTypeQualifiedName() {
return this.elementName.substring(this.containerNameLength + 1);
}
-
+
public boolean isOnDemand() {
return this.elementName != null && this.elementName.endsWith(".*"); //$NON-NLS-1$
}
@@ -1050,6 +1257,14 @@
public IRegion getSourceRange() {
return this.sourceRange;
}
+
+ public IRegion getPrecedingCommentRange() {
+ return this.precedingCommentRange;
+ }
+
+ public IRegion getTrailingCommentRange() {
+ return this.trailingCommentRange;
+ }
//{ObjectTeams: base import:
public void setIsBase(boolean flag) {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeInfoStore.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeInfoStore.java
index a1f18cd..a26e75d 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeInfoStore.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeInfoStore.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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
@@ -72,32 +72,32 @@
* @return Returns a place holder node.
*/
public final ASTNode newPlaceholderNode(int nodeType) {
- try {
- ASTNode node= this.ast.createInstance(nodeType);
- switch (node.getNodeType()) {
+ try {
+ ASTNode node= this.ast.createInstance(nodeType);
+ switch (node.getNodeType()) {
case ASTNode.FIELD_DECLARATION:
- ((FieldDeclaration) node).fragments().add(this.ast.newVariableDeclarationFragment());
- break;
+ ((FieldDeclaration) node).fragments().add(this.ast.newVariableDeclarationFragment());
+ break;
case ASTNode.MODIFIER:
- ((Modifier) node).setKeyword(Modifier.ModifierKeyword.ABSTRACT_KEYWORD);
+ ((Modifier) node).setKeyword(Modifier.ModifierKeyword.ABSTRACT_KEYWORD);
break;
case ASTNode.TRY_STATEMENT :
((TryStatement) node).setFinally(this.ast.newBlock()); // have to set at least a finally block to be legal code
break;
case ASTNode.VARIABLE_DECLARATION_EXPRESSION :
- ((VariableDeclarationExpression) node).fragments().add(this.ast.newVariableDeclarationFragment());
- break;
+ ((VariableDeclarationExpression) node).fragments().add(this.ast.newVariableDeclarationFragment());
+ break;
case ASTNode.VARIABLE_DECLARATION_STATEMENT :
- ((VariableDeclarationStatement) node).fragments().add(this.ast.newVariableDeclarationFragment());
- break;
+ ((VariableDeclarationStatement) node).fragments().add(this.ast.newVariableDeclarationFragment());
+ break;
case ASTNode.PARAMETERIZED_TYPE :
- ((ParameterizedType) node).typeArguments().add(this.ast.newWildcardType());
- break;
+ ((ParameterizedType) node).typeArguments().add(this.ast.newWildcardType());
+ break;
}
- return node;
- } catch (IllegalArgumentException e) {
- return null;
- }
+ return node;
+ } catch (IllegalArgumentException e) {
+ return null;
+ }
}
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 37afb4b..fb5424b 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
@@ -1184,7 +1184,7 @@
* <p>The severity of the problem is controlled with option {@link #COMPILER_PB_INVALID_JAVADOC}.
* <p>It does not depend on option {@link #COMPILER_PB_INVALID_JAVADOC_TAGS}.
* <p>When this option is valued to {@link #COMPILER_PB_MISSING_JAVADOC_TAG_DESCRIPTION_ALL_STANDARD_TAGS},
- * a subset of the standard <a href="http://java.sun.com/javase/6/docs/technotes/tools/windows/javadoc.html#javadoctags">Javadoc tags</a>
+ * a subset of the standard <a href="http://download.oracle.com/javase/6/docs/technotes/tools/windows/javadoc.html#javadoctags">Javadoc tags</a>
* that have a description, text or label are checked. While this set may grow in the future, note that user-defined tags are not and will not be checked.
* <dl>
* <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription"</code></dd>
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceJavadocParser.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceJavadocParser.java
index 6f96497..00461e7 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceJavadocParser.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceJavadocParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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
@@ -93,10 +93,10 @@
this.index++;
while (this.source[this.index] == 'u')
this.index++;
- if (!(((c1 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c1 < 0)
- || ((c2 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c2 < 0)
- || ((c3 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c3 < 0)
- || ((c4 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c4 < 0))) {
+ if (!(((c1 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c1 < 0)
+ || ((c2 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c2 < 0)
+ || ((c3 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c3 < 0)
+ || ((c4 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c4 < 0))) {
first = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
} else {
this.index = pos;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMember.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMember.java
index 60300ca..94e6db1 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMember.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMember.java
@@ -87,6 +87,12 @@
if ((tagBits & TagBits.AnnotationSafeVarargs) != 0) {
annotations.add(getAnnotation(TypeConstants.JAVA_LANG_SAFEVARARGS));
}
+ if ((tagBits & TagBits.AnnotationPostConstruct) != 0) {
+ annotations.add(getAnnotation(TypeConstants.JAVAX_ANNOTATION_POSTCONSTRUCT));
+ }
+ if ((tagBits & TagBits.AnnotationPreDestroy) != 0) {
+ annotations.add(getAnnotation(TypeConstants.JAVAX_ANNOTATION_PREDESTROY));
+ }
// note that JAVA_LANG_SUPPRESSWARNINGS and JAVA_LANG_OVERRIDE cannot appear in binaries
return (IAnnotation[]) annotations.toArray(new IAnnotation[annotations.size()]);
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java
index b340526..0feff2c 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java
@@ -126,6 +126,12 @@
if ((tagBits & TagBits.AnnotationSafeVarargs) != 0) {
generateStandardAnnotation(javaElement, TypeConstants.JAVA_LANG_SAFEVARARGS, Annotation.NO_MEMBER_VALUE_PAIRS, newElements);
}
+ if ((tagBits & TagBits.AnnotationPostConstruct) != 0) {
+ generateStandardAnnotation(javaElement, TypeConstants.JAVAX_ANNOTATION_POSTCONSTRUCT, Annotation.NO_MEMBER_VALUE_PAIRS, newElements);
+ }
+ if ((tagBits & TagBits.AnnotationPreDestroy) != 0) {
+ generateStandardAnnotation(javaElement, TypeConstants.JAVAX_ANNOTATION_PREDESTROY, Annotation.NO_MEMBER_VALUE_PAIRS, newElements);
+ }
// note that JAVA_LANG_SUPPRESSWARNINGS and JAVA_LANG_OVERRIDE cannot appear in binaries
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileWorkingCopy.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileWorkingCopy.java
index d1027f2..4c085ce 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileWorkingCopy.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileWorkingCopy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Stephan Herrmann - Contribution for Bug 337935 - Test failures when run as an IDE (org.eclipse.sdk.ide)
*******************************************************************************/
package org.eclipse.jdt.internal.core;
@@ -81,21 +82,18 @@
protected IBuffer openBuffer(IProgressMonitor pm, Object info) throws JavaModelException {
// create buffer
- IBuffer buffer = this.owner.createBuffer(this);
- if (buffer == null) return null;
+ IBuffer buffer = BufferManager.createBuffer(this);
// set the buffer source
- if (buffer.getCharacters() == null) {
- IBuffer classFileBuffer = this.classFile.getBuffer();
- if (classFileBuffer != null) {
- buffer.setContents(classFileBuffer.getCharacters());
- } else {
- // Disassemble
- IClassFileReader reader = ToolFactory.createDefaultClassFileReader(this.classFile, IClassFileReader.ALL);
- Disassembler disassembler = new Disassembler();
- String contents = disassembler.disassemble(reader, Util.getLineSeparator("", getJavaProject()), ClassFileBytesDisassembler.WORKING_COPY); //$NON-NLS-1$
- buffer.setContents(contents);
- }
+ IBuffer classFileBuffer = this.classFile.getBuffer();
+ if (classFileBuffer != null) {
+ buffer.setContents(classFileBuffer.getCharacters());
+ } else {
+ // Disassemble
+ IClassFileReader reader = ToolFactory.createDefaultClassFileReader(this.classFile, IClassFileReader.ALL);
+ Disassembler disassembler = new Disassembler();
+ String contents = disassembler.disassemble(reader, Util.getLineSeparator("", getJavaProject()), ClassFileBytesDisassembler.WORKING_COPY); //$NON-NLS-1$
+ buffer.setContents(contents);
}
// add buffer to buffer cache
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java
index b15d3c8..f7a0c1c 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Terry Parker <tparker@google.com> - DeltaProcessor exhibits O(N^2) behavior, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=354332
*******************************************************************************/
package org.eclipse.jdt.internal.core;
@@ -953,6 +954,7 @@
// project does not exist -> ignore
continue;
}
+ boolean hasChainedJar = false;
for (int j = 0; j < entries.length; j++){
if (entries[j].getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
IPath entryPath = entries[j].getPath();
@@ -1022,7 +1024,7 @@
System.out.println("- External JAR ADDED, affecting root: "+root.getElementName()); //$NON-NLS-1$
}
elementAdded(root, null, null);
- javaProject.resetResolvedClasspath(); // in case it contains a chained jar
+ hasChainedJar |= !this.manager.isNonChainingJar(entryPath);
this.state.addClasspathValidation(javaProject); // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=185733
hasDelta = true;
} else if (status == EXTERNAL_JAR_CHANGED) {
@@ -1031,7 +1033,7 @@
System.out.println("- External JAR CHANGED, affecting root: "+root.getElementName()); //$NON-NLS-1$
}
contentChanged(root);
- javaProject.resetResolvedClasspath(); // in case it contains a chained jar
+ hasChainedJar |= !this.manager.isNonChainingJar(entryPath);
hasDelta = true;
} else if (status == EXTERNAL_JAR_REMOVED) {
PackageFragmentRoot root = (PackageFragmentRoot) javaProject.getPackageFragmentRoot(entryPath.toString());
@@ -1039,13 +1041,17 @@
System.out.println("- External JAR REMOVED, affecting root: "+root.getElementName()); //$NON-NLS-1$
}
elementRemoved(root, null, null);
- javaProject.resetResolvedClasspath(); // in case it contains a chained jar
+ hasChainedJar |= !this.manager.isNonChainingJar(entryPath);
this.state.addClasspathValidation(javaProject); // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=185733
hasDelta = true;
}
}
}
}
+
+ if (hasChainedJar) {
+ javaProject.resetResolvedClasspath();
+ }
}
// ensure the external file cache is reset so that if a .jar file is deleted but no longer on the classpath, it won't appear as changed next time it is added
JavaModel.flushExternalFileCache();
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java
index 191af72..1f18e01 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java
@@ -351,7 +351,7 @@
}
}
public void acceptLocalMethod(MethodBinding methodBinding) {
- IJavaElement res = findLocalElement(methodBinding.sourceStart());
+ IJavaElement res = findLocalElement(methodBinding.original().sourceStart());
if(res != null) {
if(res.getElementType() == IJavaElement.METHOD) {
IMethod method = (IMethod) res;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java
index aef9537..0555b43 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java
@@ -1047,6 +1047,8 @@
char[][] memberTypeNames = CharOperation.splitOn('$', typeName, firstDollar+1, typeName.length);
for (int i = 0; i < memberTypeNames.length; i++) {
this.focusType = this.focusType.getMemberType(memberTypeNames[i]);
+ if (this.focusType == null)
+ return null;
}
}
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java
index 7e9aa85..12579ef 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java
@@ -1959,13 +1959,13 @@
this.currentPosition += (this.eofPosition - this.currentPosition);
throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
}
- if ((c1 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
+ if ((c1 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c1 < 0
- || (c2 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
+ || (c2 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c2 < 0
- || (c3 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
+ || (c3 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c3 < 0
- || (c4 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
+ || (c4 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c4 < 0){
throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
}
@@ -2865,18 +2865,18 @@
// OctalDigit OctalDigit
// ZeroToThree OctalDigit OctalDigit
- int number = ScannerHelper.getNumericValue(this.currentCharacter);
+ int number = ScannerHelper.getHexadecimalValue(this.currentCharacter);
if (number >= 0 && number <= 7) {
boolean zeroToThreeNot = number > 3;
if (ScannerHelper.isDigit(this.currentCharacter = this.source[this.currentPosition++])) {
- int digit = ScannerHelper.getNumericValue(this.currentCharacter);
+ int digit = ScannerHelper.getHexadecimalValue(this.currentCharacter);
if (digit >= 0 && digit <= 7) {
number = (number * 8) + digit;
if (ScannerHelper.isDigit(this.currentCharacter = this.source[this.currentPosition++])) {
if (zeroToThreeNot) {// has read \NotZeroToThree OctalDigit Digit --> ignore last character
this.currentPosition--;
} else {
- digit = ScannerHelper.getNumericValue(this.currentCharacter);
+ digit = ScannerHelper.getHexadecimalValue(this.currentCharacter);
if (digit >= 0 && digit <= 7){ // has read \ZeroToThree OctalDigit OctalDigit
number = (number * 8) + digit;
} else {// has read \ZeroToThree OctalDigit NonOctalDigit --> ignore last character
diff --git a/org.eclipse.jdt.core/notes/R31_buildnotes_jdt-core.html b/org.eclipse.jdt.core/notes/R31_buildnotes_jdt-core.html
index 7a64b2a..c2a9d6a 100644
--- a/org.eclipse.jdt.core/notes/R31_buildnotes_jdt-core.html
+++ b/org.eclipse.jdt.core/notes/R31_buildnotes_jdt-core.html
@@ -3219,8 +3219,8 @@
<ul>
<li>Compiler is now able to parse 1.5 syntax in Javadoc comments (see bugs <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=70891">70891</a>
and <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=70892">70892</a>).<br>
-Note: these changes only apply to <a href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javadoc.html#@param">@param</a> and
-<a href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javadoc.html#{@value}">{@value}</a> tags.
+Note: these changes only apply to <a href="http://download.oracle.com/javase/6/docs/technotes/tools/windows/javadoc.html#@param">@param</a> and
+<a href="http://download.oracle.com/javase/6/docs/technotes/tools/windows/javadoc.html#@value">{@value}</a> tags.
</li>
<li>Batch AST creation API was finalized. See <code>ASTParser#createASTs(ICompilationUnit[],String[],ASTRequestor,IProgressMonitor)</code>
and <code>ASTRequestor</code>.
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java
index 162d123..8aeb580 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java
@@ -86,6 +86,14 @@
TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE;
addAnnotationTypeReference(compoundName[compoundName.length-1]);
}
+ if ((annotationTagBits & TagBits.AnnotationPostConstruct) != 0) {
+ char[][] compoundName = TypeConstants.JAVAX_ANNOTATION_POSTCONSTRUCT;
+ addAnnotationTypeReference(compoundName[compoundName.length-1]);
+ }
+ if ((annotationTagBits & TagBits.AnnotationPreDestroy) != 0) {
+ char[][] compoundName = TypeConstants.JAVAX_ANNOTATION_PREDESTROY;
+ addAnnotationTypeReference(compoundName[compoundName.length-1]);
+ }
}
private void addBinaryTargetAnnotation(long bits) {
char[][] compoundName = null;
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java
index 1124075..f6c1039 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java
@@ -149,6 +149,18 @@
return true;
}
}
+ if ((annotationTagBits & TagBits.AnnotationPostConstruct) != 0) {
+ char[][] compoundName = TypeConstants.JAVAX_ANNOTATION_POSTCONSTRUCT;
+ if (checkAnnotationTypeReference(CharOperation.concatWith(compoundName, '.'), pattern)) {
+ return true;
+ }
+ }
+ if ((annotationTagBits & TagBits.AnnotationPreDestroy) != 0) {
+ char[][] compoundName = TypeConstants.JAVAX_ANNOTATION_PREDESTROY;
+ if (checkAnnotationTypeReference(CharOperation.concatWith(compoundName, '.'), pattern)) {
+ return true;
+ }
+ }
return false;
}
private boolean checkTypeName(char[] simpleName, char[] qualification, char[] fullyQualifiedTypeName, boolean isCaseSensitive, boolean isCamelCase) {