Index: .classpath
===================================================================
RCS file: /data/cvs/eclipse/org.eclipse.jdt.core/.classpath,v
retrieving revision 1.31
diff -u -r1.31 .classpath
--- .classpath 13 Feb 2004 21:08:44 -0000 1.31
+++ .classpath 13 Oct 2004 13:10:18 -0000
@@ -9,7 +9,7 @@
-
+
Index: compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java
===================================================================
RCS file: /data/cvs/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java,v
retrieving revision 1.24
diff -u -r1.24 AbstractVariableDeclaration.java
--- compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java 1 Jul 2004 09:31:52 -0000 1.24
+++ compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java 13 Oct 2004 13:10:18 -0000
@@ -35,6 +35,14 @@
return flowInfo;
}
+ public static final int FIELD = 1;
+ public static final int INITIALIZER = 2;
+ public static final int ENUM_CONSTANT = 3;
+ public static final int LOCAL_VARIABLE = 4;
+ public static final int PARAMETER = 5;
+ public static final int TYPE_PARAMETER = 6;
+
+
/**
* @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#genericTypeArguments()
*/
@@ -56,6 +64,10 @@
return false;
}
+ /**
+ * Returns the constant kind of this variable declaration
+ */
+ public abstract int kind();
public StringBuffer printStatement(int indent, StringBuffer output) {
Index: compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java
===================================================================
RCS file: /data/cvs/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java,v
retrieving revision 1.38
diff -u -r1.38 Argument.java
--- compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java 6 Jul 2004 11:15:03 -0000 1.38
+++ compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java 13 Oct 2004 13:10:18 -0000
@@ -65,6 +65,13 @@
this.binding.useFlag = used ? LocalVariableBinding.USED : LocalVariableBinding.UNUSED;
}
+ /**
+ * @see org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration#kind()
+ */
+ public int kind() {
+ return PARAMETER;
+ }
+
public StringBuffer print(int indent, StringBuffer output) {
printIndent(indent, output);
Index: compiler/org/eclipse/jdt/internal/compiler/ast/EnumConstant.java
===================================================================
RCS file: /data/cvs/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EnumConstant.java,v
retrieving revision 1.3
diff -u -r1.3 EnumConstant.java
--- compiler/org/eclipse/jdt/internal/compiler/ast/EnumConstant.java 25 Jul 2004 01:53:01 -0000 1.3
+++ compiler/org/eclipse/jdt/internal/compiler/ast/EnumConstant.java 13 Oct 2004 13:10:18 -0000
@@ -11,24 +11,25 @@
package org.eclipse.jdt.internal.compiler.ast;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
-import org.eclipse.jdt.internal.compiler.CompilationResult;
-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.MethodScope;
import org.eclipse.jdt.internal.compiler.problem.AbortType;
/**
* Enum constant node
*/
-public class EnumConstant extends TypeDeclaration {
+public class EnumConstant extends FieldDeclaration {
public Expression[] arguments;
-
- public EnumConstant(CompilationResult compilationResult) {
- super(compilationResult);
- this.compilationResult = compilationResult;
+ public TypeDeclaration anonymousType;
+
+ public EnumConstant(
+ char[] name,
+ int sourceStart,
+ int sourceEnd) {
+
+ super(name, sourceStart, sourceEnd);
}
-
+
public StringBuffer print(int indent, StringBuffer output) {
output.append(name);
if (arguments != null) {
@@ -40,76 +41,17 @@
}
arguments[length - 1].print(0, output);
output.append(')');
+ }
+ if (anonymousType != null) {
+ anonymousType.print(indent, output);
}
- printBody(indent, output);
return output;
}
- /**
- * Iteration for a package member type
- *
- */
- public void traverse(
- ASTVisitor visitor,
- CompilationUnitScope unitScope) {
-
- if (ignoreFurtherInvestigation)
- return;
- try {
- if (visitor.visit(this, unitScope)) {
- if (this.annotations != null) {
- int annotationsLength = this.annotations.length;
- for (int i = 0; i < annotationsLength; i++)
- this.annotations[i].traverse(visitor, scope);
- }
- if (this.arguments != null) {
- int length = this.arguments.length;
- for (int i = 0; i < length; i++)
- this.arguments[i].traverse(visitor, scope);
- }
- if (this.memberTypes != null) {
- int length = this.memberTypes.length;
- for (int i = 0; i < length; i++)
- this.memberTypes[i].traverse(visitor, scope);
- }
- if (this.enums != null) {
- int length = this.enums.length;
- for (int i = 0; i < length; i++)
- this.enums[i].traverse(visitor, scope);
- }
- if (this.fields != null) {
- int length = this.fields.length;
- for (int i = 0; i < length; i++) {
- FieldDeclaration field;
- if ((field = this.fields[i]).isStatic()) {
- field.traverse(visitor, staticInitializerScope);
- } else {
- field.traverse(visitor, initializerScope);
- }
- }
- }
- if (this.methods != null) {
- int length = this.methods.length;
- for (int i = 0; i < length; i++)
- this.methods[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, unitScope);
- } catch (AbortType e) {
- // silent abort
- }
- }
-
- /**
- * Iteration for a local innertype
- *
- */
- public void traverse(ASTVisitor visitor, BlockScope blockScope) {
+ public void traverse(ASTVisitor visitor, MethodScope scope) {
- if (ignoreFurtherInvestigation)
- return;
try {
- if (visitor.visit(this, blockScope)) {
+ if (visitor.visit(this, scope)) {
if (this.annotations != null) {
int annotationsLength = this.annotations.length;
for (int i = 0; i < annotationsLength; i++)
@@ -120,87 +62,11 @@
for (int i = 0; i < length; i++)
this.arguments[i].traverse(visitor, scope);
}
- if (this.memberTypes != null) {
- int length = this.memberTypes.length;
- for (int i = 0; i < length; i++)
- this.memberTypes[i].traverse(visitor, scope);
- }
- if (this.enums != null) {
- int length = this.enums.length;
- for (int i = 0; i < length; i++)
- this.enums[i].traverse(visitor, scope);
- }
- if (this.fields != null) {
- int length = this.fields.length;
- for (int i = 0; i < length; i++) {
- FieldDeclaration field;
- if ((field = this.fields[i]).isStatic()) {
- field.traverse(visitor, staticInitializerScope);
- } else {
- field.traverse(visitor, initializerScope);
- }
- }
- }
- if (this.methods != null) {
- int length = this.methods.length;
- for (int i = 0; i < length; i++)
- this.methods[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, blockScope);
- } catch (AbortType e) {
- // silent abort
- }
- }
-
- /**
- * Iteration for a member innertype
- *
- */
- public void traverse(ASTVisitor visitor, ClassScope classScope) {
-
- if (ignoreFurtherInvestigation)
- return;
- try {
- if (visitor.visit(this, classScope)) {
- if (this.annotations != null) {
- int annotationsLength = this.annotations.length;
- for (int i = 0; i < annotationsLength; i++)
- this.annotations[i].traverse(visitor, scope);
- }
- if (this.arguments != null) {
- int length = this.arguments.length;
- for (int i = 0; i < length; i++)
- this.arguments[i].traverse(visitor, scope);
- }
- if (this.memberTypes != null) {
- int length = this.memberTypes.length;
- for (int i = 0; i < length; i++)
- this.memberTypes[i].traverse(visitor, scope);
- }
- if (this.enums != null) {
- int length = this.enums.length;
- for (int i = 0; i < length; i++)
- this.enums[i].traverse(visitor, scope);
- }
- if (this.fields != null) {
- int length = this.fields.length;
- for (int i = 0; i < length; i++) {
- FieldDeclaration field;
- if ((field = this.fields[i]).isStatic()) {
- field.traverse(visitor, staticInitializerScope);
- } else {
- field.traverse(visitor, initializerScope);
- }
- }
- }
- if (this.methods != null) {
- int length = this.methods.length;
- for (int i = 0; i < length; i++)
- this.methods[i].traverse(visitor, scope);
+ if (this.anonymousType != null) {
+ this.anonymousType.traverse(visitor, scope);
}
}
- visitor.endVisit(this, classScope);
+ visitor.endVisit(this, scope);
} catch (AbortType e) {
// silent abort
}
Index: compiler/org/eclipse/jdt/internal/compiler/ast/EnumDeclaration.java
===================================================================
RCS file: compiler/org/eclipse/jdt/internal/compiler/ast/EnumDeclaration.java
diff -N compiler/org/eclipse/jdt/internal/compiler/ast/EnumDeclaration.java
--- compiler/org/eclipse/jdt/internal/compiler/ast/EnumDeclaration.java 25 Jul 2004 01:53:01 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,242 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jdt.internal.compiler.ast;
-
-import org.eclipse.jdt.internal.compiler.CompilationResult;
-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.problem.AbortType;
-
-/**
- * Enum declaration
- */
-public class EnumDeclaration extends TypeDeclaration {
-
- public EnumConstant[] enumConstants;
-
- /**
- * @param compilationResult
- */
- public EnumDeclaration(CompilationResult compilationResult) {
- super(compilationResult);
- }
-
- public StringBuffer printBody(int indent, StringBuffer output) {
-
- output.append(" {"); //$NON-NLS-1$
- if (enumConstants != null) {
- int length = enumConstants.length;
- output.append('\n');
- for (int i = 0; i < length - 1; i++) {
- if (enumConstants[i] != null) {
- enumConstants[i].print(indent + 1, output);
- output.append(",\n");//$NON-NLS-1$
- }
- }
- enumConstants[length - 1].print(indent + 1, output);
- output.append("\n;\n");//$NON-NLS-1$
- }
- if (this.enums != null) {
- for (int i = 0; i < this.enums.length; i++) {
- if (this.enums[i] != null) {
- output.append('\n');
- this.enums[i].print(indent + 1, output);
- }
- }
- }
- if (memberTypes != null) {
- for (int i = 0; i < memberTypes.length; i++) {
- if (memberTypes[i] != null) {
- output.append('\n');
- memberTypes[i].print(indent + 1, output);
- }
- }
- }
- if (fields != null) {
- for (int fieldI = 0; fieldI < fields.length; fieldI++) {
- if (fields[fieldI] != null) {
- output.append('\n');
- fields[fieldI].print(indent + 1, output);
- }
- }
- }
- if (methods != null) {
- for (int i = 0; i < methods.length; i++) {
- if (methods[i] != null) {
- output.append('\n');
- methods[i].print(indent + 1, output);
- }
- }
- }
- output.append('\n');
- return printIndent(indent, output).append('}');
- }
-
- public void traverse(ASTVisitor visitor, BlockScope blockScope) {
-
- if (ignoreFurtherInvestigation)
- return;
- try {
- if (visitor.visit(this, blockScope)) {
- if (this.typeParameters != null) {
- int length = this.typeParameters.length;
- for (int i = 0; i < length; i++) {
- this.typeParameters[i].traverse(visitor, scope);
- }
- }
- if (this.superclass != null)
- this.superclass.traverse(visitor, scope);
- if (this.superInterfaces != null) {
- int length = this.superInterfaces.length;
- for (int i = 0; i < length; i++)
- this.superInterfaces[i].traverse(visitor, scope);
- }
- if (this.memberTypes != null) {
- int length = this.memberTypes.length;
- for (int i = 0; i < length; i++)
- this.memberTypes[i].traverse(visitor, scope);
- }
- if (this.enums != null) {
- int length = this.enums.length;
- for (int i = 0; i < length; i++) {
- this.enums[i].traverse(visitor, scope);
- }
- }
- if (this.fields != null) {
- int length = this.fields.length;
- for (int i = 0; i < length; i++) {
- FieldDeclaration field;
- if ((field = this.fields[i]).isStatic()) {
- field.traverse(visitor, staticInitializerScope);
- } else {
- field.traverse(visitor, initializerScope);
- }
- }
- }
- if (this.methods != null) {
- int length = methods.length;
- for (int i = 0; i < length; i++)
- this.methods[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, blockScope);
- } catch (AbortType e) {
- // silent abort
- }
- }
- public void traverse(ASTVisitor visitor, ClassScope classScope) {
-
- if (ignoreFurtherInvestigation)
- return;
- try {
- if (visitor.visit(this, classScope)) {
- if (this.typeParameters != null) {
- int typeParametersLength = this.typeParameters.length;
- for (int i = 0; i < typeParametersLength; i++) {
- this.typeParameters[i].traverse(visitor, scope);
- }
- }
- if (this.superclass != null)
- this.superclass.traverse(visitor, scope);
- if (this.superInterfaces != null) {
- int length = this.superInterfaces.length;
- for (int i = 0; i < length; i++)
- this.superInterfaces[i].traverse(visitor, scope);
- }
- if (this.memberTypes != null) {
- int length = this.memberTypes.length;
- for (int i = 0; i < length; i++)
- this.memberTypes[i].traverse(visitor, scope);
- }
- if (this.enums != null) {
- int length = this.enums.length;
- for (int i = 0; i < length; i++) {
- this.enums[i].traverse(visitor, scope);
- }
- }
- if (this.fields != null) {
- int length = this.fields.length;
- for (int i = 0; i < length; i++) {
- FieldDeclaration field;
- if ((field = this.fields[i]).isStatic()) {
- field.traverse(visitor, staticInitializerScope);
- } else {
- field.traverse(visitor, initializerScope);
- }
- }
- }
- if (this.methods != null) {
- int length = this.methods.length;
- for (int i = 0; i < length; i++)
- this.methods[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, classScope);
- } catch (AbortType e) {
- // silent abort
- }
- }
-
- public void traverse(ASTVisitor visitor, CompilationUnitScope unitScope) {
-
- if (ignoreFurtherInvestigation)
- return;
- try {
- if (visitor.visit(this, unitScope)) {
- if (this.typeParameters != null) {
- int length = this.typeParameters.length;
- for (int i = 0; i < length; i++) {
- this.typeParameters[i].traverse(visitor, scope);
- }
- }
- if (this.superclass != null)
- this.superclass.traverse(visitor, scope);
- if (this.superInterfaces != null) {
- int length = this.superInterfaces.length;
- for (int i = 0; i < length; i++)
- this.superInterfaces[i].traverse(visitor, scope);
- }
- if (this.memberTypes != null) {
- int length = this.memberTypes.length;
- for (int i = 0; i < length; i++)
- this.memberTypes[i].traverse(visitor, scope);
- }
- if (this.enums != null) {
- int length = this.enums.length;
- for (int i = 0; i < length; i++) {
- this.enums[i].traverse(visitor, scope);
- }
- }
- if (this.fields != null) {
- int length = this.fields.length;
- for (int i = 0; i < length; i++) {
- FieldDeclaration field;
- if ((field = this.fields[i]).isStatic()) {
- field.traverse(visitor, staticInitializerScope);
- } else {
- field.traverse(visitor, initializerScope);
- }
- }
- }
- if (this.methods != null) {
- int length = this.methods.length;
- for (int i = 0; i < length; i++)
- this.methods[i].traverse(visitor, scope);
- }
- }
- visitor.endVisit(this, unitScope);
- } catch (AbortType e) {
- // silent abort
- }
- }
-}
Index: compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java
===================================================================
RCS file: /data/cvs/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java,v
retrieving revision 1.47
diff -u -r1.47 FieldDeclaration.java
--- compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java 7 Jul 2004 10:32:49 -0000 1.47
+++ compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java 13 Oct 2004 13:10:18 -0000
@@ -17,6 +17,7 @@
import org.eclipse.jdt.internal.compiler.lookup.*;
public class FieldDeclaration extends AbstractVariableDeclaration {
+
public FieldBinding binding;
boolean hasBeenResolved = false;
public Javadoc javadoc;
@@ -126,6 +127,13 @@
if (this.binding != null)
return this.binding.isStatic();
return (this.modifiers & AccStatic) != 0;
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration#kind()
+ */
+ public int kind() {
+ return FIELD;
}
public void resolve(MethodScope initializationScope) {
Index: compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java
===================================================================
RCS file: /data/cvs/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java,v
retrieving revision 1.31
diff -u -r1.31 Initializer.java
--- compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java 13 Jan 2004 15:48:42 -0000 1.31
+++ compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java 13 Oct 2004 13:10:18 -0000
@@ -67,6 +67,13 @@
return (modifiers & AccStatic) != 0;
}
+ /**
+ * @see org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration#kind()
+ */
+ public int kind() {
+ return INITIALIZER;
+ }
+
public void parseStatements(
Parser parser,
TypeDeclaration typeDeclaration,
Index: compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java
===================================================================
RCS file: /data/cvs/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java,v
retrieving revision 1.33
diff -u -r1.33 LocalDeclaration.java
--- compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java 7 Jul 2004 10:32:49 -0000 1.33
+++ compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java 13 Oct 2004 13:10:19 -0000
@@ -131,6 +131,13 @@
codeStream.recordPositionsFrom(pc, this.sourceStart);
}
+ /**
+ * @see org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration#kind()
+ */
+ public int kind() {
+ return LOCAL_VARIABLE;
+ }
+
public void resolve(BlockScope scope) {
// create a binding and add it to the scope
Index: compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java
===================================================================
RCS file: /data/cvs/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java,v
retrieving revision 1.2
diff -u -r1.2 TypeParameter.java
--- compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java 1 Jul 2004 09:31:52 -0000 1.2
+++ compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java 13 Oct 2004 13:10:19 -0000
@@ -21,6 +21,13 @@
public TypeVariableBinding binding;
public TypeReference[] bounds;
+ /**
+ * @see org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration#kind()
+ */
+ public int kind() {
+ return TYPE_PARAMETER;
+ }
+
public void resolve(ClassScope scope) {
// TODO (philippe) add warning for detecting variable name collisions
}
Index: compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
===================================================================
RCS file: /data/cvs/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java,v
retrieving revision 1.172
diff -u -r1.172 ProblemReporter.java
--- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 6 Oct 2004 20:35:26 -0000 1.172
+++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 13 Oct 2004 13:10:19 -0000
@@ -2467,7 +2467,7 @@
annotationTypeDeclaration.sourceStart,
annotationTypeDeclaration.sourceEnd);
}
-public void invalidUsageOfEnumDeclarations(EnumDeclaration enumDeclaration) {
+public void invalidUsageOfEnumDeclarations(TypeDeclaration enumDeclaration) {
this.handle(
IProblem.InvalidUsageOfEnumDeclarations,
NoArgument,