mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
@Override annotations.
This commit is contained in:
parent
cfc0eec3f1
commit
302e64aebc
4 changed files with 81 additions and 45 deletions
|
@ -6,9 +6,9 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Bryan Wilkinson (QNX)
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Bryan Wilkinson (QNX)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
|
@ -23,7 +23,6 @@ import org.eclipse.cdt.core.dom.IName;
|
|||
* @noimplement This interface is not intended to be implemented by clients.
|
||||
*/
|
||||
public interface IASTName extends IASTNode, IName {
|
||||
|
||||
/**
|
||||
* Constant sentinel.
|
||||
*/
|
||||
|
@ -32,12 +31,14 @@ public interface IASTName extends IASTNode, IName {
|
|||
/**
|
||||
* Returns the name including qualification and template arguments.
|
||||
*/
|
||||
@Override
|
||||
public char[] toCharArray();
|
||||
|
||||
/**
|
||||
* Same as {@link #toCharArray()}.
|
||||
* @since 5.1
|
||||
*/
|
||||
@Override
|
||||
public String toString();
|
||||
|
||||
/**
|
||||
|
@ -101,11 +102,13 @@ public interface IASTName extends IASTNode, IName {
|
|||
/**
|
||||
* @since 5.1
|
||||
*/
|
||||
@Override
|
||||
public IASTName copy();
|
||||
|
||||
/**
|
||||
* @since 5.3
|
||||
*/
|
||||
@Override
|
||||
public IASTName copy(CopyStyle style);
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Anton Leherbauer (Wind River Systems) - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Mike Kucera (IBM)
|
||||
* Anton Leherbauer (Wind River Systems) - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Mike Kucera (IBM)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.parser;
|
||||
|
||||
|
@ -106,14 +106,15 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
|||
protected abstract ParserLanguage getParserLanguage();
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public IASTTranslationUnit getASTTranslationUnit(org.eclipse.cdt.core.parser.CodeReader reader,
|
||||
IScannerInfo scanInfo, org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator, IIndex index,
|
||||
IParserLogService log) throws CoreException {
|
||||
return getASTTranslationUnit(reader, scanInfo, fileCreator, index, 0, log);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
@Override
|
||||
public IASTTranslationUnit getASTTranslationUnit(org.eclipse.cdt.core.parser.CodeReader reader,
|
||||
IScannerInfo scanInfo, org.eclipse.cdt.core.dom.ICodeReaderFactory codeReaderFactory,
|
||||
IIndex index, int options, IParserLogService log) throws CoreException {
|
||||
|
@ -136,6 +137,7 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
|||
if (log instanceof ICanceler) {
|
||||
canceler= (ICanceler) log;
|
||||
canceler.setCancelable(new ICancelable() {
|
||||
@Override
|
||||
public void cancel() {
|
||||
scanner.cancel();
|
||||
parser.cancel();
|
||||
|
@ -155,6 +157,7 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
|||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public IASTCompletionNode getCompletionNode(org.eclipse.cdt.core.parser.CodeReader reader,
|
||||
IScannerInfo scanInfo, org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator, IIndex index,
|
||||
IParserLogService log, int offset) throws CoreException {
|
||||
|
@ -189,12 +192,13 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
|||
*/
|
||||
protected ISourceCodeParser createParser(IScanner scanner, IParserLogService log, IIndex index, boolean forCompletion, int options) {
|
||||
ParserMode mode;
|
||||
if (forCompletion)
|
||||
if (forCompletion) {
|
||||
mode= ParserMode.COMPLETION_PARSE;
|
||||
else if ((options & OPTION_SKIP_FUNCTION_BODIES) != 0)
|
||||
} else if ((options & OPTION_SKIP_FUNCTION_BODIES) != 0) {
|
||||
mode= ParserMode.STRUCTURAL_PARSE;
|
||||
else
|
||||
} else {
|
||||
mode= ParserMode.COMPLETE_PARSE;
|
||||
}
|
||||
|
||||
ISourceCodeParser parser= createParser(scanner, mode, log, index);
|
||||
if ((options & OPTION_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS) != 0) {
|
||||
|
@ -224,6 +228,7 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
|||
return new CPreprocessor(content, scanInfo, getParserLanguage(), log, getScannerExtensionConfiguration(scanInfo), fcp);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public IASTName[] getSelectedNames(IASTTranslationUnit ast, int start, int length) {
|
||||
IASTNode selectedNode= ast.getNodeSelector(null).findNode(start, length);
|
||||
|
@ -243,12 +248,13 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
|||
return collector.getNames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IContributedModelBuilder createModelBuilder(ITranslationUnit tu) {
|
||||
// use default model builder
|
||||
return null;
|
||||
}
|
||||
|
||||
private ICLanguageKeywords cLanguageKeywords = null;
|
||||
private ICLanguageKeywords cLanguageKeywords;
|
||||
|
||||
private synchronized ICLanguageKeywords getCLanguageKeywords() {
|
||||
if (cLanguageKeywords == null)
|
||||
|
@ -265,15 +271,18 @@ public abstract class AbstractCLikeLanguage extends AbstractLanguage implements
|
|||
return super.getAdapter(adapter);
|
||||
}
|
||||
|
||||
// for backwards compatibility
|
||||
// For backwards compatibility
|
||||
@Override
|
||||
public String[] getBuiltinTypes() {
|
||||
return getCLanguageKeywords().getBuiltinTypes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getKeywords() {
|
||||
return getCLanguageKeywords().getKeywords();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getPreprocessorKeywords() {
|
||||
return getCLanguageKeywords().getPreprocessorKeywords();
|
||||
}
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||
* Bryan Wilkinson (QNX)
|
||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Yuan Zhang / Beth Tibbitts (IBM Research)
|
||||
* Bryan Wilkinson (QNX)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
|
@ -31,14 +31,12 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTInternalNameOwner;
|
|||
* Implementation for names in C translation units.
|
||||
*/
|
||||
public class CASTName extends ASTNode implements IASTName, IASTCompletionContext {
|
||||
|
||||
private final char[] name;
|
||||
|
||||
private static final char[] EMPTY_CHAR_ARRAY = {};
|
||||
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
||||
|
||||
private IBinding binding = null;
|
||||
|
||||
private IBinding binding;
|
||||
|
||||
public CASTName(char[] name) {
|
||||
this.name = name;
|
||||
|
@ -48,10 +46,12 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
|||
name = EMPTY_CHAR_ARRAY;
|
||||
}
|
||||
|
||||
public CASTName copy() {
|
||||
@Override
|
||||
public CASTName copy() {
|
||||
return copy(CopyStyle.withoutLocations);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CASTName copy(CopyStyle style) {
|
||||
CASTName copy = new CASTName(name == null ? null : name.clone());
|
||||
copy.setOffsetAndLength(this);
|
||||
|
@ -61,7 +61,8 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
|||
return copy;
|
||||
}
|
||||
|
||||
public IBinding resolveBinding() {
|
||||
@Override
|
||||
public IBinding resolveBinding() {
|
||||
if (binding == null) {
|
||||
CVisitor.createBinding(this);
|
||||
}
|
||||
|
@ -69,19 +70,23 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
|||
return binding;
|
||||
}
|
||||
|
||||
public IBinding resolvePreBinding() {
|
||||
@Override
|
||||
public IBinding resolvePreBinding() {
|
||||
return resolveBinding();
|
||||
}
|
||||
|
||||
public IBinding getBinding() {
|
||||
@Override
|
||||
public IBinding getBinding() {
|
||||
return binding;
|
||||
}
|
||||
|
||||
public IBinding getPreBinding() {
|
||||
@Override
|
||||
public IBinding getPreBinding() {
|
||||
return binding;
|
||||
}
|
||||
|
||||
public IASTCompletionContext getCompletionContext() {
|
||||
@Override
|
||||
public IASTCompletionContext getCompletionContext() {
|
||||
IASTNode node = getParent();
|
||||
while (node != null) {
|
||||
if (node instanceof IASTCompletionContext) {
|
||||
|
@ -95,7 +100,8 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
|||
return null;
|
||||
}
|
||||
|
||||
public void setBinding(IBinding binding) {
|
||||
@Override
|
||||
public void setBinding(IBinding binding) {
|
||||
this.binding = binding;
|
||||
}
|
||||
|
||||
|
@ -107,14 +113,17 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
|||
return new String(name);
|
||||
}
|
||||
|
||||
public char[] toCharArray() {
|
||||
@Override
|
||||
public char[] toCharArray() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public char[] getSimpleID() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public char[] getLookupKey() {
|
||||
return name;
|
||||
}
|
||||
|
@ -146,6 +155,7 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getRoleOfName(boolean allowResolution) {
|
||||
IASTNode parent = getParent();
|
||||
if (parent instanceof IASTInternalNameOwner) {
|
||||
|
@ -157,7 +167,8 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
|||
return IASTNameOwner.r_unclear;
|
||||
}
|
||||
|
||||
public boolean isDeclaration() {
|
||||
@Override
|
||||
public boolean isDeclaration() {
|
||||
IASTNode parent = getParent();
|
||||
if (parent instanceof IASTNameOwner) {
|
||||
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
||||
|
@ -172,8 +183,8 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
public boolean isReference() {
|
||||
@Override
|
||||
public boolean isReference() {
|
||||
IASTNode parent = getParent();
|
||||
if (parent instanceof IASTNameOwner) {
|
||||
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
||||
|
@ -187,7 +198,8 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isDefinition() {
|
||||
@Override
|
||||
public boolean isDefinition() {
|
||||
IASTNode parent = getParent();
|
||||
if (parent instanceof IASTNameOwner) {
|
||||
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
||||
|
@ -201,10 +213,12 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILinkage getLinkage() {
|
||||
return Linkage.C_LINKAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinding[] findBindings(IASTName n, boolean isPrefix) {
|
||||
IASTNode parent = getParent();
|
||||
if (parent instanceof IASTElaboratedTypeSpecifier) {
|
||||
|
@ -247,6 +261,7 @@ public class CASTName extends ASTNode implements IASTName, IASTCompletionContext
|
|||
return (IBinding[])ArrayUtil.removeNulls(IBinding.class, bindings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTName getLastName() {
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* 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.internal.core.dom.parser.cpp;
|
||||
|
||||
|
@ -46,9 +46,9 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
|||
}
|
||||
}
|
||||
|
||||
private IBinding fBinding = null;
|
||||
private byte fResolutionDepth = 0;
|
||||
private boolean fIsFinal= false;
|
||||
private IBinding fBinding;
|
||||
private byte fResolutionDepth;
|
||||
private boolean fIsFinal;
|
||||
|
||||
public final void incResolutionDepth() {
|
||||
if (fBinding == null && ++fResolutionDepth > MAX_RESOLUTION_DEPTH) {
|
||||
|
@ -66,6 +66,7 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
|||
* Resolves the name at least up to the intermediate binding and returns it.
|
||||
* @see ICPPTwoPhaseBinding
|
||||
*/
|
||||
@Override
|
||||
public IBinding resolvePreBinding() {
|
||||
if (fBinding == null) {
|
||||
if (++fResolutionDepth > MAX_RESOLUTION_DEPTH) {
|
||||
|
@ -77,7 +78,8 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
|||
return fBinding;
|
||||
}
|
||||
|
||||
public IBinding resolveBinding() {
|
||||
@Override
|
||||
public IBinding resolveBinding() {
|
||||
if (fBinding == null) {
|
||||
if (++fResolutionDepth > MAX_RESOLUTION_DEPTH) {
|
||||
setBinding(new RecursionResolvingBinding(this));
|
||||
|
@ -105,7 +107,8 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
|||
* Otherwise the intermediate or final binding for this name is returned.
|
||||
* @see ICPPTwoPhaseBinding
|
||||
*/
|
||||
public IBinding getPreBinding() {
|
||||
@Override
|
||||
public IBinding getPreBinding() {
|
||||
return fBinding;
|
||||
}
|
||||
|
||||
|
@ -114,7 +117,8 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
|||
* Otherwise the final binding for this name is returned.
|
||||
* @see ICPPTwoPhaseBinding
|
||||
*/
|
||||
public IBinding getBinding() {
|
||||
@Override
|
||||
public IBinding getBinding() {
|
||||
final IBinding cand= fBinding;
|
||||
if (cand == null)
|
||||
return null;
|
||||
|
@ -137,11 +141,13 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
|||
fIsFinal= true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBinding(IBinding binding) {
|
||||
fBinding= binding;
|
||||
fResolutionDepth= 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTName getLastName() {
|
||||
return this;
|
||||
}
|
||||
|
@ -151,6 +157,7 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
|||
return new String(toCharArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IASTCompletionContext getCompletionContext() {
|
||||
IASTNode node = getParent();
|
||||
while (node != null) {
|
||||
|
@ -163,6 +170,7 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRoleOfName(boolean allowResolution) {
|
||||
IASTNode parent = getParent();
|
||||
if (parent instanceof IASTInternalNameOwner) {
|
||||
|
@ -174,7 +182,8 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
|||
return IASTNameOwner.r_unclear;
|
||||
}
|
||||
|
||||
public boolean isDeclaration() {
|
||||
@Override
|
||||
public boolean isDeclaration() {
|
||||
IASTNode parent = getParent();
|
||||
if (parent instanceof IASTNameOwner) {
|
||||
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
||||
|
@ -189,7 +198,8 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isReference() {
|
||||
@Override
|
||||
public boolean isReference() {
|
||||
IASTNode parent = getParent();
|
||||
if (parent instanceof IASTNameOwner) {
|
||||
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
||||
|
@ -198,7 +208,8 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isDefinition() {
|
||||
@Override
|
||||
public boolean isDefinition() {
|
||||
IASTNode parent = getParent();
|
||||
if (parent instanceof IASTNameOwner) {
|
||||
int role = ((IASTNameOwner) parent).getRoleForName(this);
|
||||
|
@ -207,9 +218,7 @@ public abstract class CPPASTNameBase extends ASTNode implements IASTName {
|
|||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTName#getLinkage()
|
||||
*/
|
||||
@Override
|
||||
public ILinkage getLinkage() {
|
||||
return Linkage.CPP_LINKAGE;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue