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 20251 Details for
Bug 83804
[1.5][javadoc] Missing Javadoc node for package declaration
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to implement this functionality
v02.txt (text/plain), 32.30 KB, created by
Frederic Fusier
on 2005-04-22 13:53:54 EDT
(
hide
)
Description:
Patch to implement this functionality
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2005-04-22 13:53:54 EDT
Size:
32.30 KB
patch
obsolete
>Index: codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java,v >retrieving revision 1.111 >diff -u -r1.111 SelectionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java 14 Apr 2005 13:15:38 -0000 1.111 >+++ codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java 22 Apr 2005 16:07:00 -0000 >@@ -637,7 +637,7 @@ > } > } > } >- if (parsedUnit.types != null) { >+ if (parsedUnit.types != null || parsedUnit.isPackageInfo()) { > if(selectDeclaration(parsedUnit)) > return; > this.lookupEnvironment.buildTypeBindings(parsedUnit, null /*no access restriction*/); >@@ -645,7 +645,9 @@ > try { > this.lookupEnvironment.completeTypeBindings(parsedUnit, true); > parsedUnit.scope.faultInTypes(); >- ASTNode node = parseBlockStatements(parsedUnit, selectionSourceStart); >+ ASTNode node = null; >+ if (parsedUnit.types != null) >+ node = parseBlockStatements(parsedUnit, selectionSourceStart); > if(DEBUG) { > System.out.println("SELECTION - AST :"); //$NON-NLS-1$ > System.out.println(parsedUnit.toString()); >Index: codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadoc.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadoc.java,v >retrieving revision 1.1 >diff -u -r1.1 SelectionJavadoc.java >--- codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadoc.java 18 Mar 2005 15:06:29 -0000 1.1 >+++ codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadoc.java 22 Apr 2005 16:07:00 -0000 >@@ -69,9 +69,19 @@ > * > * @throws SelectionNodeFound > */ >- public void resolve(ClassScope scope) { >+ private void internalResolve(Scope scope) { > if (this.selectedNode != null) { >- this.selectedNode.resolveType(scope); >+ switch (scope.kind) { >+ case Scope.COMPILATION_UNIT_SCOPE: >+ this.selectedNode.resolveType((CompilationUnitScope)scope); >+ break; >+ case Scope.CLASS_SCOPE: >+ this.selectedNode.resolveType((ClassScope)scope); >+ break; >+ case Scope.METHOD_SCOPE: >+ this.selectedNode.resolveType((MethodScope)scope); >+ break; >+ } > Binding binding = null; > if (this.selectedNode instanceof JavadocFieldReference) { > JavadocFieldReference fieldRef = (JavadocFieldReference) this.selectedNode; >@@ -108,37 +118,28 @@ > * > * @throws SelectionNodeFound > */ >+ public void resolve(ClassScope scope) { >+ internalResolve(scope); >+ } >+ >+ /** >+ * Resolve selected node if not null and throw exception to let clients know >+ * that it has been found. >+ * >+ * @throws SelectionNodeFound >+ */ >+ public void resolve(CompilationUnitScope scope) { >+ internalResolve(scope); >+ } >+ >+ /** >+ * Resolve selected node if not null and throw exception to let clients know >+ * that it has been found. >+ * >+ * @throws SelectionNodeFound >+ */ > public void resolve(MethodScope scope) { >- if (this.selectedNode != null) { >- this.selectedNode.resolveType(scope); >- Binding binding = null; >- if (this.selectedNode instanceof JavadocFieldReference) { >- JavadocFieldReference fieldRef = (JavadocFieldReference) this.selectedNode; >- binding = fieldRef.binding; >- if (binding == null && fieldRef.methodBinding != null) { >- binding = fieldRef.methodBinding; >- } >- } else if (this.selectedNode instanceof JavadocMessageSend) { >- binding = ((JavadocMessageSend) this.selectedNode).binding; >- } else if (this.selectedNode instanceof JavadocAllocationExpression) { >- binding = ((JavadocAllocationExpression) this.selectedNode).binding; >- } else if (this.selectedNode instanceof JavadocSingleNameReference) { >- binding = ((JavadocSingleNameReference) this.selectedNode).binding; >- } else if (this.selectedNode instanceof JavadocSingleTypeReference) { >- JavadocSingleTypeReference typeRef = (JavadocSingleTypeReference) this.selectedNode; >- if (typeRef.packageBinding == null) { >- binding = typeRef.resolvedType; >- } >- } else if (this.selectedNode instanceof JavadocQualifiedTypeReference) { >- JavadocQualifiedTypeReference typeRef = (JavadocQualifiedTypeReference) this.selectedNode; >- if (typeRef.packageBinding == null) { >- binding = typeRef.resolvedType; >- } >- } else { >- binding = this.selectedNode.resolvedType; >- } >- throw new SelectionNodeFound(binding); >- } >+ internalResolve(scope); > } > > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java,v >retrieving revision 1.45 >diff -u -r1.45 CompilationUnitDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java 1 Apr 2005 00:22:21 -0000 1.45 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java 22 Apr 2005 16:07:00 -0000 >@@ -36,6 +36,8 @@ > > public boolean isPropagatingInnerClassEmulation; > >+ public Javadoc javadoc; // 1.5 addition for package-info.java >+ > public CompilationUnitDeclaration( > ProblemReporter problemReporter, > CompilationResult compilationResult, >@@ -173,7 +175,7 @@ > } > return; > } >- if (this.isPackageInfo() && this.types != null) { >+ if (this.isPackageInfo() && this.types != null && this.currentPackage.annotations != null) { > types[0].annotations = this.currentPackage.annotations; > } > try { >@@ -217,8 +219,8 @@ > > public boolean isPackageInfo() { > return CharOperation.equals(this.getMainTypeName(), TypeConstants.PACKAGE_INFO_NAME) >- && this.currentPackage != null >- && this.currentPackage.annotations != null; >+ && this.currentPackage != null; >+// && this.currentPackage.annotations != null; > } > > public boolean hasErrors() { >@@ -278,8 +280,9 @@ > public void resolve() { > int startingTypeIndex = 0; > if (this.currentPackage != null) { >+ boolean packageInfo = CharOperation.equals(this.getMainTypeName(), TypeConstants.PACKAGE_INFO_NAME); > if (this.currentPackage.annotations != null) { >- if (CharOperation.equals(this.getMainTypeName(), TypeConstants.PACKAGE_INFO_NAME)) { >+ if (packageInfo) { > if (this.types != null) { > // resolve annotations > final TypeDeclaration syntheticTypeDeclaration = types[0]; >@@ -293,6 +296,12 @@ > scope.problemReporter().invalidFileNameForPackageAnnotations(this.currentPackage.annotations[0]); > } > } >+ // resolve javadoc package if any >+ if (this.javadoc != null) { >+ if (packageInfo) { >+ this.javadoc.resolve(this.scope); >+ } >+ } > } > try { > if (types != null) { >Index: compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java,v >retrieving revision 1.71 >diff -u -r1.71 Expression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java 11 Apr 2005 15:37:37 -0000 1.71 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java 22 Apr 2005 16:07:01 -0000 >@@ -782,12 +782,16 @@ > } > > public TypeBinding resolveType(BlockScope scope) { >- // by default... subclasses should implement a better TC if required. >+ // by default... subclasses should implement a better TB if required. >+ return null; >+ } > >+ public TypeBinding resolveType(ClassScope scope) { >+ // by default... subclasses should implement a better TB if required. > return null; > } > >- public TypeBinding resolveType(ClassScope classScope) { >+ public TypeBinding resolveType(CompilationUnitScope scope) { > // by default... subclasses should implement a better TB if required. > return null; > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java,v >retrieving revision 1.28 >diff -u -r1.28 Javadoc.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java 11 Apr 2005 14:53:17 -0000 1.28 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java 22 Apr 2005 16:07:01 -0000 >@@ -76,18 +76,29 @@ > * Resolve type javadoc while a class scope > */ > public void resolve(ClassScope classScope) { >+ internalResolve(classScope); >+ } >+ >+ /* >+ * Resolve type javadoc while a compilation unit scope >+ */ >+ public void resolve(CompilationUnitScope unitScope) { >+ internalResolve(unitScope); >+ } >+ >+ private void internalResolve(Scope scope) { > > // @param tags > int paramTagsSize = this.paramReferences == null ? 0 : this.paramReferences.length; > for (int i = 0; i < paramTagsSize; i++) { > JavadocSingleNameReference param = this.paramReferences[i]; >- classScope.problemReporter().javadocUnexpectedTag(param.tagSourceStart, param.tagSourceEnd); >+ scope.problemReporter().javadocUnexpectedTag(param.tagSourceStart, param.tagSourceEnd); > } >- resolveTypeParameterTags(classScope, true); >+ resolveTypeParameterTags(scope, true); > > // @return tags > if (this.returnStatement != null) { >- classScope.problemReporter().javadocUnexpectedTag(this.returnStatement.sourceStart, this.returnStatement.sourceEnd); >+ scope.problemReporter().javadocUnexpectedTag(this.returnStatement.sourceStart, this.returnStatement.sourceEnd); > } > > // @throws/@exception tags >@@ -107,13 +118,13 @@ > start = typeRef.sourceStart; > end = typeRef.sourceEnd; > } >- classScope.problemReporter().javadocUnexpectedTag(start, end); >+ scope.problemReporter().javadocUnexpectedTag(start, end); > } > > // @see tags > int seeTagsLength = this.seeReferences == null ? 0 : this.seeReferences.length; > for (int i = 0; i < seeTagsLength; i++) { >- resolveReference(this.seeReferences[i], classScope); >+ resolveReference(this.seeReferences[i], scope); > } > } > >@@ -217,10 +228,13 @@ > switch (scope.kind) { > case Scope.METHOD_SCOPE: > reference.resolveType((MethodScope)scope); >- break; >+ break; > case Scope.CLASS_SCOPE: > reference.resolveType((ClassScope)scope); >- break; >+ break; >+ case Scope.COMPILATION_UNIT_SCOPE: >+ reference.resolveType((CompilationUnitScope)scope); >+ break; > } > > // Verify field references >Index: compiler/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java,v >retrieving revision 1.19 >diff -u -r1.19 JavadocAllocationExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java 7 Mar 2005 14:11:54 -0000 1.19 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java 22 Apr 2005 16:07:01 -0000 >@@ -35,10 +35,18 @@ > this.constant = NotAConstant; > if (this.type == null) { > this.resolvedType = scope.enclosingSourceType(); >- } else if (scope.kind == Scope.CLASS_SCOPE) { >- this.resolvedType = this.type.resolveType((ClassScope)scope); > } else { >- this.resolvedType = this.type.resolveType((BlockScope)scope, true /* check bounds*/); >+ switch (scope.kind) { >+ case Scope.COMPILATION_UNIT_SCOPE: >+ this.resolvedType = this.type.resolveType((CompilationUnitScope)scope); >+ break; >+ case Scope.CLASS_SCOPE: >+ this.resolvedType = this.type.resolveType((ClassScope)scope); >+ break; >+ default: >+ this.resolvedType = this.type.resolveType((BlockScope)scope, true /* check bounds*/); >+ break; >+ } > } > > // buffering the arguments' types >@@ -71,7 +79,8 @@ > return null; > } > this.resolvedType = scope.convertToRawType(this.type.resolvedType); >- this.superAccess = scope.enclosingSourceType().isCompatibleWith(this.resolvedType); >+ SourceTypeBinding enclosingType = scope.enclosingSourceType(); >+ this.superAccess = enclosingType==null ? false : enclosingType.isCompatibleWith(this.resolvedType); > > ReferenceBinding allocationType = (ReferenceBinding) this.resolvedType; > this.binding = scope.getConstructor(allocationType, argumentTypes, this); >@@ -124,28 +133,22 @@ > if (isMethodUseDeprecated(this.binding, scope)) { > scope.problemReporter().javadocDeprecatedMethod(this.binding, this, scope.getDeclarationModifiers()); > } >- // TODO (frederic) add support for unsafe type operation warning > return allocationType; > } >- >- /* (non-Javadoc) >- * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#isSuperAccess() >- */ >+ > public boolean isSuperAccess() { > return this.superAccess; > } > >- /* (non-Javadoc) >- * @see org.eclipse.jdt.internal.compiler.ast.Expression#resolveType(org.eclipse.jdt.internal.compiler.lookup.BlockScope) >- */ > public TypeBinding resolveType(BlockScope scope) { > return internalResolveType(scope); > } > >- /* (non-Javadoc) >- * @see org.eclipse.jdt.internal.compiler.ast.Expression#resolveType(org.eclipse.jdt.internal.compiler.lookup.BlockScope) >- */ > public TypeBinding resolveType(ClassScope scope) { > return internalResolveType(scope); > } >+ >+ public TypeBinding resolveType(CompilationUnitScope scope) { >+ return internalResolveType(scope); >+ } > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java,v >retrieving revision 1.10 >diff -u -r1.10 JavadocArgumentExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java 23 Feb 2005 02:47:28 -0000 1.10 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java 22 Apr 2005 16:07:02 -0000 >@@ -82,7 +82,11 @@ > public TypeBinding resolveType(ClassScope scope) { > return internalResolveType(scope); > } >- >+ >+ public TypeBinding resolveType(CompilationUnitScope scope) { >+ return internalResolveType(scope); >+ } >+ > /* (non-Javadoc) > * Redefine to capture javadoc specific signatures > * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope) >Index: compiler/org/eclipse/jdt/internal/compiler/ast/JavadocFieldReference.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocFieldReference.java,v >retrieving revision 1.13 >diff -u -r1.13 JavadocFieldReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/JavadocFieldReference.java 23 Feb 2005 02:47:28 -0000 1.13 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/JavadocFieldReference.java 22 Apr 2005 16:07:02 -0000 >@@ -42,10 +42,18 @@ > this.constant = NotAConstant; > if (this.receiver == null) { > this.receiverType = scope.enclosingSourceType(); >- } else if (scope.kind == Scope.CLASS_SCOPE) { >- this.receiverType = this.receiver.resolveType((ClassScope) scope); > } else { >- this.receiverType = this.receiver.resolveType((BlockScope)scope); >+ switch (scope.kind) { >+ case Scope.COMPILATION_UNIT_SCOPE: >+ this.receiverType = this.receiver.resolveType((CompilationUnitScope) scope); >+ break; >+ case Scope.CLASS_SCOPE: >+ this.receiverType = this.receiver.resolveType((ClassScope) scope); >+ break; >+ default: >+ this.receiverType = this.receiver.resolveType((BlockScope)scope); >+ break; >+ } > } > if (this.receiverType == null) { > return null; >@@ -97,9 +105,6 @@ > return this.resolvedType = this.binding.type; > } > >- /* (non-Javadoc) >- * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#isSuperAccess() >- */ > public boolean isSuperAccess() { > return this.superAccess; > } >@@ -113,20 +118,18 @@ > return output; > } > >- /* (non-Javadoc) >- * @see org.eclipse.jdt.internal.compiler.ast.Expression#resolveType(org.eclipse.jdt.internal.compiler.lookup.BlockScope) >- */ > public TypeBinding resolveType(BlockScope scope) { > return internalResolveType(scope); > } > >- /* (non-Javadoc) >- * @see org.eclipse.jdt.internal.compiler.ast.Expression#resolveType(org.eclipse.jdt.internal.compiler.lookup.BlockScope) >- */ > public TypeBinding resolveType(ClassScope scope) { > return internalResolveType(scope); > } > >+ public TypeBinding resolveType(CompilationUnitScope scope) { >+ return internalResolveType(scope); >+ } >+ > /* (non-Javadoc) > * Redefine to capture javadoc specific signatures > * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope) >Index: compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java,v >retrieving revision 1.2 >diff -u -r1.2 JavadocImplicitTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java 23 Feb 2005 02:47:28 -0000 1.2 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java 22 Apr 2005 16:07:02 -0000 >@@ -13,6 +13,7 @@ > import org.eclipse.jdt.internal.compiler.ASTVisitor; > import org.eclipse.jdt.internal.compiler.lookup.BlockScope; > import org.eclipse.jdt.internal.compiler.lookup.ClassScope; >+import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope; > import org.eclipse.jdt.internal.compiler.lookup.Scope; > import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; > >@@ -56,7 +57,8 @@ > } > > /* >- * Resolves type on a Block or Class scope. >+ * Resolves type on a Block, Class or CompilationUnit scope. >+ * We need to modify resoling behavior to avoid raw type creation. > */ > private TypeBinding internalResolveType(Scope scope) { > // handle the error here >@@ -76,39 +78,26 @@ > return this.resolvedType; > } > >- /* (non-Javadoc) >- * Override super implementation to avoid raw type creation. >- * @see org.eclipse.jdt.internal.compiler.ast.TypeReference#resolveType(org.eclipse.jdt.internal.compiler.lookup.BlockScope, boolean) >- */ > public TypeBinding resolveType(BlockScope blockScope, boolean checkBounds) { > return internalResolveType(blockScope); > } > >- /* (non-Javadoc) >- * Override super implementation to avoid raw type creation. >- * @see org.eclipse.jdt.internal.compiler.ast.Expression#resolveType(org.eclipse.jdt.internal.compiler.lookup.ClassScope) >- */ > public TypeBinding resolveType(ClassScope classScope) { > return internalResolveType(classScope); > } > >- /* (non-Javadoc) >- * @see org.eclipse.jdt.internal.compiler.ast.TypeReference#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope) >- */ >+ public TypeBinding resolveType(CompilationUnitScope scope) { >+ return internalResolveType(scope); >+ } >+ > public void traverse(ASTVisitor visitor, BlockScope classScope) { > // Do nothing > } > >- /* (non-Javadoc) >- * @see org.eclipse.jdt.internal.compiler.ast.TypeReference#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.ClassScope) >- */ > public void traverse(ASTVisitor visitor, ClassScope classScope) { > // Do nothing > } > >- /* (non-Javadoc) >- * @see org.eclipse.jdt.internal.compiler.ast.Expression#printExpression(int, java.lang.StringBuffer) >- */ > public StringBuffer printExpression(int indent, StringBuffer output) { > return new StringBuffer(); > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java,v >retrieving revision 1.19 >diff -u -r1.19 JavadocMessageSend.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java 7 Mar 2005 14:11:54 -0000 1.19 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java 22 Apr 2005 16:07:02 -0000 >@@ -42,10 +42,18 @@ > this.constant = NotAConstant; > if (this.receiver == null) { > this.actualReceiverType = scope.enclosingSourceType(); >- } else if (scope.kind == Scope.CLASS_SCOPE) { >- this.actualReceiverType = this.receiver.resolveType((ClassScope) scope); > } else { >- this.actualReceiverType = this.receiver.resolveType((BlockScope) scope); >+ switch (scope.kind) { >+ case Scope.COMPILATION_UNIT_SCOPE: >+ this.actualReceiverType = this.receiver.resolveType((CompilationUnitScope) scope); >+ break; >+ case Scope.CLASS_SCOPE: >+ this.actualReceiverType = this.receiver.resolveType((ClassScope) scope); >+ break; >+ default: >+ this.actualReceiverType = this.receiver.resolveType((BlockScope) scope); >+ break; >+ } > } > > // will check for null after args are resolved >@@ -79,7 +87,8 @@ > return null; > } > this.actualReceiverType = scope.convertToRawType(this.receiver.resolvedType); >- this.superAccess = scope.enclosingSourceType().isCompatibleWith(this.actualReceiverType); >+ SourceTypeBinding enclosingType = scope.enclosingSourceType(); >+ this.superAccess = enclosingType==null ? false : enclosingType.isCompatibleWith(this.actualReceiverType); > > // base type cannot receive any message > if (this.actualReceiverType.isBaseType()) { >@@ -200,6 +209,10 @@ > return internalResolveType(scope); > } > >+ public TypeBinding resolveType(CompilationUnitScope scope) { >+ return internalResolveType(scope); >+ } >+ > /* (non-Javadoc) > * Redefine to capture javadoc specific signatures > * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#traverse(org.eclipse.jdt.internal.compiler.ASTVisitor, org.eclipse.jdt.internal.compiler.lookup.BlockScope) >Index: compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java,v >retrieving revision 1.12 >diff -u -r1.12 JavadocQualifiedTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java 23 Feb 2005 02:47:28 -0000 1.12 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java 22 Apr 2005 16:07:02 -0000 >@@ -47,7 +47,7 @@ > } > > /* >- * >+ * We need to modify resolving behavior to handle package references > */ > private TypeBinding internalResolveType(Scope scope, boolean checkBounds) { > // handle the error here >@@ -73,19 +73,15 @@ > return resolvedType; > } > >- /* (non-Javadoc) >- * @see org.eclipse.jdt.internal.compiler.ast.Expression#resolveType(org.eclipse.jdt.internal.compiler.lookup.BlockScope) >- * We need to override to handle package references >- */ > public TypeBinding resolveType(BlockScope blockScope, boolean checkBounds) { > return internalResolveType(blockScope, checkBounds); > } > >- /* (non-Javadoc) >- * @see org.eclipse.jdt.internal.compiler.ast.Expression#resolveType(org.eclipse.jdt.internal.compiler.lookup.ClassScope) >- * We need to override to handle package references >- */ > public TypeBinding resolveType(ClassScope classScope) { > return internalResolveType(classScope, false); > } >+ >+ public TypeBinding resolveType(CompilationUnitScope scope) { >+ return internalResolveType(scope, false); >+ } > } >Index: compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java,v >retrieving revision 1.13 >diff -u -r1.13 JavadocSingleTypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java 23 Feb 2005 02:47:28 -0000 1.13 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java 22 Apr 2005 16:07:02 -0000 >@@ -47,6 +47,9 @@ > visitor.endVisit(this, scope); > } > >+ /* >+ * We need to modify resolving behavior to handle package references >+ */ > TypeBinding internalResolveType(Scope scope) { > // handle the error here > this.constant = NotAConstant; >@@ -80,11 +83,11 @@ > return internalResolveType(blockScope); > } > >- /* (non-Javadoc) >- * @see org.eclipse.jdt.internal.compiler.ast.Expression#resolveType(org.eclipse.jdt.internal.compiler.lookup.ClassScope) >- * We need to override to handle package references >- */ > public TypeBinding resolveType(ClassScope classScope) { > return internalResolveType(classScope); > } >+ >+ public TypeBinding resolveType(CompilationUnitScope scope) { >+ return internalResolveType(scope); >+ } > } >Index: compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java,v >retrieving revision 1.297 >diff -u -r1.297 Parser.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 20 Apr 2005 21:43:51 -0000 1.297 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 22 Apr 2005 16:07:08 -0000 >@@ -4230,7 +4230,11 @@ > this.realBlockStack[this.realBlockPtr] = 0; > } > protected void consumePackageComment() { >- // do nothing >+ // get possible comment for syntax since 1.5 >+ if(options.sourceLevel >= ClassFileConstants.JDK1_5) { >+ checkComment(); >+ resetModifiers(); >+ } > } > protected void consumePackageDeclaration() { > // PackageDeclaration ::= 'package' Name ';' >@@ -4238,6 +4242,8 @@ > stored in the identifier stack. */ > > ImportReference impt = this.compilationUnit.currentPackage; >+ this.compilationUnit.javadoc = this.javadoc; >+ this.javadoc = null; > // flush comments defined prior to import statements > impt.declarationEnd = this.endStatementPosition; > impt.declarationSourceEnd = this.flushCommentsDefinedPriorTo(impt.declarationSourceEnd); >Index: dom/org/eclipse/jdt/core/dom/ASTConverter.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java,v >retrieving revision 1.204 >diff -u -r1.204 ASTConverter.java >--- dom/org/eclipse/jdt/core/dom/ASTConverter.java 13 Apr 2005 16:39:31 -0000 1.204 >+++ dom/org/eclipse/jdt/core/dom/ASTConverter.java 22 Apr 2005 16:07:12 -0000 >@@ -1124,6 +1124,13 @@ > this.compilationUnitSource = source; > this.scanner.setSource(unit.compilationResult); > CompilationUnit compilationUnit = new CompilationUnit(this.ast); >+ >+ // Parse comments >+ int[][] comments = unit.comments; >+ if (comments != null) { >+ buildCommentsTable(compilationUnit, comments); >+ } >+ > // handle the package declaration immediately > // There is no node corresponding to the package declaration > if (this.resolveBindings) { >@@ -1141,12 +1148,6 @@ > } > } > >- // Parse comments >- int[][] comments = unit.comments; >- if (comments != null) { >- buildCommentsTable(compilationUnit, comments); >- } >- > org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] types = unit.types; > if (types != null) { > int typesLength = types.length; >@@ -1744,6 +1745,29 @@ > } > } > } >+ >+ public void convert(org.eclipse.jdt.internal.compiler.ast.Javadoc javadoc, PackageDeclaration packageDeclaration) { >+ if (ast.apiLevel == AST.JLS3 && packageDeclaration.getJavadoc() == null) { >+ if (javadoc != null) { >+ if (this.commentMapper == null || !this.commentMapper.hasSameTable(this.commentsTable)) { >+ this.commentMapper = new DefaultCommentMapper(this.commentsTable); >+ } >+ Comment comment = this.commentMapper.getComment(javadoc.sourceStart); >+ if (comment != null && comment.isDocComment() && comment.getParent() == null) { >+ Javadoc docComment = (Javadoc) comment; >+ if (this.resolveBindings) { >+ recordNodes(docComment, javadoc); >+ // resolve member and method references binding >+ Iterator tags = docComment.tags().listIterator(); >+ while (tags.hasNext()) { >+ recordNodes(javadoc, (TagElement) tags.next()); >+ } >+ } >+ packageDeclaration.setJavadoc(docComment); >+ } >+ } >+ } >+ } > > public LabeledStatement convert(org.eclipse.jdt.internal.compiler.ast.LabeledStatement statement) { > LabeledStatement labeledStatement = new LabeledStatement(this.ast); >@@ -2621,6 +2645,8 @@ > if (this.resolveBindings) { > recordNodes(packageDeclaration, importReference); > } >+ // Set javadoc >+ convert(compilationUnitDeclaration.javadoc, packageDeclaration); > return packageDeclaration; > } > >Index: search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java,v >retrieving revision 1.237 >diff -u -r1.237 MatchLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 22 Apr 2005 15:23:04 -0000 1.237 >+++ search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 22 Apr 2005 16:07:15 -0000 >@@ -1380,24 +1380,28 @@ > > getMethodBodies(unit); > >- if (bindingsWereCreated && ((InternalSearchPattern)this.pattern).mustResolve && unit.types != null) { >- if (BasicSearchEngine.VERBOSE) >- System.out.println("Resolving " + this.currentPossibleMatch.openable.toStringWithAncestors()); //$NON-NLS-1$ >- >- reduceParseTree(unit); >- >- if (unit.scope != null) { >- // fault in fields & methods >- unit.scope.faultInTypes(); >+ boolean mustResolve = ((InternalSearchPattern)this.pattern).mustResolve; >+ if (bindingsWereCreated && mustResolve) { >+ if (unit.types != null) { >+ if (BasicSearchEngine.VERBOSE) >+ System.out.println("Resolving " + this.currentPossibleMatch.openable.toStringWithAncestors()); //$NON-NLS-1$ >+ >+ reduceParseTree(unit); >+ >+ if (unit.scope != null) { >+ // fault in fields & methods >+ unit.scope.faultInTypes(); >+ } >+ unit.resolve(); >+ } else if (unit.isPackageInfo()) { >+ if (BasicSearchEngine.VERBOSE) >+ System.out.println("Resolving " + this.currentPossibleMatch.openable.toStringWithAncestors()); //$NON-NLS-1$ >+ unit.resolve(); > } >- unit.resolve(); >- >- reportMatching(unit, true); >- } else { >- reportMatching(unit, ((InternalSearchPattern)this.pattern).mustResolve); > } >+ reportMatching(unit, mustResolve); > } catch (AbortCompilation e) { >- // could not resolve: report innacurate matches >+ // could not resolve: report inaccurate matches > reportMatching(unit, true); // was partially resolved > if (!(e instanceof AbortCompilationUnit)) { > // problem with class path >@@ -1853,6 +1857,26 @@ > if (nodeSet.matchingNodes.elementSize == 0) return; // no matching nodes were found > > boolean matchedUnitContainer = (this.matchContainer & PatternLocator.COMPILATION_UNIT_CONTAINER) != 0; >+ >+ // report references in javadoc >+ if (unit.javadoc != null) { >+ ASTNode[] nodes = nodeSet.matchingNodes(unit.javadoc.sourceStart, unit.javadoc.sourceEnd); >+ if (nodes != null) { >+ if (!matchedUnitContainer) { >+ for (int i = 0, l = nodes.length; i < l; i++) >+ nodeSet.matchingNodes.removeKey(nodes[i]); >+ } else { >+ IJavaElement element = createTypeHandle(new String(unit.getMainTypeName())); >+ for (int i = 0, l = nodes.length; i < l; i++) { >+ ASTNode node = nodes[i]; >+ Integer level = (Integer) nodeSet.matchingNodes.removeKey(node); >+ if (encloses(element)) >+ this.patternLocator.matchReportReference(node, element, null/*no binding*/, level.intValue(), this); >+ } >+ } >+ } >+ } >+ > if (matchedUnitContainer) { > // Currently a no-op > // ImportReference pkg = unit.currentPackage;
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 83804
: 20251