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 243416 Details for
Bug 435571
ImportReferencesCollector needs to support old AST levels
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Fix 1
eclipse.jdt.ui.patch (text/plain), 2.99 KB, created by
Markus Keller
on 2014-05-22 18:30:36 EDT
(
hide
)
Description:
Fix 1
Filename:
MIME Type:
Creator:
Markus Keller
Created:
2014-05-22 18:30:36 EDT
Size:
2.99 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui >diff --git core extension/org/eclipse/jdt/internal/corext/codemanipulation/ImportReferencesCollector.java core extension/org/eclipse/jdt/internal/corext/codemanipulation/ImportReferencesCollector.java >index f775ee0..94aecc4 100644 >--- core extension/org/eclipse/jdt/internal/corext/codemanipulation/ImportReferencesCollector.java >+++ core extension/org/eclipse/jdt/internal/corext/codemanipulation/ImportReferencesCollector.java >@@ -11,12 +11,15 @@ > package org.eclipse.jdt.internal.corext.codemanipulation; > > import java.util.Collection; >+import java.util.Iterator; > import java.util.List; > > import org.eclipse.jface.text.Region; > > import org.eclipse.jdt.core.IJavaProject; >+import org.eclipse.jdt.core.dom.AST; > import org.eclipse.jdt.core.dom.ASTNode; >+import org.eclipse.jdt.core.dom.AnnotatableType; > import org.eclipse.jdt.core.dom.ClassInstanceCreation; > import org.eclipse.jdt.core.dom.CompilationUnit; > import org.eclipse.jdt.core.dom.CreationReference; >@@ -200,17 +203,17 @@ > @Override > public boolean visit(SimpleType node) { > typeRefFound(node.getName()); >- doVisitChildren(node.annotations()); >+ visitAnnotations(node); > return false; > } >- >+ > /* > * @see ASTVisitor#visit(NameQualifiedType) > */ > @Override > public boolean visit(NameQualifiedType node) { > possibleTypeRefFound(node.getQualifier()); >- doVisitChildren(node.annotations()); >+ visitAnnotations(node); > return false; > } > >@@ -220,8 +223,14 @@ > @Override > public boolean visit(QualifiedType node) { > doVisitNode(node.getQualifier()); >- doVisitChildren(node.annotations()); >+ visitAnnotations(node); > return false; >+ } >+ >+ private void visitAnnotations(AnnotatableType node) { >+ if (node.getAST().apiLevel() >= AST.JLS8) { >+ doVisitChildren(node.annotations()); >+ } > } > > /* >@@ -420,18 +429,38 @@ > doVisitNode(node.getReturnType2()); > } > // name not visited >- doVisitNode(node.getReceiverType()); >+ >+ int apiLevel= node.getAST().apiLevel(); >+ if (apiLevel >= AST.JLS8) { >+ doVisitNode(node.getReceiverType()); >+ } > // receiverQualifier not visited: > // Enclosing class names cannot be shadowed by an import (qualification is always redundant). > doVisitChildren(node.parameters()); >- doVisitChildren(node.extraDimensions()); >- doVisitChildren(node.thrownExceptionTypes()); >+ if (apiLevel >= AST.JLS8) { >+ doVisitChildren(node.extraDimensions()); >+ doVisitChildren(node.thrownExceptionTypes()); >+ } else { >+ Iterator<Name> iter= getThrownExceptions(node).iterator(); >+ while (iter.hasNext()) { >+ typeRefFound(iter.next()); >+ } >+ } > if (!fSkipMethodBodies) { > doVisitNode(node.getBody()); > } > return false; > } > >+ /** >+ * @param decl method declaration >+ * @return thrown exception names >+ * @deprecated to avoid deprecation warnings >+ */ >+ private static List<Name> getThrownExceptions(MethodDeclaration decl) { >+ return decl.thrownExceptions(); >+ } >+ > @Override > public boolean visit(TagElement node) { > String tagName= node.getTagName();
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 435571
:
243416
|
243439