Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 263364 Details for
Bug 104878
find declaring node from other compilation unit
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Patch to get AST for implicitly included java source
patch.txt (text/plain), 3.12 KB, created by
Kenneth Block
on 2016-07-28 14:20:20 EDT
(
hide
)
Description:
Patch to get AST for implicitly included java source
Filename:
MIME Type:
Creator:
Kenneth Block
Created:
2016-07-28 14:20:20 EDT
Size:
3.12 KB
patch
obsolete
>commit eac24a8793f606bd007a9766e82e462a5a6d3bef >Author: Ken Block <kblock@synopsys.com> >Date: Thu Jul 7 16:45:14 2016 -0400 > > Add ability to generated AST for impliciting include Java files. > >diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java >index 0ba08b1..611788a 100644 >--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java >+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java >@@ -89,6 +89,13 @@ class CompilationUnitResolver extends Compiler { > } > } > >+ // COVERITY: BEGIN >+ /* >+ * Used for callbacks when creating ASTs >+ */ >+ FileASTRequestor fileASTRequestor; >+ // COVERITY: END >+ > /* > * The sources that were requested. > * Map from file name (char[]) to org.eclipse.jdt.internal.compiler.env.ICompilationUnit. >@@ -174,6 +181,16 @@ class CompilationUnitResolver extends Compiler { > } > > public synchronized void accept(org.eclipse.jdt.internal.compiler.env.ICompilationUnit sourceUnit, AccessRestriction accessRestriction) { >+ >+ // COVERITY: BEGIN >+ // add implicit file to requested sources if requested >+ if ((this.fileASTRequestor != null) && >+ this.fileASTRequestor.requestImplicitCompilationUnit( >+ String.valueOf(sourceUnit.getFileName()))) { >+ this.requestedSources.put(sourceUnit.getFileName(), sourceUnit); >+ } >+ // COVERITY: END >+ > super.accept(sourceUnit, accessRestriction); > } > >@@ -976,6 +993,9 @@ class CompilationUnitResolver extends Compiler { > > // temporarily connect ourselves to the ASTResolver - must disconnect when done > astRequestor.compilationUnitResolver = this; >+ // COVERITY: BEGIN >+ this.fileASTRequestor = astRequestor; >+ // COVERITY: END > this.bindingTables = new DefaultBindingResolver.BindingTables(); > CompilationUnitDeclaration unit = null; > try { >@@ -1095,6 +1115,9 @@ class CompilationUnitResolver extends Compiler { > } finally { > // disconnect ourselves from ast requestor > astRequestor.compilationUnitResolver = null; >+ // COVERITY: BEGIN >+ this.fileASTRequestor = null; >+ // COVERITY: END > } > } > >diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FileASTRequestor.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FileASTRequestor.java >index 0a96f51..9c01f93 100644 >--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FileASTRequestor.java >+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FileASTRequestor.java >@@ -105,4 +105,20 @@ public abstract class FileASTRequestor { > } > return result; > } >+ >+ /** >+ * If additional compilation units are required to resolve the original >+ * ones, determine if the corresponding ASTs should be reported to the >+ * requestor. >+ * <p> >+ * The default implementation of this method returns false, the AST >+ * should not be reported to the requestor. Clients should override >+ * this to specify which ASTs they want. >+ * </p> >+ * >+ * @param sourceFilePath the compilation unit the given ast is coming from >+ */ >+ public boolean requestImplicitCompilationUnit(String sourceFilePath) { >+ return false; >+ } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 104878
: 263364