From df47c2b6d65c157eae7c05a7771f74c750d8e41c Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Tue, 14 Aug 2012 16:56:09 -0700 Subject: [PATCH] Bug 299911. Adapted for CDT 8.1.x branch. --- .../.settings/.api_filters | 100 ++++++++++++ .../core/dom/ast/IASTTypeIdExpression.java | 6 +- .../org/eclipse/cdt/core/dom/ast/IScope.java | 4 +- .../cpp/ICPPASTArraySubscriptExpression.java | 4 +- .../core/dom/ast/cpp/ICPPASTExpression.java | 6 +- .../dom/ast/cpp/ICPPASTFieldReference.java | 2 +- .../dom/ast/cpp/ICPPASTInitializerClause.java | 1 - .../dom/ast/cpp/ICPPClassSpecialization.java | 20 +-- .../dom/ast/cpp/ICPPMethodSpecialization.java | 2 - .../eclipse/cdt/core/parser/GCCKeywords.java | 2 +- .../eclipse/cdt/core/parser/IGCCToken.java | 7 +- .../cdt/core/parser/util/CharArrayUtils.java | 2 +- .../cdt/core/parser/util/IntArray.java | 151 ------------------ .../eclipse/cdt/internal/core/pdom/PDOM.java | 10 +- 14 files changed, 130 insertions(+), 187 deletions(-) create mode 100644 core/org.eclipse.cdt.core/.settings/.api_filters delete mode 100644 core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/IntArray.java diff --git a/core/org.eclipse.cdt.core/.settings/.api_filters b/core/org.eclipse.cdt.core/.settings/.api_filters new file mode 100644 index 00000000000..00ccfe79000 --- /dev/null +++ b/core/org.eclipse.cdt.core/.settings/.api_filters @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTypeIdExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTypeIdExpression.java index f2f0e0a4fb5..2882217601d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTypeIdExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTypeIdExpression.java @@ -130,19 +130,19 @@ public interface IASTTypeIdExpression extends IASTExpression { /** * Built-in type trait of g++. - * @since 5.5 + * Experimental API. May change without notice. */ public static final int op_is_literal_type= 19; /** * Built-in type trait of g++. - * @since 5.5 + * Experimental API. May change without notice. */ public static final int op_is_standard_layout= 20; /** * Built-in type trait of g++. - * @since 5.5 + * Experimental API. May change without notice. */ public static final int op_is_trivial= 21; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IScope.java index a713a581698..f808c84115e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IScope.java @@ -100,7 +100,7 @@ public interface IScope { /** - * @since 5.5 + * @noinstantiate This class is not intended to be instantiated by clients. * @noextend This class is not intended to be subclassed by clients. */ public static class ScopeLookupData { @@ -185,7 +185,7 @@ public interface IScope { * have not yet been resolved. * * @return : the bindings in this scope that match the name or prefix, or null - * @since 5.5 + * @noreference This method is not intended to be referenced by clients. */ public IBinding[] getBindings(ScopeLookupData lookup); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTArraySubscriptExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTArraySubscriptExpression.java index d0e61fa0ba3..2bc116c30c4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTArraySubscriptExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTArraySubscriptExpression.java @@ -31,13 +31,13 @@ public interface ICPPASTArraySubscriptExpression extends IASTArraySubscriptExpre public ICPPASTArraySubscriptExpression copy(CopyStyle style); /** - * @since 5.5 + * @noreference This method is not intended to be referenced by clients. */ @Override public ICPPASTExpression getArrayExpression(); /** - * @since 5.5 + * @noreference This method is not intended to be referenced by clients. */ @Override public ICPPASTInitializerClause getArgument(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTExpression.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTExpression.java index 1805ce597a1..74a10d41f76 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTExpression.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTExpression.java @@ -6,9 +6,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Markus Schorn - initial API and implementation + * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.core.dom.ast.cpp; import org.eclipse.cdt.core.dom.ast.IASTExpression; @@ -17,8 +16,7 @@ import org.eclipse.cdt.core.dom.ast.IASTExpression; * Interface for c++ expressions. * @noextend This interface is not intended to be extended by clients. * @noimplement This interface is not intended to be implemented by clients. - * @since 5.5 + * Experimental API. May change without notice. */ public interface ICPPASTExpression extends IASTExpression, ICPPASTInitializerClause { - } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFieldReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFieldReference.java index 645487cfa05..1d40109920b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFieldReference.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTFieldReference.java @@ -54,7 +54,7 @@ public interface ICPPASTFieldReference extends IASTFieldReference, ICPPASTExpres public IType getFieldOwnerType(); /** - * @since 5.5 + * @noreference This method is not intended to be referenced by clients. */ @Override public ICPPASTExpression getFieldOwner(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTInitializerClause.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTInitializerClause.java index 669a66ec9c7..31b066390f3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTInitializerClause.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTInitializerClause.java @@ -17,7 +17,6 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation; * C++ specific initializer clause. * @noextend This interface is not intended to be extended by clients. * @noimplement This interface is not intended to be implemented by clients. - * @since 5.5 */ public interface ICPPASTInitializerClause extends IASTInitializerClause { /** diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassSpecialization.java index 5bef68a2aec..88397d69b98 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPClassSpecialization.java @@ -35,70 +35,70 @@ public interface ICPPClassSpecialization extends ICPPSpecialization, ICPPClassTy /** * Creates a specialized binding for a member of the original class. The result is * a member of this class specialization. - * @since 5.5 + * @noreference This method is not intended to be referenced by clients. */ IBinding specializeMember(IBinding binding, IASTNode point); /** * Similar to {@link ICPPClassType#getBases()} but a accepts a starting point for template * instantiation. - * @since 5.5 + * @noreference This method is not intended to be referenced by clients. */ ICPPBase[] getBases(IASTNode point); /** * Similar to {@link ICPPClassType#getConstructors()} but a accepts a starting point * for template instantiation. - * @since 5.5 + * @noreference This method is not intended to be referenced by clients. */ ICPPConstructor[] getConstructors(IASTNode point); /** * Similar to {@link ICPPClassType#getDeclaredFields()} but a accepts a starting point * for template instantiation. - * @since 5.5 + * @noreference This method is not intended to be referenced by clients. */ ICPPField[] getDeclaredFields(IASTNode point); /** * Similar to {@link ICPPClassType#getMethods()} but a accepts a starting point * for template instantiation. - * @since 5.5 + * @noreference This method is not intended to be referenced by clients. */ ICPPMethod[] getMethods(IASTNode point); /** * Similar to {@link ICPPClassType#getAllDeclaredMethods()} but a accepts a starting point * for template instantiation. - * @since 5.5 + * @noreference This method is not intended to be referenced by clients. */ ICPPMethod[] getAllDeclaredMethods(IASTNode point); /** * Similar to {@link ICPPClassType#getDeclaredMethods()} but a accepts a starting point * for template instantiation. - * @since 5.5 + * @noreference This method is not intended to be referenced by clients. */ ICPPMethod[] getDeclaredMethods(IASTNode point); /** * Similar to {@link ICPPClassType#getFriends()} but a accepts a starting point * for template instantiation. - * @since 5.5 + * @noreference This method is not intended to be referenced by clients. */ IBinding[] getFriends(IASTNode point); /** * Similar to {@link ICPPClassType#getFriends()} but a accepts a starting point * for template instantiation. - * @since 5.5 + * @noreference This method is not intended to be referenced by clients. */ IField[] getFields(IASTNode point); /** * Similar to {@link ICPPClassType#getNestedClasses()} but a accepts a starting point * for template instantiation. - * @since 5.5 + * @noreference This method is not intended to be referenced by clients. */ ICPPClassType[] getNestedClasses(IASTNode point); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPMethodSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPMethodSpecialization.java index 1f2a1ed41cc..a3f5fe2f7ed 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPMethodSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPMethodSpecialization.java @@ -15,7 +15,6 @@ import org.eclipse.cdt.core.dom.ast.IType; /** * Specialization of a method. - * @since 5.5 * * @noextend This interface is not intended to be extended by clients. * @noimplement This interface is not intended to be implemented by clients. @@ -24,7 +23,6 @@ public interface ICPPMethodSpecialization extends ICPPSpecialization, ICPPMethod /** * Similar to {@link ICPPFunction#getExceptionSpecification()} but a accepts a starting point * for template instantiation. - * @since 5.5 */ IType[] getExceptionSpecification(IASTNode point); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/GCCKeywords.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/GCCKeywords.java index 269a05bb526..6c424d25e37 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/GCCKeywords.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/GCCKeywords.java @@ -68,7 +68,7 @@ public class GCCKeywords { cp__is_union= "__is_union".toCharArray(); /** - * @since 5.5 + * Experimental API. May change without notice. */ public static final char[] cp__is_literal_type= "__is_literal_type".toCharArray(), diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IGCCToken.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IGCCToken.java index 6eb92f22f9c..716a94fda3a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IGCCToken.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IGCCToken.java @@ -41,7 +41,8 @@ public interface IGCCToken extends IToken { /** @since 5.3 */ int tTT_is_pod= FIRST_RESERVED_IGCCToken + 19; /** @since 5.3 */ int tTT_is_polymorphic= FIRST_RESERVED_IGCCToken + 20; /** @since 5.3 */ int tTT_is_union= FIRST_RESERVED_IGCCToken + 21; - /** @since 5.5 */ int tTT_is_literal_type= FIRST_RESERVED_IGCCToken + 22; - /** @since 5.5 */ int tTT_is_standard_layout= FIRST_RESERVED_IGCCToken + 23; - /** @since 5.5 */ int tTT_is_trivial= FIRST_RESERVED_IGCCToken + 24; + /** The following constants are experimental and are not intended to be referenced by clients. */ + int tTT_is_literal_type= FIRST_RESERVED_IGCCToken + 22; + int tTT_is_standard_layout= FIRST_RESERVED_IGCCToken + 23; + int tTT_is_trivial= FIRST_RESERVED_IGCCToken + 24; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/CharArrayUtils.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/CharArrayUtils.java index 330878bb36c..1387dc81f34 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/CharArrayUtils.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/CharArrayUtils.java @@ -343,7 +343,7 @@ public class CharArrayUtils { /** * Converts a {@link StringBuilder} to a character array. - * @since 5.5 + * @noreference This method is not intended to be referenced by clients. */ public static char[] extractChars(StringBuilder buf) { final int len = buf.length(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/IntArray.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/IntArray.java deleted file mode 100644 index ba5a8b312c2..00000000000 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/IntArray.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Google, Inc 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Sergey Prigogin (Google) - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.core.parser.util; - -import java.util.Arrays; - -/** - * Automatically growing integer array. - * - * @since 5.5 - */ -public class IntArray { - private static final int INITIAL_CAPACITY = 10; - private static final int[] EMPTY_ARRAY = {}; - - private int[] buffer = EMPTY_ARRAY; - private int size; - - public IntArray() { - } - - public IntArray(int initialCapacity) { - this.buffer = new int[initialCapacity]; - } - - public int size() { - return size; - } - - public boolean isEmpty() { - return size == 0; - } - - public void add(int value) { - grow(size + 1); - buffer[size++] = value; - } - - public void add(int index, int value) { - checkBounds(index); - grow(size + 1); - System.arraycopy(buffer, index, buffer, index + 1, size - index); - buffer[index] = value; - size++; - } - - public void addAll(IntArray other) { - grow(size + other.size()); - System.arraycopy(other.buffer, 0, buffer, size, other.size); - size += other.size; - return; - } - - public void addAll(int[] array) { - grow(size + array.length); - System.arraycopy(array, 0, buffer, size, array.length); - size += array.length; - return; - } - - public int remove(int index) { - checkBounds(index); - int old = buffer[index]; - int n = size - index - 1; - if (n > 0) { - System.arraycopy(buffer, index + 1, buffer, index, n); - } - return old; - } - - public void remove(int from, int to) { - checkBounds(from); - checkBounds(to); - System.arraycopy(buffer, to, buffer, from, size - to); - } - - public void clear() { - size = 0; - } - - public int get(int index) { - checkRange(index); - return buffer[index]; - } - - public int set(int index, int value) { - checkBounds(index); - int old = buffer[index]; - buffer[index] = value; - return old; - } - - public int[] toArray() { - return size == 0 ? EMPTY_ARRAY : Arrays.copyOf(buffer, size); - } - - public void trimToSize() { - if (size == 0) { - buffer = EMPTY_ARRAY; - } else if (size < buffer.length) { - buffer = Arrays.copyOf(buffer, size); - } - } - - public void ensureCapacity(int minCapacity) { - if (minCapacity > 0) { - grow(minCapacity); - } - } - - private void grow(int minCapacity) { - if (minCapacity < 0) // Overflow - throw new OutOfMemoryError(); - - int capacity = buffer.length; - if (minCapacity > capacity) { - int newCapacity = capacity == 0 ? INITIAL_CAPACITY : capacity + (capacity >> 1); - // newCapacity may be negative due to overflow. - if (newCapacity < minCapacity) - newCapacity = minCapacity; - // newCapacity is guaranteed to be non negative. - try { - buffer = Arrays.copyOf(buffer, newCapacity); - } catch (OutOfMemoryError e) { - // Try again it case we were too aggressive in reserving capacity. - buffer = Arrays.copyOf(buffer, minCapacity); - } - } - } - - private void checkBounds(int index) { - if (index < 0) { - throw new IndexOutOfBoundsException("Negative index: " + index); //$NON-NLS-1$ - } - checkRange(index); - } - - private void checkRange(int index) { - if (index >= size) { - throw new IndexOutOfBoundsException("Index: " + index + ", size: " + size); //$NON-NLS-1$//$NON-NLS-2$ - } - } -} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java index 351dfbdd294..6601c2f441a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java @@ -217,13 +217,11 @@ public class PDOM extends PlatformObject implements IPDOM { * 123.0 - Combined file size and encoding hash code. * 124.0 - GCC attributes and NO_RETURN flag for functions. * #125.0# - Indexes for unresolved includes and files indexed with I/O errors. <> - * - * CDT 8.2 development - * 130.0 - Dependent expressions, bug 299911 + * 126.0 - Dependent expressions, bug 299911. */ - private static final int MIN_SUPPORTED_VERSION= version(130, 0); - private static final int MAX_SUPPORTED_VERSION= version(130, Short.MAX_VALUE); - private static final int DEFAULT_VERSION = version(130, 0); + private static final int MIN_SUPPORTED_VERSION= version(126, 0); + private static final int MAX_SUPPORTED_VERSION= version(126, Short.MAX_VALUE); + private static final int DEFAULT_VERSION = version(126, 0); private static int version(int major, int minor) { return (major << 16) + minor;