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 18261 Details for
Bug 86167
[1.5] Add support for package-info.java
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
First patch
patch_86167.txt (text/plain), 9.78 KB, created by
Olivier Thomann
on 2005-02-23 16:29:55 EST
(
hide
)
Description:
First patch
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2005-02-23 16:29:55 EST
Size:
9.78 KB
patch
obsolete
>Index: compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java,v >retrieving revision 1.36 >diff -u -r1.36 ASTNode.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java 23 Feb 2005 02:47:28 -0000 1.36 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java 23 Feb 2005 21:18:43 -0000 >@@ -390,7 +390,9 @@ > if (recipient != null) { > switch (recipient.kind()) { > case Binding.PACKAGE : >- // TODO (philippe) need support for package annotations >+ PackageBinding packageBinding = (PackageBinding) recipient; >+ if ((packageBinding.tagBits & TagBits.AnnotationResolved) != 0) return; >+ packageBinding.tagBits |= TagBits.AnnotationResolved; > break; > case Binding.TYPE : > case Binding.GENERIC_TYPE : >Index: compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java,v >retrieving revision 1.35 >diff -u -r1.35 Annotation.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java 23 Feb 2005 02:47:28 -0000 1.35 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java 23 Feb 2005 21:18:43 -0000 >@@ -237,7 +237,7 @@ > // tag bits onto recipient > switch (this.recipient.kind()) { > case Binding.PACKAGE : >- // TODO (philippe) need support for package annotations >+ ((PackageBinding)this.recipient).tagBits |= tagBits; > break; > case Binding.TYPE : > case Binding.GENERIC_TYPE : >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.41 >diff -u -r1.41 CompilationUnitDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java 23 Feb 2005 03:40:28 -0000 1.41 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java 23 Feb 2005 21:18:43 -0000 >@@ -175,6 +175,11 @@ > } > return; > } >+ if (this.currentPackage != null) { >+ if (this.currentPackage.annotations != null) { >+ types[0].annotations = this.currentPackage.annotations; >+ } >+ } > try { > if (types != null) { > for (int i = 0, count = types.length; i < count; i++) >@@ -274,7 +279,8 @@ > if (!CharOperation.endsWith(getFileName(), PACKAGE_INFO_FILE_NAME)) { > scope.problemReporter().invalidFileNameForPackageAnnotations(this.currentPackage.annotations[0]); > } >- // (TODO) resolve annotations >+ // resolve annotations >+ resolveAnnotations(types[0].staticInitializerScope, this.currentPackage.annotations, this.scope.fPackage); > } > } > try { >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java,v >retrieving revision 1.33 >diff -u -r1.33 PackageBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java 23 Feb 2005 02:47:30 -0000 1.33 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java 23 Feb 2005 21:18:44 -0000 >@@ -15,6 +15,8 @@ > import org.eclipse.jdt.internal.compiler.util.HashtableOfType; > > public class PackageBinding extends Binding implements TypeConstants { >+ public long tagBits = 0; // See values in the interface TagBits below >+ > public char[][] compoundName; > PackageBinding parent; > public LookupEnvironment environment; >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.284 >diff -u -r1.284 Parser.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 23 Feb 2005 02:47:58 -0000 1.284 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 23 Feb 2005 21:18:44 -0000 >@@ -39,6 +39,7 @@ > import org.eclipse.jdt.internal.compiler.util.Util; > > public class Parser implements ParserBasicInformation, TerminalTokens, CompilerModifiers, OperatorIds, TypeIds { >+ public static final char[] PACKAGE_INFO_NAME = "package-info".toCharArray(); //$NON-NLS-1$ > protected static final int THIS_CALL = ExplicitConstructorCall.This; > protected static final int SUPER_CALL = ExplicitConstructorCall.Super; > >@@ -183,7 +184,7 @@ > public JavadocParser javadocParser; > // used for recovery > protected int lastJavadocEnd; >- >+ > static { > try{ > initTables(); >@@ -3483,6 +3484,14 @@ > // InternalCompilationUnit ::= PackageDeclaration > // InternalCompilationUnit ::= PackageDeclaration ImportDeclarations ReduceImports > // InternalCompilationUnit ::= ImportDeclarations ReduceImports >+ if (this.astLengthPtr >= 0) { >+ int length; >+ if ((length = this.astLengthStack[this.astLengthPtr--]) != 0) { >+ this.compilationUnit.types = new TypeDeclaration[length]; >+ this.astPtr -= length; >+ System.arraycopy(this.astStack, this.astPtr + 1, this.compilationUnit.types, 0, length); >+ } >+ } > } > protected void consumeInternalCompilationUnitWithTypes() { > // InternalCompilationUnit ::= PackageDeclaration ImportDeclarations ReduceImports TypeDeclarations >@@ -3492,8 +3501,13 @@ > // consume type declarations > int length; > if ((length = this.astLengthStack[this.astLengthPtr--]) != 0) { >+ if (this.astLengthPtr >= 0) { >+ // check for the fake type package-info >+ length += this.astLengthStack[this.astLengthPtr--]; >+ } >+ this.compilationUnit.types = new TypeDeclaration[length]; > this.astPtr -= length; >- System.arraycopy(this.astStack, this.astPtr + 1, this.compilationUnit.types = new TypeDeclaration[length], 0, length); >+ System.arraycopy(this.astStack, this.astPtr + 1, this.compilationUnit.types, 0, length); > } > } > protected void consumeInvalidConstructorDeclaration() { >@@ -4221,6 +4235,11 @@ > length); > impt.declarationSourceStart = packageModifiersSourceStart; > intPtr--; // we don't need the position of the 'package keyword >+ // create a fake interface declaration >+ TypeDeclaration declaration = new TypeDeclaration(compilationUnit.compilationResult); >+ declaration.name = PACKAGE_INFO_NAME; >+ declaration.modifiers = AccDefault | AccInterface; >+ pushOnAstStack(declaration); > } else { > impt.declarationSourceStart = this.intStack[this.intPtr--]; > } >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.195 >diff -u -r1.195 ASTConverter.java >--- dom/org/eclipse/jdt/core/dom/ASTConverter.java 23 Feb 2005 02:47:27 -0000 1.195 >+++ dom/org/eclipse/jdt/core/dom/ASTConverter.java 23 Feb 2005 21:18:45 -0000 >@@ -20,6 +20,7 @@ > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.OperationCanceledException; > import org.eclipse.jdt.core.JavaCore; >+import org.eclipse.jdt.core.compiler.CharOperation; > import org.eclipse.jdt.core.compiler.IProblem; > import org.eclipse.jdt.core.compiler.InvalidInputException; > import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword; >@@ -45,6 +46,7 @@ > import org.eclipse.jdt.internal.compiler.env.IGenericType; > import org.eclipse.jdt.internal.compiler.lookup.BlockScope; > import org.eclipse.jdt.internal.compiler.lookup.CompilerModifiers; >+import org.eclipse.jdt.internal.compiler.parser.Parser; > import org.eclipse.jdt.internal.compiler.parser.Scanner; > import org.eclipse.jdt.internal.compiler.parser.TerminalTokens; > >@@ -1141,7 +1143,11 @@ > if (types != null) { > int typesLength = types.length; > for (int i = 0; i < typesLength; i++) { >- ASTNode type = convert(types[i]); >+ org.eclipse.jdt.internal.compiler.ast.TypeDeclaration declaration = types[i]; >+ if (CharOperation.equals(declaration.name, Parser.PACKAGE_INFO_NAME)) { >+ continue; >+ } >+ ASTNode type = convert(declaration); > if (type == null) { > compilationUnit.setFlags(compilationUnit.getFlags() | ASTNode.MALFORMED); > } else { >@@ -2200,6 +2206,9 @@ > } > if (statement instanceof org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) { > ASTNode result = convert((org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) statement); >+ if (result == null) { >+ return createFakeEmptyStatement(statement); >+ } > switch(result.getNodeType()) { > case ASTNode.ENUM_DECLARATION: > switch(this.ast.apiLevel) { >Index: model/org/eclipse/jdt/internal/compiler/SourceElementParser.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java,v >retrieving revision 1.41 >diff -u -r1.41 SourceElementParser.java >--- model/org/eclipse/jdt/internal/compiler/SourceElementParser.java 23 Feb 2005 02:47:29 -0000 1.41 >+++ model/org/eclipse/jdt/internal/compiler/SourceElementParser.java 23 Feb 2005 21:18:45 -0000 >@@ -765,6 +765,10 @@ > notifySourceElementRequestor(importRef, false); > } > } else { // instanceof TypeDeclaration >+ TypeDeclaration typeDeclaration = (TypeDeclaration) node; >+ if (CharOperation.equals(typeDeclaration.name, Parser.PACKAGE_INFO_NAME)) { >+ continue; >+ } > notifySourceElementRequestor((TypeDeclaration)node, sourceType == null, null); > } > }
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 86167
:
18261
|
18292
|
18609
|
18611
|
18649
|
19392