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 26601 Details for
Bug 108263
[1.5][compiler] Constants initilialization doesn't work inside Annotation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
patch_108263.txt (text/plain), 8.48 KB, created by
Olivier Thomann
on 2005-08-29 17:00:00 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2005-08-29 17:00:00 EDT
Size:
8.48 KB
patch
obsolete
>Index: compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java,v >retrieving revision 1.74 >diff -u -r1.74 ConstructorDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java 28 Jul 2005 16:33:23 -0000 1.74 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java 29 Aug 2005 20:10:13 -0000 >@@ -418,9 +418,6 @@ > } > } > >- if (this.binding != null && this.binding.declaringClass.isAnnotationType()) { >- this.scope.problemReporter().annotationTypeDeclarationCannotHaveConstructor(this); >- } > // if null ==> an error has occurs at parsing time .... > if (this.constructorCall != null) { > // e.g. using super() in java.lang.Object >Index: compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java,v >retrieving revision 1.68 >diff -u -r1.68 FieldDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java 16 Aug 2005 07:39:34 -0000 1.68 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java 29 Aug 2005 20:10:13 -0000 >@@ -75,17 +75,6 @@ > this); > } > >- checkAnnotationField: { >- if (!this.binding.declaringClass.isAnnotationType()) >- break checkAnnotationField; >- if (this.initialization != null) { >- if (this.binding.type.isArrayType() && (this.initialization instanceof ArrayInitializer)) >- break checkAnnotationField; >- if (this.initialization.constant != NotAConstant) >- break checkAnnotationField; >- } >- initializationScope.problemReporter().annotationFieldNeedConstantInitialization(this); >- } > if (this.initialization != null) { > flowInfo = > this.initialization >Index: compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java,v >retrieving revision 1.105 >diff -u -r1.105 TypeDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java 5 Aug 2005 15:30:41 -0000 1.105 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java 29 Aug 2005 20:10:13 -0000 >@@ -289,10 +289,16 @@ > methods[i] = m; > } > } else { >- if (this.kind() == IGenericType.INTERFACE_DECL) { >- // report the problem and continue the parsing >- parser.problemReporter().interfaceCannotHaveConstructors( >- (ConstructorDeclaration) am); >+ switch(this.kind()) { >+ case IGenericType.INTERFACE_DECL : >+ // report the problem and continue the parsing >+ parser.problemReporter().interfaceCannotHaveConstructors( >+ (ConstructorDeclaration) am); >+ break; >+ case IGenericType.ANNOTATION_TYPE_DECL : >+ // report the problem and continue the parsing >+ parser.problemReporter().annotationTypeDeclarationCannotHaveConstructor( >+ (ConstructorDeclaration) am); > } > hasConstructor = true; > } >@@ -806,8 +812,11 @@ > if (fields == null) > return false; > >- if (kind() == IGenericType.INTERFACE_DECL) >- return true; // fields are implicitly statics >+ switch(this.kind()) { >+ case IGenericType.INTERFACE_DECL : >+ case IGenericType.ANNOTATION_TYPE_DECL : >+ return true; // fields are implicitly statics >+ } > for (int i = fields.length; --i >= 0;) { > FieldDeclaration field = fields[i]; > //need to test the modifier directly while there is no binding yet >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java,v >retrieving revision 1.122 >diff -u -r1.122 ClassScope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 19 Jul 2005 12:30:01 -0000 1.122 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 29 Aug 2005 20:10:13 -0000 >@@ -181,9 +181,11 @@ > int count = 0; > nextMember : for (int i = 0; i < size; i++) { > TypeDeclaration memberContext = referenceContext.memberTypes[i]; >- if (memberContext.kind() == IGenericType.INTERFACE_DECL) { >- problemReporter().nestedClassCannotDeclareInterface(memberContext); >- continue nextMember; >+ switch(memberContext.kind()) { >+ case IGenericType.INTERFACE_DECL : >+ case IGenericType.ANNOTATION_TYPE_DECL : >+ problemReporter().illegalLocalTypeDeclaration(memberContext); >+ continue nextMember; > } > ReferenceBinding type = localType; > // check that the member does not conflict with an enclosing type >@@ -232,12 +234,15 @@ > int count = 0; > nextMember : for (int i = 0; i < length; i++) { > TypeDeclaration memberContext = referenceContext.memberTypes[i]; >- if (memberContext.kind() == IGenericType.INTERFACE_DECL >- && sourceType.isNestedType() >- && sourceType.isClass() // no need to check for enum, since implicitly static >- && !sourceType.isStatic()) { >- problemReporter().nestedClassCannotDeclareInterface(memberContext); >- continue nextMember; >+ switch(memberContext.kind()) { >+ case IGenericType.INTERFACE_DECL : >+ case IGenericType.ANNOTATION_TYPE_DECL : >+ if (sourceType.isNestedType() >+ && sourceType.isClass() // no need to check for enum, since implicitly static >+ && !sourceType.isStatic()) { >+ problemReporter().illegalLocalTypeDeclaration(memberContext); >+ continue nextMember; >+ } > } > ReferenceBinding type = sourceType; > // check that the member does not conflict with an enclosing type >Index: compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java,v >retrieving revision 1.48 >diff -u -r1.48 RecoveredMethod.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java 7 Jul 2005 10:44:03 -0000 1.48 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java 29 Aug 2005 20:10:13 -0000 >@@ -214,13 +214,15 @@ > } > return methodBody.add(typeDeclaration, bracketBalanceValue, true); > } >- if (typeDeclaration.kind() == IGenericType.INTERFACE_DECL) { >- this.updateSourceEndIfNecessary(this.previousAvailableLineEnd(typeDeclaration.declarationSourceStart - 1)); >- if (this.parent == null) { >- return this; // ignore >- } >- // close the constructor >- return this.parent.add(typeDeclaration, bracketBalanceValue); >+ switch(typeDeclaration.kind()) { >+ case IGenericType.INTERFACE_DECL : >+ case IGenericType.ANNOTATION_TYPE_DECL : >+ this.updateSourceEndIfNecessary(this.previousAvailableLineEnd(typeDeclaration.declarationSourceStart - 1)); >+ if (this.parent == null) { >+ return this; // ignore >+ } >+ // close the constructor >+ return this.parent.add(typeDeclaration, bracketBalanceValue); > } > if (localTypes == null) { > localTypes = new RecoveredType[5]; >Index: compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java,v >retrieving revision 1.261 >diff -u -r1.261 ProblemReporter.java >--- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 12 Aug 2005 15:03:30 -0000 1.261 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 29 Aug 2005 20:10:14 -0000 >@@ -4075,15 +4075,6 @@ > location.sourceStart, > location.sourceEnd); > } >-public void nestedClassCannotDeclareInterface(TypeDeclaration typeDecl) { >- String[] arguments = new String[] {new String(typeDecl.name)}; >- this.handle( >- IProblem.CannotDefineInterfaceInLocalType, >- arguments, >- arguments, >- typeDecl.sourceStart, >- typeDecl.sourceEnd); >-} > public void noMoreAvailableSpaceForArgument(LocalVariableBinding local, ASTNode location) { > String[] arguments = new String[]{ new String(local.name) }; > this.handle(
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 108263
: 26601 |
26602