Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptff2004-07-01 09:32:04 +0000
committerptff2004-07-01 09:32:04 +0000
commitb4de16a0dc7d3ad9d6dd3c598e29125b9c3084c3 (patch)
treea983cca1d57d11d5975efe863d069eadbe497551 /org.eclipse.jdt.core
parent39e0b3c44033d41fbb2f81071d1364bb178092c7 (diff)
downloadeclipse.jdt.core-b4de16a0dc7d3ad9d6dd3c598e29125b9c3084c3.tar.gz
eclipse.jdt.core-b4de16a0dc7d3ad9d6dd3c598e29125b9c3084c3.tar.xz
eclipse.jdt.core-b4de16a0dc7d3ad9d6dd3c598e29125b9c3084c3.zip
HEAD - Merge back 1.5 stream content after R3_0_maintenance branch was created...v_449b_head_after_JDK15_merge
Diffstat (limited to 'org.eclipse.jdt.core')
-rw-r--r--org.eclipse.jdt.core/.project6
-rw-r--r--org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java117
-rw-r--r--org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties13
-rw-r--r--org.eclipse.jdt.core/buildnotes_jdt-core.html4619
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java136
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/ISelectionRequestor.java85
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java105
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionNodeDetector.java24
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnArgumentName.java4
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnFieldType.java12
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword1.java2
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMethodTypeParameter.java44
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnParameterizedQualifiedTypeReference.java131
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java2
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java10
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java550
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java343
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionNodeFound.java2
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnArgumentName.java4
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnParameterizedQualifiedTypeReference.java74
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedTypeReference.java2
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleTypeReference.java4
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java152
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CharOperation.java54
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java169
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java408
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java488
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/CompilationResult.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java28
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java18
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java10
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java101
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java38
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationTypeDeclaration.java283
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationTypeMemberDeclaration.java169
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java28
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java7
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java12
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java39
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java40
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java3
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java59
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java28
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java5
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java56
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java21
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java8
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java9
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java54
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java16
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EnumConstant.java42
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EnumDeclaration.java242
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java91
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java201
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java41
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java162
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java395
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImplicitDocTypeReference.java9
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImportReference.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java20
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java11
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArrayQualifiedTypeReference.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArraySingleTypeReference.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java16
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java16
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java37
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java42
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValueArrayInitializer.java40
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java67
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java151
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java21
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java84
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorExpression.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java274
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java208
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java90
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java273
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java18
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java18
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java17
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java69
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java107
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java31
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java14
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SynchronizedStatement.java8
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ThrowStatement.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java46
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java201
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java79
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java75
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java7
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java112
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java430
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/FieldInfo.java94
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java109
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java366
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java961
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/QualifiedNamesConstants.java30
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryField.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryMethod.java8
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryType.java10
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IConstants.java39
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceMethod.java10
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceType.java10
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java27
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java63
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java460
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java319
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java58
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilerModifiers.java40
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java9
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalTypeBinding.java60
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java284
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java107
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java10
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java107
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java19
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedFieldBinding.java33
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java204
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java85
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java756
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java20
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReasons.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java25
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java160
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java176
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java995
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SignatureWrapper.java68
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java636
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Substitution.java23
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticAccessMethodBinding.java19
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java46
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java85
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java16
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java16
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java198
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java55
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/VariableBinding.java1
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java315
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java6156
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java38
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java34
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java65
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java225
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java87
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rscbin12274 -> 22670 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser10.rscbin128 -> 258 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser11.rscbin128 -> 258 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rscbin128 -> 258 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rscbin128 -> 258 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rscbin640 -> 1210 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rscbin470 -> 918 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rscbin1196 -> 1858 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rscbin434 -> 667 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rscbin5790 -> 7918 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rscbin11406 -> 21336 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rscbin8526 -> 12558 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rscbin0 -> 5336 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rscbin1196 -> 1858 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rscbin2310 -> 3174 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rscbin1196 -> 1858 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rscbin570 -> 840 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rscbin212 -> 218 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rscbin408 -> 594 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rscbin11424 -> 15792 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.properties107
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java1193
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties146
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/messages.properties7
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java1
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java5474
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java20
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AbstractTypeDeclaration.java25
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationTypeDeclaration.java16
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingResolver.java10
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java8
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DocCommentParser.java4
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumDeclaration.java16
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java29
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclaration.java16
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java443
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java342
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java20
-rw-r--r--org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java58
-rw-r--r--org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetCodeStream.java9
-rw-r--r--org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetFieldReference.java57
-rw-r--r--org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java55
-rw-r--r--org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java6
-rw-r--r--org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetQualifiedNameReference.java263
-rw-r--r--org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java18
-rw-r--r--org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java45
-rw-r--r--org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java78
-rw-r--r--org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSkeleton.java16
-rw-r--r--org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSuperReference.java7
-rw-r--r--org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetThisReference.java6
-rw-r--r--org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java7
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java2
-rw-r--r--org.eclipse.jdt.core/grammar/java_1_5.g298
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/CompletionRequestorAdapter.java1
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/CorrectionEngine.java21
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICodeAssist.java2
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICompletionRequestor.java16
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java304
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java736
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ClassFormatException.java2
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotation.java2
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotationComponent.java6
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotationComponentValue.java6
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotationDefaultAttribute.java5
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IFieldInfo.java2
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IMethodInfo.java4
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java206
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/IDocumentElementRequestor.java3
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java227
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java456
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java16
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java238
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java65
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryType.java18
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java11
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java37
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java5
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java38
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompletionRequestorWrapper.java5
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java61
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementDeltaBuilder.java12
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java114
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java241
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/Member.java5
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java29
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SortElementBuilder.java16
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java59
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethod.java12
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethodElementInfo.java50
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceType.java27
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceTypeElementInfo.java51
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/TypeConverter.java3
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/UserLibraryManager.java54
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java35
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java3
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBinaryType.java3
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java24
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMBuilder.java4
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMImport.java8
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java10
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Annotation.java81
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/AnnotationComponent.java71
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/AnnotationComponentValue.java180
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/AnnotationDefaultAttribute.java51
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java184
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CodeAttribute.java129
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantValueAttribute.java10
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java7
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ElementInfoConverter.java3
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/EnclosingMethodAttribute.java103
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ExceptionAttribute.java9
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/FieldInfo.java86
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/HandleFactory.java4
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/InnerClassesAttribute.java5
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LineNumberAttribute.java31
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableAttribute.java28
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableTypeAttribute.java68
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableTypeTableEntry.java110
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java118
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ParameterAnnotation.java72
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleAnnotationsAttribute.java69
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleParameterAnnotationsAttribute.java68
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleAnnotationsAttribute.java68
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleParameterAnnotationsAttribute.java68
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SignatureAttribute.java49
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SourceFileAttribute.java9
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java2
-rw-r--r--org.eclipse.jdt.core/notes/R30_buildnotes_jdt-core.html4492
-rw-r--r--org.eclipse.jdt.core/plugin.xml2
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchEngine.java33
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java2
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AbstractIndexer.java17
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java8
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java8
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java21
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorLocator.java2
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java35
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java5
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java1
298 files changed, 31101 insertions, 13439 deletions
diff --git a/org.eclipse.jdt.core/.project b/org.eclipse.jdt.core/.project
index 07cb369916..5e05291262 100644
--- a/org.eclipse.jdt.core/.project
+++ b/org.eclipse.jdt.core/.project
@@ -3,11 +3,7 @@
<name>org.eclipse.jdt.core</name>
<comment></comment>
<projects>
- <project>org.apache.ant</project>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime.compatibility</project>
- <project>org.eclipse.team.core</project>
- <project>org.eclipse.text</project>
+ <project>org.eclipse.ant.core</project>
</projects>
<buildSpec>
<buildCommand>
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
index dc912ac84e..fcc60a80fc 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
@@ -385,6 +385,7 @@ public class Main implements ProblemSeverities, SuffixConstants {
boolean printUsageRequired = false;
boolean printVersionRequired = false;
+ boolean didSpecifySource = false;
boolean didSpecifyCompliance = false;
boolean didSpecifyDefaultEncoding = false;
boolean didSpecifyTarget = false;
@@ -545,6 +546,16 @@ public class Main implements ProblemSeverities, SuffixConstants {
mode = Default;
continue;
}
+ if (currentArg.equals("-1.5")) { //$NON-NLS-1$
+ if (didSpecifyCompliance) {
+ throw new InvalidInputException(
+ Main.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$
+ }
+ didSpecifyCompliance = true;
+ this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
+ mode = Default;
+ continue;
+ }
if (currentArg.equals("-d")) { //$NON-NLS-1$
if (this.destinationPath != null)
throw new InvalidInputException(
@@ -827,11 +838,19 @@ public class Main implements ProblemSeverities, SuffixConstants {
this.options.put(
CompilerOptions.OPTION_ReportUnnecessaryTypeCheck,
isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
+ } else if (token.equals("unsafe")) {//$NON-NLS-1$
+ this.options.put(
+ CompilerOptions.OPTION_ReportUnsafeTypeOperation,
+ isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
+ } else if (token.equals("finalBound")) {//$NON-NLS-1$
+ this.options.put(
+ CompilerOptions.OPTION_ReportFinalParameterBound,
+ isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
} else if (token.equals("unnecessaryElse")) {//$NON-NLS-1$
this.options.put(
CompilerOptions.OPTION_ReportUnnecessaryElse,
isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
- } else if (token.equals("javadoc")) {//$NON-NLS-1$
+ } else if (token.equals("javadoc")) {//$NON-NLS-1$
if (!useEnableJavadoc) {
this.options.put(
CompilerOptions.OPTION_DocCommentSupport,
@@ -940,6 +959,10 @@ public class Main implements ProblemSeverities, SuffixConstants {
continue;
}
if (mode == TargetSetting) {
+ if (didSpecifyTarget) {
+ throw new InvalidInputException(
+ Main.bind("configure.duplicateTarget", currentArg));//$NON-NLS-1$
+ }
didSpecifyTarget = true;
if (currentArg.equals("1.1")) { //$NON-NLS-1$
this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_1);
@@ -949,10 +972,16 @@ public class Main implements ProblemSeverities, SuffixConstants {
this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_3);
} else if (currentArg.equals("1.4")) { //$NON-NLS-1$
this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4);
- if (didSpecifyCompliance && CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_Compliance)) <= ClassFileConstants.JDK1_3) {
- throw new InvalidInputException(Main.bind("configure.incompatibleComplianceForTarget14", (String)this.options.get(CompilerOptions.OPTION_Compliance))); //$NON-NLS-1$
+ if (didSpecifyCompliance && CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_Compliance)) < ClassFileConstants.JDK1_4) {
+ throw new InvalidInputException(Main.bind("configure.incompatibleComplianceForTarget", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_4)); //$NON-NLS-1$
}
this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4);
+ } else if (currentArg.equals("1.5")) { //$NON-NLS-1$
+ this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
+ if (didSpecifyCompliance && CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_Compliance)) < ClassFileConstants.JDK1_5) {
+ throw new InvalidInputException(Main.bind("configure.incompatibleComplianceForTarget", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_5)); //$NON-NLS-1$
+ }
+ this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
} else {
throw new InvalidInputException(Main.bind("configure.targetJDK", currentArg)); //$NON-NLS-1$
}
@@ -990,10 +1019,17 @@ public class Main implements ProblemSeverities, SuffixConstants {
continue;
}
if (mode == InsideSource) {
+ if (didSpecifySource) {
+ throw new InvalidInputException(
+ Main.bind("configure.duplicateSource", currentArg));//$NON-NLS-1$
+ }
+ didSpecifySource = true;
if (currentArg.equals("1.3")) { //$NON-NLS-1$
this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_3);
} else if (currentArg.equals("1.4")) { //$NON-NLS-1$
this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4);
+ } else if (currentArg.equals("1.5")) { //$NON-NLS-1$
+ this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
} else {
throw new InvalidInputException(Main.bind("configure.source", currentArg)); //$NON-NLS-1$
}
@@ -1227,32 +1263,59 @@ public class Main implements ProblemSeverities, SuffixConstants {
} else if ("none".equals(this.destinationPath)) { //$NON-NLS-1$
this.destinationPath = null;
}
-
- // target must be 1.4 if source is 1.4
- if (CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_Source)) >= ClassFileConstants.JDK1_4
- && CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_TargetPlatform)) < ClassFileConstants.JDK1_4
- && didSpecifyTarget){
- throw new InvalidInputException(Main.bind("configure.incompatibleTargetForSource14", (String)this.options.get(CompilerOptions.OPTION_TargetPlatform))); //$NON-NLS-1$
+
+ if (didSpecifyCompliance) {
+ Object version = this.options.get(CompilerOptions.OPTION_Compliance);
+ if (CompilerOptions.VERSION_1_3.equals(version)) {
+ if (!didSpecifySource) this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_3);
+ if (!didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_1);
+ } else if (CompilerOptions.VERSION_1_4.equals(version)) {
+ if (!didSpecifySource) this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_3);
+ if (!didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_2);
+ } else if (CompilerOptions.VERSION_1_5.equals(version)) {
+ if (!didSpecifySource) this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
+ if (!didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
+ }
}
-
- // target cannot be 1.4 if compliance is 1.3
- if (CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_Compliance)) < ClassFileConstants.JDK1_4
- && CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_TargetPlatform)) >= ClassFileConstants.JDK1_4
- && didSpecifyTarget){
- throw new InvalidInputException(Main.bind("configure.incompatibleComplianceForTarget14", (String)this.options.get(CompilerOptions.OPTION_Compliance))); //$NON-NLS-1$
+ if (didSpecifySource) {
+ Object version = this.options.get(CompilerOptions.OPTION_Source);
+ if (CompilerOptions.VERSION_1_4.equals(version)) {
+ if (!didSpecifyCompliance) this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4);
+ if (!didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4);
+ } else if (CompilerOptions.VERSION_1_5.equals(version)) {
+ if (!didSpecifyCompliance) this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
+ if (!didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
+ }
}
-
+
// check and set compliance/source/target compatibilities
- if (this.options.get(CompilerOptions.OPTION_Source).equals(CompilerOptions.VERSION_1_4)){
- if (!didSpecifyCompliance) this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4);
- if (!didSpecifyTarget) this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4);
+ if (didSpecifyTarget) {
+ // target must be 1.5 if source is 1.5
+ if (CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_Source)) >= ClassFileConstants.JDK1_5
+ && CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_TargetPlatform)) < ClassFileConstants.JDK1_5){
+ throw new InvalidInputException(Main.bind("configure.incompatibleTargetForSource", (String)this.options.get(CompilerOptions.OPTION_TargetPlatform), CompilerOptions.VERSION_1_5)); //$NON-NLS-1$
+ }
+ // target must be 1.4 if source is 1.4
+ if (CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_Source)) >= ClassFileConstants.JDK1_4
+ && CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_TargetPlatform)) < ClassFileConstants.JDK1_4){
+ throw new InvalidInputException(Main.bind("configure.incompatibleTargetForSource", (String)this.options.get(CompilerOptions.OPTION_TargetPlatform), CompilerOptions.VERSION_1_4)); //$NON-NLS-1$
+ }
+ // target cannot be greater than compliance level
+ if (CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_Compliance)) < CompilerOptions.versionToJdkLevel(this.options.get(CompilerOptions.OPTION_TargetPlatform))){
+ throw new InvalidInputException(Main.bind("configure.incompatibleComplianceForTarget", (String)this.options.get(CompilerOptions.OPTION_Compliance), (String)this.options.get(CompilerOptions.OPTION_TargetPlatform))); //$NON-NLS-1$
+ }
}
- // compliance must be 1.4 if source is 1.4
- if (this.options.get(CompilerOptions.OPTION_Source).equals(CompilerOptions.VERSION_1_4)
+
+ // compliance must be 1.5 if source is 1.5
+ if (this.options.get(CompilerOptions.OPTION_Source).equals(CompilerOptions.VERSION_1_5)
+ && !this.options.get(CompilerOptions.OPTION_Compliance).equals(CompilerOptions.VERSION_1_5)){
+ throw new InvalidInputException(Main.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_5)); //$NON-NLS-1$
+ } else
+ // compliance must be 1.4 if source is 1.4
+ if (this.options.get(CompilerOptions.OPTION_Source).equals(CompilerOptions.VERSION_1_4)
&& !this.options.get(CompilerOptions.OPTION_Compliance).equals(CompilerOptions.VERSION_1_4)){
- throw new InvalidInputException(Main.bind("configure.incompatibleComplianceForSource14", (String)this.options.get(CompilerOptions.OPTION_Compliance))); //$NON-NLS-1$
+ throw new InvalidInputException(Main.bind("configure.incompatibleComplianceForSource", (String)this.options.get(CompilerOptions.OPTION_Compliance), CompilerOptions.VERSION_1_4)); //$NON-NLS-1$
}
-
// set default target according to compliance & sourcelevel.
if (!didSpecifyTarget) {
if (this.options.get(CompilerOptions.OPTION_Compliance).equals(CompilerOptions.VERSION_1_3)) {
@@ -1263,6 +1326,14 @@ public class Main implements ProblemSeverities, SuffixConstants {
} else if (this.options.get(CompilerOptions.OPTION_Source).equals(CompilerOptions.VERSION_1_4)) {
this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4);
}
+ } else if (this.options.get(CompilerOptions.OPTION_Compliance).equals(CompilerOptions.VERSION_1_5)) {
+ if (this.options.get(CompilerOptions.OPTION_Source).equals(CompilerOptions.VERSION_1_3)) {
+ this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_2);
+ } else if (this.options.get(CompilerOptions.OPTION_Source).equals(CompilerOptions.VERSION_1_4)) {
+ this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4);
+ } else if (this.options.get(CompilerOptions.OPTION_Source).equals(CompilerOptions.VERSION_1_5)) {
+ this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
+ }
}
}
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
index 2b042c0f76..f8b59b5209 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
@@ -12,7 +12,7 @@
### compiler
compiler.name = Eclipse Java Compiler
-compiler.version = 0.450
+compiler.version = 0.501
compiler.copyright = Copyright IBM Corp 2000, 2004. All rights reserved.
### scanning
@@ -40,6 +40,8 @@ configure.duplicateLog = duplicate log specification: {0}
configure.duplicateRepeat = duplicate repeat specification: {0}
configure.duplicateMaxProblems = duplicate max problems specification: {0}
configure.duplicateCompliance = duplicate compliance setting specification: {0}
+configure.duplicateSource = duplicate source compliance setting specification: {0}
+configure.duplicateTarget = duplicate target compliance setting specification: {0}
configure.source = invalid source option, source is either ''1.3'' or ''1.4'': {0}
configure.duplicateOutputPath = duplicate output path specification: {0}
configure.duplicateBootClasspath = duplicate bootclasspath specification: {0}
@@ -99,8 +101,9 @@ misc.usage = {compiler.name} {compiler.version}, {compiler.copyright}\n\
\ Compliance options:\n\
\ -1.3 use 1.3 compliance level (implicit -source 1.3 -target 1.1)\n\
\ -1.4 + use 1.4 compliance level (implicit -source 1.3 -target 1.2)\n\
-\ -source <version> set source level (1.3 or 1.4)\n\
-\ -target <version> set classfile target (1.1 to 1.4)\n\
+\ -1.5 use 1.5 compliance level (implicit -source 1.5 -target 1.5)\n\
+\ -source <version> set source level (1.3 to 1.5)\n\
+\ -target <version> set classfile target (1.1 to 1.5)\n\
\ \n\
\ Warning options:\n\
\ -deprecation + deprecation outside deprecated code\n\
@@ -118,6 +121,7 @@ misc.usage = {compiler.name} {compiler.version}, {compiler.copyright}\n\
\ deprecation + deprecation outside deprecated code\n\
\ emptyBlock undocumented empty block\n\
\ fieldHiding field hiding another variable\n\
+\ finalBound type parameter with final bound\n\
\ finally + finally block not completing normally\n\
\ indirectStatic indirect reference to static member\n\
\ intfNonInherited + interface non-inherited method compatibility\n\
@@ -129,6 +133,7 @@ misc.usage = {compiler.name} {compiler.version}, {compiler.copyright}\n\
\ pkgDefaultMethod + attempt to override package-default method\n\
\ semicolon unnecessary semicolon, empty statement\n\
\ unqualifiedField unqualified reference to field\n\
+\ unsafe + unsafe type operation\n\
\ unusedImport + unused import declaration\n\
\ unusedLocal unread local variable\n\
\ unusedPrivate unused private member declaration\n\
@@ -158,7 +163,7 @@ misc.usage = {compiler.name} {compiler.version}, {compiler.copyright}\n\
\ -time display speed information \n\
\ -noExit do not call System.exit(n) at end of compilation (n==0 if no error)\n\
\ -repeat <n> repeat compilation process <n> times for perf analysis\n\
-\ -inlineJSR inline JSR bytecode\n\
+\ -inlineJSR inline JSR bytecode (implicit if target >= 1.5)\n\
\ -enableJavadoc consider references in javadoc\n\
\ \n\
\ -? -help print this help message\n\
diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html
index 5d7dcedc29..6602ec55d8 100644
--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html
+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html
@@ -15,7 +15,7 @@
<table border=0 cellspacing=5 cellpadding=2 width="100%" >
<tr>
<td align=left width="72%">
- <font face="Verdana, Arial, Helvetica" size="+3"><b>jdt core - build notes 3.0 stream</b></font>
+ <font face="Verdana, Arial, Helvetica" size="+3"><b>jdt core - build notes 3.1 stream</b></font>
<br><font face="Arial, Helvetica, sans-serif" size="-2" color="#8080ff">java development tooling core</font></td>
</tr>
<tr><td>&nbsp;</td></tr>
@@ -25,4486 +25,311 @@
Here are the build notes for the Eclipse JDT/Core plug-in project
<a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/jdt-core-home/main.html"><b>org.eclipse.jdt.core</b></a>,
describing <a href="http://bugs.eclipse.org/bugs" target=new>bug</a> resolution and substantial changes in the <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core"><b>HEAD</b></a> branch.
- This present document covers all changes since Release 2.1 (also see a summary of <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.jdt.core/notes/API_changes.html">API changes</a>).
- Older changes which occurred up to Release 2.1 can be found in
- <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.jdt.core/notes/R21_buildnotes_jdt-core.html">build notes R2.1</a>.
+ This present document covers all changes since Release 3.0 (also see a summary of <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.jdt.core/notes/API_changes.html">API changes</a>).
+ Older changes which occurred up to Release 3.0 can be found in
+ <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.jdt.core/notes/R30_buildnotes_jdt-core.html">build notes R3.0</a>.
</font>
</td>
</tr>
</table>
-<a name="v_450"></a>
+<a name="v_501"></a>
<p><hr><h1>
Eclipse Platform Build Notes&nbsp;<br>
Java Development Tooling Core</h1>
-Eclipse SDK 3.0.1 Build - ?th June 2004
-<br>Project org.eclipse.jdt.core v_450
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_450">cvs</a>).
+Eclipse SDK 3.1 - ?th July 2004 - J2SE 1.5 Preview - Codename "Cheetah"
+<br>Project org.eclipse.jdt.core v_501 (Cheetah07)
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_501">cvs</a>).
<h2>
What's new in this drop</h2>
<ul>
</ul>
<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=68772">68772</a>
-IDOMMember.getComments() sometimes returns wrong results.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=68863">68863</a>
-Missing entry in local variable attribute
-
-
-<a name="v_449"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0RC4 Build - 24th June 2004 - 3.0 RELEASE CANDIDATE 4
-<br>Project org.eclipse.jdt.core v_449
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_449">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Fixed schema copyrights.</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44068">44068</a>
-[DOC] Need more project configuration tutorials
-
-<a name="v_448"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0RC4 Build - 24th June 2004
-<br>Project org.eclipse.jdt.core v_448
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_448">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Fixed mixed line delimiters.</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-
-<a name="v_447"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0RC4 Build - 23rd June 2004
-<br>Project org.eclipse.jdt.core v_447
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_447">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Copyright update to 2004.</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-
-<a name="v_446"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0RC4 Build - 22nd June 2004
-<br>Project org.eclipse.jdt.core v_446
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_446">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=67769">67769</a>
-Internal StackOverflowError occurred during project build
-
-<a name="v_445"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0RC3 Build - 18th June 2004 - 3.0 RELEASE CANDIDATE 3
-<br>Project org.eclipse.jdt.core v_445
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_445">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66898">66898</a>
-refactor-rename: encoding is not preserved
-
-<a name="v_444"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0RC3 Build - 18th June 2004
-<br>Project org.eclipse.jdt.core v_444
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_444">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=67297">67297</a>
-Renaming included package folder throws JME
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=67786">67786</a>
-OutOfMemoryError searching for reference to Object
-
-<a name="v_443"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0RC3 Build - 18th June 2004
-<br>Project org.eclipse.jdt.core v_443
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_443">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=67717">67717</a>
-NPE disassembling .class file
-
-<a name="v_442"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0RC3 Build - 17th June 2004
-<br>Project org.eclipse.jdt.core v_442
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_442">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=67600">67600</a>
-String Index out of bounds when searching for all types
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=67599">67599</a>
-NPE when cancelling search
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66271">66271</a>
-No need to resolve type names when selecting declaration
-
-<a name="v_441"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0RC3 Build - 16th June 2004
-<br>Project org.eclipse.jdt.core v_441
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_441">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=67324">67324</a>
-Package Explorer doesn't update included package after moving contents of source folder
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41434">41434</a>
-[msic] Slow Down using classes with many methods
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64646">64646</a>
-[Navigator] Navigator popup causes Eclipse to hang.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65186">65186</a>
-Can't attach source from project directory [build path]
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65831">65831</a>
-search for all types slow/memory intensive [search]
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66675">66675</a>
-Extra period in the doc in 200406110010
-
-<a name="v_440"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0RC2 Build - 10th June 2004 - 3.0 RELEASE CANDIDATE 2
-<br>Project org.eclipse.jdt.core v_440
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_440">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66551">66551</a>
-Error in org.eclipse.swt project on class PrinterData
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66573">66573</a>
-Shouldn't bind to local constructs
-
-<a name="v_439"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0RC2 Build - 10th June 2004
-<br>Project org.eclipse.jdt.core v_439
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_439">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66216">66216</a>
-Sort Members is broken.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66437">66437</a>
-Canceling search leads to broken workspace
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65266">65266</a>
-JarPackageFragmentInfo has unnecessary field
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66098">66098</a>
-MatchLocatorParser does not need advanced syntax diagnosis
-
-<a name="v_438"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0RC2 Build - 9th June 2004
-<br>Project org.eclipse.jdt.core v_438
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_438">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66026">66026</a>
-Large amount of garbage created by DefaultCommentMapper
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64646">64646</a>
-[Navigator] Navigator popup causes Eclipse to hang.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65288">65288</a>
-Javadoc: tag gets mangled when javadoc closing on same line without whitespace
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65253">65253</a>
-[Javadoc] @@tag is wrongly parsed as @tag
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65180">65180</a>
-Spurious "Javadoc: xxx cannot be resolved or is not a field" error with inner classes
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65174">65174</a>
-Spurious "Javadoc: Missing reference" error
-
-<a name="v_437"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0RC2 Build - 8th June 2004
-<br>Project org.eclipse.jdt.core v_437
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_437">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66142">66142</a>
-SearchParticipant#scheduleDocumentIndexing() fails silently if index doesn't exist
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65795">65795</a>
-source inclusion mechanism breaks type lookups
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66099">66099</a>
-Persisted container/variable values are leaked throughout a session
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65250">65250</a>
-Problem selection does not choose first n errors
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65259">65259</a>
-CodeSelect should only find one match for dup methods
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65737">65737</a>
-Strange completion by code assist
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65871">65871</a>
-Missing SUPER_INTERFACE_TYPES_PROPERTY in EnumDeclaration
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53072">53072</a>
-[DOC] Search for fully qualified constructor name reports nothing
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65116">65116</a>
-IProjectDescription.getBuildSpec copies commands
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65234">65234</a>
-Inclusion filter not working
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64657">64657</a>
-better documentation for IType#resolveType behavior
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65693">65693</a>
-Package Explorer shows .class files instead of .java
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64750">64750</a>
-NPE in Java AST Creation - editing some random file
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65562">65562</a>
-Java AST creation failure
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65531">65531</a>
-out of the box formatter settings need to be improved
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65677">65677</a>
-Creating hierarchy failed. See log for details. 0
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65090">65090</a>
-ASTParser with kind == K_STATEMENTS doesn't work unless source range specified
-
-<a name="v_436"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0RC1 Build - 28th May 2004 - 3.0 RELEASE CANDIDATE 1
-<br>Project org.eclipse.jdt.core v_436
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_436">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63534">63534</a>
-ConcurrentModificationException after "catching up"
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62131">62131</a>
-CodeStream should do bounds checks
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64470">64470</a>
-&lt;packages prefixes=..../&gt; should be removed
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64299">64299</a>
-NullPointerException when OverrideIndicatorLabelDecorator is decorating
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63550">63550</a>
-NPE "Java AST Creation"
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64421">64421</a>
-ArrayIndexOutOfBoundsException in PackageReferenceLocator.matchReportReference()
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62453">62453</a>
-Large File: Java builder not reacting on cancel
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64377">64377</a>
-CRASH: An internal error occurred during: "Java AST creation"
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64378">64378</a>
-Wording of error message
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64332">64332</a>
-Javadoc errors in non-API doc comments
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64329">64329</a>
-Missing Javadoc tags declaration in API methods
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64170">64170</a>
-Classpath reentrance protection is not thread-safe
-
-<a name="v_435"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0RC1 Build - 27th May 2004
-<br>Project org.eclipse.jdt.core v_435
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_435">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>API polish on search matches (org.eclipse.jdt.core.search.SearchMatch hierarchy):
-<ul>
-<li>added setters for all match properties (not just length & offset)</li>
-<li>add insideDocComment argument to PackageReferenceMatch constructor (for
-being consistent with other reference matches)</li>
-</ul>
-See bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62697">62697</a> for more details.
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62854">62854</a>
-refactoring does not trigger reconcile
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62697">62697</a>
-Need to know if a package reference match is in Javadoc or in Code
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63756">63756</a>
-multiple builds early
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63077">63077</a>
-IllegalArgumentException in Openable.codeSelect
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62861">62861</a>
-ArrayIndexOutOfBoundsException in SearchableEnvironment
-
-
-<a name="v_434"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0RC1 Build - 26th May 2004
-<br>Project org.eclipse.jdt.core v_434
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_434">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=56870">56870</a>
-copied file not shown in package explorer / java browser [ccp]
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63748">63748</a>
-Type Hierarchy: null pointer when pressing F4 on ListCellRenderer
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38839">38839</a>
-org.eclipse.jdt.internal.compiler.parser.Scanner throws thousands of Exceptions
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62869">62869</a>
-[navigation] 'Go to Next Annotation' doesn't find next error
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63871">63871</a>
-Using M9, -warn: option crashes the batch compiler
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63434">63434</a>
-NPE during checkout/build
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62737">62737</a>
-Code formatter doesn't work on some files
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62639">62639</a>
-[1.5] Cheetah and extending Vector
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62769">62769</a>
-Javadoc errors in 200405180816
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62952">62952</a>
-Ant adapter behavior is a little strange
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62704">62704</a>
-Using 05180816, //toto is a task if //toto is a task tag.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51660">51660</a>
-[DOM/AST] AST.parse* should handle all legal doc tags
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51606">51606</a>
-Javadoc - {@inheritDoc} should be inefficient when not in first text element
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62713">62713</a>
-should not be able to nest output folders [build path]
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63245">63245</a>
-findPackageFragment won't return default package
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62698">62698</a>
-NPE while searching for declaration of binary package
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61017">61017</a>
-Refactoring - test case that results in uncompilable source
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63044">63044</a>
-Reference to a constructor inside a javadoc should point to a type binding and not a constructor binding
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62812">62812</a>
-Some malformed javadoc tags are not reported as malformed
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62810">62810</a>
-Deadlock when closing editors and save
-
-
-<a name="v_433"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M9 Build - 21st May 2004 - 3.0 MILESTONE-9 / 3.0 RELEASE CANDIDATE 0
-<br>Project org.eclipse.jdt.core v_433
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_433">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>Put back test org.eclipse.jdt.core.tests.model.JavaElementDeltaTests.testBuildProjectUsedAsLib()
-after bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62927">62927</a> was fixed.
-</ul>
-
-<a name="v_432"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M9 Build - 20th May 2004
-<br>Project org.eclipse.jdt.core v_432
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_432">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>Excluded test org.eclipse.jdt.core.tests.model.JavaElementDeltaTests.testBuildProjectUsedAsLib()
-</ul>
-
-<a name="v_431"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M9 Build - 20th May 2004
-<br>Project org.eclipse.jdt.core v_431
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_431">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62881">62881</a>
-JDT/Core could be contributing a content type for JAR manifests
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58580">58580</a>
-VariableBinding.getVariableId() returns wrong IDs for nested types
-
-<a name="v_430"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M9 Build - 18th May 2004
-<br>Project org.eclipse.jdt.core v_430
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_430">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62608">62608</a>
-Include pattern ending with slash should include all subtree
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59933">59933</a>
-applying exclusion filter to opened java file makes it appear twice [build path]
-
-
-<a name="v_429"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M9 Build - 18th May 2004
-<br>Project org.eclipse.jdt.core v_429
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_429">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39499">39499</a>
-keyword completion does not work in anonymous inner classes
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59282">59282</a>
-Unable to include an external folder with class files to project classpath
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52422">52422</a>
-F3 can't find method def'n inside inner (anonymous) class
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62463">62463</a>
-Wrong length for ExpressionStatement after conversion
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61831">61831</a>
-Full build happens on every start of Eclipse
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62201">62201</a>
-NPE in MethodScope
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61872">61872</a>
-library looses content when setting source attachment
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54962">54962</a>
-plain reference to package not found in (@see) javadoc
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54424">54424</a>
-AST has structural problems with incomplete javadoc tags
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51951">51951</a>
-codeComplete finds no completion in method of local class inside static method
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50686">50686</a>
-NPE in MethodScope.createMethod
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61952">61952</a>
-Bad deprecation -- IJavaSearchConstants#CASE_SENSITIVE
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62068">62068</a>
-Index manager should use client's index location
-
-<a name="v_428"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M9 Build - 13th May 2004
-<br>Project org.eclipse.jdt.core v_428
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_428">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li> Due to an implementation cleanup, the optional diagnosis for unnecessary empty statement or empty control-flow
-statement, will be reverted to ignore by default. If you did set it differently in the past, you will have to manually
-set it back. We now conform to the spec for this option (until JDT/UI converted, the old option ID was
-incorrectly used: "org.eclipse.jdt.core.compiler.problem.superfluousSemicolon"):
-<pre>
-* COMPILER / Reporting Empty Statements and Unnecessary Semicolons
-* When enabled, the compiler will issue an error or a warning if an empty statement or a
-* unnecessary semicolon is encountered.
-* - option id: "org.eclipse.jdt.core.compiler.problem.emptyStatement"
-* - possible values: { "error", "warning", "ignore" }
-* - default: "ignore"
-</pre>
-</li>
-<li>Improved error location when type indirectly referenced from required .class files.</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61959">61959</a>
-dangerous practice of catching Throwable
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61882">61882</a>
-Inconsistency between build errors and reconcile errors
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35356">35356</a>
-Convert local variable to field refactoring proposes weird name
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53555">53555</a>
-SourceType#get*QualifiedName() methods return unusable/invalid names for local types
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48752">48752</a>
-Completion: relevance could be improved for non static field
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61877">61877</a>
-ClassCastException in DefaultBindingResolver
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59769">59769</a>
-Javadoc of SearchMatch#getElement(): is *enclosing* element
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58440">58440</a>
-type hierarchy incomplete when implementing fully qualified interface
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61719">61719</a>
-Incorrect fine grain delta after method copy-rename
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61075">61075</a>
-[Compiler] implementation uses numerous ArrayIndexOutOfBoundsException
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=19898">19898</a>
-StackOverflowError in BinaryExpression
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61706">61706</a>
-Improve error message when unbound reference from binaries
-
-<a name="v_427"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M9 Build - 11th May 2004
-<br>Project org.eclipse.jdt.core v_427
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_427">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>A system job now reports progress when the indexer is running.</li>
-<li>The org.eclipse.jdt.core.jdom package has been deprecated. The JDOM was made obsolete by
- the addition in 2.0 of the more powerful, fine-grained DOM/AST API found in the
- org.eclipse.jdt.core.dom package.</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60689">60689</a>
-AST on reconcile: AST without Javadoc comments created
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60365">60365</a>
-hierarchy view shows some interfaces as classes [type hierarchy]
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53290">53290</a>
-[Javadoc] Compiler should complain when tag name is not correct
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53279">53279</a>
-[Javadoc] Compiler should complain when inline tag is not terminated
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51600">51600</a>
-Javadoc: tags with errors are not stored in DOM AST Javadoc hierarchy
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59751">59751</a>
-No Feedback/information from indexing
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42402">42402</a>
-OuterClass.this does not appear in code assist of the InnerClass
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61390">61390</a>
-Indexing thread grabbing resource lock
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61408">61408</a>
-Incorrect parsing
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58859">58859</a>
-[encoding] Editor does not detect BOM on .txt files
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61148">61148</a>
-deprecate JDOM API
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61270">61270</a>
-Wrong delta when copying a package that overrides another package
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61181">61181</a>
-Task tag starting with double-/ (//) causes compile error
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61040">61040</a>
-Should add protect for reentrance to #getResolvedClasspath
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61214">61214</a>
-The classpath computation inside the Java builder should get rid of duplicates entries
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60867">60867</a>
-LocalVariableReferenceMatch should offer isReadAccess(), etc.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59638">59638</a>
-ConcurrentModificationException in JavaModelManager.saving
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61052">61052</a>
-Flatten cp container initialization
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60848">60848</a>
-[reconciling] Unclosed Comment in Java Texteditor
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60822">60822</a>
-Reacting to Project > Clean...
-
-<a name="v_426"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M9 Build - 4th May 2004
-<br>Project org.eclipse.jdt.core v_426
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_426">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Added new flag IJavaElementDelta.F_PRIMARY_RESOURCE that is set when the resource of a primary working copy
- changes (or when it is added or removed).</li>
-<li>Removed dependency on org.eclipse.runtime.compatibility.</li>
-<li>Tuned the diagnosis for unnecessary else statements to tolerate else-if constructs.</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60687">60687</a>
-NPE in JavaCore.getEncoding
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60581">60581</a>
-"Java AST creation" error.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48502">48502</a>
-Exception during "Java AST creation"
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59750">59750</a>
-DCR: Code Assist: Hook to add getter and setters
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47227">47227</a>
-Syntax error diagnosis shouldn't expose internal goal tokens
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60595">60595</a>
-AST: AST from reconcile does not have 'ORIGINAL' bit set
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59500">59500</a>
-Java Model Notification needs notification that a java class was physically saved
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60459">60459</a>
-AST: 'malformed' flag overwrites other flags
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60367">60367</a>
-dynamic project references not maintained
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60257">60257</a>
-SearchPattern API: R_CASE_SENSITIVE vs. boolean isCaseSensitive
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58565">58565</a>
-code formatter doesn't format blocks with a return statement correctly
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58724">58724</a>
-Java code formatter should add space between imports and class definition
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60418">60418</a>
-remove warnings from core runtime deprecations
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57749">57749</a>
-Search in working copies doesn't find all matches
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60235">60235</a>
-WorkingCopyOwner needs clarification on
-
-
-<a name="v_425"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M9 Build - 28th April 2004
-<br>Project org.eclipse.jdt.core v_425
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_425">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Added API to register/deregister a pre-processing resource change listener:
-<pre>
-/**
- * Adds the given listener for POST_CHANGE resource change events to the Java core.
- * The listener is guarantied to be notified of the POST_CHANGE resource change event before
- * the Java core starts processing the resource change event itself.
- *
- * Has no effect if an identical listener is already registered.
- *
- * @param listener the listener
- * @see #removePreResourceChangeListener(IResourceChangeListener)
- * @since 3.0
- */
-public static void addPreProcessingResourceChangedListener(IResourceChangeListener listener);
-
-/**
- * Removes the given pre-processing resource changed listener.
- *
- * Has no affect if an identical listener is not registered.
- *
- * @param listener the listener
- * @since 3.0
- */
-public static void removePreProcessingResourceChangedListener(IResourceChangeListener listener);
-</pre>
-</li>
-<li>When diagnostic for unnecessary semicolon is enabled, the compiler will also flag empty
-control-flow statement: e.g. if (bool);. Note that the naming of the option is going soon
-to be revised to better reflect this evolution.
-Empty control-flow statement problem ID is: <tt>IProblem.EmptyControlFlowStatement</tt>.
-</li>
-<li>Added compiler style option to report situation where a statement is unnecessarily nested
-in else clause, e.g.:
-<pre>
- if (bool)
- return;
- else
- System.out.println(); // no need to be inside else
-</pre>
-Associated problem ID is: <tt>IProblem.UnnecessaryElse</tt>.
-<pre>
-* COMPILER / Reporting Unnecessary Else
-* When enabled, the compiler will issue an error or a warning when a statement is unnecessarily
-* nested within an else clause (in situation where then clause is not completing normally).
-* - option id: "org.eclipse.jdt.core.compiler.problem.unnecessaryElse"
-* - possible values: { "error", "warning", "ignore" }
-* - default: "ignore"
-</pre>
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42493">42493</a>
-Error message when evaluating: Expressionopt?
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=32061">32061</a>
-No code assist in instance variable inner class
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49904">49904</a>
-[DCR] Quick Assist : unneeded else
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60081">60081</a>
-[Compiler] java.lang.VerifyError: Illegal target of jump or branch
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52805">52805</a>
-[DCR] Compiler should warn when using if (test);
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58652">58652</a>
-ImageBuilderInternalException during auto build
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60108">60108</a>
-SearchMatch should implement toString()
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60078">60078</a>
-NPE in ASTConverter
-
-<a name="v_424"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M9 Build - 27th April 2004
-<br>Project org.eclipse.jdt.core v_424
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_424">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54108">54108</a>
-Weird piece of source code in SourceTypeConverter.java
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51500">51500</a>
-[DOM AST] Quick fix "Add unimplemented methods" fails on static variable initialized using anonymous constructor
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59843">59843</a>
-Eclipse 3.0M8 generates ambiguous keys from ITypeBindings for nested classes with the same name
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59937">59937</a>
-Should not process saved state delta during startup
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58069">58069</a>
-Compilation ERROR: Missing code implementation in the compiler
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51911">51911</a>
-@see method w/out ()
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49025">49025</a>
-Util.bind(String, String[]) can be optimized a little bit
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59743">59743</a>
-[Compiler] Incorrect diagnosis of ambiguous method when inheriting
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57871">57871</a>
-Override Indicator: blocks editor from opening when error occurs in java compiler
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59421">59421</a>
-Bad error message from Eclipse Java Compiler when file is missing
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58946">58946</a>
-Standalone compiler help text is incorrect on Unix
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59084">59084</a>
-[content type] ensure content types/file associations are contributed by the right plugins
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59716">59716</a>
-Using 200404201300, one more blank line is inserted in front of import declarations when no package is defined
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59575">59575</a>
-invalid formatting
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51213">51213</a>
-Unable to resolve conflict between type and package name in binaries
-
-<a name="v_423"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M9 Build - 22nd April 2004
-<br>Project org.eclipse.jdt.core v_423
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_423">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59363">59363</a>
-Should surface cancellation exceptions
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51075">51075</a>
-Compiler warning "is hiding a field" given for static inner class
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38658">38658</a>
-Search for existing type fails
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59291">59291</a>
-Deadlock between AllTypes cache and setClasspathContainer
-
-
-<a name="v_422"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M9 Build - 20th April 2004
-<br>Project org.eclipse.jdt.core v_422
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_422">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Added API for User Library Container support in JavaCore:
-<pre>
-
-/**
- * Name of the User Library Container id.
- */
-public static final String USER_LIBRARY_CONTAINER_ID= "org.eclipse.jdt.USER_LIBRARY"; //$NON-NLS-1$
-
-/**
- * Returns the names of all defined user libraries. The corresponding classpath container path
- * is the name appended to the USER_LIBRARY_CONTAINER_ID.
- * @return Return an array containing the names of all known user defined.
- */
-public static String[] getUserLibraryNames();
-</pre>
-</li>
-<li>Added API to get classpath container comparison ID in ClasspathContainerInitializer:
-<pre>
-/**
- * Returns an object which identifies a container for comparison purpose. This allows
- * to eliminate redundant containers when accumulating classpath entries (e.g.
- * runtime classpath computation). When requesting a container comparison ID, one
- * should ensure using its corresponding container initializer. Indeed, a random container
- * initializer cannot be held responsible for determining comparison IDs for arbitrary
- * containers.
- * <p>
- * @param containerPath the path of the container which is being checked
- * @param project the project for which the container is to being checked
- * @return returns an Object identifying the container for comparison
- * @since 3.0
- */
-public Object getComparisonID(IPath containerPath, IJavaProject project);
-</pre>
-By default, containers are identical if they have same container path first segment
-but this may be refined by other container initializer implementations.
-<br>
-For example, the User Library classpath container initializer added for User Library Container API
-implementation (UserLibraryClasspathContainerInitializer) refines the comparison ID to the entire container path.
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52747">52747</a>
-formatter - please special case empty array init
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59000">59000</a>
-Code formatter struggles with end-of-line comments
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52679">52679</a>
-Code formatter formats braces in case and default statements, but no settings exist
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52940">52940</a>
-Formatter: Separate control of new lines in control statements by statement type
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47815">47815</a>
-Refactoring doesn't work with some project names [refactoring]
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37657">37657</a>
-[plan item] Improve code formatter
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50989">50989</a>
-Non-externalized strings wrap lines incorrectly
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57689">57689</a>
-ArrayIndexOutOfBoundsException when creating a new class
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55004">55004</a>
-[DCR] IVariableBinding should have a method returning the constant value
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58606">58606</a>
-Inner class in child calling protected method in parent
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55979">55979</a>
-There are still deprecated formatter constants without new way
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57117">57117</a>
-Ant adapter preserves all deprecation when using compiler arg even if deprecation is set to off
-
-<a name="v_421"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M9 Build - 13th April 2004
-<br>Project org.eclipse.jdt.core v_421
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_421">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57829">57829</a>
-Should optimize assert true case
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57294">57294</a>
-Ignore serialVersionUID hiding another field
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41395">41395</a>
-StackOverflowError when pasting code
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57414">57414</a>
-Summary: GB18030: Can not open Java Search dialog.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57886">57886</a>
-Concurrency issue while initializing containers and variables
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57858">57858</a>
-[Compiler] Marking a field deprecated still report deprecated usage #46973
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57743">57743</a>
-[Compiler] invalid byte code produced when catching Throwable
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57235">57235</a>
-DCR: AST Name.getQualifiedName()
-
-<a name="v_420"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M9 Build - 6th April 2004
-<br>Project org.eclipse.jdt.core v_420
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_420">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Added inclusion patterns support. See <code>JavaCore.newSourceEntry(IPath,IPath[],IPath[],IPath)</code>
- and <code>IClasspathEntry.getInclusionPatterns()</code> for details.</li>
-<li>Added API on WorkingCopyOwner to set the primary buffer provider (for internal use by the jdt-related plug-ins only).
-<pre>
-/**
- * Sets the buffer provider of the primary working copy owner. Note that even if the
- * buffer provider is a working copy owner, only its createBuffer(ICompilationUnit)
- * method is used by the primary working copy owner. It doesn't replace the internal primary
- * working owner.
- *
- * This method is for internal use by the jdt-related plug-ins.
- * Clients outside of the jdt should not reference this method.
- *
- * @param primaryBufferProvider the primary buffer provider
- */
-public static void setPrimaryBufferProvider(WorkingCopyOwner primaryBufferProvider);
-</pre></li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54009">54009</a>
-jardesc should be known to Team/File Content
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51867">51867</a>
-An anonymous type is missing in type hierarchy when editor is modified
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54763">54763</a>
-[Compiler] Unnecessary cast not detected
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52347">52347</a>
-NPE in LaunchingPlugin.shutdown
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55992">55992</a>
-AssertionFailed during preference import
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=29964">29964</a>
-Add inclusion filter
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55088">55088</a>
-IAE when using ICU.reconcile(GET_AST_TRUE, ...)
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=56462">56462</a>
-[formatter] java profile; array initializer before closing brace
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=56449">56449</a>
-Need to know if a reference match is in Javadoc or in Code
-
-<a name="v_419"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M9 Build - 30th March 2004
-<br>Project org.eclipse.jdt.core v_419
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_419">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Replaced "name" property of ParameterizedType node (DOM/AST)
-with "type" property. The old methods and fields (added earlier in 3.0 cycle)
-are deprecated and will be removed shortly.</li>
-<li>Added typeParameters property to ClassInstanceCreation node (DOM/AST).</li>
-<li>Package org.eclipse.jdt.core.internal.dom.rewrite renamed to org.eclipse.jdt.internal.core.dom.rewrite.</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=56316">56316</a>
-JavaProject exists should not populate
-
-<a name="v_418"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M8 Build - 25th March 2004 - 3.0 MILESTONE-8
-<br>Project org.eclipse.jdt.core v_418
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_418">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=68845">68845</a>
+[1.5] AST: AbstractTypeDeclaration should have resolveBinding
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66512">66512</a>
+Invalid classpath entry not rejected
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=67643">67643</a>
+[1.5] Incompatible conditional operand types
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=68981">68981</a>
+[1.5] NPE in code assist
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=68891">68891</a>
+[1.5] TypeVariableBinding does not know his declaring type or method
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=68862">68862</a>
+[1.5] ClassCastException when moving a a java file
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55930">55930</a>
-File encoding should be used on save
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55478">55478</a>
-Unused import not reported in IDE
-
-<a name="v_417"></a>
+<a name="v_500"></a>
<p><hr><h1>
Eclipse Platform Build Notes&nbsp;<br>
Java Development Tooling Core</h1>
-Eclipse SDK 3.0M8 Build - 24th March 2004
-<br>Project org.eclipse.jdt.core v_417
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_417">cvs</a>).
+Eclipse SDK 3.1 - 29th June 2004 - J2SE 1.5 Preview - Codename "Cheetah"
+<br>Project org.eclipse.jdt.core v_500 (Cheetah06)
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_500">cvs</a>).
<h2>
What's new in this drop</h2>
<ul>
-<li>Removed failing tests re: encoding support.
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-
-<a name="v_416"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M8 Build - 23rd March 2004
-<br>Project org.eclipse.jdt.core v_416
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_416">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55504">55504</a>
-@<tasktag> should not be reported
-
-<a name="v_415"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M8 Build - 23rd March 2004
-<br>Project org.eclipse.jdt.core v_415
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_415">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li> Added rewriting support to DOM AST.
-There are two set of API to perform rewriting.
-<ul>
-<li>An AST-modifying rewrite API<br>
-To use the AST-modifying rewrite the client must create an AST from an existing
-compilation unit (ASTParser#createAST(...)).
-Then the client need to start the record process of the AST changes (CompilationUnit#recordModifications())
-and modify the AST after. When modifications are done, the client can call a method to
-compute a text edit tree containing all the text changes (CompilationUnit#rewrite()).
-
-<pre>
-CompilationUnit
- public void recordModifications()
- public TextEdit rewrite(IDocument document, Map options) throws RewriteException
-</pre>
-</li>
-<li>A describing rewrite API<br>
-To use the describing AST rewrite, the client starts with creating an instance of NewASTRewrite. Then the client
-must not modify the AST directly but use NewASTRewrite instead. When modifications are done, the client can call
-a method to compute a text edit tree containing all the text changes (NewASTRewrite#rewrite()).
-<pre>
-NewASTRewrite
- public final void markAsRemoved(ASTNode node, TextEditGroup editGroup)
- public final void markAsReplaced(ASTNode node, ASTNode replacingNode, TextEditGroup editGroup)
- public ListRewriter getListRewrite(ASTNode parent, ChildListPropertyDescriptor childProperty)
- public TextEdit rewriteAST(IDocument document, Map options) throws RewriteException
- ...
-
-ListRewriter
- remove(ASTNode, TextEditGroup)
- public void replace(ASTNode, ASTNode, TextEditGroup)
- public void insertAfter(ASTNode, ASTNode, TextEditGroup)
- public void insertBefore(ASTNode, ASTNode, TextEditGroup)
- public void insertFirst(ASTNode, TextEditGroup)
- public void insertLast(ASTNode, TextEditGroup)
- public void insertAt(ASTNode, int, TextEditGroup)
- ...
-</pre>
-</li>
-</ul>
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39068">39068</a>
-Adopt new core API for encoding on a per file basis
-
-<a name="v_414"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M8 Build - 22nd March 2004
-<br>Project org.eclipse.jdt.core v_414
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_414">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46668">46668</a>
-Changes to class path containers should not change .project
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55421">55421</a>
-Cannot save a .java file in a non-java project anymore
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55223">55223</a>
-Bug in comment mapper: Same comment mapped to 2 statements
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54044">54044</a>
-Ant log does not use system newline character
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55372">55372</a>
-Should not assume that Preferences.defaultPropertyNames() returns default-default properties
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55221">55221</a>
-Bug in comment mapper: Grabs next node's Javadoc
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55102">55102</a>
-NPE when using ICU.reconcile(GET_AST_TRUE, ...)
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49986">49986</a>
-setRawClasspath(...) should fire a F_CLASSPATH_CHANGED delta
-
-<a name="v_413"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M8 Build - 15th March 2004
-<br>Project org.eclipse.jdt.core v_413
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_413">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li> Added compiler option JavaCore.COMPILER_TASK_CASE_SENSITIVE to control whether the task detection
-should be case sensitive or not. By default, it is.
-<pre>
- * COMPILER / Determine whether task tags are case-sensitive
- * When enabled, task tags are considered in a case-sensitive way.
- * - option id: "org.eclipse.jdt.core.compiler.taskCaseSensitive"
- * - possible values: { "enabled", "disabled" }
- * - default: "enabled"
-</pre>
-</li>
-<li> Added 2 default task tags: "FIXME" and "XXX".
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54776">54776</a>
-DefaultCommentMapper: different behaviour
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54431">54431</a>
-ASTParser should honor set compiler options in all cases
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54043">54043</a>
-Problems with type hierarchy for binary types
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53095">53095</a>
-I20040225: Won't accept breakpoint on NoClassDefFoundError
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54294">54294</a>
-No default for JavaCore.COMPILER_CODEGEN_INLINE_JSR_BYTECODE
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48435">48435</a>
-Java Search for OR-pattern finds too much in strange project setup
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40921">40921</a>
-Task tags should be case-insensitive
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49266">49266</a>
-FIXME task tag
-
-
-<a name="v_412"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M8 Build - 8th March 2004
-<br>Project org.eclipse.jdt.core v_412
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_412">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li> Added new global JavaCore.COMPILER_DOC_COMMENT_SUPPORT option for doc comment (Javadoc) support. By default, this option is enabled for backward compatibility.
-<pre>
- * COMPILER / Javadoc Comment Support
- * When this support is disabled, the compiler will ignore all javadoc problems options settings
- * and will not report any javadoc problem. It will also not find any reference in javadoc comment and
- * DOM AST Javadoc node will be only a flat text instead of having structured tag elements.
- * - option id: "org.eclipse.jdt.core.compiler.doc.comment.support"
- * - possible values: { "enabled", "disabled" }
- * - default: "enabled"
-</pre>
-See bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52264">52264</a>.
-</li>
-<li> Added new JavaCore.COMPILER_CODEGEN_INLINE_JSR_BYTECODE option to allow user to inline subroutine code instead of generating JSR instructions. By default, this option is disabled.
-<pre>
- * COMPILER / Inline JSR Bytecode Instruction
- * When enabled, the compiler will no longer generate JSR instructions, but rather inline corresponding
- * subroutine code sequences (mostly corresponding to try finally blocks). The generated code will thus
- * get bigger, but will load faster on virtual machines since the verification process is then much simpler.
- * This mode is anticipating support for the Java Specification Request 202.
- * - option id: "org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode"
- * - possible values: { "enabled", "disabled" }
- * - default: "disabled"
- *
-</pre>
-Corresponding command line compiler option <code>-noJSR</code> has been renamed to:
-<pre>
- <code>-inlineJSR</code> : inline JSR bytecode
-</pre>
-which means that when specified, the compiler will no longer generate JSR bytecodes, but instead inlining the corresponding subroutine (e.g. finally block).
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53757">53757</a>
-Javadoc tag @transient ignored
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=530757">53075</a>
-https://bugs.eclipse.org/bugs/show_bug.cgi?id=53075
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53357">53357</a>
-Java AST creation error
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52264">52264</a>
-Need a global preference to enable Javadoc support
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51529">51529</a>
-"Organize imports" is confused by references inside Javadoc
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53477">53477</a>
-AnonymousClassDeclaration has wrong range
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53624">53624</a>
-StackOverFlow in Code assist
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50433">50433</a>
-Rationalize signatures of AST.parse* methods
-
-<a name="v_411"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M8 Build - 3rd March 2004
-<br>Project org.eclipse.jdt.core v_411
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_411">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Added new constant <code>IJavaElementDelta.F_CLASSPATH_CHANGED</code> that indicates that
- the project's raw classpath has changed.
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49986">49986</a>
-setRawClasspath(...) should fire a F_CLASSPATH_CHANGED delta
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53242">53242</a>
-Consitent Out of Memory problems indexing (with multiple Java libraries)
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52474">52474</a>
-UI Blocked when opening Java Perspective during CVS check out
-
-<a name="v_410"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M8 Build - 2nd March 2004
-<br>Project org.eclipse.jdt.core v_410
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_410">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Added following APIs to <code>org.eclipse.jdt.core.dom.CompilationUnit</code>:
-<ul>
-<li><code>getCommentList()</code>: Returns a list of the comments encountered while parsing the compilation unit.</li>
-<li><code>getExtendedStartPosition(ASTNode)</code>: Returns the extended start position of the given node.</li>
-<li><code>getExtendedLength(ASTNode)</code>: Returns the extended source length of the given node.</li>
-</li>
-</ul>
-Unlike <code>ASTNode#getStartPosition()</code> and <code>ASTNode#getLength()</code>, the extended source range may include
-comments and whitespace immediately before or after the normal source range for the node.
-<br>
-See bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53445">53445</a> for more details on heuristic to find leading and trailing comments.
-</li>
-<li>Added API <code>FieldReferenceMatch.isReadAccess()</code> and <code>isWriteAccess()</code>.
-<li>Added API <code>JavaCore.run(IWorkspaceRunnable action, ISchedulingRule rule, IProgressMonitor monitor)</code>
- to control the scheduling rule during a Java batch operation.
-</li>
-<li>Added API <code>SearchEngine.createJavaSearchScope(IJavaElement[], int)</code> that allows to filter the
- classpath entries added in the scope: SOURCES, APPLICATION_LIBRARIES, SYSTEM_LIBRARIES and REQUIRED_PROJECTS.
-</li>
-<li> New command line options for batch compiler:
- <ul>
- <li> <code>-maxProblems &lt;n&gt;</code> : max number of problems per compilation unit (100 by default) </li>
- <li> <code>-noJSR</code> : do not use JSR bytecode </li>
- </ul>
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53445">53445</a>
-[DCR] [DOM Comments] Provide extended ranges including leading/trailing comments for AST nodes
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53276">53276</a>
-[DOM Comments] Wrong text element length when containing '\' character
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52908">52908</a>
-[DOM Comments] Wrong text element positions when starting/ending with { or }
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48337">48337</a>
-[Search] FieldReferenceMatch should report read/write access
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52691">52691</a>
-Add batch compiler option for maxProblemsPerUnit
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51045">51045</a>
-Offer to call JavaCore.run with scheduling rule
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52273">52273</a>
-Add option on predefined search scope to include/exclude system contain libraries
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49809">49809</a>
-NPE from MethodVerifier
-
-<a name="v_409"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M8 Build - 24th February 2004
-<br>Project org.eclipse.jdt.core v_409
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_409">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Added new API to create a DOM AST while reconciling
- <code>ICompilationUnit.reconcile(boolean, boolean, WorkingCopyOwner, IProgressMonitor)</code>.
-</li>
-<li>Removed compiler support for deprecating jsr bytecode in 1.5 compliant mode (turned off until future release).
-</li>
-<li>The constant DefaultCodeFormatterConstants.FORMATTER_PRESERVE_USER_LINEBREAKS will be removed. It has been deprecated for now and
-has no effect in the UI anymore.
+<li>From target 1.5 on, the JSR bytecode instruction is no longer generated. As a consequence, the
+ corresponding compiler option status will be ignored as soon as -target 1.5 is specified.
</li>
-<li>The constant DefaultCodeFormatterConstants.FORMATTER_FILLING_SPACE will be removed. It has been deprecated for now and
-has no effect in the UI anymore.
+<li>Batch compiler defaults to 1.5 source and target, when toggled in 1.5 compliant mode ("-1.5").
</li>
+<li>Added support for generics to JavaModel, thus enabling editor problem reconciling, outliner, type hierarchies. </li>
+<li>Improved codeassist and codeselect handling of generics </li>
</ul>
<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52916">52916</a>
-Strang error message when using jre1.5.0 libraries
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50586">50586</a>
-[Code Formatter] trim trailing blanks/whitespace
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52851">52851</a>
-Space before else should be removed in some cases
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52283">52283</a>
-do <single-statement> while(<condition>) is ill-formatted
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52479">52479</a>
-Code Format fails on not on-demand imports
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52246">52246</a>
-M7 Source formatter fails silently when assert present in source
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52429">52429</a>
-code formatter seems to ignore settings
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51623">51623</a>
-[formatter] Wrong formatting when "Preserve existing line breaks" switched on
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52305">52305</a>
-Code Formatter strips blank lines in methods and field definitions when I try to tell it not to
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52746">52746</a>
-Formatter - preserve line breaks conflicts with keep blank lines
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52804">52804</a>
-Deprecated formatter constant should indicate new way
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52619">52619</a>
-NPE running Java model tests
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36889">36889</a>
-[DCR] Keep AST created in reconcile for active editor
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52384">52384</a>
-OutOfMemoryError opening hierarchy on Object
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52355">52355</a>
-Not present exception trying to create a class in excluded package
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49809">49809</a>
-NPE from MethodVerifier
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=22104">22104</a>
-[infrastructure] NPE from IndexSummary.read(...)
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=31013">31013</a>
- [infrastructure] npe in index crash recovery
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=31014">31014</a>
-[infrastructure] exception in indexer
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51447">51447</a>
-[infrastructure] NPE running JDT Core tests
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52221">52221</a>
-[Compiler] should reject Local type usage when defined in other switch case block
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52216">52216</a>
-[regression in M7] javadoc: @see <a href> shows a warning
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51990">51990</a>
-'parameter' vs 'argument' in compiler errors/settings
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52012">52012</a>
-Special 'serialPersistentFields' marked as 'never used locally'
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51353">51353</a>
-The type AbstractStringBuilder is not visible
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49259">49259</a>
-Task tags starting with TODO don't correctly display their priority in Tasks View
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49879">49879</a>
-java.lang.ClassCastException (SourceTypeBinding to a BinaryTypeBinding) in 30M6 within jdt.core.dom.TypeBinding.getKey(TypeBinding.java:411)
-
-<a name="v_408"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M7 Build - 12th February 2004 - 3.0 MILESTONE-7
-<br>Project org.eclipse.jdt.core v_408
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_408">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51603">51603</a>
-[preferences] Code formatter line wrapping preference inconsistent preview behaviour
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51476">51476</a>
-Javadoc: String or URL @see references are not stored in DOM AST Javadoc structure
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51478">51478</a>
-Javadoc: @deprecated/@inheritDoc tags are not stored in DOM AST Javadoc structure
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51508">51508</a>
-Javadoc: Package references DOM AST nodes binding is null
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51626">51626</a>
-Javadoc - DOM/AST is not correct after a @see tag
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51650">51650</a>
-Incorrected deprecation check
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51770">51770</a>
-Javadoc AST Node: wrong binding on qualified name part
-
-
-<a name="v_407"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M7 Build - 11th February 2004
-<br>Project org.eclipse.jdt.core v_407
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_407">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Fixed most of the API Java doc comments.
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51659">51659</a>
-New Code Formatter: minor problem with "White spaces/Array Initializers" option
-
-
-<a name="v_406"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M7 Build - 10th February 2004
-<br>Project org.eclipse.jdt.core v_406
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_406">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51035">51035</a>
-[Formatter] endline comment in case of simple if-then statement
-
-
-<a name="v_405"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M7 Build - 9th February 2004
-<br>Project org.eclipse.jdt.core v_405
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_405">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51363">51363</a>
-Wrong comment positions inside the Scanner.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51201">51201</a>
-Code formatter missing 'between empty brackets' option in Whitespace Array allocation configuration
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50695">50695</a>
-Javadoc: package reference in @see tags is wrongly warned
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49994">49994</a>
-Strange matches with start=0, end=1 in type reference search
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51300">51300</a>
-VerifyError when using a array reference assigned to null
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51128">51128</a>
-[Code Formatter] Indent statements within blocks and methods
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51241">51241</a>
-IllegalArgumentException while creating a DOM/AST
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51249">51249</a>
-Performance problems in PackageFragment.getPath
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50276">50276</a>
-Function call line wrapping fails on chained calls
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51190">51190</a>
-comment after else block goes to next line
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51226">51226</a>
-Javadoc inside DOM AST does not support starting characters in unicode
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51104">51104</a>
-Comments are not recorded when inside a method body
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50858">50858</a>
-Javadoc IProblem constant not defined
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50898">50898</a>
-Javadoc AST: Missing binding for reference to non-visible type
-
-<a name="v_404"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M7 Build - 3rd February 2004
-<br>Project org.eclipse.jdt.core v_404
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_404">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50938">50938</a>
-Javadoc AST: Still invalid range for embedded tag
-
-<a name="v_403"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M7 Build - 3rd February 2004
-<br>Project org.eclipse.jdt.core v_403
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_403">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Updated porting guide to introduce search participant story (see <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.jdt.core/notes/porting_guide.html">porting guide</a>)</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51089">51089</a>
-Java AST creation failure
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50571">50571</a>
-search sender in hierarchy hangs
-
-<a name="v_402"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M7 Build - 30th January 2004
-<br>Project org.eclipse.jdt.core v_402
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_402">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50883">50883</a>
-Javadoc AST node: Range problem with embedded tags
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50884">50884</a>
-Compiler crashes without a trace in the log leaving workspace in unhappy state
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50831">50831</a>
-DCR Javadoc AST: Offer well known tag names as constants
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50880">50880</a>
-JavadocAST Nodes: Wrong ranges on link
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50877">50877</a>
-Javadoc AST Nodes: Wrong ranges
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47396">47396</a>
-JAVA AST Creation failure
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50844">50844</a>
-AbortCompilation thrown from Name#resolveBinding()
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50746">50746</a>
-Searching for variable references can cause an internal error
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50838">50838</a>
-Javadoc bindings: No bindings in constructor ref parameter
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50840">50840</a>
-Javadoc AST: wrong start position on MemberRef
-
-<a name="v_401"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M7 Build - 29th January 2004
-<br>Project org.eclipse.jdt.core v_401
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_401">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46126">46126</a>
-[DCR] IBinding should have a method to check @since javadoc tag
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50785">50785</a>
-Javadoc bindings: No bindings member refs
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50784">50784</a>
-Javadoc bindings: No binding in {@link } and link disturbs other bindings
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50781">50781</a>
-Javadoc bindings: No bindings for qualified names
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50736">50736</a>
-Out of bounds exception while formatting
-
-<a name="v_400"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M7 Build - 28th January 2004
-<br>Project org.eclipse.jdt.core v_400
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_400">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50694">50694</a>
-Javadoc: Cannot find DOM AST bindings for types in @see tags
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50692">50692</a>
-Javadoc: Cannot find DOM AST bindings for inline link tags references
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50719">50719</a>
-wrong formatting for java coding conventions
-
-<a name="v_399"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M7 Build - 27th January 2004
-<br>Project org.eclipse.jdt.core v_399
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_399">cvs</a>).
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=68837">68837</a>
+[1.5] AST: Missing source range in parameterized type
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=68133">68133</a>
+[1.5] VerifyError: Code segment has wrong length in class file
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=68863">68863</a>
+Missing entry in local variable attribute
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=68440">68440</a>
+[1.5] VerifyError with new for loop
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64159">64159</a>
+[1.5] call to addAll(Collection<? extends T>) incorrectly dissalowed
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=68602">68602</a>
+[1.5] AST converter fails on local types
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66424">66424</a>
+[1.5] Collections in new style for loop
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64417">64417</a>
+[1.5] NPE in SourceTypeBinding.resolveTypesFor
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=68730">68730</a>
+[1.5] No completion
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65953">65953</a>
+[1.5] Internal Compiler Error: ArrayIndexOutOfBoundsException
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58470">58470</a>
+[1.5] Source mapper fooled by generics
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64336">64336</a>
+[1.5] Signature does allow to create parameterized type signatures
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=68557">68557</a>
+[1.5] ArrayIndexOutOfBoundsException in SourceTypeConverter
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=68006">68006</a>
+[1.5] Invalid modifier after parse
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65503">65503</a>
+[1.5] "new" for-loop inside "old" for-loop gives error
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65870">65870</a>
+[1.5] AST creation fails when created with comments
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64301">64301</a>
+[1.5] Cast required where no cast should be required
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63556">63556</a>
+[1.5] Error when creating generic classes specializing distant generic parameters
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63590">63590</a>
+[1.5] Cheetah allows generic throws clause
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63555">63555</a>
+[1.5] Cannot put generic type fields inside static inner class
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58722">58722</a>
+[1.5] cannot extend interfaces
+
+
+<a name="v_429_Cheetah05"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Eclipse SDK 3.1 - 15th May 2004
+<br>Project org.eclipse.jdt.core v_429_Cheetah05
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_429_Cheetah05">cvs</a>).
<h2>
What's new in this drop</h2>
<ul>
-<li>Improve DOM/AST support for doc comments.
-<br>Following changes have been made to the DOM/AST API:
-<ul>
-<li>added Javadoc.tags() to represent structure of the doc comments</li>
-<li>deprecated Javadoc.get/setComment</li>
-<li>added 5 new node types that occur only within doc comments: TagElement, TextElement, MemberRef, MethodRef, MethodRefParameter</li>
-<li>tag elements like MemberRef, MethodRef, and Name can carry binding information (must be requested like elsewhere)</li>
-<li>added ASTVisitor(boolean) for controlling whether Javadoc.tags() are visited by default</li>
-<li>added ASTMatcher(boolean) for controlling whether Javadoc.tags() are compared vs. only Javadoc.getComment()</li>
-<li>AST.parse*(...) now returns structured doc comments (for compatibility, Javadoc.getComment() is also set as before)</li>
-</ul>
-See bugs <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50683">50683</a>.
-</li>
<li>
-Improve DOM/AST support for locating all comments.
-<br>Following changes have been made to the DOM/AST API:
-<ul>
-<li>added CompilationUnit.getCommentTable() to record locations of all comments found in the source</li>
-<li>added 2 new node types, LineComment and BlockComment, to represent end-of-line and traditional comments respectively</li>
-<li>these new nodes are placeholders for comments</li>
-<li>these new node types only occur in the comment table (since they can occur anywhere (lexically), there is no way to properly parent them in the regular AST nodes that reflects their position)</li>
-<li>AST.parse*(...) now returns sets the comment table on the compilation unit to include all comments (including attached and free-floating doc comments)</li>
-</ul>
-See bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50697">50697</a>.
-</li>
-<li> Added option to control whether diagnosis for unused thrown exceptions should be enabled when overriding another
-method. By default, it is disabled.
-<pre>
-* COMPILER / Reporting Unused Declared Thrown Exception in Overridind Method
-* When disabled, the compiler will not include overriding methods in its diagnosis for unused declared
-* thrown exceptions.
-* The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException".
-* - option id: "org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding"
-* - possible values: { "enabled", "disabled" }
-* - default: "disabled"
-</pre>
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50644">50644</a>
-Deprecation check doesn't check that the @deprecated is at the beginning of the line
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=27134">27134</a>
-Add a ASTNode for non-Javadoc comments
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50683">50683</a>
-Improve DOM/AST support for doc comments
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50697">50697</a>
-Improve DOM/AST support for locating all comments
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50667">50667</a>
-Deadlock on Refactor -> Extract method
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47430">47430</a>
-the immutable bit is copied from the original resource to the ouput directory
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50601">50601</a>
-Blank lines before package declaration is one fewer than specified
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48292">48292</a>
-[DCR] Need AST.parsePartialClassFile(....)
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50320">50320</a>
-Java model operations should use IResourceRuleFactory
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50207">50207</a>
-Compile errors fixed by 'refresh' do not reset problem list or package explorer error states
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49691">49691</a>
-JavaProject looses property listeners on preferences
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50265">50265</a>
-Emulate old formatter with the new formatter
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50225">50225</a>
-Calling the default formatter with an empty string returns an invalid Edit
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44876">44876</a>
-"Unnecessary declaration of thrown exception" problems
-
-
-<a name="v_398"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M7 Build - 20th January 2004
-<br>Project org.eclipse.jdt.core v_398
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_398">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Major renaming of constants in the code formatter. See <code>org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants</code>. See bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49908">49908</a>.
-The old constants have been deprecated and will be removed before M7. So we encourage you to save your code formatter preferences if
-you modified the default settings. The UI will provide an automatic conversion to the new options.
-</li>
-<li>Added API for alignment options in the code formatter. See <code>org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants</code>. See bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49968">49968</a>.
-</li>
-<li>Changed 3.0 APIs on <code>org.eclipse.jdt.core.dom.AST</code> to take an <code>IProgressMonitor</code>. This progress monitor is checked for the cancelation of the AST creation only.
-</li>
-<li>Added API on <code>org.eclipse.jdt.core.dom.AST</code> to parse an expression or statements or class body declarations without requiring the parsing
-of the whole compilation unit. This is still subject to change before 3.0.
-<pre>
- /**
- * Parses the given source between the bounds specified by the given offset (inclusive)
- * and the given length and creates and returns a corresponding abstract syntax tree.
- *
- * The root node of the new AST depends on the given kind.
- * - <code>org.eclipse.jdt.core.dom.AST.K_CLASS_BODY_DECLARATIONS</code>: The root node is an instance of
- * <code>org.eclipse.jdt.core.dom.TypeDeclaration</code>. The type declaration itself doesn't contain any information.
- * It is simply used to return all class body declarations inside the bodyDeclaratins() collection.
- * - <code>org.eclipse.jdt.core.dom.AST.K_STATEMENTS</code>: The root node is an instance of
- * <code>org.eclipse.jdt.core.dom.Block</code>. The block itself doesn't contain any information.
- * It is simply used to return all the statements.
- * - <code>org.eclipse.jdt.core.dom.AST.K_EXPRESSION</code>: The root node is an instance of a subclass of
- * <code>org.eclipse.jdt.core.dom.Expression</code>.
- *
- * Each node in the subtree carries source range(s) information relating back
- * to positions in the given source (the given source itself
- * is not remembered with the AST).
- * The source range usually begins at the first character of the first token
- * corresponding to the node; leading whitespace and comments are <b>not</b>
- * included. The source range usually extends through the last character of
- * the last token corresponding to the node; trailing whitespace and
- * comments are <b>not</b> included. There are a handful of exceptions
- * (including compilation units and the various body declarations); the
- * specification for these node type spells out the details.
- * Source ranges nest properly: the source range for a child is always
- * within the source range of its parent, and the source ranges of sibling
- * nodes never overlap.
- *
- * This method does not compute binding information; all <code>resolveBinding</code>
- * methods applied to nodes of the resulting AST return <code>null</code>.
- *
- * <code>null</code> is returned:
- * 1. If a syntax error is detected while parsing,
- * 2. If the given source doesn't correspond to the given kind.
- *
- * @param kind the given kind to parse
- * @param source the string to be parsed
- * @param offset the given offset
- * @param length the given length
- * @param options the given options. If null, <code>JavaCore.getOptions()</code> is used.
- * @param monitor the progress monitor used to check if the AST creation needs to be canceled
- *
- * @return ASTNode
- * @see ASTNode#getStartPosition()
- * @see ASTNode#getLength()
- * @see AST#K_CLASS_BODY_DECLARATIONS
- * @see AST#K_EXPRESSION
- * @see AST#K_STATEMENTS
- * @see JavaCore#getOptions()
- * @since 3.0
- */
- public static ASTNode parse(int kind, char[] source, int offset, int length, Map options, IProgressMonitor monitor);
-</pre>
-</li>
-<li>Added API on <code>org.eclipse.jdt.core.dom.AST</code> to parse a compilation unit and specify
-the set of options to use. This is still subject to change before 3.0. The previous API was directly
-using <code>JavaCore.getOptions()</code>. This could be problematic in case you want to parse assert
-statements.
-<pre>
- /**
- * Parses the given string as a Java compilation unit and creates and
- * returns a corresponding abstract syntax tree.
- *
- * The given options are used to find out the compiler options to use while parsing.
- * This could implies the settings for the assertion support. See the <code>JavaCore.getOptions()</code>
- * methods for further details.
- *
- *
- * The returned compilation unit node is the root node of a new AST.
- * Each node in the subtree carries source range(s) information relating back
- * to positions in the given source string (the given source string itself
- * is not remembered with the AST).
- * The source range usually begins at the first character of the first token
- * corresponding to the node; leading whitespace and comments are <b>not</b>
- * included. The source range usually extends through the last character of
- * the last token corresponding to the node; trailing whitespace and
- * comments are <b>not</b> included. There are a handful of exceptions
- * (including compilation units and the various body declarations); the
- * specification for these node type spells out the details.
- * Source ranges nest properly: the source range for a child is always
- * within the source range of its parent, and the source ranges of sibling
- * nodes never overlap.
- * If a syntax error is detected while parsing, the relevant node(s) of the
- * tree will be flagged as <code>MALFORMED</code>.
- *
- *
- * This method does not compute binding information; all <code>resolveBinding</code>
- * methods applied to nodes of the resulting AST return <code>null</code>.
- *
- *
- * @param source the string to be parsed as a Java compilation unit
- * @param options options to use while parsing the file. If null, <code>JavaCore.getOptions()</code> is used.
- * @param monitor the progress monitor used to check if the AST creation needs to be canceled
- * @return CompilationUnit
- * @see ASTNode#getFlags()
- * @see ASTNode#MALFORMED
- * @see ASTNode#getStartPosition()
- * @see ASTNode#getLength()
- * @see JavaCore#getOptions()
- * @since 3.0
- */
- public static CompilationUnit parseCompilationUnit(char[] source, Map options, IProgressMonitor monitor);
-</pre>
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50258">50258</a>
-AST.parseCompilationUnit(... IWorkingCopyOwner..) should allow null
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49937">49937</a>
-JavaDoc of ITypeBinding#isLocal() talks about local interfaces
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49845">49845</a>
-DCR: Allow to cancel the AST creation
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48489">48489</a>
-[DCR] AST support for a single expression (vs. CU)
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49327">49327</a>
-formatter can return null TextEdit when parsing valid java
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49908">49908</a>
-Renaming of DefaultCodeFormatterConstants.java
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49968">49968</a>
-[formatter] Alignment API
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49953">49953</a>
-[Code Formatter] Cannot customize the spaces around brackets in array allocation expression
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50025">50025</a>
-uppercase ZIP and JAR classpath entries ignored
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45060">45060</a>
-Missing external jar prevents build, but jar still in Java model
-
-<a name="v_397"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M7 Build - 13th January 2004
-<br>Project org.eclipse.jdt.core v_397
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_397">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Added API to get the scheduling rule for a Java element:
-<pre>
- /**
- * Returns the scheduling rule associated with this Java element.
- * This is a handle-only method.
- *
- * @return the scheduling rule associated with this Java element
- * @since 3.0
- */
- ISchedulingRule getSchedulingRule();
-</pre>
-</li>
-<li>Code formatter: If you did change the value of the setting controlling the insertion of a white space between empty arguments of a method declaration,
-then you have to change it again. Indeed, a spelling mistake has been fixed in the constant name. See bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49530">49530</a>.</li>
-<li>Inline tags are now supported in Javadoc comments:
-<ul><li>{@link} and {@linkplain} tags are now parsed using same rules as for @see tag. See bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48385">48385</a>.
-<br>Because references declared in these tags should be now found during search operation, the index format had to be changed. Indexes will be automatically regenerated upon subsequent search queries (accounting for indexing notification in search progress dialogs).</li>
-<li>{@inheritDoc} tag is now parsed. When this tag is present in a method javadoc comment, all missing tags errors are ignored.
-See bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45782">45782</a>.</li>
-</ul>
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49843">49843</a>
-Not reporting error on constructor with no body
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49491">49491</a>
-Add option to toggle warning for Javadoc multiple same name @throws tags
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49260">49260</a>
-Malformed Javadoc Compiler option sensitive to line breaks
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45782">45782</a>
-[DCR] Compiler should take into account {@inheritDoc} tag
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48385">48385</a>
-[DCR] Need Javadoc warning for {@link }
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49760">49760</a>
-Splitting up FORMATTER_INSERT_SPACE_WITHIN_MESSAGE_SEND
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49763">49763</a>
-New formatter: Problem with empty statement in while
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48701">48701</a>
-NPE evaluating watch expression
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49290">49290</a>
-NullpointerException in TypeBinding.getInterfaces().
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49660">49660</a>
-Code formatter line wrapping indentation ignores whitespace settings
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48293">48293</a>
-[DCR] IJavaElement should implement ISchedulingRule
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48459">48459</a>
-NPE in Type hierarchy
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49653">49653</a>
-Unnecessary white space is added after last semicolon in for statement without increments
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49351">49351</a>
-New code formatter: left curly brace placement
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49530">49530</a>
-Spelling mistake in the FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_ARGUMENTS string constant
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49298">49298</a>
-Code formatter does not correctly space closing bracket on method calls
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48395">48395</a>
-Hierarchy on region misses local classes
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47743">47743</a>
-Open type hiearchy problems [type hierarchy]
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49571">49571</a>
-White space options for method and constructor declarations
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49577">49577</a>
-Add an option to specify the number of blank lines between two type declarations
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49551">49551</a>
-formatter fails on empty statement between package and imports
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39943">39943</a>
-[navigation] outliner auto-changes selection (multi-fields)
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49490">49490</a>
-New Code Formatter; Java Coding Conventions; Blank Lines; Before first declaration
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49561">49561</a>
-Commit should only lock parent's folder
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47699">47699</a>
-Make org.eclipse.core.runtime.compatibility non optional
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41444">41444</a>
-[navigation] error dialog on opening class file
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48350">48350</a>
-IType#resolveType(String) fails on local types
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49120">49120</a>
-search doesn't find references to anonymous inner methods
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49482">49482</a>
-New Code Formatter; if/else without curly braces; guardian clause (2)
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49481">49481</a>
-New Code Formatter; if/else without curly braces; guardian clause (1)
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49361">49361</a>
-FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_ARRAY_INITIALIZER
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49243">49243</a>
-New code formatter: missing feature
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49429">49429</a>
-error during build
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48404">48404</a>
-formatter: no edit returned
-
-<a name="v_396"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M6 Build - 18th December 2003 - 3.0 MILESTONE-6
-<br>Project org.eclipse.jdt.core v_396
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_396">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49081">49081</a>
-JDT is no more using the tab character by default for indentation
-
-<a name="v_395"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M6 Build - 17th December 2003
-<br>Project org.eclipse.jdt.core v_395
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_395">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48706">48706</a>
-NPE in move refactoring
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48965">48965</a>
-Javadoc problem preference settings: Use 'include' instead of 'ignore'
-
-<a name="v_394"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M6 Build - 16th December 2003
-<br>Project org.eclipse.jdt.core v_394
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_394">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47209">47209</a>
-Javadoc: Type references are not found in @see tag inside a method reference
-
-<a name="v_393"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M6 Build - 16th December 2003
-<br>Project org.eclipse.jdt.core v_393
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_393">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48818">48818</a>
-NPE in delta processor
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48711">48711</a>
-javadoc-warning if derived exception in @throws clause
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46040">46040</a>
-NPE in Eclipse console
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48725">48725</a>
-Cannot search for local vars in jars.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48749">48749</a>
-[Compiler] deprecation check in initializer fooled by trailing deprecated field decl
-
-
-<a name="v_392"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M6 Build - 15th December 2003
-<br>Project org.eclipse.jdt.core v_392
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_392">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li> Added option to avoid reporting a warning when overriding a deprecated method. By default, such
-warnings are no longer reported.
-<pre>
- * COMPILER / Reporting Deprecation When Overriding Deprecated Method
- * When enabled, the compiler will signal the declaration of a method overriding a deprecated one.
- * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.deprecation".
- * - option id: "org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod"
- * - possible values: { "enabled", "disabled" }
- * - default: "disabled"
-</pre>
-<li>Compiler options to signal problems with javadoc comments have been improved. User can now decide to report
-independently problems on invalid tags (syntax and references), missing tags and missing comments.
-Invalid references, missing tags or missing comments problem can be now ignored below a specific visibility level.
-Finally, user will also have the possibility to ignore missing tags and missing comments on overriding methods
-(assuming that complete Javadoc comments is done in superclass or interface declaration).
-<br>
-Here's the complete list of these options:
-<pre>
- * COMPILER / Reporting Invalid Javadoc Comment
- * This is the generic control for the severity of Javadoc problems.
- * When enabled, the compiler will issue an error or a warning for a problem in Javadoc.
- * - option id: "org.eclipse.jdt.core.compiler.problem.invalidJavadoc"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "ignore"
- *
- * COMPILER / Visibility Level For Invalid Javadoc Tags
- * Set the minimum visibility level for Javadoc tag problems. Below this level problems will be ignored.
- * - option id: "org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility"
- * - possible values: { "public", "protected", "default", "private" }
- * - default: "private"
- *
- * COMPILER / Reporting Invalid Javadoc Tags
- * When enabled, the compiler will signal unbound or unexpected reference tags in Javadoc.
- * A 'throws' tag referencing an undeclared exception would be considered as unexpected.
- * <br>Note that this diagnosis can be enabled based on the visibility of the construct associated with the Javadoc;
- * also see the setting "org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility".
- * <br>
- * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.invalidJavadoc".
- * - option id: "org.eclipse.jdt.core.compiler.problem.invalidJavadocTags"
- * - possible values: { "disabled", "enabled" }
- * - default: "enabled"
- *
- * COMPILER / Reporting Missing Javadoc Tags
- * This is the generic control for the severity of Javadoc missing tag problems.
- * When enabled, the compiler will issue an error or a warning when tags are missing in Javadoc comments.
- * <br>Note that this diagnosis can be enabled based on the visibility of the construct associated with the Javadoc;
- * also see the setting "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility".
- * <br>
- * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocTags"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "ignore"
- *
- * COMPILER / Visibility Level For Missing Javadoc Tags
- * Set the minimum visibility level for Javadoc missing tag problems. Below this level problems will be ignored.
- * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility"
- * - possible values: { "public", "protected", "default", "private" }
- * - default: "private"
- *
- * COMPILER / Reporting Missing Javadoc Tags on Overriding Methods
- * Specify whether the compiler will verify overriding methods in order to report Javadoc missing tag problems.
- * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding"
- * - possible values: { "enabled", "disabled" }
- * - default: "enabled"
- *
- * COMPILER / Reporting Missing Javadoc Comments
- * This is the generic control for the severity of missing Javadoc comment problems.
- * When enabled, the compiler will issue an error or a warning when Javadoc comments are missing.
- * <br>Note that this diagnosis can be enabled based on the visibility of the construct associated with the expected Javadoc;
- * also see the setting "org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility".
- * <br>
- * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocComments"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "ignore"
- *
- * COMPILER / Visibility Level For Missing Javadoc Comments
- * Set the minimum visibility level for missing Javadoc problems. Below this level problems will be ignored.
- * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility"
- * - possible values: { "public", "protected", "default", "private" }
- * - default: "public"
- *
- * COMPILER / Reporting Missing Javadoc Comments on Overriding Methods
- * Specify whether the compiler will verify overriding methods in order to report missing Javadoc comment problems.
- * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding"
- * - possible values: { "enabled", "disabled" }
- * - default: "enabled"
- *
-</pre>
-Note that backward compatibility with previous options IDs: <code>"org.eclipse.jdt.core.compiler.problem.missingJavadoc"</code>
-will be supported until 3.0M7 build and removed after.
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47214">47214</a>
-Cannot open declaration on a selected method of an anonymous class
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47795">47795</a>
-NPE selecting method in anonymous 2 level deep
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48335">48335</a>
-[Compiler] Need option to not report deprecation in override scenarii
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48523">48523</a>
-@throws reference incorrectly warned as not declared
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47940">47940</a>
-Unable to control level of JavaDoc errors
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47319">47319</a>
-Compiler warns on missing Javadoc tags for private methods.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46976">46976</a>
-Do not warn about 'Missing Javadoc' for overriding methods
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46854">46854</a>
-[DCR] Javadoc configuration setting needs more flexibility
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48617">48617</a>
-Error range for unresolved names in qualified references
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48333">48333</a>
-[Compiler] Implicit deprecation isn't propagated to anonymous type
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46084">46084</a>
-ArrayIndexOutOfBoundsException in compiler after feeding with non-real java code
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43354">43354</a>
-CodeAssist relevance should privilege package completion over type name
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48422">48422</a>
-Calling isStructureKnown() on ILocalVaraible throws JavaModelExceptions
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48261">48261</a>
-Search does not show results
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47213">47213</a>
-Inefficient recursion while initializing classpath container
-
-<a name="v_391"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M6 Build - 10th December 2003
-<br>Project org.eclipse.jdt.core v_391
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_391">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>We reverted back the behavior when using the class literal. See bugs <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=37565">37565</a> and
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48086">48086</a>. As long as javac doesn't clarify this case, we keep
-the old behavior.</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48086">48086</a>
-Compiler does not resolve references in static init blocks correctly
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48353">48353</a>
-Indexes deleted on shutdown
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42579">42579</a>
-Eclipse allows setting a source folder's parent as output folder, which wipes out source code
-
-<a name="v_390"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M6 Build - 9th December 2003
-<br>Project org.eclipse.jdt.core v_390
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_390">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>The classpath validation rules now allow an excluded directory to be used as an output location.
-Remember that a source folder can be associated with exclusion rules so as to eliminate portions of the
-source tree. Nested source/library entries were already allowed given proper exclusion rules were specified,
-now we also enable nesting an output folder as well under the same restrictions.
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47338">47338</a>
-CCE in CompletionParser
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45589">45589</a>
-Too many Util classes in JDTCore
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39539">39539</a>
-Cannot select excluded directory as output folder for class files
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48070">48070</a>
-[CodeAssist] ArrayIndexOutOfBoundsException in AssistParster
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48167">48167</a>
-Indentation/line wrapping problems with array initializers
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=32022">32022</a>
-Indirect static proposal: Wrong compiler positions
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48141">48141</a>
-Formatter: Java Conventions/WS/Expressions/Operators
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45157">45157</a>
-Source Formatter: Clear all Blank lines needs to have the ability to set a number of lines to keep.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44673">44673</a>
-Formatting
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38523">38523</a>
-so add "Insert new line after each parameter if line is too long" checkbox to Preferences > Java > Code Formatter > New Lines
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=34897">34897</a>
-Code Formatter feature request
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46937">46937</a>
-[Compiler] Marking a field deprecated still report deprecated usage
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47989">47989</a>
-Exception when searching for IPackageFragment "java.util.zip"
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47997">47997</a>
-No empty line after opening brace [formatter]
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48064">48064</a>
-Javadoc: NPE during build process
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44815">44815</a>
-Continuation indent for array initializer should be customizable
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44813">44813</a>
-Option "Insert new line before an open brace" should work also for array initializers
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43212">43212</a>
-catch variable not recognized by code-completion
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46060">46060</a>
-regression - content assist fails to present proposal
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47918">47918</a>
-New code Formatter
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47968">47968</a>
-Cannot find @see references in Class javadoc comment
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47909">47909</a>
-Javadoc: NPE while searching a constructor references in jdt-core
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47986">47986</a>
-Formatting of 'for' initializers
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47976">47976</a>
-Implementation of IField.getConstant() fails for some constants
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47886">47886</a>
-[Compiler] ACC_SUPER bit sets for interfaces
-
-<a name="v_389"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M6 Build - 2nd December 2003
-<br>Project org.eclipse.jdt.core v_389
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_389">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Spec and implementation for <code>ITypeBinding.getBinaryName()</code> was changed to be '.' separated:
-<pre>
- /**
- * Returns the binary name of this type binding.
- * The binary name of a class is defined in the Java Language
- * Specification 2nd edition, section 13.1.
- *
- * Note that in some cases, the binary name may be unavailable.
- * This may happen, for example, for a local type declared in
- * unreachable code.
- *
- * @return the binary name of this type, or null
- * if the binary name is unknown
- * @since 3.0
- */
-public String getBinaryName();
-</pre>
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47881">47881</a>
-[Compiler] x && false evaluates to "true"
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47802">47802</a>
-New Code Formatter: NEXT_PER_LINE_SPLIT
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47811">47811</a>
-New Code Formatter: doesn't handle several classes per CU
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47801">47801</a>
-New Code Formatter: INSERT_SPACE_AFTER_PREFIX_OPERATOR
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47800">47800</a>
-New Code Formatter: BINARY_EXPRESSION_ALIGNMENT
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47799">47799</a>
-New Code Formatter: PUT_EMPTY_STATEMENT_ON_NEW_LINE
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47776">47776</a>
-java.lang.VerifyError / Illegal target of jump or branch compiling with 3.0 M5
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47341">47341</a>
-Javadoc problem for @see to protected method
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47339">47339</a>
-Javadoc problem while using @see tag
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47132">47132</a>
-Javadoc for method in anonymous type should not be mark as missing
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47215">47215</a>
-Javadoc: type reference in @see tag ignore the following text
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46761">46761</a>
-Search for references: misses match in Javadoc
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46675">46675</a>
-[Compiler] NullPointerException with ? operator
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35220">35220</a>
-CodeAssist - method of anonymous type should not be proposed
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47631">47631</a>
-PerThreadObject (JavaModelManager.deltaState) leaks Threads.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46470">46470</a>
-Wrong completion after a switch
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35232">35232</a>
-CodeAssist - wrong completion for static method in anonymous type
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47401">47401</a>
-Wrong code assist proposals in anonymous class
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47443">47443</a>
-All projects touched on startup
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44493">44493</a>
-Improve formatting of throws clauses
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44765">44765</a>
-New formatter not properly formatting long method invocation
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44653">44653</a>
-// $NON-NLS-1$ comments not kept on same line of the string while formatting
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46699">46699</a>
-IBinding.isSynthetic() returns false for compiler-generated constructor
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47415">47415</a>
-[Search] package references confused with multiple fragments
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38679">38679</a>
-Search for class ref shows local class containing a match on an import [search]
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47049">47049</a>
-[Builder] Build output folder not getting flushed because files are not marked as derived
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46613">46613</a>
-AST nodes and string buffers
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47396">47396</a>
-JAVA AST Creation failure
-
-<a name="v_388"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M6 Build - 25th November 2003
-<br>Project org.eclipse.jdt.core v_388
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_388">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47082">47082</a>
-[Compiler] Problem with final variable initialization
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47180">47180</a>
-Merge different type declarations into one class
-
-
-<a name="v_387"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M5 Build - 21st November 2003 - 3.0 MILESTONE-5
-<br>Project org.eclipse.jdt.core v_387
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_387">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44397">44397</a>
-Search doesn't find references to local types
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46571">46571</a>
-Searching for all occurrences for method declarated in local types doesn't wor
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46943">46943</a>
-refactoring: encapsulate field of local type: references from enclosing type are not replaced by setter
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47180">47180</a>
-NPE in Delta Processor
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46788">46788</a>
-Export scripts: shouldn't use variable name version
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47160">47160</a>
-ArrayIndexOutOfBoundsException from CodeSnippetParser
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47177">47177</a>
-ClassCastException during hover
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47079">47079</a>
-[Builder] suspicious side-effects during incremental compile
-
-<a name="v_386"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M5 Build - 20th November 2003
-<br>Project org.eclipse.jdt.core v_386
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_386">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Removed APIs that create an <code>ICompilationUnit</code> handle given a <code>WorkingCopyOwner</code>
- as these can be replaced with <code>ICompilationUnit.findWorkingCopy(WorkingCopyOwner)</code>:
- <ul>
- <li><code>IPackageFragment.getCompilationUnit(String, WorkingCopyOwner)</code></li>
- <li><code>JavaCore.create(IFile, WorkingCopyOwner)</code></li>
- <li><code>JavaCore.create(IResource, WorkingCopyOwner)</code></li>
- <li><code>JavaCore.createCompilationUnitFrom(IFile, WorkingCopyOwner)</code></li>
- <li><code>IDOMCompilationUnit.getCompilationUnit(IPackageFragment, WorkingCopyOwner)</code></li>
- </ul>
- <br>
-</li>
-<li>Added API on <code>ICompilationUnit</code> to find an existing working copy given a working
- copy owner (it replaces <code>IWorkingCopy.findSharedWorkingCopy(IBufferFactory)</code>):
-<pre>
-/**
- * Finds the working copy for this compilation unit, given a <code>WorkingCopyOwner</code>.
- * If no working copy has been created for this compilation unit associated with this
- * working copy owner, returns <code>null</code>.
- *
- * Users of this method must not destroy the resulting working copy.
- *
- * @param owner the given <code>WorkingCopyOwner</code>
- * @return the found working copy for this compilation unit, <code>null</code> if none
- * @see WorkingCopyOwner
- * @since 3.0
- */
-ICompilationUnit findWorkingCopy(WorkingCopyOwner owner);
-</pre>
-</li>
-<li>Added API on <code>IClassFile</code> to create a working copy on a class file (it replaces
- <code>IClassFile.getWorkingCopy(IProgressMonitor, IBufferFactory)</code>):
-<pre>
-/**
- * Returns a working copy on the source associated with this class file using the given
- * owner to create the buffer, or <code>null</code> if there is no source associated
- * with the class file.
- *
- * The buffer will be automatically initialized with the source of the class file
- * upon creation.
- *
- * The only valid operations on this working copy are <code>getBuffer()</code> or <code>getPrimary()</code>.
- *
- * @param owner the owner that creates a buffer that is used to get the content of the working copy
- * or <code>null</code> if the primary owner should be used
- * @param monitor a progress monitor used to report progress while opening this compilation unit
- * or <code>null</code> if no progress should be reported
- * @return a a working copy on the source associated with this class file
- * @exception JavaModelException if the source of this class file can
- * not be determined. Reasons include:
- * - This class file does not exist (ELEMENT_DOES_NOT_EXIST)
- * @since 3.0
- */
-ICompilationUnit getWorkingCopy(WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException;
-</pre>
-</li>
-<li>Added API on <code>ITypeBinding</code> to get the binary name of a type binding:
-<pre>
-/**
- * Returns the binary name (as defined in the Java Language
- * Specification Chapter 13 Section 1) of this type binding.
- * It is however slash ('/') separated instead of dot ('.') separated as said
- * in the specification.
- * Returns <code>null</code> if the type is defined in code that is unreachable.
- *
- * @return the binary name of this type or <code>null</code> if this type is unreachable
- */
-String getBinaryName();
-</pre>
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46012">46012</a>
-IllegalArgumentException in StringLiteral
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46769">46769</a>
-NPE in PatternLocator.qualifiedSourceName
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47074">47074</a>
-inability to detect invalid cast between interfaces
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057">46057</a>
-need mechanism for retrieving the name of anonymous and local classes
-
-<a name="v_385"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M5 Build - 19th November 2003
-<br>Project org.eclipse.jdt.core v_385
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_385">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46964">46964</a>
-Can not set Javadoc compiler setting
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46901">46901</a>
-Strange compile error in javadoc
-
-<a name="v_384"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M5 Build - 19th November 2003
-<br>Project org.eclipse.jdt.core v_384
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_384">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Added API on <code>ICompilationUnit</code> to query whether the working copy's resource has changed
- (it replaces <code>IWorkingCopy.isBasedOn(IResource)</code>):
-<pre>
-/**
- * Returns whether the resource of this working copy has changed since the
- * inception of this working copy.
- * Returns <code>false</code> if this compilation unit is not in working copy mode.
- *
- * @return whether the resource has changed
- * @since 3.0
- */
-public boolean hasResourceChanged();
-</pre>
-</li>
-<li>Added APIs on <code>IType</code> to create hierarchies using <code>ICompilationUnits</code> instead of
- <code>IWorkingCopies</code>:
-<pre>
-/**
- * Creates and returns a type hierarchy for this type containing
- * this type and all of its supertypes, considering types in the given
- * working copies. In other words, the list of working copies will take
- * precedence over their original compilation units in the workspace.
- *
- * Note that passing an empty working copy will be as if the original compilation
- * unit had been deleted.
- *
- * @param workingCopies the working copies that take precedence over their original compilation units
- * @param monitor the given progress monitor
- * @return a type hierarchy for this type containing this type and all of its supertypes
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @since 3.0
- */
-ITypeHierarchy newSupertypeHierarchy(ICompilationUnit[] workingCopies, IProgressMonitor monitor) throws JavaModelException;
-
-/**
- * Creates and returns a type hierarchy for this type containing
- * this type, all of its supertypes, and all its subtypes in the workspace,
- * considering types in the given working copies. In other words, the list of working
- * copies that will take precedence over their original compilation units in the workspace.
- *
- * Note that passing an empty working copy will be as if the original compilation
- * unit had been deleted.
- *
- * @param workingCopies the working copies that take precedence over their original compilation units
- * @param monitor the given progress monitor
- * @return a type hierarchy for this type containing
- * this type, all of its supertypes, and all its subtypes in the workspace
- * @exception JavaModelException if this element does not exist or if an
- * exception occurs while accessing its corresponding resource.
- * @since 3.0
- */
-ITypeHierarchy newTypeHierarchy(ICompilationUnit[] workingCopies, IProgressMonitor monitor) throws JavaModelException;
-</pre>
-<li>Added API on <code>SearchEngine</code> to create a search engine using
- <code>ICompilationUnits</code> instead of <code>IWorkingCopies</code>:
-<pre>
-/**
- * Creates a new search engine with a list of working copies that will take precedence over
- * their original compilation units in the subsequent search operations.
- *
- * Note that passing an empty working copy will be as if the original compilation
- * unit had been deleted.
- *
- * Since 3.0 the given working copies take precedence over primary working copies (if any).
- *
- * @param workingCopies the working copies that take precedence over their original compilation units
- * @since 3.0
- */
-public SearchEngine(ICompilationUnit[] workingCopies) {...}
-</pre>
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-
-<a name="v_383"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M5 Build - 18th November 2003
-<br>Project org.eclipse.jdt.core v_383
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_383">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>To avoid confusion with annotations introduced in JDK 1.5 grammar, all internal references to "annotation" (added to handle Javadoc comments)
-got renamed into "Javadoc". As a consequence of this is that IDs for optional Javadoc problems have been updated accordingly:
-<pre>
- * COMPILER / Reporting Invalid Javadoc Comment
- * When enabled, the compiler will issue an error or a warning when a javadoc comment is inconsistent,
- * misses a tag entry or contains invalid references.
- * - option id: "org.eclipse.jdt.core.compiler.problem.invalidJavadoc"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "ignore"
- * COMPILER / Reporting Missing Javadoc Comment
- * When enabled, the compiler will signal cases where public class, interface, method, constructor or field
- * (considered as part of the API) has no javadoc comment.
- * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.invalidJavadoc".
- * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadoc"
- * - possible values: { "enabled", "disabled" }
- * - default: "disabled"
-</pre>
-Note that backward compatibility with previous options IDs: <code>"org.eclipse.jdt.core.compiler.problem.invalidAnnotation"</code> and <code>"org.eclipse.jdt.core.compiler.problem.missingAnnotation"</code>
-will be supported until 3.0M6 build and removed after.
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46717">46717</a>
-The code formatter does not insert a new line before /** Javadoc
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45958">45958</a>
-Compiler wrongly complains against valid @see constructor reference
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45112">45112</a>
-Use Javadoc instead of Annotation for comment compiler parsing
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46052">46052</a>
-result of ITypeHierarchy.getAllSuperTypes() does not include Object
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46192">46192</a>
-ILocalVariable.exists() always returns false
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=14103">14103</a>
-[Builder] Too many dependents found when incrementally recompiling
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39601">39601</a>
-[DOM/AST] clarify documentation of source ranges
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39739">39739</a>
-[DOM/AST] VariableDeclarationStatements aren't full statements
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46690">46690</a>
-Code formatter always inserts space after comma in multiple locals or field declarations
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46689">46689</a>
-Code formatter always inserts a space in front of the '-' unary operator
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46686">46686</a>
-Code formatter doesn't indent properly statements following a switch statement
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46356">46356</a>
-[Builder] simple/qualified names list for indicting dependents should be hashed collections
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46612">46612</a>
-[DOM/AST] BodyDeclaration should provide a method getModifiers
-
-<a name="v_382"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M5 Build - 10th November 2003
-<br>Project org.eclipse.jdt.core v_382
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_382">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46276">46276</a>
-Search for package declarations incorrectly finds matches in clone project
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46099">46099</a>
-Batch compiler doesn't print stats if errors and not proceeding on errors
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40950">40950</a>
-[infrastructure] NPE from indexer
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46150">46150</a>
-formatter failed to format
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013">46013</a>
-IBinding.getKey() for local shouldn't return null
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46033">46033</a>
-New formatter not formatting nested constructor/methods properly
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46093">46093</a>
-[Builder] Unoptimal pre-check for not writing class files
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45847">45847</a>
-[Builder] Reading build state is slow
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45982">45982</a>
-Array out of bounds error while editing Java file
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41611">41611</a>
-CreateCompilationUnitOperation.executeOperation() should probably force creation more agressively
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45113">45113</a>
-No hierarchy refresh when on region
-
-
-<a name="v_381"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M5 Build - 4th November 2003
-<br>Project org.eclipse.jdt.core v_381
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_381">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45968">45968</a>
-[new formatter] Formatter introduces empty lines inside line comments
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44450">44450</a>
-Strange name range for anonymous classes.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43139">43139</a>
-Delete member in Outliner not working
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45944">45944</a>
-Stack trace attempting to find markers on a closed project
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44884">44884</a>
-Wrong list displayed while code completion
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45661">45661</a>
-Search for references of default package fails
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45671">45671</a>
-Need source range and getTypeSignature() for local variables
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45575">45575</a>
-Failure in nightly build of formatter tests (test325)
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45783">45783</a>
-NPE in MatchLocator
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=22073">22073</a>
-Each "format" adds one more level of indentation.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=23709">23709</a>
-for (/*comment*/; causes indentation to misbehave
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=27249">27249</a>
-incorrect formatting of empty array initialization blocks
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=29473">29473</a>
-wrong formatting of if...try... catch... else
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45786">45786</a>
-No selection on method declaration in field initializer
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45721">45721</a>
-Getting wrong deltas
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45674">45674</a>
-Compiler should allow compound assignment to final in unreachable code
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43984">43984</a>
-NPE in background search
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45707">45707</a>
-Autobuild does not kick in when using classpath containers
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45655">45655</a>
-exception while editing java file
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42287">42287</a>
-Should consider qualified name token positions
-
-<a name="v_380"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M5 Build - 28th October 2003
-<br>Project org.eclipse.jdt.core v_380
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_380">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Search is now able to find local variable references and declarations. In order to trigger such a search, the search engine must
- be fed with an <code>ILocalVariable</code> element. Searching a local variable by its name is not supported.
-</li>
-<li>Search is now finding references in Javadoc comments. Found references are method parameters declared in <code>@param</code> tags,
- types of exceptions declared in <code>@throws</code>/<code>@exception</code> tags and all instance variables, methods, types or
- packages declared in <code>@see</code> tags.
- <br>Note that only valid references in Javadoc comments will be reported during search. In order to ensure the integrity of your Javadoc comments,
- you may want to enable the compiler check for Javadoc (Preferences>Java>Compiler>Style>Problem in Javadoc tags).
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45641">45641</a>
-CCE when using declarations view
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45596">45596</a>
-Wrongly complains about missing parameter javadoc entry in anonymous class
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45592">45592</a>
-NPE while searching a method references in jdt-core
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45520">45520</a>
-Potential NPE
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45518">45518</a>
-Search has to find references put in javadoc comments
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45436">45436</a>
-Javadoc warnings: wrong errors in AST
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45198">45198</a>
-NPE from AnnotationParser
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45459">45459</a>
-JDT compiler more restrictive than javac
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35899">35899</a>
-"hierarchy of type ... inconsistent" error message wrong
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43967">43967</a>
-Search for references on local variable finds all occurances of variables of that type not just that variable.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37509">37509</a>
-Open Declaration opens class declaration for local variables
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45433">45433</a>
-Bug7 (and counting ;-): hundretAssignmentsToFinalVariable()
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45357">45357</a>
-Compiler-Bug: "The local variable oResult may not have been initialized".txt
-
-<a name="v_379"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M5 Build - 21st October 2003
-<br>Project org.eclipse.jdt.core v_379
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_379">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li> Compiler options for controlling the severity of problems for invalid imports or unreachable code got discontinued. Indeed, allowing this kind of problems to be ignored
-or treated as a warning would violate the language spec. As a consequence, <code>JavaCore#COMPILER_PB_INVALID_IMPORT</code> and
-<code>JavaCore#COMPILER_PB_UNREACHABLE_CODE</code> got deprecated,
-further attempts to set these preferences are now ignored and import problems or unreachable code are always reported as errors.
-<li> The warning level of the batch compiler can now be configured more easily using <code>-warn:+...</code> or <code>-warn:-...</code> command line
-argument (as opposed to only existing <code>-warn:...</code> command line argument).
-<code>-warn:+...</code> will not override the default warning level, but simply enable
-a few more specific warnings. Similarily, <code>-warn:-...</code> will only disable specific warnings.
-<br>Note, by default the batch compiler is reporting the following warnings:
- <ul>
- <li>'assert' used as identifier</li>
- <li>char[] in String concat</li>
- <li>method with constructor name</li>
- <li>deprecation outside deprecated code</li>
- <li>finally block not completing normally</li>
- <li>interface non-inherited method compatibility</li>
- <li>hidden catch block</li>
- <li>assignment without effect</li>
- <li>attempt to override package-default method</li>
- <li>unused import declaration</li>
- <li>non-static reference to static member</li>
- </ul>
-</li>
-<li>Code select (i.e. <code>ICodeAssit.codeSelect(...)</code>) now returns an <code>ILocalVariable</code>
- element when a local variable or an argument is selected.
- <br>Note that <code>ILocalVariable</code>s are pseudo-elements:
- they are not part of the Java model (<code>exists()</code> always returns <code>false</code>),
- they are not returned when asking for the children of a method, and there is no other way to create such
- an element. One can only ask for the source range (<code>ISourceReference.getSourceRange()</code>) or
- for the name range (<code>ILocalVariable.getNameRange()</code>) of the local variable.
- <br>Searching a local variable is not yet implemented, but it is on the plan.
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35389">35389</a>
-Compiler settings can violate JLS [build path]
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44869">44869</a>
-Search: no refs found to overridden method in binary subclass
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45110">45110</a>
-No constant for '..compiler.problem.missingAnnotation'
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45100">45100</a>
-[formatter] test144 fails
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45036">45036</a>
-[formatter] New formatter fails formatting multiple field declarations using K_CLASSBODY_DECLARATION kind
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45037">45037</a>
-[formatter] New formatter doesn't insert a new line before the while in a do/while
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45014">45014</a>
-Formatter misplaces semicolon
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44757">44757</a>
-New code formatter does not format switch statements correctly
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44647">44647</a>
-NPE code completion
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43754">43754</a>
-How to position this comment?
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44839">44839</a>
-New formater fails with out of memory error
-
-<a name="v_378"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M5 Build - 15th October 2003
-<br>Project org.eclipse.jdt.core v_378
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_378">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li> Removed dependency on Xerces.
-</li>
-<li> Remove deprecated previously added API <code>IJavaProject#forceClasspathReload(IProgressMonitor)</code>
-(see comment of <a href="#v_368">v_368</a> drop below).
-</li>
-<li>Added optional compiler problem to signal problems with javadoc annotation.
-<pre>
- * COMPILER / Reporting Invalid Javadoc Annotation
- * When enabled, the compiler will issue an error or a warning when a javadoc annotation is inconsistent,
- * misses a tag entry or contains invalid references.
- * - option id: "org.eclipse.jdt.core.compiler.problem.invalidAnnotation"
- * - possible values: { "error", "warning", "ignore" }
- * - default: "ignore"
- * COMPILER / Reporting Missing Javadoc Annotation
- * When enabled, the compiler will signal cases where public class, interface, method, constructor or field
- * (considered as part of the API) has no javadoc annotation.
- * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.invalidAnnotation".
- * - option id: "org.eclipse.jdt.core.compiler.problem.missingAnnotation"
- * - possible values: { "enabled", "disabled" }
- * - default: "disabled"
- *
-</pre>
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44715">44715</a>
-NullPointerException compiling Java file
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44697">44697</a>
-Bug when i search reference of 'String' in 3.0M4
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38091">38091</a>
-DCR - Generate warnings for JavaDoc missing entries
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44637">44637</a>
-NPE in Initializer.getPrimaryElement()
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42762">42762</a>
-Compiler tests should run both in 1.3 and 1.4 mode
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44580">44580</a>
-No outline when unit name is not valid
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44651">44651</a>
-Wrong formatting of multiple local variables declarations
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44643">44643</a>
-Remove dependancy to xerces
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44662">44662</a>
-Should not validate unit/classfile handles upon creation
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44400">44400</a>
-Unnecessary cast not being picked up
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44143">44143</a>
-[JSR202] Remove usage of jsr bytecodes in 1.5 mode
-
-<a name="v_377"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M4 Build - 9th October 2003 - 3.0 MILESTONE-4
-<br>Project org.eclipse.jdt.core v_377
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_377">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44576">44576</a>
-Code formatter option "Insert a new line before an opening brace" has no effect for single else
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44570">44570</a>
-Code formatter option "Insert a new line inside an empty block" has no effect
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44503">44503</a>
-Unoptimal formatting for long constructor argument
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44546">44546</a>
-New formatter unable to format
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44506">44506</a>
-Type hierarchy is missing anonymous type
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44481">44481</a>
-"Insert new line between else and if" is not working as expected
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44480">44480</a>
-Formatting the formatted string should not produce edits
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44444">44444</a>
-jdt.core in trouble when project has no JRE
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44437">44437</a>
-Typo in plugin.properties
-
-<a name="v_376"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M4 Build - 8th October 2003
-<br>Project org.eclipse.jdt.core v_376
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_376">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Fix for bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44289">44289</a>
- requires the index format to be changed. Indexes will be automatically regenerated upon
- subsequent search queries (accounting for indexing notification in search progress dialogs).
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44308">44308</a>
-NullPointerException when searching jars
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44341">44341</a>
-NPE from delta processor
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44119">44119</a>
-NPE while searching for references to Action#run()
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44331">44331</a>
-Need indication that removal/add was targeted to a primary working copy
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=32639">32639</a>
-Missing empty fine-grain delta when reconciling
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44292">44292</a>
-IDOMType.setFlags(Flag.AccPublic) when applied to an interface having default visibility produces uncompilable code
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44293">44293</a>
-DOMFactory.createInitializer() always creates a static intializer
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44289">44289</a>
-Search broken
-
-<a name="v_374"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M4 Build - 7th October 2003
-<br>Project org.eclipse.jdt.core v_374
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_374">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>The new code formatter can be activated in the ui. See the work in progress section. This first release doesn't expose
-yet all the preferences of the new code formatter. This will be done after M4. However the old formatter options should be honored by
-the new code formatter. This is a work in progress and all problems should be reported against JDT/Core.
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44242">44242</a>
-Deadlock during jdt/debug test
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44066">44066</a>
-Package Explorer doesn't show new file
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44219">44219</a>
-NPE while creating TypeHierarchy for binary type "Group"
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44073">44073</a>
-Override methods action does not work for local types [code manipulation]
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=16231">16231</a>
-formatter creates ugly array initializer expressions
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=6284">6284</a>
-Java formatter enhancements
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=6268">6268</a>
-Code formatting
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44036">44036</a>
-Java code formatter wraps line too much.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43651">43651</a>
-Linewrapping of throws declarations (if many)
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43545">43545</a>
-Code Formatter: Don't separate long "import" clause.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43272">43272</a>
-feature request : extend the code formatter to support blanks between method / class name and bracket.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43050">43050</a>
-Formatting long arguments not very readable
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40777">40777</a>
-Incorrect formatting for anonymous inner class with comment
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39607">39607</a>
-Incorrect formatting of anonymous inner class inside if statement
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39603">39603</a>
-for-Statement not correctly formatted by Codeformatter
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39357">39357</a>
-Better code formatting
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38151">38151</a>
-Code formatter adds an unwanted blank line after an abstract method with a "throws" clause.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37106">37106</a>
-Code Formatter: Option to double indent wrapped lines in if statments, etc.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37057">37057</a>
-Code Formatter: Reduce number of blank lines to 1
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36832">36832</a>
-wrong indent on Code Format of anonymous class
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36455">36455</a>
-[Formatting] Too long lines look ugly
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36108">36108</a>
-Code Formatter Clear Blank Lines Doesn't Work
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35799">35799</a>
-code formatter: missing space after last array initializer
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35433">35433</a>
-Simple Feature Request - Code Formatter Enhancement
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35173">35173</a>
-Code formatter incorrectly formats this case:
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=29110">29110</a>
-RFE: Disable line splitting in the code formatter
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=28098">28098</a>
-Code Formatter doesn't format JavaDoc indentation
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=27196">27196</a>
-Code Formatter Won't Indent Braces
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=25559">25559</a>
-more code formatter options
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=24200">24200</a>
-"Space inside parens & brackets" option in Code Formatter
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=23144">23144</a>
-formatter issues
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=22528">22528</a>
-Code formatter incorrectly indents lines
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=22313">22313</a>
-Formatter doesn't like some comment
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=21943">21943</a>
-Formatter should allow removing space after for/while/if
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=20721">20721</a>
-Code formatter bug
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=19999">19999</a>
-Code Formatter always clears blank lines to 1
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=19811">19811</a>
-Code formatter bugs
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=17349">17349</a>
-Code Formatter incorrectly formats static initializer
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=16233">16233</a>
-formatter problem with constructor, array and line-end comments
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=15286">15286</a>
-Code formatter: long param lists and line wrapping
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=14659">14659</a>
-Align method arguments on line break
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=12456">12456</a>
-Add formatter options for controlling spaces
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=12321">12321</a>
-Code formatter and comments
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=10052">10052</a>
-CodeFormatter - line splitting enhancement.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=7439">7439</a>
-incorrect formatting: empty inner class
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=7224">7224</a>
-Formatting splits package names in ugly ways
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=6747">6747</a>
-Code Formatter exchange several blank lines w/ one
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=5824">5824</a>
-Code Formatter needs to be more customizable to be useful
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=3327">3327</a>
-Formatter - should ensure one empty line before a method declaration (1GHOJWD)
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=3276">3276</a>
-DCR: (LOW) Formatter option to not indent methods (1GE39ZO)
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=3181">3181</a>
-Does not format nicely anonymous type (1FRLTO1)
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44085">44085</a>
-becomeWorkingCopy() should add the working copy in the model
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44052">44052</a>
-Deadlock on startup
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44092">44092</a>
-Methods to generate parser files are not correct
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44084">44084</a>
-No refresh when deleting edited unit
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41643">41643</a>
-Code assist doesn't propose all valid types
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44065">44065</a>
-NPE during hot code replace
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43897">43897</a>
-No completion in cast expression
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44061">44061</a>
-CodeAssist - no completion after class literal access
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44018">44018</a>
-Change superfluous semicolon error message
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43872">43872</a>
-Hierarchy does not update properly when local class eliminated [type hierarchy]
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43294">43294</a>
-Primary working copy: No updates when changed in working copy mode
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43907">43907</a>
-Too many warnings reported by the jdt compiler adapter
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43847">43847</a>
-IPackageFragment not updated after CUs have moved
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43879">43879</a>
-working copy commit outside classpath doesn't save buffer
-
-<a name="v_373"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M4 Build - 30th September 2003
-<br>Project org.eclipse.jdt.core v_373
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_373">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43728">43728</a>
-Optimize CompilerOptions(Map....)
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43842">43842</a>
-JDTCompilerAdapter doesn't find bootclasspath
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40782">40782</a>
-Primary working copies: unnecessary deltas on save
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43300">43300</a>
-SearchEngine(IWorkingCopy[] workingCopies) not backward compatible
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43670">43670</a>
-No classpath refresh when replacing binary project with source form
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43600">43600</a>
-NPE from JDTCompilerAdapter
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43636">43636</a>
-Compiler complain that class cannot be resolved when it should be only not visible
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43208">43208</a>
-ICompilation.move not supported when in workingCopyMode
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40793">40793</a>
-Primary working copies: Type search does not find type in modified CU
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43587">43587</a>
-Searching for references to default constructors reports questionable results
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36143">36143</a>
-Type hierarchy doesn't include anonymous subclasses
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=8613">8613</a>
-Outline should show anonymous inner classes
-
-
-<a name="v_372"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M4 Build - 24th September 2003
-<br>Project org.eclipse.jdt.core v_372
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_372">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42692">42692</a>
-JavaCC files cause VerifyError when compiled with Eclipse
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43437">43437</a>
-Scanner does not like string literals
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43485">43485</a>
-NPE in SearchEngine
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37659">37659</a>
-[plan item] Improve shared working copies
-
-
-<a name="v_371"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M4 Build - 22nd September 2003
-<br>Project org.eclipse.jdt.core v_371
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_371">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li> As a consequence of migrating to background autobuild, the JavaModel will no longer broadcast deltas
-during PRE_AUTO_BUILD event notification. These were somewhat inconsistent in so far as the model wasn't
-totally up to date anyway. Now the model will only fire deltas during POST_CHANGE, or working copy reconcile
-operations.
-</li>
-<li>Part of the new support for local and anonymous types in the Java model has been released.
- <p>
- This includes:
- <ul>
- <li>local and anonymous types are shown in the Outline view and the Package Explorer view</li>
- <li>Java element deltas for these types are notified</li>
- <li>handles on these types can be created (see <code>IMember.getType(String, int)</code>)</li>
- <li><code>getChildren()</code> on a method, a field or an initializer returns the local or anonymous types defined in this element</li>
- <li>mementos for these handles are supported</li>
- <li>open on selection (F3) in a Java editor goes to the local type definition</li>
- <li>type hierarchies contain anonymous and local types</li>
- </ul>
- <p>
- This doesn't yet include:
- <ul>
- <li>search on these types</li>
- <li>anonymous/local binary types</li>
- </ul>
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42832">42832</a>
-Cannot get rid of this error even if the compiler settings is ignore for incompatible required binaries
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41583">41583</a>
-[misc] Eclipse cannot save or compile files in non-Java project anymore
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43274">43274</a>
-Type hierarchy broken
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38931">38931</a>
-Migrate delta processor to comply to new notification scheme in 3.0
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42281">42281</a>
-"Resource *.java does not exist"
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38931">38931</a>
-org.eclipse.jdt.internal.corext.dom.NodeFinder needed in API
-
-
-<a name="v_370"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M4 Build - 16th September 2003
-<br>Project org.eclipse.jdt.core v_370
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_370">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43026">43026</a>
-Running jdt/core tests on Linux is failing
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43045">43045</a>
-Copy/move of package fragments with read-only subpackages fails on Linux
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43116">43116</a>
-NPE copy and pasting a method
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43089">43089</a>
-Search engine doesn't report all matches
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43080">43080</a>
-NPE when searching in CU with incomplete method declaration
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42856">42856</a>
-CodeAssist - Does not work after an inner type reference
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839">42839</a>
-Incorrect position in org.eclipse.jdt.core.dom.ArrayType
-
-<a name="v_369"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M4 Build - 9th September 2003
-<br>Project org.eclipse.jdt.core v_369
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_369">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Default compiler compliance setting got raised to 1.4 level. Default source level is 1.3, and default target level is 1.2.
-To ease the 1.4 migration, the default severity for optional problem 'assert used as identifier' got raised to warning.
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42760">42760</a>
-NullPointerException in JobManager when searching
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42629">42629</a>
-javac error message with missing classpath entry when claims entry dropped from path
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42614">42614</a>
-1.3 compliant mode should select default enclosing instance
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42588">42588</a>
-Incorrect selection of current enclosing instance
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35567">35567</a>
-Classpath validation error messages should contain project name
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42443">42443</a>
-Error when inner class name has the same name than another class, but with not the same case sensitive
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42459">42459</a>
-DebugEvaluationTests don't run if target is 1.2
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39887">39887</a>
-Resource exception while indexing
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42366">42366</a>
-Classpath validation error message removed while rebuilding a project.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41680">41680</a>
-Unnecessary cast wrongly reported
-
-<a name="v_368"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M4 Build - 1st September 2003
-<br>Project org.eclipse.jdt.core v_368
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_368">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Added optional compiler problem to signal unqualified access to a non-static field. In order to improve
-code readability, qualifying field accesses is a simple way to syntactically distinguish a field access from
-a local variable access, and thus avoid resorting to a special naming convention for fields (such as "fField").
-<pre>
-* COMPILER / Reporting Unqualified Access to Field
-* When enabled, the compiler will issue an error or a warning when a field is access without any qualification.
-* In order to improve code readability, it should be qualified, e.g. 'x' should rather be written 'this.x'.
-* - option id: "org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess"
-* - possible values: { "error", "warning", "ignore" }
-* - default: "ignore"
-</pre>
-</li>
-<li>Added optional compiler problem to signal method/constructor declared thrown checked exception which
-aren't actually raised inside the method/constructor body.
-<pre>
-* COMPILER / Reporting Unused Declared Thrown Exception
-* When enabled, the compiler will issue an error or a warning when a method or a constructor is declaring a
-* thrown checked exception, but never actually raises it in its body.
-* - option id: "org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException"
-* - possible values: { "error", "warning", "ignore" }
-* - default: "ignore"
-</pre>
-</li>
-<li>Added optional compiler problem to flag situations where a finally block does not complete normally.
-<pre>
-* COMPILER / Reporting Finally Blocks Not Completing Normally
-* When enabled, the compiler will issue an error or a warning when a finally block does not complete normally.
-* - option id: "org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally"
-* - possible values: { "error", "warning", "ignore" }
-* - default: "warning"
-</pre>
-</li>
-<li>Improved problem description for unreachable catch block problems. Message will now mention the exception type
-name and better diagnose the cause of the problem. Also changed problem source range
-to rather highlight the caught exception type instead of entire catch block.
-<pre></pre>
+Cast/instanceof operations are now fully supported, along with extra diagnosis for unsafe type operations.
</li>
-<li>Added two new API methods <code>readRawClasspath()</code> and <code>readOutputLocation()</code> on <code>IJavaProject</code>
-interface so as to allow user to read classpath directly from disk (<code>.classpath</code> file contents). This is useful to configure
-a Java project before it is associated with the Java nature, or before the automatic classpath reconciliation mechanism has performed (within
-a resource modifying operation, and prior to the change notification). Note that these API additions are obsoleting the previously
-added API <code>IJavaProject#forceClasspathReload(IProgressMonitor)</code> (also see bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=20931">20931</a>)
-which has thus been deprecated. Forcing the classpath reload can simply be achieved by: <code>p.setRawClasspath(p.readRawClasspath(), p.readOutputLocation(), ...)</code>.
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40383">40383</a>
-Search - should only special treat unsaved working copies
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40658">40658</a>
-IJavaProject.getOutputLocation/getRawClasspath require Java nature
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42196">42196</a>
-Method popup extremely slow for JOGL code
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41534">41534</a>
-incorrect shadowing reported by rename [refactoring]
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40937">40937</a>
-ISourceReference.getSource throws ArrayIndexOutOfBoundsException
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41373">41373</a>
-SourceField.getConstant() returns null for final fields set in initializer
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41604">41604</a>
-Possible Compiler Bug
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=22976">22976</a>
-DCR - warning for unused declarations of thrown exceptions
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40736">40736</a>
-JDT compiler fails to compile legitimate Java code.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40020">40020</a>
-Exceptions in console
-
-<a name="v_367"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M3 Build - 22nd August 2003 - 3.0 MILESTONE-3
-<br>Project org.eclipse.jdt.core v_367
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_367">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40464">40464</a>
-Index states not saved
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41805">41805</a>
-ArrayIndexOutOfBoundsException while creating AST
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39831">39831</a>
-Search finds only "inexact" matches
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35980">35980</a>
-illegal code completion suggested (abstract methods)
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40779">40779</a>
-Primary working copies: no deltas on destroy
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36271">36271</a>
-CodeAssist should treat array.clone() as visible
-<br<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40681">40681</a>
-no warnings for some externalized strings
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40584">40584</a>
-Test suite configuration should be more flexible
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41674">41674</a>
-ToolFactory.createDefaultClassFileReader does not close zipfile
-
-<a name="v_366"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M3 Build - 19th August 2003
-<br>Project org.eclipse.jdt.core v_366
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_366">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>In 1.4 mode, the compiler is now JCK 1.4a compliant (previously was passing JCK1.4).
-</li>
-<li>To reduce the memory consumption and improve performance, the following new APIs were added:
-<ul>
-<li>AST.parsePartialCompilationUnit(ICompilationUnit unit, int position, boolean resolveBindings)</li>
-<li>AST.parsePartialCompilationUnit(ICompilationUnit unit, int position, boolean resolveBindings, WorkingCopyOwner owner)</li>
-</ul>
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41602">41602</a>
-missing @exception in javadoc of IPackageFragment.getNonJavaResources
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38635">38635</a>
-Refactor / Rename Package doesn't allow rename to same name with different case [refactoring]
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40476">40476</a>
-refactor change method signature reports erroneous non-constant case statements
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40995">40995</a>
-NPE in ast.ExplicitConstructorCall.analyseCode
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40880">40880</a>
-Wrong error range for 'indirect static access'
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40174">40174</a>
-Performance issues with builder
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39108">39108</a>
-Numerous single type imports can slow compiler down significantly
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41019">41019</a>
-org.eclipse.jdt.core.Signature cannot resolve complex type that has package name starting with letters as any primitive type
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38633">38633</a>
-Search should not open requested types with match locator parser
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40954">40954</a>
-ArrayIndexOutOfBoundsException during sort members
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40804">40804</a>
-NPE in MethodBinding.sourceMethod()
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40474">40474</a>
-DOM/AST: Add API to parse only part of a compilation
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40839">40839</a>
-Deprecation is reported even if there is an empty member declaration prior to the field declaration
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40606">40606</a>
-Unable to discard empty package if containing .class files
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39174">39174</a>
-NPE in type hierarchy when opening type
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40082">40082</a>
-NPE in TypeHierarchy.packageRegionContainsSamePackageFragment(TypeHierarchy.java:1314)
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40090">40090</a>
-No need to close Java model on shutdown
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42589">42589</a>
-jck1.4a failures
-
-<a name="v_365a"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M3 Build - 24th July 2003
-<br>Project org.eclipse.jdt.core v_365a
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_365a">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40752">40752</a>
-internal compiler error: java.lang.ClassCastException: org.eclipse.jdt.internal.compiler.lookup.ArrayBinding
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40594">40594</a>
-wrong location set for org.apache.ant when building jdt component with baseLocation
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40715">40715</a>
-getWorkingCopy(...) should always return a new working copy for primary cus
-
-<a name="v_365"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M3 Build - 22nd July 2003
-<br>Project org.eclipse.jdt.core v_365
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_365">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li> Added optional diagnosis for undocumented empty blocks
-<pre>
-* COMPILER / Reporting Undocumented Empty Block
-* When enabled, the compiler will issue an error or a warning when an empty block is detected and it is not
-* documented with any comment.
-* - option id: "org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock"
-* - possible values: { "error", "warning", "ignore" }
-* - default: "ignore"
-</pre>
-</li>
-<li> Removed optional diagnosis for boolean methods throwing exception, since it proved to be useless as is.
-</li>
-<li>Fix for bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40116">40116</a>
- requires the index format to be changed. Indexes will be automatically regenerated upon
- subsequent search queries (accounting for indexing notification in search progress dialogs).
+<li>
+Explicit parameterizations of message sends and constructor calls are also supported.
</li>
</ul>
<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40382">40382</a>
-JavaModelException#printStackTrace should be improved
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40572">40572</a>
-Unnecessary cast warning for necessary cast
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40322">40322</a>
-Error creating new Java projects
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40421">40421</a>
-Unnecessary cast warning...true but...
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=32285">32285</a>
-DCR - extra java compiler markers
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40514">40514</a>
-ArrayIndexOutOfBoundsException during detection of unnecessary casts
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40442">40442</a>
-Abstract class fails to invoke interface-defined method in 1.4 compliance mode.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40116">40116</a>
-Search for references to nested class doesn't find anything
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40334">40334</a>
-Model should be more tolerant for possible compiler failures
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36479">36479</a>
-Rename operation during refactoring fails
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39865">39865</a>
-Misleading error diagnosis on broken method signatures
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=12800">12800</a>
-suboptimal error messages on mistyped 'throw/throws' keywords
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38568">38568</a>
-Search for method declarations fooled by array types
-
-<a name="v_364b"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M2 Build - 18th July 2003 - 3.0 MILESTONE-2
-<br>Project org.eclipse.jdt.core v_364b
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_364b">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40495">40495</a>
-VerifyError with return statements containing a cast expression
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62416">62416</a>
+[1.5] An error has occurred when creating this (Java) editor
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62292">62292</a>
+[1.5] Missing receiver in parameterized message send
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61507">61507</a>
+[1.5] NPE in computeCompatibleMethod
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60681">60681</a>
+[1.5] Return type not strict enough
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60563">60563</a>
+[1.5] VerifyError when using generics and arrays
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59258">59258</a>
+Possibility to share compiler preferences for a shared project
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60556">60556</a>
+[1.5] Collections.unmodifiableList(List<A>)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58978">58978</a>
+[1.5] Generic method needs better error reporting
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59983">59983</a>
+[1.5] Internal compiler error
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58903">58903</a>
+[1.5] Implementing inherited generic methods
-<a name="v_364a"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M2 Build - 17th July 2003
-<br>Project org.eclipse.jdt.core v_364a
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_364a">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40423">40423</a>
-NPE Saving a file
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40288">40288</a>
-NPE while building
-<a name="v_364"></a>
+<a name="v_422_Cheetah04"></a>
<p><hr><h1>
Eclipse Platform Build Notes&nbsp;<br>
Java Development Tooling Core</h1>
-Eclipse SDK 3.0M2 Build - 16th July 2003
-<br>Project org.eclipse.jdt.core v_364
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_364">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40210">40210</a>
-ICompilationUnit#isWorkingCopy() misbehaving for discarded working copies
-
-<a name="v_363"></a>
-<p><hr><h1>
Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M2 Build - 15th July 2003
-<br>Project org.eclipse.jdt.core v_363
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_363">cvs</a>).
+Eclipse SDK 3.1 - 23th April 2004
+<br>Project org.eclipse.jdt.core v_422_Cheetah04
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_422_Cheetah04">cvs</a>).
<h2>
What's new in this drop</h2>
<ul>
-<li>Added flag <code>IJavaElementDelta.F_PRIMARY_WORKING_COPY</code> that signals that a compilation unit has become a
- primary working copy, or that a primary working copy has reverted to a compilation unit (i.e. primary working copies are not notified
- as being added/removed like other working copies, since the primary unit is only changing mode, also see bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40028">40028</a>).
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40028">40028</a>
-Deltas and deleted working copies
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39823">39823</a>
-AST: Would like to have binding of Serializable and Clonable
-
-<a name="v_362"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M2 Build - 14th July 2003
-<br>Project org.eclipse.jdt.core v_362
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_362">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li> Added optional diagnosis for unnecessary cast or instanceof operations (matching problem IDs are
-<code>IProblem.UnnecessaryCast</code>, <code>IProblem.UnnecessaryArgumentCast</code>, <code>IProblem.UnnecessaryInstanceof</code>).
-<pre>
-* COMPILER / Reporting Unnecessary Type Check
-* When enabled, the compiler will issue an error or a warning when a cast or an instanceof operation
-* is unnecessary.
-* - option id: "org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck"
-* - possible values: { "error", "warning", "ignore" }
-* - default: "ignore"
-</pre>
-</li>
-<li> Changed Java element delta processing to be thread-safe.
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39926">39926</a>
-deleting default package (not in source folder) does nothing
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39877">39877</a>
-Rebuild All generates extra "Unable to read classpath" entry.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39925">39925</a>
-Unnecessary instanceof checking leads to a NullPointerException
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35442">35442</a>
-flag unnecessary casts
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39841">39841</a>
-Give better explanation of why abstract class can't be instantiated
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39467">39467</a>
-Classes not implementing abstract methods compile without error
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39763">39763</a>
-Non NLS string is reported and it should not
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39779">39779</a>
-End position of IType exceeds the size of CompilationUnit
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39766">39766</a>
-compilation unit cannot be saved
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39664">39664</a>
-setSuperInterfaces(String[] interfaceNames) API of org.eclipse.jdt.core.jdom.IDOMType interface does not work for an empty array parameter as Input
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39663">39663</a>
-setSuperclass(String superclassName) API of org.eclipse.jdt.core.jdom.IDOMType interface does not work for null as Input
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39736">39736</a>
-JavaModelException on copying read-only CompilationUnits
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39009">39009</a>
-NPE in Delta processor while executing JDT/UI tests
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35739">35739</a>
-Stack dump on console
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35632">35632</a>
-NPE in DeltaProcessor
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39281">39281</a>
-Unable Refacter (renaming) an inner class
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38450">38450</a>
-Delete: Removing default package removes source folder
-
-<a name="v_361"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M2 Build - 7th July 2003
-<br>Project org.eclipse.jdt.core v_361
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_361">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li> Added optional compiler diagnosis for boolean method declaring thrown exceptions
-(matching problem ID is <code>IProblem.BooleanMethodThrowingException</code>)
-<pre>
-* COMPILER / Reporting Boolean Method Declaring Thrown Exceptions
-* When enabled, the compiler will issue an error or a warning when a boolean method declaration
-* is specifying a clause for thrown exceptions. Some of them are predicates, and these should only
-* return a boolean value and not raise exceptions.
-* - option id: "org.eclipse.jdt.core.compiler.problem.booleanMethodThrowingException"
-* - possible values: { "error", "warning", "ignore" }
-* - default: "ignore"
-</pre>
-<li> Added optional compiler diagnosis for indirect references to static members (matching problem IDs are:
-<code>IProblem.IndirectAccessToStaticField</code>, <code>IProblem.IndirectAccessToStaticMethod</code>, <code>IProblem.IndirectAccessToStaticType</code>).
-<pre>
-* COMPILER / Reporting Indirect Reference to a Static Member
-* When enabled, the compiler will issue an error or a warning whenever a static field
-* or method is accessed in an indirect way. A reference to a static member should
-* preferably be qualified with its declaring type name.
-* - option id: "org.eclipse.jdt.core.compiler.problem.indirectStaticAccess"
-* - possible values: { "error", "warning", "ignore" }
-* - default: "ignore"
-</pre>
-</li>
-<li> Removed method <code>Parser#grammar()</code>, which was hosting the Java grammar as a massive comment.
-From now on, the grammar is defined in its own separate file: <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/grammar/java_1_4.g"><code>java_1_4.g</code></a>.
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39624">39624</a>
-Should warn about predicate throwing exceptions
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39168">39168</a>
-Could remove JavaElement.fLEType field
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36989">36989</a>
-Incorrect error for "super must be first statement in constructor"
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=3319">3319</a>
-wrong compile-time error message (1GG1LDK)
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39268">39268</a>
-Optional warning for indirect static references
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39533">39533</a>
-Working copy with no corresponding file not considered by NameLookup
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39502">39502</a>
-No completion in message send
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39475">39475</a>
-Extra error diagnosis in editor from siblings
-
-<a name="v_360"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M2 Build - 1st July 2003
-<br>Project org.eclipse.jdt.core v_360
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_360">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li> Plugin version ID got incremented to 3.0.0.
-</li>
-<li> Removed tolerance for relative source attachments in <code>JavaCore.newLibraryEntry(...)</code>. Only
-allowing relative empty pathes so as to permit using classpath variables to denote the absence of a source attachment.
-<li>To finish closing the gap between compilation units and working copies
-(see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36888">bug 36888</a>), new APIs were added to generalize
-the usage of a working copy owner (entire JavaModel is now aware of owned working copies). These new APIs are copies of existing APIs augmented with
-a <code>WorkingCopyOwner</code> parameter, that defines the working copies to consider in the operation.
-When specifying an owner parameter, all working copies belonging to this owner will implicitly take precedence over primary ones
-(without requiring the owner to remember all its working copies, as in 2.1 era). Note that when no owned working copy is found, a primary
-unit will be considered instead, and since primary units have a built-in working copy (see <code>ICompilationUnit.becomeWorkingCopy(...)</code>),
-the primary unit may already be in working copy mode (very likely since an editor got opened on it). This means that an owner will already
-transparently see unsaved editor contents for all units for which it has no better working copy to contribute.
-The following new APIs were added:
- <ul>
- <li><code>AST.parseCompilationUnit(char[] source, String unitName, IJavaProject project, WorkingCopyOwner owner)</code></li>
- <li><code>AST.parseCompilationUnit(IClassFile classFile, boolean resolveBindings, WorkingCopyOwner owner)</code></li>
- <li><code>AST.parseCompilationUnit(ICompilationUnit unit, boolean resolveBindings, WorkingCopyOwner owner)</code></li>
- <li><code>IEvaluationContext.codeComplete(String codeSnippet, int position, ICompletionRequestor requestor, WorkingCopyOwner owner)</code></li>
- <li><code>IEvaluationContext.codeSelect(String codeSnippet, int offset, int length, WorkingCopyOwner owner)</code></li>
- <li><code>IDOMCompilationUnit.getCompilationUnit(IPackageFragment parent, WorkingCopyOwner owner)</code></li>
- <li><code>ICodeAssist.codeComplete(int offset, ICompletionRequestor requestor, WorkingCopyOwner owner)</code></li>
- <li><code>ICodeAssist.codeSelect(int offset, int length, WorkingCopyOwner owner)</code></li>
- <li><code>ICompilationUnit.reconcile(boolean forceProblemDetection, WorkingCopyOwner owner, IProgressMonitor monitor)</code></li>
- <li><code>IJavaProject.findElement(IPath path, WorkingCopyOwner owner)</code></li>
- <li><code>IJavaProject.findType(String packageName, String typeQualifiedName, WorkingCopyOwner owner)</code></li>
- <li><code>IJavaProject.findType(String fullyQualifiedName, WorkingCopyOwner owner)</code></li>
- <li><code>IJavaProject.newTypeHierarchy(IRegion region, WorkingCopyOwner owner, IProgressMonitor monitor)</code></li>
- <li><code>IJavaProject.newTypeHierarchy(IType type, IRegion region, WorkingCopyOwner owner, IProgressMonitor monitor)</code></li>
- <li><code>IPackageFragment.getCompilationUnit(String name, WorkingCopyOwner owner)</code></li>
- <li><code>IPackageFragment.getCompilationUnits(WorkingCopyOwner owner)</code></li>
- <li><code>IType.codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, ICompletionRequestor requestor, WorkingCopyOwner owner)</code></li>
- <li><code>IType.newSupertypeHierarchy(WorkingCopyOwner owner, IProgressMonitor monitor)</code></li>
- <li><code>IType.newTypeHierarchy(IJavaProject project, WorkingCopyOwner owner, IProgressMonitor monitor)</code></li>
- <li><code>IType.newTypeHierarchy(WorkingCopyOwner owner, IProgressMonitor monitor)</code></li>
- <li><code>IType.resolveType(String typeName, WorkingCopyOwner owner)</code></li>
- <li><code>JavaCore.create(IFile file, WorkingCopyOwner owner)</code></li>
- <li><code>JavaCore.create(IResource resource, WorkingCopyOwner owner)</code></li>
- <li><code>JavaCore.create(String handleIdentifier, WorkingCopyOwner owner)</code></li>
- <li><code>JavaCore.createCompilationUnitFrom(IFile file, WorkingCopyOwner owner)</code></li>
- <li><code>JavaCore.getWorkingCopies(WorkingCopyOwner owner)</code></li>
- <li><code>SearchEngine.SearchEngine(WorkingCopyOwner workingCopyOwner)</code></li>
- <li><code>SearchEngine.createHierarchyScope(IType type, WorkingCopyOwner owner)</code></li>
- </ul>
+<li>
+Wildcard type compatibilities got reworked quite significantly. In
+particular, it now diagnoses
+usage of methods which parameters are of wildcard type (see 59641).
</li>
-<li> Added optional problem to signal superfluous semicolons (matching problem ID is <code>IProblem.SuperfluousSemicolon</code>).
-<pre>
-* COMPILER / Reporting Superfluous Semicolon
-* When enabled, the compiler will issue an error or a warning if a superfluous semicolon is met.
-* - option id: "org.eclipse.jdt.core.compiler.problem.superfluousSemicolon"
-* - possible values: { "error", "warning", "ignore" }
-* - default: "ignore"</pre>
+<li>
+Covariance is still not supported, but the Cheetah can now issue synthetic
+bridge methods for allowing overriding to parameterized methods.
</li>
</ul>
<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=26281">26281</a>
-error hover text indicates wrong problem
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=23166">23166</a>
-Syntax error message from Java compiler is confusing.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=33213">33213</a>
-Same error reported more than once?
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36214">36214</a>
-TODOs reported twice when located at the end of the method declaration
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36232">36232</a>
-binding do not fully consider working copies
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36888">36888</a>
-Close the gap between original and working copies
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39311">39311</a>
-Outliner did not refresh after method rename (refactor)
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39259">39259</a>
-While statement has wrong source position
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39007">39007</a>
-Infinite loop trying to index a non-existing external jar
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39172">39172</a>
-Incorrect error reported if extra semi-colon exists on a return statement
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59723">59723</a>
+[1.5] Compiler rejects usage of ArrayList.toArray(char[][])
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59628">59628</a>
+[1.5] Erroneous diagnosis for missing abstract method implementation
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59641">59641</a>
+[1.5] Compiler should refuse usage of wildcard argument values
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59147">59147</a>
+[1.5] Compiler rejects correct code with wildcards and raw types
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58979">58979</a>
+[1.5] NullPointerException in compiler
-<a name="v_359"></a>
+<a name="v_421_Cheetah03"></a>
<p><hr><h1>
Eclipse Platform Build Notes&nbsp;<br>
Java Development Tooling Core</h1>
-Eclipse SDK 3.0M2 Build - 23rd June 2003
-<br>Project org.eclipse.jdt.core v_359
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_359">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Added API on <code>ICompilationUnit</code> to get the primary compilation unit of a working copy
- (it replaces <code>IWorkingCopy.getOriginalElement()</code>):
-<pre>
-/**
- * Returns the primary compilation unit (whose owner is the primary owner)
- * this working copy was created from, or this compilation unit if this a primary
- * compilation unit.
- * Note that the returned primary compilation unit can be in working copy mode.
- *
- * @return the primary compilation unit this working copy was created from,
- * or this compilation unit if it is primary
- * @since 3.0
- */
-ICompilationUnit getPrimary();
-</pre>
-</li>
-<li>Added API on <code>IJavaElement</code> to get the primary element of a working copy
- element (it replaces <code>IWorkingCopy.getOriginalElement(IJavaElement)</code>):
-<pre>
-/**
- * Returns the primary element (whose compilation unit is the primary compilation unit)
- * this working copy element was created from, or this element if it is a descendant of a
- * primary compilation unit or if it is not a descendant of a working copy (e.g. it is a
- * binary member).
- * The returned element may or may not exist.
- *
- * @return the primary element this working copy element was created from, or this
- * element.
- * @since 3.0
- */
-IJavaElement getPrimaryElement();
-</pre>
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38678">38678</a>
-workspace did not shutdown
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37006">37006</a>
-2 tasks in the tasks view instead of one
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38759">38759</a>
-Task Tags: should not consider text in substrings/parts of text
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36066">36066</a>
-Outliner did not refresh after field rename
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38951">38951</a>
-NPE in editor while saving contents
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35877">35877</a>
-Stack overflow in code assist
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35409">35409</a>
-RC2 Compiler produces bogus error messages
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38838">38838</a>
-SyntaxError- unoptimal syntax error message
-
-
-<a name="v_357b"></a>
-<p><hr><h1>
Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M2 Build - 18th June 2003
-<br>Project org.eclipse.jdt.core v_357b
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_357b">cvs</a>).
+Eclipse SDK 3.1 - 16th April 2004
+<br>Project org.eclipse.jdt.core v_421_Cheetah03
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_421_Cheetah03">cvs</a>).
<h2>
What's new in this drop</h2>
<ul>
-<li>Backported index manager deadlock fix on top of v_357</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38901">38901</a>
-IndexManager hangs in end-less loop
-
-
-<a name="v_358"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M2 Build - 16th June 2003
-<br>Project org.eclipse.jdt.core v_358
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_358">cvs</a>).
-
-<p><b>NOTE:</b> This version got backed out due to severe regression
-(see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38951">38951</a> NPE in editor while saving contents).
-Until subsequent version is made available (see above), integration builds will revert to previous version (v_357).
-
-<h2>
-What's new in this drop</h2>
-<ul>
-<li><code>JavaCore.newLibraryEntry(...)</code> will now allow an empty source attachment (<code>new Path("")</code>) to
-be equivalent to no source attachment (i.e. <code>null</code>). This adjustment is made necessary for
-library entries generated from classpath variables which cannot be set to <code>null</code>. Also see
-bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38531">38531</a>.
-<pre>
-* @param sourceAttachmentPath the absolute path of the corresponding source archive or folder,
-* or <code>null</code> if none. Note, since 3.0, an empty path is allowed to denote no source attachment.
-* and will be automatically converted to <code>null</code>.
-</pre>
-</li>
-<li>Added API <code>IJavaProject#forceClasspathReload(IProgressMonitor)</code> to force reload of <code>.classpath</code> file
-before next automatic update occurs.
-<pre>
-/**
- * Force the project to reload its <code>.classpath</code> file from disk and update the classpath accordingly.
- * Usually, a change to the <code>.classpath</code> file is automatically noticed and reconciled at the next
- * resource change notification event. If required to consider such a change prior to the next automatic
- * refresh, then this functionnality should be used to trigger a refresh. In particular, if a change to the file is performed,
- * during an operation where this change needs to be reflected before the operation ends, then an explicit refresh is
- * necessary.
- *
- * @param monitor a progress monitor for reporting operation progress
- * @exception JavaModelException if the classpath could not be updated. Reasons
- * include:
- * - This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
- * - Two or more entries specify source roots with the same or overlapping paths (NAME_COLLISION)
- * - A entry of kind <code>CPE_PROJECT</code> refers to this project (INVALID_PATH)
- * - This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
- * - The output location path refers to a location not contained in this project (<code>PATH_OUTSIDE_PROJECT</code>)
- * - The output location path is not an absolute path (<code>RELATIVE_PATH</code>)
- * - The output location path is nested inside a package fragment root of this project (<code>INVALID_PATH</code>)
- * - The classpath is being modified during resource change event notification (CORE_EXCEPTION)
- * @since 3.0
- */
-</pre>
-</li>
-<li>In the process of closing the gap between compilation units and working copies
-(see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36888 ">bug 36888 </a>), the following new APIs
-are added to <code>ICompilationUnit</code>:
- <ul>
- <li><pre>
-/**
- * Changes this compilation unit handle into a working copy. A new IBuffer is
- * created using this compilation unit handle's owner. Uses the primary owner is none was
- * specified when this compilation unit handle was created.
- *
- * When switching to working copy mode, problems are reported to given
- * IProblemRequestor.
- *
- * Once in working copy mode, changes to this compilation unit or its children are done in memory.
- * Only the new buffer is affected. Using commitWorkingCopy(boolean, IProgressMonitor)
- * will bring the underlying resource in sync with this compilation unit.
- *
- * If this compilation unit was already in working copy mode, an internal counter is incremented and no
- * other action is taken on this compilation unit. To bring this compilation unit back into the original mode
- * (where it reflects the underlying resource), discardWorkingCopy must be call as many
- * times as becomeWorkingCopy.
- *
- * @param problemRequestor a requestor which will get notified of problems detected during
- * reconciling as they are discovered. The requestor can be set to null indicating
- * that the client is not interested in problems.
- * @param monitor a progress monitor used to report progress while opening this compilation unit
- * or null if no progress should be reported
- * @exception JavaModelException if this compilation unit could not become a working copy.
- * @see discardWorkingCopy
- * @since 3.0
- */
-void becomeWorkingCopy(IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException;
- </pre></li>
- <li><pre>
-/**
- * Commits the contents of this working copy to its underlying resource.
- *
- * It is possible that the contents of the original resource have changed
- * since this working copy was created, in which case there is an update conflict.
- * The value of the force parameter effects the resolution of
- * such a conflict:
- * - true - in this case the contents of this working copy are applied to
- * the underlying resource even though this working copy was created
- * before a subsequent change in the resource
- * - false - in this case a JavaModelException is thrown
- *
- * Since 2.1, a working copy can be created on a not-yet existing compilation
- * unit. In particular, such a working copy can then be committed in order to create
- * the corresponding compilation unit.
- *
- * @param force a flag to handle the cases when the contents of the original resource have changed
- * since this working copy was created
- * @param monitor the given progress monitor
- * @exception JavaModelException if this working copy could not commit. Reasons include:
- * - A CoreException occurred while updating an underlying resource
- * - This element is not a working copy (INVALID_ELEMENT_TYPES)
- * - A update conflict (described above) (UPDATE_CONFLICT)
- * @since 3.0
- */
-void commitWorkingCopy(boolean force, IProgressMonitor monitor) throws JavaModelException;
- </pre></li>
- <li><pre>
-/**
- * Changes this compilation unit in working copy mode back to its original mode.
- *
- * This has no effect if this compilation unit was not in working copy mode.
- *
- * If becomeWorkingCopy was called several times on this
- * compilation unit, discardWorkingCopy must be called as
- * many times before it switches back to the original mode.
- *
- * @see becomeWorkingCopy
- * @exception JavaModelException if this working copy could not return in its original mode.
- * @since 3.0
- */
-void discardWorkingCopy() throws JavaModelException;
- </pre></li>
- <li><pre>
-/**
- * Returns the working copy owner of this working copy.
- * Returns null if it is not a working copy or if it has no owner.
- *
- * @return WorkingCopyOwner the owner of this working copy or null
- * @since 3.0
- */
-WorkingCopyOwner getOwner();
- </pre></li>
- <li><pre>
-/**
- * Returns a new working copy of this element if this element is not
- * a working copy, or this element if this element is already a working copy.
- *
- * Note: if intending to share a working copy amongst several clients, then
- * getWorkingCopy(WorkingCopyOwner, IProblemRequestor, IProgressMonitor)
- * should be used instead.
- *
- * When the working copy instance is created, an ADDED IJavaElementDelta is
- * reported on this working copy.
- *
- * Since 2.1, a working copy can be created on a not-yet existing compilation
- * unit. In particular, such a working copy can then be committed in order to create
- * the corresponding compilation unit.
- *
-* @param monitor a progress monitor used to report progress while opening this compilation unit
- * or null if no progress should be reported
- * @exception JavaModelException if the contents of this element can
- * not be determined.
- * @return a new working copy of this element if this element is not
- * a working copy, or this element if this element is already a working copy
- * @since 3.0
- */
-ICompilationUnit getWorkingCopy(IProgressMonitor monitor) throws JavaModelException;
- </pre></li>
- <li><pre>
-/**
- * Returns a shared working copy on this element using the given working copy owner to create
- * the buffer, or this element if this element is already a working copy.
- * This API can only answer an already existing working copy if it is based on the same
- * original compilation unit AND was using the same working copy owner (that is, as defined by Object.equals).
- *
- * The life time of a shared working copy is as follows:
- * - The first call to getWorkingCopy(WorkingCopyOwner, IProblemRequestor, IProgressMonitor)
- * creates a new working copy for this element
- * - Subsequent calls increment an internal counter.
- * - A call to discardWorkingCopy() decrements the internal counter.
- * - When this counter is 0, the working copy is discarded.
- *
- * So users of this method must discard exactly once the working copy.
- *
- * Note that the working copy owner will be used for the life time of this working copy, that is if the
- * working copy is closed then reopened, this owner will be used.
- * The buffer will be automatically initialized with the original's compilation unit content
- * upon creation.
- *
- * When the shared working copy instance is created, an ADDED IJavaElementDelta is reported on this
- * working copy.
- *
- * Since 2.1, a working copy can be created on a not-yet existing compilation
- * unit. In particular, such a working copy can then be committed in order to create
- * the corresponding compilation unit.
- *
- * @param owner the working copy owner that creates a buffer that is used to get the content
- * of the working copy
- * @param problemRequestor a requestor which will get notified of problems detected during
- * reconciling as they are discovered. The requestor can be set to null indicating
- * that the client is not interested in problems.
- * @param monitor a progress monitor used to report progress while opening this compilation unit
- * or null if no progress should be reported
- * @exception JavaModelException if the contents of this element can
- * not be determined.
- * @return a new working copy of this element using the given factory to create
- * the buffer, or this element if this element is already a working copy
- * @since 3.0
- */
-ICompilationUnit getWorkingCopy(WorkingCopyOwner owner, IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException;
- </pre></li>
- </ul>
-And the following abstract class replaces <code>IBufferFactory</code>:
- <pre>
-/**
- * The owner of an ICompilationUnit handle in working copy mode.
- * An owner is used to identify a working copy and to create its buffer.
- *
- * @see ICompilationUnit#becomeWorkingCopy
- * @see ICompilationUnit#discardWorkingCopy
- * @since 3.0
- */
-public abstract class WorkingCopyOwner {
- /**
- * Creates a buffer for the given working copy.
- * The new buffer will be initialized with the contents of the underlying file
- * if and only if it was not already initialized by the compilation owner (a buffer is
- * uninitialized if its content is null).
- *
- * @param workingCopy the working copy of the buffer
- * @return IBuffer the created buffer for the given working copy
- * @see IBuffer
- */
- public IBuffer createBuffer(ICompilationUnit workingCopy) {
- ...
- }
-}
- </pre>
- The intent for the primary owner is to use a buffer factory that would be
- provided by the org.eclipse.text infractructure. This infrastructure not being
- ready yet, in the meantime one can change the primary owner's
- <code>IBufferFactory</code> using the following internal API:
- <pre>
-org.eclipse.jdt.internal.core.DefaultWorkingCopyOwner.PRIMARY.factory = ...;
- </pre>
-
+<li>
+The Cheetah is now able to digest generic methods and perform type inference.
+It also recognizes the Object.getClass() method and perform adequate
+substitutions (see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57784">57784</a>).
</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38901">38901</a>
-IndexManager hangs in end-less loop
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38908">38908</a>
-Ant script reports that the bootclasspath cannot be infer
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38531">38531</a>
-IllegalArgumentException "Source attachment path should be absolute"
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38424">38424</a>
-Mistake on Web site
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38732">38732</a>
-organize imports does not work with assert in source code
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38447">38447</a>
-AST: Source ranges with missing bracket
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36854">36854</a>
-NPE opening type hierarchy
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=33530">33530</a>
-JavaModel synchronization model should be more optimistic
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=20931">20931</a>
-Need an API to reload the classpath from the file
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38393">38393</a>
-bytecode generated for evaluation with parentheses is wrong
-
-<a name="v_357"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M1 Build - 5th June 2003 - 3.0 MILESTONE-1
-<br>Project org.eclipse.jdt.core v_357
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_357">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37274">37274</a>
-Deadlock on plugin import
-
-
-<a name="v_356"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M1 Build - 4th June 2003
-<br>Project org.eclipse.jdt.core v_356
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_356">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38362">38362</a>
-Inconsistent output when using comparrisson operators
-
-
-<a name="v_355"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M1 Build - 3rd June 2003
-<br>Project org.eclipse.jdt.core v_355
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_355">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Fix for bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37111">37111</a> may issue some outgoing changes
-to .classpath file since the source attachment will be shortened into a project relative path when applicable. The .classpath file
-is still backward compatible, and will continue to accept non relative source attachments as well. </li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37111">37111</a>
-classpath file - java source attachment shouldn't hardcode project name
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38143">38143</a>
-this = null; should raise compile time error
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38124">38124</a>
-Brackets around cast accepted by Eclipse but not javac
-
-
-<a name="v_354"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M1 Build - 26th May 2003
-<br>Project org.eclipse.jdt.core v_354
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_354">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Added <code>JavaCore</code> optional problem to detect incompatible required binaries, so as to flag situations where
-some prerequisite binaries are required a JRE level higher than the project target platform; i.e. compiling against 1.4 libraries
-when deploying for 1.1 platform is likely unwanted.
-<pre>
-* JAVACORE / Reporting Incompatible JDK Level for Required Binaries
-* Indicate the severity of the problem reported when a project prerequisites another project
-* or library with an incompatible target JDK level (e.g. project targeting 1.1 vm, but compiled against 1.4 libraries).
-* - option id: "org.eclipse.jdt.core.incompatibleJDKLevel"
-* - possible values: { "error", "warning", "ignore" }
-* - default: "ignore"
-</pre>
+<li>
+Generic types completion is available and type parameters are proposed
+as possible completions.
+Currently type parameter proposals are given by
+ICompletionRequestor#acceptClass().
</li>
</ul>
<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37750">37750</a>
-incorrect handle identifier for IImportContainer
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36674">36674</a>
-compiler can generate Java 1.4-only bytecode regardless of compatibility settings
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37962">37962</a>
-Unexpected transient problem during reconcile
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37166">37166</a>
-NPE in SearchEngine when matching type against ProblemReferenceBinding
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37438">37438</a>
-searchenging NPE in searchDeclarationsOfReferencedTypes
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37779">37779</a>
-ExceptionInInitializerError when using JDTCompilerAdapter
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36307">36307</a>
-JDK1.4.2: Wrong declaring class for clone method on array class
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58715">58715</a>
+[1.5] The return type is incompatible
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58631">58631</a>
+[1.5] Cycle in hierarchy no longer detected
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58666">58666</a>
+[1.5] Object.getClass() need to be treated special ?
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57784">57784</a>
+[1.5] Errors using Arrays.asList(T [])
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58461">58461</a>
+[1.5] java.lang.VerifyError from enhanced for loop
-<a name="v_353"></a>
+<a name="v_421_Cheetah02"></a>
<p><hr><h1>
Eclipse Platform Build Notes&nbsp;<br>
Java Development Tooling Core</h1>
-Eclipse SDK 3.0M1 Build - 19th May 2003
-<br>Project org.eclipse.jdt.core v_353
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_353">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37621">37621</a>
-java compiler creates class with internal inconsistency
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37646">37646</a>
-Help for JDTCompilerAdapter is dated
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36894">36894</a>
-JobManager could wait when idle
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37541">37541</a>
-Unoptimal deprecation diagnosis
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37565">37565</a>
-JACKS: Class literal should not cause class initialization
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37503">37503</a>
-Compiler does not take care of exclusion filter
-
-
-<a name="v_352"></a>
-<p><hr><h1>
Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M1 Build - 13th May 2003
-<br>Project org.eclipse.jdt.core v_352
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_352">cvs</a>).
+Eclipse SDK 3.1 - 13th April 2004
+<br>Project org.eclipse.jdt.core v_421_Cheetah02
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_421_Cheetah02">cvs</a>).
<h2>
What's new in this drop</h2>
<ul>
-<li>Lowered default severity of field/local variable hiding optional diagnosis to <code>"ignore"</code>.
-</li>
-<li>Lowered default severity of accidental boolean assignment optional diagnosis to <code>"ignore"</code>.
-</li>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37501">37501</a>
-VerifyError with assert when optimizing out unused local variables
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37387">37387</a>
-Compiler generates unnecessary byte codes
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37381">37381</a>
-AST: Wrong source ranges on VariableDeclExpression
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37200">37200</a>
-"Source->Generate Delegate Methods..." fails
-
-<a name="v_351"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M1 Build - 29th April 2003
-<br>Project org.eclipse.jdt.core v_351
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_351">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37040">37040</a>
-VerifyError "Illegal target of jump or branch"
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36490">36490</a>
-Java compiler misses dependency on 'static final' class variables
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36814">36814</a>
-NaiveASTFlattener does not serialize try-finally statements correctly
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36772">36772</a>
-AST: CompilationUnit.findDeclaringNode: Spec/Impl not same
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36711">36711</a>
-Resource duplication message should list location of duplicate
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36718">36718</a>
-Compiler should not generate references to classes not on the classpath
-
-<a name="v_350"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 3.0M1 Build - 22nd April 2003
-<br>Project org.eclipse.jdt.core v_350
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_350">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-<li>Added new compiler optional problem to signal cases where a boolean variable is assigned
-in a condition expression. It is likely an accidental situation, where a comparison was actually meant.
-<pre>
-* COMPILER / Reporting Possible Accidental Boolean Assignment
-* When enabled, the compiler will issue an error or a warning if a boolean assignment is acting as the condition
-* of a control statement (where it probably was meant to be a boolean comparison).
-* - option id: "org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment"
-* - possible values: { "error", "warning", "ignore" }
-* - default: "warning"
-</pre>
-</li>
-<li>Added new compiler settings to control the diagnosis of variable hiding other ones.
-<pre>
-* COMPILER / Reporting Local Variable Declaration Hiding another Variable
-* When enabled, the compiler will issue an error or a warning whenever a local variable
-* declaration is hiding some field or local variable (either locally, inherited or defined in enclosing type).
-* - option id: "org.eclipse.jdt.core.compiler.problem.localVariableHiding"
+<li>
+Properly decode signatures of parameterized member types which are flourishing in 1.5 class libs,
+ and were reported as bogus inconsistencies with Cheetah01.
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53036">53036</a>
+Incorrect highlighting for type problem in qualified type name
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57716">57716</a>
+[1.5] NPE compiling SelectionParser in source 1.5
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57397">57397</a>
+[1.5] Unable to save unit
+
+<a name="v_420_Cheetah01"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Eclipse SDK 3.1 - 4th April 2004
+<br>Project org.eclipse.jdt.core v_420_Cheetah01
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_420_Cheetah01">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li> JDK 1.5 support.
+<li> JavaCore 1.5 specific options. Either augmented to consider 1.5 or added.
+<pre>
+* COMPILER / Setting Compliance Level
+* Select the compliance level for the compiler. In "1.3" mode, source and target settings
+* should not go beyond "1.3" level.
+* - option id: "org.eclipse.jdt.core.compiler.compliance"
+* - possible values: { "1.3", "1.4", "1.5" }
+* - default: "1.4"
+*
+* COMPILER / Setting Source Compatibility Mode
+* Specify whether which source level compatibility is used. From 1.4 on, 'assert' is a keyword
+* reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
+* level should be set to "1.4" and the compliance mode should be "1.4".
+* Source level 1.5 is necessary to enable generics, autoboxing, covariance, annotations, enumerations
+* enhanced for loop, static imports and varargs. Once toggled, the target VM level should be set to "1.5"
+* and the compliance mode should be "1.5".
+* - option id: "org.eclipse.jdt.core.compiler.source"
+* - possible values: { "1.3", "1.4", "1.5" }
+* - default: "1.3"
+*
+* COMPILER / Defining Target Java Platform
+* For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
+* Note that "1.4" target require to toggle compliance mode to "1.4" too. Similarily, "1.5" target require
+* to toggle compliance mode to "1.5".
+* - option id: "org.eclipse.jdt.core.compiler.codegen.targetPlatform"
+* - possible values: { "1.1", "1.2", "1.3", "1.4", "1.5" }
+* - default: "1.2"
+*
+* COMPILER / Reporting Unsafe Type Operation
+* When enabled, the compiler will issue an error or a warning whenever an operation involves generic types, and potentially
+* invalidates type safety since involving raw types (e.g. invoking #foo(X<String>) with arguments (X)).
+* - option id: "org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation"
* - possible values: { "error", "warning", "ignore" }
* - default: "warning"
*
-* COMPILER / Reporting Field Declaration Hiding another Variable
-* When enabled, the compiler will issue an error or a warning whenever a field
-* declaration is hiding some field or local variable (either locally, inherited or defined in enclosing type).
-* - option id: "org.eclipse.jdt.core.compiler.problem.fieldHiding"
+* COMPILER / Reporting final Bound for Type Parameter
+* When enabled, the compiler will issue an error or a warning whenever a generic type parameter is associated with a
+* bound corresponding to a final type; since final types cannot be further extended, the parameter is pretty useless.
+* - option id: "org.eclipse.jdt.core.compiler.problem.finalParameterBound"
* - possible values: { "error", "warning", "ignore" }
-* - default: "warning"
-*
-* COMPILER / Reporting Special Parameter Hiding another Field
-* When enabled, the compiler will signal cases where a constructor or setter method parameter declaration
-* is hiding some field (either locally, inherited or defined in enclosing type).
-* The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.localVariableHiding".
-* - option id: "org.eclipse.jdt.core.compiler.problem.specialParameterHidingField"
-* - possible values: { "enabled", "disabled" }
-* - default: "disabled"
+* - default: "ignore"
</pre>
</li>
</ul>
<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36510">36510</a>
-Automatically attach source for source files located in a class folder
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36499">36499</a>
-exists() returns true for a source file inside a classfolder
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36438">36438</a>
-null == null causes java.lang.VerifyError
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35755">35755</a>
-Search in hierarchy misses dependent projects
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36465">36465</a>
-Unable to create multiple source folders when not using bin for output
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36339">36339</a>
-Try codegen issues slightly incorrect ANY exception handler
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35965">35965</a>
-Source not found in source attachment
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36447">36447</a>
-Unoptimal wide conditional branch bytecode sequence
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=19286">19286</a>
-Suspicious synchronized operations
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36213">36213</a>
-ArrayIndex out of bounds
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36244">36244</a>
-JDK1.4.2: Add -cp as a batch option
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35528">35528</a>
-When I check out a project from CVS, Updating takes a very long time
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36058">36058</a>
-Unknown NPE in log
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=21661">21661</a>
-Compile dependency problems
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=28937">28937</a>
-Compiler Problem Marker: Accidental Boolean Assignment
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=33831">33831</a>
-ast API: add FieldAccess.resolveFieldBinding
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35649">35649</a>
-The SourceMapper instances could share the fileNamefilter
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=34896">34896</a>
-compiler setting "unused private fields"
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=33751">33751</a>
-The numbering of anonymous could be optimized
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35849">35849</a>
-Incremental compilation ignores linked folders
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35926">35926</a>
-Batch compiler compile should return false when the command line is incorrect
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35421">35421</a>
-[nls] Inconsistencies between properties files and nls strings
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=34173">34173</a>
-Create a compiler warning when an instance variable is "re-declared" as a local variable.
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=21140">21140</a>
-Warning/error on shadowing definition of data member?
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35490">35490</a>
-Search doesn't work for reference of 'cursorLocation'
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35338">35338</a>
-Cannot save file, "Save failed:null" error message received
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35438">35438</a>
-CastExpression resolution departs from JLS section 6.5.1
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36165">36165</a>
-[DOM/AST] Incorrect grammar rule in TypeDeclaration
-
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=56731">56731</a>
+[1.5] NPE inside ClassFileStruct when compiling with jre 1.5.0
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51262">51262</a>
+[1.5] Handling of additional bounds in type parameters
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52673">52673</a>
+[1.5] ArrayStoreException in 1.5 parser
-<a name="v_312"></a>
-<p><hr><h1>
-Eclipse Platform Build Notes&nbsp;<br>
-Java Development Tooling Core</h1>
-Eclipse SDK 2.1 Build (before 3.0/2.1.1 branching) - 31st March 2003
-<br>Project org.eclipse.jdt.core v_312
-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_312">cvs</a>).
-<h2>
-What's new in this drop</h2>
-<ul>
-</ul>
-
-<h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35831">35831</a>
-NPE navigating references using links
<p><hr>
-For earlier build notes, also see <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.jdt.core/notes/R21_buildnotes_jdt-core.html">build notes up to Release 2.1</a>.
+For earlier build notes, also see <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.jdt.core/notes/R30_buildnotes_jdt-core.html">build notes up to Release 3.0</a>.
<br>&nbsp;
</body>
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
index b2e7ccb965..35cab9f27b 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
@@ -135,6 +135,7 @@ public final class CompletionEngine
static final char[] THROWS = "throws".toCharArray(); //$NON-NLS-1$
static InvocationSite FakeInvocationSite = new InvocationSite(){
+ public TypeBinding[] genericTypeArguments() { return null; }
public boolean isSuperAccess(){ return false; }
public boolean isTypeAccess(){ return false; }
public void setActualReceiverType(ReferenceBinding receiverType) {}
@@ -411,7 +412,7 @@ public final class CompletionEngine
computeUninterestingBindings(astNodeParent, scope);
if(astNodeParent != null) {
- computeExpectedTypes(astNodeParent, scope);
+ computeExpectedTypes(astNodeParent, astNode, scope);
}
if (astNode instanceof CompletionOnFieldType) {
@@ -435,7 +436,7 @@ public final class CompletionEngine
SingleTypeReference type = (CompletionOnSingleTypeReference) method.returnType;
completionToken = type.token;
setSourceRange(type.sourceStart, type.sourceEnd);
- findTypesAndPackages(completionToken, scope);
+ findTypesAndPackages(completionToken, scope.parent);
findKeywordsForMember(completionToken, method.modifiers);
if(method.modifiers == CompilerModifiers.AccDefault) {
@@ -757,6 +758,23 @@ public final class CompletionEngine
if(astNode instanceof CompletionOnKeyword) {
CompletionOnKeyword keyword = (CompletionOnKeyword)astNode;
findKeywords(keyword.getToken(), keyword.getPossibleKeywords());
+ } else if(astNode instanceof CompletionOnParameterizedQualifiedTypeReference) {
+ CompletionOnParameterizedQualifiedTypeReference ref = (CompletionOnParameterizedQualifiedTypeReference) astNode;
+
+ insideQualifiedReference = true;
+
+ assistNodeIsClass = ref.isClass();
+ assistNodeIsException = ref.isException();
+ assistNodeIsInterface = ref.isInterface();
+
+ completionToken = ref.completionIdentifier;
+ long completionPosition = ref.sourcePositions[ref.tokens.length];
+ setSourceRange((int) (completionPosition >>> 32), (int) completionPosition);
+ findMemberTypes(
+ completionToken,
+ (ReferenceBinding) qualifiedBinding,
+ scope,
+ scope.enclosingSourceType());
}
}
}
@@ -983,9 +1001,25 @@ public final class CompletionEngine
}
*/
} catch (IndexOutOfBoundsException e) { // work-around internal failure - 1GEMF6D
+ if(DEBUG) {
+ System.out.println("Exception caught by CompletionEngine:"); //$NON-NLS-1$
+ e.printStackTrace(System.out);
+ }
} catch (InvalidCursorLocation e) { // may eventually report a usefull error
+ if(DEBUG) {
+ System.out.println("Exception caught by CompletionEngine:"); //$NON-NLS-1$
+ e.printStackTrace(System.out);
+ }
} catch (AbortCompilation e) { // ignore this exception for now since it typically means we cannot find java.lang.Object
+ if(DEBUG) {
+ System.out.println("Exception caught by CompletionEngine:"); //$NON-NLS-1$
+ e.printStackTrace(System.out);
+ }
} catch (CompletionNodeFound e){ // internal failure - bugs 5618
+ if(DEBUG) {
+ System.out.println("Exception caught by CompletionEngine:"); //$NON-NLS-1$
+ e.printStackTrace(System.out);
+ }
} finally {
reset();
}
@@ -2716,13 +2750,68 @@ public final class CompletionEngine
nameEnvironment.findPackages(CharOperation.toLowerCase(completionToken), this);
}
+ private void findTypeParameters(char[] token, Scope scope) {
+ TypeParameter[] typeParameters = null;
+ while (scope != null) { // done when a COMPILATION_UNIT_SCOPE is found
+ typeParameters = null;
+ switch (scope.kind) {
+ case Scope.METHOD_SCOPE :
+ MethodScope methodScope = (MethodScope) scope;
+ if(methodScope.referenceContext instanceof MethodDeclaration) {
+ MethodDeclaration methodDeclaration = (MethodDeclaration) methodScope.referenceContext;
+ typeParameters = methodDeclaration.typeParameters;
+ } else if(methodScope.referenceContext instanceof ConstructorDeclaration) {
+ ConstructorDeclaration methodDeclaration = (ConstructorDeclaration) methodScope.referenceContext;
+ typeParameters = methodDeclaration.typeParameters;
+ }
+ break;
+ case Scope.CLASS_SCOPE :
+ ClassScope classScope = (ClassScope) scope;
+ typeParameters = classScope.referenceContext.typeParameters;
+ break;
+ case Scope.COMPILATION_UNIT_SCOPE :
+ return;
+ }
+ if(typeParameters != null) {
+ for (int i = 0; i < typeParameters.length; i++) {
+ int typeLength = token.length;
+ TypeParameter typeParameter = typeParameters[i];
+
+ if (typeLength > typeParameter.name.length) continue;
+
+ if (!CharOperation.prefixEquals(token, typeParameter.name, false)) continue;
+
+ int relevance = computeBaseRelevance();
+ relevance += computeRelevanceForInterestingProposal();
+ relevance += computeRelevanceForCaseMatching(token, typeParameter.name);
+ relevance += computeRelevanceForExpectingType(typeParameter.type == null ? null :typeParameter.type.resolvedType);
+ relevance += computeRelevanceForQualification(false);
+ relevance += computeRelevanceForException(typeParameter.name);
+
+ noProposal = false;
+ requestor.acceptClass(
+ CharOperation.NO_CHAR,
+ typeParameter.name,
+ typeParameter.name,
+ typeParameter.modifiers,
+ startPosition - offset,
+ endPosition - offset,
+ relevance);
+ }
+ }
+ scope = scope.parent;
+ }
+ }
+
private void findTypesAndPackages(char[] token, Scope scope) {
if (token == null)
return;
- if (scope.enclosingSourceType() != null)
+ if (scope.enclosingSourceType() != null) {
findNestedTypes(token, scope.enclosingSourceType(), scope);
+ findTypeParameters(token, scope);
+ }
if (unitScope != null) {
int typeLength = token.length;
@@ -3202,7 +3291,7 @@ public final class CompletionEngine
int computeBaseRelevance(){
return R_DEFAULT;
}
- private void computeExpectedTypes(ASTNode parent, Scope scope){
+ private void computeExpectedTypes(ASTNode parent, ASTNode node, Scope scope){
// default filter
expectedTypesFilter = SUBTYPE;
@@ -3313,6 +3402,20 @@ public final class CompletionEngine
addExpectedType(BaseTypes.ByteBinding);
break;
}
+ BinaryExpression binaryExpression = (BinaryExpression) parent;
+ if(operator == OperatorIds.LESS) {
+ if(binaryExpression.left instanceof SingleNameReference){
+ SingleNameReference name = (SingleNameReference) binaryExpression.left;
+ Binding b = scope.getBinding(name.token, BindingIds.VARIABLE | BindingIds.TYPE, name, false);
+ if(b instanceof ReferenceBinding) {
+ TypeVariableBinding[] typeVariableBindings =((ReferenceBinding)b).typeVariables();
+ if(typeVariableBindings != null && typeVariableBindings.length > 0) {
+ addExpectedType(typeVariableBindings[0].firstBound);
+ }
+
+ }
+ }
+ }
} else if(parent instanceof UnaryExpression) {
switch(operator) {
case OperatorIds.NOT :
@@ -3343,6 +3446,31 @@ public final class CompletionEngine
addExpectedType(BaseTypes.ShortBinding);
addExpectedType(BaseTypes.IntBinding);
addExpectedType(BaseTypes.LongBinding);
+ } else if(parent instanceof ParameterizedSingleTypeReference) {
+ ParameterizedSingleTypeReference ref = (ParameterizedSingleTypeReference) parent;
+ TypeVariableBinding[] typeVariables = ((ReferenceBinding)ref.resolvedType).typeVariables();
+ int length = ref.typeArguments == null ? 0 : ref.typeArguments.length;
+ if(typeVariables != null && typeVariables.length >= length) {
+ int index = length - 1;
+ while(index > -1 && ref.typeArguments[index] != node) index--;
+ addExpectedType(typeVariables[index].firstBound);
+ }
+ } else if(parent instanceof ParameterizedQualifiedTypeReference) {
+ ParameterizedQualifiedTypeReference ref = (ParameterizedQualifiedTypeReference) parent;
+ TypeVariableBinding[] typeVariables = ((ReferenceBinding)ref.resolvedType).typeVariables();
+ TypeReference[][] arguments = ref.typeArguments;
+ if(typeVariables != null) {
+ int iLength = arguments == null ? 0 : arguments.length;
+ done: for (int i = 0; i < iLength; i++) {
+ int jLength = arguments[i] == null ? 0 : arguments[i].length;
+ for (int j = 0; j < jLength; j++) {
+ if(arguments[i][j] == node && typeVariables.length >= j) {
+ addExpectedType(typeVariables[j].firstBound);
+ break done;
+ }
+ }
+ }
+ }
}
if(expectedTypesPtr + 1 != expectedTypes.length) {
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/ISelectionRequestor.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/ISelectionRequestor.java
index 59730f25ad..fc511dd253 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/ISelectionRequestor.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/ISelectionRequestor.java
@@ -191,4 +191,89 @@ public interface ISelectionRequestor {
* The default package is represented by an empty array.
*/
void acceptPackage(char[] packageName);
+ /**
+ * Code assist notification of a type parameter selection.
+ *
+ * @param declaringTypePackageName char[]
+ * Name of the package in which the type that contains this new method is declared.
+ *
+ * @param declaringTypeName char[]
+ * Name of the type declaring this new method.
+ *
+ * @param typeParameterName char[]
+ * Name of the type parameter.
+ *
+ * @param isDeclaration boolean
+ * Answer if the selected type parameter is a declaration
+ *
+ * @param start
+ * Start of the selection
+ *
+ * @param end
+ * End of the selection
+ *
+ * NOTE - All package and type names are presented in their readable form:
+ * Package names are in the form "a.b.c".
+ * Nested type names are in the qualified form "A.M".
+ * The default package is represented by an empty array.
+ */
+ void acceptTypeParameter(
+ char[] declaringTypePackageName,
+ char[] declaringTypeName,
+ char[] typeParameterName,
+ boolean isDeclaration,
+ int start,
+ int end);
+
+ /**
+ * Code assist notification of a type parameter selection.
+ *
+ * @param declaringTypePackageName char[]
+ * Name of the package in which the type that contains this new method is declared.
+ *
+ * @param declaringTypeName char[]
+ * Name of the type declaring this new method.
+ *
+ * @param selector char[]
+ * Name of the new method.
+ *
+ * @param parameterPackageNames char[][]
+ * Names of the packages in which the parameter types are declared.
+ * Should contain as many elements as parameterTypeNames.
+ *
+ * @param parameterTypeNames char[][]
+ * Names of the parameters types.
+ * Should contain as many elements as parameterPackageNames.
+ *
+ * @param isConstructor boolean
+ * Answer if the method is a constructor.
+ *
+ * @param typeParameterName char[]
+ * Name of the type parameter.
+ *
+ * @param isDeclaration boolean
+ * Answer if the selected type parameter is a declaration
+ *
+ * @param start
+ * Start of the selection
+ *
+ * @param end
+ * End of the selection
+ *
+ * NOTE - All package and type names are presented in their readable form:
+ * Package names are in the form "a.b.c".
+ * Nested type names are in the qualified form "A.M".
+ * The default package is represented by an empty array.
+ */
+ void acceptMethodTypeParameter(
+ char[] declaringTypePackageName,
+ char[] declaringTypeName,
+ char[] selector,
+ char[][] parameterPackageNames,
+ char[][] parameterTypeNames,
+ boolean isConstructor,
+ char[] typeParameterName,
+ boolean isDeclaration,
+ int start,
+ int end);
}
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java
index 642504d341..0d5f9ed382 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java
@@ -402,8 +402,11 @@ public final class SelectionEngine extends Engine implements ISearchRequestor {
actualSelectionStart = lastIdentifierStart;
actualSelectionEnd = lastIdentifierEnd;
selectedIdentifier = lastIdentifier;
- if (identCount > 1)
- qualifiedSelection = entireSelection.toString().toCharArray();
+ if (identCount > 1) {
+ int entireSelectionLength = entireSelection.length();
+ qualifiedSelection = new char[entireSelectionLength];
+ entireSelection.getChars(0, entireSelectionLength, qualifiedSelection, 0);
+ }
return true;
}
return false;
@@ -554,7 +557,46 @@ public final class SelectionEngine extends Engine implements ISearchRequestor {
}
private void selectFrom(Binding binding, CompilationUnitDeclaration parsedUnit, boolean isDeclaration) {
- if (binding instanceof ReferenceBinding) {
+ if(binding instanceof TypeVariableBinding) {
+ TypeVariableBinding typeVariableBinding = (TypeVariableBinding) binding;
+ Binding enclosingElement = typeVariableBinding.declaringElement;
+ this.noProposal = false;
+
+ if(enclosingElement instanceof SourceTypeBinding) {
+ SourceTypeBinding enclosingType = (SourceTypeBinding) enclosingElement;
+ this.requestor.acceptTypeParameter(
+ enclosingType.qualifiedPackageName(),
+ enclosingType.qualifiedSourceName(),
+ typeVariableBinding.sourceName(),
+ false,
+ this.actualSelectionStart,
+ this.actualSelectionEnd);
+ } else if(enclosingElement instanceof MethodBinding) {
+ MethodBinding enclosingMethod = (MethodBinding) enclosingElement;
+
+ TypeBinding[] parameterTypes = enclosingMethod.parameters;
+ int length = parameterTypes.length;
+ char[][] parameterPackageNames = new char[length][];
+ char[][] parameterTypeNames = new char[length][];
+ for (int i = 0; i < length; i++) {
+ parameterPackageNames[i] = parameterTypes[i].qualifiedPackageName();
+ parameterTypeNames[i] = parameterTypes[i].qualifiedSourceName();
+ }
+
+ this.requestor.acceptMethodTypeParameter(
+ enclosingMethod.declaringClass.qualifiedPackageName(),
+ enclosingMethod.declaringClass.qualifiedSourceName(),
+ enclosingMethod.selector,
+ parameterPackageNames,
+ parameterTypeNames,
+ enclosingMethod.isConstructor(),
+ typeVariableBinding.sourceName(),
+ false,
+ this.actualSelectionStart,
+ this.actualSelectionEnd);
+ }
+ this.acceptedAnswer = true;
+ } else if (binding instanceof ReferenceBinding) {
ReferenceBinding typeBinding = (ReferenceBinding) binding;
if (qualifiedSelection != null
&& !CharOperation.equals(qualifiedSelection, typeBinding.readableName())) {
@@ -964,6 +1006,7 @@ public final class SelectionEngine extends Engine implements ISearchRequestor {
AbstractMethodDeclaration[] methods = typeDeclaration.methods;
for (int i = 0, length = methods == null ? 0 : methods.length; i < length; i++){
AbstractMethodDeclaration method = methods[i];
+
if (method.selector == assistIdentifier){
char[] qualifiedSourceName = null;
@@ -987,7 +1030,63 @@ public final class SelectionEngine extends Engine implements ISearchRequestor {
this.noProposal = false;
return true;
}
+
+ TypeParameter[] methodTypeParameters = method.typeParameters();
+ for (int j = 0, length2 = methodTypeParameters == null ? 0 : methodTypeParameters.length; j < length2; j++){
+ TypeParameter methodTypeParameter = methodTypeParameters[j];
+
+ if(methodTypeParameter.name == assistIdentifier) {
+ char[] qualifiedSourceName = null;
+
+ TypeDeclaration enclosingType = typeDeclaration;
+ while(enclosingType != null) {
+ qualifiedSourceName = CharOperation.concat(enclosingType.name, qualifiedSourceName, '.');
+ enclosingType = enclosingType.enclosingType;
+ }
+
+ this.requestor.acceptMethodTypeParameter(
+ packageName,
+ qualifiedSourceName,
+ method.selector,
+ null, // SelectionRequestor does not need of parameters type for declaration
+ null, // SelectionRequestor does not need of parameters type for declaration
+ method.isConstructor(),
+ methodTypeParameter.name,
+ true,
+ this.actualSelectionStart,
+ this.actualSelectionEnd);
+
+ this.noProposal = false;
+ return true;
+ }
+ }
}
+
+ TypeParameter[] typeParameters = typeDeclaration.typeParameters;
+ for (int i = 0, length = typeParameters == null ? 0 : typeParameters.length; i < length; i++){
+ TypeParameter typeParameter = typeParameters[i];
+ if(typeParameter.name == assistIdentifier) {
+ char[] qualifiedSourceName = null;
+
+ TypeDeclaration enclosingType = typeDeclaration;
+ while(enclosingType != null) {
+ qualifiedSourceName = CharOperation.concat(enclosingType.name, qualifiedSourceName, '.');
+ enclosingType = enclosingType.enclosingType;
+ }
+
+ this.requestor.acceptTypeParameter(
+ packageName,
+ qualifiedSourceName,
+ typeParameter.name,
+ true,
+ this.actualSelectionStart,
+ this.actualSelectionEnd);
+
+ this.noProposal = false;
+ return true;
+ }
+ }
+
return false;
}
}
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionNodeDetector.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionNodeDetector.java
index a55afda06d..f41e263eba 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionNodeDetector.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionNodeDetector.java
@@ -98,6 +98,18 @@ public class CompletionNodeDetector extends ASTVisitor {
public void endVisit(OR_OR_Expression or_or_Expression, BlockScope scope) {
endVisit(or_or_Expression);
}
+ public void endVisit(ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference, BlockScope scope) {
+ endVisit(parameterizedQualifiedTypeReference);
+ }
+ public void endVisit(ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference, ClassScope scope) {
+ endVisit(parameterizedQualifiedTypeReference);
+ }
+ public void endVisit(ParameterizedSingleTypeReference parameterizedSingleTypeReference, BlockScope scope) {
+ endVisit(parameterizedSingleTypeReference);
+ }
+ public void endVisit(ParameterizedSingleTypeReference parameterizedSingleTypeReference, ClassScope scope) {
+ endVisit(parameterizedSingleTypeReference);
+ }
public void endVisit(PostfixExpression postfixExpression, BlockScope scope) {
endVisit(postfixExpression);
}
@@ -200,6 +212,18 @@ public class CompletionNodeDetector extends ASTVisitor {
public boolean visit(OR_OR_Expression or_or_Expression, BlockScope scope) {
return this.visit(or_or_Expression);
}
+ public boolean visit(ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference, BlockScope scope) {
+ return this.visit(parameterizedQualifiedTypeReference);
+ }
+ public boolean visit(ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference, ClassScope scope) {
+ return this.visit(parameterizedQualifiedTypeReference);
+ }
+ public boolean visit(ParameterizedSingleTypeReference parameterizedSingleTypeReference, BlockScope scope) {
+ return this.visit(parameterizedSingleTypeReference);
+ }
+ public boolean visit(ParameterizedSingleTypeReference parameterizedSingleTypeReference, ClassScope scope) {
+ return this.visit(parameterizedSingleTypeReference);
+ }
public boolean visit(PostfixExpression postfixExpression, BlockScope scope) {
return this.visit(postfixExpression);
}
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnArgumentName.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnArgumentName.java
index f5a087b874..06d23c23d6 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnArgumentName.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnArgumentName.java
@@ -24,9 +24,9 @@ public class CompletionOnArgumentName extends Argument {
public char[] realName;
public boolean isCatchArgument = false;
- public CompletionOnArgumentName(char[] name , long posNom , TypeReference tr , int modifiers){
+ public CompletionOnArgumentName(char[] name , long posNom , TypeReference tr , int modifiers, boolean isVarArgs){
- super(CharOperation.concat(name, FAKENAMESUFFIX), posNom, tr, modifiers);
+ super(CharOperation.concat(name, FAKENAMESUFFIX), posNom, tr, modifiers, isVarArgs);
this.realName = name;
}
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnFieldType.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnFieldType.java
index b2730fcfd7..32debe3bcb 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnFieldType.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnFieldType.java
@@ -33,7 +33,6 @@ package org.eclipse.jdt.internal.codeassist.complete;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ast.*;
-import org.eclipse.jdt.internal.compiler.lookup.*;
public class CompletionOnFieldType extends FieldDeclaration {
public boolean isLocalVariable;
@@ -45,15 +44,12 @@ public CompletionOnFieldType(TypeReference type, boolean isLocalVariable){
this.type = type;
this.name = CharOperation.NO_CHAR;
this.isLocalVariable = isLocalVariable;
+ if (type instanceof CompletionOnSingleTypeReference) {
+ ((CompletionOnSingleTypeReference) type).fieldTypeCompletionNode = this;
+ }
}
-public TypeBinding getTypeBinding(Scope scope) {
- if(type instanceof CompletionOnSingleTypeReference)
- throw new CompletionNodeFound(this, scope);
- else // handle the qualified type ref directly
- return type.getTypeBinding(scope);
-}
-public StringBuffer printStatement(int tab, StringBuffer output) {
+public StringBuffer printStatement(int tab, StringBuffer output) {
return type.print(tab, output).append(';');
}
}
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword1.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword1.java
index 84dd7bec9b..7625f7a0c6 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword1.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword1.java
@@ -32,7 +32,7 @@ public class CompletionOnKeyword1 extends SingleTypeReference implements Complet
public void aboutToResolve(Scope scope) {
getTypeBinding(scope);
}
- public TypeBinding getTypeBinding(Scope scope) {
+ protected TypeBinding getTypeBinding(Scope scope) {
throw new CompletionNodeFound(this, scope);
}
public StringBuffer printExpression(int indent, StringBuffer output){
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMethodTypeParameter.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMethodTypeParameter.java
new file mode 100644
index 0000000000..15ecbc23dd
--- /dev/null
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMethodTypeParameter.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * 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.codeassist.complete;
+
+import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.compiler.CompilationResult;
+import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
+
+public class CompletionOnMethodTypeParameter extends MethodDeclaration {
+ public CompletionOnMethodTypeParameter(TypeParameter[] typeParameters, CompilationResult compilationResult){
+ super(compilationResult);
+ this.selector = CharOperation.NO_CHAR;
+ this.typeParameters = typeParameters;
+ this.sourceStart = typeParameters[0].sourceStart;
+ this.sourceEnd = typeParameters[typeParameters.length - 1].sourceEnd;
+ }
+
+ public void resolveStatements() {
+ throw new CompletionNodeFound(this, this.scope);
+ }
+
+ public StringBuffer print(int tab, StringBuffer output) {
+ printIndent(tab, output);
+ output.append('<');//$NON-NLS-1$
+ int max = typeParameters.length - 1;
+ for (int j = 0; j < max; j++) {
+ typeParameters[j].print(0, output);
+ output.append(", ");//$NON-NLS-1$
+ }
+ typeParameters[max].print(0, output);
+ output.append('>');
+ return output;
+ }
+
+}
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnParameterizedQualifiedTypeReference.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnParameterizedQualifiedTypeReference.java
new file mode 100644
index 0000000000..e1e0c17983
--- /dev/null
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnParameterizedQualifiedTypeReference.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 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.codeassist.complete;
+
+/*
+ * Completion node build by the parser in any case it was intending to
+ * reduce a type reference containing the completion identifier as part
+ * of a parameterized qualified name.
+ * e.g.
+ *
+ * class X extends Y<Z>.W[cursor]
+ *
+ * ---> class X extends <CompleteOnType:Y<Z>.W>
+ *
+ * The source range of the completion node denotes the source range
+ * which should be replaced by the completion.
+ */
+
+import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.TypeReference;
+import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
+import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
+import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
+
+
+public class CompletionOnParameterizedQualifiedTypeReference extends ParameterizedQualifiedTypeReference {
+ public static final int TYPE = 0;
+ public static final int CLASS = 1;
+ public static final int INTERFACE = 2;
+ public static final int EXCEPTION = 3;
+
+ private int kind = TYPE;
+ public char[] completionIdentifier;
+ /**
+ * @param tokens
+ * @param typeArguments
+ * @param positions
+ */
+ public CompletionOnParameterizedQualifiedTypeReference(char[][] tokens, TypeReference[][] typeArguments, char[] completionIdentifier, long[] positions) {
+ this(tokens, typeArguments, completionIdentifier, positions, TYPE);
+ }
+
+ /**
+ * @param tokens
+ * @param typeArguments
+ * @param positions
+ * @param kind
+ */
+ public CompletionOnParameterizedQualifiedTypeReference(char[][] tokens, TypeReference[][] typeArguments, char[] completionIdentifier, long[] positions, int kind) {
+ super(tokens, typeArguments, 0, positions);
+ this.completionIdentifier = completionIdentifier;
+ this.kind = kind;
+ }
+
+ public boolean isClass(){
+ return this.kind == CLASS;
+ }
+
+ public boolean isInterface(){
+ return this.kind == INTERFACE;
+ }
+
+ public boolean isException(){
+ return this.kind == EXCEPTION;
+ }
+
+ public TypeBinding resolveType(BlockScope scope) {
+ super.resolveType(scope);
+ throw new CompletionNodeFound(this, this.resolvedType, scope);
+ }
+
+ public TypeBinding resolveType(ClassScope scope) {
+ super.resolveType(scope);
+ throw new CompletionNodeFound(this, this.resolvedType, scope);
+ }
+
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+ switch (this.kind) {
+ case CLASS :
+ output.append("<CompleteOnClass:");//$NON-NLS-1$
+ break;
+ case INTERFACE :
+ output.append("<CompleteOnInterface:");//$NON-NLS-1$
+ break;
+ case EXCEPTION :
+ output.append("<CompleteOnException:");//$NON-NLS-1$
+ break;
+ default :
+ output.append("<CompleteOnType:");//$NON-NLS-1$
+ break;
+ }
+ int length = tokens.length;
+ for (int i = 0; i < length - 1; i++) {
+ output.append(tokens[i]);
+ TypeReference[] typeArgument = typeArguments[i];
+ if (typeArgument != null) {
+ output.append('<');//$NON-NLS-1$
+ int max = typeArgument.length - 1;
+ for (int j = 0; j < max; j++) {
+ typeArgument[j].print(0, output);
+ output.append(", ");//$NON-NLS-1$
+ }
+ typeArgument[max].print(0, output);
+ output.append('>');
+ }
+ output.append('.');
+ }
+ output.append(tokens[length - 1]);
+ TypeReference[] typeArgument = typeArguments[length - 1];
+ if (typeArgument != null) {
+ output.append('<');//$NON-NLS-1$
+ int max = typeArgument.length - 1;
+ for (int j = 0; j < max; j++) {
+ typeArgument[j].print(0, output);
+ output.append(", ");//$NON-NLS-1$
+ }
+ typeArgument[max].print(0, output);
+ output.append('>');
+ }
+ output.append('.').append(completionIdentifier).append('>');
+ return output;
+ }
+}
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java
index 91349ffc4a..5ebb6bccff 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java
@@ -42,7 +42,7 @@ public void aboutToResolve(Scope scope) {
public TypeReference copyDims(int dim){
return this;
}
-public TypeBinding getTypeBinding(Scope scope) {
+protected TypeBinding getTypeBinding(Scope scope) {
// it can be a package, type or member type
Binding binding = scope.parent.getTypeOrPackage(tokens); // step up from the ClassScope
if (!binding.isValidBinding()) {
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java
index 18833f604d..aadb11d1fc 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java
@@ -29,6 +29,8 @@ import org.eclipse.jdt.internal.compiler.lookup.*;
public class CompletionOnSingleTypeReference extends SingleTypeReference {
public boolean isCompletionNode;
+public CompletionOnFieldType fieldTypeCompletionNode;
+
public CompletionOnSingleTypeReference(char[] source, long pos) {
super(source, pos);
isCompletionNode = true;
@@ -42,7 +44,10 @@ public void aboutToResolve(Scope scope) {
public TypeReference copyDims(int dim){
return this;
}
-public TypeBinding getTypeBinding(Scope scope) {
+protected TypeBinding getTypeBinding(Scope scope) {
+ if (this.fieldTypeCompletionNode != null) {
+ throw new CompletionNodeFound(this.fieldTypeCompletionNode, scope);
+ }
if(isCompletionNode) {
throw new CompletionNodeFound(this, scope);
} else {
@@ -53,6 +58,9 @@ public StringBuffer printExpression(int indent, StringBuffer output){
return output.append("<CompleteOnType:").append(token).append('>'); //$NON-NLS-1$
}
public TypeBinding resolveTypeEnclosing(BlockScope scope, ReferenceBinding enclosingType) {
+ if (this.fieldTypeCompletionNode != null) {
+ throw new CompletionNodeFound(this.fieldTypeCompletionNode, scope);
+ }
if(isCompletionNode) {
throw new CompletionNodeFound(this, enclosingType, scope);
} else {
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
index f57041bb6a..91745a11f8 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
@@ -62,6 +62,10 @@ public class CompletionParser extends AssistParser {
protected static final int K_BETWEEN_CASE_AND_COLON = COMPLETION_PARSER + 26;
protected static final int K_BETWEEN_DEFAULT_AND_COLON = COMPLETION_PARSER + 27;
protected static final int K_BETWEEN_LEFT_AND_RIGHT_BRACKET = COMPLETION_PARSER + 28;
+ protected static final int K_EXTENDS_KEYWORD = COMPLETION_PARSER + 29;
+ protected static final int K_PARAMETERIZED_METHOD_INVOCATION = COMPLETION_PARSER + 30;
+ protected static final int K_PARAMETERIZED_ALLOCATION = COMPLETION_PARSER + 31;
+ protected static final int K_PARAMETERIZED_CAST = COMPLETION_PARSER + 32;
/* public fields */
@@ -186,12 +190,83 @@ protected void attachOrphanCompletionNode(){
return;
}
}
+ if(this.currentElement instanceof RecoveredType || this.currentElement instanceof RecoveredMethod) {
+ if(this.currentElement instanceof RecoveredType) {
+ RecoveredType recoveredType = (RecoveredType)this.currentElement;
+ if(recoveredType.foundOpeningBrace && this.genericsPtr > -1) {
+ if(this.genericsStack[this.genericsPtr] instanceof TypeParameter) {
+ TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr];
+ this.currentElement.add(new CompletionOnMethodTypeParameter(new TypeParameter[]{typeParameter},this.compilationUnit.compilationResult()), 0);
+ return;
+ }
+ }
+ }
+
+ if ((!isInsideMethod() && !isInsideFieldInitialization())) {
+ if(this.genericsPtr > -1 && this.genericsLengthPtr > -1 && this.genericsIdentifiersLengthPtr > -1) {
+ int kind = topKnownElementKind(COMPLETION_OR_ASSIST_PARSER);
+ int info = topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER);
+ if(kind == K_BINARY_OPERATOR && info == LESS) {
+ this.consumeTypeArguments();
+ }
+ int numberOfIdentifiers = this.genericsIdentifiersLengthStack[this.genericsIdentifiersLengthPtr];
+ int genPtr = this.genericsPtr;
+ done : for(int i = 0; i < numberOfIdentifiers; i++){
+ int length = this.genericsLengthStack[this.genericsLengthPtr - i];
+ for(int j = 0; j < length; j++) {
+ ASTNode node = this.genericsStack[genPtr - j];
+ CompletionNodeDetector detector = new CompletionNodeDetector(this.assistNode, node);
+ if(detector.containsCompletionNode()) {
+ if(node == this.assistNode){
+ if(this.identifierLengthPtr > -1 && this.identifierLengthStack[this.identifierLengthPtr]!= 0) {
+ TypeReference ref = this.getTypeReference(0);
+ this.assistNodeParent = ref;
+ }
+ } else {
+ this.assistNodeParent = detector.getCompletionNodeParent();
+ }
+ break done;
+ }
+ }
+ genPtr -= length;
+ }
+ if(this.assistNodeParent != null && this.assistNodeParent instanceof TypeReference) {
+ if(this.currentElement instanceof RecoveredType) {
+ this.currentElement = this.currentElement.add(new CompletionOnFieldType((TypeReference)this.assistNodeParent, false), 0);
+ } else {
+ this.currentElement = this.currentElement.add((TypeReference)this.assistNodeParent, 0);
+ }
+ }
+ }
+ }
+ }
// the following code applies only in methods, constructors or initializers
if ((!isInsideMethod() && !isInsideFieldInitialization())) {
return;
}
+ if(this.genericsPtr > -1) {
+ ASTNode node = this.genericsStack[this.genericsPtr];
+ CompletionNodeDetector detector = new CompletionNodeDetector(this.assistNode, node);
+ if(detector.containsCompletionNode()) {
+ /* check for completion at the beginning of method body
+ behind an invalid signature
+ */
+ RecoveredMethod method = this.currentElement.enclosingMethod();
+ if (method != null){
+ AbstractMethodDeclaration methodDecl = method.methodDeclaration;
+ if ((methodDecl.bodyStart == methodDecl.sourceEnd+1) // was missing opening brace
+ && (this.scanner.getLineNumber(node.sourceStart) == this.scanner.getLineNumber(methodDecl.sourceEnd))){
+ return;
+ }
+ }
+ if(node == this.assistNode){
+ buildMoreGenericsCompletionContext(node);
+ }
+ }
+ }
+
// push top expression on ast stack if it contains the completion node
Expression expression;
if (this.expressionPtr > -1) {
@@ -303,12 +378,17 @@ private void buildMoreCompletionContext(Expression expression) {
if(invocType == ALLOCATION) {
AllocationExpression allocationExpr = new AllocationExpression();
allocationExpr.arguments = arguments;
+ pushOnGenericsIdentifiersLengthStack(identifierLengthStack[identifierLengthPtr]);
+ pushOnGenericsLengthStack(0);
allocationExpr.type = getTypeReference(0);
assistNodeParent = allocationExpr;
} else {
QualifiedAllocationExpression allocationExpr = new QualifiedAllocationExpression();
allocationExpr.enclosingInstance = this.expressionStack[qualifierExprPtr];
allocationExpr.arguments = arguments;
+ pushOnGenericsIdentifiersLengthStack(identifierLengthStack[identifierLengthPtr]);
+ pushOnGenericsLengthStack(0);
+
allocationExpr.type = getTypeReference(0);
assistNodeParent = allocationExpr;
}
@@ -393,6 +473,8 @@ private void buildMoreCompletionContext(Expression expression) {
if(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER, 1) == K_ARRAY_CREATION) {
ArrayAllocationExpression allocationExpression = new ArrayAllocationExpression();
+ pushOnGenericsLengthStack(0);
+ pushOnGenericsIdentifiersLengthStack(identifierLengthStack[identifierLengthPtr]);
allocationExpression.type = getTypeReference(0);
int length = expressionLengthStack[expressionLengthPtr];
allocationExpression.dimensions = new Expression[length];
@@ -505,7 +587,39 @@ private void buildMoreCompletionContext(Expression expression) {
}
}
}
-
+private void buildMoreGenericsCompletionContext(ASTNode node) {
+ int kind = topKnownElementKind(COMPLETION_OR_ASSIST_PARSER);
+ if(kind != 0) {
+ int info = topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER);
+ nextElement : switch (kind) {
+ case K_BINARY_OPERATOR :
+ int prevKind = topKnownElementKind(COMPLETION_OR_ASSIST_PARSER, 1);
+ switch (prevKind) {
+ case K_PARAMETERIZED_ALLOCATION :
+ if(this.invocationType == ALLOCATION || this.invocationType == QUALIFIED_ALLOCATION) {
+ currentElement = currentElement.add((TypeReference)node, 0);
+ }
+ break nextElement;
+ case K_PARAMETERIZED_METHOD_INVOCATION :
+ currentElement = currentElement.add((TypeReference)node, 0);
+ break nextElement;
+ }
+ if(info == LESS && node instanceof TypeReference) {
+ if(this.identifierLengthPtr > -1 && this.identifierLengthStack[this.identifierLengthPtr]!= 0) {
+ this.consumeTypeArguments();
+ TypeReference ref = this.getTypeReference(0);
+ if(prevKind == K_PARAMETERIZED_CAST) {
+ ref = computeQualifiedGenericsFromRightSide(ref, 0);
+ }
+ currentElement = currentElement.add(ref, 0);
+ } else if (currentElement.enclosingMethod().methodDeclaration.isConstructor()) {
+ currentElement = currentElement.add((TypeReference)node, 0);
+ }
+ }
+ break;
+ }
+ }
+}
public int bodyEnd(AbstractMethodDeclaration method){
return cursorLocation;
}
@@ -535,22 +649,27 @@ private boolean checkCatchClause() {
*/
private boolean checkClassInstanceCreation() {
if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_BETWEEN_NEW_AND_LEFT_BRACKET) {
+ int length = identifierLengthStack[identifierLengthPtr];
+ int numberOfIdentifiers = this.genericsIdentifiersLengthStack[this.genericsIdentifiersLengthPtr];
+ if (length != numberOfIdentifiers || this.genericsLengthStack[this.genericsLengthPtr] != 0) {
+ // no class instance creation with a parameterized type
+ return true;
+ }
+
// completion on type inside an allocation expression
TypeReference type;
- if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER, 1) == K_INSIDE_THROW_STATEMENT
- && topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER, 1) == this.bracketDepth) {
- pushOnElementStack(K_NEXT_TYPEREF_IS_EXCEPTION);
- type = getTypeReference(0);
- popElement(K_NEXT_TYPEREF_IS_EXCEPTION);
- } else {
- type = getTypeReference(0);
- }
- this.assistNode = type;
- this.lastCheckPoint = type.sourceEnd + 1;
if (this.invocationType == ALLOCATION) {
// non qualified allocation expression
AllocationExpression allocExpr = new AllocationExpression();
+ if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER, 1) == K_INSIDE_THROW_STATEMENT
+ && topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER, 1) == this.bracketDepth) {
+ pushOnElementStack(K_NEXT_TYPEREF_IS_EXCEPTION);
+ type = getTypeReference(0);
+ popElement(K_NEXT_TYPEREF_IS_EXCEPTION);
+ } else {
+ type = getTypeReference(0);
+ }
allocExpr.type = type;
allocExpr.sourceStart = type.sourceStart;
allocExpr.sourceEnd = type.sourceEnd;
@@ -559,6 +678,16 @@ private boolean checkClassInstanceCreation() {
} else {
// qualified allocation expression
QualifiedAllocationExpression allocExpr = new QualifiedAllocationExpression();
+ pushOnGenericsIdentifiersLengthStack(identifierLengthStack[identifierLengthPtr]);
+ pushOnGenericsLengthStack(0);
+ if (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER, 1) == K_INSIDE_THROW_STATEMENT
+ && topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER, 1) == this.bracketDepth) {
+ pushOnElementStack(K_NEXT_TYPEREF_IS_EXCEPTION);
+ type = getTypeReference(0);
+ popElement(K_NEXT_TYPEREF_IS_EXCEPTION);
+ } else {
+ type = getTypeReference(0);
+ }
allocExpr.type = type;
allocExpr.enclosingInstance = this.expressionStack[this.qualifier];
allocExpr.sourceStart = this.intStack[this.intPtr--];
@@ -566,6 +695,9 @@ private boolean checkClassInstanceCreation() {
this.expressionStack[this.qualifier] = allocExpr; // attach it now (it replaces the qualifier expression)
this.isOrphanCompletionNode = false;
}
+ this.assistNode = type;
+ this.lastCheckPoint = type.sourceEnd + 1;
+
popElement(K_BETWEEN_NEW_AND_LEFT_BRACKET);
return true;
}
@@ -616,6 +748,9 @@ private boolean checkClassLiteralAccess() {
this.identifierLengthPtr--; // it can only be a simple identifier (so its length is one)
// get the type reference
+ pushOnGenericsIdentifiersLengthStack(identifierLengthStack[identifierLengthPtr]);
+ pushOnGenericsLengthStack(0);
+
TypeReference typeRef = getTypeReference(this.intStack[this.intPtr--]);
// build the completion on class literal access node
@@ -832,6 +967,8 @@ private boolean checkInvocation() {
// creates an allocation expression
CompletionOnQualifiedAllocationExpression allocExpr = new CompletionOnQualifiedAllocationExpression();
allocExpr.arguments = arguments;
+ pushOnGenericsLengthStack(0);
+ pushOnGenericsIdentifiersLengthStack(identifierLengthStack[identifierLengthPtr]);
allocExpr.type = super.getTypeReference(0); // we don't want a completion node here, so call super
if (invocType == QUALIFIED_ALLOCATION) {
allocExpr.enclosingInstance = this.expressionStack[qualifierExprPtr];
@@ -882,6 +1019,33 @@ private boolean checkNameCompletion() {
this.isOrphanCompletionNode = true;
return true;
}
+private boolean checkParemeterizedType() {
+ if(this.identifierLengthPtr > -1 && this.genericsLengthPtr > -1 && this.genericsIdentifiersLengthPtr > -1) {
+ int length = this.identifierLengthStack[this.identifierLengthPtr];
+ int numberOfIdentifiers = this.genericsIdentifiersLengthStack[this.genericsIdentifiersLengthPtr];
+ if (length != numberOfIdentifiers || this.genericsLengthStack[this.genericsLengthPtr] != 0) {
+ this.genericsIdentifiersLengthPtr--;
+ this.identifierLengthPtr--;
+ // generic type
+ this.assistNode = getAssistTypeReferenceForGenericType(0, length, numberOfIdentifiers);
+ this.lastCheckPoint = this.assistNode.sourceEnd + 1;
+ this.isOrphanCompletionNode = true;
+ return true;
+ } else if(this.genericsPtr > -1 && this.genericsStack[this.genericsPtr] instanceof TypeReference) {
+ // type of a cast expression
+ numberOfIdentifiers++;
+
+ this.genericsIdentifiersLengthPtr--;
+ this.identifierLengthPtr--;
+ // generic type
+ this.assistNode = getAssistTypeReferenceForGenericType(0, length, numberOfIdentifiers);
+ this.lastCheckPoint = this.assistNode.sourceEnd + 1;
+ this.isOrphanCompletionNode = true;
+ return true;
+ }
+ }
+ return false;
+}
/**
* Checks if the completion is in the context of a method and on the type of one of its arguments
* Returns whether we found a completion node.
@@ -935,6 +1099,17 @@ private boolean checkRecoveredType() {
this.lastCheckPoint = this.assistNode.sourceEnd + 1;
this.isOrphanCompletionNode = true;
return true;
+ } else {
+ if(recoveredType.typeDeclaration.superclass == null &&
+ this.topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_EXTENDS_KEYWORD) {
+ this.consumeClassOrInterfaceName();
+ this.pushOnElementStack(K_NEXT_TYPEREF_IS_CLASS);
+ this.assistNode = this.getTypeReference(0);
+ this.popElement(K_NEXT_TYPEREF_IS_CLASS);
+ this.lastCheckPoint = this.assistNode.sourceEnd + 1;
+ this.isOrphanCompletionNode = true;
+ return true;
+ }
}
}
return false;
@@ -993,6 +1168,7 @@ public void completionIdentifierCheck(){
// (NB: Put this check before checkNameCompletion() because the selector of the invocation can be on the identifier stack)
if (checkInvocation()) return;
+ if (checkParemeterizedType()) return;
if (checkNameCompletion()) return;
}
protected void consumeArrayCreationExpressionWithInitializer() {
@@ -1025,13 +1201,24 @@ protected void consumeBinaryExpression(int op) {
}
}
}
+protected void consumeBinaryExpressionWithName(int op) {
+ super.consumeBinaryExpressionWithName(op);
+ popElement(K_BINARY_OPERATOR);
+
+ if(expressionStack[expressionPtr] instanceof BinaryExpression) {
+ BinaryExpression exp = (BinaryExpression) expressionStack[expressionPtr];
+ if(assistNode != null && exp.right == assistNode) {
+ assistNodeParent = exp;
+ }
+ }
+}
protected void consumeCaseLabel() {
super.consumeCaseLabel();
if(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) != K_SWITCH_LABEL) {
pushOnElementStack(K_SWITCH_LABEL);
}
}
-protected void consumeCastExpression() {
+protected void consumeCastExpressionWithPrimitiveType() {
popElement(K_CAST_STATEMENT);
Expression exp, cast, castType;
@@ -1041,6 +1228,43 @@ protected void consumeCastExpression() {
cast.sourceStart = castType.sourceStart - 1;
cast.sourceEnd = exp.sourceEnd;
}
+protected void consumeCastExpressionWithGenericsArray() {
+ popElement(K_CAST_STATEMENT);
+
+ Expression exp, cast, castType;
+ expressionPtr--;
+ expressionLengthPtr--;
+ this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr + 1], castType = this.expressionStack[this.expressionPtr]);
+ cast.sourceStart = castType.sourceStart - 1;
+ cast.sourceEnd = exp.sourceEnd;
+}
+
+protected void consumeCastExpressionWithQualifiedGenericsArray() {
+ popElement(K_CAST_STATEMENT);
+
+ Expression exp, cast, castType;
+ expressionPtr--;
+ expressionLengthPtr--;
+ this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr + 1], castType = this.expressionStack[this.expressionPtr]);
+ cast.sourceStart = castType.sourceStart - 1;
+ cast.sourceEnd = exp.sourceEnd;
+}
+protected void consumeCastExpressionWithNameArray() {
+ // CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
+ popElement(K_CAST_STATEMENT);
+
+ Expression exp, cast, castType;
+ int end = intStack[intPtr--];
+
+ // handle type arguments
+ pushOnGenericsLengthStack(0);
+ pushOnGenericsIdentifiersLengthStack(identifierLengthStack[identifierLengthPtr]);
+
+ expressionStack[expressionPtr] = cast = new CastExpression(exp = expressionStack[expressionPtr], castType = getTypeReference(intStack[intPtr--]));
+ castType.sourceEnd = end - 1;
+ castType.sourceStart = (cast.sourceStart = intStack[intPtr--]) + 1;
+ cast.sourceEnd = exp.sourceEnd;
+}
protected void consumeCastExpressionLL1() {
popElement(K_CAST_STATEMENT);
super.consumeCastExpressionLL1();
@@ -1054,8 +1278,8 @@ protected void consumeClassBodyopt() {
popElement(K_SELECTOR_INVOCATION_TYPE);
super.consumeClassBodyopt();
}
-protected void consumeClassHeaderName() {
- super.consumeClassHeaderName();
+protected void consumeClassHeaderName1() {
+ super.consumeClassHeaderName1();
if (currentElement != null
&& currentToken == TokenNameIdentifier
@@ -1099,6 +1323,7 @@ protected void consumeClassHeaderExtends() {
pushOnElementStack(K_NEXT_TYPEREF_IS_CLASS);
super.consumeClassHeaderExtends();
popElement(K_NEXT_TYPEREF_IS_CLASS);
+ popElement(K_EXTENDS_KEYWORD);
if (currentElement != null
&& currentToken == TokenNameIdentifier
@@ -1135,6 +1360,10 @@ protected void consumeConditionalExpression(int op) {
popElement(K_CONDITIONAL_OPERATOR);
super.consumeConditionalExpression(op);
}
+protected void consumeConditionalExpressionWithName(int op) {
+ popElement(K_CONDITIONAL_OPERATOR);
+ super.consumeConditionalExpressionWithName(op);
+}
protected void consumeConstructorBody() {
popElement(K_BLOCK_DELIMITER);
super.consumeConstructorBody();
@@ -1155,6 +1384,8 @@ protected void consumeConstructorHeaderName() {
if (currentElement == null){
this.hasReportedError = true; // do not report any error
}
+ pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
+ pushOnGenericsLengthStack(0); // handle type arguments
this.restartRecovery = true;
}
protected void consumeDefaultLabel() {
@@ -1173,6 +1404,11 @@ protected void consumeEnterAnonymousClassBody() {
popElement(K_SELECTOR_INVOCATION_TYPE);
super.consumeEnterAnonymousClassBody();
}
+protected void consumeEnterAnonymousClassBodySimpleName() {
+ popElement(K_SELECTOR_QUALIFIER);
+ popElement(K_SELECTOR_INVOCATION_TYPE);
+ super.consumeEnterAnonymousClassBodySimpleName();
+}
protected void consumeEnterVariable() {
identifierPtr--;
identifierLengthPtr--;
@@ -1219,7 +1455,8 @@ protected void consumeEnterVariable() {
if(!checkKeyword() && !(currentElement instanceof RecoveredUnit && ((RecoveredUnit)currentElement).typeCount == 0)) {
int nameSourceStart = (int)(identifierPositionStack[identifierPtr] >>> 32);
intPtr--;
-
+// pushOnGenericsIdentifiersLengthStack(identifierLengthStack[identifierLengthPtr]);
+// pushOnGenericsLengthStack(0);
TypeReference type = getTypeReference(intStack[intPtr--]);
intPtr--;
@@ -1251,6 +1488,15 @@ protected void consumeEqualityExpression(int op) {
assistNodeParent = exp;
}
}
+protected void consumeEqualityExpressionWithName(int op) {
+ super.consumeEqualityExpressionWithName(op);
+ popElement(K_BINARY_OPERATOR);
+
+ BinaryExpression exp = (BinaryExpression) expressionStack[expressionPtr];
+ if(assistNode != null && exp.right == assistNode) {
+ assistNodeParent = exp;
+ }
+}
protected void consumeExitVariableWithInitialization() {
super.consumeExitVariableWithInitialization();
@@ -1293,9 +1539,9 @@ protected void consumeForceNoDiet() {
pushOnElementStack(K_LOCAL_INITIALIZER_DELIMITER);
}
}
-protected void consumeFormalParameter() {
+protected void consumeFormalParameter(boolean isVarArgs) {
if (this.indexOfAssistIdentifier() < 0) {
- super.consumeFormalParameter();
+ super.consumeFormalParameter(isVarArgs);
} else {
identifierLengthPtr--;
@@ -1308,7 +1554,18 @@ protected void consumeFormalParameter() {
identifierName,
namePositions,
type,
- intStack[intPtr + 1] & ~AccDeprecated); // modifiers
+ intStack[intPtr + 1] & ~AccDeprecated,
+ isVarArgs); // modifiers
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ arg.annotations = new Annotation[length],
+ 0,
+ length);
+ }
arg.isCatchArgument = topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_BETWEEN_CATCH_AND_RIGHT_PAREN;
pushOnAstStack(arg);
@@ -1335,6 +1592,20 @@ protected void consumeInsideCastExpressionLL1() {
super.consumeInsideCastExpressionLL1();
pushOnElementStack(K_CAST_STATEMENT);
}
+protected void consumeInsideCastExpressionWithQualifiedGenerics() {
+ Expression castType;
+ int end = this.intStack[this.intPtr--];
+
+ int dim = this.intStack[this.intPtr--];
+ TypeReference rightSide = getTypeReference(0);
+
+ castType = computeQualifiedGenericsFromRightSide(rightSide, dim);
+ castType.sourceEnd = end - 1;
+ castType.sourceStart = this.intStack[this.intPtr--] + 1;
+ pushOnExpressionStack(castType);
+
+ pushOnElementStack(K_CAST_STATEMENT);
+}
protected void consumeInstanceOfExpression(int op) {
super.consumeInstanceOfExpression(op);
popElement(K_BINARY_OPERATOR);
@@ -1344,8 +1615,17 @@ protected void consumeInstanceOfExpression(int op) {
assistNodeParent = exp;
}
}
-protected void consumeInterfaceHeaderName() {
- super.consumeInterfaceHeaderName();
+protected void consumeInstanceOfExpressionWithName(int op) {
+ super.consumeInstanceOfExpressionWithName(op);
+ popElement(K_BINARY_OPERATOR);
+
+ InstanceOfExpression exp = (InstanceOfExpression) expressionStack[expressionPtr];
+ if(assistNode != null && exp.type == assistNode) {
+ assistNodeParent = exp;
+ }
+}
+protected void consumeInterfaceHeaderName1() {
+ super.consumeInterfaceHeaderName1();
if (currentElement != null
&& currentToken == TokenNameIdentifier
@@ -1374,6 +1654,10 @@ protected void consumeInterfaceHeaderName() {
}
}
}
+protected void consumeInterfaceHeaderExtends() {
+ super.consumeInterfaceHeaderExtends();
+ popElement(K_EXTENDS_KEYWORD);
+}
protected void consumeInterfaceType() {
pushOnElementStack(K_NEXT_TYPEREF_IS_INTERFACE);
super.consumeInterfaceType();
@@ -1398,7 +1682,8 @@ protected void consumeMethodHeaderName() {
if(this.indexOfAssistIdentifier() < 0) {
identifierPtr--;
identifierLengthPtr--;
- if(this.indexOfAssistIdentifier() != 0) {
+ if(this.indexOfAssistIdentifier() != 0 ||
+ this.identifierLengthStack[this.identifierLengthPtr] != this.genericsIdentifiersLengthStack[this.genericsIdentifiersLengthPtr]) {
identifierPtr++;
identifierLengthPtr++;
super.consumeMethodHeaderName();
@@ -1420,6 +1705,16 @@ protected void consumeMethodHeaderName() {
if(scanner.getLineNumber(type.sourceStart) != scanner.getLineNumber((int) (selectorSource >>> 32))) {
FieldDeclaration completionFieldDecl = new CompletionOnFieldType(type, false);
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ completionFieldDecl.annotations = new Annotation[length],
+ 0,
+ length);
+ }
completionFieldDecl.modifiers = mod;
assistNode = completionFieldDecl;
lastCheckPoint = type.sourceEnd + 1;
@@ -1427,6 +1722,16 @@ protected void consumeMethodHeaderName() {
lastIgnoredToken = -1;
} else {
CompletionOnMethodReturnType md = new CompletionOnMethodReturnType(type, this.compilationUnit.compilationResult);
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ md.annotations = new Annotation[length],
+ 0,
+ length);
+ }
md.selector = selector;
md.declarationSourceStart = declarationSourceStart;
md.modifiers = mod;
@@ -1455,6 +1760,16 @@ protected void consumeMethodHeaderName() {
//modifiers
md.declarationSourceStart = intStack[intPtr--];
md.modifiers = intStack[intPtr--];
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ md.annotations = new Annotation[length],
+ 0,
+ length);
+ }
// javadoc
md.javadoc = this.javadoc;
this.javadoc = null;
@@ -1485,8 +1800,8 @@ protected void consumeMethodHeaderName() {
}
}
}
-protected void consumeMethodHeaderParameters() {
- super.consumeMethodHeaderParameters();
+protected void consumeMethodHeaderRightParen() {
+ super.consumeMethodHeaderRightParen();
if (currentElement != null
&& currentToken == TokenNameIdentifier
@@ -1894,6 +2209,14 @@ protected void consumeToken(int token) {
pushOnElementStack(K_BINARY_OPERATOR, UNSIGNED_RIGHT_SHIFT);
break;
case TokenNameLESS:
+ switch(previous) {
+ case TokenNameDOT :
+ pushOnElementStack(K_PARAMETERIZED_METHOD_INVOCATION);
+ break;
+ case TokenNamenew :
+ pushOnElementStack(K_PARAMETERIZED_ALLOCATION);
+ break;
+ }
pushOnElementStack(K_BINARY_OPERATOR, LESS);
break;
case TokenNameGREATER:
@@ -1981,9 +2304,126 @@ protected void consumeToken(int token) {
case TokenNamedefault :
pushOnElementStack(K_BETWEEN_DEFAULT_AND_COLON);
break;
+ case TokenNameextends:
+ pushOnElementStack(K_EXTENDS_KEYWORD);
+ break;
+ }
+ } else {
+ switch(token) {
+ case TokenNameextends:
+ pushOnElementStack(K_EXTENDS_KEYWORD);
+ break;
+ case TokenNameLESS:
+ pushOnElementStack(K_BINARY_OPERATOR, LESS);
+ break;
+ case TokenNameGREATER:
+ pushOnElementStack(K_BINARY_OPERATOR, GREATER);
+ break;
+ case TokenNameRIGHT_SHIFT:
+ pushOnElementStack(K_BINARY_OPERATOR, RIGHT_SHIFT);
+ break;
+ case TokenNameUNSIGNED_RIGHT_SHIFT:
+ pushOnElementStack(K_BINARY_OPERATOR, UNSIGNED_RIGHT_SHIFT);
+ break;
+
}
}
}
+protected void consumeOnlyTypeArguments() {
+ super.consumeOnlyTypeArguments();
+ popElement(K_BINARY_OPERATOR);
+ if(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_PARAMETERIZED_METHOD_INVOCATION) {
+ popElement(K_PARAMETERIZED_METHOD_INVOCATION);
+ } else {
+ popElement(K_PARAMETERIZED_ALLOCATION);
+ }
+}
+protected void consumeOnlyTypeArgumentsForCastExpression() {
+ super.consumeOnlyTypeArgumentsForCastExpression();
+ pushOnElementStack(K_PARAMETERIZED_CAST);
+}
+protected void consumeRightParen() {
+ super.consumeRightParen();
+ if(topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_PARAMETERIZED_CAST) {
+ popElement(K_PARAMETERIZED_CAST);
+ }
+}
+protected void consumeReferenceType1() {
+ super.consumeReferenceType1();
+ popElement(K_BINARY_OPERATOR);
+}
+protected void consumeReferenceType2() {
+ super.consumeReferenceType2();
+ popElement(K_BINARY_OPERATOR);
+}
+protected void consumeReferenceType3() {
+ super.consumeReferenceType3();
+ popElement(K_BINARY_OPERATOR);
+}
+protected void consumeTypeArgumentReferenceType1() {
+ super.consumeTypeArgumentReferenceType1();
+ popElement(K_BINARY_OPERATOR);
+}
+protected void consumeTypeArgumentReferenceType2() {
+ super.consumeTypeArgumentReferenceType2();
+ popElement(K_BINARY_OPERATOR);
+}
+protected void consumeTypeArguments() {
+ super.consumeTypeArguments();
+ popElement(K_BINARY_OPERATOR);
+}
+protected void consumeTypeParameters() {
+ super.consumeTypeParameters();
+ popElement(K_BINARY_OPERATOR);
+}
+protected void consumeTypeParameters1() {
+ super.consumeTypeParameter1();
+ popElement(K_BINARY_OPERATOR);
+}
+protected void consumeTypeParameterWithExtends() {
+ super.consumeTypeParameterWithExtends();
+ popElement(K_EXTENDS_KEYWORD);
+}
+protected void consumeTypeParameterWithExtendsAndBounds() {
+ super.consumeTypeParameterWithExtendsAndBounds();
+ popElement(K_EXTENDS_KEYWORD);
+}
+protected void consumeTypeParameter1WithExtends() {
+ super.consumeTypeParameter1WithExtends();
+ popElement(K_EXTENDS_KEYWORD);
+}
+protected void consumeTypeParameter1WithExtendsAndBounds() {
+ super.consumeTypeParameter1WithExtendsAndBounds();
+ popElement(K_EXTENDS_KEYWORD);
+}
+protected void consumeWildcard1() {
+ super.consumeWildcard1();
+ popElement(K_BINARY_OPERATOR);
+}
+protected void consumeWildcard2() {
+ super.consumeWildcard2();
+ popElement(K_BINARY_OPERATOR);
+}
+protected void consumeWildcard3() {
+ super.consumeWildcard3();
+ popElement(K_BINARY_OPERATOR);
+}
+protected void consumeWildcardBoundsExtends() {
+ super.consumeWildcardBoundsExtends();
+ popElement(K_EXTENDS_KEYWORD);
+}
+protected void consumeWildcardBounds1Extends() {
+ super.consumeWildcardBounds1Extends();
+ popElement(K_EXTENDS_KEYWORD);
+}
+protected void consumeWildcardBounds2Extends() {
+ super.consumeWildcardBounds2Extends();
+ popElement(K_EXTENDS_KEYWORD);
+}
+protected void consumeWildcardBounds3Extends() {
+ super.consumeWildcardBounds3Extends();
+ popElement(K_EXTENDS_KEYWORD);
+}
protected void consumeUnaryExpression(int op) {
super.consumeUnaryExpression(op);
popElement(K_UNARY_OPERATOR);
@@ -2031,6 +2471,37 @@ public TypeReference createQualifiedAssistTypeReference(char[][] previousIdentif
return new CompletionOnQualifiedTypeReference(previousIdentifiers, assistName, positions);
}
}
+public TypeReference createParameterizedQualifiedAssistTypeReference(char[][] previousIdentifiers, TypeReference[][] typeArguments, char[] assistName, long[] positions) {
+ switch (topKnownElementKind(COMPLETION_OR_ASSIST_PARSER)) {
+ case K_NEXT_TYPEREF_IS_EXCEPTION :
+ return new CompletionOnParameterizedQualifiedTypeReference(
+ previousIdentifiers,
+ typeArguments,
+ assistName,
+ positions,
+ CompletionOnParameterizedQualifiedTypeReference.EXCEPTION);
+ case K_NEXT_TYPEREF_IS_CLASS :
+ return new CompletionOnParameterizedQualifiedTypeReference(
+ previousIdentifiers,
+ typeArguments,
+ assistName,
+ positions,
+ CompletionOnParameterizedQualifiedTypeReference.CLASS);
+ case K_NEXT_TYPEREF_IS_INTERFACE :
+ return new CompletionOnParameterizedQualifiedTypeReference(
+ previousIdentifiers,
+ typeArguments,
+ assistName,
+ positions,
+ CompletionOnParameterizedQualifiedTypeReference.INTERFACE);
+ default :
+ return new CompletionOnParameterizedQualifiedTypeReference(
+ previousIdentifiers,
+ typeArguments,
+ assistName,
+ positions);
+ }
+}
public NameReference createSingleAssistNameReference(char[] assistName, long position) {
int kind = topKnownElementKind(COMPLETION_OR_ASSIST_PARSER);
if(!isInsideMethod()) {
@@ -2145,6 +2616,39 @@ public void flushAssistState() {
completionScanner.completedIdentifierStart = 0;
completionScanner.completedIdentifierEnd = -1;
}
+
+protected TypeReference getTypeReferenceForGenericType(int dim, int identifierLength, int numberOfIdentifiers) {
+ TypeReference ref = super.getTypeReferenceForGenericType(dim, identifierLength, numberOfIdentifiers);
+
+ if(this.assistNode != null) {
+ if (identifierLength == 1 && numberOfIdentifiers == 1) {
+ ParameterizedSingleTypeReference singleRef = (ParameterizedSingleTypeReference) ref;
+ TypeReference[] typeArguments = singleRef.typeArguments;
+ for (int i = 0; i < typeArguments.length; i++) {
+ if(typeArguments[i] == this.assistNode) {
+ this.assistNodeParent = ref;
+ return ref;
+ }
+ }
+ } else {
+ ParameterizedQualifiedTypeReference qualifiedRef = (ParameterizedQualifiedTypeReference) ref;
+ TypeReference[][] typeArguments = qualifiedRef.typeArguments;
+ for (int i = 0; i < typeArguments.length; i++) {
+ if(typeArguments[i] != null) {
+ for (int j = 0; j < typeArguments[i].length; j++) {
+ if(typeArguments[i][j] == this.assistNode) {
+ this.assistNodeParent = ref;
+ return ref;
+ }
+ }
+ }
+ }
+
+ }
+ }
+
+ return ref;
+}
protected NameReference getUnspecifiedReferenceOptimized() {
if (this.identifierLengthStack[this.identifierLengthPtr] > 1) { // reducing a qualified name
// potential receiver is being poped, so reset potential receiver
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
index 1669801be7..fe9e48c144 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
@@ -265,6 +265,11 @@ protected void consumeEnterAnonymousClassBody() {
popElement(K_SELECTOR);
pushOnElementStack(K_TYPE_DELIMITER);
}
+protected void consumeEnterAnonymousClassBodySimpleName() {
+ super.consumeEnterAnonymousClassBodySimpleName();
+ popElement(K_SELECTOR);
+ pushOnElementStack(K_TYPE_DELIMITER);
+}
protected void consumeExplicitConstructorInvocation(int flag, int recFlag) {
super.consumeExplicitConstructorInvocation(flag, recFlag);
popElement(K_SELECTOR);
@@ -378,6 +383,65 @@ protected void consumePackageDeclarationName() {
restartRecovery = true; // used to avoid branching back into the regular automaton
}
}
+protected void consumePackageDeclarationNameWithModifiers() {
+ // PackageDeclarationName ::= Modifiers 'package' PushRealModifiers Name
+ /* build an ImportRef build from the last name
+ stored in the identifier stack. */
+
+ int index;
+
+ /* no need to take action if not inside assist identifiers */
+ if ((index = indexOfAssistIdentifier()) < 0) {
+ super.consumePackageDeclarationNameWithModifiers();
+ return;
+ }
+ /* retrieve identifiers subset and whole positions, the assist node positions
+ should include the entire replaced source. */
+ int length = identifierLengthStack[identifierLengthPtr];
+ char[][] subset = identifierSubSet(index+1); // include the assistIdentifier
+ identifierLengthPtr--;
+ identifierPtr -= length;
+ long[] positions = new long[length];
+ System.arraycopy(
+ identifierPositionStack,
+ identifierPtr + 1,
+ positions,
+ 0,
+ length);
+
+ this.intPtr--; // we don't need the modifiers start
+ this.intPtr--; // we don't need the package modifiers
+ ImportReference reference = this.createAssistPackageReference(subset, positions);
+ // consume annotations
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ reference.annotations = new Annotation[length],
+ 0,
+ length);
+ }
+ /* build specific assist node on package statement */
+ assistNode = reference;
+ this.lastCheckPoint = reference.sourceEnd + 1;
+ compilationUnit.currentPackage = reference;
+
+ if (currentToken == TokenNameSEMICOLON){
+ reference.declarationSourceEnd = scanner.currentPosition - 1;
+ } else {
+ reference.declarationSourceEnd = (int) positions[length-1];
+ }
+ //endPosition is just before the ;
+ reference.declarationSourceStart = intStack[intPtr--];
+ // flush comments defined prior to import statements
+ reference.declarationSourceEnd = this.flushCommentsDefinedPriorTo(reference.declarationSourceEnd);
+
+ // recovery
+ if (currentElement != null){
+ lastCheckPoint = reference.declarationSourceEnd+1;
+ restartRecovery = true; // used to avoid branching back into the regular automaton
+ }
+}
protected void consumeRestoreDiet() {
super.consumeRestoreDiet();
// if we are not in a method (ie. we were not in a local variable initializer)
@@ -386,6 +450,57 @@ protected void consumeRestoreDiet() {
popElement(K_FIELD_INITIALIZER_DELIMITER);
}
}
+protected void consumeSingleStaticImportDeclarationName() {
+ // SingleTypeImportDeclarationName ::= 'import' 'static' Name
+ /* push an ImportRef build from the last name
+ stored in the identifier stack. */
+
+ int index;
+
+ /* no need to take action if not inside assist identifiers */
+ if ((index = indexOfAssistIdentifier()) < 0) {
+ super.consumeSingleStaticImportDeclarationName();
+ return;
+ }
+ /* retrieve identifiers subset and whole positions, the assist node positions
+ should include the entire replaced source. */
+ int length = identifierLengthStack[identifierLengthPtr];
+ char[][] subset = identifierSubSet(index+1); // include the assistIdentifier
+ identifierLengthPtr--;
+ identifierPtr -= length;
+ long[] positions = new long[length];
+ System.arraycopy(
+ identifierPositionStack,
+ identifierPtr + 1,
+ positions,
+ 0,
+ length);
+
+ /* build specific assist node on import statement */
+ ImportReference reference = this.createAssistImportReference(subset, positions, AccStatic);
+ assistNode = reference;
+ this.lastCheckPoint = reference.sourceEnd + 1;
+
+ pushOnAstStack(reference);
+
+ if (currentToken == TokenNameSEMICOLON){
+ reference.declarationSourceEnd = scanner.currentPosition - 1;
+ } else {
+ reference.declarationSourceEnd = (int) positions[length-1];
+ }
+ //endPosition is just before the ;
+ reference.declarationSourceStart = intStack[intPtr--];
+ // flush annotations defined prior to import statements
+ reference.declarationSourceEnd = this.flushCommentsDefinedPriorTo(reference.declarationSourceEnd);
+
+ // recovery
+ if (currentElement != null){
+ lastCheckPoint = reference.declarationSourceEnd+1;
+ currentElement = currentElement.add(reference, 0);
+ lastIgnoredToken = -1;
+ restartRecovery = true; // used to avoid branching back into the regular automaton
+ }
+}
protected void consumeSingleTypeImportDeclarationName() {
// SingleTypeImportDeclarationName ::= 'import' Name
/* push an ImportRef build from the last name
@@ -437,6 +552,58 @@ protected void consumeSingleTypeImportDeclarationName() {
restartRecovery = true; // used to avoid branching back into the regular automaton
}
}
+protected void consumeStaticImportOnDemandDeclarationName() {
+ // TypeImportOnDemandDeclarationName ::= 'import' 'static' Name '.' '*'
+ /* push an ImportRef build from the last name
+ stored in the identifier stack. */
+
+ int index;
+
+ /* no need to take action if not inside assist identifiers */
+ if ((index = indexOfAssistIdentifier()) < 0) {
+ super.consumeStaticImportOnDemandDeclarationName();
+ return;
+ }
+ /* retrieve identifiers subset and whole positions, the assist node positions
+ should include the entire replaced source. */
+ int length = identifierLengthStack[identifierLengthPtr];
+ char[][] subset = identifierSubSet(index+1); // include the assistIdentifier
+ identifierLengthPtr--;
+ identifierPtr -= length;
+ long[] positions = new long[length];
+ System.arraycopy(
+ identifierPositionStack,
+ identifierPtr + 1,
+ positions,
+ 0,
+ length);
+
+ /* build specific assist node on import statement */
+ ImportReference reference = this.createAssistImportReference(subset, positions, AccStatic);
+ reference.onDemand = true;
+ assistNode = reference;
+ this.lastCheckPoint = reference.sourceEnd + 1;
+
+ pushOnAstStack(reference);
+
+ if (currentToken == TokenNameSEMICOLON){
+ reference.declarationSourceEnd = scanner.currentPosition - 1;
+ } else {
+ reference.declarationSourceEnd = (int) positions[length-1];
+ }
+ //endPosition is just before the ;
+ reference.declarationSourceStart = intStack[intPtr--];
+ // flush annotations defined prior to import statements
+ reference.declarationSourceEnd = this.flushCommentsDefinedPriorTo(reference.declarationSourceEnd);
+
+ // recovery
+ if (currentElement != null){
+ lastCheckPoint = reference.declarationSourceEnd+1;
+ currentElement = currentElement.add(reference, 0);
+ lastIgnoredToken = -1;
+ restartRecovery = true; // used to avoid branching back into the regular automaton
+ }
+}
protected void consumeStaticInitializer() {
super.consumeStaticInitializer();
popElement(K_METHOD_DELIMITER);
@@ -540,6 +707,7 @@ public abstract ImportReference createAssistImportReference(char[][] tokens, lon
public abstract ImportReference createAssistPackageReference(char[][] tokens, long[] positions);
public abstract NameReference createQualifiedAssistNameReference(char[][] previousIdentifiers, char[] assistName, long[] positions);
public abstract TypeReference createQualifiedAssistTypeReference(char[][] previousIdentifiers, char[] assistName, long[] positions);
+public abstract TypeReference createParameterizedQualifiedAssistTypeReference(char[][] previousIdentifiers, TypeReference[][] typeArguments, char[] asistIdentifier, long[] positions);
public abstract NameReference createSingleAssistNameReference(char[] assistName, long position);
public abstract TypeReference createSingleAssistTypeReference(char[] assistName, long position);
/*
@@ -563,38 +731,130 @@ protected TypeReference getTypeReference(int dim) {
int index;
/* no need to take action if not inside completed identifiers */
- if ((index = indexOfAssistIdentifier()) < 0) {
+ if ((index = indexOfAssistIdentifier(true)) < 0) {
return super.getTypeReference(dim);
}
-
- /* retrieve identifiers subset and whole positions, the assist node positions
- should include the entire replaced source. */
int length = identifierLengthStack[identifierLengthPtr];
- char[][] subset = identifierSubSet(index);
- identifierLengthPtr--;
- identifierPtr -= length;
- long[] positions = new long[length];
- System.arraycopy(
- identifierPositionStack,
- identifierPtr + 1,
- positions,
- 0,
- length);
-
- /* build specific assist on type reference */
TypeReference reference;
- if (index == 0) {
- /* assist inside first identifier */
- reference = this.createSingleAssistTypeReference(
- assistIdentifier(),
- positions[0]);
+ int numberOfIdentifiers = this.genericsIdentifiersLengthStack[this.genericsIdentifiersLengthPtr--];
+ if (length != numberOfIdentifiers || this.genericsLengthStack[this.genericsLengthPtr] != 0) {
+ identifierLengthPtr--;
+ // generic type
+ reference = getAssistTypeReferenceForGenericType(dim, length, numberOfIdentifiers);
} else {
- /* assist inside subsequent identifier */
- reference = this.createQualifiedAssistTypeReference(
- subset,
- assistIdentifier(),
- positions);
+ /* retrieve identifiers subset and whole positions, the assist node positions
+ should include the entire replaced source. */
+
+ char[][] subset = identifierSubSet(index);
+ identifierLengthPtr--;
+ identifierPtr -= length;
+ long[] positions = new long[length];
+ System.arraycopy(
+ identifierPositionStack,
+ identifierPtr + 1,
+ positions,
+ 0,
+ length);
+
+ /* build specific assist on type reference */
+
+ if (index == 0) {
+// genericsIdentifiersLengthPtr--;
+ genericsLengthPtr--;
+ /* assist inside first identifier */
+ reference = this.createSingleAssistTypeReference(
+ assistIdentifier(),
+ positions[0]);
+ } else {
+// genericsIdentifiersLengthPtr--;
+ genericsLengthPtr--;
+ /* assist inside subsequent identifier */
+ reference = this.createQualifiedAssistTypeReference(
+ subset,
+ assistIdentifier(),
+ positions);
+ }
+ assistNode = reference;
+ this.lastCheckPoint = reference.sourceEnd + 1;
+ }
+ return reference;
+}
+protected TypeReference getAssistTypeReferenceForGenericType(int dim, int identifierLength, int numberOfIdentifiers) {
+ /* no need to take action if not inside completed identifiers */
+ if (/*(indexOfAssistIdentifier()) < 0 ||*/ (identifierLength == 1 && numberOfIdentifiers == 1)) {
+ int length = this.genericsLengthStack[this.genericsLengthPtr--];
+ this.genericsPtr -= length;
+ long[] positions = new long[identifierLength];
+ System.arraycopy(
+ identifierPositionStack,
+ identifierPtr,
+ positions,
+ 0,
+ identifierLength);
+ TypeReference reference = this.createSingleAssistTypeReference(
+ assistIdentifier(),
+ positions[0]);
+ this.assistNode = reference;
+ this.lastCheckPoint = reference.sourceEnd + 1;
+ return reference;
}
+
+ TypeReference[][] typeArguments = new TypeReference[numberOfIdentifiers][];
+ char[][] tokens = new char[numberOfIdentifiers][];
+ long[] positions = new long[numberOfIdentifiers];
+ int index = numberOfIdentifiers;
+ int currentIdentifiersLength = identifierLength;
+ while (index > 0) {
+ int currentTypeArgumentsLength = this.genericsLengthStack[this.genericsLengthPtr--];
+ if (currentTypeArgumentsLength != 0) {
+ this.genericsPtr -= currentTypeArgumentsLength;
+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, typeArguments[index - 1] = new TypeReference[currentTypeArgumentsLength], 0, currentTypeArgumentsLength);
+ }
+ switch(currentIdentifiersLength) {
+ case 1 :
+ // we are in a case A<B>.C<D> or A<B>.C<D>
+ tokens[index - 1] = this.identifierStack[this.identifierPtr];
+ positions[index - 1] = this.identifierPositionStack[this.identifierPtr--];
+ break;
+ default:
+ // we are in a case A.B.C<B>.C<D> or A.B.C<B>...
+ this.identifierPtr -= currentIdentifiersLength;
+ System.arraycopy(this.identifierStack, this.identifierPtr + 1, tokens, index - currentIdentifiersLength, currentIdentifiersLength);
+ System.arraycopy(this.identifierPositionStack, this.identifierPtr + 1, positions, index - currentIdentifiersLength, currentIdentifiersLength);
+ }
+ index -= currentIdentifiersLength;
+ if (index > 0) {
+ currentIdentifiersLength = this.identifierLengthStack[this.identifierLengthPtr--];
+ }
+ }
+
+ // remove completion token
+ int realLength = numberOfIdentifiers;
+ for (int i = 0; i < numberOfIdentifiers; i++) {
+ if(tokens[i] == assistIdentifier()) {
+ realLength = i;
+ }
+ }
+ TypeReference reference;
+ if(realLength == 0) {
+ reference = this.createSingleAssistTypeReference(assistIdentifier(), positions[0]);
+ } else {
+ System.arraycopy(tokens, 0, tokens = new char[realLength][], 0, realLength);
+ System.arraycopy(typeArguments, 0, typeArguments = new TypeReference[realLength][], 0, realLength);
+
+ boolean isParameterized = false;
+ for (int i = 0; i < typeArguments.length; i++) {
+ if(typeArguments[i] != null) {
+ isParameterized = true;
+ }
+ }
+ if(isParameterized) {
+ reference = this.createParameterizedQualifiedAssistTypeReference(tokens, typeArguments, assistIdentifier(), positions);
+ } else {
+ reference = this.createQualifiedAssistTypeReference(tokens, assistIdentifier(), positions);
+ }
+ }
+
assistNode = reference;
this.lastCheckPoint = reference.sourceEnd + 1;
return reference;
@@ -678,6 +938,10 @@ protected char[][] identifierSubSet(int subsetLength){
subsetLength);
return subset;
}
+
+protected int indexOfAssistIdentifier(){
+ return this.indexOfAssistIdentifier(false);
+}
/*
* Iterate the most recent group of awaiting identifiers (grouped for qualified name reference (eg. aa.bb.cc)
* so as to check whether one of them is the assist identifier.
@@ -685,7 +949,7 @@ protected char[][] identifierSubSet(int subsetLength){
* eg. aa(0).bb(1).cc(2)
* If no assist identifier was found, answers -1.
*/
-protected int indexOfAssistIdentifier(){
+protected int indexOfAssistIdentifier(boolean useGenericsStack){
if (identifierLengthPtr < 0){
return -1; // no awaiting identifier
@@ -698,6 +962,9 @@ protected int indexOfAssistIdentifier(){
// iterate awaiting identifiers backwards
int length = identifierLengthStack[identifierLengthPtr];
+ if(useGenericsStack && length > 0 && this.genericsIdentifiersLengthPtr > -1 ) {
+ length = this.genericsIdentifiersLengthStack[this.genericsIdentifiersLengthPtr];
+ }
for (int i = 0; i < length; i++){
if (identifierStack[identifierPtr - i] == assistIdentifier){
return length - i - 1;
@@ -1109,15 +1376,19 @@ public void reset(){
protected boolean resumeAfterRecovery() {
// reset internal stacks
- astPtr = -1;
- astLengthPtr = -1;
- expressionPtr = -1;
- expressionLengthPtr = -1;
- identifierPtr = -1;
- identifierLengthPtr = -1;
- intPtr = -1;
- dimensions = 0 ;
- recoveredStaticInitializerStart = 0;
+ this.astPtr = -1;
+ this.astLengthPtr = -1;
+ this.expressionPtr = -1;
+ this.expressionLengthPtr = -1;
+ this.identifierPtr = -1;
+ this.identifierLengthPtr = -1;
+ this.intPtr = -1;
+ this.dimensions = 0 ;
+ this.recoveredStaticInitializerStart = 0;
+
+ this.genericsIdentifiersLengthPtr = -1;
+ this.genericsLengthPtr = -1;
+ this.genericsPtr = -1;
// if in diet mode, reset the diet counter because we're going to restart outside an initializer.
if (diet) dietInt = 0;
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionNodeFound.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionNodeFound.java
index 7feb67e827..0ad419db5c 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionNodeFound.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionNodeFound.java
@@ -16,7 +16,7 @@ public class SelectionNodeFound extends RuntimeException {
public Binding binding;
public boolean isDeclaration;
public SelectionNodeFound() {
- this(null); // we found a problem in the selection node
+ this(null, false); // we found a problem in the selection node
}
public SelectionNodeFound(Binding binding) {
this(binding, false);
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnArgumentName.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnArgumentName.java
index 776cbcd383..69aa689951 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnArgumentName.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnArgumentName.java
@@ -18,9 +18,9 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
public class SelectionOnArgumentName extends Argument {
- public SelectionOnArgumentName(char[] name , long posNom , TypeReference tr , int modifiers){
+ public SelectionOnArgumentName(char[] name , long posNom , TypeReference tr , int modifiers, boolean isVarArgs){
- super(name, posNom, tr, modifiers);
+ super(name, posNom, tr, modifiers, isVarArgs);
}
public void bind(MethodScope scope, TypeBinding typeBinding, boolean used) {
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnParameterizedQualifiedTypeReference.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnParameterizedQualifiedTypeReference.java
new file mode 100644
index 0000000000..efd6f10367
--- /dev/null
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnParameterizedQualifiedTypeReference.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * 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.codeassist.select;
+
+import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.TypeReference;
+import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
+import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
+import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
+
+public class SelectionOnParameterizedQualifiedTypeReference extends ParameterizedQualifiedTypeReference {
+ public SelectionOnParameterizedQualifiedTypeReference(char[][] previousIdentifiers, char[] selectionIdentifier, TypeReference[][] typeArguments, long[] positions) {
+ super(
+ CharOperation.arrayConcat(previousIdentifiers, selectionIdentifier),
+ typeArguments,
+ 0,
+ positions);
+ int length = this.typeArguments.length;
+ System.arraycopy(this.typeArguments, 0, this.typeArguments = new TypeReference[length + 1][], 0, length);
+ }
+
+ public TypeBinding resolveType(BlockScope scope) {
+ super.resolveType(scope);
+ throw new SelectionNodeFound(this.resolvedType);
+ }
+
+ public TypeBinding resolveType(ClassScope scope) {
+ super.resolveType(scope);
+ throw new SelectionNodeFound(this.resolvedType);
+ }
+
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+ output.append("<SelectOnType:");//$NON-NLS-1$
+ int length = tokens.length - 1;
+ for (int i = 0; i < length - 1; i++) {
+ output.append(tokens[i]);
+ TypeReference[] typeArgument = typeArguments[i];
+ if (typeArgument != null) {
+ output.append('<');//$NON-NLS-1$
+ int max = typeArgument.length - 1;
+ for (int j = 0; j < max; j++) {
+ typeArgument[j].print(0, output);
+ output.append(", ");//$NON-NLS-1$
+ }
+ typeArgument[max].print(0, output);
+ output.append('>');
+ }
+ output.append('.');
+ }
+ output.append(tokens[length - 1]);
+ TypeReference[] typeArgument = typeArguments[length - 1];
+ if (typeArgument != null) {
+ output.append('<');//$NON-NLS-1$
+ int max = typeArgument.length - 1;
+ for (int j = 0; j < max; j++) {
+ typeArgument[j].print(0, output);
+ output.append(", ");//$NON-NLS-1$
+ }
+ typeArgument[max].print(0, output);
+ output.append('>');
+ }
+ output.append('.').append(tokens[length]).append('>');
+ return output;
+ }
+}
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedTypeReference.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedTypeReference.java
index f2bb372c1b..d1d4137a6b 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedTypeReference.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedTypeReference.java
@@ -38,7 +38,7 @@ public SelectionOnQualifiedTypeReference(char[][] previousIdentifiers, char[] se
public void aboutToResolve(Scope scope) {
getTypeBinding(scope.parent); // step up from the ClassScope
}
-public TypeBinding getTypeBinding(Scope scope) {
+protected TypeBinding getTypeBinding(Scope scope) {
// it can be a package, type or member type
Binding binding = scope.getTypeOrPackage(tokens);
if (!binding.isValidBinding()) {
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleTypeReference.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleTypeReference.java
index f5667794d6..236b2cdc14 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleTypeReference.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleTypeReference.java
@@ -21,7 +21,6 @@ package org.eclipse.jdt.internal.codeassist.select;
* ---> class X extends <SelectOnType:Object>
*
*/
-
import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference;
import org.eclipse.jdt.internal.compiler.lookup.Binding;
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
@@ -37,14 +36,13 @@ public SelectionOnSingleTypeReference(char[] source, long pos) {
public void aboutToResolve(Scope scope) {
getTypeBinding(scope.parent); // step up from the ClassScope
}
-public TypeBinding getTypeBinding(Scope scope) {
+protected TypeBinding getTypeBinding(Scope scope) {
// it can be a package, type or member type
Binding binding = scope.getTypeOrPackage(new char[][] {token});
if (!binding.isValidBinding()) {
scope.problemReporter().invalidType(this, (TypeBinding) binding);
throw new SelectionNodeFound();
}
-
throw new SelectionNodeFound(binding);
}
public StringBuffer printExpression(int indent, StringBuffer output) {
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java
index d6785f242a..11374a0d54 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java
@@ -123,8 +123,9 @@ protected void classInstanceCreation(boolean alwaysQualified) {
}
// trick to avoid creating a selection on type reference
char [] oldIdent = this.assistIdentifier();
- this.setAssistIdentifier(null);
+ this.setAssistIdentifier(null);
alloc.type = getTypeReference(0);
+
this.setAssistIdentifier(oldIdent);
//the default constructor with the correct number of argument
@@ -158,9 +159,7 @@ protected void consumeArrayCreationExpressionWithoutInitializer() {
this.isOrphanCompletionNode = true;
}
}
-
protected void consumeArrayCreationExpressionWithInitializer() {
- // ArrayCreationWithArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs ArrayInitializer
// ArrayCreationWithArrayInitializer ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs ArrayInitializer
super.consumeArrayCreationExpressionWithInitializer();
@@ -181,6 +180,13 @@ protected void consumeEnterAnonymousClassBody() {
super.consumeEnterAnonymousClassBody();
return;
}
+
+ // trick to avoid creating a selection on type reference
+ char [] oldIdent = this.assistIdentifier();
+ this.setAssistIdentifier(null);
+ TypeReference typeReference = getTypeReference(0);
+ this.setAssistIdentifier(oldIdent);
+
QualifiedAllocationExpression alloc;
TypeDeclaration anonymousType = new TypeDeclaration(this.compilationUnit.compilationResult);
anonymousType.name = TypeDeclaration.ANONYMOUS_EMPTY_NAME;
@@ -200,11 +206,69 @@ protected void consumeEnterAnonymousClassBody() {
0,
argumentLength);
}
+
+ alloc.type = typeReference;
+
+ anonymousType.sourceEnd = alloc.sourceEnd;
+ //position at the type while it impacts the anonymous declaration
+ anonymousType.sourceStart = anonymousType.declarationSourceStart = alloc.type.sourceStart;
+ alloc.sourceStart = intStack[intPtr--];
+ pushOnExpressionStack(alloc);
+
+ assistNode = alloc;
+ this.lastCheckPoint = alloc.sourceEnd + 1;
+ if (!diet){
+ this.restartRecovery = true; // force to restart in recovery mode
+ this.lastIgnoredToken = -1;
+ currentToken = 0; // opening brace already taken into account
+ hasReportedError = true;
+ }
+
+ anonymousType.bodyStart = scanner.currentPosition;
+ listLength = 0; // will be updated when reading super-interfaces
+ // recovery
+ if (currentElement != null){
+ lastCheckPoint = anonymousType.bodyStart;
+ currentElement = currentElement.add(anonymousType, 0);
+ currentToken = 0; // opening brace already taken into account
+ lastIgnoredToken = -1;
+ }
+}
+protected void consumeEnterAnonymousClassBodySimpleName() {
+ // EnterAnonymousClassBody ::= $empty
+
+ if (this.indexOfAssistIdentifier() < 0) {
+ super.consumeEnterAnonymousClassBodySimpleName();
+ return;
+ }
+ pushOnGenericsLengthStack(0);
+ pushOnGenericsIdentifiersLengthStack(identifierLengthStack[identifierLengthPtr]);
// trick to avoid creating a selection on type reference
char [] oldIdent = this.assistIdentifier();
- this.setAssistIdentifier(null);
- alloc.type = getTypeReference(0);
- this.setAssistIdentifier(oldIdent);
+ this.setAssistIdentifier(null);
+ TypeReference typeReference = getTypeReference(0);
+ this.setAssistIdentifier(oldIdent);
+
+ QualifiedAllocationExpression alloc;
+ TypeDeclaration anonymousType = new TypeDeclaration(this.compilationUnit.compilationResult);
+ anonymousType.name = TypeDeclaration.ANONYMOUS_EMPTY_NAME;
+ anonymousType.bits |= ASTNode.AnonymousAndLocalMask;
+ alloc = anonymousType.allocation = new SelectionOnQualifiedAllocationExpression(anonymousType);
+ markEnclosingMemberWithLocalType();
+ pushOnAstStack(anonymousType);
+
+ alloc.sourceEnd = rParenPos; //the position has been stored explicitly
+ int argumentLength;
+ if ((argumentLength = expressionLengthStack[expressionLengthPtr--]) != 0) {
+ expressionPtr -= argumentLength;
+ System.arraycopy(
+ expressionStack,
+ expressionPtr + 1,
+ alloc.arguments = new Expression[argumentLength],
+ 0,
+ argumentLength);
+ }
+ alloc.type = typeReference;
anonymousType.sourceEnd = alloc.sourceEnd;
//position at the type while it impacts the anonymous declaration
@@ -292,9 +356,9 @@ protected void consumeFieldAccess(boolean isSuperAccess) {
}
this.isOrphanCompletionNode = true;
}
-protected void consumeFormalParameter() {
+protected void consumeFormalParameter(boolean isVarArgs) {
if (this.indexOfAssistIdentifier() < 0) {
- super.consumeFormalParameter();
+ super.consumeFormalParameter(isVarArgs);
if((!diet || dietInt != 0) && astPtr > -1) {
Argument argument = (Argument) astStack[astPtr];
if(argument.type == assistNode) {
@@ -316,7 +380,8 @@ protected void consumeFormalParameter() {
identifierName,
namePositions,
type,
- intStack[intPtr + 1] & ~AccDeprecated); // modifiers
+ intStack[intPtr + 1] & ~AccDeprecated,
+ isVarArgs); // modifiers
arg.declarationSourceStart = modifierPositions;
pushOnAstStack(arg);
@@ -344,6 +409,16 @@ protected void consumeInstanceOfExpression(int op) {
this.lastIgnoredToken = -1;
}
}
+protected void consumeInstanceOfExpressionWithName(int op) {
+ if (indexOfAssistIdentifier() < 0) {
+ super.consumeInstanceOfExpressionWithName(op);
+ } else {
+ getTypeReference(intStack[intPtr--]);
+ this.isOrphanCompletionNode = true;
+ this.restartRecovery = true;
+ this.lastIgnoredToken = -1;
+ }
+}
protected void consumeLocalVariableDeclarationStatement() {
super.consumeLocalVariableDeclarationStatement();
@@ -456,6 +531,58 @@ protected void consumeMethodInvocationPrimary() {
this.lastCheckPoint = constructorCall.sourceEnd + 1;
this.isOrphanCompletionNode = true;
}
+protected void consumeStaticImportOnDemandDeclarationName() {
+ // TypeImportOnDemandDeclarationName ::= 'import' 'static' Name '.' '*'
+ /* push an ImportRef build from the last name
+ stored in the identifier stack. */
+
+ int index;
+
+ /* no need to take action if not inside assist identifiers */
+ if ((index = indexOfAssistIdentifier()) < 0) {
+ super.consumeStaticImportOnDemandDeclarationName();
+ return;
+ }
+ /* retrieve identifiers subset and whole positions, the assist node positions
+ should include the entire replaced source. */
+ int length = identifierLengthStack[identifierLengthPtr];
+ char[][] subset = identifierSubSet(index+1); // include the assistIdentifier
+ identifierLengthPtr--;
+ identifierPtr -= length;
+ long[] positions = new long[length];
+ System.arraycopy(
+ identifierPositionStack,
+ identifierPtr + 1,
+ positions,
+ 0,
+ length);
+
+ /* build specific assist node on import statement */
+ ImportReference reference = this.createAssistImportReference(subset, positions, AccStatic);
+ reference.onDemand = true;
+ assistNode = reference;
+ this.lastCheckPoint = reference.sourceEnd + 1;
+
+ pushOnAstStack(reference);
+
+ if (currentToken == TokenNameSEMICOLON){
+ reference.declarationSourceEnd = scanner.currentPosition - 1;
+ } else {
+ reference.declarationSourceEnd = (int) positions[length-1];
+ }
+ //endPosition is just before the ;
+ reference.declarationSourceStart = intStack[intPtr--];
+ // flush annotations defined prior to import statements
+ reference.declarationSourceEnd = this.flushCommentsDefinedPriorTo(reference.declarationSourceEnd);
+
+ // recovery
+ if (currentElement != null){
+ lastCheckPoint = reference.declarationSourceEnd+1;
+ currentElement = currentElement.add(reference, 0);
+ lastIgnoredToken = -1;
+ restartRecovery = true; // used to avoid branching back into the regular automaton
+ }
+}
protected void consumeTypeImportOnDemandDeclarationName() {
// TypeImportOnDemandDeclarationName ::= 'import' Name '.' '*'
/* push an ImportRef build from the last name
@@ -536,6 +663,11 @@ public TypeReference createQualifiedAssistTypeReference(char[][] previousIdentif
assistName,
positions);
}
+public TypeReference createParameterizedQualifiedAssistTypeReference(
+ char[][] tokens, TypeReference[][] typeArguments, char[] assistname, long[] positions) {
+ return new SelectionOnParameterizedQualifiedTypeReference(tokens, assistname, typeArguments, positions);
+
+}
public NameReference createSingleAssistNameReference(char[] assistName, long position) {
return new SelectionOnSingleNameReference(assistName, position);
}
@@ -569,6 +701,8 @@ protected NameReference getUnspecifiedReference() {
// discard 'super' from identifier stacks
identifierLengthStack[identifierLengthPtr] = completionIndex;
int ptr = identifierPtr -= (length - completionIndex);
+ pushOnGenericsLengthStack(0);
+ pushOnGenericsIdentifiersLengthStack(identifierLengthStack[identifierLengthPtr]);
reference =
new SelectionOnQualifiedSuperReference(
getTypeReference(0),
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CharOperation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CharOperation.java
index 07d23e3b87..cb2afefdc5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CharOperation.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CharOperation.java
@@ -490,7 +490,7 @@ public final class CharOperation {
/**
* Answers the concatenation of the three arrays inserting the sep1 character between the
- * two arrays and sep2 between the last two.
+ * first two arrays and sep2 between the last two.
* It answers null if the three arrays are null.
* If the first array is null, then it answers the concatenation of second and third inserting
* the sep2 character between them.
@@ -2269,6 +2269,58 @@ public final class CharOperation {
System.arraycopy(array, inStart, result, outStart, max - inStart);
return result;
}
+
+ /**
+ * Replace all occurrence of the character to be replaced with the remplacement character
+ * in a copy of the given array. Returns the given array if no occurrences of the character
+ * to be replaced are found.
+ * <br>
+ * <br>
+ * For example:
+ * <ol>
+ * <li><pre>
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * toBeReplaced = 'b'
+ * replacementChar = 'a'
+ * result => A new array that is equals to { 'a' , 'a', 'a', 'a', 'a', 'a' }
+ * </pre>
+ * </li>
+ * <li><pre>
+ * array = { 'a' , 'b', 'b', 'a', 'b', 'a' }
+ * toBeReplaced = 'c'
+ * replacementChar = 'a'
+ * result => The original array that remains unchanged.
+ * </pre>
+ * </li>
+ * </ol>
+ *
+ * @param array the given array
+ * @param toBeReplaced the character to be replaced
+ * @param replacementChar the replacement character
+ * @throws NullPointerException if the given array is null
+ * @since 3.1
+ */
+ public static final char[] replaceOnCopy(
+ char[] array,
+ char toBeReplaced,
+ char replacementChar) {
+
+ char[] result = null;
+ for (int i = 0, length = array.length; i < length; i++) {
+ char c = array[i];
+ if (c == toBeReplaced) {
+ if (result == null) {
+ result = new char[length];
+ System.arraycopy(array, 0, result, 0, i);
+ }
+ result[i] = replacementChar;
+ } else if (result != null) {
+ result[i] = c;
+ }
+ }
+ if (result == null) return array;
+ return result;
+ }
/**
* Return a new array which is the split of the given array using the given divider and triming each subarray to remove
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java
index 7be59f139a..fafcbc3f62 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java
@@ -69,6 +69,8 @@
* JavadocInvalidTag
* JavadocMessagePrefix
* EmptyControlFlowStatement
+ * IBM Corporation - added the following constants
+ * IllegalUsageOfQualifiedTypeReference
****************************************************************************/
package org.eclipse.jdt.core.compiler;
@@ -229,7 +231,7 @@ public interface IProblem {
int InternalTypeNameProvided = TypeRelated + 6;
/** @since 2.1 */
int UnusedPrivateType = Internal + TypeRelated + 7;
-
+
int IncompatibleTypesInEqualityOperator = TypeRelated + 15;
int IncompatibleTypesInConditionalOperator = TypeRelated + 16;
int TypeMismatch = TypeRelated + 17;
@@ -445,7 +447,7 @@ public interface IProblem {
/** @since 3.0 */
int UnusedConstructorDeclaredThrownException = Internal + 186;
/** @since 3.0 */
- int InvalidCatchBlockSequence = Internal + TypeRelated + 187;
+ int InvalidCatchBlockSequence = Internal + TypeRelated + 187;
/** @since 3.0 */
int EmptyControlFlowStatement = Internal + TypeRelated + 188;
/** @since 3.0 */
@@ -462,6 +464,9 @@ public interface IProblem {
int InheritedFieldHidesEnclosingName = FieldRelated + 196;
int InheritedTypeHidesEnclosingName = TypeRelated + 197;
+ /** @since 3.1 */
+ int IllegalUsageOfQualifiedTypeReference = Internal + Syntax + 198;
+
// miscellaneous
int ThisInStaticContext = Internal + 200;
int StaticMethodRequested = Internal + MethodRelated + 201;
@@ -560,18 +565,26 @@ public interface IProblem {
/** @since 2.1 */
int ObjectCannotHaveSuperTypes = 329;
- // int InvalidSuperclassBase = TypeRelated + 329; // reserved to 334 included
+ /** @deprecated - problem is no longer generated, UndefinedType is used instead */
int SuperclassNotFound = TypeRelated + 329 + ProblemReasons.NotFound; // TypeRelated + 330
+ /** @deprecated - problem is no longer generated, NotVisibleType is used instead */
int SuperclassNotVisible = TypeRelated + 329 + ProblemReasons.NotVisible; // TypeRelated + 331
+ /** @deprecated - problem is no longer generated, use AmbiguousType is used instead */
int SuperclassAmbiguous = TypeRelated + 329 + ProblemReasons.Ambiguous; // TypeRelated + 332
+ /** @deprecated - problem is no longer generated, use InternalTypeNameProvided is used instead */
int SuperclassInternalNameProvided = TypeRelated + 329 + ProblemReasons.InternalNameProvided; // TypeRelated + 333
+ /** @deprecated - problem is no longer generated, use InheritedTypeHidesEnclosingName is used instead */
int SuperclassInheritedNameHidesEnclosingName = TypeRelated + 329 + ProblemReasons.InheritedNameHidesEnclosingName; // TypeRelated + 334
- // int InvalidInterfaceBase = TypeRelated + 334; // reserved to 339 included
+ /** @deprecated - problem is no longer generated, UndefinedType is used instead */
int InterfaceNotFound = TypeRelated + 334 + ProblemReasons.NotFound; // TypeRelated + 335
+ /** @deprecated - problem is no longer generated, NotVisibleType is used instead */
int InterfaceNotVisible = TypeRelated + 334 + ProblemReasons.NotVisible; // TypeRelated + 336
+ /** @deprecated - problem is no longer generated, use AmbiguousType is used instead */
int InterfaceAmbiguous = TypeRelated + 334 + ProblemReasons.Ambiguous; // TypeRelated + 337
+ /** @deprecated - problem is no longer generated, use InternalTypeNameProvided is used instead */
int InterfaceInternalNameProvided = TypeRelated + 334 + ProblemReasons.InternalNameProvided; // TypeRelated + 338
+ /** @deprecated - problem is no longer generated, use InheritedTypeHidesEnclosingName is used instead */
int InterfaceInheritedNameHidesEnclosingName = TypeRelated + 334 + ProblemReasons.InheritedNameHidesEnclosingName; // TypeRelated + 339
// field related problems
@@ -583,11 +596,15 @@ public interface IProblem {
int IllegalModifierCombinationFinalVolatileForField = FieldRelated + 345;
int UnexpectedStaticModifierForField = FieldRelated + 346;
- // int FieldTypeProblemBase = FieldRelated + 349; //reserved to 354
+ /** @deprecated - problem is no longer generated, UndefinedType is used instead */
int FieldTypeNotFound = FieldRelated + 349 + ProblemReasons.NotFound; // FieldRelated + 350
+ /** @deprecated - problem is no longer generated, NotVisibleType is used instead */
int FieldTypeNotVisible = FieldRelated + 349 + ProblemReasons.NotVisible; // FieldRelated + 351
+ /** @deprecated - problem is no longer generated, use AmbiguousType is used instead */
int FieldTypeAmbiguous = FieldRelated + 349 + ProblemReasons.Ambiguous; // FieldRelated + 352
+ /** @deprecated - problem is no longer generated, use InternalTypeNameProvided is used instead */
int FieldTypeInternalNameProvided = FieldRelated + 349 + ProblemReasons.InternalNameProvided; // FieldRelated + 353
+ /** @deprecated - problem is no longer generated, use InheritedTypeHidesEnclosingName is used instead */
int FieldTypeInheritedNameHidesEnclosingName = FieldRelated + 349 + ProblemReasons.InheritedNameHidesEnclosingName; // FieldRelated + 354
// method related problems
@@ -606,25 +623,37 @@ public interface IProblem {
int NativeMethodsCannotBeStrictfp = MethodRelated + 367;
int DuplicateModifierForArgument = MethodRelated + 368;
- // int ArgumentProblemBase = MethodRelated + 369; // reserved to 374 included.
+ /** @deprecated - problem is no longer generated, UndefinedType is used instead */
int ArgumentTypeNotFound = MethodRelated + 369 + ProblemReasons.NotFound; // MethodRelated + 370
+ /** @deprecated - problem is no longer generated, NotVisibleType is used instead */
int ArgumentTypeNotVisible = MethodRelated + 369 + ProblemReasons.NotVisible; // MethodRelated + 371
+ /** @deprecated - problem is no longer generated, use AmbiguousType is used instead */
int ArgumentTypeAmbiguous = MethodRelated + 369 + ProblemReasons.Ambiguous; // MethodRelated + 372
+ /** @deprecated - problem is no longer generated, use InternalTypeNameProvided is used instead */
int ArgumentTypeInternalNameProvided = MethodRelated + 369 + ProblemReasons.InternalNameProvided; // MethodRelated + 373
+ /** @deprecated - problem is no longer generated, use InheritedTypeHidesEnclosingName is used instead */
int ArgumentTypeInheritedNameHidesEnclosingName = MethodRelated + 369 + ProblemReasons.InheritedNameHidesEnclosingName; // MethodRelated + 374
- // int ExceptionTypeProblemBase = MethodRelated + 374; // reserved to 379 included.
+ /** @deprecated - problem is no longer generated, UndefinedType is used instead */
int ExceptionTypeNotFound = MethodRelated + 374 + ProblemReasons.NotFound; // MethodRelated + 375
+ /** @deprecated - problem is no longer generated, NotVisibleType is used instead */
int ExceptionTypeNotVisible = MethodRelated + 374 + ProblemReasons.NotVisible; // MethodRelated + 376
+ /** @deprecated - problem is no longer generated, use AmbiguousType is used instead */
int ExceptionTypeAmbiguous = MethodRelated + 374 + ProblemReasons.Ambiguous; // MethodRelated + 377
+ /** @deprecated - problem is no longer generated, use InternalTypeNameProvided is used instead */
int ExceptionTypeInternalNameProvided = MethodRelated + 374 + ProblemReasons.InternalNameProvided; // MethodRelated + 378
+ /** @deprecated - problem is no longer generated, use InheritedTypeHidesEnclosingName is used instead */
int ExceptionTypeInheritedNameHidesEnclosingName = MethodRelated + 374 + ProblemReasons.InheritedNameHidesEnclosingName; // MethodRelated + 379
- // int ReturnTypeProblemBase = MethodRelated + 379;
+ /** @deprecated - problem is no longer generated, UndefinedType is used instead */
int ReturnTypeNotFound = MethodRelated + 379 + ProblemReasons.NotFound; // MethodRelated + 380
+ /** @deprecated - problem is no longer generated, NotVisibleType is used instead */
int ReturnTypeNotVisible = MethodRelated + 379 + ProblemReasons.NotVisible; // MethodRelated + 381
+ /** @deprecated - problem is no longer generated, use AmbiguousType is used instead */
int ReturnTypeAmbiguous = MethodRelated + 379 + ProblemReasons.Ambiguous; // MethodRelated + 382
+ /** @deprecated - problem is no longer generated, use InternalTypeNameProvided is used instead */
int ReturnTypeInternalNameProvided = MethodRelated + 379 + ProblemReasons.InternalNameProvided; // MethodRelated + 383
+ /** @deprecated - problem is no longer generated, use InheritedTypeHidesEnclosingName is used instead */
int ReturnTypeInheritedNameHidesEnclosingName = MethodRelated + 379 + ProblemReasons.InheritedNameHidesEnclosingName; // MethodRelated + 384
// import related problems
@@ -633,11 +662,14 @@ public interface IProblem {
int CannotImportPackage = ImportRelated + 387;
int UnusedImport = ImportRelated + 388;
- // int ImportProblemBase = ImportRelated + 389;
int ImportNotFound = ImportRelated + 389 + ProblemReasons.NotFound; // ImportRelated + 390
+ /** @deprecated - problem is no longer generated, NotVisibleType is used instead */
int ImportNotVisible = ImportRelated + 389 + ProblemReasons.NotVisible; // ImportRelated + 391
+ /** @deprecated - problem is no longer generated, use AmbiguousType is used instead */
int ImportAmbiguous = ImportRelated + 389 + ProblemReasons.Ambiguous; // ImportRelated + 392
+ /** @deprecated - problem is no longer generated, use InternalTypeNameProvided is used instead */
int ImportInternalNameProvided = ImportRelated + 389 + ProblemReasons.InternalNameProvided; // ImportRelated + 393
+ /** @deprecated - problem is no longer generated, use InheritedTypeHidesEnclosingName is used instead */
int ImportInheritedNameHidesEnclosingName = ImportRelated + 389 + ProblemReasons.InheritedNameHidesEnclosingName; // ImportRelated + 394
// local variable related problems
@@ -797,4 +829,123 @@ public interface IProblem {
int JavadocMalformedSeeReference = Javadoc + Internal + 513;
/** @since 3.0 */
int JavadocMessagePrefix = Internal + 515;
+
+ /**
+ * Generics
+ */
+ /** @since 3.1 */
+ int DuplicateTypeVariable = Internal + 520;
+ /** @since 3.1 */
+ int IllegalTypeVariableSuperReference = Internal + 521;
+ /** @since 3.1 */
+ int TypeVariableReferenceFromStaticContext = Internal + 522;
+ /** @since 3.1 */
+ int ObjectCannotBeGeneric = Internal + 523;
+ /** @since 3.1 */
+ int NonGenericType = TypeRelated + 524;
+ /** @since 3.1 */
+ int IncorrectArityForParameterizedType = TypeRelated + 525;
+ /** @since 3.1 */
+ int TypeArgumentMismatch = TypeRelated + 526;
+ /** @since 3.1 */
+ int DuplicateMethodErasure = TypeRelated + 527;
+ /** @since 3.1 */
+ int ReferenceToForwardTypeVariable = TypeRelated + 528;
+ /** @since 3.1 */
+ int BoundsMustBeAnInterface = TypeRelated + 529;
+ /** @since 3.1 */
+ int UnsafeRawConstructorInvocation = TypeRelated + 530;
+ /** @since 3.1 */
+ int UnsafeRawMethodInvocation = TypeRelated + 531;
+ /** @since 3.1 */
+ int UnsafeRawExpressionAssignment = TypeRelated + 532;
+ /** @since 3.1 */
+ int UnsafeConstructorWithRawArguments = TypeRelated + 533;
+ /** @since 3.1 */
+ int UnsafeMethodWithRawArguments = TypeRelated + 534;
+ /** @since 3.1 */
+ int IllegalArrayOfParameterizedType = TypeRelated + 535;
+ /** @since 3.1 */
+ int UnsafeRawFieldAssignment = TypeRelated + 536;
+ /** @since 3.1 */
+ int InvalidClassInstantiationWithWildcards = Internal + 537;
+ /** @since 3.1 */
+ int FinalBoundForTypeVariable = TypeRelated + 538;
+ /** @since 3.1 */
+ int UndefinedTypeVariable = Internal + 539;
+ /** @since 3.1 */
+ int SuperInterfacesCollide = TypeRelated + 540;
+ /** @since 3.1 */
+ int UnsafeWildcardConstructorInvocation = TypeRelated + 541;
+ /** @since 3.1 */
+ int UnsafeWildcardMethodInvocation = TypeRelated + 542;
+ /** @since 3.1 */
+ int UnsafeWildcardFieldAssignment = TypeRelated + 543;
+ /** @since 3.1 */
+ int GenericMethodTypeArgumentMismatch = TypeRelated + 544;
+ /** @since 3.1 */
+ int GenericConstructorTypeArgumentMismatch = TypeRelated + 545;
+ /** @since 3.1 */
+ int UnsafeGenericCast = TypeRelated + 546;
+ /** @since 3.1 */
+ int UnsafeRawReturnValue = TypeRelated + 547;
+ /** @since 3.1 */
+ int IllegalInstanceofParameterizedType = Internal + 548;
+ /** @since 3.1 */
+ int IllegalInstanceofTypeParameter = Internal + 549;
+ /** @since 3.1 */
+ int NonGenericMethod = TypeRelated + 550;
+ /** @since 3.1 */
+ int IncorrectArityForParameterizedMethod = TypeRelated + 551;
+ /** @since 3.1 */
+ int ParameterizedMethodArgumentTypeMismatch = TypeRelated + 552;
+ /** @since 3.1 */
+ int NonGenericConstructor = TypeRelated + 553;
+ /** @since 3.1 */
+ int IncorrectArityForParameterizedConstructor = TypeRelated + 554;
+ /** @since 3.1 */
+ int ParameterizedConstructorArgumentTypeMismatch = TypeRelated + 555;
+ /** @since 3.1 */
+ int InvalidParameterizedExceptionType = TypeRelated + 556;
+
+ /**
+ * Foreach
+ */
+ /** @since 3.1 */
+ int IncompatibleTypesInForeach = TypeRelated + 580;
+ /** @since 3.1 */
+ int InvalidTypeForCollection = Internal + 581;
+
+ /**
+ * 1.5 Syntax errors (when source level < 1.5)
+ */
+ /** @since 3.1 */
+ int InvalidUsageOfTypeParameters = Syntax + Internal + 590;
+ /** @since 3.1 */
+ int InvalidUsageOfStaticImports = Syntax + Internal + 591;
+ /** @since 3.1 */
+ int InvalidUsageOfForeachStatements = Syntax + Internal + 592;
+ /** @since 3.1 */
+ int InvalidUsageOfTypeArguments = Syntax + Internal + 593;
+ /** @since 3.1 */
+ int InvalidUsageOfEnumDeclarations = Syntax + Internal + 594;
+ /** @since 3.1 */
+ int InvalidUsageOfVarargs = Syntax + Internal + 595;
+ /** @since 3.1 */
+ int InvalidUsageOfAnnotations = Syntax + Internal + 596;
+
+ /**
+ * Annotation
+ */
+ /** @since 3.0 */
+ int AnnotationButConstructorName = MethodRelated + 600;
+ /** @since 3.0 */
+ int IllegalExtendedDimensions = MethodRelated + 601;
+ /** @since 3.0 */
+ int InvalidFileNameForPackageAnnotations = Syntax + Internal + 602;
+
+ /**
+ * Corrupted binaries
+ */
+ int CorruptedSignature = Internal + 700;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java
index 9e1166d837..d3f08e4a1b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java
@@ -30,33 +30,26 @@ public abstract class ASTVisitor {
public void endVisit(AND_AND_Expression and_and_Expression, BlockScope scope) {
// do nothing by default
}
- public void endVisit(JavadocArrayQualifiedTypeReference typeRef, BlockScope scope) {
- // do nothing by default
- }
- public void endVisit(JavadocArraySingleTypeReference typeRef, BlockScope scope) {
- // do nothing by default
- }
- public void endVisit(JavadocArgumentExpression expression, BlockScope scope) {
- // do nothing by default
- }
- public void endVisit(JavadocFieldReference fieldRef, BlockScope scope) {
- // do nothing by default
- }
- public void endVisit(JavadocMessageSend messageSend, BlockScope scope) {
- // do nothing by default
- }
- public void endVisit(JavadocQualifiedTypeReference typeRef, BlockScope scope) {
- // do nothing by default
- }
- public void endVisit(JavadocReturnStatement statement, BlockScope scope) {
+ public void endVisit(
+ AnnotationTypeDeclaration annotationTypeDeclaration,
+ BlockScope scope) {
// do nothing by default
}
- public void endVisit(JavadocSingleNameReference argument, BlockScope scope) {
+ public void endVisit(
+ AnnotationTypeDeclaration annotationTypeDeclaration,
+ ClassScope scope) {
// do nothing by default
- }
- public void endVisit(JavadocSingleTypeReference typeRef, BlockScope scope) {
+ }
+ public void endVisit(
+ AnnotationTypeDeclaration annotationTypeDeclaration,
+ CompilationUnitScope scope) {
// do nothing by default
}
+ public void endVisit(
+ AnnotationTypeMemberDeclaration annotationTypeDeclaration,
+ ClassScope classScope) {
+ // do nothing by default
+ }
public void endVisit(Argument argument, BlockScope scope) {
// do nothing by default
}
@@ -87,10 +80,10 @@ public abstract class ASTVisitor {
public void endVisit(ArrayTypeReference arrayTypeReference, ClassScope scope) {
// do nothing by default
}
- public void endVisit(Assignment assignment, BlockScope scope) {
+ public void endVisit(AssertStatement assertStatement, BlockScope scope) {
// do nothing by default
}
- public void endVisit(AssertStatement assertStatement, BlockScope scope) {
+ public void endVisit(Assignment assignment, BlockScope scope) {
// do nothing by default
}
public void endVisit(BinaryExpression binaryExpression, BlockScope scope) {
@@ -144,6 +137,21 @@ public abstract class ASTVisitor {
public void endVisit(DoubleLiteral doubleLiteral, BlockScope scope) {
// do nothing by default
}
+ public void endVisit(EmptyStatement emptyStatement, BlockScope scope) {
+ // do nothing by default
+ }
+ public void endVisit(EnumConstant enumDeclaration, ClassScope scope) {
+ // do nothing by default
+ }
+ public void endVisit(EnumDeclaration enumDeclaration, BlockScope scope) {
+ // do nothing by default
+ }
+ public void endVisit(EnumDeclaration enumDeclaration, ClassScope scope) {
+ // do nothing by default
+ }
+ public void endVisit(EnumDeclaration enumDeclaration, CompilationUnitScope scope) {
+ // do nothing by default
+ }
public void endVisit(EqualExpression equalExpression, BlockScope scope) {
// do nothing by default
}
@@ -169,7 +177,7 @@ public abstract class ASTVisitor {
public void endVisit(FloatLiteral floatLiteral, BlockScope scope) {
// do nothing by default
}
- public void endVisit(EmptyStatement emptyStatement, BlockScope scope) {
+ public void endVisit(ForeachStatement forStatement, BlockScope scope) {
// do nothing by default
}
public void endVisit(ForStatement forStatement, BlockScope scope) {
@@ -192,6 +200,33 @@ public abstract class ASTVisitor {
public void endVisit(IntLiteral intLiteral, BlockScope scope) {
// do nothing by default
}
+ public void endVisit(JavadocArgumentExpression expression, BlockScope scope) {
+ // do nothing by default
+ }
+ public void endVisit(JavadocArrayQualifiedTypeReference typeRef, BlockScope scope) {
+ // do nothing by default
+ }
+ public void endVisit(JavadocArraySingleTypeReference typeRef, BlockScope scope) {
+ // do nothing by default
+ }
+ public void endVisit(JavadocFieldReference fieldRef, BlockScope scope) {
+ // do nothing by default
+ }
+ public void endVisit(JavadocMessageSend messageSend, BlockScope scope) {
+ // do nothing by default
+ }
+ public void endVisit(JavadocQualifiedTypeReference typeRef, BlockScope scope) {
+ // do nothing by default
+ }
+ public void endVisit(JavadocReturnStatement statement, BlockScope scope) {
+ // do nothing by default
+ }
+ public void endVisit(JavadocSingleNameReference argument, BlockScope scope) {
+ // do nothing by default
+ }
+ public void endVisit(JavadocSingleTypeReference typeRef, BlockScope scope) {
+ // do nothing by default
+ }
public void endVisit(LabeledStatement labeledStatement, BlockScope scope) {
// do nothing by default
}
@@ -201,6 +236,51 @@ public abstract class ASTVisitor {
public void endVisit(LongLiteral longLiteral, BlockScope scope) {
// do nothing by default
}
+ /**
+ * @param annotation
+ * @param scope
+ * @since 3.1
+ */
+ public void endVisit(MarkerAnnotation annotation, BlockScope scope) {
+ // do nothing by default
+ }
+ /**
+ * @param annotation
+ * @param scope
+ * @since 3.1
+ */
+ public void endVisit(MarkerAnnotation annotation, ClassScope scope) {
+ // do nothing by default
+ }
+ /**
+ * @param annotation
+ * @param scope
+ * @since 3.1
+ */
+ public void endVisit(MarkerAnnotation annotation, CompilationUnitScope scope) {
+ // do nothing by default
+ }
+ /**
+ * @param pair
+ * @param scope
+ */
+ public void endVisit(MemberValuePair pair, BlockScope scope) {
+ // do nothing by default
+ }
+ /**
+ * @param pair
+ * @param scope
+ */
+ public void endVisit(MemberValuePair pair, ClassScope scope) {
+ // do nothing by default
+ }
+ /**
+ * @param pair
+ * @param scope
+ */
+ public void endVisit(MemberValuePair pair, CompilationUnitScope scope) {
+ // do nothing by default
+ }
public void endVisit(MessageSend messageSend, BlockScope scope) {
// do nothing by default
}
@@ -210,12 +290,48 @@ public abstract class ASTVisitor {
public void endVisit(StringLiteralConcatenation literal, BlockScope scope) {
// do nothing by default
}
+ /**
+ * @param annotation
+ * @param scope
+ * @since 3.1
+ */
+ public void endVisit(NormalAnnotation annotation, BlockScope scope) {
+ // do nothing by default
+ }
+ /**
+ * @param annotation
+ * @param scope
+ * @since 3.1
+ */
+ public void endVisit(NormalAnnotation annotation, ClassScope scope) {
+ // do nothing by default
+ }
+ /**
+ * @param annotation
+ * @param scope
+ * @since 3.1
+ */
+ public void endVisit(NormalAnnotation annotation, CompilationUnitScope scope) {
+ // do nothing by default
+ }
public void endVisit(NullLiteral nullLiteral, BlockScope scope) {
// do nothing by default
}
public void endVisit(OR_OR_Expression or_or_Expression, BlockScope scope) {
// do nothing by default
}
+ public void endVisit(ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference, BlockScope scope) {
+ // do nothing by default
+ }
+ public void endVisit(ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference, ClassScope scope) {
+ // do nothing by default
+ }
+ public void endVisit(ParameterizedSingleTypeReference parameterizedSingleTypeReference, BlockScope scope) {
+ // do nothing by default
+ }
+ public void endVisit(ParameterizedSingleTypeReference parameterizedSingleTypeReference, ClassScope scope) {
+ // do nothing by default
+ }
public void endVisit(PostfixExpression postfixExpression, BlockScope scope) {
// do nothing by default
}
@@ -255,6 +371,30 @@ public abstract class ASTVisitor {
public void endVisit(ReturnStatement returnStatement, BlockScope scope) {
// do nothing by default
}
+ /**
+ * @param annotation
+ * @param scope
+ * @since 3.1
+ */
+ public void endVisit(SingleMemberAnnotation annotation, BlockScope scope) {
+ // do nothing by default
+ }
+ /**
+ * @param annotation
+ * @param scope
+ * @since 3.1
+ */
+ public void endVisit(SingleMemberAnnotation annotation, ClassScope scope) {
+ // do nothing by default
+ }
+ /**
+ * @param annotation
+ * @param scope
+ * @since 3.1
+ */
+ public void endVisit(SingleMemberAnnotation annotation, CompilationUnitScope scope) {
+ // do nothing by default
+ }
public void endVisit(
SingleNameReference singleNameReference,
BlockScope scope) {
@@ -311,48 +451,52 @@ public abstract class ASTVisitor {
CompilationUnitScope scope) {
// do nothing by default
}
+ public void endVisit(TypeParameter typeParameter, BlockScope scope) {
+ // do nothing by default
+ }
+ public void endVisit(TypeParameter typeParameter, ClassScope scope) {
+ // do nothing by default
+ }
public void endVisit(UnaryExpression unaryExpression, BlockScope scope) {
// do nothing by default
}
public void endVisit(WhileStatement whileStatement, BlockScope scope) {
// do nothing by default
}
+ public void endVisit(Wildcard wildcard, BlockScope scope) {
+ // do nothing by default
+ }
+ public void endVisit(Wildcard wildcard, ClassScope scope) {
+ // do nothing by default
+ }
public boolean visit(
AllocationExpression allocationExpression,
BlockScope scope) {
return true; // do nothing by default, keep traversing
- // do nothing by default
}
public boolean visit(AND_AND_Expression and_and_Expression, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(JavadocArrayQualifiedTypeReference typeRef, BlockScope scope) {
- return true; // do nothing by default, keep traversing
- }
- public boolean visit(JavadocArraySingleTypeReference typeRef, BlockScope scope) {
- return true; // do nothing by default, keep traversing
- }
- public boolean visit(JavadocArgumentExpression expression, BlockScope scope) {
- return true; // do nothing by default, keep traversing
- }
- public boolean visit(JavadocFieldReference fieldRef, BlockScope scope) {
- return true; // do nothing by default, keep traversing
- }
- public boolean visit(JavadocMessageSend messageSend, BlockScope scope) {
- return true; // do nothing by default, keep traversing
- }
- public boolean visit(JavadocQualifiedTypeReference typeRef, BlockScope scope) {
+ public boolean visit(
+ AnnotationTypeDeclaration annotationTypeDeclaration,
+ BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(JavadocReturnStatement statement, BlockScope scope) {
+ public boolean visit(
+ AnnotationTypeDeclaration annotationTypeDeclaration,
+ ClassScope scope) {
return true; // do nothing by default, keep traversing
- }
- public boolean visit(JavadocSingleNameReference argument, BlockScope scope) {
+ }
+ public boolean visit(
+ AnnotationTypeDeclaration annotationTypeDeclaration,
+ CompilationUnitScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(JavadocSingleTypeReference typeRef, BlockScope scope) {
+ public boolean visit(
+ AnnotationTypeMemberDeclaration annotationTypeDeclaration,
+ ClassScope classScope) {
return true; // do nothing by default, keep traversing
- }
+ }
public boolean visit(Argument argument, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
@@ -383,10 +527,10 @@ public abstract class ASTVisitor {
public boolean visit(ArrayTypeReference arrayTypeReference, ClassScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(Assignment assignment, BlockScope scope) {
+ public boolean visit(AssertStatement assertStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(AssertStatement assertStatement, BlockScope scope) {
+ public boolean visit(Assignment assignment, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
public boolean visit(BinaryExpression binaryExpression, BlockScope scope) {
@@ -440,10 +584,22 @@ public abstract class ASTVisitor {
public boolean visit(DoubleLiteral doubleLiteral, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(EqualExpression equalExpression, BlockScope scope) {
+ public boolean visit(EmptyStatement emptyStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
- public boolean visit(EmptyStatement emptyStatement, BlockScope scope) {
+ public boolean visit(EnumConstant enumConstant, ClassScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
+ public boolean visit(EnumDeclaration enumDeclaration, BlockScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
+ public boolean visit(EnumDeclaration enumDeclaration, ClassScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
+ public boolean visit(EnumDeclaration enumDeclaration, CompilationUnitScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
+ public boolean visit(EqualExpression equalExpression, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
public boolean visit(
@@ -468,6 +624,9 @@ public abstract class ASTVisitor {
public boolean visit(FloatLiteral floatLiteral, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+ public boolean visit(ForeachStatement forStatement, BlockScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
public boolean visit(ForStatement forStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
@@ -488,6 +647,33 @@ public abstract class ASTVisitor {
public boolean visit(IntLiteral intLiteral, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+ public boolean visit(JavadocArgumentExpression expression, BlockScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
+ public boolean visit(JavadocArrayQualifiedTypeReference typeRef, BlockScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
+ public boolean visit(JavadocArraySingleTypeReference typeRef, BlockScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
+ public boolean visit(JavadocFieldReference fieldRef, BlockScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
+ public boolean visit(JavadocMessageSend messageSend, BlockScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
+ public boolean visit(JavadocQualifiedTypeReference typeRef, BlockScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
+ public boolean visit(JavadocReturnStatement statement, BlockScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
+ public boolean visit(JavadocSingleNameReference argument, BlockScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
+ public boolean visit(JavadocSingleTypeReference typeRef, BlockScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
public boolean visit(LabeledStatement labeledStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
@@ -497,6 +683,54 @@ public abstract class ASTVisitor {
public boolean visit(LongLiteral longLiteral, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+ /**
+ * @param annotation
+ * @param scope
+ * @since 3.1
+ */
+ public boolean visit(MarkerAnnotation annotation, BlockScope scope) {
+ return true;
+ }
+ /**
+ * @param annotation
+ * @param scope
+ * @since 3.1
+ */
+ public boolean visit(MarkerAnnotation annotation, ClassScope scope) {
+ return true;
+ }
+ /**
+ * @param annotation
+ * @param scope
+ * @since 3.1
+ */
+ public boolean visit(MarkerAnnotation annotation, CompilationUnitScope scope) {
+ return true;
+ }
+ /**
+ * @param pair
+ * @param scope
+ * @since 3.1
+ */
+ public boolean visit(MemberValuePair pair, BlockScope scope) {
+ return true;
+ }
+ /**
+ * @param pair
+ * @param scope
+ * @since 3.1
+ */
+ public boolean visit(MemberValuePair pair, ClassScope scope) {
+ return true;
+ }
+ /**
+ * @param pair
+ * @param scope
+ * @since 3.1
+ */
+ public boolean visit(MemberValuePair pair, CompilationUnitScope scope) {
+ return true;
+ }
public boolean visit(MessageSend messageSend, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
@@ -508,12 +742,48 @@ public abstract class ASTVisitor {
BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+ /**
+ * @param annotation
+ * @param scope
+ * @since 3.1
+ */
+ public boolean visit(NormalAnnotation annotation, BlockScope scope) {
+ return true;
+ }
+ /**
+ * @param annotation
+ * @param scope
+ * @since 3.1
+ */
+ public boolean visit(NormalAnnotation annotation, ClassScope scope) {
+ return true;
+ }
+ /**
+ * @param annotation
+ * @param scope
+ * @since 3.1
+ */
+ public boolean visit(NormalAnnotation annotation, CompilationUnitScope scope) {
+ return true;
+ }
public boolean visit(NullLiteral nullLiteral, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
public boolean visit(OR_OR_Expression or_or_Expression, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+ public boolean visit(ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference, BlockScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
+ public boolean visit(ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference, ClassScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
+ public boolean visit(ParameterizedSingleTypeReference parameterizedSingleTypeReference, BlockScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
+ public boolean visit(ParameterizedSingleTypeReference parameterizedSingleTypeReference, ClassScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
public boolean visit(PostfixExpression postfixExpression, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
@@ -553,6 +823,30 @@ public abstract class ASTVisitor {
public boolean visit(ReturnStatement returnStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+ /**
+ * @param annotation
+ * @param scope
+ * @since 3.1
+ */
+ public boolean visit(SingleMemberAnnotation annotation, BlockScope scope) {
+ return true;
+ }
+ /**
+ * @param annotation
+ * @param scope
+ * @since 3.1
+ */
+ public boolean visit(SingleMemberAnnotation annotation, ClassScope scope) {
+ return true;
+ }
+ /**
+ * @param annotation
+ * @param scope
+ * @since 3.1
+ */
+ public boolean visit(SingleMemberAnnotation annotation, CompilationUnitScope scope) {
+ return true;
+ }
public boolean visit(
SingleNameReference singleNameReference,
BlockScope scope) {
@@ -609,10 +903,22 @@ public abstract class ASTVisitor {
CompilationUnitScope scope) {
return true; // do nothing by default, keep traversing
}
+ public boolean visit(TypeParameter typeParameter, BlockScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
+ public boolean visit(TypeParameter typeParameter, ClassScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
public boolean visit(UnaryExpression unaryExpression, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
public boolean visit(WhileStatement whileStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
+ public boolean visit(Wildcard wildcard, BlockScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
+ public boolean visit(Wildcard wildcard, ClassScope scope) {
+ return true; // do nothing by default, keep traversing
+ }
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java
index e575af546b..8dc7822d84 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java
@@ -91,7 +91,7 @@ public class ClassFile
ClassFile enclosingClassFile,
boolean creatingProblemType) {
- referenceBinding = aType;
+ this.referenceBinding = aType;
initByteArrays();
// generate the magic numbers inside the header
@@ -100,7 +100,8 @@ public class ClassFile
header[headerOffset++] = (byte) (0xCAFEBABEL >> 8);
header[headerOffset++] = (byte) (0xCAFEBABEL >> 0);
- this.targetJDK = referenceBinding.scope.environment().options.targetJDK;
+ final CompilerOptions options = aType.scope.environment().options;
+ this.targetJDK = options.targetJDK;
header[headerOffset++] = (byte) (this.targetJDK >> 8); // minor high
header[headerOffset++] = (byte) (this.targetJDK >> 0); // minor low
header[headerOffset++] = (byte) (this.targetJDK >> 24); // major high
@@ -160,10 +161,10 @@ public class ClassFile
contents[contentsOffset++] = (byte) (interfaceIndex >> 8);
contents[contentsOffset++] = (byte) interfaceIndex;
}
- produceDebugAttributes = referenceBinding.scope.environment().options.produceDebugAttributes;
+ produceDebugAttributes = options.produceDebugAttributes;
innerClassesBindings = new ReferenceBinding[INNER_CLASSES_SIZE];
this.creatingProblemType = creatingProblemType;
- codeStream = new CodeStream(this);
+ codeStream = new CodeStream(this, options.sourceLevel);
// retrieve the enclosing one guaranteed to be the one matching the propagated flow info
// 1FF9ZBU: LFCOM:ALL - Local variable attributes busted (Sanity check)
@@ -321,6 +322,30 @@ public class ClassFile
}
attributeNumber++;
}
+ // add signature attribute
+ char[] genericSignature = referenceBinding.genericSignature();
+ if (genericSignature != null) {
+ // check that there is enough space to write all the bytes for the field info corresponding
+ // to the @fieldBinding
+ if (contentsOffset + 8 >= contents.length) {
+ resizeContents(8);
+ }
+ int signatureAttributeNameIndex =
+ constantPool.literalIndex(AttributeNamesConstants.SignatureName);
+ contents[contentsOffset++] = (byte) (signatureAttributeNameIndex >> 8);
+ contents[contentsOffset++] = (byte) signatureAttributeNameIndex;
+ // the length of a signature attribute is equals to 2
+ contents[contentsOffset++] = 0;
+ contents[contentsOffset++] = 0;
+ contents[contentsOffset++] = 0;
+ contents[contentsOffset++] = 2;
+ int signatureIndex =
+ constantPool.literalIndex(genericSignature);
+ contents[contentsOffset++] = (byte) (signatureIndex >> 8);
+ contents[contentsOffset++] = (byte) signatureIndex;
+ attributeNumber++;
+ }
+
// update the number of attributes
if (attributeOffset + 2 >= this.contents.length) {
resizeContents(2);
@@ -364,10 +389,13 @@ public class ClassFile
if (contentsOffset + 30 >= contents.length) {
resizeContents(30);
}
- // Generate two attribute: constantValueAttribute and SyntheticAttribute
// Now we can generate all entries into the byte array
// First the accessFlags
int accessFlags = fieldBinding.getAccessFlags();
+ if (targetJDK < ClassFileConstants.JDK1_5) {
+ // pre 1.5, synthetic was an attribute, not a modifier
+ accessFlags &= ~AccSynthetic;
+ }
contents[contentsOffset++] = (byte) (accessFlags >> 8);
contents[contentsOffset++] = (byte) accessFlags;
// Then the nameIndex
@@ -382,7 +410,11 @@ public class ClassFile
int fieldAttributeOffset = contentsOffset;
contentsOffset += 2;
// 4.7.2 only static constant fields get a ConstantAttribute
+ // Generate the constantValueAttribute
if (fieldBinding.constant != Constant.NotAConstant){
+ if (contentsOffset + 8 >= contents.length) {
+ resizeContents(8);
+ }
// Now we generate the constant attribute corresponding to the fieldBinding
int constantValueNameIndex =
constantPool.literalIndex(AttributeNamesConstants.ConstantValueName);
@@ -457,7 +489,10 @@ public class ClassFile
}
}
}
- if (fieldBinding.isSynthetic()) {
+ if (this.targetJDK < ClassFileConstants.JDK1_5 && fieldBinding.isSynthetic()) {
+ if (contentsOffset + 6 >= contents.length) {
+ resizeContents(6);
+ }
int syntheticAttributeNameIndex =
constantPool.literalIndex(AttributeNamesConstants.SyntheticName);
contents[contentsOffset++] = (byte) (syntheticAttributeNameIndex >> 8);
@@ -470,6 +505,9 @@ public class ClassFile
attributeNumber++;
}
if (fieldBinding.isDeprecated()) {
+ if (contentsOffset + 6 >= contents.length) {
+ resizeContents(6);
+ }
int deprecatedAttributeNameIndex =
constantPool.literalIndex(AttributeNamesConstants.DeprecatedName);
contents[contentsOffset++] = (byte) (deprecatedAttributeNameIndex >> 8);
@@ -481,6 +519,29 @@ public class ClassFile
contents[contentsOffset++] = 0;
attributeNumber++;
}
+ // add signature attribute
+ char[] genericSignature = fieldBinding.genericSignature();
+ if (genericSignature != null) {
+ // check that there is enough space to write all the bytes for the field info corresponding
+ // to the @fieldBinding
+ if (contentsOffset + 8 >= contents.length) {
+ resizeContents(8);
+ }
+ int signatureAttributeNameIndex =
+ constantPool.literalIndex(AttributeNamesConstants.SignatureName);
+ contents[contentsOffset++] = (byte) (signatureAttributeNameIndex >> 8);
+ contents[contentsOffset++] = (byte) signatureAttributeNameIndex;
+ // the length of a signature attribute is equals to 2
+ contents[contentsOffset++] = 0;
+ contents[contentsOffset++] = 0;
+ contents[contentsOffset++] = 0;
+ contents[contentsOffset++] = 2;
+ int signatureIndex =
+ constantPool.literalIndex(genericSignature);
+ contents[contentsOffset++] = (byte) (signatureIndex >> 8);
+ contents[contentsOffset++] = (byte) signatureIndex;
+ attributeNumber++;
+ }
contents[fieldAttributeOffset++] = (byte) (attributeNumber >> 8);
contents[fieldAttributeOffset] = (byte) attributeNumber;
}
@@ -773,12 +834,13 @@ public class ClassFile
* - default abstract methods
*/
public void addSpecialMethods() {
+
// add all methods (default abstract methods and synthetic)
// default abstract methods
- SourceTypeBinding currentBinding = referenceBinding;
- MethodBinding[] defaultAbstractMethods =
- currentBinding.getDefaultAbstractMethods();
+ generateMissingAbstractMethods(referenceBinding.scope.referenceType().missingAbstractMethods, referenceBinding.scope.referenceCompilationUnit().compilationResult);
+
+ MethodBinding[] defaultAbstractMethods = this.referenceBinding.getDefaultAbstractMethods();
for (int i = 0, max = defaultAbstractMethods.length; i < max; i++) {
generateMethodInfoHeader(defaultAbstractMethods[i]);
int methodAttributeOffset = contentsOffset;
@@ -786,8 +848,7 @@ public class ClassFile
completeMethodInfo(methodAttributeOffset, attributeNumber);
}
// add synthetic methods infos
- SyntheticAccessMethodBinding[] syntheticAccessMethods =
- currentBinding.syntheticAccessMethods();
+ SyntheticAccessMethodBinding[] syntheticAccessMethods = this.referenceBinding.syntheticAccessMethods();
if (syntheticAccessMethods != null) {
for (int i = 0, max = syntheticAccessMethods.length; i < max; i++) {
SyntheticAccessMethodBinding accessMethodBinding = syntheticAccessMethods[i];
@@ -795,21 +856,23 @@ public class ClassFile
case SyntheticAccessMethodBinding.FieldReadAccess :
// generate a method info to emulate an reading access to
// a non-accessible field
- addSyntheticFieldReadAccessMethod(syntheticAccessMethods[i]);
+ addSyntheticFieldReadAccessMethod(accessMethodBinding);
break;
case SyntheticAccessMethodBinding.FieldWriteAccess :
// generate a method info to emulate an writing access to
// a non-accessible field
- addSyntheticFieldWriteAccessMethod(syntheticAccessMethods[i]);
+ addSyntheticFieldWriteAccessMethod(accessMethodBinding);
break;
case SyntheticAccessMethodBinding.MethodAccess :
case SyntheticAccessMethodBinding.SuperMethodAccess :
- // generate a method info to emulate an access to a non-accessible method / super-method
- addSyntheticMethodAccessMethod(syntheticAccessMethods[i]);
+ case SyntheticAccessMethodBinding.BridgeMethodAccess :
+ // generate a method info to emulate an access to a non-accessible method / super-method or bridge method
+ addSyntheticMethodAccessMethod(accessMethodBinding);
break;
case SyntheticAccessMethodBinding.ConstructorAccess :
// generate a method info to emulate an access to a non-accessible constructor
- addSyntheticConstructorAccessMethod(syntheticAccessMethods[i]);
+ addSyntheticConstructorAccessMethod(accessMethodBinding);
+ break;
}
}
}
@@ -1300,8 +1363,14 @@ public class ClassFile
int numberOfEntries = 0;
int localVariableNameIndex =
constantPool.literalIndex(AttributeNamesConstants.LocalVariableTableName);
- if (localContentsOffset + 8 >= this.contents.length) {
- resizeContents(8);
+ final boolean methodDeclarationIsStatic = codeStream.methodDeclaration.isStatic();
+ int maxOfEntries = 8 + 10 * (methodDeclarationIsStatic ? 0 : 1);
+ for (int i = 0; i < codeStream.allLocalsCounter; i++) {
+ maxOfEntries += 10 * codeStream.locals[i].initializationCount;
+ }
+ // reserve enough space
+ if (localContentsOffset + maxOfEntries >= this.contents.length) {
+ resizeContents(maxOfEntries);
}
this.contents[localContentsOffset++] = (byte) (localVariableNameIndex >> 8);
this.contents[localContentsOffset++] = (byte) localVariableNameIndex;
@@ -1309,11 +1378,9 @@ public class ClassFile
// leave space for attribute_length and local_variable_table_length
int nameIndex;
int descriptorIndex;
- if (!codeStream.methodDeclaration.isStatic()) {
+ SourceTypeBinding declaringClassBinding = null;
+ if (!methodDeclarationIsStatic) {
numberOfEntries++;
- if (localContentsOffset + 10 >= this.contents.length) {
- resizeContents(10);
- }
this.contents[localContentsOffset++] = 0; // the startPC for this is always 0
this.contents[localContentsOffset++] = 0;
this.contents[localContentsOffset++] = (byte) (code_length >> 8);
@@ -1321,16 +1388,31 @@ public class ClassFile
nameIndex = constantPool.literalIndex(QualifiedNamesConstants.This);
this.contents[localContentsOffset++] = (byte) (nameIndex >> 8);
this.contents[localContentsOffset++] = (byte) nameIndex;
+ declaringClassBinding = (SourceTypeBinding) codeStream.methodDeclaration.binding.declaringClass;
descriptorIndex =
constantPool.literalIndex(
- codeStream.methodDeclaration.binding.declaringClass.signature());
+ declaringClassBinding.signature());
this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8);
this.contents[localContentsOffset++] = (byte) descriptorIndex;
this.contents[localContentsOffset++] = 0;// the resolved position for this is always 0
this.contents[localContentsOffset++] = 0;
}
- for (int i = 0; i < codeStream.allLocalsCounter; i++) {
+ // used to remember the local variable with a generic type
+ int genericLocalVariablesCounter = 0;
+ LocalVariableBinding[] genericLocalVariables = null;
+ int numberOfGenericEntries = 0;
+
+ for (int i = 0, max = codeStream.allLocalsCounter; i < max; i++) {
LocalVariableBinding localVariable = codeStream.locals[i];
+ final TypeBinding localVariableTypeBinding = localVariable.type;
+ boolean isParameterizedType = localVariableTypeBinding.isParameterizedType() || localVariableTypeBinding.isTypeVariable();
+ if (localVariable.initializationCount != 0 && isParameterizedType) {
+ if (genericLocalVariables == null) {
+ // we cannot have more than max locals
+ genericLocalVariables = new LocalVariableBinding[max];
+ }
+ genericLocalVariables[genericLocalVariablesCounter++] = localVariable;
+ }
for (int j = 0; j < localVariable.initializationCount; j++) {
int startPC = localVariable.initializationPCs[j << 1];
int endPC = localVariable.initializationPCs[(j << 1) + 1];
@@ -1340,8 +1422,8 @@ public class ClassFile
Util.bind("abort.invalidAttribute" , new String(localVariable.name)), //$NON-NLS-1$
(ASTNode) localVariable.declaringScope.methodScope().referenceContext);
}
- if (localContentsOffset + 10 >= this.contents.length) {
- resizeContents(10);
+ if (isParameterizedType) {
+ numberOfGenericEntries++;
}
// now we can safely add the local entry
numberOfEntries++;
@@ -1353,7 +1435,7 @@ public class ClassFile
nameIndex = constantPool.literalIndex(localVariable.name);
this.contents[localContentsOffset++] = (byte) (nameIndex >> 8);
this.contents[localContentsOffset++] = (byte) nameIndex;
- descriptorIndex = constantPool.literalIndex(localVariable.type.signature());
+ descriptorIndex = constantPool.literalIndex(localVariableTypeBinding.signature());
this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8);
this.contents[localContentsOffset++] = (byte) descriptorIndex;
int resolvedPosition = localVariable.resolvedPosition;
@@ -1371,6 +1453,72 @@ public class ClassFile
this.contents[localVariableTableOffset++] = (byte) (numberOfEntries >> 8);
this.contents[localVariableTableOffset] = (byte) numberOfEntries;
attributeNumber++;
+
+ final boolean currentInstanceIsGeneric =
+ !methodDeclarationIsStatic
+ && declaringClassBinding != null
+ && declaringClassBinding.typeVariables != NoTypeVariables;
+ if (genericLocalVariablesCounter != 0 || currentInstanceIsGeneric) {
+ // add the local variable type table attribute
+ numberOfGenericEntries += (currentInstanceIsGeneric ? 1 : 0);
+ maxOfEntries = 8 + numberOfGenericEntries * 10;
+ // reserve enough space
+ if (localContentsOffset + maxOfEntries >= this.contents.length) {
+ resizeContents(maxOfEntries);
+ }
+ int localVariableTypeNameIndex =
+ constantPool.literalIndex(AttributeNamesConstants.LocalVariableTypeTableName);
+ this.contents[localContentsOffset++] = (byte) (localVariableTypeNameIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) localVariableTypeNameIndex;
+ value = numberOfGenericEntries * 10 + 2;
+ this.contents[localContentsOffset++] = (byte) (value >> 24);
+ this.contents[localContentsOffset++] = (byte) (value >> 16);
+ this.contents[localContentsOffset++] = (byte) (value >> 8);
+ this.contents[localContentsOffset++] = (byte) value;
+ this.contents[localContentsOffset++] = (byte) (numberOfGenericEntries >> 8);
+ this.contents[localContentsOffset++] = (byte) numberOfGenericEntries;
+ if (currentInstanceIsGeneric) {
+ this.contents[localContentsOffset++] = 0; // the startPC for this is always 0
+ this.contents[localContentsOffset++] = 0;
+ this.contents[localContentsOffset++] = (byte) (code_length >> 8);
+ this.contents[localContentsOffset++] = (byte) code_length;
+ nameIndex = constantPool.literalIndex(QualifiedNamesConstants.This);
+ this.contents[localContentsOffset++] = (byte) (nameIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) nameIndex;
+ descriptorIndex = constantPool.literalIndex(declaringClassBinding.genericTypeSignature());
+ this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) descriptorIndex;
+ this.contents[localContentsOffset++] = 0;// the resolved position for this is always 0
+ this.contents[localContentsOffset++] = 0;
+ }
+
+ for (int i = 0; i < genericLocalVariablesCounter; i++) {
+ LocalVariableBinding localVariable = genericLocalVariables[i];
+ for (int j = 0; j < localVariable.initializationCount; j++) {
+ int startPC = localVariable.initializationPCs[j << 1];
+ int endPC = localVariable.initializationPCs[(j << 1) + 1];
+ if (startPC != endPC) {
+ // only entries for non zero length
+ // now we can safely add the local entry
+ this.contents[localContentsOffset++] = (byte) (startPC >> 8);
+ this.contents[localContentsOffset++] = (byte) startPC;
+ int length = endPC - startPC;
+ this.contents[localContentsOffset++] = (byte) (length >> 8);
+ this.contents[localContentsOffset++] = (byte) length;
+ nameIndex = constantPool.literalIndex(localVariable.name);
+ this.contents[localContentsOffset++] = (byte) (nameIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) nameIndex;
+ descriptorIndex = constantPool.literalIndex(localVariable.type.genericTypeSignature());
+ this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) descriptorIndex;
+ int resolvedPosition = localVariable.resolvedPosition;
+ this.contents[localContentsOffset++] = (byte) (resolvedPosition >> 8);
+ this.contents[localContentsOffset++] = (byte) resolvedPosition;
+ }
+ }
+ }
+ attributeNumber++;
+ }
}
// update the number of attributes
// ensure first that there is enough space available inside the localContents array
@@ -1534,11 +1682,27 @@ public class ClassFile
this.contents[localContentsOffset++] = (byte) (localVariableNameIndex >> 8);
this.contents[localContentsOffset++] = (byte) localVariableNameIndex;
localContentsOffset += 6;
+
// leave space for attribute_length and local_variable_table_length
int nameIndex;
int descriptorIndex;
- for (int i = 0; i < codeStream.allLocalsCounter; i++) {
+
+ // used to remember the local variable with a generic type
+ int genericLocalVariablesCounter = 0;
+ LocalVariableBinding[] genericLocalVariables = null;
+ int numberOfGenericEntries = 0;
+
+ for (int i = 0, max = codeStream.allLocalsCounter; i < max; i++) {
LocalVariableBinding localVariable = codeStream.locals[i];
+ final TypeBinding localVariableTypeBinding = localVariable.type;
+ boolean isParameterizedType = localVariableTypeBinding.isParameterizedType() || localVariableTypeBinding.isTypeVariable();
+ if (localVariable.initializationCount != 0 && isParameterizedType) {
+ if (genericLocalVariables == null) {
+ // we cannot have more than max locals
+ genericLocalVariables = new LocalVariableBinding[max];
+ }
+ genericLocalVariables[genericLocalVariablesCounter++] = localVariable;
+ }
for (int j = 0; j < localVariable.initializationCount; j++) {
int startPC = localVariable.initializationPCs[j << 1];
int endPC = localVariable.initializationPCs[(j << 1) + 1];
@@ -1553,6 +1717,9 @@ public class ClassFile
}
// now we can safely add the local entry
numberOfEntries++;
+ if (isParameterizedType) {
+ numberOfGenericEntries++;
+ }
this.contents[localContentsOffset++] = (byte) (startPC >> 8);
this.contents[localContentsOffset++] = (byte) startPC;
int length = endPC - startPC;
@@ -1561,7 +1728,7 @@ public class ClassFile
nameIndex = constantPool.literalIndex(localVariable.name);
this.contents[localContentsOffset++] = (byte) (nameIndex >> 8);
this.contents[localContentsOffset++] = (byte) nameIndex;
- descriptorIndex = constantPool.literalIndex(localVariable.type.signature());
+ descriptorIndex = constantPool.literalIndex(localVariableTypeBinding.signature());
this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8);
this.contents[localContentsOffset++] = (byte) descriptorIndex;
int resolvedPosition = localVariable.resolvedPosition;
@@ -1579,6 +1746,52 @@ public class ClassFile
this.contents[localVariableTableOffset++] = (byte) (numberOfEntries >> 8);
this.contents[localVariableTableOffset] = (byte) numberOfEntries;
attributeNumber++;
+
+ if (genericLocalVariablesCounter != 0) {
+ // add the local variable type table attribute
+ // reserve enough space
+ int maxOfEntries = 8 + numberOfGenericEntries * 10;
+
+ if (localContentsOffset + maxOfEntries >= this.contents.length) {
+ resizeContents(maxOfEntries);
+ }
+ int localVariableTypeNameIndex =
+ constantPool.literalIndex(AttributeNamesConstants.LocalVariableTypeTableName);
+ this.contents[localContentsOffset++] = (byte) (localVariableTypeNameIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) localVariableTypeNameIndex;
+ value = numberOfGenericEntries * 10 + 2;
+ this.contents[localContentsOffset++] = (byte) (value >> 24);
+ this.contents[localContentsOffset++] = (byte) (value >> 16);
+ this.contents[localContentsOffset++] = (byte) (value >> 8);
+ this.contents[localContentsOffset++] = (byte) value;
+ this.contents[localContentsOffset++] = (byte) (numberOfGenericEntries >> 8);
+ this.contents[localContentsOffset++] = (byte) numberOfGenericEntries;
+ for (int i = 0; i < genericLocalVariablesCounter; i++) {
+ LocalVariableBinding localVariable = genericLocalVariables[i];
+ for (int j = 0; j < localVariable.initializationCount; j++) {
+ int startPC = localVariable.initializationPCs[j << 1];
+ int endPC = localVariable.initializationPCs[(j << 1) + 1];
+ if (startPC != endPC) { // only entries for non zero length
+ // now we can safely add the local entry
+ this.contents[localContentsOffset++] = (byte) (startPC >> 8);
+ this.contents[localContentsOffset++] = (byte) startPC;
+ int length = endPC - startPC;
+ this.contents[localContentsOffset++] = (byte) (length >> 8);
+ this.contents[localContentsOffset++] = (byte) length;
+ nameIndex = constantPool.literalIndex(localVariable.name);
+ this.contents[localContentsOffset++] = (byte) (nameIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) nameIndex;
+ descriptorIndex = constantPool.literalIndex(localVariable.type.genericTypeSignature());
+ this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) descriptorIndex;
+ int resolvedPosition = localVariable.resolvedPosition;
+ this.contents[localContentsOffset++] = (byte) (resolvedPosition >> 8);
+ this.contents[localContentsOffset++] = (byte) resolvedPosition;
+ }
+ }
+ }
+ attributeNumber++;
+ }
}
}
// update the number of attributes
@@ -1803,7 +2016,10 @@ public class ClassFile
localContentsOffset += 6;
// leave space for attribute_length and local_variable_table_length
int descriptorIndex;
- if (!codeStream.methodDeclaration.isStatic()) {
+ int nameIndex;
+ SourceTypeBinding declaringClassBinding = null;
+ final boolean methodDeclarationIsStatic = codeStream.methodDeclaration.isStatic();
+ if (!methodDeclarationIsStatic) {
numberOfEntries++;
if (localContentsOffset + 10 >= this.contents.length) {
resizeContents(10);
@@ -1812,28 +2028,41 @@ public class ClassFile
this.contents[localContentsOffset++] = 0;
this.contents[localContentsOffset++] = (byte) (code_length >> 8);
this.contents[localContentsOffset++] = (byte) code_length;
- int nameIndex = constantPool.literalIndex(QualifiedNamesConstants.This);
+ nameIndex = constantPool.literalIndex(QualifiedNamesConstants.This);
this.contents[localContentsOffset++] = (byte) (nameIndex >> 8);
this.contents[localContentsOffset++] = (byte) nameIndex;
+ declaringClassBinding = (SourceTypeBinding) codeStream.methodDeclaration.binding.declaringClass;
descriptorIndex =
- constantPool.literalIndex(
- codeStream.methodDeclaration.binding.declaringClass.signature());
+ constantPool.literalIndex(declaringClassBinding.signature());
this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8);
this.contents[localContentsOffset++] = (byte) descriptorIndex;
// the resolved position for this is always 0
this.contents[localContentsOffset++] = 0;
this.contents[localContentsOffset++] = 0;
}
+ // used to remember the local variable with a generic type
+ int genericLocalVariablesCounter = 0;
+ LocalVariableBinding[] genericLocalVariables = null;
+ int numberOfGenericEntries = 0;
+
if (binding.isConstructor()) {
ReferenceBinding declaringClass = binding.declaringClass;
if (declaringClass.isNestedType()) {
NestedTypeBinding methodDeclaringClass = (NestedTypeBinding) declaringClass;
argSize = methodDeclaringClass.enclosingInstancesSlotSize;
SyntheticArgumentBinding[] syntheticArguments;
- if ((syntheticArguments = methodDeclaringClass.syntheticEnclosingInstances())
- != null) {
+ if ((syntheticArguments = methodDeclaringClass.syntheticEnclosingInstances()) != null) {
for (int i = 0, max = syntheticArguments.length; i < max; i++) {
LocalVariableBinding localVariable = syntheticArguments[i];
+ final TypeBinding localVariableTypeBinding = localVariable.type;
+ if (localVariableTypeBinding.isParameterizedType() || localVariableTypeBinding.isTypeVariable()) {
+ if (genericLocalVariables == null) {
+ // we cannot have more than max locals
+ genericLocalVariables = new LocalVariableBinding[max];
+ }
+ genericLocalVariables[genericLocalVariablesCounter++] = localVariable;
+ numberOfGenericEntries++;
+ }
if (localContentsOffset + 10 >= this.contents.length) {
resizeContents(10);
}
@@ -1843,10 +2072,10 @@ public class ClassFile
this.contents[localContentsOffset++] = 0;
this.contents[localContentsOffset++] = (byte) (code_length >> 8);
this.contents[localContentsOffset++] = (byte) code_length;
- int nameIndex = constantPool.literalIndex(localVariable.name);
+ nameIndex = constantPool.literalIndex(localVariable.name);
this.contents[localContentsOffset++] = (byte) (nameIndex >> 8);
this.contents[localContentsOffset++] = (byte) nameIndex;
- descriptorIndex = constantPool.literalIndex(localVariable.type.signature());
+ descriptorIndex = constantPool.literalIndex(localVariableTypeBinding.signature());
this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8);
this.contents[localContentsOffset++] = (byte) descriptorIndex;
int resolvedPosition = localVariable.resolvedPosition;
@@ -1860,6 +2089,12 @@ public class ClassFile
} else {
argSize = binding.isStatic() ? 0 : 1;
}
+
+ int genericArgumentsCounter = 0;
+ int[] genericArgumentsNameIndexes = null;
+ int[] genericArgumentsResolvedPositions = null;
+ TypeBinding[] genericArgumentsTypeBindings = null;
+
if (method.binding != null) {
TypeBinding[] parameters = method.binding.parameters;
Argument[] arguments = method.arguments;
@@ -1875,13 +2110,24 @@ public class ClassFile
this.contents[localContentsOffset++] = 0;
this.contents[localContentsOffset++] = (byte) (code_length >> 8);
this.contents[localContentsOffset++] = (byte) code_length;
- int nameIndex = constantPool.literalIndex(arguments[i].name);
+ nameIndex = constantPool.literalIndex(arguments[i].name);
this.contents[localContentsOffset++] = (byte) (nameIndex >> 8);
this.contents[localContentsOffset++] = (byte) nameIndex;
+ int resolvedPosition = argSize;
+ if (argumentBinding.isParameterizedType() || argumentBinding.isTypeVariable()) {
+ if (genericArgumentsCounter == 0) {
+ // we cannot have more than max locals
+ genericArgumentsNameIndexes = new int[max];
+ genericArgumentsResolvedPositions = new int[max];
+ genericArgumentsTypeBindings = new TypeBinding[max];
+ }
+ genericArgumentsNameIndexes[genericArgumentsCounter] = nameIndex;
+ genericArgumentsResolvedPositions[genericArgumentsCounter] = resolvedPosition;
+ genericArgumentsTypeBindings[genericArgumentsCounter++] = argumentBinding;
+ }
descriptorIndex = constantPool.literalIndex(argumentBinding.signature());
this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8);
this.contents[localContentsOffset++] = (byte) descriptorIndex;
- int resolvedPosition = argSize;
if ((argumentBinding == BaseTypes.LongBinding)
|| (argumentBinding == BaseTypes.DoubleBinding))
argSize += 2;
@@ -1901,6 +2147,79 @@ public class ClassFile
this.contents[localVariableTableOffset++] = (byte) (numberOfEntries >> 8);
this.contents[localVariableTableOffset] = (byte) numberOfEntries;
attributeNumber++;
+
+ final boolean currentInstanceIsGeneric =
+ !methodDeclarationIsStatic
+ && declaringClassBinding != null
+ && declaringClassBinding.typeVariables != NoTypeVariables;
+ if (genericLocalVariablesCounter != 0 || genericArgumentsCounter != 0 || currentInstanceIsGeneric) {
+ // add the local variable type table attribute
+ numberOfEntries = numberOfGenericEntries + genericArgumentsCounter + (currentInstanceIsGeneric ? 1 : 0);
+ // reserve enough space
+ int maxOfEntries = 8 + numberOfEntries * 10;
+ if (localContentsOffset + maxOfEntries >= this.contents.length) {
+ resizeContents(maxOfEntries);
+ }
+ int localVariableTypeNameIndex =
+ constantPool.literalIndex(AttributeNamesConstants.LocalVariableTypeTableName);
+ this.contents[localContentsOffset++] = (byte) (localVariableTypeNameIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) localVariableTypeNameIndex;
+ value = numberOfEntries * 10 + 2;
+ this.contents[localContentsOffset++] = (byte) (value >> 24);
+ this.contents[localContentsOffset++] = (byte) (value >> 16);
+ this.contents[localContentsOffset++] = (byte) (value >> 8);
+ this.contents[localContentsOffset++] = (byte) value;
+ this.contents[localContentsOffset++] = (byte) (numberOfEntries >> 8);
+ this.contents[localContentsOffset++] = (byte) numberOfEntries;
+ if (currentInstanceIsGeneric) {
+ numberOfEntries++;
+ this.contents[localContentsOffset++] = 0; // the startPC for this is always 0
+ this.contents[localContentsOffset++] = 0;
+ this.contents[localContentsOffset++] = (byte) (code_length >> 8);
+ this.contents[localContentsOffset++] = (byte) code_length;
+ nameIndex = constantPool.literalIndex(QualifiedNamesConstants.This);
+ this.contents[localContentsOffset++] = (byte) (nameIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) nameIndex;
+ descriptorIndex = constantPool.literalIndex(declaringClassBinding.genericTypeSignature());
+ this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) descriptorIndex;
+ this.contents[localContentsOffset++] = 0;// the resolved position for this is always 0
+ this.contents[localContentsOffset++] = 0;
+ }
+
+ for (int i = 0; i < genericLocalVariablesCounter; i++) {
+ LocalVariableBinding localVariable = genericLocalVariables[i];
+ this.contents[localContentsOffset++] = 0;
+ this.contents[localContentsOffset++] = 0;
+ this.contents[localContentsOffset++] = (byte) (code_length >> 8);
+ this.contents[localContentsOffset++] = (byte) code_length;
+ nameIndex = constantPool.literalIndex(localVariable.name);
+ this.contents[localContentsOffset++] = (byte) (nameIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) nameIndex;
+ descriptorIndex = constantPool.literalIndex(localVariable.type.genericTypeSignature());
+ this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) descriptorIndex;
+ int resolvedPosition = localVariable.resolvedPosition;
+ this.contents[localContentsOffset++] = (byte) (resolvedPosition >> 8);
+ this.contents[localContentsOffset++] = (byte) resolvedPosition;
+ }
+ for (int i = 0; i < genericArgumentsCounter; i++) {
+ this.contents[localContentsOffset++] = 0;
+ this.contents[localContentsOffset++] = 0;
+ this.contents[localContentsOffset++] = (byte) (code_length >> 8);
+ this.contents[localContentsOffset++] = (byte) code_length;
+ nameIndex = genericArgumentsNameIndexes[i];
+ this.contents[localContentsOffset++] = (byte) (nameIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) nameIndex;
+ descriptorIndex = constantPool.literalIndex(genericArgumentsTypeBindings[i].genericTypeSignature());
+ this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8);
+ this.contents[localContentsOffset++] = (byte) descriptorIndex;
+ int resolvedPosition = genericArgumentsResolvedPositions[i];
+ this.contents[localContentsOffset++] = (byte) (resolvedPosition >> 8);
+ this.contents[localContentsOffset++] = (byte) resolvedPosition;
+ }
+ attributeNumber++;
+ }
}
// update the number of attributes// ensure first that there is enough space available inside the localContents array
if (codeAttributeAttributeOffset + 2 >= this.contents.length) {
@@ -2005,8 +2324,23 @@ public class ClassFile
// leave space for attribute_length and local_variable_table_length
int nameIndex;
int descriptorIndex;
- for (int i = 0; i < codeStream.allLocalsCounter; i++) {
+
+ // used to remember the local variable with a generic type
+ int genericLocalVariablesCounter = 0;
+ LocalVariableBinding[] genericLocalVariables = null;
+ int numberOfGenericEntries = 0;
+
+ for (int i = 0, max = codeStream.allLocalsCounter; i < max; i++) {
LocalVariableBinding localVariable = codeStream.locals[i];
+ final TypeBinding localVariableTypeBinding = localVariable.type;
+ boolean isParameterizedType = localVariableTypeBinding.isParameterizedType() || localVariableTypeBinding.isTypeVariable();
+ if (localVariable.initializationCount != 0 && isParameterizedType) {
+ if (genericLocalVariables == null) {
+ // we cannot have more than max locals
+ genericLocalVariables = new LocalVariableBinding[max];
+ }
+ genericLocalVariables[genericLocalVariablesCounter++] = localVariable;
+ }
for (int j = 0; j < localVariable.initializationCount; j++) {
int startPC = localVariable.initializationPCs[j << 1];
int endPC = localVariable.initializationPCs[(j << 1) + 1];
@@ -2021,6 +2355,9 @@ public class ClassFile
}
// now we can safely add the local entry
numberOfEntries++;
+ if (isParameterizedType) {
+ numberOfGenericEntries++;
+ }
contents[localContentsOffset++] = (byte) (startPC >> 8);
contents[localContentsOffset++] = (byte) startPC;
int length = endPC - startPC;
@@ -2029,7 +2366,7 @@ public class ClassFile
nameIndex = constantPool.literalIndex(localVariable.name);
contents[localContentsOffset++] = (byte) (nameIndex >> 8);
contents[localContentsOffset++] = (byte) nameIndex;
- descriptorIndex = constantPool.literalIndex(localVariable.type.signature());
+ descriptorIndex = constantPool.literalIndex(localVariableTypeBinding.signature());
contents[localContentsOffset++] = (byte) (descriptorIndex >> 8);
contents[localContentsOffset++] = (byte) descriptorIndex;
int resolvedPosition = localVariable.resolvedPosition;
@@ -2047,6 +2384,52 @@ public class ClassFile
contents[localVariableTableOffset++] = (byte) (numberOfEntries >> 8);
contents[localVariableTableOffset] = (byte) numberOfEntries;
attributeNumber++;
+
+ if (genericLocalVariablesCounter != 0) {
+ // add the local variable type table attribute
+ int maxOfEntries = 8 + numberOfGenericEntries * 10;
+ // reserve enough space
+ if (localContentsOffset + maxOfEntries >= this.contents.length) {
+ resizeContents(maxOfEntries);
+ }
+ int localVariableTypeNameIndex =
+ constantPool.literalIndex(AttributeNamesConstants.LocalVariableTypeTableName);
+ contents[localContentsOffset++] = (byte) (localVariableTypeNameIndex >> 8);
+ contents[localContentsOffset++] = (byte) localVariableTypeNameIndex;
+ value = numberOfGenericEntries * 10 + 2;
+ contents[localContentsOffset++] = (byte) (value >> 24);
+ contents[localContentsOffset++] = (byte) (value >> 16);
+ contents[localContentsOffset++] = (byte) (value >> 8);
+ contents[localContentsOffset++] = (byte) value;
+ contents[localContentsOffset++] = (byte) (numberOfGenericEntries >> 8);
+ contents[localContentsOffset++] = (byte) numberOfGenericEntries;
+
+ for (int i = 0; i < genericLocalVariablesCounter; i++) {
+ LocalVariableBinding localVariable = genericLocalVariables[i];
+ for (int j = 0; j < localVariable.initializationCount; j++) {
+ int startPC = localVariable.initializationPCs[j << 1];
+ int endPC = localVariable.initializationPCs[(j << 1) + 1];
+ if (startPC != endPC) { // only entries for non zero length
+ // now we can safely add the local entry
+ contents[localContentsOffset++] = (byte) (startPC >> 8);
+ contents[localContentsOffset++] = (byte) startPC;
+ int length = endPC - startPC;
+ contents[localContentsOffset++] = (byte) (length >> 8);
+ contents[localContentsOffset++] = (byte) length;
+ nameIndex = constantPool.literalIndex(localVariable.name);
+ contents[localContentsOffset++] = (byte) (nameIndex >> 8);
+ contents[localContentsOffset++] = (byte) nameIndex;
+ descriptorIndex = constantPool.literalIndex(localVariable.type.genericTypeSignature());
+ contents[localContentsOffset++] = (byte) (descriptorIndex >> 8);
+ contents[localContentsOffset++] = (byte) descriptorIndex;
+ int resolvedPosition = localVariable.resolvedPosition;
+ contents[localContentsOffset++] = (byte) (resolvedPosition >> 8);
+ contents[localContentsOffset++] = (byte) resolvedPosition;
+ }
+ }
+ }
+ attributeNumber++;
+ }
}
// update the number of attributes
// ensure first that there is enough space available inside the contents array
@@ -2300,6 +2683,29 @@ public class ClassFile
attributeNumber++;
}
+ // add signature attribute
+ char[] genericSignature = methodBinding.genericSignature();
+ if (genericSignature != null) {
+ // check that there is enough space to write all the bytes for the field info corresponding
+ // to the @fieldBinding
+ if (contentsOffset + 8 >= this.contents.length) {
+ resizeContents(8);
+ }
+ int signatureAttributeNameIndex =
+ constantPool.literalIndex(AttributeNamesConstants.SignatureName);
+ contents[contentsOffset++] = (byte) (signatureAttributeNameIndex >> 8);
+ contents[contentsOffset++] = (byte) signatureAttributeNameIndex;
+ // the length of a signature attribute is equals to 2
+ contents[contentsOffset++] = 0;
+ contents[contentsOffset++] = 0;
+ contents[contentsOffset++] = 0;
+ contents[contentsOffset++] = 2;
+ int signatureIndex =
+ constantPool.literalIndex(genericSignature);
+ contents[contentsOffset++] = (byte) (signatureIndex >> 8);
+ contents[contentsOffset++] = (byte) signatureIndex;
+ attributeNumber++;
+ }
return attributeNumber;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/CompilationResult.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/CompilationResult.java
index 684df0be88..d6b7475c9d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/CompilationResult.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/CompilationResult.java
@@ -35,6 +35,7 @@ import org.eclipse.jdt.core.compiler.*;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.eclipse.jdt.internal.compiler.env.*;
import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
+import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
import java.util.*;
@@ -56,6 +57,7 @@ public class CompilationResult {
public int unitIndex, totalUnitsKnown;
public boolean hasBeenAccepted = false;
public char[] fileName;
+ public boolean hasInconsistentToplevelHierarchies = false; // record the fact some toplevel types have inconsistent hierarchies
public CompilationResult(
char[] fileName,
@@ -358,6 +360,10 @@ public class CompilationResult {
*/
public void record(char[] typeName, ClassFile classFile) {
+ SourceTypeBinding sourceType = classFile.referenceBinding;
+ if (!sourceType.isLocalType() && sourceType.isHierarchyInconsistent()) {
+ this.hasInconsistentToplevelHierarchies = true;
+ }
compiledTypes.put(typeName, classFile);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
index 74ba90b968..c4d169dc1d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
@@ -26,7 +26,7 @@ public abstract class ASTNode implements BaseTypes, CompilerModifiers, TypeConst
public final static int Bit2 = 0x2; // return type (operator) | name reference kind (name ref) | has local type (type, method, field decl)
public final static int Bit3 = 0x4; // return type (operator) | name reference kind (name ref) | implicit this (this ref)
public final static int Bit4 = 0x8; // return type (operator) | first assignment to local (local decl) | undocumented empty block (block, type and method decl)
- public final static int Bit5 = 0x10; // value for return (expression) | has all method bodies (unit)
+ public final static int Bit5 = 0x10; // value for return (expression) | has all method bodies (unit) | supertype ref (type ref)
public final static int Bit6 = 0x20; // depth (name ref, msg) | only value required (binary expression) | ignore need cast check (cast expression)
public final static int Bit7 = 0x40; // depth (name ref, msg) | operator (operator) | need runtime checkcast (cast expression)
public final static int Bit8 = 0x80; // depth (name ref, msg) | operator (operator)
@@ -136,7 +136,31 @@ public abstract class ASTNode implements BaseTypes, CompilerModifiers, TypeConst
super();
}
-
+ public static void checkInvocationArguments(BlockScope scope, Expression receiver, TypeBinding receiverType, MethodBinding method, Expression[] arguments, TypeBinding[] argumentTypes, boolean argsContainCast, InvocationSite invocationSite) {
+ boolean warnRawArgs = false, wildcardInvocation = false;
+ for (int i = 0; i < arguments.length; i++) {
+ TypeBinding parameterType = method.parameters[i];
+ TypeBinding argumentType = argumentTypes[i];
+ arguments[i].computeConversion(scope, parameterType, argumentType);
+ if (parameterType.isWildcard() && argumentType != NullBinding) {
+ wildcardInvocation = true;
+ } else if (argumentType != parameterType
+ && argumentType.isRawType()
+ && (parameterType.isParameterizedType() || parameterType.isGenericType())) {
+ warnRawArgs = true;
+ }
+ }
+ if (argsContainCast) {
+ CastExpression.checkNeedForArgumentCasts(scope, receiver, receiverType, method, arguments, argumentTypes, invocationSite);
+ }
+ if (wildcardInvocation) {
+ scope.problemReporter().unsafeWildcardInvocation((ASTNode)invocationSite, receiverType, method, argumentTypes);
+ } else if (receiverType.isRawType() && method.hasSubstitutedParameters()) {
+ scope.problemReporter().unsafeRawInvocation((ASTNode)invocationSite, receiverType, method);
+ } else if (warnRawArgs) {
+ scope.problemReporter().unsafeInvocationWithRawArguments((ASTNode)invocationSite, receiverType, method, argumentTypes);
+ }
+ }
public ASTNode concreteStatement() {
return this;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
index c25253eae8..b6d5bf5992 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
@@ -32,6 +32,7 @@ public abstract class AbstractMethodDeclaration
public int declarationSourceEnd;
public int modifiers;
public int modifiersSourceStart;
+ public Annotation[] annotations;
public Argument[] arguments;
public TypeReference[] thrownExceptions;
public Statement[] statements;
@@ -305,6 +306,19 @@ public abstract class AbstractMethodDeclaration
printIndent(tab, output);
printModifiers(this.modifiers, output);
+
+ TypeParameter[] typeParams = typeParameters();
+ if (typeParams != null) {
+ output.append('<');//$NON-NLS-1$
+ int max = typeParams.length - 1;
+ for (int j = 0; j < max; j++) {
+ typeParams[j].print(0, output);
+ output.append(", ");//$NON-NLS-1$
+ }
+ typeParams[max].print(0, output);
+ output.append('>');
+ }
+
printReturnType(0, output).append(this.selector).append('(');
if (this.arguments != null) {
for (int i = 0; i < this.arguments.length; i++) {
@@ -395,4 +409,8 @@ public abstract class AbstractMethodDeclaration
ClassScope classScope) {
// default implementation: subclass will define it
}
+
+ public TypeParameter[] typeParameters() {
+ return null;
+ }
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java
index cce62fce4e..e9fd9446ed 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java
@@ -15,6 +15,7 @@ import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
import org.eclipse.jdt.internal.compiler.lookup.InvocationSite;
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
+import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
public abstract class AbstractVariableDeclaration extends Statement implements InvocationSite {
public int declarationEnd;
@@ -24,6 +25,7 @@ public abstract class AbstractVariableDeclaration extends Statement implements I
public Expression initialization;
public int modifiers;
public int modifiersSourceStart;
+ public Annotation[] annotations;
public char[] name;
@@ -32,6 +34,14 @@ public abstract class AbstractVariableDeclaration extends Statement implements I
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
return flowInfo;
}
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#genericTypeArguments()
+ */
+ public TypeBinding[] genericTypeArguments() {
+ return null;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#isSuperAccess()
*/
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
index 2a47d4d2a0..72127a36fd 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
@@ -15,16 +15,16 @@ import org.eclipse.jdt.internal.compiler.codegen.*;
import org.eclipse.jdt.internal.compiler.flow.*;
import org.eclipse.jdt.internal.compiler.lookup.*;
-public class AllocationExpression
- extends Expression
- implements InvocationSite {
+public class AllocationExpression extends Expression implements InvocationSite {
public TypeReference type;
public Expression[] arguments;
- public MethodBinding binding;
-
- MethodBinding syntheticAccessor;
-
+ public MethodBinding binding; // exact binding resulting from lookup
+ protected MethodBinding codegenBinding; // actual binding used for code generation (if no synthetic accessor)
+ MethodBinding syntheticAccessor; // synthetic accessor for inner-emulation
+ public TypeReference[] typeArguments;
+ public TypeBinding[] genericTypeArguments;
+
public FlowInfo analyseCode(
BlockScope currentScope,
FlowContext flowContext,
@@ -88,7 +88,7 @@ public class AllocationExpression
boolean valueRequired) {
int pc = codeStream.position;
- ReferenceBinding allocatedType = binding.declaringClass;
+ ReferenceBinding allocatedType = this.codegenBinding.declaringClass;
codeStream.new_(allocatedType);
if (valueRequired) {
@@ -120,11 +120,11 @@ public class AllocationExpression
}
// invoke constructor
if (syntheticAccessor == null) {
- codeStream.invokespecial(binding);
+ codeStream.invokespecial(this.codegenBinding);
} else {
// synthetic accessor got some extra arguments appended to its signature, which need values
for (int i = 0,
- max = syntheticAccessor.parameters.length - binding.parameters.length;
+ max = syntheticAccessor.parameters.length - this.codegenBinding.parameters.length;
i < max;
i++) {
codeStream.aconst_null();
@@ -133,7 +133,13 @@ public class AllocationExpression
}
codeStream.recordPositionsFrom(pc, this.sourceStart);
}
-
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#genericTypeArguments()
+ */
+ public TypeBinding[] genericTypeArguments() {
+ return this.genericTypeArguments;
+ }
+
public boolean isSuperAccess() {
return false;
@@ -174,19 +180,20 @@ public class AllocationExpression
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
if (!flowInfo.isReachable()) return;
+
+ // if constructor from parameterized type got found, use the original constructor at codegen time
+ this.codegenBinding = this.binding.original();
+
if (binding.isPrivate()
&& (currentScope.enclosingSourceType() != binding.declaringClass)) {
- if (currentScope
- .environment()
- .options
- .isPrivateConstructorAccessChangingVisibility) {
- binding.tagForClearingPrivateModifier();
+ if (currentScope.environment().options.isPrivateConstructorAccessChangingVisibility) {
+ this.codegenBinding.tagForClearingPrivateModifier();
// constructor will not be dumped as private, no emulation required thus
} else {
syntheticAccessor =
- ((SourceTypeBinding) binding.declaringClass).addSyntheticMethod(binding, isSuperAccess());
- currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
+ ((SourceTypeBinding) binding.declaringClass).addSyntheticMethod(this.codegenBinding, isSuperAccess());
+ currentScope.problemReporter().needToEmulateMethodAccess(this.codegenBinding, this);
}
}
}
@@ -194,6 +201,16 @@ public class AllocationExpression
public StringBuffer printExpression(int indent, StringBuffer output) {
output.append("new "); //$NON-NLS-1$
+ if (typeArguments != null) {
+ output.append('<');//$NON-NLS-1$
+ int max = typeArguments.length - 1;
+ for (int j = 0; j < max; j++) {
+ typeArguments[j].print(0, output);
+ output.append(", ");//$NON-NLS-1$
+ }
+ typeArguments[max].print(0, output);
+ output.append('>');
+ }
type.printExpression(0, output);
output.append('(');
if (arguments != null) {
@@ -212,6 +229,21 @@ public class AllocationExpression
this.resolvedType = type.resolveType(scope);
// will check for null after args are resolved
+ // resolve type arguments (for generic constructor call)
+ if (this.typeArguments != null) {
+ int length = this.typeArguments.length;
+ boolean argHasError = false; // typeChecks all arguments
+ this.genericTypeArguments = new TypeBinding[length];
+ for (int i = 0; i < length; i++) {
+ if ((this.genericTypeArguments[i] = this.typeArguments[i].resolveType(scope)) == null) {
+ argHasError = true;
+ }
+ }
+ if (argHasError) {
+ return null;
+ }
+ }
+
// buffering the arguments' types
boolean argsContainCast = false;
TypeBinding[] argumentTypes = NoParameters;
@@ -240,9 +272,12 @@ public class AllocationExpression
scope.problemReporter().cannotInstantiate(type, this.resolvedType);
return this.resolvedType;
}
+ if ((this.resolvedType.tagBits & TagBits.HasWildcard) != 0) {
+ scope.problemReporter().cannotInstantiateWithWildcards(type, (ParameterizedTypeBinding)this.resolvedType);
+ return this.resolvedType;
+ }
ReferenceBinding allocationType = (ReferenceBinding) this.resolvedType;
- if (!(binding = scope.getConstructor(allocationType, argumentTypes, this))
- .isValidBinding()) {
+ if (!(binding = scope.getConstructor(allocationType, argumentTypes, this)).isValidBinding()) {
if (binding.declaringClass == null)
binding.declaringClass = allocationType;
scope.problemReporter().invalidConstructor(this, binding);
@@ -250,15 +285,8 @@ public class AllocationExpression
}
if (isMethodUseDeprecated(binding, scope))
scope.problemReporter().deprecatedMethod(binding, this);
-
- if (arguments != null) {
- for (int i = 0; i < arguments.length; i++) {
- arguments[i].implicitWidening(binding.parameters[i], argumentTypes[i]);
- }
- if (argsContainCast) {
- CastExpression.checkNeedForArgumentCasts(scope, null, allocationType, binding, this.arguments, argumentTypes, this);
- }
- }
+ if (this.arguments != null)
+ checkInvocationArguments(scope, null, allocationType, this.binding, this.arguments, argumentTypes, argsContainCast, this);
return allocationType;
}
@@ -277,12 +305,15 @@ public class AllocationExpression
public void traverse(ASTVisitor visitor, BlockScope scope) {
if (visitor.visit(this, scope)) {
- int argumentsLength;
- type.traverse(visitor, scope);
- if (arguments != null) {
- argumentsLength = arguments.length;
- for (int i = 0; i < argumentsLength; i++)
- arguments[i].traverse(visitor, scope);
+ if (this.typeArguments != null) {
+ for (int i = 0, typeArgumentsLength = this.typeArguments.length; i < typeArgumentsLength; i++) {
+ this.typeArguments[i].traverse(visitor, scope);
+ }
+ }
+ this.type.traverse(visitor, scope);
+ if (this.arguments != null) {
+ for (int i = 0, argumentsLength = this.arguments.length; i < argumentsLength; i++)
+ this.arguments[i].traverse(visitor, scope);
}
}
visitor.endVisit(this, scope);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java
new file mode 100644
index 0000000000..192ea9a2f3
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * 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.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;
+
+/**
+ * Annotation
+ */
+public abstract class Annotation extends Expression {
+
+ public char[][] tokens;
+ public long[] sourcePositions;
+ public int declarationSourceEnd;
+
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+ output.append('@');
+ for (int i = 0; i < tokens.length; i++) {
+ if (i > 0) output.append('.');
+ output.append(tokens[i]);
+ }
+ return output;
+ }
+ public abstract void traverse(ASTVisitor visitor, BlockScope scope);
+ public abstract void traverse(ASTVisitor visitor, ClassScope scope);
+ public abstract void traverse(ASTVisitor visitor, CompilationUnitScope scope);
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationTypeDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationTypeDeclaration.java
new file mode 100644
index 0000000000..634da8b2af
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationTypeDeclaration.java
@@ -0,0 +1,283 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * Annotation type declaration
+ */
+public class AnnotationTypeDeclaration extends TypeDeclaration {
+
+ public AnnotationTypeMemberDeclaration[] annotationTypeMemberDeclarations;
+
+ /**
+ * @param compilationResult
+ */
+ public AnnotationTypeDeclaration(CompilationResult compilationResult) {
+ super(compilationResult);
+ }
+
+ public StringBuffer printHeader(int indent, StringBuffer output) {
+
+ printModifiers(this.modifiers, output);
+ output.append("@interface "); //$NON-NLS-1$ //$NON-NLS-2$
+ output.append(name);
+ if (typeParameters != null) {
+ output.append("<");//$NON-NLS-1$
+ for (int i = 0; i < typeParameters.length; i++) {
+ if (i > 0) output.append( ", "); //$NON-NLS-1$
+ typeParameters[i].print(0, output);
+ }
+ output.append(">");//$NON-NLS-1$
+ }
+ if (superclass != null) {
+ output.append(" extends "); //$NON-NLS-1$
+ superclass.print(0, output);
+ }
+ if (superInterfaces != null && superInterfaces.length > 0) {
+ output.append(isInterface() ? " extends " : " implements ");//$NON-NLS-2$ //$NON-NLS-1$
+ for (int i = 0; i < superInterfaces.length; i++) {
+ if (i > 0) output.append( ", "); //$NON-NLS-1$
+ superInterfaces[i].print(0, output);
+ }
+ }
+ return output;
+ }
+
+ public StringBuffer printBody(int indent, StringBuffer output) {
+
+ output.append(" {"); //$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 (this.annotationTypeMemberDeclarations != null) {
+ for (int i = 0; i < this.annotationTypeMemberDeclarations.length; i++) {
+ if (this.annotationTypeMemberDeclarations[i] != null) {
+ output.append('\n');
+ this.annotationTypeMemberDeclarations[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 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.annotationTypeMemberDeclarations != null) {
+ int length = this.annotationTypeMemberDeclarations.length;
+ for (int i = 0; i < length; i++) {
+ this.annotationTypeMemberDeclarations[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, unitScope);
+ } 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.annotationTypeMemberDeclarations != null) {
+ int length = this.annotationTypeMemberDeclarations.length;
+ for (int i = 0; i < length; i++) {
+ this.annotationTypeMemberDeclarations[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.annotationTypeMemberDeclarations != null) {
+ int length = this.annotationTypeMemberDeclarations.length;
+ for (int i = 0; i < length; i++) {
+ this.annotationTypeMemberDeclarations[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
+ }
+ }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationTypeMemberDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationTypeMemberDeclaration.java
new file mode 100644
index 0000000000..26a7502c97
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationTypeMemberDeclaration.java
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * 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.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.compiler.ASTVisitor;
+import org.eclipse.jdt.internal.compiler.CompilationResult;
+import org.eclipse.jdt.internal.compiler.flow.ExceptionHandlingFlowContext;
+import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
+import org.eclipse.jdt.internal.compiler.flow.InitializationFlowContext;
+import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
+import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
+import org.eclipse.jdt.internal.compiler.parser.Parser;
+import org.eclipse.jdt.internal.compiler.problem.AbortMethod;
+
+public class AnnotationTypeMemberDeclaration extends AbstractMethodDeclaration {
+
+ public TypeReference returnType;
+ public Expression memberValue;
+ public int extendedDimensions;
+
+ /**
+ * MethodDeclaration constructor comment.
+ */
+ public AnnotationTypeMemberDeclaration(CompilationResult compilationResult) {
+ super(compilationResult);
+ }
+
+ public void analyseCode(
+ ClassScope classScope,
+ InitializationFlowContext initializationContext,
+ FlowInfo flowInfo) {
+
+ // starting of the code analysis for methods
+ if (ignoreFurtherInvestigation) {
+ return;
+ }
+ if (this.extendedDimensions != 0) {
+ scope.problemReporter().illegalExtendedDimensions(this);
+ }
+ try {
+ if (binding == null) {
+ return;
+ }
+
+ if (this.binding.isPrivate() && !this.binding.isPrivateUsed()) {
+ if (!classScope.referenceCompilationUnit().compilationResult.hasSyntaxError()) {
+ scope.problemReporter().unusedPrivateMethod(this);
+ }
+ }
+
+ // may be in a non necessary <clinit> for innerclass with static final constant fields
+ if (binding.isAbstract() || binding.isNative())
+ return;
+
+ ExceptionHandlingFlowContext methodContext =
+ new ExceptionHandlingFlowContext(
+ initializationContext,
+ this,
+ binding.thrownExceptions,
+ scope,
+ FlowInfo.DEAD_END);
+
+ // propagate to statements
+ if (statements != null) {
+ boolean didAlreadyComplain = false;
+ for (int i = 0, count = statements.length; i < count; i++) {
+ Statement stat = statements[i];
+ if (!stat.complainIfUnreachable(flowInfo, scope, didAlreadyComplain)) {
+ flowInfo = stat.analyseCode(scope, methodContext, flowInfo);
+ } else {
+ didAlreadyComplain = true;
+ }
+ }
+ }
+ // check for missing returning path
+ TypeBinding returnTypeBinding = binding.returnType;
+ if ((returnTypeBinding == VoidBinding) || isAbstract()) {
+ this.needFreeReturn = flowInfo.isReachable();
+ } else {
+ if (flowInfo != FlowInfo.DEAD_END) {
+ scope.problemReporter().shouldReturn(returnTypeBinding, this);
+ }
+ }
+ // check unreachable catch blocks
+ methodContext.complainIfUnusedExceptionHandlers(this);
+ } catch (AbortMethod e) {
+ this.ignoreFurtherInvestigation = true;
+ }
+ }
+
+
+ public void parseStatements(Parser parser, CompilationUnitDeclaration unit) {
+ // nothing to do
+ // annotation type member declaration don't have any body
+ }
+
+ public StringBuffer printReturnType(int indent, StringBuffer output) {
+
+ if (returnType == null) return output;
+ return returnType.printExpression(0, output).append(' ');
+ }
+
+ public void resolve(ClassScope upperScope) {
+ if (this.binding == null) {
+ this.ignoreFurtherInvestigation = true;
+ }
+
+ try {
+ resolveStatements();
+ resolveJavadoc();
+ } catch (AbortMethod e) { // ========= abort on fatal error =============
+ this.ignoreFurtherInvestigation = true;
+ }
+ }
+
+ public void resolveStatements() {
+
+ // ========= abort on fatal error =============
+ if (this.returnType != null && this.binding != null) {
+ this.returnType.resolvedType = this.binding.returnType;
+ // record the return type binding
+ }
+ // check if method with constructor name
+ if (CharOperation.equals(scope.enclosingSourceType().sourceName, selector)) {
+ scope.problemReporter().annotationTypeMemberDeclarationWithConstructorName(this);
+ }
+ super.resolveStatements();
+ }
+
+ public void traverse(
+ ASTVisitor visitor,
+ ClassScope classScope) {
+
+ 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 (returnType != null)
+ returnType.traverse(visitor, scope);
+ if (arguments != null) {
+ int argumentLength = arguments.length;
+ for (int i = 0; i < argumentLength; i++)
+ arguments[i].traverse(visitor, scope);
+ }
+ if (thrownExceptions != null) {
+ int thrownExceptionsLength = thrownExceptions.length;
+ for (int i = 0; i < thrownExceptionsLength; i++)
+ thrownExceptions[i].traverse(visitor, scope);
+ }
+ if (statements != null) {
+ int statementsLength = statements.length;
+ for (int i = 0; i < statementsLength; i++)
+ statements[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, classScope);
+ }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java
index b6669acca5..ff1e0717f1 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java
@@ -18,20 +18,22 @@ public class Argument extends LocalDeclaration {
// prefix for setter method (to recognize special hiding argument)
private final static char[] SET = "set".toCharArray(); //$NON-NLS-1$
-
- public Argument(char[] name, long posNom, TypeReference tr, int modifiers) {
+ public boolean isVarArgs;
+
+ public Argument(char[] name, long posNom, TypeReference tr, int modifiers, boolean isVarArgs) {
super(name, (int) (posNom >>> 32), (int) posNom);
this.declarationSourceEnd = (int) posNom;
this.modifiers = modifiers;
type = tr;
this.bits |= IsLocalDeclarationReachableMASK;
+ this.isVarArgs = isVarArgs;
}
public void bind(MethodScope scope, TypeBinding typeBinding, boolean used) {
if (this.type != null)
- this.type.resolvedType = typeBinding;
+ this.type.resolvedType = typeBinding; // TODO (philippe) no longer necessary as when binding got resolved, it was recorded already (SourceTypeBinding#resolveTypesFor(MethodBinding))
// record the resolved type into the type reference
int modifierFlag = this.modifiers;
@@ -59,8 +61,6 @@ public class Argument extends LocalDeclaration {
this.binding =
new LocalVariableBinding(this, typeBinding, modifierFlag, true));
//true stand for argument instead of just local
- if (typeBinding != null && isTypeUseDeprecated(typeBinding, scope))
- scope.problemReporter().deprecatedType(typeBinding, this.type);
this.binding.declaration = this;
this.binding.useFlag = used ? LocalVariableBinding.USED : LocalVariableBinding.UNUSED;
}
@@ -88,10 +88,18 @@ public class Argument extends LocalDeclaration {
// provide the scope with a side effect : insertion of a LOCAL
// that represents the argument. The type must be from JavaThrowable
- TypeBinding tb = type.resolveTypeExpecting(scope, scope.getJavaLangThrowable());
- if (tb == null)
+ TypeBinding exceptionType = this.type.resolveType(scope);
+ if (exceptionType == null) return null;
+ if (exceptionType.isGenericType() || exceptionType.isParameterizedType()) {
+ scope.problemReporter().invalidParameterizedExceptionType(exceptionType, this);
return null;
-
+ }
+ TypeBinding throwable = scope.getJavaLangThrowable();
+ if (!exceptionType.isCompatibleWith(throwable)) {
+ scope.problemReporter().typeMismatchError(exceptionType, throwable, this);
+ return null;
+ }
+
Binding existingVariable = scope.getBinding(name, BindingIds.VARIABLE, this, false /*do not resolve hidden field*/);
if (existingVariable != null && existingVariable.isValidBinding()){
if (existingVariable instanceof LocalVariableBinding && this.hiddenVariableDepth == 0) {
@@ -101,10 +109,10 @@ public class Argument extends LocalDeclaration {
scope.problemReporter().localVariableHiding(this, existingVariable, false);
}
- binding = new LocalVariableBinding(this, tb, modifiers, false); // argument decl, but local var (where isArgument = false)
+ binding = new LocalVariableBinding(this, exceptionType, modifiers, false); // argument decl, but local var (where isArgument = false)
scope.addLocalVariable(binding);
binding.constant = NotAConstant;
- return tb;
+ return exceptionType;
}
public void traverse(ASTVisitor visitor, BlockScope scope) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java
index d9ab28db74..8c2b92155d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java
@@ -148,7 +148,7 @@ public class ArrayAllocationExpression extends Expression {
if (dimensions[i] != null) {
TypeBinding dimensionType = dimensions[i].resolveTypeExpecting(scope, IntBinding);
if (dimensionType != null) {
- dimensions[i].implicitWidening(IntBinding, dimensionType);
+ dimensions[i].computeConversion(scope, IntBinding, dimensionType);
}
}
}
@@ -158,7 +158,10 @@ public class ArrayAllocationExpression extends Expression {
if (dimensions.length > 255) {
scope.problemReporter().tooManyDimensions(this);
}
- this.resolvedType = scope.createArray(referenceType, dimensions.length);
+ if (referenceType.isParameterizedType()) {
+ scope.problemReporter().illegalArrayOfParameterizedType(referenceType, this);
+ }
+ this.resolvedType = scope.createArrayType(referenceType, dimensions.length);
// check the initializer
if (initializer != null) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java
index b7170475ad..24cf0bb91a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java
@@ -138,7 +138,7 @@ public class ArrayInitializer extends Expression {
binding = (ArrayBinding) expectedTb;
if (expressions == null)
return binding;
- TypeBinding expectedElementsTb = binding.elementsType(scope);
+ TypeBinding expectedElementsTb = binding.elementsType();
if (expectedElementsTb.isBaseType()) {
for (int i = 0, length = expressions.length; i < length; i++) {
Expression expression = expressions[i];
@@ -151,11 +151,11 @@ public class ArrayInitializer extends Expression {
// Compile-time conversion required?
if (expression.isConstantValueOfTypeAssignableToType(expressionTb, expectedElementsTb)) {
- expression.implicitWidening(expectedElementsTb, expressionTb);
+ expression.computeConversion(scope, expectedElementsTb, expressionTb);
} else if (BaseTypeBinding.isWidening(expectedElementsTb.id, expressionTb.id)) {
- expression.implicitWidening(expectedElementsTb, expressionTb);
+ expression.computeConversion(scope, expectedElementsTb, expressionTb);
} else {
- scope.problemReporter().typeMismatchErrorActualTypeExpectedType(expression, expressionTb, expectedElementsTb);
+ scope.problemReporter().typeMismatchError(expressionTb, expectedElementsTb, expression);
return null;
}
}
@@ -189,8 +189,8 @@ public class ArrayInitializer extends Expression {
}
}
if (leafElementType != null) {
- TypeBinding probableTb = scope.createArray(leafElementType, dim);
- scope.problemReporter().typeMismatchErrorActualTypeExpectedType(this, probableTb, expectedTb);
+ TypeBinding probableTb = scope.createArrayType(leafElementType, dim);
+ scope.problemReporter().typeMismatchError(probableTb, expectedTb, this);
}
return null;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java
index 701f3a6b4a..5c0a645ebd 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java
@@ -10,8 +10,10 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
+import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
import org.eclipse.jdt.internal.compiler.lookup.*;
+import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
public class ArrayQualifiedTypeReference extends QualifiedTypeReference {
int dimensions;
@@ -22,25 +24,46 @@ public class ArrayQualifiedTypeReference extends QualifiedTypeReference {
dimensions = dim ;
}
- public ArrayQualifiedTypeReference(char[][] sources , TypeBinding tb, int dim, long[] poss) {
-
- super( sources , tb, poss);
- dimensions = dim ;
- }
-
public int dimensions() {
return dimensions;
}
+
+ /**
+ * @return char[][]
+ */
+ public char [][] getParameterizedTypeName(){
+ int dim = this.dimensions;
+ char[] dimChars = new char[dim*2];
+ for (int i = 0; i < dim; i++) {
+ int index = i*2;
+ dimChars[index] = '[';
+ dimChars[index+1] = ']';
+ }
+ int length = this.tokens.length;
+ char[][] qParamName = new char[length][];
+ System.arraycopy(this.tokens, 0, qParamName, 0, length-1);
+ qParamName[length-1] = CharOperation.concat(this.tokens[length-1], dimChars);
+ return qParamName;
+ }
- public TypeBinding getTypeBinding(Scope scope) {
+ protected TypeBinding getTypeBinding(Scope scope) {
if (this.resolvedType != null)
return this.resolvedType;
if (dimensions > 255) {
scope.problemReporter().tooManyDimensions(this);
}
- return scope.createArray(scope.getType(tokens), dimensions);
+ try {
+ TypeBinding leafComponentType = scope.getType(this.tokens, this.tokens.length);
+ if (leafComponentType.isParameterizedType()) {
+ scope.problemReporter().illegalArrayOfParameterizedType(leafComponentType, this);
+ }
+ return scope.createArrayType(leafComponentType, dimensions);
+ } catch (AbortCompilation e) {
+ e.updateContext(this, scope.referenceCompilationUnit().compilationResult);
+ throw e;
+ }
}
public StringBuffer printExpression(int indent, StringBuffer output){
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java
index 915b347771..cab79d7212 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java
@@ -124,7 +124,7 @@ public class ArrayReference extends Reference {
codeStream.arrayAt(this.resolvedType.id);
int operationTypeID;
if ((operationTypeID = implicitConversion >> 4) == T_String) {
- codeStream.generateStringAppend(currentScope, null, expression);
+ codeStream.generateStringConcatenationAppend(currentScope, null, expression);
} else {
// promote the array reference to the suitable operation type
codeStream.generateImplicitConversion(implicitConversion);
@@ -189,14 +189,14 @@ public class ArrayReference extends Reference {
TypeBinding arrayType = receiver.resolveType(scope);
if (arrayType != null) {
if (arrayType.isArrayType()) {
- this.resolvedType = ((ArrayBinding) arrayType).elementsType(scope);
+ this.resolvedType = ((ArrayBinding) arrayType).elementsType();
} else {
scope.problemReporter().referenceMustBeArrayTypeAt(arrayType, this);
}
}
TypeBinding positionType = position.resolveTypeExpecting(scope, IntBinding);
if (positionType != null) {
- position.implicitWidening(IntBinding, positionType);
+ position.computeConversion(scope, IntBinding, positionType);
}
return this.resolvedType;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java
index eec8865de1..ebb51dd985 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java
@@ -10,8 +10,12 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
+import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
-import org.eclipse.jdt.internal.compiler.lookup.*;
+import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
+import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
+import org.eclipse.jdt.internal.compiler.lookup.Scope;
+import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
public class ArrayTypeReference extends SingleTypeReference {
public int dimensions;
@@ -28,24 +32,34 @@ public class ArrayTypeReference extends SingleTypeReference {
this.dimensions = dimensions ;
}
- public ArrayTypeReference(char[] source, TypeBinding tb, int dimensions, long pos) {
-
- super(source, tb, pos);
- this.dimensions = dimensions ;
- }
-
public int dimensions() {
return dimensions;
}
-
- public TypeBinding getTypeBinding(Scope scope) {
+ /**
+ * @return char[][]
+ */
+ public char [][] getParameterizedTypeName(){
+ int dim = this.dimensions;
+ char[] dimChars = new char[dim*2];
+ for (int i = 0; i < dim; i++) {
+ int index = i*2;
+ dimChars[index] = '[';
+ dimChars[index+1] = ']';
+ }
+ return new char[][]{ CharOperation.concat(token, dimChars) };
+ }
+ protected TypeBinding getTypeBinding(Scope scope) {
if (this.resolvedType != null) return this.resolvedType;
if (dimensions > 255) {
scope.problemReporter().tooManyDimensions(this);
}
- return scope.createArray(scope.getType(token), dimensions);
+ TypeBinding leafComponentType = scope.getType(token);
+ if (leafComponentType.isParameterizedType()) {
+ scope.problemReporter().illegalArrayOfParameterizedType(leafComponentType, this);
+ }
+ return scope.createArrayType(leafComponentType, dimensions);
}
@@ -63,4 +77,10 @@ public class ArrayTypeReference extends SingleTypeReference {
visitor.visit(this, scope);
visitor.endVisit(this, scope);
}
+
+ public void traverse(ASTVisitor visitor, ClassScope scope) {
+
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java
index cf3093a943..cf948b4dd3 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.codegen.*;
import org.eclipse.jdt.internal.compiler.flow.*;
import org.eclipse.jdt.internal.compiler.impl.Constant;
@@ -176,7 +177,7 @@ public class AssertStatement extends Statement {
for (int i = 0, max = methods.length; i < max; i++) {
AbstractMethodDeclaration method = methods[i];
if (method.isClinit()) {
- ((Clinit) method).setAssertionSupport(assertionSyntheticFieldBinding);
+ ((Clinit) method).setAssertionSupport(assertionSyntheticFieldBinding, currentScope.environment().options.sourceLevel < ClassFileConstants.JDK1_5);
break;
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java
index 5b86adec80..3e7a409bad 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java
@@ -56,6 +56,19 @@ public class Assignment extends Expression {
}
}
+ void checkAssignment(BlockScope scope, TypeBinding lhsType, TypeBinding rhsType) {
+
+ FieldBinding leftField = getLastField(this.lhs);
+ if (leftField != null && lhsType.isWildcard() && rhsType != NullBinding) {
+ scope.problemReporter().unsafeWildcardAssignment(lhsType, rhsType, this.expression);
+ } else if (leftField != null && leftField.declaringClass.isRawType()
+ && (rhsType.isParameterizedType() || rhsType.isGenericType())) {
+ scope.problemReporter().unsafeRawFieldAssignment(leftField, rhsType, this.lhs);
+ } else if (rhsType.isRawType() && (lhsType.isParameterizedType() || lhsType.isGenericType())) {
+ scope.problemReporter().unsafeRawAssignment(this.expression, rhsType, lhsType);
+ }
+ }
+
public void generateCode(
BlockScope currentScope,
CodeStream codeStream,
@@ -89,6 +102,23 @@ public class Assignment extends Expression {
}
return null;
}
+ FieldBinding getLastField(Expression someExpression) {
+ if (someExpression instanceof SingleNameReference) {
+ if ((someExpression.bits & RestrictiveFlagMASK) == BindingIds.FIELD) {
+ return (FieldBinding) ((SingleNameReference)someExpression).binding;
+ }
+ } else if (someExpression instanceof FieldReference) {
+ return ((FieldReference)someExpression).binding;
+ } else if (someExpression instanceof QualifiedNameReference) {
+ QualifiedNameReference qName = (QualifiedNameReference) someExpression;
+ if (qName.otherBindings == null && ((someExpression.bits & RestrictiveFlagMASK) == BindingIds.FIELD)) {
+ return (FieldBinding)qName.binding;
+ } else {
+ return qName.otherBindings[qName.otherBindings.length - 1];
+ }
+ }
+ return null;
+ }
public StringBuffer print(int indent, StringBuffer output) {
//no () when used as a statement
@@ -122,26 +152,25 @@ public class Assignment extends Expression {
scope.problemReporter().expressionShouldBeAVariable(this.lhs);
return null;
}
- this.resolvedType = lhs.resolveType(scope); // expressionType contains the assignment type (lhs Type)
+ TypeBinding lhsType = this.resolvedType = lhs.resolveType(scope);
+ expression.setExpectedType(lhsType); // needed in case of generic method invocation
TypeBinding rhsType = expression.resolveType(scope);
- if (this.resolvedType == null || rhsType == null) {
+ if (lhsType == null || rhsType == null) {
return null;
}
checkAssignmentEffect(scope);
-
+
// Compile-time conversion of base-types : implicit narrowing integer into byte/short/character
// may require to widen the rhs expression at runtime
- if ((expression.isConstantValueOfTypeAssignableToType(rhsType, this.resolvedType)
- || (this.resolvedType.isBaseType() && BaseTypeBinding.isWidening(this.resolvedType.id, rhsType.id)))
- || rhsType.isCompatibleWith(this.resolvedType)) {
- expression.implicitWidening(this.resolvedType, rhsType);
+ if ((expression.isConstantValueOfTypeAssignableToType(rhsType, lhsType)
+ || (lhsType.isBaseType() && BaseTypeBinding.isWidening(lhsType.id, rhsType.id)))
+ || rhsType.isCompatibleWith(lhsType)) {
+ expression.computeConversion(scope, lhsType, rhsType);
+ checkAssignment(scope, lhsType, rhsType);
return this.resolvedType;
}
- scope.problemReporter().typeMismatchErrorActualTypeExpectedType(
- expression,
- rhsType,
- this.resolvedType);
- return this.resolvedType;
+ scope.problemReporter().typeMismatchError(rhsType, lhsType, expression);
+ return lhsType;
}
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.compiler.ast.Expression#resolveTypeExpecting(org.eclipse.jdt.internal.compiler.lookup.BlockScope, org.eclipse.jdt.internal.compiler.lookup.TypeBinding)
@@ -151,13 +180,15 @@ public class Assignment extends Expression {
TypeBinding expectedType) {
TypeBinding type = super.resolveTypeExpecting(scope, expectedType);
+ TypeBinding lhsType = this.resolvedType;
+ TypeBinding rhsType = this.expression.resolvedType;
// signal possible accidental boolean assignment (instead of using '==' operator)
if (expectedType == BooleanBinding
- && this.lhs.resolvedType == BooleanBinding
+ && lhsType == BooleanBinding
&& (this.lhs.bits & IsStrictlyAssignedMASK) != 0) {
scope.problemReporter().possibleAccidentalBooleanAssignment(this);
}
-
+ checkAssignment(scope, lhsType, rhsType);
return type;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java
index b5804d03d1..87bf2536db 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java
@@ -97,7 +97,7 @@ public class BinaryExpression extends OperatorExpression {
case PLUS :
switch (bits & ReturnTypeIDMASK) {
case T_String :
- codeStream.generateStringAppend(currentScope, left, right);
+ codeStream.generateStringConcatenationAppend(currentScope, left, right);
if (!valueRequired)
codeStream.pop();
break;
@@ -1525,7 +1525,7 @@ public class BinaryExpression extends OperatorExpression {
codeStream.updateLastRecordedEndPC(codeStream.position);
}
- public void generateOptimizedStringBuffer(
+ public void generateOptimizedStringConcatenation(
BlockScope blockScope,
CodeStream codeStream,
int typeID) {
@@ -1539,27 +1539,27 @@ public class BinaryExpression extends OperatorExpression {
&& ((bits & ReturnTypeIDMASK) == T_String)) {
if (constant != NotAConstant) {
codeStream.generateConstant(constant, implicitConversion);
- codeStream.invokeStringBufferAppendForType(implicitConversion & 0xF);
+ codeStream.invokeStringConcatenationAppendForType(implicitConversion & 0xF);
} else {
int pc = codeStream.position;
- left.generateOptimizedStringBuffer(
+ left.generateOptimizedStringConcatenation(
blockScope,
codeStream,
left.implicitConversion & 0xF);
codeStream.recordPositionsFrom(pc, left.sourceStart);
pc = codeStream.position;
- right.generateOptimizedStringBuffer(
+ right.generateOptimizedStringConcatenation(
blockScope,
codeStream,
right.implicitConversion & 0xF);
codeStream.recordPositionsFrom(pc, right.sourceStart);
}
} else {
- super.generateOptimizedStringBuffer(blockScope, codeStream, typeID);
+ super.generateOptimizedStringConcatenation(blockScope, codeStream, typeID);
}
}
- public void generateOptimizedStringBufferCreation(
+ public void generateOptimizedStringConcatenationCreation(
BlockScope blockScope,
CodeStream codeStream,
int typeID) {
@@ -1572,27 +1572,27 @@ public class BinaryExpression extends OperatorExpression {
if ((((bits & OperatorMASK) >> OperatorSHIFT) == PLUS)
&& ((bits & ReturnTypeIDMASK) == T_String)) {
if (constant != NotAConstant) {
- codeStream.newStringBuffer(); // new: java.lang.StringBuffer
+ codeStream.newStringContatenation(); // new: java.lang.StringBuffer
codeStream.dup();
codeStream.ldc(constant.stringValue());
- codeStream.invokeStringBufferStringConstructor();
+ codeStream.invokeStringConcatenationStringConstructor();
// invokespecial: java.lang.StringBuffer.<init>(Ljava.lang.String;)V
} else {
int pc = codeStream.position;
- left.generateOptimizedStringBufferCreation(
+ left.generateOptimizedStringConcatenationCreation(
blockScope,
codeStream,
left.implicitConversion & 0xF);
codeStream.recordPositionsFrom(pc, left.sourceStart);
pc = codeStream.position;
- right.generateOptimizedStringBuffer(
+ right.generateOptimizedStringConcatenation(
blockScope,
codeStream,
right.implicitConversion & 0xF);
codeStream.recordPositionsFrom(pc, right.sourceStart);
}
} else {
- super.generateOptimizedStringBufferCreation(blockScope, codeStream, typeID);
+ super.generateOptimizedStringConcatenationCreation(blockScope, codeStream, typeID);
}
}
@@ -1687,11 +1687,11 @@ public class BinaryExpression extends OperatorExpression {
if (((bits & OperatorMASK) >> OperatorSHIFT) == PLUS) {
if (leftTypeId == T_String
&& rightType.isArrayType()
- && ((ArrayBinding) rightType).elementsType(scope) == CharBinding) {
+ && ((ArrayBinding) rightType).elementsType() == CharBinding) {
scope.problemReporter().signalNoImplicitStringConversionForCharArrayExpression(right);
} else if (rightTypeId == T_String
&& leftType.isArrayType()
- && ((ArrayBinding) leftType).elementsType(scope) == CharBinding) {
+ && ((ArrayBinding) leftType).elementsType() == CharBinding) {
scope.problemReporter().signalNoImplicitStringConversionForCharArrayExpression(left);
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java
index 56380f764a..ddea0c269d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java
@@ -97,10 +97,7 @@ public class CaseStatement extends Statement {
return constantExpression.constant;
if (caseType.isCompatibleWith(switchType))
return constantExpression.constant;
- scope.problemReporter().typeMismatchErrorActualTypeExpectedType(
- constantExpression,
- caseType,
- switchType);
+ scope.problemReporter().typeMismatchError(caseType, switchType, constantExpression);
return null;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java
index ecfe767b9e..f09e6d578c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java
@@ -23,6 +23,7 @@ public class CastExpression extends Expression {
public Expression expression;
public Expression type;
+ public TypeBinding expectedType; // when assignment conversion to a given expected type: String s = (String) t;
//expression.implicitConversion holds the cast for baseType casting
public CastExpression(Expression expression, Expression type) {
@@ -76,7 +77,7 @@ public class CastExpression extends Expression {
if (castType.isBaseType()) {
if (expressionType.isBaseType()) {
if (expressionType == castType) {
- expression.implicitWidening(castType, expressionType);
+ expression.computeConversion(scope, castType, expressionType);
constant = expression.constant; //use the same constant
return false;
}
@@ -112,10 +113,10 @@ public class CastExpression extends Expression {
if (castType.isArrayType()) {
//------- (castType.isArray) expressionType.isArray -----------
- TypeBinding exprElementType = ((ArrayBinding) expressionType).elementsType(scope);
+ TypeBinding exprElementType = ((ArrayBinding) expressionType).elementsType();
if (exprElementType.isBaseType()) {
// <---stop the recursion-------
- if (((ArrayBinding) castType).elementsType(scope) == exprElementType) {
+ if (((ArrayBinding) castType).elementsType() == exprElementType) {
this.bits |= NeedRuntimeCheckCastMASK;
} else {
scope.problemReporter().typeCastError(this, castType, expressionType);
@@ -125,7 +126,7 @@ public class CastExpression extends Expression {
// recursively on the elements...
return checkCastTypesCompatibility(
scope,
- ((ArrayBinding) castType).elementsType(scope),
+ ((ArrayBinding) castType).elementsType(),
exprElementType);
} else if (
castType.isClass()) {
@@ -158,14 +159,27 @@ public class CastExpression extends Expression {
if (castType.isCompatibleWith(expressionType)) {
// potential runtime error
this.bits |= NeedRuntimeCheckCastMASK;
+ if (castType.isParameterizedType() || castType.isGenericType()) {
+ ReferenceBinding match = ((ReferenceBinding)castType).findSuperTypeErasingTo((ReferenceBinding)expressionType.erasure());
+ if (!match.isParameterizedType() && !match.isGenericType()) {
+ scope.problemReporter().unsafeCast(this);
+ }
+ }
return true;
}
} else { // ----- (castType.isInterface) expressionType.isClass -------
- if (expressionType.isCompatibleWith(castType))
+ if (expressionType.isCompatibleWith(castType)) {
return false;
+ }
if (!((ReferenceBinding) expressionType).isFinal()) {
// a subclass may implement the interface ==> no check at compile time
this.bits |= NeedRuntimeCheckCastMASK;
+ if (castType.isParameterizedType() || castType.isGenericType()) {
+ ReferenceBinding match = ((ReferenceBinding)castType).findSuperTypeErasingTo((ReferenceBinding)expressionType.erasure());
+ if (!match.isParameterizedType() && !match.isGenericType()) {
+ scope.problemReporter().unsafeCast(this);
+ }
+ }
return true;
}
// no subclass for expressionType, thus compile-time check is valid
@@ -386,6 +400,7 @@ public class CastExpression extends Expression {
private static void checkAlternateBinding(BlockScope scope, Expression receiver, TypeBinding receiverType, MethodBinding binding, Expression[] arguments, TypeBinding[] originalArgumentTypes, TypeBinding[] alternateArgumentTypes, final InvocationSite invocationSite) {
InvocationSite fakeInvocationSite = new InvocationSite(){
+ public TypeBinding[] genericTypeArguments() { return null; }
public boolean isSuperAccess(){ return invocationSite.isSuperAccess(); }
public boolean isTypeAccess() { return invocationSite.isTypeAccess(); }
public void setActualReceiverType(ReferenceBinding actualReceiverType) { /* ignore */}
@@ -480,24 +495,51 @@ public class CastExpression extends Expression {
&& ((type.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT) == 0) { // no extra parenthesis around type: ((A))exp
this.resolvedType = type.resolveType(scope);
+ expression.setExpectedType(this.resolvedType); // needed in case of generic method invocation
TypeBinding expressionType = expression.resolveType(scope);
if (this.resolvedType != null && expressionType != null) {
boolean necessary = checkCastTypesCompatibility(scope, this.resolvedType, expressionType);
if (!necessary && this.expression.resolvedType != null) { // cannot do better if expression is not bound
this.bits |= UnnecessaryCastMask;
if ((this.bits & IgnoreNeedForCastCheckMASK) == 0) {
- scope.problemReporter().unnecessaryCast(this);
+ if (!usedForGenericMethodReturnTypeInference()) // used for generic type inference ?
+ scope.problemReporter().unnecessaryCast(this);
}
}
}
return this.resolvedType;
- } else { // expression as a cast !!!!!!!!
+ } else { // expression as a cast
TypeBinding expressionType = expression.resolveType(scope);
if (expressionType == null) return null;
scope.problemReporter().invalidTypeReference(type);
return null;
}
}
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.ast.Expression#setExpectedType(org.eclipse.jdt.internal.compiler.lookup.TypeBinding)
+ */
+ public void setExpectedType(TypeBinding expectedType) {
+ this.expectedType = expectedType;
+ }
+
+ /**
+ * Determines whether apparent unnecessary cast wasn't actually used to
+ * perform return type inference of generic method invocation.
+ */
+ private boolean usedForGenericMethodReturnTypeInference() {
+ if (this.expression instanceof MessageSend) {
+ MethodBinding method = ((MessageSend)this.expression).binding;
+ if (method instanceof ParameterizedGenericMethodBinding
+ && ((ParameterizedGenericMethodBinding)method).inferredReturnType) {
+ if (this.expectedType == null)
+ return true;
+ if (this.resolvedType != this.expectedType)
+ return true;
+ }
+ }
+ return false;
+ }
public void traverse(
ASTVisitor visitor,
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java
index 4a4136e527..cf712302fe 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java
@@ -11,6 +11,7 @@
package org.eclipse.jdt.internal.compiler.ast;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.codegen.*;
import org.eclipse.jdt.internal.compiler.flow.*;
import org.eclipse.jdt.internal.compiler.lookup.*;
@@ -35,9 +36,10 @@ public class ClassLiteralAccess extends Expression {
// if reachable, request the addition of a synthetic field for caching the class descriptor
SourceTypeBinding sourceType =
currentScope.outerMostMethodScope().enclosingSourceType();
- if (!(sourceType.isInterface()
- // no field generated in interface case (would'nt verify) see 1FHHEZL
- || sourceType.isBaseType())) {
+ if ((!(sourceType.isInterface()
+ // no field generated in interface case (would'nt verify) see 1FHHEZL
+ || sourceType.isBaseType()))
+ && currentScope.environment().options.sourceLevel <= ClassFileConstants.JDK1_5) {
syntheticField = sourceType.addSyntheticField(targetType, currentScope);
}
return flowInfo;
@@ -57,8 +59,9 @@ public class ClassLiteralAccess extends Expression {
int pc = codeStream.position;
// in interface case, no caching occurs, since cannot make a cache field for interface
- if (valueRequired)
+ if (valueRequired) {
codeStream.generateClassLiteralAccessForType(type.resolvedType, syntheticField);
+ }
codeStream.recordPositionsFrom(pc, this.sourceStart);
}
@@ -78,8 +81,14 @@ public class ClassLiteralAccess extends Expression {
scope.problemReporter().cannotAllocateVoidArray(this);
return null;
}
-
- return this.resolvedType = scope.getJavaLangClass();
+ ReferenceBinding classType = scope.getJavaLangClass();
+ if (classType.isGenericType()) {
+ // Integer.class is of type Class<Integer>
+ this.resolvedType = scope.createParameterizedType(classType, new TypeBinding[]{ targetType }, null);
+ } else {
+ this.resolvedType = classType;
+ }
+ return this.resolvedType;
}
public void traverse(
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java
index 2bbac9c9a2..30fa0a8888 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java
@@ -232,15 +232,17 @@ public class Clinit extends AbstractMethodDeclaration {
}
// 1.4 feature
- public void setAssertionSupport(FieldBinding assertionSyntheticFieldBinding) {
+ public void setAssertionSupport(FieldBinding assertionSyntheticFieldBinding, boolean needClassLiteralField) {
this.assertionSyntheticFieldBinding = assertionSyntheticFieldBinding;
// we need to add the field right now, because the field infos are generated before the methods
SourceTypeBinding sourceType =
this.scope.outerMostMethodScope().enclosingSourceType();
- this.classLiteralSyntheticField =
- sourceType.addSyntheticField(sourceType, scope);
+ if (needClassLiteralField) {
+ this.classLiteralSyntheticField =
+ sourceType.addSyntheticField(sourceType, scope);
+ }
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java
index d736614978..df96e49f7d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java
@@ -19,6 +19,8 @@ import org.eclipse.jdt.internal.compiler.problem.*;
public class CompilationUnitDeclaration
extends ASTNode
implements ProblemSeverities, ReferenceContext {
+
+ private static final char[] PACKAGE_INFO_FILE_NAME = "package-info.java".toCharArray(); //$NON-NLS-1$
public ImportReference currentPackage;
public ImportReference[] imports;
@@ -266,7 +268,12 @@ public class CompilationUnitDeclaration
}
public void resolve() {
-
+ if (this.currentPackage != null) {
+ if (this.currentPackage.annotations != null
+ && !CharOperation.endsWith(getFileName(), PACKAGE_INFO_FILE_NAME)) {
+ scope.problemReporter().invalidFileNameForPackageAnnotations(this.currentPackage.annotations[0]);
+ }
+ }
try {
if (types != null) {
for (int i = 0, count = types.length; i < count; i++) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java
index cf863738b1..9c6dc46b32 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java
@@ -12,6 +12,7 @@ package org.eclipse.jdt.internal.compiler.ast;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
import org.eclipse.jdt.internal.compiler.impl.*;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.codegen.*;
import org.eclipse.jdt.internal.compiler.flow.*;
import org.eclipse.jdt.internal.compiler.lookup.*;
@@ -246,9 +247,7 @@ public class ConditionalExpression extends OperatorExpression {
if (needFalsePart) {
internalFalseLabel.place();
if (falseInitStateIndex != -1) {
- codeStream.removeNotDefinitelyAssignedVariables(
- currentScope,
- falseInitStateIndex);
+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, falseInitStateIndex);
codeStream.addDefinitelyAssignedVariables(currentScope, falseInitStateIndex);
}
valueIfFalse.generateOptimizedBoolean(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
@@ -258,9 +257,7 @@ public class ConditionalExpression extends OperatorExpression {
}
// May loose some local variable initializations : affecting the local variable attributes
if (mergedInitStateIndex != -1) {
- codeStream.removeNotDefinitelyAssignedVariables(
- currentScope,
- mergedInitStateIndex);
+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, mergedInitStateIndex);
}
// no implicit conversion for boolean values
codeStream.updateLastRecordedEndPC(codeStream.position);
@@ -302,7 +299,7 @@ public class ConditionalExpression extends OperatorExpression {
constant = condConstant.booleanValue() ? trueConstant : falseConstant;
}
if (valueIfTrueType == valueIfFalseType) { // harmed the implicit conversion
- valueIfTrue.implicitWidening(valueIfTrueType, valueIfTrueType);
+ valueIfTrue.computeConversion(scope, valueIfTrueType, valueIfTrueType);
valueIfFalse.implicitConversion = valueIfTrue.implicitConversion;
if (valueIfTrueType == BooleanBinding) {
this.optimizedIfTrueConstant = valueIfTrue.optimizedBooleanConstant();
@@ -326,16 +323,16 @@ public class ConditionalExpression extends OperatorExpression {
// (Short x Byte) or (Byte x Short)"
if ((valueIfTrueType == ByteBinding && valueIfFalseType == ShortBinding)
|| (valueIfTrueType == ShortBinding && valueIfFalseType == ByteBinding)) {
- valueIfTrue.implicitWidening(ShortBinding, valueIfTrueType);
- valueIfFalse.implicitWidening(ShortBinding, valueIfFalseType);
+ valueIfTrue.computeConversion(scope, ShortBinding, valueIfTrueType);
+ valueIfFalse.computeConversion(scope, ShortBinding, valueIfFalseType);
return this.resolvedType = ShortBinding;
}
// <Byte|Short|Char> x constant(Int) ---> <Byte|Short|Char> and reciprocally
if ((valueIfTrueType == ByteBinding || valueIfTrueType == ShortBinding || valueIfTrueType == CharBinding)
&& (valueIfFalseType == IntBinding
&& valueIfFalse.isConstantValueOfTypeAssignableToType(valueIfFalseType, valueIfTrueType))) {
- valueIfTrue.implicitWidening(valueIfTrueType, valueIfTrueType);
- valueIfFalse.implicitWidening(valueIfTrueType, valueIfFalseType);
+ valueIfTrue.computeConversion(scope, valueIfTrueType, valueIfTrueType);
+ valueIfFalse.computeConversion(scope, valueIfTrueType, valueIfFalseType);
return this.resolvedType = valueIfTrueType;
}
if ((valueIfFalseType == ByteBinding
@@ -343,35 +340,35 @@ public class ConditionalExpression extends OperatorExpression {
|| valueIfFalseType == CharBinding)
&& (valueIfTrueType == IntBinding
&& valueIfTrue.isConstantValueOfTypeAssignableToType(valueIfTrueType, valueIfFalseType))) {
- valueIfTrue.implicitWidening(valueIfFalseType, valueIfTrueType);
- valueIfFalse.implicitWidening(valueIfFalseType, valueIfFalseType);
+ valueIfTrue.computeConversion(scope, valueIfFalseType, valueIfTrueType);
+ valueIfFalse.computeConversion(scope, valueIfFalseType, valueIfFalseType);
return this.resolvedType = valueIfFalseType;
}
// Manual binary numeric promotion
// int
if (BaseTypeBinding.isNarrowing(valueIfTrueType.id, T_int)
&& BaseTypeBinding.isNarrowing(valueIfFalseType.id, T_int)) {
- valueIfTrue.implicitWidening(IntBinding, valueIfTrueType);
- valueIfFalse.implicitWidening(IntBinding, valueIfFalseType);
+ valueIfTrue.computeConversion(scope, IntBinding, valueIfTrueType);
+ valueIfFalse.computeConversion(scope, IntBinding, valueIfFalseType);
return this.resolvedType = IntBinding;
}
// long
if (BaseTypeBinding.isNarrowing(valueIfTrueType.id, T_long)
&& BaseTypeBinding.isNarrowing(valueIfFalseType.id, T_long)) {
- valueIfTrue.implicitWidening(LongBinding, valueIfTrueType);
- valueIfFalse.implicitWidening(LongBinding, valueIfFalseType);
+ valueIfTrue.computeConversion(scope, LongBinding, valueIfTrueType);
+ valueIfFalse.computeConversion(scope, LongBinding, valueIfFalseType);
return this.resolvedType = LongBinding;
}
// float
if (BaseTypeBinding.isNarrowing(valueIfTrueType.id, T_float)
&& BaseTypeBinding.isNarrowing(valueIfFalseType.id, T_float)) {
- valueIfTrue.implicitWidening(FloatBinding, valueIfTrueType);
- valueIfFalse.implicitWidening(FloatBinding, valueIfFalseType);
+ valueIfTrue.computeConversion(scope, FloatBinding, valueIfTrueType);
+ valueIfFalse.computeConversion(scope, FloatBinding, valueIfFalseType);
return this.resolvedType = FloatBinding;
}
// double
- valueIfTrue.implicitWidening(DoubleBinding, valueIfTrueType);
- valueIfFalse.implicitWidening(DoubleBinding, valueIfFalseType);
+ valueIfTrue.computeConversion(scope, DoubleBinding, valueIfTrueType);
+ valueIfFalse.computeConversion(scope, DoubleBinding, valueIfFalseType);
return this.resolvedType = DoubleBinding;
}
// Type references (null null is already tested)
@@ -384,15 +381,22 @@ public class ConditionalExpression extends OperatorExpression {
return null;
}
if (valueIfFalseType.isCompatibleWith(valueIfTrueType)) {
- valueIfTrue.implicitWidening(valueIfTrueType, valueIfTrueType);
- valueIfFalse.implicitWidening(valueIfTrueType, valueIfFalseType);
+ valueIfTrue.computeConversion(scope, valueIfTrueType, valueIfTrueType);
+ valueIfFalse.computeConversion(scope, valueIfTrueType, valueIfFalseType);
return this.resolvedType = valueIfTrueType;
}
if (valueIfTrueType.isCompatibleWith(valueIfFalseType)) {
- valueIfTrue.implicitWidening(valueIfFalseType, valueIfTrueType);
- valueIfFalse.implicitWidening(valueIfFalseType, valueIfFalseType);
+ valueIfTrue.computeConversion(scope, valueIfFalseType, valueIfTrueType);
+ valueIfFalse.computeConversion(scope, valueIfFalseType, valueIfFalseType);
return this.resolvedType = valueIfFalseType;
}
+ // 1.5 addition: allow most common type
+ if (scope.environment().options.sourceLevel >= ClassFileConstants.JDK1_5) {
+ TypeBinding commonType = scope.mostSpecificCommonType(new TypeBinding[] { valueIfTrueType, valueIfFalseType });
+ if (commonType != null) {
+ return this.resolvedType = commonType;
+ }
+ }
scope.problemReporter().conditionalArgumentsIncompatibleTypes(
this,
valueIfTrueType,
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
index 7170bbf40d..932d624f4d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
@@ -26,6 +26,7 @@ public class ConstructorDeclaration extends AbstractMethodDeclaration {
public ExplicitConstructorCall constructorCall;
public final static char[] ConstantPoolName = "<init>".toCharArray(); //$NON-NLS-1$
public boolean isDefaultConstructor = false;
+ public TypeParameter[] typeParameters;
public ConstructorDeclaration(CompilationResult compilationResult){
super(compilationResult);
@@ -430,7 +431,19 @@ public class ConstructorDeclaration extends AbstractMethodDeclaration {
ASTVisitor visitor,
ClassScope classScope) {
+
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.typeParameters != null) {
+ int typeParametersLength = this.typeParameters.length;
+ for (int i = 0; i < typeParametersLength; i++) {
+ this.typeParameters[i].traverse(visitor, scope);
+ }
+ }
if (arguments != null) {
int argumentLength = arguments.length;
for (int i = 0; i < argumentLength; i++)
@@ -451,4 +464,7 @@ public class ConstructorDeclaration extends AbstractMethodDeclaration {
}
visitor.endVisit(this, classScope);
}
+ public TypeParameter[] typeParameters() {
+ return this.typeParameters;
+ }
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java
index 0dc995def8..e94bdf9434 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java
@@ -155,7 +155,7 @@ public class DoStatement extends Statement {
public void resolve(BlockScope scope) {
TypeBinding type = condition.resolveTypeExpecting(scope, BooleanBinding);
- condition.implicitWidening(type, type);
+ condition.computeConversion(scope, type, type);
if (action != null)
action.resolve(scope);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EnumConstant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EnumConstant.java
new file mode 100644
index 0000000000..ca83265007
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EnumConstant.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * Enum constant node
+ */
+public class EnumConstant extends TypeDeclaration {
+
+ public Expression[] arguments ;
+
+ public EnumConstant(CompilationResult compilationResult){
+ super(compilationResult);
+ this.compilationResult = compilationResult;
+ }
+
+ public StringBuffer print(int indent, StringBuffer output) {
+ output.append(name);
+ if (arguments != null) {
+ output.append('(');
+ int length = arguments.length;
+ for (int i = 0; i < length - 1; i++) {
+ arguments[i].print(0, output);
+ output.append(", ");//$NON-NLS-1$
+ }
+ arguments[length - 1].print(0, output);
+ output.append(')');
+ }
+ printBody(indent, output);
+ return output;
+ }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EnumDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EnumDeclaration.java
new file mode 100644
index 0000000000..915e07ab90
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EnumDeclaration.java
@@ -0,0 +1,242 @@
+/*******************************************************************************
+ * 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 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 = methods.length;
+ for (int i = 0; i < length; i++)
+ this.methods[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, unitScope);
+ } 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
+ }
+ }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java
index 0caeb81a07..551dc96bd5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java
@@ -79,12 +79,12 @@ public final boolean areTypesCastCompatible(BlockScope scope, TypeBinding castTy
//========ARRAY===============
if (expressionType.isArrayType()) {
if (castType.isArrayType()) { //------- (castTb.isArray) expressionTb.isArray -----------
- TypeBinding expressionEltType = ((ArrayBinding) expressionType).elementsType(scope);
+ TypeBinding expressionEltType = ((ArrayBinding) expressionType).elementsType();
if (expressionEltType.isBaseType())
// <---stop the recursion-------
- return ((ArrayBinding) castType).elementsType(scope) == expressionEltType;
+ return ((ArrayBinding) castType).elementsType() == expressionEltType;
//recursivly on the elts...
- return areTypesCastCompatible(scope, ((ArrayBinding) castType).elementsType(scope), expressionEltType);
+ return areTypesCastCompatible(scope, ((ArrayBinding) castType).elementsType(), expressionEltType);
}
if (castType.isBaseType()) {
return false;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java
index ec709ff633..697435bf78 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java
@@ -15,16 +15,17 @@ import org.eclipse.jdt.internal.compiler.codegen.*;
import org.eclipse.jdt.internal.compiler.flow.*;
import org.eclipse.jdt.internal.compiler.lookup.*;
-public class ExplicitConstructorCall
- extends Statement
- implements InvocationSite {
+public class ExplicitConstructorCall extends Statement implements InvocationSite {
public Expression[] arguments;
public Expression qualification;
- public MethodBinding binding;
-
+ public MethodBinding binding; // exact binding resulting from lookup
+ protected MethodBinding codegenBinding; // actual binding used for code generation (if no synthetic accessor)
+ MethodBinding syntheticAccessor; // synthetic accessor for inner-emulation
public int accessMode;
-
+ public TypeReference[] typeArguments;
+ public TypeBinding[] genericTypeArguments;
+
public final static int ImplicitSuper = 1;
public final static int Super = 2;
public final static int This = 3;
@@ -32,8 +33,6 @@ public class ExplicitConstructorCall
public VariableBinding[][] implicitArguments;
boolean discardEnclosingInstance;
- MethodBinding syntheticAccessor;
-
public ExplicitConstructorCall(int accessMode) {
this.accessMode = accessMode;
}
@@ -102,7 +101,7 @@ public class ExplicitConstructorCall
codeStream.aload_0();
// handling innerclass constructor invocation
- ReferenceBinding targetType = binding.declaringClass;
+ ReferenceBinding targetType = this.codegenBinding.declaringClass;
// handling innerclass instance allocation - enclosing instance arguments
if (targetType.isNestedType()) {
codeStream.generateSyntheticEnclosingInstanceValues(
@@ -127,21 +126,26 @@ public class ExplicitConstructorCall
if (syntheticAccessor != null) {
// synthetic accessor got some extra arguments appended to its signature, which need values
for (int i = 0,
- max = syntheticAccessor.parameters.length - binding.parameters.length;
+ max = syntheticAccessor.parameters.length - this.codegenBinding.parameters.length;
i < max;
i++) {
codeStream.aconst_null();
}
codeStream.invokespecial(syntheticAccessor);
} else {
- codeStream.invokespecial(binding);
+ codeStream.invokespecial(this.codegenBinding);
}
codeStream.recordPositionsFrom(pc, this.sourceStart);
} finally {
((MethodScope) currentScope).isConstructorCall = false;
}
}
-
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#genericTypeArguments()
+ */
+ public TypeBinding[] genericTypeArguments() {
+ return this.genericTypeArguments;
+ }
public boolean isImplicitSuper() {
//return true if I'm of these compiler added statement super();
@@ -185,19 +189,19 @@ public class ExplicitConstructorCall
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
if (!flowInfo.isReachable()) return;
+ // if constructor from parameterized type got found, use the original constructor at codegen time
+ this.codegenBinding = this.binding.original();
+
// perform some emulation work in case there is some and we are inside a local type only
- if (binding.isPrivate() && (accessMode != This)) {
+ if (binding.isPrivate() && accessMode != This) {
- if (currentScope
- .environment()
- .options
- .isPrivateConstructorAccessChangingVisibility) {
- binding.tagForClearingPrivateModifier();
+ if (currentScope.environment().options.isPrivateConstructorAccessChangingVisibility) {
+ this.codegenBinding.tagForClearingPrivateModifier();
// constructor will not be dumped as private, no emulation required thus
} else {
syntheticAccessor =
- ((SourceTypeBinding) binding.declaringClass).addSyntheticMethod(binding, isSuperAccess());
- currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
+ ((SourceTypeBinding) binding.declaringClass).addSyntheticMethod(this.codegenBinding, isSuperAccess());
+ currentScope.problemReporter().needToEmulateMethodAccess(this.codegenBinding, this);
}
}
}
@@ -206,6 +210,16 @@ public class ExplicitConstructorCall
printIndent(indent, output);
if (qualification != null) qualification.printExpression(0, output).append('.');
+ if (typeArguments != null) {
+ output.append('<');//$NON-NLS-1$
+ int max = typeArguments.length - 1;
+ for (int j = 0; j < max; j++) {
+ typeArguments[j].print(0, output);
+ output.append(", ");//$NON-NLS-1$
+ }
+ typeArguments[max].print(0, output);
+ output.append('>');
+ }
if (accessMode == This) {
output.append("this("); //$NON-NLS-1$
} else {
@@ -259,10 +273,24 @@ public class ExplicitConstructorCall
discardEnclosingInstance = true;
} else {
TypeBinding qTb = qualification.resolveTypeExpecting(scope, enclosingType);
- qualification.implicitWidening(qTb, qTb);
+ qualification.computeConversion(scope, qTb, qTb);
}
}
-
+ // resolve type arguments (for generic constructor call)
+ if (this.typeArguments != null) {
+ int length = this.typeArguments.length;
+ boolean argHasError = false; // typeChecks all arguments
+ this.genericTypeArguments = new TypeBinding[length];
+ for (int i = 0; i < length; i++) {
+ if ((this.genericTypeArguments[i] = this.typeArguments[i].resolveType(scope)) == null) {
+ argHasError = true;
+ }
+ }
+ if (argHasError) {
+ return;
+ }
+ }
+
// arguments buffering for the method lookup
TypeBinding[] argumentTypes = NoParameters;
boolean argsContainCast = false;
@@ -287,18 +315,8 @@ public class ExplicitConstructorCall
if ((binding = scope.getConstructor(receiverType, argumentTypes, this)).isValidBinding()) {
if (isMethodUseDeprecated(binding, scope))
scope.problemReporter().deprecatedMethod(binding, this);
-
- // see for user-implicit widening conversion
- if (arguments != null) {
- int length = arguments.length;
- TypeBinding[] paramTypes = binding.parameters;
- for (int i = 0; i < length; i++) {
- arguments[i].implicitWidening(paramTypes[i], argumentTypes[i]);
- }
- if (argsContainCast) {
- CastExpression.checkNeedForArgumentCasts(scope, null, receiverType, binding, this.arguments, argumentTypes, this);
- }
- }
+ if (this.arguments != null)
+ checkInvocationArguments(scope, null, receiverType, binding, this.arguments, argumentTypes, argsContainCast, this);
if (binding.isPrivate()) {
binding.modifiers |= AccPrivateUsed;
}
@@ -330,6 +348,11 @@ public class ExplicitConstructorCall
if (this.qualification != null) {
this.qualification.traverse(visitor, scope);
}
+ if (this.typeArguments != null) {
+ for (int i = 0, typeArgumentsLength = this.typeArguments.length; i < typeArgumentsLength; i++) {
+ this.typeArguments[i].traverse(visitor, scope);
+ }
+ }
if (this.arguments != null) {
for (int i = 0, argumentLength = this.arguments.length; i < argumentLength; i++)
this.arguments[i].traverse(visitor, scope);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
index ae3b502976..55052503bf 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
+import org.eclipse.jdt.internal.compiler.ASTVisitor;
import org.eclipse.jdt.internal.compiler.impl.*;
import org.eclipse.jdt.internal.compiler.codegen.*;
import org.eclipse.jdt.internal.compiler.flow.*;
@@ -18,41 +19,6 @@ import org.eclipse.jdt.internal.compiler.problem.*;
import org.eclipse.jdt.internal.compiler.util.Util;
public abstract class Expression extends Statement {
-
- //Some expression may not be used - from a java semantic point
- //of view only - as statements. Other may. In order to avoid the creation
- //of wrappers around expression in order to tune them as expression
- //Expression is a subclass of Statement. See the message isValidJavaStatement()
-
- public int implicitConversion;
- public TypeBinding resolvedType;
-
- public Constant constant;
-
- public Expression() {
- super();
- }
-
- public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
-
- return flowInfo;
- }
-
- public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired) {
-
- return analyseCode(currentScope, flowContext, flowInfo);
- }
-
- /**
- * Constant usable for bytecode pattern optimizations, but cannot be inlined
- * since it is not strictly equivalent to the definition of constant expressions.
- * In particular, some side-effects may be required to occur (only the end value
- * is known).
- * @return Constant known to be of boolean type
- */
- public Constant optimizedBooleanConstant() {
- return this.constant;
- }
public static final boolean isConstantValueRepresentable(
Constant constant,
@@ -208,6 +174,60 @@ public abstract class Expression extends Statement {
return false; //boolean
}
}
+
+ public Constant constant;
+
+ //Some expression may not be used - from a java semantic point
+ //of view only - as statements. Other may. In order to avoid the creation
+ //of wrappers around expression in order to tune them as expression
+ //Expression is a subclass of Statement. See the message isValidJavaStatement()
+
+ public int implicitConversion;
+ public TypeBinding resolvedType;
+
+ public Expression() {
+ super();
+ }
+
+ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+
+ return flowInfo;
+ }
+
+ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired) {
+
+ return analyseCode(currentScope, flowContext, flowInfo);
+ }
+
+ /**
+ * Base types need that the widening is explicitly done by the compiler using some bytecode like i2f.
+ * Also check unsafe type operations.
+ */
+ public void computeConversion(Scope scope, TypeBinding runtimeTimeType, TypeBinding compileTimeType) {
+
+ if (runtimeTimeType == null || compileTimeType == null)
+ return;
+
+ switch (runtimeTimeType.id) {
+ case T_byte :
+ case T_short :
+ case T_char :
+ this.implicitConversion = (T_int << 4) + compileTimeType.id;
+ break;
+ case T_String :
+ case T_float :
+ case T_boolean :
+ case T_double :
+ case T_int : //implicitConversion may result in i2i which will result in NO code gen
+ case T_long :
+ this.implicitConversion = (runtimeTimeType.id << 4) + compileTimeType.id;
+ break;
+ default : // regular object ref
+// if (compileTimeType.isRawType() && runtimeTimeType.isParameterizedType()) {
+// scope.problemReporter().unsafeRawExpression(this, compileTimeType, runtimeTimeType);
+// }
+ }
+ }
/**
* Expression statements are plain expressions, however they generate like
@@ -317,23 +337,23 @@ public abstract class Expression extends Statement {
* creation, further operands should rather be only appended to the current one.
* By default: no optimization.
*/
- public void generateOptimizedStringBuffer(
+ public void generateOptimizedStringConcatenation(
BlockScope blockScope,
- org.eclipse.jdt.internal.compiler.codegen.CodeStream codeStream,
+ CodeStream codeStream,
int typeID) {
if (typeID == T_String && this.constant != NotAConstant && this.constant.stringValue().length() == 0) {
return; // optimize str + ""
}
generateCode(blockScope, codeStream, true);
- codeStream.invokeStringBufferAppendForType(typeID);
+ codeStream.invokeStringConcatenationAppendForType(typeID);
}
/* Optimized (java) code generation for string concatenations that involve StringBuffer
* creation: going through this path means that there is no need for a new StringBuffer
* creation, further operands should rather be only appended to the current one.
*/
- public void generateOptimizedStringBufferCreation(
+ public void generateOptimizedStringConcatenationCreation(
BlockScope blockScope,
CodeStream codeStream,
int typeID) {
@@ -342,20 +362,20 @@ public abstract class Expression extends Statement {
if (typeID == T_Object) {
// in the case the runtime value of valueOf(Object) returns null, we have to use append(Object) instead of directly valueOf(Object)
// append(Object) returns append(valueOf(Object)), which means that the null case is handled by append(String).
- codeStream.newStringBuffer();
+ codeStream.newStringContatenation();
codeStream.dup();
- codeStream.invokeStringBufferDefaultConstructor();
+ codeStream.invokeStringConcatenationDefaultConstructor();
generateCode(blockScope, codeStream, true);
- codeStream.invokeStringBufferAppendForType(T_Object);
+ codeStream.invokeStringConcatenationAppendForType(T_Object);
return;
}
- codeStream.newStringBuffer();
+ codeStream.newStringContatenation();
codeStream.dup();
if (typeID == T_String || typeID == T_null) {
if (constant != NotAConstant) {
String stringValue = constant.stringValue();
if (stringValue.length() == 0) { // optimize ""+<str>
- codeStream.invokeStringBufferDefaultConstructor();
+ codeStream.invokeStringConcatenationDefaultConstructor();
return;
}
codeStream.ldc(stringValue);
@@ -367,43 +387,7 @@ public abstract class Expression extends Statement {
generateCode(blockScope, codeStream, true);
codeStream.invokeStringValueOf(typeID);
}
- codeStream.invokeStringBufferStringConstructor();
- }
-
- // Base types need that the widening is explicitly done by the compiler using some bytecode like i2f
- public void implicitWidening(
- TypeBinding runtimeTimeType,
- TypeBinding compileTimeType) {
-
- if (runtimeTimeType == null || compileTimeType == null)
- return;
-
-// if (compileTimeType.id == T_null) {
-// // this case is possible only for constant null
-// // The type of runtime is a reference type
-// // The code gen use the constant id thus any value
-// // for the runtime id (akak the <<4) could be used.
-// // T_Object is used as some general T_reference
-// implicitConversion = (T_Object << 4) + T_null;
-// return;
-// }
-
- switch (runtimeTimeType.id) {
- case T_byte :
- case T_short :
- case T_char :
- implicitConversion = (T_int << 4) + compileTimeType.id;
- break;
- case T_String :
- case T_float :
- case T_boolean :
- case T_double :
- case T_int : //implicitConversion may result in i2i which will result in NO code gen
- case T_long :
- implicitConversion = (runtimeTimeType.id << 4) + compileTimeType.id;
- break;
- default : //nothing on regular object ref
- }
+ codeStream.invokeStringConcatenationStringConstructor();
}
public boolean isCompactableOperation() {
@@ -413,11 +397,9 @@ public abstract class Expression extends Statement {
//Return true if the conversion is done AUTOMATICALLY by the vm
//while the javaVM is an int based-machine, thus for example pushing
- //a byte onto the stack , will automatically creates a int on the stack
+ //a byte onto the stack , will automatically create an int on the stack
//(this request some work d be done by the VM on signed numbers)
- public boolean isConstantValueOfTypeAssignableToType(
- TypeBinding constantType,
- TypeBinding targetType) {
+ public boolean isConstantValueOfTypeAssignableToType(TypeBinding constantType, TypeBinding targetType) {
if (constant == Constant.NotAConstant)
return false;
@@ -438,6 +420,28 @@ public abstract class Expression extends Statement {
public boolean isTypeReference() {
return false;
}
+
+ /**
+ * Constant usable for bytecode pattern optimizations, but cannot be inlined
+ * since it is not strictly equivalent to the definition of constant expressions.
+ * In particular, some side-effects may be required to occur (only the end value
+ * is known).
+ * @return Constant known to be of boolean type
+ */
+ public Constant optimizedBooleanConstant() {
+ return this.constant;
+ }
+
+ public StringBuffer print(int indent, StringBuffer output) {
+ printIndent(indent, output);
+ return printExpression(indent, output);
+ }
+
+ public abstract StringBuffer printExpression(int indent, StringBuffer output);
+
+ public StringBuffer printStatement(int indent, StringBuffer output) {
+ return print(indent, output).append(";"); //$NON-NLS-1$
+ }
public void resolve(BlockScope scope) {
// drops the returning expression's type whatever the type is.
@@ -461,6 +465,7 @@ public abstract class Expression extends Statement {
BlockScope scope,
TypeBinding expectedType) {
+ this.setExpectedType(expectedType); // needed in case of generic method invocation
TypeBinding expressionType = this.resolveType(scope);
if (expressionType == null) return null;
if (expressionType == expectedType) return expressionType;
@@ -472,17 +477,15 @@ public abstract class Expression extends Statement {
return expressionType;
}
- public StringBuffer print(int indent, StringBuffer output) {
- printIndent(indent, output);
- return printExpression(indent, output);
+ /**
+ * Record the type expectation before this expression is typechecked.
+ * e.g. String s = foo();, foo() will be tagged as being expected of type String
+ * Used to trigger proper inference of generic method invocations.
+ */
+ public void setExpectedType(TypeBinding expectedType) {
+ // do nothing by default
}
-
- public abstract StringBuffer printExpression(int indent, StringBuffer output);
- public StringBuffer printStatement(int indent, StringBuffer output) {
- return print(indent, output).append(";"); //$NON-NLS-1$
- }
-
public Expression toTypeReference() {
//by default undefined
@@ -493,4 +496,14 @@ public abstract class Expression extends Statement {
return this;
}
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ // do nothing by default
+ }
+ public void traverse(ASTVisitor visitor, ClassScope scope) {
+ // do nothing by default
+ }
+ public void traverse(ASTVisitor visitor, CompilationUnitScope scope) {
+ // do nothing by default
+ }
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java
index 7f001c35a2..716b1d8dff 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java
@@ -116,11 +116,6 @@ public class FieldDeclaration extends AbstractVariableDeclaration {
codeStream.recordPositionsFrom(pc, this.sourceStart);
}
- public TypeBinding getTypeBinding(Scope scope) {
-
- return this.type.getTypeBinding(scope);
- }
-
public boolean isField() {
return true;
@@ -180,9 +175,6 @@ public class FieldDeclaration extends AbstractVariableDeclaration {
initializationScope.initializedField = this.binding;
initializationScope.lastVisibleFieldID = this.binding.id;
- if (isTypeUseDeprecated(this.binding.type, initializationScope)) {
- initializationScope.problemReporter().deprecatedType(this.binding.type, this.type);
- }
// the resolution of the initialization hasn't been done
if (this.initialization == null) {
this.binding.constant = Constant.NotAConstant;
@@ -190,27 +182,26 @@ public class FieldDeclaration extends AbstractVariableDeclaration {
// break dead-lock cycles by forcing constant to NotAConstant
this.binding.constant = Constant.NotAConstant;
- TypeBinding typeBinding = this.binding.type;
- TypeBinding initializationTypeBinding;
-
+ TypeBinding fieldType = this.binding.type;
+ TypeBinding initializationType;
+ this.initialization.setExpectedType(fieldType); // needed in case of generic method invocation
if (this.initialization instanceof ArrayInitializer) {
- if ((initializationTypeBinding = this.initialization.resolveTypeExpecting(initializationScope, typeBinding)) != null) {
- ((ArrayInitializer) this.initialization).binding = (ArrayBinding) initializationTypeBinding;
- this.initialization.implicitWidening(typeBinding, initializationTypeBinding);
+ if ((initializationType = this.initialization.resolveTypeExpecting(initializationScope, fieldType)) != null) {
+ ((ArrayInitializer) this.initialization).binding = (ArrayBinding) initializationType;
+ this.initialization.computeConversion(initializationScope, fieldType, initializationType);
}
- } else if ((initializationTypeBinding = this.initialization.resolveType(initializationScope)) != null) {
-
- if (this.initialization.isConstantValueOfTypeAssignableToType(initializationTypeBinding, typeBinding)
- || (typeBinding.isBaseType() && BaseTypeBinding.isWidening(typeBinding.id, initializationTypeBinding.id))) {
-
- this.initialization.implicitWidening(typeBinding, initializationTypeBinding);
-
- } else if (initializationTypeBinding.isCompatibleWith(typeBinding)) {
- this.initialization.implicitWidening(typeBinding, initializationTypeBinding);
-
+ } else if ((initializationType = this.initialization.resolveType(initializationScope)) != null) {
+
+ if (this.initialization.isConstantValueOfTypeAssignableToType(initializationType, fieldType)
+ || (fieldType.isBaseType() && BaseTypeBinding.isWidening(fieldType.id, initializationType.id))
+ || initializationType.isCompatibleWith(fieldType)) {
+ this.initialization.computeConversion(initializationScope, fieldType, initializationType);
+ if (initializationType.isRawType() && (fieldType.isParameterizedType() || fieldType.isGenericType())) {
+ initializationScope.problemReporter().unsafeRawAssignment(this.initialization, initializationType, fieldType);
+ }
} else {
- initializationScope.problemReporter().typeMismatchError(initializationTypeBinding, typeBinding, this);
+ initializationScope.problemReporter().typeMismatchError(initializationType, fieldType, this);
}
if (this.binding.isFinal()){ // cast from constant actual type to variable type
this.binding.constant =
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java
index 9c4a86d5fc..7b9a750b9a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java
@@ -21,11 +21,16 @@ public class FieldReference extends Reference implements InvocationSite {
public Expression receiver;
public char[] token;
- public FieldBinding binding, codegenBinding;
+ public FieldBinding binding; // exact binding resulting from lookup
+ protected FieldBinding codegenBinding; // actual binding used for code generation (if no synthetic accessor)
+ public MethodBinding[] syntheticAccessors; // [0]=read accessor [1]=write accessor
+ public static final int READ = 0;
+ public static final int WRITE = 1;
+
public long nameSourcePosition; //(start<<32)+end
- MethodBinding syntheticReadAccessor, syntheticWriteAccessor;
public TypeBinding receiverType;
-
+ public TypeBinding genericCast;
+
public FieldReference(char[] source, long pos) {
token = source;
@@ -53,7 +58,7 @@ public class FieldReference extends Reference implements InvocationSite {
currentScope.problemReporter().uninitializedBlankFinalField(binding, this);
// we could improve error msg here telling "cannot use compound assignment on final blank field"
}
- manageSyntheticReadAccessIfNecessary(currentScope, flowInfo);
+ manageSyntheticAccessIfNecessary(currentScope, flowInfo, true /*read-access*/);
}
flowInfo =
receiver
@@ -66,7 +71,7 @@ public class FieldReference extends Reference implements InvocationSite {
.analyseCode(currentScope, flowContext, flowInfo)
.unconditionalInits();
}
- manageSyntheticWriteAccessIfNecessary(currentScope, flowInfo);
+ manageSyntheticAccessIfNecessary(currentScope, flowInfo, false /*write-access*/);
// check if assigning a final field
if (binding.isFinal()) {
@@ -109,7 +114,7 @@ public class FieldReference extends Reference implements InvocationSite {
receiver.analyseCode(currentScope, flowContext, flowInfo, !binding.isStatic());
if (valueRequired) {
- manageSyntheticReadAccessIfNecessary(currentScope, flowInfo);
+ manageSyntheticAccessIfNecessary(currentScope, flowInfo, true /*read-access*/);
}
return flowInfo;
}
@@ -133,11 +138,12 @@ public class FieldReference extends Reference implements InvocationSite {
fieldStore(
codeStream,
this.codegenBinding,
- syntheticWriteAccessor,
+ syntheticAccessors == null ? null : syntheticAccessors[WRITE],
valueRequired);
if (valueRequired) {
codeStream.generateImplicitConversion(assignment.implicitConversion);
}
+ // no need for generic cast as value got dupped
}
/**
@@ -165,17 +171,18 @@ public class FieldReference extends Reference implements InvocationSite {
if (this.codegenBinding.declaringClass == null) { // array length
codeStream.arraylength();
} else {
- if (syntheticReadAccessor == null) {
+ if (syntheticAccessors == null || syntheticAccessors[READ] == null) {
if (isStatic) {
codeStream.getstatic(this.codegenBinding);
} else {
codeStream.getfield(this.codegenBinding);
}
} else {
- codeStream.invokestatic(syntheticReadAccessor);
+ codeStream.invokestatic(syntheticAccessors[READ]);
}
}
codeStream.generateImplicitConversion(implicitConversion);
+ if (this.genericCast != null) codeStream.checkcast(this.genericCast);
} else {
if (!isStatic) {
codeStream.invokeObjectGetClass(); // perform null check
@@ -207,22 +214,23 @@ public class FieldReference extends Reference implements InvocationSite {
codeStream,
!(isStatic = this.codegenBinding.isStatic()));
if (isStatic) {
- if (syntheticReadAccessor == null) {
+ if (syntheticAccessors == null || syntheticAccessors[READ] == null) {
codeStream.getstatic(this.codegenBinding);
} else {
- codeStream.invokestatic(syntheticReadAccessor);
+ codeStream.invokestatic(syntheticAccessors[READ]);
}
} else {
codeStream.dup();
- if (syntheticReadAccessor == null) {
+ if (syntheticAccessors == null || syntheticAccessors[READ] == null) {
codeStream.getfield(this.codegenBinding);
} else {
- codeStream.invokestatic(syntheticReadAccessor);
+ codeStream.invokestatic(syntheticAccessors[READ]);
}
}
int operationTypeID;
if ((operationTypeID = implicitConversion >> 4) == T_String) {
- codeStream.generateStringAppend(currentScope, null, expression);
+ // no need for generic cast on previous #getfield since using Object string buffer methods.
+ codeStream.generateStringConcatenationAppend(currentScope, null, expression);
} else {
// promote the array reference to the suitable operation type
codeStream.generateImplicitConversion(implicitConversion);
@@ -240,8 +248,9 @@ public class FieldReference extends Reference implements InvocationSite {
fieldStore(
codeStream,
this.codegenBinding,
- syntheticWriteAccessor,
+ syntheticAccessors == null ? null : syntheticAccessors[WRITE],
valueRequired);
+ // no need for generic cast as value got dupped
}
public void generatePostIncrement(
@@ -256,17 +265,17 @@ public class FieldReference extends Reference implements InvocationSite {
codeStream,
!(isStatic = this.codegenBinding.isStatic()));
if (isStatic) {
- if (syntheticReadAccessor == null) {
+ if (syntheticAccessors == null || syntheticAccessors[READ] == null) {
codeStream.getstatic(this.codegenBinding);
} else {
- codeStream.invokestatic(syntheticReadAccessor);
+ codeStream.invokestatic(syntheticAccessors[READ]);
}
} else {
codeStream.dup();
- if (syntheticReadAccessor == null) {
+ if (syntheticAccessors == null || syntheticAccessors[READ] == null) {
codeStream.getfield(this.codegenBinding);
} else {
- codeStream.invokestatic(syntheticReadAccessor);
+ codeStream.invokestatic(syntheticAccessors[READ]);
}
}
if (valueRequired) {
@@ -292,9 +301,14 @@ public class FieldReference extends Reference implements InvocationSite {
codeStream.sendOperator(postIncrement.operator, this.codegenBinding.type.id);
codeStream.generateImplicitConversion(
postIncrement.assignmentImplicitConversion);
- fieldStore(codeStream, this.codegenBinding, syntheticWriteAccessor, false);
+ fieldStore(codeStream, this.codegenBinding, syntheticAccessors == null ? null : syntheticAccessors[WRITE], false);
+ }
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#genericTypeArguments()
+ */
+ public TypeBinding[] genericTypeArguments() {
+ return null;
}
-
public static final Constant getConstantFor(
FieldBinding binding,
Reference reference,
@@ -361,15 +375,30 @@ public class FieldReference extends Reference implements InvocationSite {
/*
* No need to emulate access to protected fields since not implicitly accessed
*/
- public void manageSyntheticReadAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
+ public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo, boolean isReadAccess) {
if (!flowInfo.isReachable()) return;
+ // if field from parameterized type got found, use the original field at codegen time
+ if (this.binding instanceof ParameterizedFieldBinding) {
+ ParameterizedFieldBinding parameterizedField = (ParameterizedFieldBinding) this.binding;
+ this.codegenBinding = parameterizedField.originalField;
+
+ // extra cast needed if field type has type variable
+ if ((this.codegenBinding.type.tagBits & TagBits.HasTypeVariable) != 0) {
+ this.genericCast = this.codegenBinding.type.genericCast(parameterizedField.type);
+ }
+ } else {
+ this.codegenBinding = this.binding;
+ }
+
if (binding.isPrivate()) {
if ((currentScope.enclosingSourceType() != binding.declaringClass)
&& (binding.constant == NotAConstant)) {
- syntheticReadAccessor =
- ((SourceTypeBinding) binding.declaringClass).addSyntheticMethod(binding, true);
- currentScope.problemReporter().needToEmulateFieldReadAccess(binding, this);
+ if (syntheticAccessors == null)
+ syntheticAccessors = new MethodBinding[2];
+ syntheticAccessors[isReadAccess ? READ : WRITE] =
+ ((SourceTypeBinding) binding.declaringClass).addSyntheticMethod(this.codegenBinding, isReadAccess);
+ currentScope.problemReporter().needToEmulateFieldAccess(this.codegenBinding, this, isReadAccess);
return;
}
@@ -379,8 +408,10 @@ public class FieldReference extends Reference implements InvocationSite {
SourceTypeBinding destinationType =
(SourceTypeBinding) (((QualifiedSuperReference) receiver)
.currentCompatibleType);
- syntheticReadAccessor = destinationType.addSyntheticMethod(binding, true);
- currentScope.problemReporter().needToEmulateFieldReadAccess(binding, this);
+ if (syntheticAccessors == null)
+ syntheticAccessors = new MethodBinding[2];
+ syntheticAccessors[isReadAccess ? READ : WRITE] = destinationType.addSyntheticMethod(this.codegenBinding, isReadAccess);
+ currentScope.problemReporter().needToEmulateFieldAccess(this.codegenBinding, this, isReadAccess);
return;
} else if (binding.isProtected()) {
@@ -393,86 +424,31 @@ public class FieldReference extends Reference implements InvocationSite {
SourceTypeBinding currentCompatibleType =
(SourceTypeBinding) enclosingSourceType.enclosingTypeAt(
(bits & DepthMASK) >> DepthSHIFT);
- syntheticReadAccessor = currentCompatibleType.addSyntheticMethod(binding, true);
- currentScope.problemReporter().needToEmulateFieldReadAccess(binding, this);
+ if (syntheticAccessors == null)
+ syntheticAccessors = new MethodBinding[2];
+ syntheticAccessors[isReadAccess ? READ : WRITE] = currentCompatibleType.addSyntheticMethod(this.codegenBinding, isReadAccess);
+ currentScope.problemReporter().needToEmulateFieldAccess(this.codegenBinding, this, isReadAccess);
return;
}
}
// if the binding declaring class is not visible, need special action
// for runtime compatibility on 1.2 VMs : change the declaring class of the binding
// NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
- if (binding.declaringClass != this.receiverType
+ if (this.binding.declaringClass != this.receiverType
&& !this.receiverType.isArrayType()
- && binding.declaringClass != null // array.length
- && binding.constant == NotAConstant
+ && this.binding.declaringClass != null // array.length
+ && this.binding.constant == NotAConstant
&& ((currentScope.environment().options.targetJDK >= ClassFileConstants.JDK1_2
- && binding.declaringClass.id != T_Object)
+ && this.binding.declaringClass.id != T_Object)
//no change for Object fields (in case there was)
- || !binding.declaringClass.canBeSeenBy(currentScope))) {
+ || !this.binding.declaringClass.canBeSeenBy(currentScope))) {
this.codegenBinding =
currentScope.enclosingSourceType().getUpdatedFieldBinding(
- binding,
- (ReferenceBinding) this.receiverType);
+ this.codegenBinding,
+ (ReferenceBinding) this.receiverType.erasure());
}
}
- /*
- * No need to emulate access to protected fields since not implicitly accessed
- */
- public void manageSyntheticWriteAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
-
- if (!flowInfo.isReachable()) return;
- if (binding.isPrivate()) {
- if (currentScope.enclosingSourceType() != binding.declaringClass) {
- syntheticWriteAccessor =
- ((SourceTypeBinding) binding.declaringClass).addSyntheticMethod(binding, false);
- currentScope.problemReporter().needToEmulateFieldWriteAccess(binding, this);
- return;
- }
-
- } else if (receiver instanceof QualifiedSuperReference) { // qualified super
-
- // qualified super need emulation always
- SourceTypeBinding destinationType =
- (SourceTypeBinding) (((QualifiedSuperReference) receiver)
- .currentCompatibleType);
- syntheticWriteAccessor = destinationType.addSyntheticMethod(binding, false);
- currentScope.problemReporter().needToEmulateFieldWriteAccess(binding, this);
- return;
-
- } else if (binding.isProtected()) {
-
- SourceTypeBinding enclosingSourceType;
- if (((bits & DepthMASK) != 0)
- && binding.declaringClass.getPackage()
- != (enclosingSourceType = currentScope.enclosingSourceType()).getPackage()) {
-
- SourceTypeBinding currentCompatibleType =
- (SourceTypeBinding) enclosingSourceType.enclosingTypeAt(
- (bits & DepthMASK) >> DepthSHIFT);
- syntheticWriteAccessor =
- currentCompatibleType.addSyntheticMethod(binding, false);
- currentScope.problemReporter().needToEmulateFieldWriteAccess(binding, this);
- return;
- }
- }
- // if the binding declaring class is not visible, need special action
- // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
- // NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
- if (binding.declaringClass != this.receiverType
- && !this.receiverType.isArrayType()
- && binding.declaringClass != null // array.length
- && binding.constant == NotAConstant
- && ((currentScope.environment().options.targetJDK >= ClassFileConstants.JDK1_2
- && binding.declaringClass.id != T_Object)
- //no change for Object fields (in case there was)
- || !binding.declaringClass.canBeSeenBy(currentScope))) {
- this.codegenBinding =
- currentScope.enclosingSourceType().getUpdatedFieldBinding(
- binding,
- (ReferenceBinding) this.receiverType);
- }
- }
public StringBuffer printExpression(int indent, StringBuffer output) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java
index 51c5db60fc..ccc81cdcc7 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java
@@ -221,9 +221,7 @@ public class ForStatement extends Statement {
// May loose some local variable initializations : affecting the local variable attributes
if (preCondInitStateIndex != -1) {
- codeStream.removeNotDefinitelyAssignedVariables(
- currentScope,
- preCondInitStateIndex);
+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, preCondInitStateIndex);
}
// generate the condition
@@ -290,7 +288,7 @@ public class ForStatement extends Statement {
initializations[i].resolve(scope);
if (condition != null) {
TypeBinding type = condition.resolveTypeExpecting(scope, BooleanBinding);
- condition.implicitWidening(type, type);
+ condition.computeConversion(scope, type, type);
}
if (increments != null)
for (int i = 0, length = increments.length; i < length; i++)
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java
new file mode 100644
index 0000000000..82222e1159
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java
@@ -0,0 +1,395 @@
+/*******************************************************************************
+ * 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.ASTVisitor;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
+import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
+import org.eclipse.jdt.internal.compiler.codegen.Label;
+import org.eclipse.jdt.internal.compiler.flow.FlowContext;
+import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
+import org.eclipse.jdt.internal.compiler.flow.LoopingFlowContext;
+import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
+import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
+import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
+import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
+import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding;
+import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
+import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
+import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
+
+public class ForeachStatement extends Statement {
+
+ public LocalDeclaration elementVariable;
+ public int elementVariableImplicitWidening = -1;
+ public Expression collection;
+ public Statement action;
+
+ // set the kind of foreach
+ private int kind;
+ // possible kinds of iterating behavior
+ private static final int ARRAY = 0;
+ private static final int RAW_ITERABLE = 1;
+ private static final int GENERIC_ITERABLE = 2;
+
+ private int arrayElementTypeID;
+
+ // loop labels
+ private Label breakLabel;
+ private Label continueLabel;
+
+ public BlockScope scope;
+
+ // secret variables for codegen
+ public LocalVariableBinding indexVariable;
+ public LocalVariableBinding collectionVariable; // to store the collection expression value
+ public LocalVariableBinding maxVariable;
+ // secret variable names
+ private static final char[] SecretIndexVariableName = " index".toCharArray(); //$NON-NLS-1$
+ private static final char[] SecretCollectionVariableName = " collection".toCharArray(); //$NON-NLS-1$
+ private static final char[] SecretMaxVariableName = " max".toCharArray(); //$NON-NLS-1$
+
+ int postCollectionInitStateIndex = -1;
+ int mergedInitStateIndex = -1;
+
+ public ForeachStatement(
+ LocalDeclaration elementVariable,
+ Expression collection,
+ int start) {
+
+ this.elementVariable = elementVariable;
+ this.collection = collection;
+ this.sourceStart = start;
+ this.kind = -1;
+ }
+
+ public FlowInfo analyseCode(
+ BlockScope currentScope,
+ FlowContext flowContext,
+ FlowInfo flowInfo) {
+ // initialize break and continue labels
+ breakLabel = new Label();
+ continueLabel = new Label();
+
+ // process the element variable and collection
+ flowInfo = this.elementVariable.analyseCode(scope, flowContext, flowInfo);
+ flowInfo = this.collection.analyseCode(scope, flowContext, flowInfo);
+
+ // element variable will be assigned when iterating
+ flowInfo.markAsDefinitelyAssigned(this.elementVariable.binding);
+
+ this.postCollectionInitStateIndex = currentScope.methodScope().recordInitializationStates(flowInfo);
+
+ // process the action
+ LoopingFlowContext loopingContext = new LoopingFlowContext(flowContext, this, breakLabel, continueLabel, scope);
+ FlowInfo actionInfo = flowInfo.initsWhenTrue().copy();
+ if (!(action == null || (action.isEmptyBlock()
+ && currentScope.environment().options.complianceLevel <= ClassFileConstants.JDK1_3))) {
+
+ if (!this.action.complainIfUnreachable(actionInfo, scope, false)) {
+ actionInfo = action.analyseCode(scope, loopingContext, actionInfo);
+ }
+
+ // code generation can be optimized when no need to continue in the loop
+ if (!actionInfo.isReachable() && !loopingContext.initsOnContinue.isReachable()) {
+ continueLabel = null;
+ } else {
+ actionInfo = actionInfo.mergedWith(loopingContext.initsOnContinue.unconditionalInits());
+ loopingContext.complainOnFinalAssignmentsInLoop(scope, actionInfo);
+ }
+ }
+
+ // we need the variable to iterate the collection even if the
+ // element variable is not used
+ if (!(this.action == null
+ || this.action.isEmptyBlock()
+ || ((this.action.bits & IsUsefulEmptyStatementMASK) != 0))) {
+ switch(this.kind) {
+ case ARRAY :
+ this.collectionVariable.useFlag = LocalVariableBinding.USED;
+ this.indexVariable.useFlag = LocalVariableBinding.USED;
+ this.maxVariable.useFlag = LocalVariableBinding.USED;
+ break;
+ case RAW_ITERABLE :
+ case GENERIC_ITERABLE :
+ this.collectionVariable.useFlag = LocalVariableBinding.USED;
+ this.indexVariable.useFlag = LocalVariableBinding.USED;
+ break;
+ }
+ }
+ //end of loop
+ FlowInfo mergedInfo = FlowInfo.mergedOptimizedBranches(
+ loopingContext.initsOnBreak,
+ false,
+ flowInfo.initsWhenFalse(),
+ false,
+ true /*for(;;){}while(true); unreachable(); */);
+ return mergedInfo;
+ }
+
+ /**
+ * For statement code generation
+ *
+ * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
+ * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
+ */
+ public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+
+ if ((bits & IsReachableMASK) == 0) {
+ return;
+ }
+ int pc = codeStream.position;
+ if (this.action == null
+ || this.action.isEmptyBlock()
+ || ((this.action.bits & IsUsefulEmptyStatementMASK) != 0)) {
+ codeStream.exitUserScope(scope);
+ if (mergedInitStateIndex != -1) {
+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, mergedInitStateIndex);
+ codeStream.addDefinitelyAssignedVariables(currentScope, mergedInitStateIndex);
+ }
+ codeStream.recordPositionsFrom(pc, this.sourceStart);
+ return;
+ }
+ // generate the initializations
+ switch(this.kind) {
+ case ARRAY :
+ collection.generateCode(scope, codeStream, true);
+ codeStream.store(this.collectionVariable, false);
+ codeStream.iconst_0();
+ codeStream.store(this.indexVariable, false);
+ codeStream.load(this.collectionVariable);
+ codeStream.arraylength();
+ codeStream.store(this.maxVariable, false);
+ break;
+ case RAW_ITERABLE :
+ case GENERIC_ITERABLE :
+ collection.generateCode(scope, codeStream, true);
+ codeStream.dup();
+ codeStream.store(this.collectionVariable, false);
+ // declaringClass.iterator();
+ final TypeBinding collectionTypeBinding = collection.resolvedType;
+ MethodBinding iteratorMethodBinding =
+ new MethodBinding(
+ AccPublic,
+ "iterator".toCharArray(),//$NON-NLS-1$
+ scope.getJavaUtilIterator(),
+ TypeConstants.NoParameters,
+ TypeConstants.NoExceptions,
+ (ReferenceBinding) collectionTypeBinding);
+ if (collectionTypeBinding.isInterface()) {
+ codeStream.invokeinterface(iteratorMethodBinding);
+ } else {
+ codeStream.invokevirtual(iteratorMethodBinding);
+ }
+ codeStream.store(this.indexVariable, false);
+ break;
+ }
+
+ // label management
+ Label actionLabel = new Label(codeStream);
+ Label conditionLabel = new Label(codeStream);
+ breakLabel.initialize(codeStream);
+ if (this.continueLabel != null) {
+ this.continueLabel.initialize(codeStream);
+ }
+ // jump over the actionBlock
+ codeStream.goto_(conditionLabel);
+
+ // generate the loop action
+ actionLabel.place();
+
+ // generate the loop action
+ if (this.elementVariable.binding.resolvedPosition != -1) {
+ switch(this.kind) {
+ case ARRAY :
+ codeStream.load(this.collectionVariable);
+ codeStream.load(this.indexVariable);
+ codeStream.arrayAt(this.arrayElementTypeID);
+ if (this.elementVariableImplicitWidening != -1) {
+ codeStream.generateImplicitConversion(this.elementVariableImplicitWidening);
+ }
+ codeStream.store(this.elementVariable.binding, false);
+ break;
+ case RAW_ITERABLE :
+ case GENERIC_ITERABLE :
+ codeStream.load(this.indexVariable);
+ codeStream.invokeJavaUtilIteratorNext();
+ if (this.elementVariable.binding.type.id != T_JavaLangObject) {
+ codeStream.checkcast(this.elementVariable.binding.type);
+ }
+ codeStream.store(this.elementVariable.binding, false);
+ break;
+ }
+ codeStream.addVisibleLocalVariable(this.elementVariable.binding);
+ if (this.postCollectionInitStateIndex != -1) {
+ codeStream.addDefinitelyAssignedVariables(
+ currentScope,
+ this.postCollectionInitStateIndex);
+ }
+ }
+ this.action.generateCode(scope, codeStream);
+
+ // continuation point
+ int continuationPC = codeStream.position;
+ if (this.continueLabel != null) {
+ this.continueLabel.place();
+ // generate the increments for next iteration
+ switch(this.kind) {
+ case ARRAY :
+ codeStream.iinc(this.indexVariable.resolvedPosition, 1);
+ break;
+ case RAW_ITERABLE :
+ case GENERIC_ITERABLE :
+ break;
+ }
+ }
+ // generate the condition
+ conditionLabel.place();
+ if (this.postCollectionInitStateIndex != -1) {
+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, postCollectionInitStateIndex);
+ }
+ switch(this.kind) {
+ case ARRAY :
+ codeStream.load(this.indexVariable);
+ codeStream.load(this.maxVariable);
+ codeStream.if_icmplt(actionLabel);
+ break;
+ case RAW_ITERABLE :
+ case GENERIC_ITERABLE :
+ codeStream.load(this.indexVariable);
+ codeStream.invokeJavaUtilIteratorHasNext();
+ codeStream.ifne(actionLabel);
+ break;
+ }
+ codeStream.recordPositionsFrom(continuationPC, this.elementVariable.sourceStart);
+
+ breakLabel.place();
+ codeStream.exitUserScope(scope);
+ if (mergedInitStateIndex != -1) {
+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, mergedInitStateIndex);
+ codeStream.addDefinitelyAssignedVariables(currentScope, mergedInitStateIndex);
+ }
+ codeStream.recordPositionsFrom(pc, this.sourceStart);
+ }
+
+ public StringBuffer printStatement(int tab, StringBuffer output) {
+
+ printIndent(tab, output).append("for ("); //$NON-NLS-1$
+ this.elementVariable.print(0, output);
+ output.append(" : ");//$NON-NLS-1$
+ this.collection.print(0, output).append(") "); //$NON-NLS-1$
+ //block
+ if (this.action == null) {
+ output.append(';');
+ } else {
+ output.append('\n');
+ this.action.printStatement(tab + 1, output); //$NON-NLS-1$
+ }
+ return output;
+ }
+
+ public void resolve(BlockScope upperScope) {
+ // use the scope that will hold the init declarations
+ scope = new BlockScope(upperScope);
+ this.elementVariable.resolve(scope); // collection expression can see itemVariable
+ TypeBinding elementType = this.elementVariable.type.resolvedType;
+ TypeBinding collectionType = this.collection.resolveType(scope);
+ boolean hasError = elementType == null || collectionType == null;
+
+ if (!hasError) {
+ if (collectionType.isArrayType()) { // for(E e : E[])
+ this.kind = ARRAY;
+ TypeBinding collectionElementType = ((ArrayBinding) collectionType).elementsType();
+ if (!collectionElementType.isCompatibleWith(elementType)) {
+ scope.problemReporter().notCompatibleTypesErrorInForeach(collection, collectionElementType, elementType);
+ }
+ // in case we need to do a conversion
+ this.arrayElementTypeID = collectionElementType.id;
+ if (elementType.isBaseType()) {
+ this.elementVariableImplicitWidening = (elementType.id << 4) + this.arrayElementTypeID;
+ }
+ } else if (collectionType instanceof ReferenceBinding) {
+ ReferenceBinding iterableType = ((ReferenceBinding)collectionType).findSuperTypeErasingTo(scope.getJavaLangIterable());
+ if (iterableType != null) {
+ if (iterableType.isParameterizedType()) { // for(E e : Iterable<E>)
+ ParameterizedTypeBinding parameterizedType = (ParameterizedTypeBinding)iterableType;
+ if (parameterizedType.arguments.length == 1) { // per construction can only be one
+ this.kind = GENERIC_ITERABLE;
+ TypeBinding collectionElementType = parameterizedType.arguments[0];
+ if (!collectionElementType.isCompatibleWith(elementType)) {
+ scope.problemReporter().notCompatibleTypesErrorInForeach(collection, collectionElementType, elementType);
+ }
+ // no conversion needed as only for reference types
+ }
+ } else if (iterableType.isGenericType()) { // for (T t : Iterable<T>) - in case used inside Iterable itself
+ if (iterableType.typeVariables().length == 1) {
+ this.kind = GENERIC_ITERABLE;
+ TypeBinding collectionElementType = iterableType.typeVariables()[0];
+ if (!collectionElementType.isCompatibleWith(elementType)) {
+ scope.problemReporter().notCompatibleTypesErrorInForeach(collection, collectionElementType, elementType);
+ }
+ }
+ } else if (iterableType.isRawType()) { // for(Object o : Iterable)
+ this.kind = RAW_ITERABLE;
+ TypeBinding collectionElementType = scope.getJavaLangObject();
+ if (!collectionElementType.isCompatibleWith(elementType)) {
+ scope.problemReporter().notCompatibleTypesErrorInForeach(collection, collectionElementType, elementType);
+ }
+ // no conversion needed as only for reference types
+ }
+ }
+ }
+ switch(this.kind) {
+ case ARRAY :
+ // allocate #index secret variable (of type int)
+ this.indexVariable = new LocalVariableBinding(SecretIndexVariableName, IntBinding, AccDefault, false);
+ scope.addLocalVariable(this.indexVariable);
+ this.indexVariable.constant = NotAConstant; // not inlinable
+
+ // allocate #max secret variable
+ this.maxVariable = new LocalVariableBinding(SecretMaxVariableName, IntBinding, AccDefault, false);
+ scope.addLocalVariable(this.maxVariable);
+ this.maxVariable.constant = NotAConstant; // not inlinable
+ break;
+ case RAW_ITERABLE :
+ case GENERIC_ITERABLE :
+ // allocate #index secret variable (of type Iterator)
+ this.indexVariable = new LocalVariableBinding(SecretIndexVariableName, scope.getJavaUtilIterator(), AccDefault, false);
+ scope.addLocalVariable(this.indexVariable);
+ this.indexVariable.constant = NotAConstant; // not inlinable
+ break;
+ default :
+ scope.problemReporter().invalidTypeForCollection(collection);
+ }
+ // add #array secret variable (of collection type)
+ this.collectionVariable = new LocalVariableBinding(SecretCollectionVariableName, collectionType, AccDefault, false);
+ scope.addLocalVariable(this.collectionVariable);
+ this.collectionVariable.constant = NotAConstant; // not inlinable
+ }
+ if (action != null) {
+ action.resolve(scope);
+ }
+ }
+
+ public void traverse(
+ ASTVisitor visitor,
+ BlockScope blockScope) {
+
+ if (visitor.visit(this, blockScope)) {
+ this.elementVariable.traverse(visitor, scope);
+ this.collection.traverse(visitor, scope);
+ if (action != null) {
+ action.traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, blockScope);
+ }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java
index a26210434f..baaa9113d5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java
@@ -152,9 +152,7 @@ public class IfStatement extends Statement {
true);
// May loose some local variable initializations : affecting the local variable attributes
if (thenInitStateIndex != -1) {
- codeStream.removeNotDefinitelyAssignedVariables(
- currentScope,
- thenInitStateIndex);
+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, thenInitStateIndex);
codeStream.addDefinitelyAssignedVariables(currentScope, thenInitStateIndex);
}
// generate then statement
@@ -221,7 +219,7 @@ public class IfStatement extends Statement {
public void resolve(BlockScope scope) {
TypeBinding type = condition.resolveTypeExpecting(scope, BooleanBinding);
- condition.implicitWidening(type, type);
+ condition.computeConversion(scope, type, type);
if (thenStatement != null)
thenStatement.resolve(scope);
if (elseStatement != null)
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImplicitDocTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImplicitDocTypeReference.java
index 9dda67ee74..546e57c7b9 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImplicitDocTypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImplicitDocTypeReference.java
@@ -11,6 +11,7 @@
package org.eclipse.jdt.internal.compiler.ast;
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.Scope;
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
@@ -34,7 +35,7 @@ public class ImplicitDocTypeReference extends TypeReference {
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.compiler.ast.TypeReference#getTypeBinding(org.eclipse.jdt.internal.compiler.lookup.Scope)
*/
- public TypeBinding getTypeBinding(Scope scope) {
+ protected TypeBinding getTypeBinding(Scope scope) {
this.constant = NotAConstant;
return this.resolvedType = scope.enclosingSourceType();
}
@@ -52,6 +53,12 @@ public class ImplicitDocTypeReference extends TypeReference {
return true;
}
/* (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 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) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImportReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImportReference.java
index 4623b2dcc7..3601f29880 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImportReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImportReference.java
@@ -23,6 +23,7 @@ public class ImportReference extends ASTNode {
public int declarationSourceEnd;
public boolean used;
public int modifiers; // 1.5 addition for static imports
+ public Annotation[] annotations;
public ImportReference(
char[][] tokens,
@@ -67,6 +68,11 @@ public class ImportReference extends ASTNode {
public void traverse(ASTVisitor visitor, CompilationUnitScope scope) {
visitor.visit(this, scope);
+ if (this.annotations != null) {
+ int annotationsLength = this.annotations.length;
+ for (int i = 0; i < annotationsLength; i++)
+ this.annotations[i].traverse(visitor, scope);
+ }
visitor.endVisit(this, scope);
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java
index feacdaf870..86daa03291 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java
@@ -76,17 +76,17 @@ public class InstanceOfExpression extends OperatorExpression {
if (castType.isArrayType()) {
//------- (castType.isArray) expressionType.isArray -----------
- TypeBinding exprElementType = ((ArrayBinding) expressionType).elementsType(scope);
+ TypeBinding exprElementType = ((ArrayBinding) expressionType).elementsType();
if (exprElementType.isBaseType()) {
// <---stop the recursion-------
- if (((ArrayBinding) castType).elementsType(scope) != exprElementType)
+ if (((ArrayBinding) castType).elementsType() != exprElementType)
scope.problemReporter().notCompatibleTypesError(this, expressionType, castType);
return true;
}
// recursively on the elements...
return checkCastTypesCompatibility(
scope,
- ((ArrayBinding) castType).elementsType(scope),
+ ((ArrayBinding) castType).elementsType(),
exprElementType);
} else if (
castType.isClass()) {
@@ -201,13 +201,17 @@ public class InstanceOfExpression extends OperatorExpression {
constant = NotAConstant;
TypeBinding expressionType = expression.resolveType(scope);
- TypeBinding checkType = type.resolveType(scope);
- if (expressionType == null || checkType == null)
+ TypeBinding checkedType = type.resolveType(scope);
+ if (expressionType == null || checkedType == null)
return null;
- boolean necessary = checkCastTypesCompatibility(scope, checkType, expressionType);
- if (!necessary) {
- scope.problemReporter().unnecessaryInstanceof(this, checkType);
+ if (checkedType.isTypeVariable() || checkedType.isParameterizedType() || checkedType.isGenericType()) {
+ scope.problemReporter().illegalInstanceOfGenericType(checkedType, this);
+ } else {
+ boolean necessary = checkCastTypesCompatibility(scope, checkedType, expressionType);
+ if (!necessary) {
+ scope.problemReporter().unnecessaryInstanceof(this, checkedType);
+ }
}
return this.resolvedType = BooleanBinding;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java
index 6c7ff1feda..553c636c5e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java
@@ -85,7 +85,7 @@ public class JavadocAllocationExpression extends AllocationExpression {
if (isMethodUseDeprecated(this.binding, scope)) {
scope.problemReporter().javadocDeprecatedMethod(this.binding, this, scope.getDeclarationModifiers());
}
-
+ // TODO (frederic) add support for unsafe type operation warning
return allocationType;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java
index 57be26e86e..e3e8c3826e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java
@@ -26,7 +26,7 @@ public class JavadocArgumentExpression extends Expression {
this.sourceStart = startPos;
this.sourceEnd = endPos;
long pos = (((long) startPos) << 32) + endPos;
- this.argument = new Argument(name, pos, typeRef, IConstants.AccDefault);
+ this.argument = new Argument(name, pos, typeRef, IConstants.AccDefault, false);
this.bits |= InsideJavadoc;
}
@@ -54,6 +54,15 @@ public class JavadocArgumentExpression extends Expression {
scope.problemReporter().javadocDeprecatedType(this.resolvedType, typeRef, scope.getDeclarationModifiers());
return null;
}
+ // check raw type
+ if (this.resolvedType.isArrayType()) {
+ TypeBinding leafComponentType = this.resolvedType.leafComponentType();
+ if (leafComponentType.isGenericType()) { // raw type
+ this.resolvedType = scope.createArrayType(scope.environment().createRawType((ReferenceBinding)leafComponentType, null), this.resolvedType.dimensions());
+ }
+ } else if (this.resolvedType.isGenericType()) {
+ this.resolvedType = scope.environment().createRawType((ReferenceBinding)this.resolvedType, null); // raw type
+ }
return this.resolvedType;
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArrayQualifiedTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArrayQualifiedTypeReference.java
index 86b4d0ef19..e2c44c4687 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArrayQualifiedTypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArrayQualifiedTypeReference.java
@@ -12,6 +12,7 @@ package org.eclipse.jdt.internal.compiler.ast;
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.Scope;
@@ -39,4 +40,9 @@ public class JavadocArrayQualifiedTypeReference extends ArrayQualifiedTypeRefere
visitor.visit(this, scope);
visitor.endVisit(this, scope);
}
+
+ public void traverse(ASTVisitor visitor, ClassScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArraySingleTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArraySingleTypeReference.java
index 8395065f3e..67cde846f3 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArraySingleTypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArraySingleTypeReference.java
@@ -12,6 +12,7 @@ package org.eclipse.jdt.internal.compiler.ast;
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.Scope;
@@ -37,4 +38,9 @@ public class JavadocArraySingleTypeReference extends ArrayTypeReference {
visitor.visit(this, scope);
visitor.endVisit(this, scope);
}
+
+ public void traverse(ASTVisitor visitor, ClassScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java
index ec6913678e..1f0fa667c7 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java
@@ -108,7 +108,7 @@ public class JavadocMessageSend extends MessageSend {
// record the closest match, for clients who may still need hint about possible method match
if (this.binding instanceof ProblemMethodBinding){
MethodBinding closestMatch = ((ProblemMethodBinding)this.binding).closestMatch;
- if (closestMatch != null) this.codegenBinding = this.binding = closestMatch;
+ if (closestMatch != null) this.binding = closestMatch;
}
return this.resolvedType = this.binding == null ? null : this.binding.returnType;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java
index 388f8ef989..95f9a8b519 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java
@@ -15,6 +15,7 @@ import org.eclipse.jdt.internal.compiler.lookup.Binding;
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
import org.eclipse.jdt.internal.compiler.lookup.PackageBinding;
+import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
import org.eclipse.jdt.internal.compiler.lookup.Scope;
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
@@ -47,9 +48,13 @@ public class JavadocQualifiedTypeReference extends QualifiedTypeReference {
visitor.visit(this, scope);
visitor.endVisit(this, scope);
}
+ public void traverse(ASTVisitor visitor, ClassScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
/*
- *
+ *
*/
private TypeBinding internalResolveType(Scope scope) {
// handle the error here
@@ -71,6 +76,15 @@ public class JavadocQualifiedTypeReference extends QualifiedTypeReference {
if (isTypeUseDeprecated(this.resolvedType, scope)) {
reportDeprecatedType(scope);
}
+ // check raw type
+ if (this.resolvedType.isArrayType()) {
+ TypeBinding leafComponentType = this.resolvedType.leafComponentType();
+ if (leafComponentType.isGenericType()) { // raw type
+ return this.resolvedType = scope.createArrayType(scope.environment().createRawType((ReferenceBinding)leafComponentType, null), this.resolvedType.dimensions());
+ }
+ } else if (this.resolvedType.isGenericType()) {
+ return this.resolvedType = scope.environment().createRawType((ReferenceBinding)this.resolvedType, null); // raw type
+ }
}
return this.resolvedType;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java
index 541f0998a8..28bd80da67 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java
@@ -15,6 +15,7 @@ import org.eclipse.jdt.internal.compiler.lookup.Binding;
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
import org.eclipse.jdt.internal.compiler.lookup.PackageBinding;
+import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
import org.eclipse.jdt.internal.compiler.lookup.Scope;
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
@@ -46,7 +47,11 @@ public class JavadocSingleTypeReference extends SingleTypeReference {
visitor.visit(this, scope);
visitor.endVisit(this, scope);
}
-
+
+ public void traverse(ASTVisitor visitor, ClassScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
/*
*
*/
@@ -71,6 +76,15 @@ public class JavadocSingleTypeReference extends SingleTypeReference {
if (isTypeUseDeprecated(this.resolvedType, scope)) {
reportDeprecatedType(scope);
}
+ // check raw type
+ if (this.resolvedType.isArrayType()) {
+ TypeBinding leafComponentType = this.resolvedType.leafComponentType();
+ if (leafComponentType.isGenericType()) { // raw type
+ return this.resolvedType = scope.createArrayType(scope.environment().createRawType((ReferenceBinding)leafComponentType, null), this.resolvedType.dimensions());
+ }
+ } else if (this.resolvedType.isGenericType()) {
+ return this.resolvedType = scope.environment().createRawType((ReferenceBinding)this.resolvedType, null); // raw type
+ }
}
return this.resolvedType;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java
index 353fc00acb..849dc5b7dc 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java
@@ -134,16 +134,16 @@ public class LocalDeclaration extends AbstractVariableDeclaration {
public void resolve(BlockScope scope) {
// create a binding and add it to the scope
- TypeBinding typeBinding = type.resolveType(scope);
+ TypeBinding variableType = type.resolveType(scope);
checkModifiers();
- if (typeBinding != null) {
- if (typeBinding == VoidBinding) {
+ if (variableType != null) {
+ if (variableType == VoidBinding) {
scope.problemReporter().variableTypeCannotBeVoid(this);
return;
}
- if (typeBinding.isArrayType() && ((ArrayBinding) typeBinding).leafComponentType == VoidBinding) {
+ if (variableType.isArrayType() && ((ArrayBinding) variableType).leafComponentType == VoidBinding) {
scope.problemReporter().variableTypeCannotBeVoidArray(this);
return;
}
@@ -164,14 +164,14 @@ public class LocalDeclaration extends AbstractVariableDeclaration {
if ((modifiers & AccFinal)!= 0 && this.initialization == null) {
modifiers |= AccBlankFinal;
}
- binding = new LocalVariableBinding(this, typeBinding, modifiers, false);
+ binding = new LocalVariableBinding(this, variableType, modifiers, false);
scope.addLocalVariable(binding);
binding.constant = NotAConstant;
// allow to recursivelly target the binding....
// the correct constant is harmed if correctly computed at the end of this method
}
- if (typeBinding == null) {
+ if (variableType == null) {
if (initialization != null)
initialization.resolveType(scope); // want to report all possible errors
return;
@@ -180,20 +180,25 @@ public class LocalDeclaration extends AbstractVariableDeclaration {
// store the constant for final locals
if (initialization != null) {
if (initialization instanceof ArrayInitializer) {
- TypeBinding initializationType = initialization.resolveTypeExpecting(scope, typeBinding);
+ TypeBinding initializationType = initialization.resolveTypeExpecting(scope, variableType);
if (initializationType != null) {
((ArrayInitializer) initialization).binding = (ArrayBinding) initializationType;
- initialization.implicitWidening(typeBinding, initializationType);
+ initialization.computeConversion(scope, variableType, initializationType);
}
} else {
- TypeBinding initializationType = initialization.resolveType(scope);
+ this.initialization.setExpectedType(variableType);
+ TypeBinding initializationType = this.initialization.resolveType(scope);
if (initializationType != null) {
- if (initialization.isConstantValueOfTypeAssignableToType(initializationType, typeBinding)
- || (typeBinding.isBaseType() && BaseTypeBinding.isWidening(typeBinding.id, initializationType.id))
- || initializationType.isCompatibleWith(typeBinding))
- initialization.implicitWidening(typeBinding, initializationType);
- else
- scope.problemReporter().typeMismatchError(initializationType, typeBinding, this);
+ if (initialization.isConstantValueOfTypeAssignableToType(initializationType, variableType)
+ || (variableType.isBaseType() && BaseTypeBinding.isWidening(variableType.id, initializationType.id))
+ || initializationType.isCompatibleWith(variableType)) {
+ this.initialization.computeConversion(scope, variableType, initializationType);
+ if (initializationType.isRawType() && (variableType.isParameterizedType() || variableType.isGenericType())) {
+ scope.problemReporter().unsafeRawAssignment(this.initialization, initializationType, variableType);
+ }
+ } else {
+ scope.problemReporter().typeMismatchError(initializationType, variableType, this);
+ }
}
}
@@ -203,7 +208,7 @@ public class LocalDeclaration extends AbstractVariableDeclaration {
if (binding != null) {
binding.constant =
binding.isFinal()
- ? initialization.constant.castTo((typeBinding.id << 4) + initialization.constant.typeID())
+ ? initialization.constant.castTo((variableType.id << 4) + initialization.constant.typeID())
: NotAConstant;
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java
new file mode 100644
index 0000000000..1f016d344e
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java
@@ -0,0 +1,42 @@
+/*
+ * Created on 2004-03-11
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.eclipse.jdt.internal.compiler.ast;
+
+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;
+
+public class MarkerAnnotation extends Annotation {
+
+ public MarkerAnnotation(char[][] tokens, long[] sourcePositions, int sourceStart) {
+ this.tokens = tokens;
+ this.sourcePositions = sourcePositions;
+ this.sourceStart = sourceStart;
+ this.sourceEnd = (int) sourcePositions[sourcePositions.length - 1];
+ }
+
+ public MarkerAnnotation(char[] token, long sourcePosition, int sourceStart) {
+ this.tokens = new char[][] { token };
+ this.sourcePositions = new long[] { sourcePosition };
+ this.sourceStart = sourceStart;
+ this.sourceEnd = (int) sourcePosition;
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
+ public void traverse(ASTVisitor visitor, ClassScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
+ public void traverse(ASTVisitor visitor, CompilationUnitScope scope) {
+ visitor.visit(this, scope);
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValueArrayInitializer.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValueArrayInitializer.java
new file mode 100644
index 0000000000..32c7d0173a
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValueArrayInitializer.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * MemberValueArrayInitializer node
+ */
+public class MemberValueArrayInitializer extends Expression {
+
+ public Expression[] memberValues;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.compiler.ast.Expression#printExpression(int, java.lang.StringBuffer)
+ */
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+ output.append('{');
+ if (this.memberValues != null) {
+ int j = 2 ;
+ for (int i = 0 ; i < this.memberValues.length ; i++) {
+ if (i > 0) output.append(", "); //$NON-NLS-1$
+ this.memberValues[i].printExpression(0, output);
+ j -- ;
+ if (j == 0) {
+ output.append('\n');
+ printIndent(indent+1, output);
+ j = 2;
+ }
+ }
+ }
+ return output.append('}');
+ }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java
new file mode 100644
index 0000000000..908739565e
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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.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;
+
+/**
+ * MemberValuePair node
+ */
+public class MemberValuePair extends ASTNode {
+
+ public char[] token;
+ public Expression value;
+
+ public MemberValuePair(char[] token, int sourceStart, int sourceEnd, Expression value) {
+ this.token = token;
+ this.sourceStart = sourceStart;
+ this.sourceEnd = sourceEnd;
+ this.value = value;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.compiler.ast.ASTNode#print(int, java.lang.StringBuffer)
+ */
+ public StringBuffer print(int indent, StringBuffer output) {
+ output
+ .append(token)
+ .append(" = "); //$NON-NLS-1$
+ value.print(indent, output);
+ return output;
+ }
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ if (this.value != null) {
+ this.value.traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+ public void traverse(ASTVisitor visitor, ClassScope scope) {
+ if (visitor.visit(this, scope)) {
+ if (this.value != null) {
+ this.value.traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+ public void traverse(ASTVisitor visitor, CompilationUnitScope scope) {
+ if (visitor.visit(this, scope)) {
+ if (this.value != null) {
+ this.value.traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
index a9a2e9df41..f796d0daa8 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
@@ -18,16 +18,21 @@ import org.eclipse.jdt.internal.compiler.codegen.*;
import org.eclipse.jdt.internal.compiler.lookup.*;
public class MessageSend extends Expression implements InvocationSite {
+
public Expression receiver ;
public char[] selector ;
public Expression[] arguments ;
- public MethodBinding binding, codegenBinding;
+ public MethodBinding binding; // exact binding resulting from lookup
+ protected MethodBinding codegenBinding; // actual binding used for code generation (if no synthetic accessor)
+ MethodBinding syntheticAccessor; // synthetic accessor for inner-emulation
+ public TypeBinding expectedType; // for generic method invocation (return type inference)
public long nameSourcePosition ; //(start<<32)+end
- MethodBinding syntheticAccessor;
-
public TypeBinding receiverType, qualifyingType;
+ public TypeBinding genericCast;
+ public TypeReference[] typeArguments;
+ public TypeBinding[] genericTypeArguments;
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
@@ -59,7 +64,7 @@ public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean
int pc = codeStream.position;
// generate receiver/enclosing instance access
- boolean isStatic = codegenBinding.isStatic();
+ boolean isStatic = this.codegenBinding.isStatic();
// outer access ?
if (!isStatic && ((bits & DepthMASK) != 0) && receiver.isImplicitThis()){
// outer method can be reached through emulation if implicit access
@@ -78,15 +83,15 @@ public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean
// actual message invocation
if (syntheticAccessor == null){
if (isStatic){
- codeStream.invokestatic(codegenBinding);
+ codeStream.invokestatic(this.codegenBinding);
} else {
- if( (receiver.isSuper()) || codegenBinding.isPrivate()){
- codeStream.invokespecial(codegenBinding);
+ if( (receiver.isSuper()) || this.codegenBinding.isPrivate()){
+ codeStream.invokespecial(this.codegenBinding);
} else {
- if (codegenBinding.declaringClass.isInterface()){
- codeStream.invokeinterface(codegenBinding);
+ if (this.codegenBinding.declaringClass.isInterface()){
+ codeStream.invokeinterface(this.codegenBinding);
} else {
- codeStream.invokevirtual(codegenBinding);
+ codeStream.invokevirtual(this.codegenBinding);
}
}
}
@@ -97,6 +102,7 @@ public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean
if (valueRequired){
// implicit conversion if necessary
codeStream.generateImplicitConversion(implicitConversion);
+ if (this.genericCast != null) codeStream.checkcast(this.genericCast);
} else {
// pop return value if any
switch(binding.returnType.id){
@@ -112,6 +118,12 @@ public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean
}
codeStream.recordPositionsFrom(pc, (int)(this.nameSourcePosition >>> 32)); // highlight selector
}
+/**
+ * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#genericTypeArguments()
+ */
+public TypeBinding[] genericTypeArguments() {
+ return this.genericTypeArguments;
+}
public boolean isSuperAccess() {
return receiver.isSuper();
}
@@ -121,13 +133,22 @@ public boolean isTypeAccess() {
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo){
if (!flowInfo.isReachable()) return;
- if (binding.isPrivate()){
+
+ // if method from parameterized type got found, use the original method at codegen time
+ this.codegenBinding = this.binding.original();
+ if (this.codegenBinding != this.binding) {
+ // extra cast needed if method return type has type variable
+ if ((this.codegenBinding.returnType.tagBits & TagBits.HasTypeVariable) != 0) {
+ this.genericCast = this.codegenBinding.returnType.genericCast(this.binding.returnType);
+ }
+ }
+ if (this.binding.isPrivate()){
// depth is set for both implicit and explicit access (see MethodBinding#canBeSeenBy)
if (currentScope.enclosingSourceType() != binding.declaringClass){
- syntheticAccessor = ((SourceTypeBinding)binding.declaringClass).addSyntheticMethod(binding, isSuperAccess());
- currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
+ syntheticAccessor = ((SourceTypeBinding)binding.declaringClass).addSyntheticMethod(this.codegenBinding, isSuperAccess());
+ currentScope.problemReporter().needToEmulateMethodAccess(this.codegenBinding, this);
return;
}
@@ -135,35 +156,37 @@ public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo f
// qualified super need emulation always
SourceTypeBinding destinationType = (SourceTypeBinding)(((QualifiedSuperReference)receiver).currentCompatibleType);
- syntheticAccessor = destinationType.addSyntheticMethod(binding, isSuperAccess());
- currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
+ syntheticAccessor = destinationType.addSyntheticMethod(this.codegenBinding, isSuperAccess());
+ currentScope.problemReporter().needToEmulateMethodAccess(this.codegenBinding, this);
return;
} else if (binding.isProtected()){
SourceTypeBinding enclosingSourceType;
if (((bits & DepthMASK) != 0)
- && binding.declaringClass.getPackage()
+ && this.codegenBinding.declaringClass.getPackage()
!= (enclosingSourceType = currentScope.enclosingSourceType()).getPackage()){
SourceTypeBinding currentCompatibleType = (SourceTypeBinding)enclosingSourceType.enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT);
- syntheticAccessor = currentCompatibleType.addSyntheticMethod(binding, isSuperAccess());
- currentScope.problemReporter().needToEmulateMethodAccess(binding, this);
+ syntheticAccessor = currentCompatibleType.addSyntheticMethod(this.codegenBinding, isSuperAccess());
+ currentScope.problemReporter().needToEmulateMethodAccess(this.codegenBinding, this);
return;
}
}
+
// if the binding declaring class is not visible, need special action
// for runtime compatibility on 1.2 VMs : change the declaring class of the binding
// NOTE: from target 1.2 on, method's declaring class is touched if any different from receiver type
// and not from Object or implicit static method call.
- if (binding.declaringClass != this.qualifyingType
+ if (this.binding.declaringClass != this.qualifyingType
&& !this.qualifyingType.isArrayType()
&& ((currentScope.environment().options.targetJDK >= ClassFileConstants.JDK1_2
- && (!receiver.isImplicitThis() || !binding.isStatic())
- && binding.declaringClass.id != T_Object) // no change for Object methods
- || !binding.declaringClass.canBeSeenBy(currentScope))) {
+ && (!receiver.isImplicitThis() || !this.codegenBinding.isStatic())
+ && this.binding.declaringClass.id != T_Object) // no change for Object methods
+ || !this.binding.declaringClass.canBeSeenBy(currentScope))) {
- this.codegenBinding = currentScope.enclosingSourceType().getUpdatedMethodBinding(binding, (ReferenceBinding) this.qualifyingType);
+ this.codegenBinding = currentScope.enclosingSourceType().getUpdatedMethodBinding(
+ this.codegenBinding, (ReferenceBinding) this.qualifyingType.erasure());
// Post 1.4.0 target, array clone() invocations are qualified with array type
// This is handled in array type #clone method binding resolution (see Scope and UpdatedMethodBinding)
@@ -173,6 +196,16 @@ public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo f
public StringBuffer printExpression(int indent, StringBuffer output){
if (!receiver.isImplicitThis()) receiver.printExpression(0, output).append('.');
+ if (this.typeArguments != null) {
+ output.append('<');//$NON-NLS-1$
+ int max = typeArguments.length - 1;
+ for (int j = 0; j < max; j++) {
+ typeArguments[j].print(0, output);
+ output.append(", ");//$NON-NLS-1$
+ }
+ typeArguments[max].print(0, output);
+ output.append('>');
+ }
output.append(selector).append('(') ; //$NON-NLS-1$
if (arguments != null) {
for (int i = 0; i < arguments.length ; i ++) {
@@ -188,7 +221,7 @@ public TypeBinding resolveType(BlockScope scope) {
// Base type promotion
constant = NotAConstant;
- boolean receiverCast = false, argumentsCast = false;
+ boolean receiverCast = false, argsContainCast = false;
if (this.receiver instanceof CastExpression) {
this.receiver.bits |= IgnoreNeedForCastCheckMASK; // will check later on
receiverCast = true;
@@ -197,9 +230,23 @@ public TypeBinding resolveType(BlockScope scope) {
if (receiverCast && this.receiverType != null) {
// due to change of declaring class with receiver type, only identity cast should be notified
if (((CastExpression)this.receiver).expression.resolvedType == this.receiverType) {
- scope.problemReporter().unnecessaryCast((CastExpression)this.receiver);
+ scope.problemReporter().unnecessaryCast((CastExpression)this.receiver);
}
}
+ // resolve type arguments (for generic constructor call)
+ if (this.typeArguments != null) {
+ int length = this.typeArguments.length;
+ boolean argHasError = false; // typeChecks all arguments
+ this.genericTypeArguments = new TypeBinding[length];
+ for (int i = 0; i < length; i++) {
+ if ((this.genericTypeArguments[i] = this.typeArguments[i].resolveType(scope)) == null) {
+ argHasError = true;
+ }
+ }
+ if (argHasError) {
+ return null;
+ }
+ }
// will check for null after args are resolved
TypeBinding[] argumentTypes = NoParameters;
if (arguments != null) {
@@ -210,7 +257,7 @@ public TypeBinding resolveType(BlockScope scope) {
Expression argument = arguments[i];
if (argument instanceof CastExpression) {
argument.bits |= IgnoreNeedForCastCheckMASK; // will check later on
- argumentsCast = true;
+ argsContainCast = true;
}
if ((argumentTypes[i] = argument.resolveType(scope)) == null){
argHasError = true;
@@ -219,20 +266,20 @@ public TypeBinding resolveType(BlockScope scope) {
if (argHasError) {
if(receiverType instanceof ReferenceBinding) {
// record any selector match, for clients who may still need hint about possible method match
- this.codegenBinding = this.binding = scope.findMethod((ReferenceBinding)receiverType, selector, new TypeBinding[]{}, this);
+ this.binding = scope.findMethod((ReferenceBinding)receiverType, selector, new TypeBinding[]{}, this);
}
return null;
}
}
- if (this.receiverType == null)
+ if (this.receiverType == null) {
return null;
-
+ }
// base type cannot receive any message
if (this.receiverType.isBaseType()) {
scope.problemReporter().errorNoMethodFor(this, this.receiverType, argumentTypes);
return null;
}
- this.codegenBinding = this.binding =
+ this.binding =
receiver.isImplicitThis()
? scope.getImplicitMethod(selector, argumentTypes, this)
: scope.getMethod(this.receiverType, selector, argumentTypes, this);
@@ -246,12 +293,21 @@ public TypeBinding resolveType(BlockScope scope) {
}
}
scope.problemReporter().invalidMethod(this, binding);
- // record the closest match, for clients who may still need hint about possible method match
- if (binding instanceof ProblemMethodBinding){
- MethodBinding closestMatch = ((ProblemMethodBinding)binding).closestMatch;
- if (closestMatch != null) this.codegenBinding = this.binding = closestMatch;
+ MethodBinding closestMatch = ((ProblemMethodBinding)binding).closestMatch;
+ switch (this.binding.problemId()) {
+ case ProblemReasons.Ambiguous :
+ case ProblemReasons.NotVisible :
+ case ProblemReasons.NonStaticReferenceInConstructorInvocation :
+ case ProblemReasons.NonStaticReferenceInStaticContext :
+ case ProblemReasons.ReceiverTypeNotVisible :
+ case ProblemReasons.ParameterBoundMismatch :
+ // only steal returnType in cases listed above
+ if (closestMatch != null) this.resolvedType = closestMatch.returnType;
+ default :
}
- return this.resolvedType = this.binding == null ? null : this.binding.returnType;
+ // record the closest match, for clients who may still need hint about possible method match
+ if (closestMatch != null) this.binding = closestMatch;
+ return this.resolvedType;
}
if (!binding.isStatic()) {
// the "receiver" must not be a type, in other words, a NameReference that the TC has bound to a Type
@@ -271,14 +327,9 @@ public TypeBinding resolveType(BlockScope scope) {
scope.problemReporter().indirectAccessToStaticMethod(this, binding);
}
}
- if (arguments != null) {
- for (int i = 0; i < arguments.length; i++) {
- arguments[i].implicitWidening(binding.parameters[i], argumentTypes[i]);
- }
- if (argumentsCast) {
- CastExpression.checkNeedForArgumentCasts(scope, this.receiver, receiverType, binding, this.arguments, argumentTypes, this);
- }
- }
+ if (this.arguments != null)
+ checkInvocationArguments(scope, this.receiver, receiverType, binding, this.arguments, argumentTypes, argsContainCast, this);
+
//-------message send that are known to fail at compile time-----------
if (binding.isAbstract()) {
if (receiver.isSuper()) {
@@ -289,11 +340,18 @@ public TypeBinding resolveType(BlockScope scope) {
if (isMethodUseDeprecated(binding, scope))
scope.problemReporter().deprecatedMethod(binding, this);
- return this.resolvedType = binding.returnType;
+ return this.resolvedType = this.binding.returnType;
}
public void setActualReceiverType(ReferenceBinding receiverType) {
this.qualifyingType = receiverType;
}
+/**
+ * @see org.eclipse.jdt.internal.compiler.ast.Expression#setExpectedType(org.eclipse.jdt.internal.compiler.lookup.TypeBinding)
+ */
+public void setExpectedType(TypeBinding expectedType) {
+ this.expectedType = expectedType;
+}
+
public void setDepth(int depth) {
bits &= ~DepthMASK; // flush previous depth if any
if (depth > 0) {
@@ -307,6 +365,11 @@ public void setFieldIndex(int depth) {
public void traverse(ASTVisitor visitor, BlockScope blockScope) {
if (visitor.visit(this, blockScope)) {
receiver.traverse(visitor, blockScope);
+ if (this.typeArguments != null) {
+ for (int i = 0, typeArgumentsLength = this.typeArguments.length; i < typeArgumentsLength; i++) {
+ this.typeArguments[i].traverse(visitor, blockScope);
+ }
+ }
if (arguments != null) {
int argumentsLength = arguments.length;
for (int i = 0; i < argumentsLength; i++)
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java
index b7386658b9..3548b3b5ee 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java
@@ -23,7 +23,8 @@ import org.eclipse.jdt.internal.compiler.problem.AbortMethod;
public class MethodDeclaration extends AbstractMethodDeclaration {
public TypeReference returnType;
-
+ public TypeParameter[] typeParameters;
+
/**
* MethodDeclaration constructor comment.
*/
@@ -110,10 +111,6 @@ public class MethodDeclaration extends AbstractMethodDeclaration {
this.returnType.resolvedType = this.binding.returnType;
// record the return type binding
}
- // look if the name of the method is correct
- if (binding != null && isTypeUseDeprecated(binding.returnType, scope))
- scope.problemReporter().deprecatedType(binding.returnType, returnType);
-
// check if method with constructor name
if (CharOperation.equals(scope.enclosingSourceType().sourceName, selector)) {
scope.problemReporter().methodWithConstructorName(this);
@@ -142,6 +139,17 @@ public class MethodDeclaration extends AbstractMethodDeclaration {
ClassScope classScope) {
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.typeParameters != null) {
+ int typeParametersLength = this.typeParameters.length;
+ for (int i = 0; i < typeParametersLength; i++) {
+ this.typeParameters[i].traverse(visitor, scope);
+ }
+ }
if (returnType != null)
returnType.traverse(visitor, scope);
if (arguments != null) {
@@ -162,4 +170,7 @@ public class MethodDeclaration extends AbstractMethodDeclaration {
}
visitor.endVisit(this, classScope);
}
+ public TypeParameter[] typeParameters() {
+ return this.typeParameters;
+ }
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java
new file mode 100644
index 0000000000..65abe3d316
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * 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.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;
+
+/**
+ * Normal annotation node
+ */
+public class NormalAnnotation extends Annotation {
+
+ public MemberValuePair[] memberValuePairs;
+
+ public NormalAnnotation(char[][] tokens, long[] sourcePositions, int sourceStart) {
+ this.tokens = tokens;
+ this.sourcePositions = sourcePositions;
+ this.sourceStart = sourceStart;
+ this.sourceEnd = (int) sourcePositions[sourcePositions.length - 1];
+ }
+
+ public NormalAnnotation(char[] token, long sourcePosition, int sourceStart) {
+ this.tokens = new char[][] { token };
+ this.sourcePositions = new long[] { sourcePosition };
+ this.sourceStart = sourceStart;
+ this.sourceEnd = (int) sourcePosition;
+ }
+
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+ super.printExpression(indent, output);
+ output.append('(');
+ if (this.memberValuePairs != null) {
+ for (int i = 0, max = this.memberValuePairs.length; i < max; i++) {
+ if (i > 0) {
+ output.append(',');
+ }
+ this.memberValuePairs[i].print(indent, output);
+ }
+ }
+ output.append(')');
+ return output;
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ if (this.memberValuePairs != null) {
+ int memberValuePairsLength = this.memberValuePairs.length;
+ for (int i = 0; i < memberValuePairsLength; i++)
+ this.memberValuePairs[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+ public void traverse(ASTVisitor visitor, ClassScope scope) {
+ if (visitor.visit(this, scope)) {
+ if (this.memberValuePairs != null) {
+ int memberValuePairsLength = this.memberValuePairs.length;
+ for (int i = 0; i < memberValuePairsLength; i++)
+ this.memberValuePairs[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+ public void traverse(ASTVisitor visitor, CompilationUnitScope scope) {
+ if (visitor.visit(this, scope)) {
+ if (this.memberValuePairs != null) {
+ int memberValuePairsLength = this.memberValuePairs.length;
+ for (int i = 0; i < memberValuePairsLength; i++)
+ this.memberValuePairs[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorExpression.java
index 4574e0b576..adf0869a04 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorExpression.java
@@ -167,7 +167,7 @@ public abstract class OperatorExpression extends Expression implements OperatorI
public static final int[] get_AND(){
- //the code is an int
+ //the code is an int, only 20 bits are used, see below.
// (cast) left Op (cast) rigth --> result
// 0000 0000 0000 0000 0000
// <<16 <<12 <<8 <<4
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java
new file mode 100644
index 0000000000..f240ce1d69
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java
@@ -0,0 +1,274 @@
+/*******************************************************************************
+ * 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 java.util.ArrayList;
+
+import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.compiler.ASTVisitor;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
+
+/**
+ * Syntactic representation of a reference to a generic type.
+ * Note that it might also have a dimension.
+ */
+public class ParameterizedQualifiedTypeReference extends ArrayQualifiedTypeReference {
+
+ public TypeReference[][] typeArguments;
+ private boolean didResolve = false;
+
+ /**
+ * @param tokens
+ * @param dim
+ * @param positions
+ */
+ public ParameterizedQualifiedTypeReference(char[][] tokens, TypeReference[][] typeArguments, int dim, long[] positions) {
+
+ super(tokens, dim, positions);
+ this.typeArguments = typeArguments;
+ }
+ public TypeReference copyDims(int dim){
+ //return a type reference copy of me with some dimensions
+ //warning : the new type ref has a null binding
+ this.dimensions = dim;
+ return this;
+ }
+
+ /**
+ * @return char[][]
+ */
+ public char [][] getParameterizedTypeName(){
+ int length = this.tokens.length;
+ char[][] qParamName = new char[length][];
+ for (int i = 0; i < length; i++) {
+ TypeReference[] arguments = this.typeArguments[i];
+ if (arguments == null) {
+ qParamName[i] = this.tokens[i];
+ } else {
+ StringBuffer buffer = new StringBuffer(5);
+ buffer.append(this.tokens[i]);
+ buffer.append('<');
+ for (int j = 0, argLength =arguments.length; j < argLength; j++) {
+ if (j > 0) buffer.append(',');
+ buffer.append(CharOperation.concatWith(arguments[j].getParameterizedTypeName(), '.'));
+ }
+ buffer.append('>');
+ int nameLength = buffer.length();
+ qParamName[i] = new char[nameLength];
+ buffer.getChars(0, nameLength, qParamName[i], 0);
+ }
+ }
+ int dim = this.dimensions;
+ if (dim > 0) {
+ char[] dimChars = new char[dim*2];
+ for (int i = 0; i < dim; i++) {
+ int index = i*2;
+ dimChars[index] = '[';
+ dimChars[index+1] = ']';
+ }
+ qParamName[length-1] = CharOperation.concat(qParamName[length-1], dimChars);
+ }
+ return qParamName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference#getTypeBinding(org.eclipse.jdt.internal.compiler.lookup.Scope)
+ */
+ protected TypeBinding getTypeBinding(Scope scope) {
+ return null; // not supported here - combined with resolveType(...)
+ }
+
+ /*
+ * No need to check for reference to raw type per construction
+ */
+ private TypeBinding internalResolveType(Scope scope) {
+
+ boolean isClassScope = scope.kind == Scope.CLASS_SCOPE;
+
+ // handle the error here
+ this.constant = NotAConstant;
+ if (this.didResolve) { // is a shared type reference which was already resolved
+ if (this.resolvedType != null && !this.resolvedType.isValidBinding()) {
+ return null; // already reported error
+ }
+ return this.resolvedType;
+ }
+ this.didResolve = true;
+ ReferenceBinding qualifiedType = null;
+ for (int i = 0, max = this.tokens.length; i < max; i++) {
+ ReferenceBinding currentType;
+ if (i == 0) {
+ // isolate first fragment
+ while (this.typeArguments[i] == null) i++;
+ try {
+ this.resolvedType = scope.getType(this.tokens, i+1);
+ } catch (AbortCompilation e) {
+ e.updateContext(this, scope.referenceCompilationUnit().compilationResult);
+ throw e;
+ }
+ if (!(this.resolvedType.isValidBinding())) {
+ reportInvalidType(scope);
+ return null;
+ }
+ currentType = (ReferenceBinding) this.resolvedType;
+ if (currentType.isMemberType()) { // check raw enclosing type
+ ArrayList enclosingTypes = new ArrayList();
+ boolean hasGenericEnclosing = false;
+ for (ReferenceBinding enclosing = currentType.enclosingType(); enclosing != null; enclosing = enclosing.enclosingType()) {
+ enclosingTypes.add(enclosing);
+ if (enclosing.isGenericType()) hasGenericEnclosing = true;
+ }
+ if (hasGenericEnclosing) {
+ for (int j = enclosingTypes.size() - 1; j >= 0; j--) {
+ ReferenceBinding enclosing = (ReferenceBinding)enclosingTypes.get(j);
+ if (enclosing.isGenericType()) {
+ qualifiedType = scope.environment().createRawType(enclosing, qualifiedType); // raw type
+ }
+ }
+ }
+ }
+ } else {
+ this.resolvedType = currentType = scope.getMemberType(this.tokens[i], (ReferenceBinding)qualifiedType.erasure());
+ if (!(this.resolvedType.isValidBinding())) {
+ reportInvalidType(scope);
+ return null;
+ }
+ }
+ if (isClassScope)
+ if (((ClassScope) scope).detectCycle(currentType, this))
+ return null;
+ // check generic and arity
+ TypeVariableBinding[] typeVariables = currentType.typeVariables();
+ TypeReference[] args = this.typeArguments[i];
+ if (args != null) {
+ int argLength = args.length;
+ TypeBinding[] argTypes = new TypeBinding[argLength];
+ boolean argHasError = false;
+ for (int j = 0; j < argLength; j++) {
+ TypeReference arg = args[j];
+ TypeBinding argType = isClassScope
+ ? arg.resolveTypeArgument((ClassScope) scope, currentType, j)
+ : arg.resolveTypeArgument((BlockScope) scope, currentType, j);
+ if (argType == null) {
+ argHasError = true;
+ } else {
+ argTypes[j] = argType;
+ }
+ }
+ if (argHasError) return null;
+ if (typeVariables == NoTypeVariables) { // check generic
+ scope.problemReporter().nonGenericTypeCannotBeParameterized(this, currentType, argTypes);
+ return null;
+ } else if (argLength != typeVariables.length) { // check arity
+ scope.problemReporter().incorrectArityForParameterizedType(this, currentType, argTypes);
+ return null;
+ }
+ ParameterizedTypeBinding parameterizedType = scope.createParameterizedType(currentType, argTypes, qualifiedType);
+ // check argument type compatibility
+ for (int j = 0; j < argLength; j++) {
+ TypeBinding argType = argTypes[j];
+ if (!typeVariables[j].boundCheck(parameterizedType, argType)) {
+ scope.problemReporter().typeMismatchError(argType, typeVariables[j], currentType, args[j]);
+ }
+ }
+ qualifiedType = parameterizedType;
+ } else if (currentType.isGenericType()) { // check raw type
+ qualifiedType = scope.environment().createRawType(currentType, qualifiedType); // raw type
+ } else if (qualifiedType != null && (qualifiedType.isParameterizedType() || qualifiedType.isRawType())) {
+ qualifiedType = scope.createParameterizedType(currentType, null, qualifiedType);
+ }
+ }
+ this.resolvedType = qualifiedType;
+ if (isTypeUseDeprecated(this.resolvedType, scope)) {
+ reportDeprecatedType(scope);
+ }
+ // array type ?
+ if (this.dimensions > 0) {
+ if (dimensions > 255) {
+ scope.problemReporter().tooManyDimensions(this);
+ }
+ if (qualifiedType.isParameterizedType()) {
+ scope.problemReporter().illegalArrayOfParameterizedType(qualifiedType, this);
+ }
+ this.resolvedType = scope.createArrayType(qualifiedType, dimensions);
+ }
+ return this.resolvedType;
+ }
+
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+ int length = tokens.length;
+ for (int i = 0; i < length - 1; i++) {
+ output.append(tokens[i]);
+ TypeReference[] typeArgument = typeArguments[i];
+ if (typeArgument != null) {
+ output.append('<');//$NON-NLS-1$
+ int max = typeArgument.length - 1;
+ for (int j = 0; j < max; j++) {
+ typeArgument[j].print(0, output);
+ output.append(", ");//$NON-NLS-1$
+ }
+ typeArgument[max].print(0, output);
+ output.append('>');
+ }
+ output.append('.');
+ }
+ output.append(tokens[length - 1]);
+ TypeReference[] typeArgument = typeArguments[length - 1];
+ if (typeArgument != null) {
+ output.append('<');//$NON-NLS-1$
+ int max = typeArgument.length - 1;
+ for (int j = 0; j < max; j++) {
+ typeArgument[j].print(0, output);
+ output.append(", ");//$NON-NLS-1$
+ }
+ typeArgument[max].print(0, output);
+ output.append('>');
+ }
+ for (int i= 0 ; i < dimensions ; i++) {
+ output.append("[]"); //$NON-NLS-1$
+ }
+ return output;
+ }
+
+ public TypeBinding resolveType(BlockScope scope) {
+ return internalResolveType(scope);
+ }
+ public TypeBinding resolveType(ClassScope scope) {
+ return internalResolveType(scope);
+ }
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ for (int i = 0, max = this.typeArguments.length; i < max; i++) {
+ if (this.typeArguments[i] != null) {
+ for (int j = 0, max2 = this.typeArguments[i].length; j < max2; j++) {
+ this.typeArguments[i][j].traverse(visitor, scope);
+ }
+ }
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+
+ public void traverse(ASTVisitor visitor, ClassScope scope) {
+ if (visitor.visit(this, scope)) {
+ for (int i = 0, max = this.typeArguments.length; i < max; i++) {
+ if (this.typeArguments[i] != null) {
+ for (int j = 0, max2 = this.typeArguments[i].length; j < max2; j++) {
+ this.typeArguments[i][j].traverse(visitor, scope);
+ }
+ }
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java
new file mode 100644
index 0000000000..09670015ad
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ * 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.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.compiler.ASTVisitor;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+/**
+ * Syntactic representation of a reference to a generic type.
+ * Note that it might also have a dimension.
+ */
+public class ParameterizedSingleTypeReference extends ArrayTypeReference {
+
+ public TypeReference[] typeArguments;
+ private boolean didResolve = false;
+
+ public ParameterizedSingleTypeReference(char[] name, TypeReference[] typeArguments, int dim, long pos){
+ super(name, dim, pos);
+ this.typeArguments = typeArguments;
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.ast.TypeReference#copyDims(int)
+ */
+ public TypeReference copyDims(int dim) {
+ this.dimensions = dim;
+ return this;
+ }
+
+ /**
+ * @return char[][]
+ */
+ public char [][] getParameterizedTypeName(){
+ StringBuffer buffer = new StringBuffer(5);
+ buffer.append(this.token).append('<');
+ for (int i = 0, length = this.typeArguments.length; i < length; i++) {
+ if (i > 0) buffer.append(',');
+ buffer.append(CharOperation.concatWith(this.typeArguments[i].getParameterizedTypeName(), '.'));
+ }
+ buffer.append('>');
+ int nameLength = buffer.length();
+ char[] name = new char[nameLength];
+ buffer.getChars(0, nameLength, name, 0);
+ int dim = this.dimensions;
+ if (dim > 0) {
+ char[] dimChars = new char[dim*2];
+ for (int i = 0; i < dim; i++) {
+ int index = i*2;
+ dimChars[index] = '[';
+ dimChars[index+1] = ']';
+ }
+ name = CharOperation.concat(name, dimChars);
+ }
+ return new char[][]{ name };
+ }
+ /**
+ * @see org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference#getTypeBinding(org.eclipse.jdt.internal.compiler.lookup.Scope)
+ */
+ protected TypeBinding getTypeBinding(Scope scope) {
+ return null; // not supported here - combined with resolveType(...)
+ }
+
+ /*
+ * No need to check for reference to raw type per construction
+ */
+ private TypeBinding internalResolveType(Scope scope, ReferenceBinding enclosingType) {
+
+ boolean isClassScope = scope.kind == Scope.CLASS_SCOPE;
+
+ // handle the error here
+ this.constant = NotAConstant;
+ if (this.didResolve) { // is a shared type reference which was already resolved
+ if (this.resolvedType != null && !this.resolvedType.isValidBinding()) {
+ return null; // already reported error
+ }
+ return this.resolvedType;
+ }
+ this.didResolve = true;
+ ReferenceBinding currentType = null;
+ if (enclosingType == null) {
+ this.resolvedType = scope.getType(token);
+ if (!(this.resolvedType.isValidBinding())) {
+ reportInvalidType(scope);
+ return null;
+ }
+ } else { // resolving member type (relatively to enclosingType)
+ this.resolvedType = scope.getMemberType(token, (ReferenceBinding)enclosingType.erasure());
+ if (!this.resolvedType.isValidBinding()) {
+ scope.problemReporter().invalidEnclosingType(this, this.resolvedType, enclosingType);
+ return null;
+ }
+ if (isTypeUseDeprecated(this.resolvedType, scope)) {
+ scope.problemReporter().deprecatedType(this.resolvedType, this);
+ }
+ }
+ currentType = (ReferenceBinding) this.resolvedType;
+ if (isClassScope)
+ if (((ClassScope) scope).detectCycle(currentType, this))
+ return null;
+ // check generic and arity
+ TypeVariableBinding[] typeVariables = currentType.typeVariables();
+ int argLength = this.typeArguments.length;
+ TypeBinding[] argTypes = new TypeBinding[argLength];
+ boolean argHasError = false;
+ for (int i = 0; i < argLength; i++) {
+ TypeReference typeArgument = this.typeArguments[i];
+ TypeBinding argType = isClassScope
+ ? typeArgument.resolveTypeArgument((ClassScope) scope, currentType, i)
+ : typeArgument.resolveTypeArgument((BlockScope) scope, currentType, i);
+ if (argType == null) {
+ argHasError = true;
+ } else {
+ argTypes[i] = argType;
+ }
+ }
+ if (argHasError) return null;
+ if (typeVariables == NoTypeVariables) { // check generic
+ scope.problemReporter().nonGenericTypeCannotBeParameterized(this, currentType, argTypes);
+ return null;
+ } else if (argLength != typeVariables.length) { // check arity
+ scope.problemReporter().incorrectArityForParameterizedType(this, currentType, argTypes);
+ return null;
+ }
+ // if generic type X<T> is referred to as parameterized X<T>, then answer itself
+ checkGeneric: {
+ for (int i = 0; i < argLength; i++)
+ if (typeVariables[i] != argTypes[i])
+ break checkGeneric;
+ return currentType;
+ }
+ ParameterizedTypeBinding parameterizedType = scope.createParameterizedType(currentType, argTypes, enclosingType);
+ // check argument type compatibility
+ for (int i = 0; i < argLength; i++) {
+ TypeBinding argType = argTypes[i];
+ if (!typeVariables[i].boundCheck(parameterizedType, argType)) {
+ scope.problemReporter().typeMismatchError(argType, typeVariables[i], currentType, this.typeArguments[i]);
+ }
+ }
+ this.resolvedType = parameterizedType;
+ if (isTypeUseDeprecated(this.resolvedType, scope)) {
+ reportDeprecatedType(scope);
+ }
+ // array type ?
+ if (this.dimensions > 0) {
+ if (dimensions > 255) {
+ scope.problemReporter().tooManyDimensions(this);
+ }
+ scope.problemReporter().illegalArrayOfParameterizedType(parameterizedType, this);
+ this.resolvedType = scope.createArrayType(parameterizedType, dimensions);
+ }
+ return this.resolvedType;
+ }
+
+ public StringBuffer printExpression(int indent, StringBuffer output){
+ output.append(token);
+ output.append("<"); //$NON-NLS-1$
+ int max = typeArguments.length - 1;
+ for (int i= 0; i < max; i++) {
+ typeArguments[i].print(0, output);
+ output.append(", ");//$NON-NLS-1$
+ }
+ typeArguments[max].print(0, output);
+ output.append(">"); //$NON-NLS-1$
+ for (int i= 0 ; i < dimensions ; i++) {
+ output.append("[]"); //$NON-NLS-1$
+ }
+ return output;
+ }
+
+ public TypeBinding resolveType(BlockScope scope) {
+ return internalResolveType(scope, null);
+ }
+
+ public TypeBinding resolveType(ClassScope scope) {
+ return internalResolveType(scope, null);
+ }
+
+ public TypeBinding resolveTypeEnclosing(BlockScope scope, ReferenceBinding enclosingType) {
+ return internalResolveType(scope, enclosingType);
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ for (int i = 0, max = this.typeArguments.length; i < max; i++) {
+ this.typeArguments[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+
+ public void traverse(ASTVisitor visitor, ClassScope scope) {
+ if (visitor.visit(this, scope)) {
+ for (int i = 0, max = this.typeArguments.length; i < max; i++) {
+ this.typeArguments[i].traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
index f236168bda..7721af6de3 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
@@ -16,7 +16,10 @@ import org.eclipse.jdt.internal.compiler.flow.*;
import org.eclipse.jdt.internal.compiler.lookup.*;
/**
- * Variation on allocation, where can be specified an enclosing instance and an anonymous type
+ * Variation on allocation, where can optionally be specified any of:
+ * - leading enclosing instance
+ * - trailing anonymous type
+ * - generic type arguments for generic constructor invocation
*/
public class QualifiedAllocationExpression extends AllocationExpression {
@@ -87,7 +90,7 @@ public class QualifiedAllocationExpression extends AllocationExpression {
boolean valueRequired) {
int pc = codeStream.position;
- ReferenceBinding allocatedType = binding.declaringClass;
+ ReferenceBinding allocatedType = this.codegenBinding.declaringClass;
codeStream.new_(allocatedType);
if (valueRequired) {
codeStream.dup();
@@ -119,11 +122,11 @@ public class QualifiedAllocationExpression extends AllocationExpression {
// invoke constructor
if (syntheticAccessor == null) {
- codeStream.invokespecial(binding);
+ codeStream.invokespecial(this.codegenBinding);
} else {
// synthetic accessor got some extra arguments appended to its signature, which need values
for (int i = 0,
- max = syntheticAccessor.parameters.length - binding.parameters.length;
+ max = syntheticAccessor.parameters.length - this.codegenBinding.parameters.length;
i < max;
i++) {
codeStream.aconst_null();
@@ -172,6 +175,16 @@ public class QualifiedAllocationExpression extends AllocationExpression {
if (enclosingInstance != null)
enclosingInstance.printExpression(0, output).append('.');
+ if (typeArguments != null) {
+ output.append('<');//$NON-NLS-1$
+ int max = typeArguments.length - 1;
+ for (int j = 0; j < max; j++) {
+ typeArguments[j].print(0, output);
+ output.append(", ");//$NON-NLS-1$
+ }
+ typeArguments[max].print(0, output);
+ output.append('>');
+ }
super.printExpression(0, output);
if (anonymousType != null) {
anonymousType.print(indent, output);
@@ -182,17 +195,14 @@ public class QualifiedAllocationExpression extends AllocationExpression {
public TypeBinding resolveType(BlockScope scope) {
// added for code assist...cannot occur with 'normal' code
- if (anonymousType == null && enclosingInstance == null) {
+ if (this.anonymousType == null && this.enclosingInstance == null) {
return super.resolveType(scope);
}
// Propagate the type checking to the arguments, and checks if the constructor is defined.
// ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
// ClassInstanceCreationExpression ::= Name '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
- // ==> by construction, when there is an enclosing instance the typename may NOT be qualified
- // ==> therefore by construction the type is always a SingleTypeReferenceType instead of being either
- // sometime a SingleTypeReference and sometime a QualifedTypeReference
-
+
constant = NotAConstant;
TypeBinding enclosingInstanceType = null;
TypeBinding receiverType = null;
@@ -212,10 +222,13 @@ public class QualifiedAllocationExpression extends AllocationExpression {
enclosingInstanceType,
enclosingInstance);
hasError = true;
+ } else if (type instanceof QualifiedTypeReference) {
+ scope.problemReporter().illegalUsageOfQualifiedTypeReference((QualifiedTypeReference)type);
+ hasError = true;
} else {
receiverType = ((SingleTypeReference) type).resolveTypeEnclosing(scope, (ReferenceBinding) enclosingInstanceType);
if (receiverType != null && enclosingInstanceContainsCast) {
- CastExpression.checkNeedForEnclosingInstanceCast(scope, enclosingInstance, enclosingInstanceType, receiverType);
+ CastExpression.checkNeedForEnclosingInstanceCast(scope, enclosingInstance, enclosingInstanceType, receiverType);
}
}
} else {
@@ -227,7 +240,17 @@ public class QualifiedAllocationExpression extends AllocationExpression {
scope.problemReporter().anonymousClassCannotExtendFinalClass(type, receiverType);
hasError = true;
}
-
+ // resolve type arguments (for generic constructor call)
+ if (this.typeArguments != null) {
+ int length = this.typeArguments.length;
+ this.genericTypeArguments = new TypeBinding[length];
+ for (int i = 0; i < length; i++) {
+ TypeBinding argType = this.typeArguments[i].resolveType(scope);
+ if (argType == null) return null; // error already reported
+ this.genericTypeArguments[i] = argType;
+ }
+ }
+
// will check for null after args are resolved
TypeBinding[] argumentTypes = NoParameters;
if (arguments != null) {
@@ -246,7 +269,10 @@ public class QualifiedAllocationExpression extends AllocationExpression {
}
// limit of fault-tolerance
if (hasError) return this.resolvedType = receiverType;
-
+ if ((receiverType.tagBits & TagBits.HasWildcard) != 0) {
+ scope.problemReporter().cannotInstantiateWithWildcards(type, (ParameterizedTypeBinding)receiverType);
+ return this.resolvedType = receiverType;
+ }
if (this.anonymousType == null) {
// qualified allocation with no anonymous type
ReferenceBinding allocationType = (ReferenceBinding) receiverType;
@@ -258,14 +284,8 @@ public class QualifiedAllocationExpression extends AllocationExpression {
if (isMethodUseDeprecated(binding, scope)) {
scope.problemReporter().deprecatedMethod(this.binding, this);
}
- if (arguments != null) {
- for (int i = 0; i < arguments.length; i++) {
- arguments[i].implicitWidening(this.binding.parameters[i], argumentTypes[i]);
- }
- if (argsContainCast) {
- CastExpression.checkNeedForArgumentCasts(scope, null, allocationType, binding, this.arguments, argumentTypes, this);
- }
- }
+ if (this.arguments != null)
+ checkInvocationArguments(scope, null, allocationType, binding, this.arguments, argumentTypes, argsContainCast, this);
} else {
if (this.binding.declaringClass == null) {
this.binding.declaringClass = allocationType;
@@ -279,10 +299,7 @@ public class QualifiedAllocationExpression extends AllocationExpression {
if (enclosingInstanceType.isCompatibleWith(expectedType)) {
return receiverType;
}
- scope.problemReporter().typeMismatchErrorActualTypeExpectedType(
- this.enclosingInstance,
- enclosingInstanceType,
- expectedType);
+ scope.problemReporter().typeMismatchError(enclosingInstanceType, expectedType, this.enclosingInstance);
return this.resolvedType = receiverType;
}
@@ -302,26 +319,16 @@ public class QualifiedAllocationExpression extends AllocationExpression {
scope.problemReporter().invalidConstructor(this, inheritedBinding);
return this.resolvedType = anonymousType.binding;
}
+ // TODO (philippe) no deprecation check?
if (enclosingInstance != null) {
if (!enclosingInstanceType.isCompatibleWith(inheritedBinding.declaringClass.enclosingType())) {
- scope.problemReporter().typeMismatchErrorActualTypeExpectedType(
- enclosingInstance,
- enclosingInstanceType,
- inheritedBinding.declaringClass.enclosingType());
+ scope.problemReporter().typeMismatchError(enclosingInstanceType, inheritedBinding.declaringClass.enclosingType(), enclosingInstance);
return this.resolvedType = anonymousType.binding;
}
}
-
- // this promotion has to be done somewhere: here or inside the constructor of the
- // anonymous class. We do it here while the constructor of the inner is then easier.
- if (arguments != null) {
- for (int i = 0; i < arguments.length; i++) {
- arguments[i].implicitWidening(inheritedBinding.parameters[i], argumentTypes[i]);
- }
- if (argsContainCast) {
- CastExpression.checkNeedForArgumentCasts(scope, null, this.superTypeBinding, inheritedBinding, this.arguments, argumentTypes, this);
- }
- }
+ if (this.arguments != null)
+ checkInvocationArguments(scope, null, this.superTypeBinding, inheritedBinding, this.arguments, argumentTypes, argsContainCast, this);
+
// Update the anonymous inner class : superclass, interface
binding = anonymousType.createsInternalConstructorWithBinding(inheritedBinding);
return this.resolvedType = anonymousType.binding; // 1.2 change
@@ -332,6 +339,11 @@ public class QualifiedAllocationExpression extends AllocationExpression {
if (visitor.visit(this, scope)) {
if (enclosingInstance != null)
enclosingInstance.traverse(visitor, scope);
+ if (this.typeArguments != null) {
+ for (int i = 0, typeArgumentsLength = this.typeArguments.length; i < typeArgumentsLength; i++) {
+ this.typeArguments[i].traverse(visitor, scope);
+ }
+ }
type.traverse(visitor, scope);
if (arguments != null) {
int argumentsLength = arguments.length;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java
index 8afa15a179..394cecebd4 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java
@@ -27,7 +27,9 @@ public class QualifiedNameReference extends NameReference {
public int indexOfFirstFieldBinding;//points (into tokens) for the first token that corresponds to first FieldBinding
SyntheticAccessMethodBinding syntheticWriteAccessor;
SyntheticAccessMethodBinding[] syntheticReadAccessors;
- protected FieldBinding lastFieldBinding;
+ public TypeBinding genericCast;
+ public TypeBinding[] otherGenericCasts;
+
public QualifiedNameReference(
char[][] sources,
long[] positions,
@@ -39,6 +41,7 @@ public class QualifiedNameReference extends NameReference {
this.sourceStart = sourceStart;
this.sourceEnd = sourceEnd;
}
+
public FlowInfo analyseAssignment(
BlockScope currentScope,
FlowContext flowContext,
@@ -49,11 +52,12 @@ public class QualifiedNameReference extends NameReference {
// determine the rank until which we now we do not need any actual value for the field access
int otherBindingsCount = otherBindings == null ? 0 : otherBindings.length;
boolean needValue = otherBindingsCount == 0 || !this.otherBindings[0].isStatic();
+ FieldBinding lastFieldBinding = null;
switch (bits & RestrictiveFlagMASK) {
case FIELD : // reading a field
lastFieldBinding = (FieldBinding) binding;
if (needValue) {
- manageSyntheticReadAccessIfNecessary(currentScope, lastFieldBinding, this.actualReceiverType, 0, flowInfo);
+ manageSyntheticAccessIfNecessary(currentScope, lastFieldBinding, this.actualReceiverType, 0, flowInfo);
} // check if final blank field
if (lastFieldBinding.isBlankFinal()
&& this.otherBindings != null // the last field binding is only assigned
@@ -89,7 +93,7 @@ public class QualifiedNameReference extends NameReference {
lastFieldBinding = otherBindings[i];
needValue = !otherBindings[i+1].isStatic();
if (needValue) {
- manageSyntheticReadAccessIfNecessary(
+ manageSyntheticAccessIfNecessary(
currentScope,
lastFieldBinding,
i == 0
@@ -119,7 +123,7 @@ public class QualifiedNameReference extends NameReference {
} else {
lastReceiverType = this.otherBindings[otherBindingsCount-2].type;
}
- manageSyntheticReadAccessIfNecessary(
+ manageSyntheticAccessIfNecessary(
currentScope,
lastFieldBinding,
lastReceiverType,
@@ -166,7 +170,7 @@ public class QualifiedNameReference extends NameReference {
} else {
lastReceiverType = this.otherBindings[otherBindingsCount-2].type;
}
- manageSyntheticWriteAccessIfNecessary(currentScope, lastFieldBinding, lastReceiverType, flowInfo);
+ manageSyntheticAccessIfNecessary(currentScope, lastFieldBinding, lastReceiverType, -1 /*write-access*/, flowInfo);
return flowInfo;
}
@@ -192,7 +196,7 @@ public class QualifiedNameReference extends NameReference {
switch (bits & RestrictiveFlagMASK) {
case FIELD : // reading a field
if (needValue) {
- manageSyntheticReadAccessIfNecessary(currentScope, (FieldBinding) binding, this.actualReceiverType, 0, flowInfo);
+ manageSyntheticAccessIfNecessary(currentScope, (FieldBinding) binding, this.actualReceiverType, 0, flowInfo);
}
// check if reading a final blank field
FieldBinding fieldBinding;
@@ -224,12 +228,10 @@ public class QualifiedNameReference extends NameReference {
for (int i = 0; i < otherBindingsCount; i++) {
needValue = i < otherBindingsCount-1 ? !otherBindings[i+1].isStatic() : valueRequired;
if (needValue) {
- manageSyntheticReadAccessIfNecessary(
+ manageSyntheticAccessIfNecessary(
currentScope,
otherBindings[i],
- i == 0
- ? ((VariableBinding)binding).type
- : otherBindings[i-1].type,
+ i == 0 ? ((VariableBinding)binding).type : otherBindings[i-1].type,
i + 1,
flowInfo);
}
@@ -261,7 +263,7 @@ public class QualifiedNameReference extends NameReference {
Assignment assignment,
boolean valueRequired) {
- generateReadSequence(currentScope, codeStream);
+ FieldBinding lastFieldBinding = generateReadSequence(currentScope, codeStream);
assignment.expression.generateCode(currentScope, codeStream, true);
fieldStore(codeStream, lastFieldBinding, syntheticWriteAccessor, valueRequired);
// equivalent to valuesRequired[maxOtherBindings]
@@ -280,7 +282,7 @@ public class QualifiedNameReference extends NameReference {
codeStream.generateConstant(constant, implicitConversion);
}
} else {
- generateReadSequence(currentScope, codeStream);
+ FieldBinding lastFieldBinding = generateReadSequence(currentScope, codeStream);
if (valueRequired) {
if (lastFieldBinding.declaringClass == null) { // array length
codeStream.arraylength();
@@ -308,6 +310,8 @@ public class QualifiedNameReference extends NameReference {
codeStream.invokestatic(accessor);
}
codeStream.generateImplicitConversion(implicitConversion);
+ TypeBinding requiredGenericCast = getGenericCast(lastFieldBinding, this.otherCodegenBindings == null ? 0 : this.otherCodegenBindings.length);
+ if (requiredGenericCast != null) codeStream.checkcast(requiredGenericCast);
}
}
} else {
@@ -328,7 +332,7 @@ public class QualifiedNameReference extends NameReference {
int assignmentImplicitConversion,
boolean valueRequired) {
- generateReadSequence(currentScope, codeStream);
+ FieldBinding lastFieldBinding = generateReadSequence(currentScope, codeStream);
SyntheticAccessMethodBinding accessor =
syntheticReadAccessors == null
? null
@@ -351,7 +355,7 @@ public class QualifiedNameReference extends NameReference {
// perform the actual compound operation
int operationTypeID;
if ((operationTypeID = implicitConversion >> 4) == T_String) {
- codeStream.generateStringAppend(currentScope, null, expression);
+ codeStream.generateStringConcatenationAppend(currentScope, null, expression);
} else {
// promote the array reference to the suitable operation type
codeStream.generateImplicitConversion(implicitConversion);
@@ -375,7 +379,8 @@ public class QualifiedNameReference extends NameReference {
CodeStream codeStream,
CompoundAssignment postIncrement,
boolean valueRequired) {
- generateReadSequence(currentScope, codeStream);
+
+ FieldBinding lastFieldBinding = generateReadSequence(currentScope, codeStream);
SyntheticAccessMethodBinding accessor =
syntheticReadAccessors == null
? null
@@ -424,17 +429,18 @@ public class QualifiedNameReference extends NameReference {
* Generate code for all bindings (local and fields) excluding the last one, which may then be generated code
* for a read or write access.
*/
- public void generateReadSequence(
- BlockScope currentScope,
- CodeStream codeStream) {
+ public FieldBinding generateReadSequence(BlockScope currentScope, CodeStream codeStream) {
// determine the rank until which we now we do not need any actual value for the field access
int otherBindingsCount = this.otherCodegenBindings == null ? 0 : otherCodegenBindings.length;
-
boolean needValue = otherBindingsCount == 0 || !this.otherBindings[0].isStatic();
+ FieldBinding lastFieldBinding = null;
+ TypeBinding lastGenericCast = null;
+
switch (bits & RestrictiveFlagMASK) {
case FIELD :
lastFieldBinding = (FieldBinding) this.codegenBinding;
+ lastGenericCast = this.genericCast;
// if first field is actually constant, we can inline it
if (lastFieldBinding.constant != NotAConstant) {
break;
@@ -450,7 +456,6 @@ public class QualifiedNameReference extends NameReference {
}
break;
case LOCAL : // reading the first local variable
- lastFieldBinding = null;
if (!needValue) break; // no value needed
LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding;
// regular local variable read
@@ -468,12 +473,13 @@ public class QualifiedNameReference extends NameReference {
}
}
}
-
+
// all intermediate field accesses are read accesses
// only the last field binding is a write access
if (this.otherCodegenBindings != null) {
for (int i = 0; i < otherBindingsCount; i++) {
FieldBinding nextField = this.otherCodegenBindings[i];
+ TypeBinding nextGenericCast = this.otherGenericCasts == null ? null : this.otherGenericCasts[i];
if (lastFieldBinding != null) {
needValue = !nextField.isStatic();
if (needValue) {
@@ -481,7 +487,7 @@ public class QualifiedNameReference extends NameReference {
syntheticReadAccessors == null ? null : syntheticReadAccessors[i];
if (accessor == null) {
if (lastFieldBinding.constant != NotAConstant) {
- if (this.lastFieldBinding != this.codegenBinding && !this.lastFieldBinding.isStatic()) {
+ if (lastFieldBinding != this.codegenBinding && !lastFieldBinding.isStatic()) {
codeStream.invokeObjectGetClass(); // perform null check
codeStream.pop();
}
@@ -494,20 +500,63 @@ public class QualifiedNameReference extends NameReference {
} else {
codeStream.invokestatic(accessor);
}
+ if (lastGenericCast != null) codeStream.checkcast(lastGenericCast);
} else {
- if (this.codegenBinding != this.lastFieldBinding && !this.lastFieldBinding.isStatic()){
+ if (this.codegenBinding != lastFieldBinding && !lastFieldBinding.isStatic()){
codeStream.invokeObjectGetClass(); // perform null check
codeStream.pop();
}
}
}
- this.lastFieldBinding = nextField;
+ lastFieldBinding = nextField;
+ lastGenericCast = nextGenericCast;
}
}
+ return lastFieldBinding;
}
public void generateReceiver(CodeStream codeStream) {
codeStream.aload_0();
}
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#genericTypeArguments()
+ */
+ public TypeBinding[] genericTypeArguments() {
+ return null;
+ }
+
+ // get the matching codegenBinding
+ protected FieldBinding getCodegenBinding(FieldBinding fieldBinding, int index) {
+ if (index < 0) { // write-access ?
+ if (fieldBinding == binding){
+ return (FieldBinding)this.codegenBinding;
+ } else {
+ return this.otherCodegenBindings[this.otherBindings.length-1];
+ }
+ } else if (index == 0){
+ return (FieldBinding)this.codegenBinding;
+ } else {
+ return this.otherCodegenBindings[index-1];
+ }
+ }
+
+ // get the matching generic cast
+ protected TypeBinding getGenericCast(FieldBinding fieldBinding, int index) {
+ if (index < 0) { // write-access ?
+ if (fieldBinding == binding){
+ return this.genericCast;
+ } else {
+ if (this.otherGenericCasts == null) return null;
+ return this.otherGenericCasts[this.otherGenericCasts.length-1];
+ }
+ } else if (index == 0){
+ return this.genericCast;
+ } else {
+ if (this.otherGenericCasts == null) return null;
+ return this.otherGenericCasts[index-1];
+ }
+ }
+
public TypeBinding getOtherFieldBindings(BlockScope scope) {
// At this point restrictiveFlag may ONLY have two potential value : FIELD LOCAL (i.e cast <<(VariableBinding) binding>> is valid)
int length = tokens.length;
@@ -601,93 +650,52 @@ public class QualifiedNameReference extends NameReference {
currentScope.emulateOuterAccess((LocalVariableBinding) binding);
}
}
- public void manageSyntheticReadAccessIfNecessary(
+ /**
+ * index is <0 to denote write access emulation
+ */
+ public void manageSyntheticAccessIfNecessary(
BlockScope currentScope,
FieldBinding fieldBinding,
TypeBinding lastReceiverType,
int index,
FlowInfo flowInfo) {
+
if (!flowInfo.isReachable()) return;
- // index == 0 denotes the first fieldBinding, index > 0 denotes one of the 'otherBindings'
+ // index == 0 denotes the first fieldBinding, index > 0 denotes one of the 'otherBindings', index < 0 denotes a write access (to last binding)
if (fieldBinding.constant != NotAConstant)
return;
- if (fieldBinding.isPrivate()) { // private access
- if (fieldBinding.declaringClass != currentScope.enclosingSourceType()) {
- if (syntheticReadAccessors == null) {
- if (otherBindings == null)
- syntheticReadAccessors = new SyntheticAccessMethodBinding[1];
- else
- syntheticReadAccessors =
- new SyntheticAccessMethodBinding[otherBindings.length + 1];
- }
- syntheticReadAccessors[index] = ((SourceTypeBinding) fieldBinding.declaringClass).addSyntheticMethod(fieldBinding, true);
- currentScope.problemReporter().needToEmulateFieldReadAccess(fieldBinding, this);
- return;
- }
- } else if (fieldBinding.isProtected()){
- int depth = index == 0 ? (bits & DepthMASK) >> DepthSHIFT : otherDepths[index-1];
- // implicit protected access (only for first one)
- if (depth > 0 && (fieldBinding.declaringClass.getPackage()
- != currentScope.enclosingSourceType().getPackage())) {
- if (syntheticReadAccessors == null) {
- if (otherBindings == null)
- syntheticReadAccessors = new SyntheticAccessMethodBinding[1];
- else
- syntheticReadAccessors =
- new SyntheticAccessMethodBinding[otherBindings.length + 1];
- }
- syntheticReadAccessors[index] =
- ((SourceTypeBinding) currentScope.enclosingSourceType().enclosingTypeAt(depth))
- .addSyntheticMethod(fieldBinding, true);
- currentScope.problemReporter().needToEmulateFieldReadAccess(fieldBinding, this);
- return;
- }
- }
- // if the binding declaring class is not visible, need special action
- // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
- // NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
- if (fieldBinding.declaringClass != lastReceiverType
- && !lastReceiverType.isArrayType()
- && fieldBinding.declaringClass != null
- && fieldBinding.constant == NotAConstant
- && ((currentScope.environment().options.targetJDK >= ClassFileConstants.JDK1_2
- && (index > 0 || indexOfFirstFieldBinding > 1 || !fieldBinding.isStatic())
- && fieldBinding.declaringClass.id != T_Object)
- || !fieldBinding.declaringClass.canBeSeenBy(currentScope))){
- if (index == 0){
- this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType);
- } else {
- if (this.otherCodegenBindings == this.otherBindings){
- int l = this.otherBindings.length;
- System.arraycopy(this.otherBindings, 0, this.otherCodegenBindings = new FieldBinding[l], 0, l);
- }
- this.otherCodegenBindings[index-1] = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType);
- }
+
+ // if field from parameterized type got found, use the original field at codegen time
+ if (fieldBinding instanceof ParameterizedFieldBinding) {
+ ParameterizedFieldBinding parameterizedField = (ParameterizedFieldBinding) fieldBinding;
+ FieldBinding originalField = parameterizedField.originalField;
+ TypeBinding requiredGenericCast = null;
+ // extra cast needed if field type was type variable
+ if ((originalField.type.tagBits & TagBits.HasTypeVariable) != 0) {
+ requiredGenericCast = originalField.type.genericCast(parameterizedField.type);
+ }
+ setCodegenBinding(fieldBinding, index, originalField, requiredGenericCast);
}
- }
- /*
- * No need to emulate access to protected fields since not implicitly accessed
- */
- public void manageSyntheticWriteAccessIfNecessary(
- BlockScope currentScope,
- FieldBinding fieldBinding,
- TypeBinding lastReceiverType,
- FlowInfo flowInfo) {
- if (!flowInfo.isReachable()) return;
- if (fieldBinding.isPrivate()) {
+
+ if (fieldBinding.isPrivate()) { // private access
if (fieldBinding.declaringClass != currentScope.enclosingSourceType()) {
- syntheticWriteAccessor = ((SourceTypeBinding) fieldBinding.declaringClass)
- .addSyntheticMethod(fieldBinding, false);
- currentScope.problemReporter().needToEmulateFieldWriteAccess(fieldBinding, this);
+ FieldBinding someCodegenBinding = getCodegenBinding(fieldBinding, index);
+ setSyntheticAccessor(fieldBinding, index,
+ ((SourceTypeBinding) fieldBinding.declaringClass).addSyntheticMethod(someCodegenBinding, index >= 0 /*read-access?*/));
+ currentScope.problemReporter().needToEmulateFieldAccess(someCodegenBinding, this, index >= 0 /*read-access?*/);
return;
}
} else if (fieldBinding.isProtected()){
- int depth = fieldBinding == binding ? (bits & DepthMASK) >> DepthSHIFT : otherDepths[otherDepths.length-1];
- if (depth > 0 && (fieldBinding.declaringClass.getPackage()
- != currentScope.enclosingSourceType().getPackage())) {
- syntheticWriteAccessor = ((SourceTypeBinding) currentScope.enclosingSourceType().enclosingTypeAt(depth))
- .addSyntheticMethod(fieldBinding, false);
- currentScope.problemReporter().needToEmulateFieldWriteAccess(fieldBinding, this);
+ int depth = fieldBinding == binding
+ ? (bits & DepthMASK) >> DepthSHIFT
+ : otherDepths[index < 0 ? otherDepths.length-1 : index-1];
+
+ // implicit protected access
+ if (depth > 0 && (fieldBinding.declaringClass.getPackage() != currentScope.enclosingSourceType().getPackage())) {
+ FieldBinding someCodegenBinding = getCodegenBinding(fieldBinding, index);
+ setSyntheticAccessor(fieldBinding, index,
+ ((SourceTypeBinding) currentScope.enclosingSourceType().enclosingTypeAt(depth)).addSyntheticMethod(someCodegenBinding, index >= 0 /*read-access?*/));
+ currentScope.problemReporter().needToEmulateFieldAccess(someCodegenBinding, this, index >= 0 /*read-access?*/);
return;
}
}
@@ -702,19 +710,16 @@ public class QualifiedNameReference extends NameReference {
&& (fieldBinding != binding || indexOfFirstFieldBinding > 1 || !fieldBinding.isStatic())
&& fieldBinding.declaringClass.id != T_Object)
|| !fieldBinding.declaringClass.canBeSeenBy(currentScope))){
- if (fieldBinding == binding){
- this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType);
- } else {
- if (this.otherCodegenBindings == this.otherBindings){
- int l = this.otherBindings.length;
- System.arraycopy(this.otherBindings, 0, this.otherCodegenBindings = new FieldBinding[l], 0, l);
- }
- this.otherCodegenBindings[this.otherCodegenBindings.length-1] = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType);
- }
+ setCodegenBinding(
+ fieldBinding,
+ index,
+ currentScope.enclosingSourceType().getUpdatedFieldBinding(
+ getCodegenBinding(fieldBinding, index),
+ (ReferenceBinding)lastReceiverType.erasure()),
+ null/*reuse existing*/);
}
-
}
-
+
public StringBuffer printExpression(int indent, StringBuffer output) {
for (int i = 0; i < tokens.length; i++) {
@@ -789,14 +794,58 @@ public class QualifiedNameReference extends NameReference {
bits &= ~RestrictiveFlagMASK; // clear bits
bits |= TYPE;
case TYPE : //=============only type ==============
- if (isTypeUseDeprecated((TypeBinding) binding, scope))
- scope.problemReporter().deprecatedType((TypeBinding) binding, this);
- return this.resolvedType = (TypeBinding) binding;
+ TypeBinding type = (TypeBinding) binding;
+ if (isTypeUseDeprecated(type, scope))
+ scope.problemReporter().deprecatedType(type, this);
+ // check raw type
+ if (type.isArrayType()) {
+ TypeBinding leafComponentType = type.leafComponentType();
+ if (leafComponentType.isGenericType()) { // raw type
+ return this.resolvedType = scope.createArrayType(scope.environment().createRawType((ReferenceBinding)leafComponentType, null), type.dimensions());
+ }
+ } else if (type.isGenericType()) {
+ return this.resolvedType = scope.environment().createRawType((ReferenceBinding)type, null); // raw type
+ }
+ return this.resolvedType = type;
}
}
//========error cases===============
return this.resolvedType = this.reportError(scope);
}
+
+ // set the matching codegenBinding and generic cast
+ protected void setCodegenBinding(FieldBinding fieldBinding, int index, FieldBinding someCodegenBinding, TypeBinding someGenericCast) {
+
+ if (fieldBinding == binding){
+ this.codegenBinding = someCodegenBinding;
+ if (someGenericCast != null) this.genericCast = someGenericCast;
+ } else {
+ int length = this.otherBindings.length;
+ int position = index < 0 ? length-1: index-1; // write is always the last
+ if (this.otherCodegenBindings == this.otherBindings){
+ System.arraycopy(this.otherBindings, 0, this.otherCodegenBindings = new FieldBinding[length], 0, length);
+ }
+ this.otherCodegenBindings[position] = someCodegenBinding;
+ if (someGenericCast != null) {
+ if (this.otherGenericCasts == null) {
+ this.otherGenericCasts = new TypeBinding[length];
+ }
+ this.otherGenericCasts[position] = someGenericCast;
+ }
+ }
+ }
+
+ // set the matching synthetic accessor
+ protected void setSyntheticAccessor(FieldBinding fieldBinding, int index, SyntheticAccessMethodBinding syntheticAccessor) {
+ if (index < 0) { // write-access ?
+ syntheticWriteAccessor = syntheticAccessor;
+ } else {
+ if (syntheticReadAccessors == null) {
+ syntheticReadAccessors = new SyntheticAccessMethodBinding[otherBindings == null ? 1 : otherBindings.length + 1];
+ }
+ syntheticReadAccessors[index] = syntheticAccessor;
+ }
+ }
public void setFieldIndex(int index) {
this.indexOfFirstFieldBinding = index;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java
index 93e4c1c64f..a5655d4f2a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java
@@ -72,15 +72,19 @@ public class QualifiedThisReference extends ThisReference {
public TypeBinding resolveType(BlockScope scope) {
constant = NotAConstant;
- this.resolvedType = this.qualification.resolveType(scope);
- if (this.resolvedType == null) return null;
-
+ TypeBinding type = this.resolvedType = this.qualification.resolveType(scope);
+ if (type == null) return null;
+ // X.this is not a raw type as denoting enclosing instance
+ if (type.isRawType()) {
+ RawTypeBinding rawType = (RawTypeBinding) type;
+ type = this.resolvedType = rawType.type; // unwrap
+ }
// the qualification MUST exactly match some enclosing type name
// Its possible to qualify 'this' by the name of the current class
int depth = 0;
this.currentCompatibleType = scope.referenceType().binding;
while (this.currentCompatibleType != null
- && this.currentCompatibleType != this.resolvedType) {
+ && this.currentCompatibleType != type) {
depth++;
this.currentCompatibleType = this.currentCompatibleType.isStatic() ? null : this.currentCompatibleType.enclosingType();
}
@@ -88,15 +92,15 @@ public class QualifiedThisReference extends ThisReference {
bits |= (depth & 0xFF) << DepthSHIFT; // encoded depth into 8 bits
if (this.currentCompatibleType == null) {
- scope.problemReporter().noSuchEnclosingInstance(this.resolvedType, this, false);
- return this.resolvedType;
+ scope.problemReporter().noSuchEnclosingInstance(type, this, false);
+ return type;
}
// Ensure one cannot write code like: B() { super(B.this); }
if (depth == 0) {
checkAccess(scope.methodScope());
} // if depth>0, path emulation will diagnose bad scenarii
- return this.resolvedType;
+ return type;
}
public StringBuffer printExpression(int indent, StringBuffer output) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java
index b37276be0b..c97e3fbf1e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java
@@ -12,6 +12,7 @@ package org.eclipse.jdt.internal.compiler.ast;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
import org.eclipse.jdt.internal.compiler.lookup.*;
+import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
public class QualifiedTypeReference extends TypeReference {
@@ -25,24 +26,23 @@ public class QualifiedTypeReference extends TypeReference {
sourceStart = (int) (sourcePositions[0]>>>32) ;
sourceEnd = (int)(sourcePositions[sourcePositions.length-1] & 0x00000000FFFFFFFFL ) ;
}
-
- public QualifiedTypeReference(char[][] sources , TypeBinding type , long[] poss) {
- this(sources,poss);
- this.resolvedType = type;
- }
-
public TypeReference copyDims(int dim){
//return a type reference copy of me with some dimensions
//warning : the new type ref has a null binding
- return new ArrayQualifiedTypeReference(tokens,null,dim,sourcePositions) ;
+ return new ArrayQualifiedTypeReference(tokens, dim, sourcePositions);
}
- public TypeBinding getTypeBinding(Scope scope) {
+ protected TypeBinding getTypeBinding(Scope scope) {
if (this.resolvedType != null)
return this.resolvedType;
- return scope.getType(tokens);
+ try {
+ return scope.getType(this.tokens, this.tokens.length);
+ } catch (AbortCompilation e) {
+ e.updateContext(this, scope.referenceCompilationUnit().compilationResult);
+ throw e;
+ }
}
public char[][] getTypeName(){
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
index ca74dae364..524e5b7e2c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
@@ -18,7 +18,6 @@ import org.eclipse.jdt.internal.compiler.lookup.*;
public class ReturnStatement extends Statement {
public Expression expression;
- public TypeBinding expressionType;
public boolean isSynchronized;
public SubRoutineStatement[] subroutines;
public boolean isAnySubRoutineEscaping = false;
@@ -92,7 +91,7 @@ public class ReturnStatement extends Statement {
}
} else {
this.saveValueVariable = null;
- if ((!isSynchronized) && (expressionType == BooleanBinding)) {
+ if (!isSynchronized && this.expression != null && this.expression.resolvedType == BooleanBinding) {
this.expression.bits |= ValueForReturnMASK;
}
}
@@ -187,7 +186,9 @@ public class ReturnStatement extends Statement {
expression.printExpression(0, output) ;
return output.append(';');
}
+
public void resolve(BlockScope scope) {
+
MethodScope methodScope = scope.methodScope();
MethodBinding methodBinding;
TypeBinding methodType =
@@ -196,6 +197,7 @@ public class ReturnStatement extends Statement {
? null
: methodBinding.returnType)
: VoidBinding;
+ TypeBinding expressionType;
if (methodType == VoidBinding) {
// the expression should be null
if (expression == null)
@@ -208,12 +210,17 @@ public class ReturnStatement extends Statement {
if (methodType != null) scope.problemReporter().shouldReturn(methodType, this);
return;
}
+ expression.setExpectedType(methodType); // needed in case of generic method invocation
if ((expressionType = expression.resolveType(scope)) == null)
return;
+ if (expressionType.isRawType() && (methodType.isParameterizedType() || methodType.isGenericType())) {
+ scope.problemReporter().unsafeRawReturnValue(this.expression, expressionType, methodType);
+ }
+
if (methodType != null && expression.isConstantValueOfTypeAssignableToType(expressionType, methodType)) {
// dealing with constant
- expression.implicitWidening(methodType, expressionType);
+ expression.computeConversion(scope, methodType, expressionType);
return;
}
if (expressionType == VoidBinding) {
@@ -221,11 +228,11 @@ public class ReturnStatement extends Statement {
return;
}
if (methodType != null && expressionType.isCompatibleWith(methodType)) {
- expression.implicitWidening(methodType, expressionType);
+ expression.computeConversion(scope, methodType, expressionType);
return;
}
if (methodType != null){
- scope.problemReporter().typeMismatchErrorActualTypeExpectedType(expression, expressionType, methodType);
+ scope.problemReporter().typeMismatchError(expressionType, methodType, expression);
}
}
public void traverse(ASTVisitor visitor, BlockScope scope) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java
new file mode 100644
index 0000000000..ae38821c0d
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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.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;
+
+/**
+ * SingleMemberAnnotation node
+ */
+public class SingleMemberAnnotation extends Annotation {
+ public Expression memberValue;
+
+ public SingleMemberAnnotation(char[][] tokens, long[] sourcePositions, int sourceStart) {
+ this.tokens = tokens;
+ this.sourcePositions = sourcePositions;
+ this.sourceStart = sourceStart;
+ this.sourceEnd = (int) sourcePositions[sourcePositions.length - 1];
+ }
+
+ public SingleMemberAnnotation(char[] token, long sourcePosition, int sourceStart) {
+ this.tokens = new char[][] { token };
+ this.sourcePositions = new long[] { sourcePosition };
+ this.sourceStart = sourceStart;
+ this.sourceEnd = (int) sourcePosition;
+ }
+
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+ super.printExpression(indent, output);
+ output.append('(');
+ this.memberValue.printExpression(indent, output);
+ return output.append(')');
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ if (this.memberValue != null) {
+ this.memberValue.traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+ public void traverse(ASTVisitor visitor, ClassScope scope) {
+ if (visitor.visit(this, scope)) {
+ if (this.memberValue != null) {
+ this.memberValue.traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+ public void traverse(ASTVisitor visitor, CompilationUnitScope scope) {
+ if (visitor.visit(this, scope)) {
+ if (this.memberValue != null) {
+ this.memberValue.traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java
index 908732b2df..ee019194ef 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java
@@ -19,11 +19,12 @@ import org.eclipse.jdt.internal.compiler.lookup.*;
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
public class SingleNameReference extends NameReference implements OperatorIds {
+
public char[] token;
-
public MethodBinding[] syntheticAccessors; // [0]=read accessor [1]=write accessor
public static final int READ = 0;
public static final int WRITE = 1;
+ public TypeBinding genericCast;
public SingleNameReference(char[] source, long pos) {
super();
@@ -45,7 +46,7 @@ public class SingleNameReference extends NameReference implements OperatorIds {
currentScope.problemReporter().uninitializedBlankFinalField(fieldBinding, this);
}
}
- manageSyntheticReadAccessIfNecessary(currentScope, flowInfo);
+ manageSyntheticAccessIfNecessary(currentScope, flowInfo, true /*read-access*/);
break;
case LOCAL : // reading a local variable
// check if assigning a final blank field
@@ -66,7 +67,7 @@ public class SingleNameReference extends NameReference implements OperatorIds {
}
switch (bits & RestrictiveFlagMASK) {
case FIELD : // assigning to a field
- manageSyntheticWriteAccessIfNecessary(currentScope, flowInfo);
+ manageSyntheticAccessIfNecessary(currentScope, flowInfo, false /*write-access*/);
// check if assigning a final field
FieldBinding fieldBinding;
@@ -118,7 +119,7 @@ public class SingleNameReference extends NameReference implements OperatorIds {
switch (bits & RestrictiveFlagMASK) {
case FIELD : // reading a field
if (valueRequired) {
- manageSyntheticReadAccessIfNecessary(currentScope, flowInfo);
+ manageSyntheticAccessIfNecessary(currentScope, flowInfo, true /*read-access*/);
}
// check if reading a final blank field
FieldBinding fieldBinding;
@@ -218,6 +219,7 @@ public class SingleNameReference extends NameReference implements OperatorIds {
if (valueRequired) {
codeStream.generateImplicitConversion(assignment.implicitConversion);
}
+ // no need for generic cast as value got dupped
return;
case LOCAL : // assigning to a local variable
LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding;
@@ -297,7 +299,8 @@ public class SingleNameReference extends NameReference implements OperatorIds {
codeStream.invokestatic(syntheticAccessors[READ]);
}
codeStream.generateImplicitConversion(implicitConversion);
- } else { // directly use the inlined value
+ if (this.genericCast != null) codeStream.checkcast(this.genericCast);
+ } else { // directly use the inlined value
codeStream.generateConstant(fieldBinding.constant, implicitConversion);
}
}
@@ -374,7 +377,7 @@ public class SingleNameReference extends NameReference implements OperatorIds {
// using incr bytecode if possible
switch (localBinding.type.id) {
case T_String :
- codeStream.generateStringAppend(currentScope, this, expression);
+ codeStream.generateStringConcatenationAppend(currentScope, this, expression);
if (valueRequired) {
codeStream.dup();
}
@@ -410,7 +413,8 @@ public class SingleNameReference extends NameReference implements OperatorIds {
// we enter here if the single name reference is a field of type java.lang.String or if the type of the
// operation is java.lang.Object
// For example: o = o + ""; // where the compiled type of o is java.lang.Object.
- codeStream.generateStringAppend(currentScope, null, expression);
+ codeStream.generateStringConcatenationAppend(currentScope, null, expression);
+ // no need for generic cast on previous #getfield since using Object string buffer methods.
} else {
// promote the array reference to the suitable operation type
codeStream.generateImplicitConversion(implicitConversion);
@@ -429,6 +433,7 @@ public class SingleNameReference extends NameReference implements OperatorIds {
switch (bits & RestrictiveFlagMASK) {
case FIELD : // assigning to a field
fieldStore(codeStream, (FieldBinding) this.codegenBinding, writeAccessor, valueRequired);
+ // no need for generic cast as value got dupped
return;
case LOCAL : // assigning to a local variable
LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding;
@@ -487,6 +492,7 @@ public class SingleNameReference extends NameReference implements OperatorIds {
codeStream.sendOperator(postIncrement.operator, fieldBinding.type.id);
codeStream.generateImplicitConversion(postIncrement.assignmentImplicitConversion);
fieldStore(codeStream, fieldBinding, syntheticAccessors == null ? null : syntheticAccessors[WRITE], false);
+ // no need for generic cast
return;
case LOCAL : // assigning to a local variable
LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding;
@@ -522,6 +528,13 @@ public class SingleNameReference extends NameReference implements OperatorIds {
codeStream.aload_0();
}
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#genericTypeArguments()
+ */
+ public TypeBinding[] genericTypeArguments() {
+ return null;
+ }
public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
@@ -533,7 +546,7 @@ public class SingleNameReference extends NameReference implements OperatorIds {
currentScope.emulateOuterAccess((LocalVariableBinding) binding);
}
}
- public void manageSyntheticReadAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
+ public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo, boolean isReadAccess) {
if (!flowInfo.isReachable()) return;
@@ -541,55 +554,28 @@ public class SingleNameReference extends NameReference implements OperatorIds {
if (constant != NotAConstant)
return;
+ // if field from parameterized type got found, use the original field at codegen time
+ if (this.binding instanceof ParameterizedFieldBinding) {
+ ParameterizedFieldBinding parameterizedField = (ParameterizedFieldBinding) this.binding;
+ this.codegenBinding = parameterizedField.originalField;
+ FieldBinding fieldCodegenBinding = (FieldBinding)this.codegenBinding;
+ // extra cast needed if field type was type variable
+ if ((fieldCodegenBinding.type.tagBits & TagBits.HasTypeVariable) != 0) {
+ this.genericCast = fieldCodegenBinding.type.genericCast(parameterizedField.type);
+ }
+ }
if ((bits & FIELD) != 0) {
FieldBinding fieldBinding = (FieldBinding) binding;
if (((bits & DepthMASK) != 0)
&& (fieldBinding.isPrivate() // private access
|| (fieldBinding.isProtected() // implicit protected access
- && fieldBinding.declaringClass.getPackage()
- != currentScope.enclosingSourceType().getPackage()))) {
- if (syntheticAccessors == null)
- syntheticAccessors = new MethodBinding[2];
- syntheticAccessors[READ] =
- ((SourceTypeBinding)currentScope.enclosingSourceType().
- enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT)).
- addSyntheticMethod(fieldBinding, true);
- currentScope.problemReporter().needToEmulateFieldReadAccess(fieldBinding, this);
- return;
- }
- // if the binding declaring class is not visible, need special action
- // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
- // NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
- // and not from Object or implicit static field access.
- if (fieldBinding.declaringClass != this.actualReceiverType
- && !this.actualReceiverType.isArrayType()
- && fieldBinding.declaringClass != null
- && fieldBinding.constant == NotAConstant
- && ((currentScope.environment().options.targetJDK >= ClassFileConstants.JDK1_2
- && !fieldBinding.isStatic()
- && fieldBinding.declaringClass.id != T_Object) // no change for Object fields (if there was any)
- || !fieldBinding.declaringClass.canBeSeenBy(currentScope))){
- this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)this.actualReceiverType);
- }
- }
- }
- public void manageSyntheticWriteAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
-
- if (!flowInfo.isReachable()) return;
- if ((bits & FIELD) != 0) {
- FieldBinding fieldBinding = (FieldBinding) binding;
- if (((bits & DepthMASK) != 0)
- && (fieldBinding.isPrivate() // private access
- || (fieldBinding.isProtected() // implicit protected access
- && fieldBinding.declaringClass.getPackage()
- != currentScope.enclosingSourceType().getPackage()))) {
+ && fieldBinding.declaringClass.getPackage() != currentScope.enclosingSourceType().getPackage()))) {
if (syntheticAccessors == null)
syntheticAccessors = new MethodBinding[2];
- syntheticAccessors[WRITE] =
- ((SourceTypeBinding)currentScope.enclosingSourceType().
- enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT)).
- addSyntheticMethod(fieldBinding, false);
- currentScope.problemReporter().needToEmulateFieldWriteAccess(fieldBinding, this);
+ syntheticAccessors[isReadAccess ? READ : WRITE] =
+ ((SourceTypeBinding)currentScope.enclosingSourceType().
+ enclosingTypeAt((bits & DepthMASK) >> DepthSHIFT)).addSyntheticMethod((FieldBinding) this.codegenBinding, isReadAccess);
+ currentScope.problemReporter().needToEmulateFieldAccess((FieldBinding)this.codegenBinding, this, isReadAccess);
return;
}
// if the binding declaring class is not visible, need special action
@@ -604,7 +590,10 @@ public class SingleNameReference extends NameReference implements OperatorIds {
&& !fieldBinding.isStatic()
&& fieldBinding.declaringClass.id != T_Object) // no change for Object fields (if there was any)
|| !fieldBinding.declaringClass.canBeSeenBy(currentScope))){
- this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)this.actualReceiverType);
+ this.codegenBinding =
+ currentScope.enclosingSourceType().getUpdatedFieldBinding(
+ (FieldBinding) this.codegenBinding,
+ (ReferenceBinding)this.actualReceiverType.erasure());
}
}
}
@@ -664,9 +653,19 @@ public class SingleNameReference extends NameReference implements OperatorIds {
case TYPE : //========only type==============
constant = Constant.NotAConstant;
//deprecated test
- if (isTypeUseDeprecated((TypeBinding) binding, scope))
- scope.problemReporter().deprecatedType((TypeBinding) binding, this);
- return this.resolvedType = (TypeBinding) binding;
+ TypeBinding type = (TypeBinding)binding;
+ if (isTypeUseDeprecated(type, scope))
+ scope.problemReporter().deprecatedType(type, this);
+ // check raw type
+ if (type.isArrayType()) {
+ TypeBinding leafComponentType = type.leafComponentType();
+ if (leafComponentType.isGenericType()) { // raw type
+ return this.resolvedType = scope.createArrayType(scope.environment().createRawType((ReferenceBinding)leafComponentType, null), type.dimensions());
+ }
+ } else if (type.isGenericType()) {
+ return this.resolvedType = scope.environment().createRawType((ReferenceBinding)type, null); // raw type
+ }
+ return this.resolvedType = type;
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java
index 4d29467d66..80a54b5cbc 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java
@@ -25,19 +25,14 @@ public class SingleTypeReference extends TypeReference {
}
- public SingleTypeReference(char[] source ,TypeBinding type, long pos) {
- this(source, pos) ;
- this.resolvedType = type ;
- }
-
public TypeReference copyDims(int dim){
//return a type reference copy of me with some dimensions
//warning : the new type ref has a null binding
- return new ArrayTypeReference(token,null,dim,(((long)sourceStart)<<32)+sourceEnd) ;
+ return new ArrayTypeReference(token, dim,(((long)sourceStart)<<32)+sourceEnd);
}
- public TypeBinding getTypeBinding(Scope scope) {
+ protected TypeBinding getTypeBinding(Scope scope) {
if (this.resolvedType != null)
return this.resolvedType;
return scope.getType(token);
@@ -54,14 +49,24 @@ public class SingleTypeReference extends TypeReference {
public TypeBinding resolveTypeEnclosing(BlockScope scope, ReferenceBinding enclosingType) {
- ReferenceBinding memberTb = scope.getMemberType(token, enclosingType);
- if (!memberTb.isValidBinding()) {
- scope.problemReporter().invalidEnclosingType(this, memberTb, enclosingType);
+ ReferenceBinding memberType = scope.getMemberType(token, enclosingType);
+ if (!memberType.isValidBinding()) {
+ scope.problemReporter().invalidEnclosingType(this, memberType, enclosingType);
return null;
}
- if (isTypeUseDeprecated(memberTb, scope))
- scope.problemReporter().deprecatedType(memberTb, this);
- return this.resolvedType = memberTb;
+ if (isTypeUseDeprecated(memberType, scope)) {
+ scope.problemReporter().deprecatedType(memberType, this);
+ }
+ // check raw type
+ if (memberType.isArrayType()) {
+ TypeBinding leafComponentType = memberType.leafComponentType();
+ if (leafComponentType.isGenericType()) { // raw type
+ return this.resolvedType = scope.createArrayType(scope.environment().createRawType((ReferenceBinding)leafComponentType, null), memberType.dimensions());
+ }
+ } else if (memberType.isGenericType()) {
+ return this.resolvedType = scope.environment().createRawType(memberType, null); // raw type
+ }
+ return this.resolvedType = memberType;
}
public void traverse(ASTVisitor visitor, BlockScope scope) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java
index 65cddb15f2..af1de50f55 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java
@@ -170,18 +170,14 @@ public class SwitchStatement extends Statement {
if ((caseIndex < caseCount) && (statement == cases[caseIndex])) { // statements[i] is a case
this.scope.switchCase = cases[caseIndex]; // record entering in a switch case block
if (preSwitchInitStateIndex != -1) {
- codeStream.removeNotDefinitelyAssignedVariables(
- currentScope,
- preSwitchInitStateIndex);
+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, preSwitchInitStateIndex);
}
caseIndex++;
} else {
if (statement == defaultCase) { // statements[i] is a case or a default case
this.scope.switchCase = defaultCase; // record entering in a switch case block
if (preSwitchInitStateIndex != -1) {
- codeStream.removeNotDefinitelyAssignedVariables(
- currentScope,
- preSwitchInitStateIndex);
+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, preSwitchInitStateIndex);
}
}
}
@@ -195,9 +191,7 @@ public class SwitchStatement extends Statement {
}
// May loose some local variable initializations : affecting the local variable attributes
if (mergedInitStateIndex != -1) {
- codeStream.removeNotDefinitelyAssignedVariables(
- currentScope,
- mergedInitStateIndex);
+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, mergedInitStateIndex);
codeStream.addDefinitelyAssignedVariables(currentScope, mergedInitStateIndex);
}
if (scope != currentScope) {
@@ -233,7 +227,7 @@ public class SwitchStatement extends Statement {
TypeBinding testType = expression.resolveType(upperScope);
if (testType == null)
return;
- expression.implicitWidening(testType, testType);
+ expression.computeConversion(upperScope, testType, testType);
if (!(expression.isConstantValueOfTypeAssignableToType(testType, IntBinding))) {
if (!testType.isCompatibleWith(IntBinding)) {
upperScope.problemReporter().incorrectSwitchType(expression, testType);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SynchronizedStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SynchronizedStatement.java
index 2a45c54ee4..6dd2457bbb 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SynchronizedStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SynchronizedStatement.java
@@ -41,6 +41,8 @@ public class SynchronizedStatement extends SubRoutineStatement {
FlowContext flowContext,
FlowInfo flowInfo) {
+ // TODO (philippe) shouldn't it be protected by a check whether reachable statement ?
+
// mark the synthetic variable as being used
synchroVariable.useFlag = LocalVariableBinding.USED;
@@ -105,14 +107,16 @@ public class SynchronizedStatement extends SubRoutineStatement {
if (!blockExit) {
codeStream.load(synchroVariable);
codeStream.monitorexit();
+ this.exitAnyExceptionHandler();
codeStream.goto_(endLabel);
+ this.enterAnyExceptionHandler(codeStream);
}
// generate the body of the exception handler
- this.exitAnyExceptionHandler();
this.placeAllAnyExceptionHandlers();
codeStream.incrStackSize(1);
codeStream.load(synchroVariable);
codeStream.monitorexit();
+ this.exitAnyExceptionHandler();
codeStream.athrow();
if (!blockExit) {
endLabel.place();
@@ -164,7 +168,7 @@ public class SynchronizedStatement extends SubRoutineStatement {
synchroVariable = new LocalVariableBinding(SecretLocalDeclarationName, type, AccDefault, false);
scope.addLocalVariable(synchroVariable);
synchroVariable.constant = NotAConstant; // not inlinable
- expression.implicitWidening(type, type);
+ expression.computeConversion(scope, type, type);
block.resolveUsing(scope);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ThrowStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ThrowStatement.java
index dac8920de1..515d313733 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ThrowStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ThrowStatement.java
@@ -68,7 +68,7 @@ public class ThrowStatement extends Statement {
// if compliant with 1.4, this problem will not be reported
scope.problemReporter().cannotThrowNull(this);
}
- exception.implicitWidening(exceptionType, exceptionType);
+ exception.computeConversion(scope, exceptionType, exceptionType);
}
public void traverse(ASTVisitor visitor, BlockScope blockScope) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java
index bda4130f3d..49885c1e8e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java
@@ -260,15 +260,11 @@ public class TryStatement extends SubRoutineStatement {
thrown) into their own catch variables, the one specified in the source
that must denote the handled exception.
*/
- if (catchArguments == null) {
- this.exitAnyExceptionHandler();
- } else {
+ if (catchArguments != null) {
for (int i = 0; i < maxCatches; i++) {
// May loose some local variable initializations : affecting the local variable attributes
if (preTryInitStateIndex != -1) {
- codeStream.removeNotDefinitelyAssignedVariables(
- currentScope,
- preTryInitStateIndex);
+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, preTryInitStateIndex);
}
exceptionLabels[i].place();
codeStream.incrStackSize(1);
@@ -286,10 +282,6 @@ public class TryStatement extends SubRoutineStatement {
// Keep track of the pcs at diverging point for computing the local attribute
// since not passing the catchScope, the block generation will exitUserScope(catchScope)
catchBlocks[i].generateCode(scope, codeStream);
-
- if (i == maxCatches - 1) {
- this.exitAnyExceptionHandler();
- }
if (!catchExits[i]) {
switch(finallyMode) {
case FINALLY_SUBROUTINE :
@@ -306,22 +298,23 @@ public class TryStatement extends SubRoutineStatement {
}
}
}
+ if (finallyMode != FINALLY_SUBROUTINE || this.subRoutineStartLabel == null) {
+ this.exitAnyExceptionHandler();
+ }
// extra handler for trailing natural exit (will be fixed up later on when natural exit is generated below)
ExceptionLabel naturalExitExceptionHandler =
- finallyMode == FINALLY_SUBROUTINE && requiresNaturalExit ? this.enterAnyExceptionHandler(codeStream) : null;
-
+ finallyMode == FINALLY_SUBROUTINE && requiresNaturalExit ? new ExceptionLabel(codeStream, null) : null;
+
// addition of a special handler so as to ensure that any uncaught exception (or exception thrown
// inside catch blocks) will run the finally block
int finallySequenceStartPC = codeStream.position;
if (subRoutineStartLabel != null) {
- // the additional handler is doing: jsr finallyBlock and rethrow TOS-exception
this.placeAllAnyExceptionHandlers();
-
+ if (naturalExitExceptionHandler != null) naturalExitExceptionHandler.place();
+
if (preTryInitStateIndex != -1) {
// reset initialization state, as for a normal catch block
- codeStream.removeNotDefinitelyAssignedVariables(
- currentScope,
- preTryInitStateIndex);
+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, preTryInitStateIndex);
}
codeStream.incrStackSize(1);
@@ -330,6 +323,7 @@ public class TryStatement extends SubRoutineStatement {
case FINALLY_SUBROUTINE :
codeStream.store(anyExceptionVariable, false);
codeStream.jsr(subRoutineStartLabel);
+ this.exitAnyExceptionHandler();
codeStream.load(anyExceptionVariable);
codeStream.athrow();
subRoutineStartLabel.place();
@@ -382,9 +376,7 @@ public class TryStatement extends SubRoutineStatement {
// May loose some local variable initializations : affecting the local variable attributes
// needed since any exception handler got inlined subroutine
if (preTryInitStateIndex != -1) {
- codeStream.removeNotDefinitelyAssignedVariables(
- currentScope,
- preTryInitStateIndex);
+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, preTryInitStateIndex);
}
// entire sequence for finally is associated to finally block
finallyBlock.generateCode(scope, codeStream);
@@ -406,9 +398,7 @@ public class TryStatement extends SubRoutineStatement {
}
// May loose some local variable initializations : affecting the local variable attributes
if (mergedInitStateIndex != -1) {
- codeStream.removeNotDefinitelyAssignedVariables(
- currentScope,
- mergedInitStateIndex);
+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, mergedInitStateIndex);
codeStream.addDefinitelyAssignedVariables(currentScope, mergedInitStateIndex);
}
codeStream.recordPositionsFrom(pc, this.sourceStart);
@@ -518,17 +508,21 @@ public class TryStatement extends SubRoutineStatement {
if (this.catchBlocks != null) {
int length = this.catchArguments.length;
TypeBinding[] argumentTypes = new TypeBinding[length];
+ boolean catchHasError = false;
for (int i = 0; i < length; i++) {
BlockScope catchScope = new BlockScope(scope);
if (finallyScope != null){
finallyScope.shiftScopes[i+1] = catchScope;
}
// side effect on catchScope in resolveForCatch(..)
- if ((argumentTypes[i] = catchArguments[i].resolveForCatch(catchScope)) == null)
- return;
+ if ((argumentTypes[i] = catchArguments[i].resolveForCatch(catchScope)) == null) {
+ catchHasError = true;
+ }
catchBlocks[i].resolveUsing(catchScope);
}
-
+ if (catchHasError) {
+ return;
+ }
// Verify that the catch clause are ordered in the right way:
// more specialized first.
this.caughtExceptionTypes = new ReferenceBinding[length];
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
index b6ba6f1370..577b67a185 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
@@ -28,6 +28,7 @@ public class TypeDeclaration
public int modifiers = AccDefault;
public int modifiersSourceStart;
+ public Annotation[] annotations;
public char[] name;
public TypeReference superclass;
public TypeReference[] superInterfaces;
@@ -46,12 +47,16 @@ public class TypeDeclaration
public int bodyEnd; // doesn't include the trailing comment if any.
protected boolean hasBeenGenerated = false;
public CompilationResult compilationResult;
- private MethodDeclaration[] missingAbstractMethods;
+ public MethodDeclaration[] missingAbstractMethods;
public Javadoc javadoc;
public QualifiedAllocationExpression allocation; // for anonymous only
public TypeDeclaration enclosingType; // for member types only
+ // 1.5 support
+ public EnumDeclaration[] enums;
+ public TypeParameter[] typeParameters;
+
public TypeDeclaration(CompilationResult compilationResult){
this.compilationResult = compilationResult;
}
@@ -128,7 +133,7 @@ public class TypeDeclaration
String baseName = "arg";//$NON-NLS-1$
Argument[] arguments = (methodDeclaration.arguments = new Argument[argumentsLength]);
for (int i = argumentsLength; --i >= 0;) {
- arguments[i] = new Argument((baseName + i).toCharArray(), 0L, null /*type ref*/, AccDefault);
+ arguments[i] = new Argument((baseName + i).toCharArray(), 0L, null /*type ref*/, AccDefault, false /*not vararg*/);
}
}
@@ -371,7 +376,7 @@ public class TypeDeclaration
if (argumentsLength > 0) {
Argument[] arguments = (cd.arguments = new Argument[argumentsLength]);
for (int i = argumentsLength; --i >= 0;) {
- arguments[i] = new Argument((baseName + i).toCharArray(), 0L, null /*type ref*/, AccDefault);
+ arguments[i] = new Argument((baseName + i).toCharArray(), 0L, null /*type ref*/, AccDefault, false /*not vararg*/);
}
}
@@ -550,10 +555,7 @@ public class TypeDeclaration
methods[i].generateCode(scope, classFile);
}
}
-
- classFile.generateMissingAbstractMethods(this.missingAbstractMethods, scope.referenceCompilationUnit().compilationResult);
-
- // generate all methods
+ // generate all synthetic and abstract methods
classFile.addSpecialMethods();
if (ignoreFurtherInvestigation) { // trigger problem type generation for code gen errors
@@ -660,14 +662,14 @@ public class TypeDeclaration
if (nonStaticFieldInfo == FlowInfo.DEAD_END) {
initializerScope.problemReporter().initializerMustCompleteNormally(field);
nonStaticFieldInfo = FlowInfo.initial(maxFieldCount).setReachMode(FlowInfo.UNREACHABLE);
- }
+ }
}
}
}
if (memberTypes != null) {
for (int i = 0, count = memberTypes.length; i < count; i++) {
if (flowContext != null){ // local type
- memberTypes[i].analyseCode(scope, flowContext, nonStaticFieldInfo.copy());
+ memberTypes[i].analyseCode(scope, flowContext, nonStaticFieldInfo.copy().setReachMode(flowInfo.reachMode())); // reset reach mode in case initializers did abrupt completely
} else {
memberTypes[i].analyseCode(scope);
}
@@ -684,10 +686,10 @@ public class TypeDeclaration
if (method.isStatic()) { // <clinit>
method.analyseCode(
scope,
- staticInitializerContext,
- staticFieldInfo.unconditionalInits().discardNonFieldInitializations().addInitializationsFrom(outerInfo));
+ staticInitializerContext,
+ staticFieldInfo.unconditionalInits().discardNonFieldInitializations().addInitializationsFrom(outerInfo).setReachMode(flowInfo.reachMode())); // reset reach mode in case initializers did abrupt completely
} else { // constructor
- method.analyseCode(scope, initializerContext, constructorInfo.copy());
+ method.analyseCode(scope, initializerContext, constructorInfo.copy().setReachMode(flowInfo.reachMode())); // reset reach mode in case initializers did abrupt completely
}
} else { // regular method
method.analyseCode(scope, null, flowInfo.copy());
@@ -846,6 +848,14 @@ public class TypeDeclaration
printModifiers(this.modifiers, output);
output.append(isInterface() ? "interface " : "class "); //$NON-NLS-1$ //$NON-NLS-2$
output.append(name);
+ if (typeParameters != null) {
+ output.append("<");//$NON-NLS-1$
+ for (int i = 0; i < typeParameters.length; i++) {
+ if (i > 0) output.append( ", "); //$NON-NLS-1$
+ typeParameters[i].print(0, output);
+ }
+ output.append(">");//$NON-NLS-1$
+ }
if (superclass != null) {
output.append(" extends "); //$NON-NLS-1$
superclass.print(0, output);
@@ -874,17 +884,6 @@ public class TypeDeclaration
if ((this.bits & UndocumentedEmptyBlockMASK) != 0) {
this.scope.problemReporter().undocumentedEmptyBlock(this.bodyStart-1, this.bodyEnd);
}
- // check superclass & interfaces
- if (this.binding.superclass != null) // watch out for Object ! (and other roots)
- if (isTypeUseDeprecated(this.binding.superclass, this.scope))
- this.scope.problemReporter().deprecatedType(this.binding.superclass, this.superclass);
- if (this.superInterfaces != null)
- for (int i = this.superInterfaces.length; --i >= 0;)
- if (this.superInterfaces[i].resolvedType != null)
- if (isTypeUseDeprecated(this.superInterfaces[i].resolvedType, this.scope))
- this.scope.problemReporter().deprecatedType(
- this.superInterfaces[i].resolvedType,
- this.superInterfaces[i]);
this.maxFieldCount = 0;
int lastVisibleFieldID = -1;
if (this.fields != null) {
@@ -988,33 +987,49 @@ public class TypeDeclaration
return;
try {
if (visitor.visit(this, unitScope)) {
- if (superclass != null)
- superclass.traverse(visitor, scope);
- if (superInterfaces != null) {
- int superInterfaceLength = superInterfaces.length;
- for (int i = 0; i < superInterfaceLength; i++)
- superInterfaces[i].traverse(visitor, scope);
+ if (this.annotations != null) {
+ int annotationsLength = this.annotations.length;
+ for (int i = 0; i < annotationsLength; i++)
+ this.annotations[i].traverse(visitor, scope);
}
- if (memberTypes != null) {
- int memberTypesLength = memberTypes.length;
- for (int i = 0; i < memberTypesLength; i++)
- memberTypes[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 (fields != null) {
- int fieldsLength = fields.length;
- for (int i = 0; i < fieldsLength; i++) {
+ if (this.typeParameters != null) {
+ int length = this.typeParameters.length;
+ for (int i = 0; i < length; i++) {
+ this.typeParameters[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 = fields[i]).isStatic()) {
+ if ((field = this.fields[i]).isStatic()) {
field.traverse(visitor, staticInitializerScope);
} else {
field.traverse(visitor, initializerScope);
}
}
}
- if (methods != null) {
- int methodsLength = methods.length;
- for (int i = 0; i < methodsLength; i++)
- methods[i].traverse(visitor, scope);
+ 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);
@@ -1032,33 +1047,49 @@ public class TypeDeclaration
return;
try {
if (visitor.visit(this, blockScope)) {
- if (superclass != null)
- superclass.traverse(visitor, scope);
- if (superInterfaces != null) {
- int superInterfaceLength = superInterfaces.length;
- for (int i = 0; i < superInterfaceLength; i++)
- superInterfaces[i].traverse(visitor, scope);
+ if (this.annotations != null) {
+ int annotationsLength = this.annotations.length;
+ for (int i = 0; i < annotationsLength; i++)
+ this.annotations[i].traverse(visitor, scope);
}
- if (memberTypes != null) {
- int memberTypesLength = memberTypes.length;
- for (int i = 0; i < memberTypesLength; i++)
- memberTypes[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 (fields != null) {
- int fieldsLength = fields.length;
- for (int i = 0; i < fieldsLength; i++) {
+ if (this.typeParameters != null) {
+ int length = this.typeParameters.length;
+ for (int i = 0; i < length; i++) {
+ this.typeParameters[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 = fields[i]).isStatic()) {
+ if ((field = this.fields[i]).isStatic()) {
// local type cannot have static fields
} else {
field.traverse(visitor, initializerScope);
}
}
}
- if (methods != null) {
- int methodsLength = methods.length;
- for (int i = 0; i < methodsLength; i++)
- methods[i].traverse(visitor, scope);
+ 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);
@@ -1076,33 +1107,49 @@ public class TypeDeclaration
return;
try {
if (visitor.visit(this, classScope)) {
- if (superclass != null)
- superclass.traverse(visitor, scope);
- if (superInterfaces != null) {
- int superInterfaceLength = superInterfaces.length;
- for (int i = 0; i < superInterfaceLength; i++)
- superInterfaces[i].traverse(visitor, scope);
+ if (this.annotations != null) {
+ int annotationsLength = this.annotations.length;
+ for (int i = 0; i < annotationsLength; i++)
+ this.annotations[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 (memberTypes != null) {
- int memberTypesLength = memberTypes.length;
- for (int i = 0; i < memberTypesLength; i++)
- memberTypes[i].traverse(visitor, scope);
+ if (this.typeParameters != null) {
+ int length = this.typeParameters.length;
+ for (int i = 0; i < length; i++) {
+ this.typeParameters[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 (fields != null) {
- int fieldsLength = fields.length;
- for (int i = 0; i < fieldsLength; i++) {
+ 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 = fields[i]).isStatic()) {
+ if ((field = this.fields[i]).isStatic()) {
field.traverse(visitor, staticInitializerScope);
} else {
field.traverse(visitor, initializerScope);
}
}
}
- if (methods != null) {
- int methodsLength = methods.length;
- for (int i = 0; i < methodsLength; i++)
- methods[i].traverse(visitor, scope);
+ 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);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java
new file mode 100644
index 0000000000..c6ab461815
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * 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.ASTVisitor;
+import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
+import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
+import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
+import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
+
+public class TypeParameter extends AbstractVariableDeclaration {
+
+ public TypeVariableBinding binding;
+ public TypeReference[] bounds;
+
+ public void resolve(ClassScope scope) {
+ // TODO (philippe) add warning for detecting variable name collisions
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.compiler.ast.AstNode#print(int, java.lang.StringBuffer)
+ */
+ public StringBuffer printStatement(int indent, StringBuffer output) {
+ output.append(this.name);
+ if (this.type != null) {
+ output.append(" extends "); //$NON-NLS-1$
+ this.type.print(0, output);
+ }
+ if (this.bounds != null){
+ for (int i = 0; i < this.bounds.length; i++) {
+ output.append(" & "); //$NON-NLS-1$
+ this.bounds[i].print(0, output);
+ }
+ }
+ return output;
+ }
+
+ public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+ // nothing to do
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ if (type != null) {
+ type.traverse(visitor, scope);
+ }
+ if (bounds != null) {
+ int boundsLength = this.bounds.length;
+ for (int i = 0; i < boundsLength; i++) {
+ this.bounds[i].traverse(visitor, scope);
+ }
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+
+ public void traverse(ASTVisitor visitor, ClassScope scope) {
+ if (visitor.visit(this, scope)) {
+ if (type != null) {
+ type.traverse(visitor, scope);
+ }
+ if (bounds != null) {
+ int boundsLength = this.bounds.length;
+ for (int i = 0; i < boundsLength; i++) {
+ this.bounds[i].traverse(visitor, scope);
+ }
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java
index 2e8e10c5d3..eff3ddbbab 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java
@@ -81,7 +81,14 @@ public abstract TypeReference copyDims(int dim);
public int dimensions() {
return 0;
}
-public abstract TypeBinding getTypeBinding(Scope scope);
+/**
+ * @return char[][]
+ * TODO (jerome) should merge back into #getTypeName()
+ */
+public char [][] getParameterizedTypeName(){
+ return getTypeName();
+}
+protected abstract TypeBinding getTypeBinding(Scope scope);
/**
* @return char[][]
*/
@@ -89,43 +96,86 @@ public abstract char [][] getTypeName() ;
public boolean isTypeReference() {
return true;
}
+public TypeBinding resolveSuperType(ClassScope scope) {
+ if (resolveType(scope) == null) return null;
+
+ if (this.resolvedType.isTypeVariable()) {
+ this.resolvedType = new ProblemReferenceBinding(getTypeName(), (ReferenceBinding) this.resolvedType, ProblemReasons.IllegalSuperTypeVariable);
+ reportInvalidType(scope);
+ return null;
+ }
+ return this.resolvedType;
+}
public TypeBinding resolveType(BlockScope blockScope) {
// handle the error here
this.constant = NotAConstant;
- if (this.resolvedType != null) { // is a shared type reference which was already resolved
- if (!this.resolvedType.isValidBinding())
+ TypeBinding type;
+ if ((type = this.resolvedType) != null) { // is a shared type reference which was already resolved
+ if (!type.isValidBinding())
return null; // already reported error
} else {
- this.resolvedType = getTypeBinding(blockScope);
- if (!this.resolvedType.isValidBinding()) {
+ type = this.resolvedType = getTypeBinding(blockScope);
+ if (type == null)
+ return null; // detected cycle while resolving hierarchy
+ if (!type.isValidBinding()) {
reportInvalidType(blockScope);
return null;
}
- if (isTypeUseDeprecated(this.resolvedType, blockScope)) {
+ if (isTypeUseDeprecated(type, blockScope)) {
reportDeprecatedType(blockScope);
}
+ // check raw type
+ if (type.isArrayType()) {
+ TypeBinding leafComponentType = type.leafComponentType();
+ if (leafComponentType.isGenericType()) { // raw type
+ return this.resolvedType = blockScope.createArrayType(blockScope.environment().createRawType((ReferenceBinding)leafComponentType, null), type.dimensions());
+ }
+ } else if (type.isGenericType()) {
+ return this.resolvedType = blockScope.environment().createRawType((ReferenceBinding)type, null); // raw type
+ }
}
return this.resolvedType;
}
-
public TypeBinding resolveType(ClassScope classScope) {
// handle the error here
this.constant = NotAConstant;
- if (this.resolvedType != null) { // is a shared type reference which was already resolved
- if (!this.resolvedType.isValidBinding())
+ TypeBinding type;
+ if ((type = this.resolvedType) != null) { // is a shared type reference which was already resolved
+ if (!type.isValidBinding())
return null; // already reported error
} else {
- this.resolvedType = getTypeBinding(classScope);
- if (!this.resolvedType.isValidBinding()) {
+ type = this.resolvedType = getTypeBinding(classScope);
+ if (type == null)
+ return null; // detected cycle while resolving hierarchy
+ if (!type.isValidBinding()) {
reportInvalidType(classScope);
return null;
}
- if (isTypeUseDeprecated(this.resolvedType, classScope)) {
+ if (isTypeUseDeprecated(type, classScope)) {
reportDeprecatedType(classScope);
}
+ // check raw type
+ if (type.isArrayType()) {
+ TypeBinding leafComponentType = type.leafComponentType();
+ if (leafComponentType.isGenericType()) { // raw type
+ return this.resolvedType = classScope.createArrayType(classScope.environment().createRawType((ReferenceBinding)leafComponentType, null), type.dimensions());
+ }
+ } else if (type.isGenericType()) {
+ return this.resolvedType = classScope.environment().createRawType((ReferenceBinding)type, null); // raw type
+ }
+
}
return this.resolvedType;
}
+
+public TypeBinding resolveTypeArgument(BlockScope blockScope, ReferenceBinding genericType, int rank) {
+ return resolveType(blockScope);
+}
+
+public TypeBinding resolveTypeArgument(ClassScope classScope, ReferenceBinding genericType, int rank) {
+ return resolveType(classScope);
+}
+
protected void reportInvalidType(Scope scope) {
scope.problemReporter().invalidType(this, this.resolvedType);
}
@@ -133,4 +183,5 @@ protected void reportDeprecatedType(Scope scope) {
scope.problemReporter().deprecatedType(this.resolvedType, this);
}
public abstract void traverse(ASTVisitor visitor, ClassScope classScope);
+public abstract void traverse(ASTVisitor visitor, BlockScope classScope);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java
index b7e1441c6a..fcc591b6f3 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java
@@ -110,7 +110,6 @@ public class WhileStatement extends Statement {
if (!actionInfo.isReachable() && !loopingContext.initsOnContinue.isReachable()) {
continueLabel = null;
} else {
- // TODO (philippe) should simplify in one Loop context
condLoopContext.complainOnFinalAssignmentsInLoop(currentScope, postCondInfo);
actionInfo = actionInfo.mergedWith(loopingContext.initsOnContinue.unconditionalInits());
loopingContext.complainOnFinalAssignmentsInLoop(currentScope, actionInfo);
@@ -178,9 +177,7 @@ public class WhileStatement extends Statement {
action.generateCode(currentScope, codeStream);
// May loose some local variable initializations : affecting the local variable attributes
if (preCondInitStateIndex != -1) {
- codeStream.removeNotDefinitelyAssignedVariables(
- currentScope,
- preCondInitStateIndex);
+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, preCondInitStateIndex);
}
}
@@ -207,7 +204,7 @@ public class WhileStatement extends Statement {
public void resolve(BlockScope scope) {
TypeBinding type = condition.resolveTypeExpecting(scope, BooleanBinding);
- condition.implicitWidening(type, type);
+ condition.computeConversion(scope, type, type);
if (action != null)
action.resolve(scope);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java
new file mode 100644
index 0000000000..06d29844d3
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * 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.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.compiler.ASTVisitor;
+import org.eclipse.jdt.internal.compiler.lookup.*;
+
+/**
+ * Node to represent Wildcard
+ */
+public class Wildcard extends SingleTypeReference {
+
+ public static final int UNBOUND = 0;
+ public static final int EXTENDS = 1;
+ public static final int SUPER = 2;
+
+ public TypeReference bound;
+ public int kind;
+
+ public Wildcard(int kind) {
+ super(WILDCARD_NAME, 0);
+ this.kind = kind;
+ }
+
+ public char [][] getParameterizedTypeName() {
+ switch (this.kind) {
+ case Wildcard.UNBOUND :
+ return new char[][] { WILDCARD_NAME };
+ case Wildcard.EXTENDS :
+ return new char[][] { CharOperation.concat(WILDCARD_NAME, WILDCARD_EXTENDS, CharOperation.concatWith(this.bound.getParameterizedTypeName(), '.')) };
+ default: // SUPER
+ return new char[][] { CharOperation.concat(WILDCARD_NAME, WILDCARD_SUPER, CharOperation.concatWith(this.bound.getParameterizedTypeName(), '.')) };
+ }
+ }
+
+ public char [][] getTypeName() {
+ switch (this.kind) {
+ case Wildcard.UNBOUND :
+ return new char[][] { WILDCARD_NAME };
+ case Wildcard.EXTENDS :
+ return new char[][] { CharOperation.concat(WILDCARD_NAME, WILDCARD_EXTENDS, CharOperation.concatWith(this.bound.getTypeName(), '.')) };
+ default: // SUPER
+ return new char[][] { CharOperation.concat(WILDCARD_NAME, WILDCARD_SUPER, CharOperation.concatWith(this.bound.getTypeName(), '.')) };
+ }
+ }
+
+ private TypeBinding internalResolveType(Scope scope, ReferenceBinding genericType, int rank) {
+ TypeBinding boundType = null;
+ if (this.bound != null) {
+ boundType = scope.kind == Scope.CLASS_SCOPE
+ ? this.bound.resolveType((ClassScope)scope)
+ : this.bound.resolveType((BlockScope)scope);
+
+ if (boundType == null) {
+ return null;
+ }
+ }
+ WildcardBinding wildcard = scope.environment().createWildcard(genericType, rank, boundType, this.kind);
+ return this.resolvedType = wildcard;
+ }
+
+ public StringBuffer printExpression(int indent, StringBuffer output){
+ switch (this.kind) {
+ case Wildcard.UNBOUND :
+ output.append(WILDCARD_NAME);
+ case Wildcard.EXTENDS :
+ output.append(WILDCARD_NAME).append(WILDCARD_EXTENDS);
+ this.bound.printExpression(0, output);
+ break;
+ default: // SUPER
+ output.append(WILDCARD_NAME).append(WILDCARD_SUPER);
+ this.bound.printExpression(0, output);
+ break;
+ }
+ return output;
+ }
+
+ public TypeBinding resolveTypeArgument(BlockScope blockScope, ReferenceBinding genericType, int rank) {
+ return internalResolveType(blockScope, genericType, rank);
+ }
+
+ public TypeBinding resolveTypeArgument(ClassScope classScope, ReferenceBinding genericType, int rank) {
+ return internalResolveType(classScope, genericType, rank);
+ }
+
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ if (visitor.visit(this, scope)) {
+ if (this.bound != null) {
+ this.bound.traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+
+ public void traverse(ASTVisitor visitor, ClassScope scope) {
+ if (visitor.visit(this, scope)) {
+ if (this.bound != null) {
+ this.bound.traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java
index 6899fa0631..5662e9da92 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java
@@ -22,25 +22,75 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
import org.eclipse.jdt.internal.compiler.util.Util;
public class ClassFileReader extends ClassFileStruct implements AttributeNamesConstants, IBinaryType {
- private int constantPoolCount;
- private int[] constantPoolOffsets;
- private long version;
+public static ClassFileReader read(File file) throws ClassFormatException, IOException {
+ return read(file, false);
+}
+public static ClassFileReader read(File file, boolean fullyInitialize) throws ClassFormatException, IOException {
+ byte classFileBytes[] = Util.getFileByteContent(file);
+ ClassFileReader classFileReader = new ClassFileReader(classFileBytes, file.getAbsolutePath().toCharArray());
+ if (fullyInitialize) {
+ classFileReader.initialize();
+ }
+ return classFileReader;
+}
+public static ClassFileReader read(
+ java.util.zip.ZipFile zip,
+ String filename)
+ throws ClassFormatException, java.io.IOException {
+ return read(zip, filename, false);
+}
+public static ClassFileReader read(
+ java.util.zip.ZipFile zip,
+ String filename,
+ boolean fullyInitialize)
+ throws ClassFormatException, java.io.IOException {
+ java.util.zip.ZipEntry ze = zip.getEntry(filename);
+ if (ze == null)
+ return null;
+ byte classFileBytes[] = Util.getZipEntryByteContent(ze, zip);
+ ClassFileReader classFileReader = new ClassFileReader(classFileBytes, filename.toCharArray());
+ if (fullyInitialize) {
+ classFileReader.initialize();
+ }
+ return classFileReader;
+}
+public static ClassFileReader read(String fileName) throws ClassFormatException, java.io.IOException {
+ return read(fileName, false);
+}
+public static ClassFileReader read(String fileName, boolean fullyInitialize) throws ClassFormatException, java.io.IOException {
+ return read(new File(fileName), fullyInitialize);
+}
private int accessFlags;
+ private char[] classFileName;
private char[] className;
- private char[] superclassName;
- private int interfacesCount;
- private char[][] interfaceNames;
- private int fieldsCount;
+ private int classNameIndex;
+ private int constantPoolCount;
+ private int[] constantPoolOffsets;
private FieldInfo[] fields;
- private int methodsCount;
- private MethodInfo[] methods;
- private InnerClassInfo[] innerInfos;
- private char[] sourceFileName;
+ private int fieldsCount;
// initialized in case the .class file is a nested type
private InnerClassInfo innerInfo;
- private char[] classFileName;
- private int classNameIndex;
private int innerInfoIndex;
+ private InnerClassInfo[] innerInfos;
+ private char[][] interfaceNames;
+ private int interfacesCount;
+ private MethodInfo[] methods;
+ private int methodsCount;
+ private char[] signature;
+ private char[] sourceFileName;
+ private char[] superclassName;
+ private long version;
+
+/**
+ * @param classFileBytes Actual bytes of a .class file
+ * @param fileName Actual name of the file that contains the bytes, can be null
+ *
+ * @exception ClassFormatException
+ */
+public ClassFileReader(byte classFileBytes[], char[] fileName) throws ClassFormatException {
+ this(classFileBytes, fileName, false);
+}
+
/**
* @param classFileBytes byte[]
* Actual bytes of a .class file
@@ -178,33 +228,30 @@ public ClassFileReader(byte[] classFileBytes, char[] fileName, boolean fullyInit
char[] attributeName = utf8At(utf8Offset + 3, u2At(utf8Offset + 1));
if (CharOperation.equals(attributeName, DeprecatedName)) {
this.accessFlags |= AccDeprecated;
- } else {
- if (CharOperation.equals(attributeName, InnerClassName)) {
- int innerOffset = readOffset + 6;
- int number_of_classes = u2At(innerOffset);
- if (number_of_classes != 0) {
- innerOffset+= 2;
- this.innerInfos = new InnerClassInfo[number_of_classes];
- for (int j = 0; j < number_of_classes; j++) {
- this.innerInfos[j] =
- new InnerClassInfo(reference, this.constantPoolOffsets, innerOffset);
- if (this.classNameIndex == this.innerInfos[j].innerClassNameIndex) {
- this.innerInfo = this.innerInfos[j];
- this.innerInfoIndex = j;
- }
- innerOffset += 8;
- }
- }
- } else {
- if (CharOperation.equals(attributeName, SourceName)) {
- utf8Offset = this.constantPoolOffsets[u2At(readOffset + 6)];
- this.sourceFileName = utf8At(utf8Offset + 3, u2At(utf8Offset + 1));
- } else {
- if (CharOperation.equals(attributeName, SyntheticName)) {
- this.accessFlags |= AccSynthetic;
+ } else if (CharOperation.equals(attributeName, InnerClassName)) {
+ int innerOffset = readOffset + 6;
+ int number_of_classes = u2At(innerOffset);
+ if (number_of_classes != 0) {
+ innerOffset+= 2;
+ this.innerInfos = new InnerClassInfo[number_of_classes];
+ for (int j = 0; j < number_of_classes; j++) {
+ this.innerInfos[j] =
+ new InnerClassInfo(reference, this.constantPoolOffsets, innerOffset);
+ if (this.classNameIndex == this.innerInfos[j].innerClassNameIndex) {
+ this.innerInfo = this.innerInfos[j];
+ this.innerInfoIndex = j;
}
+ innerOffset += 8;
}
}
+ } else if (CharOperation.equals(attributeName, SourceName)) {
+ utf8Offset = this.constantPoolOffsets[u2At(readOffset + 6)];
+ this.sourceFileName = utf8At(utf8Offset + 3, u2At(utf8Offset + 1));
+ } else if (CharOperation.equals(attributeName, SyntheticName)) {
+ this.accessFlags |= AccSynthetic;
+ } else if (CharOperation.equals(attributeName, SignatureName)) {
+ utf8Offset = this.constantPoolOffsets[u2At(readOffset + 6)];
+ this.signature = utf8At(utf8Offset + 3, u2At(utf8Offset + 1));
}
readOffset += (6 + u4At(readOffset + 2));
}
@@ -221,16 +268,6 @@ public ClassFileReader(byte[] classFileBytes, char[] fileName, boolean fullyInit
}
/**
- * @param classFileBytes Actual bytes of a .class file
- * @param fileName Actual name of the file that contains the bytes, can be null
- *
- * @exception ClassFormatException
- */
-public ClassFileReader(byte classFileBytes[], char[] fileName) throws ClassFormatException {
- this(classFileBytes, fileName, false);
-}
-
-/**
* Answer the receiver's access flags. The value of the access_flags
* item is a mask of modifiers used with class and interface declarations.
* @return int
@@ -281,6 +318,9 @@ public IBinaryField[] getFields() {
public char[] getFileName() {
return this.classFileName;
}
+public char[] getGenericSignature() {
+ return this.signature;
+}
/**
* Answer the source name if the receiver is a inner type. Return null if it is an anonymous class or if the receiver is a top-level class.
* e.g.
@@ -426,126 +466,56 @@ public char[] getSuperclassName() {
public long getVersion() {
return this.version;
}
-/**
- * Answer true if the receiver is an anonymous type, false otherwise
- *
- * @return <CODE>boolean</CODE>
- */
-public boolean isAnonymous() {
- if (this.innerInfo == null) return false;
- char[] sourceName = this.innerInfo.getSourceName();
- return (sourceName == null || sourceName.length == 0);
-}
-/**
- * Answer whether the receiver contains the resolved binary form
- * or the unresolved source form of the type.
- * @return boolean
- */
-public boolean isBinaryType() {
- return true;
-}
-/**
- * Answer true if the receiver is a class. False otherwise.
- * @return boolean
- */
-public boolean isClass() {
- return (getModifiers() & AccInterface) == 0;
-}
-/**
- * Answer true if the receiver is an interface. False otherwise.
- * @return boolean
- */
-public boolean isInterface() {
- return (getModifiers() & AccInterface) != 0;
-}
-/**
- * Answer true if the receiver is a local type, false otherwise
- *
- * @return <CODE>boolean</CODE>
- */
-public boolean isLocal() {
- if (this.innerInfo == null) return false;
- if (this.innerInfo.getEnclosingTypeName() != null) return false;
- char[] sourceName = this.innerInfo.getSourceName();
- return (sourceName != null && sourceName.length > 0);
-}
-/**
- * Answer true if the receiver is a member type, false otherwise
- *
- * @return <CODE>boolean</CODE>
- */
-public boolean isMember() {
- if (this.innerInfo == null) return false;
- if (this.innerInfo.getEnclosingTypeName() == null) return false;
- char[] sourceName = this.innerInfo.getSourceName();
- return (sourceName != null && sourceName.length > 0); // protection against ill-formed attributes (67600)
-}
-/**
- * Answer true if the receiver is a nested type, false otherwise
- *
- * @return <CODE>boolean</CODE>
- */
-public boolean isNestedType() {
- return this.innerInfo != null;
-}
-public static ClassFileReader read(File file) throws ClassFormatException, IOException {
- return read(file, false);
-}
-public static ClassFileReader read(File file, boolean fullyInitialize) throws ClassFormatException, IOException {
- byte classFileBytes[] = Util.getFileByteContent(file);
- ClassFileReader classFileReader = new ClassFileReader(classFileBytes, file.getAbsolutePath().toCharArray());
- if (fullyInitialize) {
- classFileReader.initialize();
+private boolean hasNonSyntheticFieldChanges(FieldInfo[] currentFieldInfos, FieldInfo[] otherFieldInfos) {
+ int length1 = currentFieldInfos == null ? 0 : currentFieldInfos.length;
+ int length2 = otherFieldInfos == null ? 0 : otherFieldInfos.length;
+ int index1 = 0;
+ int index2 = 0;
+
+ end : while (index1 < length1 && index2 < length2) {
+ while (currentFieldInfos[index1].isSynthetic()) {
+ if (++index1 >= length1) break end;
+ }
+ while (otherFieldInfos[index2].isSynthetic()) {
+ if (++index2 >= length2) break end;
+ }
+ if (hasStructuralFieldChanges(currentFieldInfos[index1++], otherFieldInfos[index2++]))
+ return true;
}
- return classFileReader;
-}
-public static ClassFileReader read(String fileName) throws ClassFormatException, java.io.IOException {
- return read(fileName, false);
-}
-public static ClassFileReader read(String fileName, boolean fullyInitialize) throws ClassFormatException, java.io.IOException {
- return read(new File(fileName), fullyInitialize);
-}
-public static ClassFileReader read(
- java.util.zip.ZipFile zip,
- String filename)
- throws ClassFormatException, java.io.IOException {
- return read(zip, filename, false);
-}
-public static ClassFileReader read(
- java.util.zip.ZipFile zip,
- String filename,
- boolean fullyInitialize)
- throws ClassFormatException, java.io.IOException {
- java.util.zip.ZipEntry ze = zip.getEntry(filename);
- if (ze == null)
- return null;
- byte classFileBytes[] = Util.getZipEntryByteContent(ze, zip);
- ClassFileReader classFileReader = new ClassFileReader(classFileBytes, filename.toCharArray());
- if (fullyInitialize) {
- classFileReader.initialize();
+
+ while (index1 < length1) {
+ if (!currentFieldInfos[index1++].isSynthetic()) return true;
}
- return classFileReader;
+ while (index2 < length2) {
+ if (!otherFieldInfos[index2++].isSynthetic()) return true;
+ }
+ return false;
}
+private boolean hasNonSyntheticMethodChanges(MethodInfo[] currentMethodInfos, MethodInfo[] otherMethodInfos) {
+ int length1 = currentMethodInfos == null ? 0 : currentMethodInfos.length;
+ int length2 = otherMethodInfos == null ? 0 : otherMethodInfos.length;
+ int index1 = 0;
+ int index2 = 0;
-/**
- * Answer the source file name attribute. Return null if there is no source file attribute for the receiver.
- *
- * @return char[]
- */
-public char[] sourceFileName() {
- return this.sourceFileName;
-}
-public String toString() {
- java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream();
- java.io.PrintWriter print = new java.io.PrintWriter(out);
-
- print.println(this.getClass().getName() + "{"); //$NON-NLS-1$
- print.println(" this.className: " + new String(getName())); //$NON-NLS-1$
- print.println(" this.superclassName: " + (getSuperclassName() == null ? "null" : new String(getSuperclassName()))); //$NON-NLS-2$ //$NON-NLS-1$
- print.println(" access_flags: " + ClassFileStruct.printTypeModifiers(this.accessFlags()) + "(" + this.accessFlags() + ")"); //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$
+ MethodInfo m;
+ end : while (index1 < length1 && index2 < length2) {
+ while ((m = currentMethodInfos[index1]).isSynthetic() || m.isClinit()) {
+ if (++index1 >= length1) break end;
+ }
+ while ((m = otherMethodInfos[index2]).isSynthetic() || m.isClinit()) {
+ if (++index2 >= length2) break end;
+ }
+ if (hasStructuralMethodChanges(currentMethodInfos[index1++], otherMethodInfos[index2++]))
+ return true;
+ }
- print.flush();
- return out.toString();
+ while (index1 < length1) {
+ if (!((m = currentMethodInfos[index1++]).isSynthetic() || m.isClinit())) return true;
+ }
+ while (index2 < length2) {
+ if (!((m = otherMethodInfos[index2++]).isSynthetic() || m.isClinit())) return true;
+ }
+ return false;
}
/**
* Check if the receiver has structural changes compare to the byte array in argument.
@@ -682,31 +652,6 @@ public boolean hasStructuralChanges(byte[] newBytes, boolean orderRequired, bool
return true;
}
}
-private boolean hasNonSyntheticFieldChanges(FieldInfo[] currentFieldInfos, FieldInfo[] otherFieldInfos) {
- int length1 = currentFieldInfos == null ? 0 : currentFieldInfos.length;
- int length2 = otherFieldInfos == null ? 0 : otherFieldInfos.length;
- int index1 = 0;
- int index2 = 0;
-
- end : while (index1 < length1 && index2 < length2) {
- while (currentFieldInfos[index1].isSynthetic()) {
- if (++index1 >= length1) break end;
- }
- while (otherFieldInfos[index2].isSynthetic()) {
- if (++index2 >= length2) break end;
- }
- if (hasStructuralFieldChanges(currentFieldInfos[index1++], otherFieldInfos[index2++]))
- return true;
- }
-
- while (index1 < length1) {
- if (!currentFieldInfos[index1++].isSynthetic()) return true;
- }
- while (index2 < length2) {
- if (!otherFieldInfos[index2++].isSynthetic()) return true;
- }
- return false;
-}
private boolean hasStructuralFieldChanges(FieldInfo currentFieldInfo, FieldInfo otherFieldInfo) {
if (currentFieldInfo.getModifiers() != otherFieldInfo.getModifiers())
return true;
@@ -746,32 +691,6 @@ private boolean hasStructuralFieldChanges(FieldInfo currentFieldInfo, FieldInfo
}
return false;
}
-private boolean hasNonSyntheticMethodChanges(MethodInfo[] currentMethodInfos, MethodInfo[] otherMethodInfos) {
- int length1 = currentMethodInfos == null ? 0 : currentMethodInfos.length;
- int length2 = otherMethodInfos == null ? 0 : otherMethodInfos.length;
- int index1 = 0;
- int index2 = 0;
-
- MethodInfo m;
- end : while (index1 < length1 && index2 < length2) {
- while ((m = currentMethodInfos[index1]).isSynthetic() || m.isClinit()) {
- if (++index1 >= length1) break end;
- }
- while ((m = otherMethodInfos[index2]).isSynthetic() || m.isClinit()) {
- if (++index2 >= length2) break end;
- }
- if (hasStructuralMethodChanges(currentMethodInfos[index1++], otherMethodInfos[index2++]))
- return true;
- }
-
- while (index1 < length1) {
- if (!((m = currentMethodInfos[index1++]).isSynthetic() || m.isClinit())) return true;
- }
- while (index2 < length2) {
- if (!((m = otherMethodInfos[index2++]).isSynthetic() || m.isClinit())) return true;
- }
- return false;
-}
private boolean hasStructuralMethodChanges(MethodInfo currentMethodInfo, MethodInfo otherMethodInfo) {
if (currentMethodInfo.getModifiers() != otherMethodInfo.getModifiers())
return true;
@@ -779,6 +698,8 @@ private boolean hasStructuralMethodChanges(MethodInfo currentMethodInfo, MethodI
return true;
if (!CharOperation.equals(currentMethodInfo.getMethodDescriptor(), otherMethodInfo.getMethodDescriptor()))
return true;
+ if (!CharOperation.equals(currentMethodInfo.getGenericSignature(), otherMethodInfo.getGenericSignature()))
+ return true;
char[][] currentThrownExceptions = currentMethodInfo.getExceptionTypeNames();
char[][] otherThrownExceptions = otherMethodInfo.getExceptionTypeNames();
@@ -816,9 +737,92 @@ private void initialize() throws ClassFormatException {
throw exception;
}
}
+/**
+ * Answer true if the receiver is an anonymous type, false otherwise
+ *
+ * @return <CODE>boolean</CODE>
+ */
+public boolean isAnonymous() {
+ if (this.innerInfo == null) return false;
+ char[] sourceName = this.innerInfo.getSourceName();
+ return (sourceName == null || sourceName.length == 0);
+}
+/**
+ * Answer whether the receiver contains the resolved binary form
+ * or the unresolved source form of the type.
+ * @return boolean
+ */
+public boolean isBinaryType() {
+ return true;
+}
+/**
+ * Answer true if the receiver is a class. False otherwise.
+ * @return boolean
+ */
+public boolean isClass() {
+ return (getModifiers() & AccInterface) == 0;
+}
+/**
+ * Answer true if the receiver is an interface. False otherwise.
+ * @return boolean
+ */
+public boolean isInterface() {
+ return (getModifiers() & AccInterface) != 0;
+}
+/**
+ * Answer true if the receiver is a local type, false otherwise
+ *
+ * @return <CODE>boolean</CODE>
+ */
+public boolean isLocal() {
+ if (this.innerInfo == null) return false;
+ if (this.innerInfo.getEnclosingTypeName() != null) return false;
+ char[] sourceName = this.innerInfo.getSourceName();
+ return (sourceName != null && sourceName.length > 0);
+}
+/**
+ * Answer true if the receiver is a member type, false otherwise
+ *
+ * @return <CODE>boolean</CODE>
+ */
+public boolean isMember() {
+ if (this.innerInfo == null) return false;
+ if (this.innerInfo.getEnclosingTypeName() == null) return false;
+ char[] sourceName = this.innerInfo.getSourceName();
+ return (sourceName != null && sourceName.length > 0); // protection against ill-formed attributes (67600)
+}
+/**
+ * Answer true if the receiver is a nested type, false otherwise
+ *
+ * @return <CODE>boolean</CODE>
+ */
+public boolean isNestedType() {
+ return this.innerInfo != null;
+}
protected void reset() {
this.constantPoolOffsets = null;
super.reset();
}
+/**
+ * Answer the source file name attribute. Return null if there is no source file attribute for the receiver.
+ *
+ * @return char[]
+ */
+public char[] sourceFileName() {
+ return this.sourceFileName;
+}
+public String toString() {
+ java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream();
+ java.io.PrintWriter print = new java.io.PrintWriter(out);
+
+ print.println(this.getClass().getName() + "{"); //$NON-NLS-1$
+ print.println(" this.className: " + new String(getName())); //$NON-NLS-1$
+ print.println(" this.superclassName: " + (getSuperclassName() == null ? "null" : new String(getSuperclassName()))); //$NON-NLS-2$ //$NON-NLS-1$
+ print.println(" access_flags: " + ClassFileStruct.printTypeModifiers(this.accessFlags()) + "(" + this.accessFlags() + ")"); //$NON-NLS-1$ //$NON-NLS-3$ //$NON-NLS-2$
+
+ print.flush();
+ return out.toString();
+}
+
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/FieldInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/FieldInfo.java
index 26392d8230..9b26177826 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/FieldInfo.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/FieldInfo.java
@@ -27,15 +27,15 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
import org.eclipse.jdt.internal.compiler.util.Util;
public class FieldInfo extends ClassFileStruct implements AttributeNamesConstants, IBinaryField, Comparable, TypeIds {
+ private int accessFlags;
+ private int attributeBytes;
private Constant constant;
- private boolean isDeprecated;
- private boolean isSynthetic;
private int[] constantPoolOffsets;
- private int accessFlags;
+ private char[] descriptor;
private char[] name;
- private char[] signature;
- private int attributeBytes;
private Object wrappedConstantValue;
+ private char[] signature;
+ private int signatureUtf8Offset;
/**
* @param classFileBytes byte[]
* @param offsets int[]
@@ -47,11 +47,25 @@ public FieldInfo (byte classFileBytes[], int offsets[], int offset) {
accessFlags = -1;
int attributesCount = u2At(6);
int readOffset = 8;
+ this.signatureUtf8Offset = -1;
for (int i = 0; i < attributesCount; i++) {
+ // check the name of each attribute
+ int utf8Offset = constantPoolOffsets[u2At(readOffset)] - structOffset;
+ char[] attributeName = utf8At(utf8Offset + 3, u2At(utf8Offset + 1));
+ if (CharOperation.equals(AttributeNamesConstants.SignatureName, attributeName)) {
+ this.signatureUtf8Offset = constantPoolOffsets[u2At(readOffset + 6)] - structOffset;
+ }
readOffset += (6 + u4At(readOffset + 2));
}
attributeBytes = readOffset;
}
+
+public int compareTo(Object o) {
+ if (!(o instanceof FieldInfo)) {
+ throw new ClassCastException();
+ }
+ return new String(this.getName()).compareTo(new String(((FieldInfo) o).getName()));
+}
/**
* Return the constant of the field.
* Return org.eclipse.jdt.internal.compiler.impl.Constant.NotAConstant if there is none.
@@ -64,6 +78,16 @@ public Constant getConstant() {
}
return constant;
}
+public char[] getGenericSignature() {
+ if (this.signatureUtf8Offset != -1) {
+ if (this.signature == null) {
+ // decode the signature
+ this.signature = utf8At(this.signatureUtf8Offset + 3, u2At(this.signatureUtf8Offset + 1));
+ }
+ return this.signature;
+ }
+ return null;
+}
/**
* Answer an int whose bits are set according the access constants
* defined by the VM spec.
@@ -71,18 +95,12 @@ public Constant getConstant() {
* @return int
*/
public int getModifiers() {
- if (accessFlags == -1) {
+ if (this.accessFlags == -1) {
// compute the accessflag. Don't forget the deprecated attribute
- accessFlags = u2At(0);
+ this.accessFlags = u2At(0);
readDeprecatedAndSyntheticAttributes();
- if (isDeprecated) {
- accessFlags |= AccDeprecated;
- }
- if (isSynthetic) {
- accessFlags |= AccSynthetic;
- }
}
- return accessFlags;
+ return this.accessFlags;
}
/**
* Answer the name of the field.
@@ -108,12 +126,12 @@ public char[] getName() {
* @return char[]
*/
public char[] getTypeName() {
- if (signature == null) {
+ if (descriptor == null) {
// read the signature
int utf8Offset = constantPoolOffsets[u2At(4)] - structOffset;
- signature = utf8At(utf8Offset + 3, u2At(utf8Offset + 1));
+ descriptor = utf8At(utf8Offset + 3, u2At(utf8Offset + 1));
}
- return signature;
+ return descriptor;
}
/**
* Return a wrapper that contains the constant of the field.
@@ -164,6 +182,18 @@ public boolean hasConstant() {
return getConstant() != Constant.NotAConstant;
}
/**
+ * This method is used to fully initialize the contents of the receiver. All methodinfos, fields infos
+ * will be therefore fully initialized and we can get rid of the bytes.
+ */
+void initialize() {
+ getModifiers();
+ getName();
+ getConstant();
+ getTypeName();
+ getGenericSignature();
+ reset();
+}
+/**
* Return true if the field is a synthetic field, false otherwise.
* @return boolean
*/
@@ -240,13 +270,17 @@ private void readDeprecatedAndSyntheticAttributes() {
int utf8Offset = constantPoolOffsets[u2At(readOffset)] - structOffset;
char[] attributeName = utf8At(utf8Offset + 3, u2At(utf8Offset + 1));
if (CharOperation.equals(attributeName, DeprecatedName)) {
- isDeprecated = true;
+ this.accessFlags |= AccDeprecated;
} else if (CharOperation.equals(attributeName, SyntheticName)) {
- isSynthetic = true;
+ this.accessFlags |= AccSynthetic;
}
readOffset += (6 + u4At(readOffset + 2));
}
}
+protected void reset() {
+ this.constantPoolOffsets = null;
+ super.reset();
+}
/**
* Answer the size of the receiver in bytes.
*
@@ -281,26 +315,4 @@ public String toString() {
.toString();
}
-public int compareTo(Object o) {
- if (!(o instanceof FieldInfo)) {
- throw new ClassCastException();
- }
- return new String(this.getName()).compareTo(new String(((FieldInfo) o).getName()));
-}
-/**
- * This method is used to fully initialize the contents of the receiver. All methodinfos, fields infos
- * will be therefore fully initialized and we can get rid of the bytes.
- */
-void initialize() {
- getModifiers();
- getName();
- getConstant();
- getTypeName();
- reset();
-}
-protected void reset() {
- this.constantPoolOffsets = null;
- super.reset();
-}
-
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java
index c9255bed4c..c9ba34a8de 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java
@@ -15,15 +15,16 @@ import org.eclipse.jdt.internal.compiler.codegen.AttributeNamesConstants;
import org.eclipse.jdt.internal.compiler.env.IBinaryMethod;
public class MethodInfo extends ClassFileStruct implements IBinaryMethod, AttributeNamesConstants, Comparable {
- private char[][] exceptionNames;
- private int[] constantPoolOffsets;
- private boolean isDeprecated;
- private boolean isSynthetic;
+ static private final char[][] noException = CharOperation.NO_CHAR_CHAR;
private int accessFlags;
+ private int attributeBytes;
+ private int[] constantPoolOffsets;
+ private char[] descriptor;
+ private char[][] exceptionNames;
private char[] name;
private char[] signature;
- private int attributeBytes;
- static private final char[][] noException = CharOperation.NO_CHAR_CHAR;
+ private int signatureUtf8Offset;
+
/**
* @param classFileBytes byte[]
* @param offsets int[]
@@ -35,11 +36,28 @@ public MethodInfo (byte classFileBytes[], int offsets[], int offset) {
accessFlags = -1;
int attributesCount = u2At(6);
int readOffset = 8;
+ this.signatureUtf8Offset = -1;
for (int i = 0; i < attributesCount; i++) {
+ // check the name of each attribute
+ int utf8Offset = constantPoolOffsets[u2At(readOffset)] - structOffset;
+ char[] attributeName = utf8At(utf8Offset + 3, u2At(utf8Offset + 1));
+ if (CharOperation.equals(AttributeNamesConstants.SignatureName, attributeName)) {
+ this.signatureUtf8Offset = constantPoolOffsets[u2At(readOffset + 6)] - structOffset;
+ }
readOffset += (6 + u4At(readOffset + 2));
}
attributeBytes = readOffset;
}
+public int compareTo(Object o) {
+ if (!(o instanceof MethodInfo)) {
+ throw new ClassCastException();
+ }
+
+ MethodInfo otherMethod = (MethodInfo) o;
+ int result = new String(this.getSelector()).compareTo(new String(otherMethod.getSelector()));
+ if (result != 0) return result;
+ return new String(this.getMethodDescriptor()).compareTo(new String(otherMethod.getMethodDescriptor()));
+}
/**
* @see org.eclipse.jdt.internal.compiler.env.IGenericMethod#getArgumentNames()
*/
@@ -60,6 +78,16 @@ public char[][] getExceptionTypeNames() {
}
return exceptionNames;
}
+public char[] getGenericSignature() {
+ if (this.signatureUtf8Offset != -1) {
+ if (this.signature == null) {
+ // decode the signature
+ this.signature = utf8At(this.signatureUtf8Offset + 3, u2At(this.signatureUtf8Offset + 1));
+ }
+ return this.signature;
+ }
+ return null;
+}
/**
* Answer the receiver's method descriptor which describes the parameter &
* return types as specified in section 4.3.3 of the Java 2 VM spec.
@@ -70,12 +98,12 @@ public char[][] getExceptionTypeNames() {
* @return char[]
*/
public char[] getMethodDescriptor() {
- if (signature == null) {
+ if (descriptor == null) {
// read the name
int utf8Offset = constantPoolOffsets[u2At(4)] - structOffset;
- signature = utf8At(utf8Offset + 3, u2At(utf8Offset + 1));
+ descriptor = utf8At(utf8Offset + 3, u2At(utf8Offset + 1));
}
- return signature;
+ return descriptor;
}
/**
* Answer an int whose bits are set according the access constants
@@ -84,18 +112,12 @@ public char[] getMethodDescriptor() {
* @return int
*/
public int getModifiers() {
- if (accessFlags == -1) {
+ if (this.accessFlags == -1) {
// compute the accessflag. Don't forget the deprecated attribute
- accessFlags = u2At(0);
+ this.accessFlags = u2At(0);
readDeprecatedAndSyntheticAttributes();
- if (isDeprecated) {
- accessFlags |= AccDeprecated;
- }
- if (isSynthetic) {
- accessFlags |= AccSynthetic;
- }
}
- return accessFlags;
+ return this.accessFlags;
}
/**
* Answer the name of the method.
@@ -112,6 +134,18 @@ public char[] getSelector() {
return name;
}
/**
+ * This method is used to fully initialize the contents of the receiver. All methodinfos, fields infos
+ * will be therefore fully initialized and we can get rid of the bytes.
+ */
+void initialize() {
+ getModifiers();
+ getSelector();
+ getMethodDescriptor();
+ getExceptionTypeNames();
+ getGenericSignature();
+ reset();
+}
+/**
* Answer true if the method is a class initializer, false otherwise.
* @return boolean
*/
@@ -141,9 +175,9 @@ private void readDeprecatedAndSyntheticAttributes() {
int utf8Offset = constantPoolOffsets[u2At(readOffset)] - structOffset;
char[] attributeName = utf8At(utf8Offset + 3, u2At(utf8Offset + 1));
if (CharOperation.equals(attributeName, DeprecatedName)) {
- isDeprecated = true;
+ this.accessFlags |= AccDeprecated;
} else if (CharOperation.equals(attributeName, SyntheticName)) {
- isSynthetic = true;
+ this.accessFlags |= AccSynthetic;
}
readOffset += (6 + u4At(readOffset + 2));
}
@@ -180,6 +214,10 @@ private void readExceptionAttributes() {
exceptionNames = noException;
}
}
+protected void reset() {
+ this.constantPoolOffsets = null;
+ super.reset();
+}
/**
* Answer the size of the receiver in bytes.
*
@@ -190,6 +228,9 @@ public int sizeInBytes() {
}
public String toString() {
int modifiers = getModifiers();
+ char[] desc = getGenericSignature();
+ if (desc == null)
+ desc = getMethodDescriptor();
StringBuffer buffer = new StringBuffer(this.getClass().getName());
return buffer
.append("{") //$NON-NLS-1$
@@ -203,34 +244,8 @@ public String toString() {
+ ((modifiers & 0x0040) == 0x0040 ? "volatile " : "") //$NON-NLS-1$ //$NON-NLS-2$
+ ((modifiers & 0x0080) == 0x0080 ? "transient " : "")) //$NON-NLS-1$ //$NON-NLS-2$
.append(getSelector())
- .append(getMethodDescriptor())
+ .append(desc)
.append("}") //$NON-NLS-1$
.toString();
}
-public int compareTo(Object o) {
- if (!(o instanceof MethodInfo)) {
- throw new ClassCastException();
- }
-
- MethodInfo otherMethod = (MethodInfo) o;
- int result = new String(this.getSelector()).compareTo(new String(otherMethod.getSelector()));
- if (result != 0) return result;
- return new String(this.getMethodDescriptor()).compareTo(new String(otherMethod.getMethodDescriptor()));
-}
-
-/**
- * This method is used to fully initialize the contents of the receiver. All methodinfos, fields infos
- * will be therefore fully initialized and we can get rid of the bytes.
- */
-void initialize() {
- getModifiers();
- getSelector();
- getMethodDescriptor();
- getExceptionTypeNames();
- reset();
-}
-protected void reset() {
- this.constantPoolOffsets = null;
- super.reset();
-}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java
index 577b9bd9f8..26d55cdcf5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java
@@ -20,4 +20,6 @@ public interface AttributeNamesConstants {
final char[] ExceptionsName = new char[] {'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n', 's'};
final char[] SourceName = new char[] {'S', 'o', 'u', 'r', 'c', 'e', 'F', 'i', 'l', 'e'};
final char[] DeprecatedName = new char[] {'D', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'e', 'd'};
+ final char[] SignatureName = new char[] {'S', 'i', 'g', 'n', 'a', 't', 'u', 'r', 'e'};
+ final char[] LocalVariableTypeTableName = new char[] {'L', 'o', 'c', 'a', 'l', 'V', 'a', 'r', 'i', 'a', 'b', 'l', 'e', 'T', 'y', 'p', 'e', 'T', 'a', 'b', 'l', 'e'};
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java
index 4d7a6ef338..ca34788090 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java
@@ -65,11 +65,15 @@ public class CodeStream implements OperatorIds, ClassFileConstants, Opcodes, Bas
public boolean wideMode = false;
public static final CompilationResult RESTART_IN_WIDE_MODE = new CompilationResult((char[])null, 0, 0, 0);
-public CodeStream(ClassFile classFile) {
- generateLineNumberAttributes = (classFile.produceDebugAttributes & CompilerOptions.Lines) != 0;
- generateLocalVariableTableAttributes = (classFile.produceDebugAttributes & CompilerOptions.Vars) != 0;
- if (generateLineNumberAttributes) {
- lineSeparatorPositions = classFile.referenceBinding.scope.referenceCompilationUnit().compilationResult.lineSeparatorPositions;
+ // target level to manage different code generation between different source levels
+ private long targetLevel;
+
+public CodeStream(ClassFile classFile, long sourceLevel) {
+ this.targetLevel = sourceLevel;
+ this.generateLineNumberAttributes = (classFile.produceDebugAttributes & CompilerOptions.Lines) != 0;
+ this.generateLocalVariableTableAttributes = (classFile.produceDebugAttributes & CompilerOptions.Vars) != 0;
+ if (this.generateLineNumberAttributes) {
+ this.lineSeparatorPositions = classFile.referenceBinding.scope.referenceCompilationUnit().compilationResult.lineSeparatorPositions;
}
}
final public void aaload() {
@@ -1260,80 +1264,85 @@ public void generateClassLiteralAccessForType(TypeBinding accessedType, FieldBin
this.getTYPE(accessedType.id);
return;
}
- endLabel = new Label(this);
-
- if (syntheticFieldBinding != null) { // non interface case
- this.getstatic(syntheticFieldBinding);
- this.dup();
- this.ifnonnull(endLabel);
- this.pop();
- }
-
- /* Macro for building a class descriptor object... using or not a field cache to store it into...
- this sequence is responsible for building the actual class descriptor.
-
- If the fieldCache is set, then it is supposed to be the body of a synthetic access method
- factoring the actual descriptor creation out of the invocation site (saving space).
- If the fieldCache is nil, then we are dumping the bytecode on the invocation site, since
- we have no way to get a hand on the field cache to do better. */
-
-
- // Wrap the code in an exception handler to convert a ClassNotFoundException into a NoClassDefError
-
- anyExceptionHandler = new ExceptionLabel(this, BaseTypes.NullBinding /* represents ClassNotFoundException*/);
- this.ldc(accessedType == BaseTypes.NullBinding ? "java.lang.Object" : String.valueOf(accessedType.constantPoolName()).replace('/', '.')); //$NON-NLS-1$
- this.invokeClassForName();
- /* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=37565
- if (accessedType == BaseTypes.NullBinding) {
- this.ldc("java.lang.Object"); //$NON-NLS-1$
- } else if (accessedType.isArrayType()) {
- this.ldc(String.valueOf(accessedType.constantPoolName()).replace('/', '.'));
+ if (this.targetLevel >= ClassFileConstants.JDK1_5) {
+ // generation using the new ldc_w bytecode
+ this.ldc(accessedType);
} else {
- // we make it an array type (to avoid class initialization)
- this.ldc("[L" + String.valueOf(accessedType.constantPoolName()).replace('/', '.') + ";"); //$NON-NLS-1$//$NON-NLS-2$
- }
- this.invokeClassForName();
- if (!accessedType.isArrayType()) { // extract the component type, which doesn't initialize the class
- this.invokeJavaLangClassGetComponentType();
- }
- */
- /* We need to protect the runtime code from binary inconsistencies
- in case the accessedType is missing, the ClassNotFoundException has to be converted
- into a NoClassDefError(old ex message), we thus need to build an exception handler for this one. */
- anyExceptionHandler.placeEnd();
+ endLabel = new Label(this);
+ if (syntheticFieldBinding != null) { // non interface case
+ this.getstatic(syntheticFieldBinding);
+ this.dup();
+ this.ifnonnull(endLabel);
+ this.pop();
+ }
- if (syntheticFieldBinding != null) { // non interface case
- this.dup();
- this.putstatic(syntheticFieldBinding);
+ /* Macro for building a class descriptor object... using or not a field cache to store it into...
+ this sequence is responsible for building the actual class descriptor.
+
+ If the fieldCache is set, then it is supposed to be the body of a synthetic access method
+ factoring the actual descriptor creation out of the invocation site (saving space).
+ If the fieldCache is nil, then we are dumping the bytecode on the invocation site, since
+ we have no way to get a hand on the field cache to do better. */
+
+
+ // Wrap the code in an exception handler to convert a ClassNotFoundException into a NoClassDefError
+
+ anyExceptionHandler = new ExceptionLabel(this, BaseTypes.NullBinding /* represents ClassNotFoundException*/);
+ this.ldc(accessedType == BaseTypes.NullBinding ? "java.lang.Object" : String.valueOf(accessedType.constantPoolName()).replace('/', '.')); //$NON-NLS-1$
+ this.invokeClassForName();
+
+ /* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=37565
+ if (accessedType == BaseTypes.NullBinding) {
+ this.ldc("java.lang.Object"); //$NON-NLS-1$
+ } else if (accessedType.isArrayType()) {
+ this.ldc(String.valueOf(accessedType.constantPoolName()).replace('/', '.'));
+ } else {
+ // we make it an array type (to avoid class initialization)
+ this.ldc("[L" + String.valueOf(accessedType.constantPoolName()).replace('/', '.') + ";"); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ this.invokeClassForName();
+ if (!accessedType.isArrayType()) { // extract the component type, which doesn't initialize the class
+ this.invokeJavaLangClassGetComponentType();
+ }
+ */
+ /* We need to protect the runtime code from binary inconsistencies
+ in case the accessedType is missing, the ClassNotFoundException has to be converted
+ into a NoClassDefError(old ex message), we thus need to build an exception handler for this one. */
+ anyExceptionHandler.placeEnd();
+
+ if (syntheticFieldBinding != null) { // non interface case
+ this.dup();
+ this.putstatic(syntheticFieldBinding);
+ }
+ this.goto_(endLabel);
+
+
+ // Generate the body of the exception handler
+ saveStackSize = stackDepth;
+ stackDepth = 1;
+ /* ClassNotFoundException on stack -- the class literal could be doing more things
+ on the stack, which means that the stack may not be empty at this point in the
+ above code gen. So we save its state and restart it from 1. */
+
+ anyExceptionHandler.place();
+
+ // Transform the current exception, and repush and throw a
+ // NoClassDefFoundError(ClassNotFound.getMessage())
+
+ this.newNoClassDefFoundError();
+ this.dup_x1();
+ this.swap();
+
+ // Retrieve the message from the old exception
+ this.invokeThrowableGetMessage();
+
+ // Send the constructor taking a message string as an argument
+ this.invokeNoClassDefFoundErrorStringConstructor();
+ this.athrow();
+ stackDepth = saveStackSize;
+ endLabel.place();
}
- this.goto_(endLabel);
-
-
- // Generate the body of the exception handler
- saveStackSize = stackDepth;
- stackDepth = 1;
- /* ClassNotFoundException on stack -- the class literal could be doing more things
- on the stack, which means that the stack may not be empty at this point in the
- above code gen. So we save its state and restart it from 1. */
-
- anyExceptionHandler.place();
-
- // Transform the current exception, and repush and throw a
- // NoClassDefFoundError(ClassNotFound.getMessage())
-
- this.newNoClassDefFoundError();
- this.dup_x1();
- this.swap();
-
- // Retrieve the message from the old exception
- this.invokeThrowableGetMessage();
-
- // Send the constructor taking a message string as an argument
- this.invokeNoClassDefFoundErrorStringConstructor();
- this.athrow();
- endLabel.place();
- stackDepth = saveStackSize;
}
/**
* This method generates the code attribute bytecode
@@ -1377,6 +1386,8 @@ public void generateConstant(Constant constant, int implicitConversionCode) {
}
}
/**
+ * Generates the sequence of instructions which will perform the conversion of the expression
+ * on the stack into a different type (e.g. long l = someInt; --> i2l must be inserted).
* @param implicitConversionCode int
*/
public void generateImplicitConversion(int implicitConversionCode) {
@@ -1699,27 +1710,27 @@ public void generateOuterAccess(Object[] mappingSequence, ASTNode invocationSite
* @param oper1 the first expression
* @param oper2 the second expression
*/
-public void generateStringAppend(BlockScope blockScope, Expression oper1, Expression oper2) {
+public void generateStringConcatenationAppend(BlockScope blockScope, Expression oper1, Expression oper2) {
int pc;
if (oper1 == null) {
/* Operand is already on the stack, and maybe nil:
note type1 is always to java.lang.String here.*/
- this.newStringBuffer();
+ this.newStringContatenation();
this.dup_x1();
this.swap();
// If argument is reference type, need to transform it
// into a string (handles null case)
this.invokeStringValueOf(T_Object);
- this.invokeStringBufferStringConstructor();
+ this.invokeStringConcatenationStringConstructor();
} else {
pc = position;
- oper1.generateOptimizedStringBufferCreation(blockScope, this, oper1.implicitConversion & 0xF);
+ oper1.generateOptimizedStringConcatenationCreation(blockScope, this, oper1.implicitConversion & 0xF);
this.recordPositionsFrom(pc, oper1.sourceStart);
}
pc = position;
- oper2.generateOptimizedStringBuffer(blockScope, this, oper2.implicitConversion & 0xF);
+ oper2.generateOptimizedStringConcatenation(blockScope, this, oper2.implicitConversion & 0xF);
this.recordPositionsFrom(pc, oper2.sourceStart);
- this.invokeStringBufferToString();
+ this.invokeStringConcatenationToString();
}
/**
* Code responsible to generate the suitable code to supply values for the synthetic enclosing
@@ -1885,6 +1896,9 @@ public void generateSyntheticBodyForMethodAccess(SyntheticAccessMethodBinding ac
MethodBinding methodBinding = accessBinding.targetMethod;
TypeBinding[] parameters = methodBinding.parameters;
int length = parameters.length;
+ TypeBinding[] arguments = accessBinding.accessType == SyntheticAccessMethodBinding.BridgeMethodAccess
+ ? accessBinding.parameters
+ : null;
int resolvedPosition;
if (methodBinding.isStatic())
resolvedPosition = 0;
@@ -1893,8 +1907,16 @@ public void generateSyntheticBodyForMethodAccess(SyntheticAccessMethodBinding ac
resolvedPosition = 1;
}
for (int i = 0; i < length; i++) {
- load(parameters[i], resolvedPosition);
- if ((parameters[i] == DoubleBinding) || (parameters[i] == LongBinding))
+ TypeBinding parameter = parameters[i];
+ if (arguments != null) { // for bridge methods
+ TypeBinding argument = arguments[i];
+ load(argument, resolvedPosition);
+ if (argument != parameter)
+ checkcast(parameter);
+ } else {
+ load(parameter, resolvedPosition);
+ }
+ if ((parameter == DoubleBinding) || (parameter == LongBinding))
resolvedPosition += 2;
else
resolvedPosition++;
@@ -2805,7 +2827,6 @@ public void invokeClassForName() {
bCodeStream[classFileOffset++] = OPC_invokestatic;
writeUnsignedShort(constantPool.literalIndexForJavaLangClassForName());
}
-
public void invokeJavaLangClassDesiredAssertionStatus() {
// invokevirtual: java.lang.Class.desiredAssertionStatus()Z;
if (DEBUG) System.out.println(position + "\t\tinvokevirtual: java.lang.Class.desiredAssertionStatus()Z;"); //$NON-NLS-1$
@@ -2984,25 +3005,37 @@ final public void invokestatic(MethodBinding methodBinding) {
* The equivalent code performs a string conversion of the TOS
* @param typeID <CODE>int</CODE>
*/
-public void invokeStringBufferAppendForType(int typeID) {
- if (DEBUG) System.out.println(position + "\t\tinvokevirtual: java.lang.StringBuffer.append(...)"); //$NON-NLS-1$
+public void invokeStringConcatenationAppendForType(int typeID) {
+ if (DEBUG) {
+ if (this.targetLevel >= JDK1_5) {
+ System.out.println(position + "\t\tinvokevirtual: java.lang.StringBuilder.append(...)"); //$NON-NLS-1$
+ } else {
+ System.out.println(position + "\t\tinvokevirtual: java.lang.StringBuffer.append(...)"); //$NON-NLS-1$
+ }
+ }
countLabels = 0;
int usedTypeID;
- if (typeID == T_null)
+ if (typeID == T_null) {
usedTypeID = T_String;
- else
+ } else {
usedTypeID = typeID;
+ }
// invokevirtual
if (classFileOffset + 2 >= bCodeStream.length) {
resizeByteArray();
}
position++;
bCodeStream[classFileOffset++] = OPC_invokevirtual;
- writeUnsignedShort(constantPool.literalIndexForJavaLangStringBufferAppend(typeID));
- if ((usedTypeID == T_long) || (usedTypeID == T_double))
+ if (this.targetLevel >= JDK1_5) {
+ writeUnsignedShort(constantPool.literalIndexForJavaLangStringBuilderAppend(typeID));
+ } else {
+ writeUnsignedShort(constantPool.literalIndexForJavaLangStringBufferAppend(typeID));
+ }
+ if ((usedTypeID == T_long) || (usedTypeID == T_double)) {
stackDepth -= 2;
- else
+ } else {
stackDepth--;
+ }
}
public void invokeJavaLangAssertionErrorConstructor(int typeBindingID) {
@@ -3030,42 +3063,99 @@ public void invokeJavaLangAssertionErrorDefaultConstructor() {
writeUnsignedShort(constantPool.literalIndexForJavaLangAssertionErrorDefaultConstructor());
stackDepth --;
}
-
-public void invokeStringBufferDefaultConstructor() {
+public void invokeJavaUtilIteratorHasNext() {
+ // invokeinterface java.util.Iterator.hasNext()Z
+ if (DEBUG) System.out.println(position + "\t\tinvokeinterface: java.util.Iterator.hasNext()Z"); //$NON-NLS-1$
+ countLabels = 0;
+ if (classFileOffset + 4 >= bCodeStream.length) {
+ resizeByteArray();
+ }
+ position += 3;
+ bCodeStream[classFileOffset++] = OPC_invokeinterface;
+ writeUnsignedShort(constantPool.literalIndexForJavaUtilIteratorHasNext());
+ bCodeStream[classFileOffset++] = 1;
+ // Generate a 0 into the byte array. Like the array is already fill with 0, we just need to increment
+ // the number of bytes.
+ bCodeStream[classFileOffset++] = 0;
+}
+public void invokeJavaUtilIteratorNext() {
+ // invokeinterface java.util.Iterator.next()java.lang.Object
+ if (DEBUG) System.out.println(position + "\t\tinvokeinterface: java.util.Iterator.next()java.lang.Object"); //$NON-NLS-1$
+ countLabels = 0;
+ if (classFileOffset + 4 >= bCodeStream.length) {
+ resizeByteArray();
+ }
+ position += 3;
+ bCodeStream[classFileOffset++] = OPC_invokeinterface;
+ writeUnsignedShort(constantPool.literalIndexForJavaUtilIteratorNext());
+ bCodeStream[classFileOffset++] = 1;
+ // Generate a 0 into the byte array. Like the array is already fill with 0, we just need to increment
+ // the number of bytes.
+ bCodeStream[classFileOffset++] = 0;
+}
+public void invokeStringConcatenationDefaultConstructor() {
// invokespecial: java.lang.StringBuffer.<init>()V
- if (DEBUG) System.out.println(position + "\t\tinvokespecial: java.lang.StringBuffer.<init>()V"); //$NON-NLS-1$
+ if (DEBUG) {
+ if (this.targetLevel >= JDK1_5) {
+ System.out.println(position + "\t\tinvokespecial: java.lang.StringBuilder.<init>()V"); //$NON-NLS-1$
+ } else {
+ System.out.println(position + "\t\tinvokespecial: java.lang.StringBuffer.<init>()V"); //$NON-NLS-1$
+ }
+ }
countLabels = 0;
if (classFileOffset + 2 >= bCodeStream.length) {
resizeByteArray();
}
position++;
bCodeStream[classFileOffset++] = OPC_invokespecial;
- writeUnsignedShort(constantPool.literalIndexForJavaLangStringBufferDefaultConstructor());
+ if (this.targetLevel >= JDK1_5) {
+ writeUnsignedShort(constantPool.literalIndexForJavaLangStringBuilderDefaultConstructor());
+ } else {
+ writeUnsignedShort(constantPool.literalIndexForJavaLangStringBufferDefaultConstructor());
+ }
stackDepth--;
}
-public void invokeStringBufferStringConstructor() {
- // invokespecial: java.lang.StringBuffer.<init>(Ljava.lang.String;)V
- if (DEBUG) System.out.println(position + "\t\tjava.lang.StringBuffer.<init>(Ljava.lang.String;)V"); //$NON-NLS-1$
+public void invokeStringConcatenationStringConstructor() {
+ if (DEBUG) {
+ if (this.targetLevel >= JDK1_5) {
+ System.out.println(position + "\t\tjava.lang.StringBuilder.<init>(Ljava.lang.String;)V"); //$NON-NLS-1$
+ } else {
+ System.out.println(position + "\t\tjava.lang.StringBuffer.<init>(Ljava.lang.String;)V"); //$NON-NLS-1$
+ }
+ }
countLabels = 0;
if (classFileOffset + 2 >= bCodeStream.length) {
resizeByteArray();
}
position++;
bCodeStream[classFileOffset++] = OPC_invokespecial;
- writeUnsignedShort(constantPool.literalIndexForJavaLangStringBufferConstructor());
+ if (this.targetLevel >= JDK1_5) {
+ writeUnsignedShort(constantPool.literalIndexForJavaLangStringBuilderConstructor());
+ } else {
+ writeUnsignedShort(constantPool.literalIndexForJavaLangStringBufferConstructor());
+ }
stackDepth -= 2;
}
-public void invokeStringBufferToString() {
- // invokevirtual: StringBuffer.toString()Ljava.lang.String;
- if (DEBUG) System.out.println(position + "\t\tinvokevirtual: StringBuffer.toString()Ljava.lang.String;"); //$NON-NLS-1$
+public void invokeStringConcatenationToString() {
+ if (DEBUG) {
+ if (this.targetLevel >= JDK1_5) {
+ System.out.println(position + "\t\tinvokevirtual: StringBuilder.toString()Ljava.lang.String;"); //$NON-NLS-1$
+ } else {
+ System.out.println(position + "\t\tinvokevirtual: StringBuffer.toString()Ljava.lang.String;"); //$NON-NLS-1$
+ }
+ }
countLabels = 0;
if (classFileOffset + 2 >= bCodeStream.length) {
resizeByteArray();
}
position++;
bCodeStream[classFileOffset++] = OPC_invokevirtual;
- writeUnsignedShort(constantPool.literalIndexForJavaLangStringBufferToString());
+ if (this.targetLevel >= JDK1_5) {
+ writeUnsignedShort(constantPool.literalIndexForJavaLangStringBuilderToString());
+ } else {
+ writeUnsignedShort(constantPool.literalIndexForJavaLangStringBufferToString());
+ }
}
public void invokeStringIntern() {
// invokevirtual: java.lang.String.intern()
@@ -3433,13 +3523,13 @@ final public void lconst_1() {
bCodeStream[classFileOffset++] = OPC_lconst_1;
}
final public void ldc(float constant) {
- if (DEBUG) System.out.println(position + "\t\tldc:"+constant); //$NON-NLS-1$
countLabels = 0;
int index = constantPool.literalIndex(constant);
stackDepth++;
if (stackDepth > stackMax)
stackMax = stackDepth;
if (index > 255) {
+ if (DEBUG) System.out.println(position + "\t\tldc_w:"+constant); //$NON-NLS-1$
// Generate a ldc_w
if (classFileOffset + 2 >= bCodeStream.length) {
resizeByteArray();
@@ -3448,6 +3538,7 @@ final public void ldc(float constant) {
bCodeStream[classFileOffset++] = OPC_ldc_w;
writeUnsignedShort(index);
} else {
+ if (DEBUG) System.out.println(position + "\t\tldc:"+constant); //$NON-NLS-1$
// Generate a ldc
if (classFileOffset + 1 >= bCodeStream.length) {
resizeByteArray();
@@ -3458,13 +3549,13 @@ final public void ldc(float constant) {
}
}
final public void ldc(int constant) {
- if (DEBUG) System.out.println(position + "\t\tldc:"+constant); //$NON-NLS-1$
countLabels = 0;
int index = constantPool.literalIndex(constant);
stackDepth++;
if (stackDepth > stackMax)
stackMax = stackDepth;
if (index > 255) {
+ if (DEBUG) System.out.println(position + "\t\tldc_w:"+constant); //$NON-NLS-1$
// Generate a ldc_w
if (classFileOffset + 2 >= bCodeStream.length) {
resizeByteArray();
@@ -3473,6 +3564,7 @@ final public void ldc(int constant) {
bCodeStream[classFileOffset++] = OPC_ldc_w;
writeUnsignedShort(index);
} else {
+ if (DEBUG) System.out.println(position + "\t\tldc:"+constant); //$NON-NLS-1$
// Generate a ldc
if (classFileOffset + 1 >= bCodeStream.length) {
resizeByteArray();
@@ -3483,7 +3575,6 @@ final public void ldc(int constant) {
}
}
final public void ldc(String constant) {
- if (DEBUG) System.out.println(position + "\t\tldc:"+constant); //$NON-NLS-1$
countLabels = 0;
int currentConstantPoolIndex = constantPool.currentIndex;
int currentConstantPoolOffset = constantPool.currentOffset;
@@ -3496,6 +3587,7 @@ final public void ldc(String constant) {
if (stackDepth > stackMax)
stackMax = stackDepth;
if (index > 255) {
+ if (DEBUG) System.out.println(position + "\t\tldc_w:"+constant); //$NON-NLS-1$
// Generate a ldc_w
if (classFileOffset + 2 >= bCodeStream.length) {
resizeByteArray();
@@ -3504,6 +3596,7 @@ final public void ldc(String constant) {
bCodeStream[classFileOffset++] = OPC_ldc_w;
writeUnsignedShort(index);
} else {
+ if (DEBUG) System.out.println(position + "\t\tldc:"+constant); //$NON-NLS-1$
// Generate a ldc
if (classFileOffset + 1 >= bCodeStream.length) {
resizeByteArray();
@@ -3554,7 +3647,7 @@ final public void ldc(String constant) {
}
// check if all the string is encoded (PR 1PR2DWJ)
// the string is too big to be encoded in one pass
- newStringBuffer();
+ newStringContatenation();
dup();
// write the first part
char[] subChars = new char[i];
@@ -3582,7 +3675,7 @@ final public void ldc(String constant) {
bCodeStream[classFileOffset++] = (byte) index;
}
// write the remaining part
- invokeStringBufferStringConstructor();
+ invokeStringConcatenationStringConstructor();
while (i < constantLength) {
length = 0;
utf8encoding = new byte[Math.min(constantLength - i + 100, 65535)];
@@ -3637,12 +3730,38 @@ final public void ldc(String constant) {
bCodeStream[classFileOffset++] = (byte) index;
}
// now on the stack it should be a StringBuffer and a string.
- invokeStringBufferAppendForType(T_String);
+ invokeStringConcatenationAppendForType(T_String);
}
- invokeStringBufferToString();
+ invokeStringConcatenationToString();
invokeStringIntern();
}
}
+final public void ldc(TypeBinding typeBinding) {
+ countLabels = 0;
+ int index = constantPool.literalIndex(typeBinding);
+ stackDepth++;
+ if (stackDepth > stackMax)
+ stackMax = stackDepth;
+ if (index > 255) {
+ if (DEBUG) System.out.println(position + "\t\tldc_w:"+ typeBinding); //$NON-NLS-1$
+ // Generate a ldc_w
+ if (classFileOffset + 2 >= bCodeStream.length) {
+ resizeByteArray();
+ }
+ position++;
+ bCodeStream[classFileOffset++] = OPC_ldc_w;
+ writeUnsignedShort(index);
+ } else {
+ if (DEBUG) System.out.println(position + "\t\tldw:"+ typeBinding); //$NON-NLS-1$
+ // Generate a ldc
+ if (classFileOffset + 1 >= bCodeStream.length) {
+ resizeByteArray();
+ }
+ position += 2;
+ bCodeStream[classFileOffset++] = OPC_ldc;
+ bCodeStream[classFileOffset++] = (byte) index;
+ }
+}
final public void ldc2_w(double constant) {
if (DEBUG) System.out.println(position + "\t\tldc2_w:"+constant); //$NON-NLS-1$
countLabels = 0;
@@ -4317,7 +4436,7 @@ final public void newarray(int array_Type) {
bCodeStream[classFileOffset++] = (byte) array_Type;
}
public void newArray(Scope scope, ArrayBinding arrayBinding) {
- TypeBinding component = arrayBinding.elementsType(scope);
+ TypeBinding component = arrayBinding.elementsType();
switch (component.id) {
case T_int :
this.newarray(10);
@@ -4391,19 +4510,31 @@ public void newNoClassDefFoundError() {
bCodeStream[classFileOffset++] = OPC_new;
writeUnsignedShort(constantPool.literalIndexForJavaLangNoClassDefFoundError());
}
-public void newStringBuffer() {
+public void newStringContatenation() {
// new: java.lang.StringBuffer
- if (DEBUG) System.out.println(position + "\t\tnew: java.lang.StringBuffer"); //$NON-NLS-1$
+ // new: java.lang.StringBuilder
+ if (DEBUG) {
+ if (this.targetLevel >= JDK1_5) {
+ System.out.println(position + "\t\tnew: java.lang.StringBuilder"); //$NON-NLS-1$
+ } else {
+ System.out.println(position + "\t\tnew: java.lang.StringBuffer"); //$NON-NLS-1$
+ }
+ }
countLabels = 0;
stackDepth++;
- if (stackDepth > stackMax)
+ if (stackDepth > stackMax) {
stackMax = stackDepth;
+ }
if (classFileOffset + 2 >= bCodeStream.length) {
resizeByteArray();
}
position++;
bCodeStream[classFileOffset++] = OPC_new;
- writeUnsignedShort(constantPool.literalIndexForJavaLangStringBuffer());
+ if (this.targetLevel >= JDK1_5) {
+ writeUnsignedShort(constantPool.literalIndexForJavaLangStringBuilder());
+ } else {
+ writeUnsignedShort(constantPool.literalIndexForJavaLangStringBuffer());
+ }
}
public void newWrapperFor(int typeID) {
countLabels = 0;
@@ -4574,15 +4705,14 @@ public void recordPositionsFrom(int startPC, int sourcePos) {
if (existingEntryIndex != -1) {
// widen existing entry
pcToSourceMap[existingEntryIndex] = startPC;
- } else {
+ } else if (insertionIndex < 1 || pcToSourceMap[insertionIndex - 1] != newLine) {
// we have to add an entry that won't be sorted. So we sort the pcToSourceMap.
System.arraycopy(pcToSourceMap, insertionIndex, pcToSourceMap, insertionIndex + 2, pcToSourceMapSize - insertionIndex);
pcToSourceMap[insertionIndex++] = startPC;
pcToSourceMap[insertionIndex] = newLine;
pcToSourceMapSize += 2;
}
- }
- if (position != lastEntryPC) { // no bytecode since last entry pc
+ } else if (position != lastEntryPC) { // no bytecode since last entry pc
pcToSourceMap[pcToSourceMapSize++] = lastEntryPC;
pcToSourceMap[pcToSourceMapSize++] = newLine;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java
index 66a2f72279..db0af0c1d0 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java
@@ -45,11 +45,11 @@ public class ConstantPool implements ClassFileConstants, TypeIds {
protected ObjectCache classCache;
protected FieldNameAndTypeCache nameAndTypeCacheForFields;
protected MethodNameAndTypeCache nameAndTypeCacheForMethods;
- int[] wellKnownTypes = new int[21];
- int[] wellKnownMethods = new int[36];
- int[] wellKnownFields = new int[10];
+ int[] wellKnownTypes = new int[23];
+ int[] wellKnownMethods = new int[49];
+ int[] wellKnownFields = new int[9];
int[] wellKnownFieldNameAndTypes = new int[2];
- int[] wellKnownMethodNameAndTypes = new int[33];
+ int[] wellKnownMethodNameAndTypes = new int[43];
public byte[] poolContent;
public int currentIndex = 1;
public int currentOffset;
@@ -75,29 +75,31 @@ public class ConstantPool implements ClassFileConstants, TypeIds {
final static int JAVA_LANG_EXCEPTION_TYPE = 18;
final static int JAVA_LANG_REFLECT_CONSTRUCTOR_TYPE = 19;
final static int JAVA_LANG_ASSERTIONERROR_TYPE = 20;
+ final static int JAVA_UTIL_ITERATOR_TYPE = 21;
+ final static int JAVA_LANG_STRINGBUILDER_TYPE = 22;
// predefined constant index for well known fields
- final static int TYPE_BYTE_FIELD = 0;
- final static int TYPE_SHORT_FIELD = 1;
- final static int TYPE_CHARACTER_FIELD = 2;
- final static int TYPE_INTEGER_FIELD = 3;
- final static int TYPE_LONG_FIELD = 4;
- final static int TYPE_FLOAT_FIELD = 5;
- final static int TYPE_DOUBLE_FIELD = 6;
- final static int TYPE_BOOLEAN_FIELD = 7;
- final static int TYPE_VOID_FIELD = 8;
- final static int OUT_SYSTEM_FIELD = 9;
+ final static int JAVA_LANG_BYTE_TYPE_FIELD = 0;
+ final static int JAVA_LANG_SHORT_TYPE_FIELD = 1;
+ final static int JAVA_LANG_CHARACTER_TYPE_FIELD = 2;
+ final static int JAVA_LANG_INTEGER_TYPE_FIELD = 3;
+ final static int JAVA_LANG_LONG_TYPE_FIELD = 4;
+ final static int JAVA_LANG_FLOAT_TYPE_FIELD = 5;
+ final static int JAVA_LANG_DOUBLE_TYPE_FIELD = 6;
+ final static int JAVA_LANG_BOOLEAN_TYPE_FIELD = 7;
+ final static int JAVA_LANG_VOID_TYPE_FIELD = 8;
+
// predefined constant index for well known methods
- final static int FORNAME_CLASS_METHOD = 0;
+ final static int CLASS_FORNAME_METHOD = 0;
final static int NOCLASSDEFFOUNDERROR_CONSTR_METHOD = 1;
- final static int APPEND_INT_METHOD = 2;
- final static int APPEND_FLOAT_METHOD = 3;
- final static int APPEND_LONG_METHOD = 4;
- final static int APPEND_OBJECT_METHOD = 5;
- final static int APPEND_CHAR_METHOD = 6;
- final static int APPEND_STRING_METHOD = 7;
- final static int APPEND_BOOLEAN_METHOD = 8;
- final static int APPEND_DOUBLE_METHOD = 9;
+ final static int STRINGBUFFER_APPEND_INT_METHOD = 2;
+ final static int STRINGBUFFER_APPEND_FLOAT_METHOD = 3;
+ final static int STRINGBUFFER_APPEND_LONG_METHOD = 4;
+ final static int STRINGBUFFER_APPEND_OBJECT_METHOD = 5;
+ final static int STRINGBUFFER_APPEND_CHAR_METHOD = 6;
+ final static int STRINGBUFFER_APPEND_STRING_METHOD = 7;
+ final static int STRINGBUFFER_APPEND_BOOLEAN_METHOD = 8;
+ final static int STRINGBUFFER_APPEND_DOUBLE_METHOD = 9;
final static int STRINGBUFFER_STRING_CONSTR_METHOD = 10;
final static int STRINGBUFFER_DEFAULT_CONSTR_METHOD = 11;
final static int STRINGBUFFER_TOSTRING_METHOD = 12;
@@ -106,13 +108,13 @@ public class ConstantPool implements ClassFileConstants, TypeIds {
final static int JAVALANGERROR_CONSTR_METHOD = 15;
final static int NEWINSTANCE_CONSTRUCTOR_METHOD = 16;
final static int STRING_INTERN_METHOD = 17;
- final static int VALUEOF_INT_METHOD = 18;
- final static int VALUEOF_FLOAT_METHOD = 19;
- final static int VALUEOF_LONG_METHOD = 20;
- final static int VALUEOF_OBJECT_METHOD = 21;
- final static int VALUEOF_CHAR_METHOD = 22;
- final static int VALUEOF_BOOLEAN_METHOD = 23;
- final static int VALUEOF_DOUBLE_METHOD = 24;
+ final static int STRING_VALUEOF_INT_METHOD = 18;
+ final static int STRING_VALUEOF_FLOAT_METHOD = 19;
+ final static int STRING_VALUEOF_LONG_METHOD = 20;
+ final static int STRING_VALUEOF_OBJECT_METHOD = 21;
+ final static int STRING_VALUEOF_CHAR_METHOD = 22;
+ final static int STRING_VALUEOF_BOOLEAN_METHOD = 23;
+ final static int STRING_VALUEOF_DOUBLE_METHOD = 24;
final static int ASSERTIONERROR_CONSTR_OBJECT_METHOD = 25;
final static int ASSERTIONERROR_CONSTR_INT_METHOD = 26;
final static int ASSERTIONERROR_CONSTR_LONG_METHOD = 27;
@@ -121,9 +123,22 @@ public class ConstantPool implements ClassFileConstants, TypeIds {
final static int ASSERTIONERROR_CONSTR_BOOLEAN_METHOD = 30;
final static int ASSERTIONERROR_CONSTR_CHAR_METHOD = 31;
final static int ASSERTIONERROR_DEFAULT_CONSTR_METHOD = 32;
- final static int DESIREDASSERTIONSTATUS_CLASS_METHOD = 33;
- final static int GETCLASS_OBJECT_METHOD = 34;
- final static int GETCOMPONENTTYPE_CLASS_METHOD = 35;
+ final static int CLASS_DESIREDASSERTIONSTATUS_METHOD = 33;
+ final static int OBJECT_GETCLASS_METHOD = 34;
+ final static int CLASS_GETCOMPONENTTYPE_METHOD = 35;
+ final static int ITERATOR_HASNEXT_METHOD = 36;
+ final static int ITERATOR_NEXT_METHOD = 37;
+ final static int STRINGBUILDER_STRING_CONSTR_METHOD = 38;
+ final static int STRINGBUILDER_DEFAULT_CONSTR_METHOD = 39;
+ final static int STRINGBUILDER_TOSTRING_METHOD = 40;
+ final static int STRINGBUILDER_APPEND_INT_METHOD = 41;
+ final static int STRINGBUILDER_APPEND_FLOAT_METHOD = 42;
+ final static int STRINGBUILDER_APPEND_LONG_METHOD = 43;
+ final static int STRINGBUILDER_APPEND_OBJECT_METHOD = 44;
+ final static int STRINGBUILDER_APPEND_CHAR_METHOD = 45;
+ final static int STRINGBUILDER_APPEND_STRING_METHOD = 46;
+ final static int STRINGBUILDER_APPEND_BOOLEAN_METHOD = 47;
+ final static int STRINGBUILDER_APPEND_DOUBLE_METHOD = 48;
// predefined constant index for well known name and type for fields
final static int TYPE_JAVALANGCLASS_NAME_AND_TYPE = 0;
@@ -132,14 +147,14 @@ public class ConstantPool implements ClassFileConstants, TypeIds {
final static int FORNAME_CLASS_METHOD_NAME_AND_TYPE = 0;
final static int CONSTR_STRING_METHOD_NAME_AND_TYPE = 1;
final static int DEFAULT_CONSTR_METHOD_NAME_AND_TYPE = 2;
- final static int APPEND_INT_METHOD_NAME_AND_TYPE = 3;
- final static int APPEND_FLOAT_METHOD_NAME_AND_TYPE = 4;
- final static int APPEND_LONG_METHOD_NAME_AND_TYPE = 5;
- final static int APPEND_OBJECT_METHOD_NAME_AND_TYPE = 6;
- final static int APPEND_CHAR_METHOD_NAME_AND_TYPE = 7;
- final static int APPEND_STRING_METHOD_NAME_AND_TYPE = 8;
- final static int APPEND_BOOLEAN_METHOD_NAME_AND_TYPE = 9;
- final static int APPEND_DOUBLE_METHOD_NAME_AND_TYPE = 10;
+ final static int APPEND_INT_STRINGBUFFER_METHOD_NAME_AND_TYPE = 3;
+ final static int APPEND_FLOAT_STRINGBUFFER_METHOD_NAME_AND_TYPE = 4;
+ final static int APPEND_LONG_STRINGBUFFER_METHOD_NAME_AND_TYPE = 5;
+ final static int APPEND_OBJECT_STRINGBUFFER_METHOD_NAME_AND_TYPE = 6;
+ final static int APPEND_CHAR_STRINGBUFFER_METHOD_NAME_AND_TYPE = 7;
+ final static int APPEND_STRING_STRINGBUFFER_METHOD_NAME_AND_TYPE = 8;
+ final static int APPEND_BOOLEAN_STRINGBUFFER_METHOD_NAME_AND_TYPE = 9;
+ final static int APPEND_DOUBLE_STRINGBUFFER_METHOD_NAME_AND_TYPE = 10;
final static int TOSTRING_METHOD_NAME_AND_TYPE = 11;
final static int EXIT_METHOD_NAME_AND_TYPE = 12;
final static int GETMESSAGE_METHOD_NAME_AND_TYPE = 13;
@@ -162,6 +177,17 @@ public class ConstantPool implements ClassFileConstants, TypeIds {
final static int DESIREDASSERTIONSTATUS_METHOD_NAME_AND_TYPE = 30;
final static int GETCLASS_OBJECT_METHOD_NAME_AND_TYPE = 31;
final static int GETCOMPONENTTYPE_CLASS_METHOD_NAME_AND_TYPE = 32;
+ final static int HASNEXT_METHOD_NAME_AND_TYPE = 33;
+ final static int NEXT_METHOD_NAME_AND_TYPE = 34;
+ final static int APPEND_INT_STRINGBUILDER_METHOD_NAME_AND_TYPE = 35;
+ final static int APPEND_FLOAT_STRINGBUILDER_METHOD_NAME_AND_TYPE = 36;
+ final static int APPEND_LONG_STRINGBUILDER_METHOD_NAME_AND_TYPE = 37;
+ final static int APPEND_OBJECT_STRINGBUILDER_METHOD_NAME_AND_TYPE = 38;
+ final static int APPEND_CHAR_STRINGBUILDER_METHOD_NAME_AND_TYPE = 39;
+ final static int APPEND_STRING_STRINGBUILDER_METHOD_NAME_AND_TYPE = 40;
+ final static int APPEND_BOOLEAN_STRINGBUILDER_METHOD_NAME_AND_TYPE = 41;
+ final static int APPEND_DOUBLE_STRINGBUILDER_METHOD_NAME_AND_TYPE = 42;
+
public ClassFile classFile;
@@ -219,43 +245,40 @@ public int indexOfWellKnownFields(FieldBinding fieldBinding) {
switch (fieldBinding.declaringClass.id) {
case T_JavaLangByte :
if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.TYPE))
- return TYPE_BYTE_FIELD;
+ return JAVA_LANG_BYTE_TYPE_FIELD;
break;
case T_JavaLangShort :
if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.TYPE))
- return TYPE_SHORT_FIELD;
+ return JAVA_LANG_SHORT_TYPE_FIELD;
break;
case T_JavaLangCharacter :
if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.TYPE))
- return TYPE_CHARACTER_FIELD;
+ return JAVA_LANG_CHARACTER_TYPE_FIELD;
break;
case T_JavaLangInteger :
if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.TYPE))
- return TYPE_INTEGER_FIELD;
+ return JAVA_LANG_INTEGER_TYPE_FIELD;
break;
case T_JavaLangLong :
if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.TYPE))
- return TYPE_LONG_FIELD;
+ return JAVA_LANG_LONG_TYPE_FIELD;
break;
case T_JavaLangFloat :
if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.TYPE))
- return TYPE_FLOAT_FIELD;
+ return JAVA_LANG_FLOAT_TYPE_FIELD;
break;
case T_JavaLangDouble :
if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.TYPE))
- return TYPE_DOUBLE_FIELD;
+ return JAVA_LANG_DOUBLE_TYPE_FIELD;
break;
case T_JavaLangBoolean :
if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.TYPE))
- return TYPE_BOOLEAN_FIELD;
+ return JAVA_LANG_BOOLEAN_TYPE_FIELD;
break;
case T_JavaLangVoid :
if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.TYPE))
- return TYPE_VOID_FIELD;
+ return JAVA_LANG_VOID_TYPE_FIELD;
break;
- case T_JavaLangSystem :
- if (CharOperation.equals(fieldBinding.name, QualifiedNamesConstants.Out))
- return OUT_SYSTEM_FIELD;
}
return -1;
}
@@ -339,34 +362,65 @@ public int indexOfWellKnownMethodNameAndType(MethodBinding methodBinding) {
}
break;
case 'a' :
- if ((methodBinding.parameters.length == 1) && (methodBinding.returnType.id == T_JavaLangStringBuffer) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Append))) {
- switch (methodBinding.parameters[0].id) {
- case T_int :
- case T_byte :
- case T_short :
- // This method binding is append(int)
- return APPEND_INT_METHOD_NAME_AND_TYPE;
- case T_float :
- // This method binding is append(float)
- return APPEND_FLOAT_METHOD_NAME_AND_TYPE;
- case T_long :
- // This method binding is append(long)
- return APPEND_LONG_METHOD_NAME_AND_TYPE;
- case T_JavaLangObject :
- // This method binding is append(java.lang.Object)
- return APPEND_OBJECT_METHOD_NAME_AND_TYPE;
- case T_char :
- // This method binding is append(char)
- return APPEND_CHAR_METHOD_NAME_AND_TYPE;
- case T_JavaLangString :
- // This method binding is append(java.lang.String)
- return APPEND_STRING_METHOD_NAME_AND_TYPE;
- case T_boolean :
- // This method binding is append(boolean)
- return APPEND_BOOLEAN_METHOD_NAME_AND_TYPE;
- case T_double :
- // This method binding is append(double)
- return APPEND_DOUBLE_METHOD_NAME_AND_TYPE;
+ if ((methodBinding.parameters.length == 1) && CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Append)) {
+ if (methodBinding.returnType.id == T_JavaLangStringBuffer) {
+ switch (methodBinding.parameters[0].id) {
+ case T_int :
+ case T_byte :
+ case T_short :
+ // This method binding is append(int)
+ return APPEND_INT_STRINGBUFFER_METHOD_NAME_AND_TYPE;
+ case T_float :
+ // This method binding is append(float)
+ return APPEND_FLOAT_STRINGBUFFER_METHOD_NAME_AND_TYPE;
+ case T_long :
+ // This method binding is append(long)
+ return APPEND_LONG_STRINGBUFFER_METHOD_NAME_AND_TYPE;
+ case T_JavaLangObject :
+ // This method binding is append(java.lang.Object)
+ return APPEND_OBJECT_STRINGBUFFER_METHOD_NAME_AND_TYPE;
+ case T_char :
+ // This method binding is append(char)
+ return APPEND_CHAR_STRINGBUFFER_METHOD_NAME_AND_TYPE;
+ case T_JavaLangString :
+ // This method binding is append(java.lang.String)
+ return APPEND_STRING_STRINGBUFFER_METHOD_NAME_AND_TYPE;
+ case T_boolean :
+ // This method binding is append(boolean)
+ return APPEND_BOOLEAN_STRINGBUFFER_METHOD_NAME_AND_TYPE;
+ case T_double :
+ // This method binding is append(double)
+ return APPEND_DOUBLE_STRINGBUFFER_METHOD_NAME_AND_TYPE;
+ }
+ } else if (methodBinding.returnType.id == T_JavaLangStringBuilder) {
+ switch (methodBinding.parameters[0].id) {
+ case T_int :
+ case T_byte :
+ case T_short :
+ // This method binding is append(int)
+ return APPEND_INT_STRINGBUILDER_METHOD_NAME_AND_TYPE;
+ case T_float :
+ // This method binding is append(float)
+ return APPEND_FLOAT_STRINGBUILDER_METHOD_NAME_AND_TYPE;
+ case T_long :
+ // This method binding is append(long)
+ return APPEND_LONG_STRINGBUILDER_METHOD_NAME_AND_TYPE;
+ case T_JavaLangObject :
+ // This method binding is append(java.lang.Object)
+ return APPEND_OBJECT_STRINGBUILDER_METHOD_NAME_AND_TYPE;
+ case T_char :
+ // This method binding is append(char)
+ return APPEND_CHAR_STRINGBUILDER_METHOD_NAME_AND_TYPE;
+ case T_JavaLangString :
+ // This method binding is append(java.lang.String)
+ return APPEND_STRING_STRINGBUILDER_METHOD_NAME_AND_TYPE;
+ case T_boolean :
+ // This method binding is append(boolean)
+ return APPEND_BOOLEAN_STRINGBUILDER_METHOD_NAME_AND_TYPE;
+ case T_double :
+ // This method binding is append(double)
+ return APPEND_DOUBLE_STRINGBUILDER_METHOD_NAME_AND_TYPE;
+ }
}
}
break;
@@ -425,9 +479,20 @@ public int indexOfWellKnownMethodNameAndType(MethodBinding methodBinding) {
break;
case 'i' :
if ((methodBinding.parameters.length == 0) && (methodBinding.returnType.id == T_JavaLangString) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Intern))) {
- // This method binding is toString()
+ // This method binding is intern()java.lang.String
return INTERN_METHOD_NAME_AND_TYPE;
- }
+ }
+ break;
+ case 'h' :
+ if ((methodBinding.parameters.length == 0) && (methodBinding.returnType.id == T_boolean) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.HasNext))) {
+ // This method binding is hasNext()Z
+ return HASNEXT_METHOD_NAME_AND_TYPE;
+ }
+ case 'n' :
+ if ((methodBinding.parameters.length == 0) && (methodBinding.returnType.id == T_JavaLangObject) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Next))) {
+ // This method binding is next()java.lang.Object
+ return NEXT_METHOD_NAME_AND_TYPE;
+ }
}
return -1;
}
@@ -446,11 +511,11 @@ public int indexOfWellKnownMethods(MethodBinding methodBinding) {
case T_JavaLangClass :
if ((firstChar == 'f') && (methodBinding.isStatic()) && (methodBinding.parameters.length == 1) && (methodBinding.parameters[0].id == T_JavaLangString) && (methodBinding.returnType.id == T_JavaLangClass) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.ForName))) {
// This method binding is forName(java.lang.String)
- return FORNAME_CLASS_METHOD;
+ return CLASS_FORNAME_METHOD;
} else if ((firstChar == 'd') && (methodBinding.parameters.length == 0) && (methodBinding.returnType.id == T_boolean) && CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.DesiredAssertionStatus)) {
- return DESIREDASSERTIONSTATUS_CLASS_METHOD;
+ return CLASS_DESIREDASSERTIONSTATUS_METHOD;
} else if ((firstChar == 'g') && (methodBinding.parameters.length == 0) && (methodBinding.returnType.id == T_JavaLangClass) && CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.GetComponentType)) {
- return GETCOMPONENTTYPE_CLASS_METHOD;
+ return CLASS_GETCOMPONENTTYPE_METHOD;
}
break;
case T_JavaLangNoClassDefError :
@@ -471,28 +536,28 @@ public int indexOfWellKnownMethods(MethodBinding methodBinding) {
case T_byte :
case T_short :
// This method binding is append(int)
- return APPEND_INT_METHOD;
+ return STRINGBUFFER_APPEND_INT_METHOD;
case T_float :
// This method binding is append(float)
- return APPEND_FLOAT_METHOD;
+ return STRINGBUFFER_APPEND_FLOAT_METHOD;
case T_long :
// This method binding is append(long)
- return APPEND_LONG_METHOD;
+ return STRINGBUFFER_APPEND_LONG_METHOD;
case T_JavaLangObject :
// This method binding is append(java.lang.Object)
- return APPEND_OBJECT_METHOD;
+ return STRINGBUFFER_APPEND_OBJECT_METHOD;
case T_char :
// This method binding is append(char)
- return APPEND_CHAR_METHOD;
+ return STRINGBUFFER_APPEND_CHAR_METHOD;
case T_JavaLangString :
// This method binding is append(java.lang.String)
- return APPEND_STRING_METHOD;
+ return STRINGBUFFER_APPEND_STRING_METHOD;
case T_boolean :
// This method binding is append(boolean)
- return APPEND_BOOLEAN_METHOD;
+ return STRINGBUFFER_APPEND_BOOLEAN_METHOD;
case T_double :
// This method binding is append(double)
- return APPEND_DOUBLE_METHOD;
+ return STRINGBUFFER_APPEND_DOUBLE_METHOD;
}
} else
if ((firstChar == 't') && (methodBinding.parameters.length == 0) && (methodBinding.returnType.id == T_JavaLangString) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.ToString))) {
@@ -511,26 +576,73 @@ public int indexOfWellKnownMethods(MethodBinding methodBinding) {
}
}
break;
+ case T_JavaLangStringBuilder :
+ if ((firstChar == 'a') && (methodBinding.parameters.length == 1) && (methodBinding.returnType.id == T_JavaLangStringBuilder) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Append))) {
+ switch (methodBinding.parameters[0].id) {
+ case T_int :
+ case T_byte :
+ case T_short :
+ // This method binding is append(int)
+ return STRINGBUILDER_APPEND_INT_METHOD;
+ case T_float :
+ // This method binding is append(float)
+ return STRINGBUILDER_APPEND_FLOAT_METHOD;
+ case T_long :
+ // This method binding is append(long)
+ return STRINGBUILDER_APPEND_LONG_METHOD;
+ case T_JavaLangObject :
+ // This method binding is append(java.lang.Object)
+ return STRINGBUILDER_APPEND_OBJECT_METHOD;
+ case T_char :
+ // This method binding is append(char)
+ return STRINGBUILDER_APPEND_CHAR_METHOD;
+ case T_JavaLangString :
+ // This method binding is append(java.lang.String)
+ return STRINGBUILDER_APPEND_STRING_METHOD;
+ case T_boolean :
+ // This method binding is append(boolean)
+ return STRINGBUILDER_APPEND_BOOLEAN_METHOD;
+ case T_double :
+ // This method binding is append(double)
+ return STRINGBUILDER_APPEND_DOUBLE_METHOD;
+ }
+ } else
+ if ((firstChar == 't') && (methodBinding.parameters.length == 0) && (methodBinding.returnType.id == T_JavaLangString) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.ToString))) {
+ // This method binding is toString()
+ return STRINGBUILDER_TOSTRING_METHOD;
+ } else
+ if ((firstChar == '<') && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Init))) {
+ if ((methodBinding.parameters.length == 1) && (methodBinding.parameters[0].id == T_JavaLangString)) {
+ // This method binding is <init>(String)
+ return STRINGBUILDER_STRING_CONSTR_METHOD;
+ } else {
+ if (methodBinding.parameters.length == 0) {
+ // This method binding is <init>()
+ return STRINGBUILDER_DEFAULT_CONSTR_METHOD;
+ }
+ }
+ }
+ break;
case T_JavaLangString :
if ((firstChar == 'v') && (methodBinding.parameters.length == 1) && (methodBinding.returnType.id == T_JavaLangString) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.ValueOf))) {
// This method binding is valueOf(java.lang.Object)
switch (methodBinding.parameters[0].id) {
case T_Object :
- return VALUEOF_OBJECT_METHOD;
+ return STRING_VALUEOF_OBJECT_METHOD;
case T_int :
case T_short :
case T_byte :
- return VALUEOF_INT_METHOD;
+ return STRING_VALUEOF_INT_METHOD;
case T_long :
- return VALUEOF_LONG_METHOD;
+ return STRING_VALUEOF_LONG_METHOD;
case T_float :
- return VALUEOF_FLOAT_METHOD;
+ return STRING_VALUEOF_FLOAT_METHOD;
case T_double :
- return VALUEOF_DOUBLE_METHOD;
+ return STRING_VALUEOF_DOUBLE_METHOD;
case T_boolean :
- return VALUEOF_BOOLEAN_METHOD;
+ return STRING_VALUEOF_BOOLEAN_METHOD;
case T_char :
- return VALUEOF_CHAR_METHOD;
+ return STRING_VALUEOF_CHAR_METHOD;
}
} else
if ((firstChar == 'i') && (methodBinding.parameters.length == 0) && (methodBinding.returnType.id == T_JavaLangString) && (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Intern))) {
@@ -585,8 +697,18 @@ public int indexOfWellKnownMethods(MethodBinding methodBinding) {
case T_JavaLangObject :
if (methodBinding.parameters.length == 0
&& CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.GetClass)) {
- return GETCLASS_OBJECT_METHOD;
- }
+ return OBJECT_GETCLASS_METHOD;
+ }
+ break;
+ case T_JavaUtilIterator :
+ if (methodBinding.parameters.length == 0) {
+ if (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.HasNext)) {
+ return ITERATOR_HASNEXT_METHOD;
+ }
+ if (CharOperation.equals(methodBinding.selector, QualifiedNamesConstants.Next)) {
+ return ITERATOR_NEXT_METHOD;
+ }
+ }
}
return -1;
}
@@ -616,12 +738,14 @@ public int indexOfWellKnownTypes(TypeBinding typeBinding) {
case T_JavaLangObject : return JAVA_LANG_OBJECT_TYPE;
case T_JavaLangString : return JAVA_LANG_STRING_TYPE;
case T_JavaLangStringBuffer : return JAVA_LANG_STRINGBUFFER_TYPE;
+ case T_JavaLangStringBuilder: return JAVA_LANG_STRINGBUILDER_TYPE;
case T_JavaLangSystem : return JAVA_LANG_SYSTEM_TYPE;
case T_JavaLangThrowable : return JAVA_LANG_THROWABLE_TYPE;
case T_JavaLangError : return JAVA_LANG_ERROR_TYPE;
case T_JavaLangException : return JAVA_LANG_EXCEPTION_TYPE;
case T_JavaLangReflectConstructor : return JAVA_LANG_REFLECT_CONSTRUCTOR_TYPE;
case T_JavaLangAssertionError : return JAVA_LANG_ASSERTIONERROR_TYPE;
+ case T_JavaUtilIterator : return JAVA_UTIL_ITERATOR_TYPE;
}
return -1;
}
@@ -1132,7 +1256,7 @@ public int literalIndexForJavaLangBoolean() {
*/
public int literalIndexForJavaLangBooleanTYPE() {
int index;
- if ((index = wellKnownFields[TYPE_BOOLEAN_FIELD]) == 0) {
+ if ((index = wellKnownFields[JAVA_LANG_BOOLEAN_TYPE_FIELD]) == 0) {
int nameAndTypeIndex;
int classIndex;
// The entry doesn't exit yet
@@ -1145,7 +1269,7 @@ public int literalIndexForJavaLangBooleanTYPE() {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownFields[TYPE_BOOLEAN_FIELD] = currentIndex++;
+ index = wellKnownFields[JAVA_LANG_BOOLEAN_TYPE_FIELD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -1184,7 +1308,7 @@ public int literalIndexForJavaLangByte() {
*/
public int literalIndexForJavaLangByteTYPE() {
int index;
- if ((index = wellKnownFields[TYPE_BYTE_FIELD]) == 0) {
+ if ((index = wellKnownFields[JAVA_LANG_BYTE_TYPE_FIELD]) == 0) {
int nameAndTypeIndex;
int classIndex;
// The entry doesn't exit yet
@@ -1197,7 +1321,7 @@ public int literalIndexForJavaLangByteTYPE() {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownFields[TYPE_BYTE_FIELD] = currentIndex++;
+ index = wellKnownFields[JAVA_LANG_BYTE_TYPE_FIELD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -1236,7 +1360,7 @@ public int literalIndexForJavaLangCharacter() {
*/
public int literalIndexForJavaLangCharacterTYPE() {
int index;
- if ((index = wellKnownFields[TYPE_CHARACTER_FIELD]) == 0) {
+ if ((index = wellKnownFields[JAVA_LANG_CHARACTER_TYPE_FIELD]) == 0) {
int nameAndTypeIndex;
int classIndex;
// The entry doesn't exit yet
@@ -1249,7 +1373,7 @@ public int literalIndexForJavaLangCharacterTYPE() {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownFields[TYPE_CHARACTER_FIELD] = currentIndex++;
+ index = wellKnownFields[JAVA_LANG_CHARACTER_TYPE_FIELD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -1292,7 +1416,7 @@ public int literalIndexForJavaLangClassForName() {
int nameAndTypeIndex;
int classIndex;
// Looking into the method ref table
- if ((index = wellKnownMethods[FORNAME_CLASS_METHOD]) == 0) {
+ if ((index = wellKnownMethods[CLASS_FORNAME_METHOD]) == 0) {
classIndex = literalIndexForJavaLangClass();
if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[FORNAME_CLASS_METHOD_NAME_AND_TYPE]) == 0) {
int nameIndex = literalIndex(QualifiedNamesConstants.ForName);
@@ -1302,7 +1426,7 @@ public int literalIndexForJavaLangClassForName() {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownMethods[FORNAME_CLASS_METHOD] = currentIndex++;
+ index = wellKnownMethods[CLASS_FORNAME_METHOD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -1328,7 +1452,7 @@ public int literalIndexForJavaLangClassDesiredAssertionStatus() {
int nameAndTypeIndex;
int classIndex;
// Looking into the method ref table
- if ((index = wellKnownMethods[DESIREDASSERTIONSTATUS_CLASS_METHOD]) == 0) {
+ if ((index = wellKnownMethods[CLASS_DESIREDASSERTIONSTATUS_METHOD]) == 0) {
classIndex = literalIndexForJavaLangClass();
if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[DESIREDASSERTIONSTATUS_METHOD_NAME_AND_TYPE]) == 0) {
int nameIndex = literalIndex(QualifiedNamesConstants.DesiredAssertionStatus);
@@ -1338,7 +1462,7 @@ public int literalIndexForJavaLangClassDesiredAssertionStatus() {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownMethods[DESIREDASSERTIONSTATUS_CLASS_METHOD] = currentIndex++;
+ index = wellKnownMethods[CLASS_DESIREDASSERTIONSTATUS_METHOD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -1364,7 +1488,7 @@ public int literalIndexForJavaLangClassGetComponentType() {
int nameAndTypeIndex;
int classIndex;
// Looking into the method ref table
- if ((index = wellKnownMethods[GETCOMPONENTTYPE_CLASS_METHOD]) == 0) {
+ if ((index = wellKnownMethods[CLASS_GETCOMPONENTTYPE_METHOD]) == 0) {
classIndex = literalIndexForJavaLangClass();
if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[GETCOMPONENTTYPE_CLASS_METHOD_NAME_AND_TYPE]) == 0) {
int nameIndex = literalIndex(QualifiedNamesConstants.GetComponentType);
@@ -1374,7 +1498,7 @@ public int literalIndexForJavaLangClassGetComponentType() {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownMethods[GETCOMPONENTTYPE_CLASS_METHOD] = currentIndex++;
+ index = wellKnownMethods[CLASS_GETCOMPONENTTYPE_METHOD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -1438,7 +1562,7 @@ public int literalIndexForJavaLangDouble() {
*/
public int literalIndexForJavaLangDoubleTYPE() {
int index;
- if ((index = wellKnownFields[TYPE_DOUBLE_FIELD]) == 0) {
+ if ((index = wellKnownFields[JAVA_LANG_DOUBLE_TYPE_FIELD]) == 0) {
int nameAndTypeIndex;
int classIndex;
// The entry doesn't exit yet
@@ -1451,7 +1575,7 @@ public int literalIndexForJavaLangDoubleTYPE() {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownFields[TYPE_DOUBLE_FIELD] = currentIndex++;
+ index = wellKnownFields[JAVA_LANG_DOUBLE_TYPE_FIELD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -1562,7 +1686,7 @@ public int literalIndexForJavaLangFloat() {
*/
public int literalIndexForJavaLangFloatTYPE() {
int index;
- if ((index = wellKnownFields[TYPE_FLOAT_FIELD]) == 0) {
+ if ((index = wellKnownFields[JAVA_LANG_FLOAT_TYPE_FIELD]) == 0) {
int nameAndTypeIndex;
int classIndex;
// The entry doesn't exit yet
@@ -1575,7 +1699,7 @@ public int literalIndexForJavaLangFloatTYPE() {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownFields[TYPE_FLOAT_FIELD] = currentIndex++;
+ index = wellKnownFields[JAVA_LANG_FLOAT_TYPE_FIELD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -1614,7 +1738,7 @@ public int literalIndexForJavaLangInteger() {
*/
public int literalIndexForJavaLangIntegerTYPE() {
int index;
- if ((index = wellKnownFields[TYPE_INTEGER_FIELD]) == 0) {
+ if ((index = wellKnownFields[JAVA_LANG_INTEGER_TYPE_FIELD]) == 0) {
int nameAndTypeIndex;
int classIndex;
// The entry doesn't exit yet
@@ -1627,7 +1751,7 @@ public int literalIndexForJavaLangIntegerTYPE() {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownFields[TYPE_INTEGER_FIELD] = currentIndex++;
+ index = wellKnownFields[JAVA_LANG_INTEGER_TYPE_FIELD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -1666,7 +1790,7 @@ public int literalIndexForJavaLangLong() {
*/
public int literalIndexForJavaLangLongTYPE() {
int index;
- if ((index = wellKnownFields[TYPE_LONG_FIELD]) == 0) {
+ if ((index = wellKnownFields[JAVA_LANG_LONG_TYPE_FIELD]) == 0) {
int nameAndTypeIndex;
int classIndex;
// The entry doesn't exit yet
@@ -1679,7 +1803,7 @@ public int literalIndexForJavaLangLongTYPE() {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownFields[TYPE_LONG_FIELD] = currentIndex++;
+ index = wellKnownFields[JAVA_LANG_LONG_TYPE_FIELD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -2094,7 +2218,7 @@ public int literalIndexForJavaLangShort() {
*/
public int literalIndexForJavaLangShortTYPE() {
int index;
- if ((index = wellKnownFields[TYPE_SHORT_FIELD]) == 0) {
+ if ((index = wellKnownFields[JAVA_LANG_SHORT_TYPE_FIELD]) == 0) {
int nameAndTypeIndex;
int classIndex;
// The entry doesn't exit yet
@@ -2107,7 +2231,7 @@ public int literalIndexForJavaLangShortTYPE() {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownFields[TYPE_SHORT_FIELD] = currentIndex++;
+ index = wellKnownFields[JAVA_LANG_SHORT_TYPE_FIELD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -2143,6 +2267,28 @@ public int literalIndexForJavaLangString() {
*
* @return <CODE>int</CODE>
*/
+public int literalIndexForJavaUtilIterator() {
+ int index;
+ if ((index = wellKnownTypes[JAVA_UTIL_ITERATOR_TYPE]) == 0) {
+ int nameIndex;
+ // The entry doesn't exit yet
+ nameIndex = literalIndex(QualifiedNamesConstants.JavaUtilIteratorConstantPoolName);
+ index = wellKnownTypes[JAVA_UTIL_ITERATOR_TYPE] = currentIndex++;
+ if (index > 0xFFFF){
+ this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
+ }
+ writeU1(ClassTag);
+ // Then add the 8 bytes representing the long
+ writeU2(nameIndex);
+ }
+ return index;
+}
+/**
+ * This method returns the index into the constantPool corresponding to the type descriptor.
+ *
+ * @param TypeBinding aTypeBinding
+ * @return <CODE>int</CODE>
+ */
public int literalIndexForJavaLangStringBuffer() {
int index;
if ((index = wellKnownTypes[JAVA_LANG_STRINGBUFFER_TYPE]) == 0) {
@@ -2160,6 +2306,28 @@ public int literalIndexForJavaLangStringBuffer() {
return index;
}
/**
+ * This method returns the index into the constantPool corresponding to the type descriptor.
+ *
+ * @param TypeBinding aTypeBinding
+ * @return <CODE>int</CODE>
+ */
+public int literalIndexForJavaLangStringBuilder() {
+ int index;
+ if ((index = wellKnownTypes[JAVA_LANG_STRINGBUILDER_TYPE]) == 0) {
+ int nameIndex;
+ // The entry doesn't exit yet
+ nameIndex = literalIndex(QualifiedNamesConstants.JavaLangStringBuilderConstantPoolName);
+ index = wellKnownTypes[JAVA_LANG_STRINGBUILDER_TYPE] = currentIndex++;
+ if (index > 0xFFFF){
+ this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
+ }
+ writeU1(ClassTag);
+ // Then add the 8 bytes representing the long
+ writeU2(nameIndex);
+ }
+ return index;
+}
+/**
* This method returns the index into the constantPool corresponding to the
* method descriptor. It can be either an interface method reference constant
* or a method reference constant.
@@ -2174,17 +2342,17 @@ public int literalIndexForJavaLangStringBufferAppend(int typeID) {
case T_int :
case T_byte :
case T_short :
- if ((index = wellKnownMethods[APPEND_INT_METHOD]) == 0) {
+ if ((index = wellKnownMethods[STRINGBUFFER_APPEND_INT_METHOD]) == 0) {
classIndex = literalIndexForJavaLangStringBuffer();
- if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_INT_METHOD_NAME_AND_TYPE]) == 0) {
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_INT_STRINGBUFFER_METHOD_NAME_AND_TYPE]) == 0) {
int nameIndex = literalIndex(QualifiedNamesConstants.Append);
- int typeIndex = literalIndex(QualifiedNamesConstants.AppendIntSignature);
- nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_INT_METHOD_NAME_AND_TYPE] = currentIndex++;
+ int typeIndex = literalIndex(QualifiedNamesConstants.StringBufferAppendIntSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_INT_STRINGBUFFER_METHOD_NAME_AND_TYPE] = currentIndex++;
writeU1(NameAndTypeTag);
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownMethods[APPEND_INT_METHOD] = currentIndex++;
+ index = wellKnownMethods[STRINGBUFFER_APPEND_INT_METHOD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -2198,17 +2366,17 @@ public int literalIndexForJavaLangStringBufferAppend(int typeID) {
}
break;
case T_long :
- if ((index = wellKnownMethods[APPEND_LONG_METHOD]) == 0) {
+ if ((index = wellKnownMethods[STRINGBUFFER_APPEND_LONG_METHOD]) == 0) {
classIndex = literalIndexForJavaLangStringBuffer();
- if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_LONG_METHOD_NAME_AND_TYPE]) == 0) {
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_LONG_STRINGBUFFER_METHOD_NAME_AND_TYPE]) == 0) {
int nameIndex = literalIndex(QualifiedNamesConstants.Append);
- int typeIndex = literalIndex(QualifiedNamesConstants.AppendLongSignature);
- nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_LONG_METHOD_NAME_AND_TYPE] = currentIndex++;
+ int typeIndex = literalIndex(QualifiedNamesConstants.StringBufferAppendLongSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_LONG_STRINGBUFFER_METHOD_NAME_AND_TYPE] = currentIndex++;
writeU1(NameAndTypeTag);
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownMethods[APPEND_LONG_METHOD] = currentIndex++;
+ index = wellKnownMethods[STRINGBUFFER_APPEND_LONG_METHOD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -2222,17 +2390,17 @@ public int literalIndexForJavaLangStringBufferAppend(int typeID) {
}
break;
case T_float :
- if ((index = wellKnownMethods[APPEND_FLOAT_METHOD]) == 0) {
+ if ((index = wellKnownMethods[STRINGBUFFER_APPEND_FLOAT_METHOD]) == 0) {
classIndex = literalIndexForJavaLangStringBuffer();
- if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_FLOAT_METHOD_NAME_AND_TYPE]) == 0) {
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_FLOAT_STRINGBUFFER_METHOD_NAME_AND_TYPE]) == 0) {
int nameIndex = literalIndex(QualifiedNamesConstants.Append);
- int typeIndex = literalIndex(QualifiedNamesConstants.AppendFloatSignature);
- nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_FLOAT_METHOD_NAME_AND_TYPE] = currentIndex++;
+ int typeIndex = literalIndex(QualifiedNamesConstants.StringBufferAppendFloatSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_FLOAT_STRINGBUFFER_METHOD_NAME_AND_TYPE] = currentIndex++;
writeU1(NameAndTypeTag);
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownMethods[APPEND_FLOAT_METHOD] = currentIndex++;
+ index = wellKnownMethods[STRINGBUFFER_APPEND_FLOAT_METHOD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -2246,17 +2414,17 @@ public int literalIndexForJavaLangStringBufferAppend(int typeID) {
}
break;
case T_double :
- if ((index = wellKnownMethods[APPEND_DOUBLE_METHOD]) == 0) {
+ if ((index = wellKnownMethods[STRINGBUFFER_APPEND_DOUBLE_METHOD]) == 0) {
classIndex = literalIndexForJavaLangStringBuffer();
- if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_DOUBLE_METHOD_NAME_AND_TYPE]) == 0) {
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_DOUBLE_STRINGBUFFER_METHOD_NAME_AND_TYPE]) == 0) {
int nameIndex = literalIndex(QualifiedNamesConstants.Append);
- int typeIndex = literalIndex(QualifiedNamesConstants.AppendDoubleSignature);
- nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_DOUBLE_METHOD_NAME_AND_TYPE] = currentIndex++;
+ int typeIndex = literalIndex(QualifiedNamesConstants.StringBufferAppendDoubleSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_DOUBLE_STRINGBUFFER_METHOD_NAME_AND_TYPE] = currentIndex++;
writeU1(NameAndTypeTag);
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownMethods[APPEND_DOUBLE_METHOD] = currentIndex++;
+ index = wellKnownMethods[STRINGBUFFER_APPEND_DOUBLE_METHOD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -2270,17 +2438,17 @@ public int literalIndexForJavaLangStringBufferAppend(int typeID) {
}
break;
case T_char :
- if ((index = wellKnownMethods[APPEND_CHAR_METHOD]) == 0) {
+ if ((index = wellKnownMethods[STRINGBUFFER_APPEND_CHAR_METHOD]) == 0) {
classIndex = literalIndexForJavaLangStringBuffer();
- if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_CHAR_METHOD_NAME_AND_TYPE]) == 0) {
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_CHAR_STRINGBUFFER_METHOD_NAME_AND_TYPE]) == 0) {
int nameIndex = literalIndex(QualifiedNamesConstants.Append);
- int typeIndex = literalIndex(QualifiedNamesConstants.AppendCharSignature);
- nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_CHAR_METHOD_NAME_AND_TYPE] = currentIndex++;
+ int typeIndex = literalIndex(QualifiedNamesConstants.StringBufferAppendCharSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_CHAR_STRINGBUFFER_METHOD_NAME_AND_TYPE] = currentIndex++;
writeU1(NameAndTypeTag);
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownMethods[APPEND_CHAR_METHOD] = currentIndex++;
+ index = wellKnownMethods[STRINGBUFFER_APPEND_CHAR_METHOD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -2294,17 +2462,17 @@ public int literalIndexForJavaLangStringBufferAppend(int typeID) {
}
break;
case T_boolean :
- if ((index = wellKnownMethods[APPEND_BOOLEAN_METHOD]) == 0) {
+ if ((index = wellKnownMethods[STRINGBUFFER_APPEND_BOOLEAN_METHOD]) == 0) {
classIndex = literalIndexForJavaLangStringBuffer();
- if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_BOOLEAN_METHOD_NAME_AND_TYPE]) == 0) {
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_BOOLEAN_STRINGBUFFER_METHOD_NAME_AND_TYPE]) == 0) {
int nameIndex = literalIndex(QualifiedNamesConstants.Append);
- int typeIndex = literalIndex(QualifiedNamesConstants.AppendBooleanSignature);
- nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_BOOLEAN_METHOD_NAME_AND_TYPE] = currentIndex++;
+ int typeIndex = literalIndex(QualifiedNamesConstants.StringBufferAppendBooleanSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_BOOLEAN_STRINGBUFFER_METHOD_NAME_AND_TYPE] = currentIndex++;
writeU1(NameAndTypeTag);
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownMethods[APPEND_BOOLEAN_METHOD] = currentIndex++;
+ index = wellKnownMethods[STRINGBUFFER_APPEND_BOOLEAN_METHOD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -2318,17 +2486,17 @@ public int literalIndexForJavaLangStringBufferAppend(int typeID) {
}
break;
case T_Object :
- if ((index = wellKnownMethods[APPEND_OBJECT_METHOD]) == 0) {
+ if ((index = wellKnownMethods[STRINGBUFFER_APPEND_OBJECT_METHOD]) == 0) {
classIndex = literalIndexForJavaLangStringBuffer();
- if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_OBJECT_METHOD_NAME_AND_TYPE]) == 0) {
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_OBJECT_STRINGBUFFER_METHOD_NAME_AND_TYPE]) == 0) {
int nameIndex = literalIndex(QualifiedNamesConstants.Append);
- int typeIndex = literalIndex(QualifiedNamesConstants.AppendObjectSignature);
- nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_OBJECT_METHOD_NAME_AND_TYPE] = currentIndex++;
+ int typeIndex = literalIndex(QualifiedNamesConstants.StringBufferAppendObjectSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_OBJECT_STRINGBUFFER_METHOD_NAME_AND_TYPE] = currentIndex++;
writeU1(NameAndTypeTag);
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownMethods[APPEND_OBJECT_METHOD] = currentIndex++;
+ index = wellKnownMethods[STRINGBUFFER_APPEND_OBJECT_METHOD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -2343,17 +2511,227 @@ public int literalIndexForJavaLangStringBufferAppend(int typeID) {
break;
case T_String :
case T_null :
- if ((index = wellKnownMethods[APPEND_STRING_METHOD]) == 0) {
+ if ((index = wellKnownMethods[STRINGBUFFER_APPEND_STRING_METHOD]) == 0) {
classIndex = literalIndexForJavaLangStringBuffer();
- if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_STRING_METHOD_NAME_AND_TYPE]) == 0) {
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_STRING_STRINGBUFFER_METHOD_NAME_AND_TYPE]) == 0) {
int nameIndex = literalIndex(QualifiedNamesConstants.Append);
- int typeIndex = literalIndex(QualifiedNamesConstants.AppendStringSignature);
- nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_STRING_METHOD_NAME_AND_TYPE] = currentIndex++;
+ int typeIndex = literalIndex(QualifiedNamesConstants.StringBufferAppendStringSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_STRING_STRINGBUFFER_METHOD_NAME_AND_TYPE] = currentIndex++;
writeU1(NameAndTypeTag);
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownMethods[APPEND_STRING_METHOD] = currentIndex++;
+ index = wellKnownMethods[STRINGBUFFER_APPEND_STRING_METHOD] = currentIndex++;
+ if (index > 0xFFFF){
+ this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
+ }
+ // Write the method ref constant into the constant pool
+ // First add the tag
+ writeU1(MethodRefTag);
+ // Then write the class index
+ writeU2(classIndex);
+ // The write the nameAndType index
+ writeU2(nameAndTypeIndex);
+ }
+ break;
+ }
+ return index;
+}
+/**
+ * This method returns the index into the constantPool corresponding to the
+ * method descriptor. It can be either an interface method reference constant
+ * or a method reference constant.
+ *
+ * @return <CODE>int</CODE>
+ */
+public int literalIndexForJavaLangStringBuilderAppend(int typeID) {
+ int index = 0;
+ int nameAndTypeIndex = 0;
+ int classIndex = 0;
+ switch (typeID) {
+ case T_int :
+ case T_byte :
+ case T_short :
+ if ((index = wellKnownMethods[STRINGBUILDER_APPEND_INT_METHOD]) == 0) {
+ classIndex = literalIndexForJavaLangStringBuilder();
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_INT_STRINGBUILDER_METHOD_NAME_AND_TYPE]) == 0) {
+ int nameIndex = literalIndex(QualifiedNamesConstants.Append);
+ int typeIndex = literalIndex(QualifiedNamesConstants.StringBuilderAppendIntSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_INT_STRINGBUILDER_METHOD_NAME_AND_TYPE] = currentIndex++;
+ writeU1(NameAndTypeTag);
+ writeU2(nameIndex);
+ writeU2(typeIndex);
+ }
+ index = wellKnownMethods[STRINGBUILDER_APPEND_INT_METHOD] = currentIndex++;
+ if (index > 0xFFFF){
+ this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
+ }
+ // Write the method ref constant into the constant pool
+ // First add the tag
+ writeU1(MethodRefTag);
+ // Then write the class index
+ writeU2(classIndex);
+ // The write the nameAndType index
+ writeU2(nameAndTypeIndex);
+ }
+ break;
+ case T_long :
+ if ((index = wellKnownMethods[STRINGBUILDER_APPEND_LONG_METHOD]) == 0) {
+ classIndex = literalIndexForJavaLangStringBuilder();
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_LONG_STRINGBUILDER_METHOD_NAME_AND_TYPE]) == 0) {
+ int nameIndex = literalIndex(QualifiedNamesConstants.Append);
+ int typeIndex = literalIndex(QualifiedNamesConstants.StringBuilderAppendLongSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_LONG_STRINGBUILDER_METHOD_NAME_AND_TYPE] = currentIndex++;
+ writeU1(NameAndTypeTag);
+ writeU2(nameIndex);
+ writeU2(typeIndex);
+ }
+ index = wellKnownMethods[STRINGBUILDER_APPEND_LONG_METHOD] = currentIndex++;
+ if (index > 0xFFFF){
+ this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
+ }
+ // Write the method ref constant into the constant pool
+ // First add the tag
+ writeU1(MethodRefTag);
+ // Then write the class index
+ writeU2(classIndex);
+ // The write the nameAndType index
+ writeU2(nameAndTypeIndex);
+ }
+ break;
+ case T_float :
+ if ((index = wellKnownMethods[STRINGBUILDER_APPEND_FLOAT_METHOD]) == 0) {
+ classIndex = literalIndexForJavaLangStringBuilder();
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_FLOAT_STRINGBUILDER_METHOD_NAME_AND_TYPE]) == 0) {
+ int nameIndex = literalIndex(QualifiedNamesConstants.Append);
+ int typeIndex = literalIndex(QualifiedNamesConstants.StringBuilderAppendFloatSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_FLOAT_STRINGBUILDER_METHOD_NAME_AND_TYPE] = currentIndex++;
+ writeU1(NameAndTypeTag);
+ writeU2(nameIndex);
+ writeU2(typeIndex);
+ }
+ index = wellKnownMethods[STRINGBUILDER_APPEND_FLOAT_METHOD] = currentIndex++;
+ if (index > 0xFFFF){
+ this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
+ }
+ // Write the method ref constant into the constant pool
+ // First add the tag
+ writeU1(MethodRefTag);
+ // Then write the class index
+ writeU2(classIndex);
+ // The write the nameAndType index
+ writeU2(nameAndTypeIndex);
+ }
+ break;
+ case T_double :
+ if ((index = wellKnownMethods[STRINGBUILDER_APPEND_DOUBLE_METHOD]) == 0) {
+ classIndex = literalIndexForJavaLangStringBuilder();
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_DOUBLE_STRINGBUILDER_METHOD_NAME_AND_TYPE]) == 0) {
+ int nameIndex = literalIndex(QualifiedNamesConstants.Append);
+ int typeIndex = literalIndex(QualifiedNamesConstants.StringBuilderAppendDoubleSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_DOUBLE_STRINGBUILDER_METHOD_NAME_AND_TYPE] = currentIndex++;
+ writeU1(NameAndTypeTag);
+ writeU2(nameIndex);
+ writeU2(typeIndex);
+ }
+ index = wellKnownMethods[STRINGBUILDER_APPEND_DOUBLE_METHOD] = currentIndex++;
+ if (index > 0xFFFF){
+ this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
+ }
+ // Write the method ref constant into the constant pool
+ // First add the tag
+ writeU1(MethodRefTag);
+ // Then write the class index
+ writeU2(classIndex);
+ // The write the nameAndType index
+ writeU2(nameAndTypeIndex);
+ }
+ break;
+ case T_char :
+ if ((index = wellKnownMethods[STRINGBUILDER_APPEND_CHAR_METHOD]) == 0) {
+ classIndex = literalIndexForJavaLangStringBuilder();
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_CHAR_STRINGBUILDER_METHOD_NAME_AND_TYPE]) == 0) {
+ int nameIndex = literalIndex(QualifiedNamesConstants.Append);
+ int typeIndex = literalIndex(QualifiedNamesConstants.StringBuilderAppendCharSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_CHAR_STRINGBUILDER_METHOD_NAME_AND_TYPE] = currentIndex++;
+ writeU1(NameAndTypeTag);
+ writeU2(nameIndex);
+ writeU2(typeIndex);
+ }
+ index = wellKnownMethods[STRINGBUILDER_APPEND_CHAR_METHOD] = currentIndex++;
+ if (index > 0xFFFF){
+ this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
+ }
+ // Write the method ref constant into the constant pool
+ // First add the tag
+ writeU1(MethodRefTag);
+ // Then write the class index
+ writeU2(classIndex);
+ // The write the nameAndType index
+ writeU2(nameAndTypeIndex);
+ }
+ break;
+ case T_boolean :
+ if ((index = wellKnownMethods[STRINGBUILDER_APPEND_BOOLEAN_METHOD]) == 0) {
+ classIndex = literalIndexForJavaLangStringBuilder();
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_BOOLEAN_STRINGBUILDER_METHOD_NAME_AND_TYPE]) == 0) {
+ int nameIndex = literalIndex(QualifiedNamesConstants.Append);
+ int typeIndex = literalIndex(QualifiedNamesConstants.StringBuilderAppendBooleanSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_BOOLEAN_STRINGBUILDER_METHOD_NAME_AND_TYPE] = currentIndex++;
+ writeU1(NameAndTypeTag);
+ writeU2(nameIndex);
+ writeU2(typeIndex);
+ }
+ index = wellKnownMethods[STRINGBUILDER_APPEND_BOOLEAN_METHOD] = currentIndex++;
+ if (index > 0xFFFF){
+ this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
+ }
+ // Write the method ref constant into the constant pool
+ // First add the tag
+ writeU1(MethodRefTag);
+ // Then write the class index
+ writeU2(classIndex);
+ // The write the nameAndType index
+ writeU2(nameAndTypeIndex);
+ }
+ break;
+ case T_Object :
+ if ((index = wellKnownMethods[STRINGBUILDER_APPEND_OBJECT_METHOD]) == 0) {
+ classIndex = literalIndexForJavaLangStringBuilder();
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_OBJECT_STRINGBUILDER_METHOD_NAME_AND_TYPE]) == 0) {
+ int nameIndex = literalIndex(QualifiedNamesConstants.Append);
+ int typeIndex = literalIndex(QualifiedNamesConstants.StringBuilderAppendObjectSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_OBJECT_STRINGBUILDER_METHOD_NAME_AND_TYPE] = currentIndex++;
+ writeU1(NameAndTypeTag);
+ writeU2(nameIndex);
+ writeU2(typeIndex);
+ }
+ index = wellKnownMethods[STRINGBUILDER_APPEND_OBJECT_METHOD] = currentIndex++;
+ if (index > 0xFFFF){
+ this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
+ }
+ // Write the method ref constant into the constant pool
+ // First add the tag
+ writeU1(MethodRefTag);
+ // Then write the class index
+ writeU2(classIndex);
+ // The write the nameAndType index
+ writeU2(nameAndTypeIndex);
+ }
+ break;
+ case T_String :
+ case T_null :
+ if ((index = wellKnownMethods[STRINGBUILDER_APPEND_STRING_METHOD]) == 0) {
+ classIndex = literalIndexForJavaLangStringBuilder();
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_STRING_STRINGBUILDER_METHOD_NAME_AND_TYPE]) == 0) {
+ int nameIndex = literalIndex(QualifiedNamesConstants.Append);
+ int typeIndex = literalIndex(QualifiedNamesConstants.StringBuilderAppendStringSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[APPEND_STRING_STRINGBUILDER_METHOD_NAME_AND_TYPE] = currentIndex++;
+ writeU1(NameAndTypeTag);
+ writeU2(nameIndex);
+ writeU2(typeIndex);
+ }
+ index = wellKnownMethods[STRINGBUILDER_APPEND_STRING_METHOD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -2412,6 +2790,42 @@ public int literalIndexForJavaLangStringBufferConstructor() {
*
* @return <CODE>int</CODE>
*/
+public int literalIndexForJavaLangStringBuilderConstructor() {
+ int index;
+ int nameAndTypeIndex;
+ int classIndex;
+ // Looking into the method ref table
+ if ((index = wellKnownMethods[STRINGBUILDER_STRING_CONSTR_METHOD]) == 0) {
+ classIndex = literalIndexForJavaLangStringBuilder();
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_STRING_METHOD_NAME_AND_TYPE]) == 0) {
+ int nameIndex = literalIndex(QualifiedNamesConstants.Init);
+ int typeIndex = literalIndex(QualifiedNamesConstants.StringConstructorSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[CONSTR_STRING_METHOD_NAME_AND_TYPE] = currentIndex++;
+ writeU1(NameAndTypeTag);
+ writeU2(nameIndex);
+ writeU2(typeIndex);
+ }
+ index = wellKnownMethods[STRINGBUILDER_STRING_CONSTR_METHOD] = currentIndex++;
+ if (index > 0xFFFF){
+ this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
+ }
+ // Write the method ref constant into the constant pool
+ // First add the tag
+ writeU1(MethodRefTag);
+ // Then write the class index
+ writeU2(classIndex);
+ // The write the nameAndType index
+ writeU2(nameAndTypeIndex);
+ }
+ return index;
+}
+/**
+ * This method returns the index into the constantPool corresponding to the
+ * method descriptor. It can be either an interface method reference constant
+ * or a method reference constant.
+ *
+ * @return <CODE>int</CODE>
+ */
public int literalIndexForJavaLangStringBufferDefaultConstructor() {
int index;
int nameAndTypeIndex;
@@ -2448,6 +2862,42 @@ public int literalIndexForJavaLangStringBufferDefaultConstructor() {
*
* @return <CODE>int</CODE>
*/
+public int literalIndexForJavaLangStringBuilderDefaultConstructor() {
+ int index;
+ int nameAndTypeIndex;
+ int classIndex;
+ // Looking into the method ref table
+ if ((index = wellKnownMethods[STRINGBUILDER_DEFAULT_CONSTR_METHOD]) == 0) {
+ classIndex = literalIndexForJavaLangStringBuilder();
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[DEFAULT_CONSTR_METHOD_NAME_AND_TYPE]) == 0) {
+ int nameIndex = literalIndex(QualifiedNamesConstants.Init);
+ int typeIndex = literalIndex(QualifiedNamesConstants.DefaultConstructorSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[DEFAULT_CONSTR_METHOD_NAME_AND_TYPE] = currentIndex++;
+ writeU1(NameAndTypeTag);
+ writeU2(nameIndex);
+ writeU2(typeIndex);
+ }
+ index = wellKnownMethods[STRINGBUILDER_DEFAULT_CONSTR_METHOD] = currentIndex++;
+ if (index > 0xFFFF){
+ this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
+ }
+ // Write the method ref constant into the constant pool
+ // First add the tag
+ writeU1(MethodRefTag);
+ // Then write the class index
+ writeU2(classIndex);
+ // The write the nameAndType index
+ writeU2(nameAndTypeIndex);
+ }
+ return index;
+}
+/**
+ * This method returns the index into the constantPool corresponding to the
+ * method descriptor. It can be either an interface method reference constant
+ * or a method reference constant.
+ *
+ * @return <CODE>int</CODE>
+ */
public int literalIndexForJavaLangStringBufferToString() {
int index;
int nameAndTypeIndex;
@@ -2484,6 +2934,42 @@ public int literalIndexForJavaLangStringBufferToString() {
*
* @return <CODE>int</CODE>
*/
+public int literalIndexForJavaLangStringBuilderToString() {
+ int index;
+ int nameAndTypeIndex;
+ int classIndex;
+ // Looking into the method ref table
+ if ((index = wellKnownMethods[STRINGBUILDER_TOSTRING_METHOD]) == 0) {
+ classIndex = literalIndexForJavaLangStringBuilder();
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[TOSTRING_METHOD_NAME_AND_TYPE]) == 0) {
+ int nameIndex = literalIndex(QualifiedNamesConstants.ToString);
+ int typeIndex = literalIndex(QualifiedNamesConstants.ToStringSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[TOSTRING_METHOD_NAME_AND_TYPE] = currentIndex++;
+ writeU1(NameAndTypeTag);
+ writeU2(nameIndex);
+ writeU2(typeIndex);
+ }
+ index = wellKnownMethods[STRINGBUILDER_TOSTRING_METHOD] = currentIndex++;
+ if (index > 0xFFFF){
+ this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
+ }
+ // Write the method ref constant into the constant pool
+ // First add the tag
+ writeU1(MethodRefTag);
+ // Then write the class index
+ writeU2(classIndex);
+ // The write the nameAndType index
+ writeU2(nameAndTypeIndex);
+ }
+ return index;
+}
+/**
+ * This method returns the index into the constantPool corresponding to the
+ * method descriptor. It can be either an interface method reference constant
+ * or a method reference constant.
+ *
+ * @return <CODE>int</CODE>
+ */
public int literalIndexForJavaLangStringIntern() {
int index;
int nameAndTypeIndex;
@@ -2515,6 +3001,76 @@ public int literalIndexForJavaLangStringIntern() {
}
/**
* This method returns the index into the constantPool corresponding to the
+ * method descriptor. It is an interface method reference constant
+ *
+ * @return <CODE>int</CODE>
+ */
+public int literalIndexForJavaUtilIteratorHasNext() {
+ int index;
+ int nameAndTypeIndex;
+ int classIndex;
+ // Looking into the method ref table
+ if ((index = wellKnownMethods[ITERATOR_HASNEXT_METHOD]) == 0) {
+ classIndex = literalIndexForJavaUtilIterator();
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[HASNEXT_METHOD_NAME_AND_TYPE]) == 0) {
+ int nameIndex = literalIndex(QualifiedNamesConstants.HasNext);
+ int typeIndex = literalIndex(QualifiedNamesConstants.HasNextSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[HASNEXT_METHOD_NAME_AND_TYPE] = currentIndex++;
+ writeU1(NameAndTypeTag);
+ writeU2(nameIndex);
+ writeU2(typeIndex);
+ }
+ index = wellKnownMethods[ITERATOR_HASNEXT_METHOD] = currentIndex++;
+ if (index > 0xFFFF){
+ this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
+ }
+ // Write the method ref constant into the constant pool
+ // First add the tag
+ writeU1(InterfaceMethodRefTag);
+ // Then write the class index
+ writeU2(classIndex);
+ // The write the nameAndType index
+ writeU2(nameAndTypeIndex);
+ }
+ return index;
+}
+/**
+ * This method returns the index into the constantPool corresponding to the
+ * method descriptor. It is an interface method reference constant
+ *
+ * @return <CODE>int</CODE>
+ */
+public int literalIndexForJavaUtilIteratorNext() {
+ int index;
+ int nameAndTypeIndex;
+ int classIndex;
+ // Looking into the method ref table
+ if ((index = wellKnownMethods[ITERATOR_NEXT_METHOD]) == 0) {
+ classIndex = literalIndexForJavaUtilIterator();
+ if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[NEXT_METHOD_NAME_AND_TYPE]) == 0) {
+ int nameIndex = literalIndex(QualifiedNamesConstants.Next);
+ int typeIndex = literalIndex(QualifiedNamesConstants.NextSignature);
+ nameAndTypeIndex = wellKnownMethodNameAndTypes[NEXT_METHOD_NAME_AND_TYPE] = currentIndex++;
+ writeU1(NameAndTypeTag);
+ writeU2(nameIndex);
+ writeU2(typeIndex);
+ }
+ index = wellKnownMethods[ITERATOR_NEXT_METHOD] = currentIndex++;
+ if (index > 0xFFFF){
+ this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
+ }
+ // Write the method ref constant into the constant pool
+ // First add the tag
+ writeU1(InterfaceMethodRefTag);
+ // Then write the class index
+ writeU2(classIndex);
+ // The write the nameAndType index
+ writeU2(nameAndTypeIndex);
+ }
+ return index;
+}
+/**
+ * This method returns the index into the constantPool corresponding to the
* method descriptor. It can be either an interface method reference constant
* or a method reference constant.
*
@@ -2523,12 +3079,12 @@ public int literalIndexForJavaLangStringIntern() {
public int literalIndexForJavaLangStringValueOf(int typeID) {
int index = 0;
int nameAndTypeIndex = 0;
- int classIndex = literalIndexForJavaLangString();
switch (typeID) {
case T_int :
case T_byte :
case T_short :
- if ((index = wellKnownMethods[VALUEOF_INT_METHOD]) == 0) {
+ if ((index = wellKnownMethods[STRING_VALUEOF_INT_METHOD]) == 0) {
+ int classIndex = literalIndexForJavaLangString();
if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_INT_METHOD_NAME_AND_TYPE]) == 0) {
int nameIndex = literalIndex(QualifiedNamesConstants.ValueOf);
int typeIndex = literalIndex(QualifiedNamesConstants.ValueOfIntSignature);
@@ -2537,7 +3093,7 @@ public int literalIndexForJavaLangStringValueOf(int typeID) {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownMethods[VALUEOF_INT_METHOD] = currentIndex++;
+ index = wellKnownMethods[STRING_VALUEOF_INT_METHOD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -2551,7 +3107,8 @@ public int literalIndexForJavaLangStringValueOf(int typeID) {
}
break;
case T_long :
- if ((index = wellKnownMethods[VALUEOF_LONG_METHOD]) == 0) {
+ if ((index = wellKnownMethods[STRING_VALUEOF_LONG_METHOD]) == 0) {
+ int classIndex = literalIndexForJavaLangString();
if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_LONG_METHOD_NAME_AND_TYPE]) == 0) {
int nameIndex = literalIndex(QualifiedNamesConstants.ValueOf);
int typeIndex = literalIndex(QualifiedNamesConstants.ValueOfLongSignature);
@@ -2560,7 +3117,7 @@ public int literalIndexForJavaLangStringValueOf(int typeID) {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownMethods[VALUEOF_LONG_METHOD] = currentIndex++;
+ index = wellKnownMethods[STRING_VALUEOF_LONG_METHOD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -2574,7 +3131,8 @@ public int literalIndexForJavaLangStringValueOf(int typeID) {
}
break;
case T_float :
- if ((index = wellKnownMethods[VALUEOF_FLOAT_METHOD]) == 0) {
+ if ((index = wellKnownMethods[STRING_VALUEOF_FLOAT_METHOD]) == 0) {
+ int classIndex = literalIndexForJavaLangString();
if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_FLOAT_METHOD_NAME_AND_TYPE]) == 0) {
int nameIndex = literalIndex(QualifiedNamesConstants.ValueOf);
int typeIndex = literalIndex(QualifiedNamesConstants.ValueOfFloatSignature);
@@ -2583,7 +3141,7 @@ public int literalIndexForJavaLangStringValueOf(int typeID) {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownMethods[VALUEOF_FLOAT_METHOD] = currentIndex++;
+ index = wellKnownMethods[STRING_VALUEOF_FLOAT_METHOD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -2597,7 +3155,8 @@ public int literalIndexForJavaLangStringValueOf(int typeID) {
}
break;
case T_double :
- if ((index = wellKnownMethods[VALUEOF_DOUBLE_METHOD]) == 0) {
+ if ((index = wellKnownMethods[STRING_VALUEOF_DOUBLE_METHOD]) == 0) {
+ int classIndex = literalIndexForJavaLangString();
if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_DOUBLE_METHOD_NAME_AND_TYPE]) == 0) {
int nameIndex = literalIndex(QualifiedNamesConstants.ValueOf);
int typeIndex = literalIndex(QualifiedNamesConstants.ValueOfDoubleSignature);
@@ -2606,7 +3165,7 @@ public int literalIndexForJavaLangStringValueOf(int typeID) {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownMethods[VALUEOF_DOUBLE_METHOD] = currentIndex++;
+ index = wellKnownMethods[STRING_VALUEOF_DOUBLE_METHOD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -2620,7 +3179,8 @@ public int literalIndexForJavaLangStringValueOf(int typeID) {
}
break;
case T_char :
- if ((index = wellKnownMethods[VALUEOF_CHAR_METHOD]) == 0) {
+ if ((index = wellKnownMethods[STRING_VALUEOF_CHAR_METHOD]) == 0) {
+ int classIndex = literalIndexForJavaLangString();
if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_CHAR_METHOD_NAME_AND_TYPE]) == 0) {
int nameIndex = literalIndex(QualifiedNamesConstants.ValueOf);
int typeIndex = literalIndex(QualifiedNamesConstants.ValueOfCharSignature);
@@ -2629,7 +3189,7 @@ public int literalIndexForJavaLangStringValueOf(int typeID) {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownMethods[VALUEOF_CHAR_METHOD] = currentIndex++;
+ index = wellKnownMethods[STRING_VALUEOF_CHAR_METHOD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -2643,7 +3203,8 @@ public int literalIndexForJavaLangStringValueOf(int typeID) {
}
break;
case T_boolean :
- if ((index = wellKnownMethods[VALUEOF_BOOLEAN_METHOD]) == 0) {
+ if ((index = wellKnownMethods[STRING_VALUEOF_BOOLEAN_METHOD]) == 0) {
+ int classIndex = literalIndexForJavaLangString();
if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_BOOLEAN_METHOD_NAME_AND_TYPE]) == 0) {
int nameIndex = literalIndex(QualifiedNamesConstants.ValueOf);
int typeIndex = literalIndex(QualifiedNamesConstants.ValueOfBooleanSignature);
@@ -2652,7 +3213,7 @@ public int literalIndexForJavaLangStringValueOf(int typeID) {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownMethods[VALUEOF_BOOLEAN_METHOD] = currentIndex++;
+ index = wellKnownMethods[STRING_VALUEOF_BOOLEAN_METHOD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -2666,7 +3227,8 @@ public int literalIndexForJavaLangStringValueOf(int typeID) {
}
break;
case T_Object :
- if ((index = wellKnownMethods[VALUEOF_OBJECT_METHOD]) == 0) {
+ if ((index = wellKnownMethods[STRING_VALUEOF_OBJECT_METHOD]) == 0) {
+ int classIndex = literalIndexForJavaLangString();
if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[VALUEOF_OBJECT_METHOD_NAME_AND_TYPE]) == 0) {
int nameIndex = literalIndex(QualifiedNamesConstants.ValueOf);
int typeIndex = literalIndex(QualifiedNamesConstants.ValueOfObjectSignature);
@@ -2675,7 +3237,7 @@ public int literalIndexForJavaLangStringValueOf(int typeID) {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownMethods[VALUEOF_OBJECT_METHOD] = currentIndex++;
+ index = wellKnownMethods[STRING_VALUEOF_OBJECT_METHOD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -2749,37 +3311,6 @@ public int literalIndexForJavaLangSystemExitInt() {
return index;
}
/**
- * This method returns the index into the constantPool
- * corresponding to the field binding aFieldBinding.
- *
- * @return <CODE>int</CODE>
- */
-public int literalIndexForJavaLangSystemOut() {
- int index;
- if ((index = wellKnownFields[OUT_SYSTEM_FIELD]) == 0) {
- int nameAndTypeIndex;
- int classIndex;
- // The entry doesn't exit yet
- classIndex = literalIndexForJavaLangSystem();
- if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[OUT_SYSTEM_NAME_AND_TYPE]) == 0) {
- int nameIndex = literalIndex(QualifiedNamesConstants.Out);
- int typeIndex = literalIndex(QualifiedNamesConstants.JavaIoPrintStreamSignature);
- nameAndTypeIndex = wellKnownMethodNameAndTypes[OUT_SYSTEM_NAME_AND_TYPE] = currentIndex++;
- writeU1(NameAndTypeTag);
- writeU2(nameIndex);
- writeU2(typeIndex);
- }
- index = wellKnownFields[OUT_SYSTEM_FIELD] = currentIndex++;
- if (index > 0xFFFF){
- this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
- }
- writeU1(FieldRefTag);
- writeU2(classIndex);
- writeU2(nameAndTypeIndex);
- }
- return index;
-}
-/**
* This method returns the index into the constantPool corresponding to the type descriptor.
*
* @return <CODE>int</CODE>
@@ -2865,7 +3396,7 @@ public int literalIndexForJavaLangVoid() {
*/
public int literalIndexForJavaLangVoidTYPE() {
int index;
- if ((index = wellKnownFields[TYPE_VOID_FIELD]) == 0) {
+ if ((index = wellKnownFields[JAVA_LANG_VOID_TYPE_FIELD]) == 0) {
int nameAndTypeIndex;
int classIndex;
// The entry doesn't exit yet
@@ -2878,7 +3409,7 @@ public int literalIndexForJavaLangVoidTYPE() {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownFields[TYPE_VOID_FIELD] = currentIndex++;
+ index = wellKnownFields[JAVA_LANG_VOID_TYPE_FIELD] = currentIndex++;
if (index > 0xFFFF){
this.classFile.referenceBinding.scope.problemReporter().noMoreAvailableSpaceInConstantPool(this.classFile.referenceBinding.scope.referenceType());
}
@@ -3006,7 +3537,7 @@ public int literalIndexForJavaLangObjectGetClass() {
int nameAndTypeIndex;
int classIndex;
// Looking into the method ref table
- if ((index = wellKnownMethods[GETCLASS_OBJECT_METHOD]) == 0) {
+ if ((index = wellKnownMethods[OBJECT_GETCLASS_METHOD]) == 0) {
classIndex = literalIndexForJavaLangObject();
if ((nameAndTypeIndex = wellKnownMethodNameAndTypes[GETCLASS_OBJECT_METHOD_NAME_AND_TYPE]) == 0) {
int nameIndex = literalIndex(QualifiedNamesConstants.GetClass);
@@ -3016,7 +3547,7 @@ public int literalIndexForJavaLangObjectGetClass() {
writeU2(nameIndex);
writeU2(typeIndex);
}
- index = wellKnownMethods[GETCLASS_OBJECT_METHOD] = currentIndex++;
+ index = wellKnownMethods[OBJECT_GETCLASS_METHOD] = currentIndex++;
// Write the method ref constant into the constant pool
// First add the tag
writeU1(MethodRefTag);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/QualifiedNamesConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/QualifiedNamesConstants.java
index aff4cb89b6..29668674b0 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/QualifiedNamesConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/QualifiedNamesConstants.java
@@ -31,6 +31,8 @@ public interface QualifiedNamesConstants {
char[] JavaLangErrorConstantPoolName = "java/lang/Error".toCharArray(); //$NON-NLS-1$
char[] JavaLangExceptionConstantPoolName = "java/lang/Exception".toCharArray(); //$NON-NLS-1$
char[] JavaLangReflectConstructor = "java/lang/reflect/Constructor".toCharArray(); //$NON-NLS-1$
+ char[] JavaUtilIteratorConstantPoolName = "java/util/Iterator".toCharArray(); //$NON-NLS-1$
+ char[] JavaLangStringBuilderConstantPoolName = "java/lang/StringBuilder".toCharArray(); //$NON-NLS-1$
char[] Append = new char[] {'a', 'p', 'p', 'e', 'n', 'd'};
char[] ToString = new char[] {'t', 'o', 'S', 't', 'r', 'i', 'n', 'g'};
char[] Init = new char[] {'<', 'i', 'n', 'i', 't', '>'};
@@ -55,14 +57,22 @@ public interface QualifiedNamesConstants {
char[] ClinitSignature = DefaultConstructorSignature;
char[] ToStringSignature = GetMessageSignature;
char[] InternSignature = GetMessageSignature;
- char[] AppendIntSignature = "(I)Ljava/lang/StringBuffer;".toCharArray(); //$NON-NLS-1$
- char[] AppendLongSignature = "(J)Ljava/lang/StringBuffer;".toCharArray(); //$NON-NLS-1$
- char[] AppendFloatSignature = "(F)Ljava/lang/StringBuffer;".toCharArray(); //$NON-NLS-1$
- char[] AppendDoubleSignature = "(D)Ljava/lang/StringBuffer;".toCharArray(); //$NON-NLS-1$
- char[] AppendCharSignature = "(C)Ljava/lang/StringBuffer;".toCharArray(); //$NON-NLS-1$
- char[] AppendBooleanSignature = "(Z)Ljava/lang/StringBuffer;".toCharArray(); //$NON-NLS-1$
- char[] AppendObjectSignature = "(Ljava/lang/Object;)Ljava/lang/StringBuffer;".toCharArray(); //$NON-NLS-1$
- char[] AppendStringSignature = "(Ljava/lang/String;)Ljava/lang/StringBuffer;".toCharArray(); //$NON-NLS-1$
+ char[] StringBufferAppendIntSignature = "(I)Ljava/lang/StringBuffer;".toCharArray(); //$NON-NLS-1$
+ char[] StringBufferAppendLongSignature = "(J)Ljava/lang/StringBuffer;".toCharArray(); //$NON-NLS-1$
+ char[] StringBufferAppendFloatSignature = "(F)Ljava/lang/StringBuffer;".toCharArray(); //$NON-NLS-1$
+ char[] StringBufferAppendDoubleSignature = "(D)Ljava/lang/StringBuffer;".toCharArray(); //$NON-NLS-1$
+ char[] StringBufferAppendCharSignature = "(C)Ljava/lang/StringBuffer;".toCharArray(); //$NON-NLS-1$
+ char[] StringBufferAppendBooleanSignature = "(Z)Ljava/lang/StringBuffer;".toCharArray(); //$NON-NLS-1$
+ char[] StringBufferAppendObjectSignature = "(Ljava/lang/Object;)Ljava/lang/StringBuffer;".toCharArray(); //$NON-NLS-1$
+ char[] StringBufferAppendStringSignature = "(Ljava/lang/String;)Ljava/lang/StringBuffer;".toCharArray(); //$NON-NLS-1$
+ char[] StringBuilderAppendIntSignature = "(I)Ljava/lang/StringBuilder;".toCharArray(); //$NON-NLS-1$
+ char[] StringBuilderAppendLongSignature = "(J)Ljava/lang/StringBuilder;".toCharArray(); //$NON-NLS-1$
+ char[] StringBuilderAppendFloatSignature = "(F)Ljava/lang/StringBuilder;".toCharArray(); //$NON-NLS-1$
+ char[] StringBuilderAppendDoubleSignature = "(D)Ljava/lang/StringBuilder;".toCharArray(); //$NON-NLS-1$
+ char[] StringBuilderAppendCharSignature = "(C)Ljava/lang/StringBuilder;".toCharArray(); //$NON-NLS-1$
+ char[] StringBuilderAppendBooleanSignature = "(Z)Ljava/lang/StringBuilder;".toCharArray(); //$NON-NLS-1$
+ char[] StringBuilderAppendObjectSignature = "(Ljava/lang/Object;)Ljava/lang/StringBuilder;".toCharArray(); //$NON-NLS-1$
+ char[] StringBuilderAppendStringSignature = "(Ljava/lang/String;)Ljava/lang/StringBuilder;".toCharArray(); //$NON-NLS-1$
char[] ValueOfObjectSignature = "(Ljava/lang/Object;)Ljava/lang/String;".toCharArray(); //$NON-NLS-1$
char[] ValueOfIntSignature = "(I)Ljava/lang/String;".toCharArray(); //$NON-NLS-1$
char[] ValueOfLongSignature = "(J)Ljava/lang/String;".toCharArray(); //$NON-NLS-1$
@@ -90,4 +100,8 @@ public interface QualifiedNamesConstants {
char[] GetClassSignature = "()Ljava/lang/Class;".toCharArray(); //$NON-NLS-1$
char[] GetComponentType = "getComponentType".toCharArray(); //$NON-NLS-1$
char[] GetComponentTypeSignature = GetClassSignature;
+ char[] HasNext = "hasNext".toCharArray();//$NON-NLS-1$
+ char[] HasNextSignature = "()Z".toCharArray();//$NON-NLS-1$
+ char[] Next = "next".toCharArray();//$NON-NLS-1$
+ char[] NextSignature = "()Ljava/lang/Object;".toCharArray();//$NON-NLS-1$
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryField.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryField.java
index d928f82896..15a96c9f7f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryField.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryField.java
@@ -30,4 +30,10 @@ Constant getConstant();
*/
char[] getTypeName();
+
+/**
+ * Answer the receiver's signature which describes the parameter &
+ * return types as specified in section 4.4.4 of the Java 2 VM spec.
+ */
+char[] getGenericSignature();
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryMethod.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryMethod.java
index 75435bc220..88d605ef42 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryMethod.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryMethod.java
@@ -29,7 +29,7 @@ char[][] getExceptionTypeNames();
/**
* Answer the receiver's method descriptor which describes the parameter &
- * return types as specified in section 4.3.3 of the Java 2 VM spec.
+ * return types as specified in section 4.4.3 of the Java 2 VM spec.
*
* For example:
* - int foo(String) is (Ljava/lang/String;)I
@@ -38,6 +38,12 @@ char[][] getExceptionTypeNames();
char[] getMethodDescriptor();
/**
+ * Answer the receiver's signature which describes the parameter &
+ * return types as specified in section 4.4.4 of the Java 2 VM spec.
+ */
+char[] getGenericSignature();
+
+/**
* Answer whether the receiver represents a class initializer method.
*/
boolean isClinit();
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryType.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryType.java
index aacda7313c..ed2bfe20fd 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryType.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryType.java
@@ -65,6 +65,16 @@ IBinaryMethod[] getMethods();
*/
char[] getName();
+
+/**
+ * Answer the receiver's signature which describes the parameter &
+ * return types as specified in section 4.4.4 of the Java 2 VM spec.
+ * Returns null if none.
+ *
+ * @return the receiver's signature, null if none
+ */
+char[] getGenericSignature();
+
/**
* Answer the resolved name of the receiver's superclass in the
* class file format as specified in section 4.2 of the Java 2 VM spec
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IConstants.java
index 4f3bfa15a6..1540190ffa 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IConstants.java
@@ -9,38 +9,37 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.env;
-
/**
- * This interface defines constants for use by the builder / compiler interface.
+ * This interface defines constants for use by the builder / compiler
+ * interface.
*/
public interface IConstants {
-
int AccDefault = 0;
-
- /**
+ /*
* Modifiers
*/
- int AccPublic = 0x0001;
- int AccPrivate = 0x0002;
- int AccProtected = 0x0004;
- int AccStatic = 0x0008;
- int AccFinal = 0x0010;
+ int AccPublic = 0x0001;
+ int AccPrivate = 0x0002;
+ int AccProtected = 0x0004;
+ int AccStatic = 0x0008;
+ int AccFinal = 0x0010;
int AccSynchronized = 0x0020;
- int AccVolatile = 0x0040;
- int AccBridge = 0x0040;
- int AccTransient = 0x0080;
- int AccVarargs = 0x0080;
- int AccNative = 0x0100;
- int AccInterface = 0x0200;
- int AccAbstract = 0x0400;
- int AccStrictfp = 0x0800;
- int AccSynthetic = 0x1000;
+ int AccVolatile = 0x0040;
+ int AccBridge = 0x0040;
+ int AccTransient = 0x0080;
+ int AccVarargs = 0x0080;
+ int AccNative = 0x0100;
+ int AccInterface = 0x0200;
+ int AccAbstract = 0x0400;
+ int AccStrictfp = 0x0800;
+ int AccSynthetic = 0x1000;
+ int AccAnnotation = 0x2000;
+ int AccEnum = 0x4000;
/**
* Other VM flags.
*/
int AccSuper = 0x0020;
-
/**
* Extra flags for types and members attributes.
*/
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceMethod.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceMethod.java
index fc08366cf6..8eba3ab9a1 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceMethod.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceMethod.java
@@ -59,4 +59,14 @@ int getNameSourceStart();
*/
char[] getReturnTypeName();
+/**
+ * Answer the names of the receiver's type parameters
+ * or null if the array is empty.
+ */
+char[][] getTypeParameterNames();
+/**
+ * Answer the array of bound names of the receiver's type parameters
+ * or null if the array is empty.
+ */
+char[][][] getTypeParameterBounds();
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceType.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceType.java
index 594d71825e..19c50ea630 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceType.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceType.java
@@ -98,4 +98,14 @@ char[] getPackageName();
* For example, Hashtable or java.util.Hashtable.
*/
char[] getSuperclassName();
+/**
+ * Answer the names of the receiver's type parameters
+ * or null if the array is empty.
+ */
+char[][] getTypeParameterNames();
+/**
+ * Answer the array of bound names of the receiver's type parameters
+ * or null if the array is empty.
+ */
+char[][][] getTypeParameterBounds();
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
index 0d729a4344..fe25366a46 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
@@ -74,6 +74,8 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, Class
public static final String OPTION_ReportUnusedDeclaredThrownException = "org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException"; //$NON-NLS-1$
public static final String OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding = "org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding"; //$NON-NLS-1$
public static final String OPTION_ReportUnqualifiedFieldAccess = "org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess"; //$NON-NLS-1$
+ public static final String OPTION_ReportUnsafeTypeOperation = "org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation"; //$NON-NLS-1$
+ public static final String OPTION_ReportFinalParameterBound = "org.eclipse.jdt.core.compiler.problem.finalParameterBound"; //$NON-NLS-1$
public static final String OPTION_Source = "org.eclipse.jdt.core.compiler.source"; //$NON-NLS-1$
public static final String OPTION_TargetPlatform = "org.eclipse.jdt.core.compiler.codegen.targetPlatform"; //$NON-NLS-1$
public static final String OPTION_Compliance = "org.eclipse.jdt.core.compiler.compliance"; //$NON-NLS-1$
@@ -147,6 +149,9 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, Class
public static final long UndocumentedEmptyBlock = ASTNode.Bit28;
public static final long IndirectStaticAccess = ASTNode.Bit29;
public static final long UnnecessaryElse = ASTNode.Bit30;
+ /* 1.5 below */
+ public static final long UnsafeTypeOperation = ASTNode.Bit31;
+ public static final long FinalParameterBound = ASTNode.Bit32L;
// Default severity level for handlers
public long errorThreshold = 0;
@@ -162,7 +167,8 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, Class
| IncompatibleNonInheritedInterfaceMethod
| NoImplicitStringConversion
| FinallyBlockNotCompleting
- | AssertUsedAsAnIdentifier;
+ | AssertUsedAsAnIdentifier
+ | UnsafeTypeOperation;
// Debug attributes
public static final int Source = 1; // SourceFileAttribute
@@ -297,6 +303,8 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, Class
optionsMap.put(OPTION_ReportUnusedDeclaredThrownException, getSeverityString(UnusedDeclaredThrownException));
optionsMap.put(OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding, this.reportUnusedDeclaredThrownExceptionWhenOverriding ? ENABLED : DISABLED);
optionsMap.put(OPTION_ReportUnqualifiedFieldAccess, getSeverityString(UnqualifiedFieldAccess));
+ optionsMap.put(OPTION_ReportUnsafeTypeOperation, getSeverityString(UnsafeTypeOperation));
+ optionsMap.put(OPTION_ReportFinalParameterBound, getSeverityString(FinalParameterBound));
optionsMap.put(OPTION_Compliance, versionFromJdkLevel(this.complianceLevel));
optionsMap.put(OPTION_Source, versionFromJdkLevel(this.sourceLevel));
optionsMap.put(OPTION_TargetPlatform, versionFromJdkLevel(this.targetJDK));
@@ -406,6 +414,7 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, Class
if ((optionValue = optionsMap.get(OPTION_TargetPlatform)) != null) {
long level = versionToJdkLevel(optionValue);
if (level != 0) this.targetJDK = level;
+ if (this.targetJDK >= JDK1_5) this.inlineJsrBytecode = true; // forced in 1.5 mode
}
if ((optionValue = optionsMap.get(OPTION_Encoding)) != null) {
if (optionValue instanceof String) {
@@ -485,10 +494,12 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, Class
}
}
if ((optionValue = optionsMap.get(OPTION_InlineJsr)) != null) {
- if (ENABLED.equals(optionValue)) {
- this.inlineJsrBytecode = true;
- } else if (DISABLED.equals(optionValue)) {
- this.inlineJsrBytecode = false;
+ if (this.targetJDK < JDK1_5) { // only optional if target < 1.5 (inlining on from 1.5 on)
+ if (ENABLED.equals(optionValue)) {
+ this.inlineJsrBytecode = true;
+ } else if (DISABLED.equals(optionValue)) {
+ this.inlineJsrBytecode = false;
+ }
}
}
if ((optionValue = optionsMap.get(OPTION_ReportMethodWithConstructorName)) != null) updateSeverity(MethodWithConstructorName, optionValue);
@@ -513,10 +524,12 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, Class
if ((optionValue = optionsMap.get(OPTION_ReportIncompatibleNonInheritedInterfaceMethod)) != null) updateSeverity(IncompatibleNonInheritedInterfaceMethod, optionValue);
if ((optionValue = optionsMap.get(OPTION_ReportUndocumentedEmptyBlock)) != null) updateSeverity(UndocumentedEmptyBlock, optionValue);
if ((optionValue = optionsMap.get(OPTION_ReportUnnecessaryTypeCheck)) != null) updateSeverity(UnnecessaryTypeCheck, optionValue);
+ if ((optionValue = optionsMap.get(OPTION_ReportUnnecessaryElse)) != null) updateSeverity(UnnecessaryElse, optionValue);
if ((optionValue = optionsMap.get(OPTION_ReportFinallyBlockNotCompletingNormally)) != null) updateSeverity(FinallyBlockNotCompleting, optionValue);
if ((optionValue = optionsMap.get(OPTION_ReportUnqualifiedFieldAccess)) != null) updateSeverity(UnqualifiedFieldAccess, optionValue);
if ((optionValue = optionsMap.get(OPTION_ReportNoEffectAssignment)) != null) updateSeverity(NoEffectAssignment, optionValue);
- if ((optionValue = optionsMap.get(OPTION_ReportUnnecessaryElse)) != null) updateSeverity(UnnecessaryElse, optionValue);
+ if ((optionValue = optionsMap.get(OPTION_ReportUnsafeTypeOperation)) != null) updateSeverity(UnsafeTypeOperation, optionValue);
+ if ((optionValue = optionsMap.get(OPTION_ReportFinalParameterBound)) != null) updateSeverity(FinalParameterBound, optionValue);
// Javadoc options
if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) {
@@ -648,6 +661,8 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, Class
buf.append("\n\t- report unused parameter when overriding concrete method : ").append(this.reportUnusedParameterWhenOverridingConcrete ? ENABLED : DISABLED); //$NON-NLS-1$
buf.append("\n\t- report constructor/setter parameter hiding existing field : ").append(this.reportSpecialParameterHidingField ? ENABLED : DISABLED); //$NON-NLS-1$
buf.append("\n\t- inline JSR bytecode : ").append(this.inlineJsrBytecode ? ENABLED : DISABLED); //$NON-NLS-1$
+ buf.append("\n\t- unsafe type operation: ").append(getSeverityString(UnsafeTypeOperation)); //$NON-NLS-1$
+ buf.append("\n\t- final bound for type parameter: ").append(getSeverityString(FinalParameterBound)); //$NON-NLS-1$
return buf.toString();
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java
index da456843bf..2818dcffb9 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
+import java.util.Map;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.impl.Constant;
@@ -20,19 +21,41 @@ public final class ArrayBinding extends TypeBinding {
public TypeBinding leafComponentType;
public int dimensions;
-
+ LookupEnvironment environment;
char[] constantPoolName;
-public ArrayBinding(TypeBinding type, int dimensions) {
+
+public ArrayBinding(TypeBinding type, int dimensions, LookupEnvironment environment) {
this.tagBits |= IsArrayType;
this.leafComponentType = type;
this.dimensions = dimensions;
+ this.environment = environment;
+ if (type instanceof UnresolvedReferenceBinding)
+ ((UnresolvedReferenceBinding) type).addWrapper(this);
+ else
+ this.tagBits |= type.tagBits & (HasTypeVariable | HasWildcard);
+}
+
+/**
+ * Collect the substitutes into a map for certain type variables inside the receiver type
+ * e.g. Collection<T>.findSubstitute(T, Collection<List<X>>): T --> List<X>
+ */
+public void collectSubstitutes(TypeBinding otherType, Map substitutes) {
+ if (otherType.isArrayType()) {
+ int otherDim = otherType.dimensions();
+ if (otherDim == this.dimensions) {
+ this.leafComponentType.collectSubstitutes(otherType.leafComponentType(), substitutes);
+ } else if (otherDim > this.dimensions) {
+ ArrayBinding otherReducedType = this.environment.createArrayType(otherType.leafComponentType(), otherDim - this.dimensions);
+ this.leafComponentType.collectSubstitutes(otherReducedType, substitutes);
+ }
+ }
}
+
/**
* Answer the receiver's constant pool name.
* NOTE: This method should only be used during/after code gen.
* e.g. '[Ljava/lang/Object;'
*/
-
public char[] constantPoolName() {
if (constantPoolName != null)
return constantPoolName;
@@ -41,7 +64,7 @@ public char[] constantPoolName() {
for (int i = dimensions - 1; i >= 0; i--) brackets[i] = '[';
return constantPoolName = CharOperation.concat(brackets, leafComponentType.signature());
}
-String debugName() {
+public String debugName() {
StringBuffer brackets = new StringBuffer(dimensions * 2);
for (int i = dimensions; --i >= 0;)
brackets.append("[]"); //$NON-NLS-1$
@@ -56,16 +79,31 @@ public int dimensions() {
* When the receiver's dimension size is one then answer the leaf component type.
*/
-public TypeBinding elementsType(Scope scope) {
- if (dimensions == 1) return leafComponentType;
- return scope.createArray(leafComponentType, dimensions - 1);
+public TypeBinding elementsType() {
+ if (this.dimensions == 1) return this.leafComponentType;
+ return this.environment.createArrayType(this.leafComponentType, this.dimensions - 1);
}
+/**
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#erasure()
+ */
+public TypeBinding erasure() {
+ TypeBinding erasedType = this.leafComponentType.erasure();
+ if (this.leafComponentType != erasedType)
+ return this.environment.createArrayType(erasedType, this.dimensions);
+ return this;
+}
+public LookupEnvironment environment() {
+ return this.environment;
+}
+
public PackageBinding getPackage() {
return leafComponentType.getPackage();
}
+public int hashCode() {
+ return this.leafComponentType == null ? super.hashCode() : this.leafComponentType.hashCode();
+}
/* Answer true if the receiver type can be assigned to the argument type (right)
*/
-
public boolean isCompatibleWith(TypeBinding right) {
if (this == right)
return true;
@@ -81,6 +119,9 @@ public boolean isCompatibleWith(TypeBinding right) {
} else {
if (right.isBaseType())
return false;
+ if (right.isWildcard()) {
+ return ((WildcardBinding) right).boundCheck(this);
+ }
}
//Check dimensions - Java does not support explicitly sized dimensions for types.
//However, if it did, the type checking support would go here.
@@ -143,6 +184,12 @@ public char[] sourceName() {
}
return CharOperation.concat(leafComponentType.sourceName(), brackets);
}
+public void swapUnresolved(UnresolvedReferenceBinding unresolvedType, ReferenceBinding resolvedType, LookupEnvironment env) {
+ if (this.leafComponentType == unresolvedType) {
+ this.leafComponentType = resolvedType.isGenericType() ? env.createRawType(resolvedType, null) : resolvedType;
+ this.tagBits |= this.leafComponentType.tagBits & (HasTypeVariable | HasWildcard);
+ }
+}
public String toString() {
return leafComponentType != null ? debugName() : "NULL TYPE ARRAY"; //$NON-NLS-1$
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
index 6ada2f8d4c..2dff537f4c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
@@ -12,6 +12,7 @@ package org.eclipse.jdt.internal.compiler.lookup;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.env.IBinaryField;
import org.eclipse.jdt.internal.compiler.env.IBinaryMethod;
import org.eclipse.jdt.internal.compiler.env.IBinaryNestedType;
@@ -30,16 +31,41 @@ null is NOT a valid value for a non-public field... it just means the field is n
*/
public final class BinaryTypeBinding extends ReferenceBinding {
- // all of these fields are ONLY guaranteed to be initialized if accessed using their public accessor method
- private ReferenceBinding superclass;
- private ReferenceBinding enclosingType;
- private ReferenceBinding[] superInterfaces;
- private FieldBinding[] fields;
- private MethodBinding[] methods;
- private ReferenceBinding[] memberTypes;
-
- // For the link with the principle structure
- private LookupEnvironment environment;
+
+// all of these fields are ONLY guaranteed to be initialized if accessed using their public accessor method
+private ReferenceBinding superclass;
+private ReferenceBinding enclosingType;
+private ReferenceBinding[] superInterfaces;
+private FieldBinding[] fields;
+private MethodBinding[] methods;
+private ReferenceBinding[] memberTypes;
+protected TypeVariableBinding[] typeVariables;
+
+// For the link with the principle structure
+private LookupEnvironment environment;
+
+public static ReferenceBinding resolveType(ReferenceBinding type, LookupEnvironment environment, boolean convertGenericToRawType) {
+ if (type instanceof UnresolvedReferenceBinding)
+ return ((UnresolvedReferenceBinding) type).resolve(environment, convertGenericToRawType);
+ if (type.isParameterizedType())
+ return ((ParameterizedTypeBinding) type).resolve();
+ if (type.isWildcard())
+ return ((WildcardBinding) type).resolve();
+ return type;
+}
+public static TypeBinding resolveType(TypeBinding type, LookupEnvironment environment, ParameterizedTypeBinding parameterizedType, int rank) {
+ if (type instanceof UnresolvedReferenceBinding)
+ return ((UnresolvedReferenceBinding) type).resolve(environment, parameterizedType == null);
+ if (type.isParameterizedType())
+ return ((ParameterizedTypeBinding) type).resolve();
+ if (type.isWildcard())
+ return ((WildcardBinding) type).resolve();
+ if (type.isArrayType())
+ resolveType(((ArrayBinding) type).leafComponentType, environment, parameterizedType, rank);
+ return type;
+}
+
+
public BinaryTypeBinding(PackageBinding packageBinding, IBinaryType binaryType, LookupEnvironment environment) {
this.compoundName = CharOperation.splitOn('/', binaryType.getName());
computeId();
@@ -48,6 +74,7 @@ public BinaryTypeBinding(PackageBinding packageBinding, IBinaryType binaryType,
this.environment = environment;
this.fPackage = packageBinding;
this.fileName = binaryType.getFileName();
+ this.typeVariables = NoTypeVariables;
// source name must be one name without "$".
char[] possibleSourceName = this.compoundName[this.compoundName.length - 1];
@@ -114,22 +141,76 @@ void cachePartsFrom(IBinaryType binaryType, boolean needFieldsAndMethods) {
// and still want to use binaries passed that point (e.g. type hierarchy resolver, see bug 63748).
this.superInterfaces = NoSuperInterfaces;
- char[] superclassName = binaryType.getSuperclassName();
- if (superclassName != null)
- // attempt to find the superclass if it exists in the cache (otherwise - resolve it when requested)
- this.superclass = environment.getTypeFromConstantPoolName(superclassName, 0, -1);
-
+ // need enclosing type to access type variables
char[] enclosingTypeName = binaryType.getEnclosingTypeName();
if (enclosingTypeName != null) {
// attempt to find the enclosing type if it exists in the cache (otherwise - resolve it when requested)
- this.enclosingType = environment.getTypeFromConstantPoolName(enclosingTypeName, 0, -1);
+ this.enclosingType = environment.getTypeFromConstantPoolName(enclosingTypeName, 0, -1, true); // pretend parameterized to avoid raw
this.tagBits |= MemberTypeMask; // must be a member type not a top-level or local type
+ this.tagBits |= HasUnresolvedEnclosingType;
if (this.enclosingType().isStrictfp())
this.modifiers |= AccStrictfp;
if (this.enclosingType().isDeprecated())
this.modifiers |= AccDeprecatedImplicitly;
}
+ boolean checkGenericSignatures = environment.options.sourceLevel >= ClassFileConstants.JDK1_5;
+ char[] typeSignature = checkGenericSignatures ? binaryType.getGenericSignature() : null;
+ if (typeSignature == null) {
+ char[] superclassName = binaryType.getSuperclassName();
+ if (superclassName != null) {
+ // attempt to find the superclass if it exists in the cache (otherwise - resolve it when requested)
+ this.superclass = environment.getTypeFromConstantPoolName(superclassName, 0, -1, false);
+ this.tagBits |= HasUnresolvedSuperclass;
+ }
+
+ this.superInterfaces = NoSuperInterfaces;
+ char[][] interfaceNames = binaryType.getInterfaceNames();
+ if (interfaceNames != null) {
+ int size = interfaceNames.length;
+ if (size > 0) {
+ this.superInterfaces = new ReferenceBinding[size];
+ for (int i = 0; i < size; i++)
+ // attempt to find each superinterface if it exists in the cache (otherwise - resolve it when requested)
+ this.superInterfaces[i] = environment.getTypeFromConstantPoolName(interfaceNames[i], 0, -1, false);
+ this.tagBits |= HasUnresolvedSuperinterfaces;
+ }
+ }
+ } else {
+ // ClassSignature = ParameterPart(optional) super_TypeSignature interface_signature
+ SignatureWrapper wrapper = new SignatureWrapper(typeSignature);
+ if (wrapper.signature[wrapper.start] == '<') {
+ // ParameterPart = '<' ParameterSignature(s) '>'
+ wrapper.start++; // skip '<'
+ int rank = 0;
+ do {
+ TypeVariableBinding variable = createTypeVariable(wrapper, rank);
+ variable.fPackage = this.fPackage;
+ System.arraycopy(this.typeVariables, 0, this.typeVariables = new TypeVariableBinding[rank + 1], 0, rank);
+ this.typeVariables[rank++] = variable;
+ } while (wrapper.signature[wrapper.start] != '>');
+ wrapper.start++; // skip '>'
+ this.tagBits |= HasUnresolvedTypeVariables;
+ this.modifiers |= AccGenericSignature;
+ }
+
+ // attempt to find the superclass if it exists in the cache (otherwise - resolve it when requested)
+ this.superclass = (ReferenceBinding) environment.getTypeFromTypeSignature(wrapper, NoTypeVariables, this);
+ this.tagBits |= HasUnresolvedSuperclass;
+
+ this.superInterfaces = NoSuperInterfaces;
+ if (!wrapper.atEnd()) {
+ // attempt to find each superinterface if it exists in the cache (otherwise - resolve it when requested)
+ java.util.ArrayList types = new java.util.ArrayList(2);
+ do {
+ types.add(environment.getTypeFromTypeSignature(wrapper, NoTypeVariables, this));
+ } while (!wrapper.atEnd());
+ this.superInterfaces = new ReferenceBinding[types.size()];
+ types.toArray(this.superInterfaces);
+ this.tagBits |= HasUnresolvedSuperinterfaces;
+ }
+ }
+
this.memberTypes = NoMemberTypes;
IBinaryNestedType[] memberTypeStructures = binaryType.getMemberTypes();
if (memberTypeStructures != null) {
@@ -138,29 +219,20 @@ void cachePartsFrom(IBinaryType binaryType, boolean needFieldsAndMethods) {
this.memberTypes = new ReferenceBinding[size];
for (int i = 0; i < size; i++)
// attempt to find each member type if it exists in the cache (otherwise - resolve it when requested)
- this.memberTypes[i] = environment.getTypeFromConstantPoolName(memberTypeStructures[i].getName(), 0, -1);
+ this.memberTypes[i] = environment.getTypeFromConstantPoolName(memberTypeStructures[i].getName(), 0, -1, false);
+ this.tagBits |= HasUnresolvedMemberTypes;
}
}
- char[][] interfaceNames = binaryType.getInterfaceNames();
- if (interfaceNames != null) {
- int size = interfaceNames.length;
- if (size > 0) {
- this.superInterfaces = new ReferenceBinding[size];
- for (int i = 0; i < size; i++)
- // attempt to find each superinterface if it exists in the cache (otherwise - resolve it when requested)
- this.superInterfaces[i] = environment.getTypeFromConstantPoolName(interfaceNames[i], 0, -1);
- }
- }
if (needFieldsAndMethods) {
- createFields(binaryType.getFields());
- createMethods(binaryType.getMethods());
+ createFields(binaryType.getFields(), checkGenericSignatures);
+ createMethods(binaryType.getMethods(), checkGenericSignatures);
} else { // protect against incorrect use of the needFieldsAndMethods flag, see 48459
this.fields = NoFields;
this.methods = NoMethods;
}
}
-private void createFields(IBinaryField[] iFields) {
+private void createFields(IBinaryField[] iFields, boolean checkGenericSignatures) {
this.fields = NoFields;
if (iFields != null) {
int size = iFields.length;
@@ -168,10 +240,14 @@ private void createFields(IBinaryField[] iFields) {
this.fields = new FieldBinding[size];
for (int i = 0; i < size; i++) {
IBinaryField field = iFields[i];
+ char[] fieldSignature = checkGenericSignatures ? field.getGenericSignature() : null;
+ TypeBinding type = fieldSignature == null
+ ? environment.getTypeFromSignature(field.getTypeName(), 0, -1, false, this)
+ : environment.getTypeFromTypeSignature(new SignatureWrapper(fieldSignature), NoTypeVariables, this);
this.fields[i] =
new FieldBinding(
field.getName(),
- environment.getTypeFromSignature(field.getTypeName(), 0, -1),
+ type,
field.getModifiers() | AccUnresolved,
this,
field.getConstant());
@@ -179,68 +255,126 @@ private void createFields(IBinaryField[] iFields) {
}
}
}
-private MethodBinding createMethod(IBinaryMethod method) {
+private MethodBinding createMethod(IBinaryMethod method, boolean checkGenericSignatures) {
int methodModifiers = method.getModifiers() | AccUnresolved;
-
ReferenceBinding[] exceptions = NoExceptions;
- char[][] exceptionTypes = method.getExceptionTypeNames();
- if (exceptionTypes != null) {
- int size = exceptionTypes.length;
+ TypeBinding[] parameters = NoParameters;
+ TypeVariableBinding[] typeVars = NoTypeVariables;
+ TypeBinding returnType = null;
+
+ char[] methodSignature = checkGenericSignatures ? method.getGenericSignature() : null;
+ if (methodSignature == null) { // no generics
+ char[] methodDescriptor = method.getMethodDescriptor(); // of the form (I[Ljava/jang/String;)V
+ int numOfParams = 0;
+ char nextChar;
+ int index = 0; // first character is always '(' so skip it
+ while ((nextChar = methodDescriptor[++index]) != ')') {
+ if (nextChar != '[') {
+ numOfParams++;
+ if (nextChar == 'L')
+ while ((nextChar = methodDescriptor[++index]) != ';'){/*empty*/}
+ }
+ }
+
+ // Ignore synthetic argument for member types.
+ int startIndex = (method.isConstructor() && isMemberType() && !isStatic()) ? 1 : 0;
+ int size = numOfParams - startIndex;
if (size > 0) {
- exceptions = new ReferenceBinding[size];
- for (int i = 0; i < size; i++)
- exceptions[i] = environment.getTypeFromConstantPoolName(exceptionTypes[i], 0, -1);
+ parameters = new TypeBinding[size];
+ index = 1;
+ int end = 0; // first character is always '(' so skip it
+ for (int i = 0; i < numOfParams; i++) {
+ while ((nextChar = methodDescriptor[++end]) == '['){/*empty*/}
+ if (nextChar == 'L')
+ while ((nextChar = methodDescriptor[++end]) != ';'){/*empty*/}
+
+ if (i >= startIndex) // skip the synthetic arg if necessary
+ parameters[i - startIndex] = environment.getTypeFromSignature(methodDescriptor, index, end, false, this);
+ index = end + 1;
+ }
}
- }
- TypeBinding[] parameters = NoParameters;
- char[] methodSignature = method.getMethodDescriptor(); // of the form (I[Ljava/jang/String;)V
- int numOfParams = 0;
- char nextChar;
- int index = 0; // first character is always '(' so skip it
- while ((nextChar = methodSignature[++index]) != ')') {
- if (nextChar != '[') {
- numOfParams++;
- if (nextChar == 'L')
- while ((nextChar = methodSignature[++index]) != ';'){/*empty*/}
+ char[][] exceptionTypes = method.getExceptionTypeNames();
+ if (exceptionTypes != null) {
+ size = exceptionTypes.length;
+ if (size > 0) {
+ exceptions = new ReferenceBinding[size];
+ for (int i = 0; i < size; i++)
+ exceptions[i] = environment.getTypeFromConstantPoolName(exceptionTypes[i], 0, -1, false);
+ }
}
- }
- // Ignore synthetic argument for member types.
- int startIndex = (method.isConstructor() && isMemberType() && !isStatic()) ? 1 : 0;
- int size = numOfParams - startIndex;
- if (size > 0) {
- parameters = new TypeBinding[size];
- index = 1;
- int end = 0; // first character is always '(' so skip it
- for (int i = 0; i < numOfParams; i++) {
- while ((nextChar = methodSignature[++end]) == '['){/*empty*/}
- if (nextChar == 'L')
- while ((nextChar = methodSignature[++end]) != ';'){/*empty*/}
-
- if (i >= startIndex) // skip the synthetic arg if necessary
- parameters[i - startIndex] = environment.getTypeFromSignature(methodSignature, index, end);
- index = end + 1;
+ if (!method.isConstructor())
+ returnType = environment.getTypeFromSignature(methodDescriptor, index + 1, -1, false, this); // index is currently pointing at the ')'
+ } else {
+ // MethodTypeSignature = ParameterPart(optional) '(' TypeSignatures ')' return_typeSignature ['^' TypeSignature (optional)]
+ SignatureWrapper wrapper = new SignatureWrapper(methodSignature);
+ if (wrapper.signature[wrapper.start] == '<') {
+ // <A::Ljava/lang/annotation/Annotation;>(Ljava/lang/Class<TA;>;)TA;
+ // ParameterPart = '<' ParameterSignature(s) '>'
+ wrapper.start++; // skip '<'
+ int rank = 0;
+ do {
+ TypeVariableBinding variable = createTypeVariable(wrapper, rank);
+ System.arraycopy(typeVars, 0, typeVars = new TypeVariableBinding[rank + 1], 0, rank);
+ typeVars[rank++] = variable;
+ } while (wrapper.signature[wrapper.start] != '>');
+ wrapper.start++; // skip '>'
+ }
+
+ if (wrapper.signature[wrapper.start] == '(') {
+ wrapper.start++; // skip '('
+ if (wrapper.signature[wrapper.start] == ')') {
+ wrapper.start++; // skip ')'
+ } else {
+ java.util.ArrayList types = new java.util.ArrayList(2);
+ int startIndex = (method.isConstructor() && isMemberType() && !isStatic()) ? 1 : 0;
+ if (startIndex == 1)
+ environment.getTypeFromTypeSignature(wrapper, typeVars, this); // skip synthetic argument
+ while (wrapper.signature[wrapper.start] != ')') {
+ types.add(environment.getTypeFromTypeSignature(wrapper, typeVars, this));
+ }
+ wrapper.start++; // skip ')'
+ parameters = new TypeBinding[types.size()];
+ types.toArray(parameters);
+ }
+ }
+
+ if (!method.isConstructor())
+ returnType = environment.getTypeFromTypeSignature(wrapper, typeVars, this);
+
+ if (!wrapper.atEnd() && wrapper.signature[wrapper.start] == '^') {
+ // attempt to find each superinterface if it exists in the cache (otherwise - resolve it when requested)
+ java.util.ArrayList types = new java.util.ArrayList(2);
+ do {
+ wrapper.start++; // skip '^'
+ types.add(environment.getTypeFromTypeSignature(wrapper, typeVars, this));
+ } while (!wrapper.atEnd() && wrapper.signature[wrapper.start] == '^');
+ exceptions = new ReferenceBinding[types.size()];
+ types.toArray(exceptions);
+ } else { // get the exceptions the old way
+ char[][] exceptionTypes = method.getExceptionTypeNames();
+ if (exceptionTypes != null) {
+ int size = exceptionTypes.length;
+ if (size > 0) {
+ exceptions = new ReferenceBinding[size];
+ for (int i = 0; i < size; i++)
+ exceptions[i] = environment.getTypeFromConstantPoolName(exceptionTypes[i], 0, -1, false);
+ }
+ }
}
}
- MethodBinding binding = null;
- if (method.isConstructor())
- binding = new MethodBinding(methodModifiers, parameters, exceptions, this);
- else
- binding = new MethodBinding(
- methodModifiers,
- method.getSelector(),
- environment.getTypeFromSignature(methodSignature, index + 1, -1), // index is currently pointing at the ')'
- parameters,
- exceptions,
- this);
- return binding;
+ MethodBinding result = method.isConstructor()
+ ? new MethodBinding(methodModifiers, parameters, exceptions, this)
+ : new MethodBinding(methodModifiers, method.getSelector(), returnType, parameters, exceptions, this);
+ result.typeVariables = typeVars;
+ return result;
}
/**
* Create method bindings for binary type, filtering out <clinit> and synthetics
*/
-private void createMethods(IBinaryMethod[] iMethods) {
+private void createMethods(IBinaryMethod[] iMethods, boolean checkGenericSignatures) {
int total = 0, initialTotal = 0, iClinit = -1;
int[] toSkip = null;
if (iMethods != null) {
@@ -270,25 +404,66 @@ private void createMethods(IBinaryMethod[] iMethods) {
this.methods = new MethodBinding[total];
if (total == initialTotal) {
for (int i = 0; i < initialTotal; i++)
- this.methods[i] = createMethod(iMethods[i]);
+ this.methods[i] = createMethod(iMethods[i], checkGenericSignatures);
} else {
for (int i = 0, index = 0; i < initialTotal; i++)
if (iClinit != i && (toSkip == null || toSkip[i] != -1))
- this.methods[index++] = createMethod(iMethods[i]);
+ this.methods[index++] = createMethod(iMethods[i], checkGenericSignatures);
}
modifiers |= AccUnresolved; // until methods() is sent
}
+private TypeVariableBinding createTypeVariable(SignatureWrapper wrapper, int rank) {
+ // ParameterSignature = Identifier ':' TypeSignature
+ // or Identifier ':' TypeSignature(optional) InterfaceBound(s)
+ // InterfaceBound = ':' TypeSignature
+ int colon = CharOperation.indexOf(':', wrapper.signature, wrapper.start);
+ char[] variableName = CharOperation.subarray(wrapper.signature, wrapper.start, colon);
+ wrapper.start = colon + 1; // skip name + ':'
+ ReferenceBinding type, firstBound = null;
+ if (wrapper.signature[wrapper.start] == ':') {
+ type = environment.getType(JAVA_LANG_OBJECT);
+ } else {
+ type = (ReferenceBinding) environment.getTypeFromTypeSignature(wrapper, NoTypeVariables, this);
+ firstBound = type;
+ }
+
+ // variable is visible to its bounds
+ TypeVariableBinding variable = new TypeVariableBinding(variableName, this, rank);
+ variable.modifiers |= AccUnresolved;
+ variable.superclass = type;
+
+ ReferenceBinding[] bounds = null;
+ if (wrapper.signature[wrapper.start] == ':') {
+ java.util.ArrayList types = new java.util.ArrayList(2);
+ do {
+ wrapper.start++; // skip ':'
+ types.add(environment.getTypeFromTypeSignature(wrapper, new TypeVariableBinding[] {variable}, this));
+ } while (wrapper.signature[wrapper.start] == ':');
+ bounds = new ReferenceBinding[types.size()];
+ types.toArray(bounds);
+ }
+
+ variable.superInterfaces = bounds == null ? NoSuperInterfaces : bounds;
+ if (firstBound == null) {
+ firstBound = variable.superInterfaces.length == 0 ? null : variable.superInterfaces[0];
+ variable.modifiers |= AccInterface;
+// variable.superclass = null;
+ }
+ variable.firstBound = firstBound;
+ return variable;
+}
/* Answer the receiver's enclosing type... null if the receiver is a top level type.
*
* NOTE: enclosingType of a binary type is resolved when needed
*/
public ReferenceBinding enclosingType() {
- if (enclosingType == null)
- return null;
- if (enclosingType instanceof UnresolvedReferenceBinding)
- enclosingType = ((UnresolvedReferenceBinding) enclosingType).resolve(environment);
- return enclosingType;
+ if ((this.tagBits & HasUnresolvedEnclosingType) == 0)
+ return this.enclosingType;
+
+ this.enclosingType = resolveType(this.enclosingType, this.environment, false); // no raw conversion for now
+ this.tagBits ^= HasUnresolvedEnclosingType;
+ return this.enclosingType;
}
// NOTE: the type of each field of a binary type is resolved when needed
@@ -368,7 +543,7 @@ public ReferenceBinding getMemberType(char[] typeName) {
int prefixLength = this.compoundName[this.compoundName.length - 1].length + 1; // enclosing$
if (name.length == (prefixLength + typeName.length)) // enclosing $ typeName
if (CharOperation.fragmentEquals(typeName, name, prefixLength, true)) // only check trailing portion
- return this.memberTypes[i] = ((UnresolvedReferenceBinding) memberType).resolve(environment);
+ return this.memberTypes[i] = resolveType(memberType, this.environment, false); // no raw conversion for now
} else if (CharOperation.equals(typeName, memberType.sourceName)) {
return memberType;
}
@@ -408,11 +583,38 @@ public boolean hasMemberTypes() {
}
// NOTE: member types of binary types are resolved when needed
+public TypeVariableBinding getTypeVariable(char[] variableName) {
+ TypeVariableBinding variable = super.getTypeVariable(variableName);
+ resolveTypesFor(variable);
+ return variable;
+}
+/**
+ * Returns true if a type is identical to another one,
+ * or for generic types, true if compared to its raw type.
+ */
+public boolean isEquivalentTo(TypeBinding otherType) {
+ if (this == otherType) return true;
+ if (otherType == null) return false;
+ if (otherType.isWildcard()) // wildcard
+ return ((WildcardBinding) otherType).boundCheck(this);
+ if (this.typeVariables == NoTypeVariables) return false;
+ if (otherType.isRawType())
+ return otherType.erasure() == this;
+ return false;
+}
+public boolean isGenericType() {
+ return this.typeVariables != NoTypeVariables;
+}
+// NOTE: member types of binary types are resolved when needed
+
public ReferenceBinding[] memberTypes() {
- for (int i = memberTypes.length; --i >= 0;)
- if (memberTypes[i] instanceof UnresolvedReferenceBinding)
- memberTypes[i] = ((UnresolvedReferenceBinding) memberTypes[i]).resolve(environment);
- return memberTypes;
+ if ((this.tagBits & HasUnresolvedMemberTypes) == 0)
+ return this.memberTypes;
+
+ for (int i = this.memberTypes.length; --i >= 0;)
+ this.memberTypes[i] = resolveType(this.memberTypes[i], this.environment, false); // no raw conversion for now
+ this.tagBits ^= HasUnresolvedMemberTypes;
+ return this.memberTypes;
}
// NOTE: the return type, arg & exception types of each method of a binary type are resolved when needed
@@ -425,21 +627,12 @@ public MethodBinding[] methods() {
modifiers ^= AccUnresolved;
return methods;
}
-TypeBinding resolveType(TypeBinding type) {
- if (type instanceof UnresolvedReferenceBinding)
- return ((UnresolvedReferenceBinding) type).resolve(environment);
- if (type instanceof ArrayBinding) {
- ArrayBinding array = (ArrayBinding) type;
- if (array.leafComponentType instanceof UnresolvedReferenceBinding)
- array.leafComponentType = ((UnresolvedReferenceBinding) array.leafComponentType).resolve(environment);
- }
- return type;
-}
private FieldBinding resolveTypeFor(FieldBinding field) {
- if ((field.modifiers & AccUnresolved) != 0) {
- field.type = resolveType(field.type);
- field.modifiers ^= AccUnresolved;
- }
+ if ((field.modifiers & AccUnresolved) == 0)
+ return field;
+
+ field.type = resolveType(field.type, this.environment, null, 0);
+ field.modifiers ^= AccUnresolved;
return field;
}
private MethodBinding resolveTypesFor(MethodBinding method) {
@@ -447,37 +640,61 @@ private MethodBinding resolveTypesFor(MethodBinding method) {
return method;
if (!method.isConstructor())
- method.returnType = resolveType(method.returnType);
+ method.returnType = resolveType(method.returnType, this.environment, null, 0);
for (int i = method.parameters.length; --i >= 0;)
- method.parameters[i] = resolveType(method.parameters[i]);
+ method.parameters[i] = resolveType(method.parameters[i], this.environment, null, 0);
for (int i = method.thrownExceptions.length; --i >= 0;)
- if (method.thrownExceptions[i] instanceof UnresolvedReferenceBinding)
- method.thrownExceptions[i] = ((UnresolvedReferenceBinding) method.thrownExceptions[i]).resolve(environment);
+ method.thrownExceptions[i] = resolveType(method.thrownExceptions[i], this.environment, true);
+ for (int i = method.typeVariables.length; --i >= 0;)
+ resolveTypesFor(method.typeVariables[i]);
method.modifiers ^= AccUnresolved;
return method;
}
+private TypeVariableBinding resolveTypesFor(TypeVariableBinding variable) {
+ if ((variable.modifiers & AccUnresolved) == 0)
+ return variable;
+
+ if (variable.superclass != null)
+ variable.superclass = resolveType(variable.superclass, this.environment, true);
+ if (variable.firstBound != null)
+ variable.firstBound = resolveType(variable.firstBound, this.environment, true);
+ ReferenceBinding[] interfaces = variable.superInterfaces;
+ for (int i = interfaces.length; --i >= 0;)
+ interfaces[i] = resolveType(interfaces[i], this.environment, true);
+ variable.modifiers ^= AccUnresolved;
+ return variable;
+}
/* Answer the receiver's superclass... null if the receiver is Object or an interface.
*
* NOTE: superclass of a binary type is resolved when needed
*/
public ReferenceBinding superclass() {
- if (superclass == null)
- return null;
- if (superclass instanceof UnresolvedReferenceBinding)
- superclass = ((UnresolvedReferenceBinding) superclass).resolve(environment);
- return superclass;
+ if ((this.tagBits & HasUnresolvedSuperclass) == 0)
+ return this.superclass;
+
+ this.superclass = resolveType(this.superclass, this.environment, true);
+ this.tagBits ^= HasUnresolvedSuperclass;
+ return this.superclass;
}
// NOTE: superInterfaces of binary types are resolved when needed
public ReferenceBinding[] superInterfaces() {
- for (int i = superInterfaces.length; --i >= 0;)
- if (superInterfaces[i] instanceof UnresolvedReferenceBinding)
- superInterfaces[i] = ((UnresolvedReferenceBinding) superInterfaces[i]).resolve(environment);
- return superInterfaces;
+ if ((this.tagBits & HasUnresolvedSuperinterfaces) == 0)
+ return this.superInterfaces;
+
+ for (int i = this.superInterfaces.length; --i >= 0;)
+ this.superInterfaces[i] = resolveType(this.superInterfaces[i], this.environment, true);
+ this.tagBits ^= HasUnresolvedSuperinterfaces;
+ return this.superInterfaces;
}
-MethodBinding[] unResolvedMethods() { // for the MethodVerifier so it doesn't resolve types
- return methods;
+public TypeVariableBinding[] typeVariables() {
+ if ((this.tagBits & HasUnresolvedTypeVariables) == 0)
+ return this.typeVariables;
+ for (int i = this.typeVariables.length; --i >= 0;)
+ resolveTypesFor(this.typeVariables[i]);
+ this.tagBits ^= HasUnresolvedTypeVariables;
+ return this.typeVariables;
}
public String toString() {
String s = ""; //$NON-NLS-1$
@@ -547,4 +764,7 @@ public String toString() {
s += "\n\n\n"; //$NON-NLS-1$
return s;
}
+MethodBinding[] unResolvedMethods() { // for the MethodVerifier so it doesn't resolve types
+ return methods;
+}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java
index d6225aa729..bec8fd0273 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java
@@ -29,7 +29,7 @@ public abstract class Binding implements BindingIds, CompilerModifiers, ProblemR
* Answer the problem id associated with the receiver.
* NoError if the receiver is a valid binding.
*/
-
+ // TODO (philippe) should rename into problemReason()
public int problemId() {
return NoError;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java
index f0f94517b7..7aec944b4f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java
@@ -319,7 +319,7 @@ public class BlockScope extends Scope {
*/
public final ReferenceBinding findLocalType(char[] name) {
- long compliance = environment().options.complianceLevel;
+ long compliance = environment().options.complianceLevel;
for (int i = 0, length = subscopeCount; i < length; i++) {
if (subscopes[i] instanceof ClassScope) {
LocalTypeBinding sourceType = (LocalTypeBinding)((ClassScope) subscopes[i]).referenceContext.binding;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
index 575119c453..4f1e1b2842 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
@@ -15,13 +15,16 @@ import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Clinit;
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
public class ClassScope extends Scope {
public TypeDeclaration referenceContext;
+ private TypeReference superTypeReference;
public ClassScope(Scope parent, TypeDeclaration context) {
super(CLASS_SCOPE, parent);
@@ -144,7 +147,8 @@ public class ClassScope extends Scope {
LocalTypeBinding localType = new LocalTypeBinding(this, enclosingType, this.switchCase());
referenceContext.binding = localType;
checkAndSetModifiers();
-
+ buildTypeVariables();
+
// Look at member types
ReferenceBinding[] memberTypeBindings = NoMemberTypes;
if (referenceContext.memberTypes != null) {
@@ -173,7 +177,6 @@ public class ClassScope extends Scope {
continue nextMember;
}
}
-
ClassScope memberScope = new ClassScope(this, referenceContext.memberTypes[i]);
LocalTypeBinding memberBinding = memberScope.buildLocalType(localType, packageBinding);
memberBinding.setAsMemberType();
@@ -196,6 +199,48 @@ public class ClassScope extends Scope {
referenceContext.binding.verifyMethods(environment().methodVerifier());
}
+ private void buildMemberTypes() {
+ SourceTypeBinding sourceType = referenceContext.binding;
+ ReferenceBinding[] memberTypeBindings = NoMemberTypes;
+ if (referenceContext.memberTypes != null) {
+ int length = referenceContext.memberTypes.length;
+ memberTypeBindings = new ReferenceBinding[length];
+ int count = 0;
+ nextMember : for (int i = 0; i < length; i++) {
+ TypeDeclaration memberContext = referenceContext.memberTypes[i];
+ if (memberContext.isInterface()
+ && sourceType.isNestedType()
+ && sourceType.isClass()
+ && !sourceType.isStatic()) {
+ problemReporter().nestedClassCannotDeclareInterface(memberContext);
+ continue nextMember;
+ }
+ ReferenceBinding type = sourceType;
+ // check that the member does not conflict with an enclosing type
+ do {
+ if (CharOperation.equals(type.sourceName, memberContext.name)) {
+ problemReporter().hidingEnclosingType(memberContext);
+ continue nextMember;
+ }
+ type = type.enclosingType();
+ } while (type != null);
+ // check that the member type does not conflict with another sibling member type
+ for (int j = 0; j < i; j++) {
+ if (CharOperation.equals(referenceContext.memberTypes[j].name, memberContext.name)) {
+ problemReporter().duplicateNestedType(memberContext);
+ continue nextMember;
+ }
+ }
+
+ ClassScope memberScope = new ClassScope(this, memberContext);
+ memberTypeBindings[count++] = memberScope.buildType(sourceType, sourceType.fPackage);
+ }
+ if (count != length)
+ System.arraycopy(memberTypeBindings, 0, memberTypeBindings = new ReferenceBinding[count], 0, count);
+ }
+ sourceType.memberTypes = memberTypeBindings;
+ }
+
private void buildMethods() {
if (referenceContext.methods == null) {
referenceContext.binding.methods = NoMethods;
@@ -229,6 +274,7 @@ public class ClassScope extends Scope {
referenceContext.binding.methods = methodBindings;
referenceContext.binding.modifiers |= AccUnresolved; // until methods() is sent
}
+
SourceTypeBinding buildType(SourceTypeBinding enclosingType, PackageBinding packageBinding) {
// provide the typeDeclaration with needed scopes
referenceContext.scope = this;
@@ -248,49 +294,31 @@ public class ClassScope extends Scope {
SourceTypeBinding sourceType = referenceContext.binding;
sourceType.fPackage.addType(sourceType);
checkAndSetModifiers();
-
- // Look at member types
- ReferenceBinding[] memberTypeBindings = NoMemberTypes;
- if (referenceContext.memberTypes != null) {
- int size = referenceContext.memberTypes.length;
- memberTypeBindings = new ReferenceBinding[size];
- int count = 0;
- nextMember : for (int i = 0; i < size; i++) {
- TypeDeclaration memberContext = referenceContext.memberTypes[i];
- if (memberContext.isInterface()
- && sourceType.isNestedType()
- && sourceType.isClass()
- && !sourceType.isStatic()) {
- problemReporter().nestedClassCannotDeclareInterface(memberContext);
- continue nextMember;
- }
- ReferenceBinding type = sourceType;
- // check that the member does not conflict with an enclosing type
- do {
- if (CharOperation.equals(type.sourceName, memberContext.name)) {
- problemReporter().hidingEnclosingType(memberContext);
- continue nextMember;
- }
- type = type.enclosingType();
- } while (type != null);
- // check that the member type does not conflict with another sibling member type
- for (int j = 0; j < i; j++) {
- if (CharOperation.equals(referenceContext.memberTypes[j].name, memberContext.name)) {
- problemReporter().duplicateNestedType(memberContext);
- continue nextMember;
- }
- }
-
- ClassScope memberScope = new ClassScope(this, memberContext);
- memberTypeBindings[count++] = memberScope.buildType(sourceType, packageBinding);
- }
- if (count != size)
- System.arraycopy(memberTypeBindings, 0, memberTypeBindings = new ReferenceBinding[count], 0, count);
- }
- sourceType.memberTypes = memberTypeBindings;
+ buildTypeVariables();
+ buildMemberTypes();
return sourceType;
}
+ private void buildTypeVariables() {
+
+ SourceTypeBinding sourceType = referenceContext.binding;
+ TypeParameter[] typeParameters = referenceContext.typeParameters;
+
+ // do not construct type variables if source < 1.5
+ if (typeParameters == null || environment().options.sourceLevel < ClassFileConstants.JDK1_5) {
+ sourceType.typeVariables = NoTypeVariables;
+ return;
+ }
+ sourceType.typeVariables = NoTypeVariables; // safety
+
+ if (sourceType.id == T_Object) { // handle the case of redefining java.lang.Object up front
+ problemReporter().objectCannotBeGeneric(referenceContext);
+ return;
+ }
+ sourceType.typeVariables = createTypeVariables(typeParameters, sourceType);
+ sourceType.modifiers |= AccGenericSignature;
+ }
+
private void checkAndSetModifiers() {
SourceTypeBinding sourceType = referenceContext.binding;
int modifiers = sourceType.modifiers;
@@ -499,7 +527,7 @@ public class ClassScope extends Scope {
}
fieldBinding.modifiers = modifiers;
}
-
+
private void checkForInheritedMemberTypes(SourceTypeBinding sourceType) {
// search up the hierarchy of the sourceType to see if any superType defines a member type
// when no member types are defined, tag the sourceType & each superType with the HasNoMemberTypes bit
@@ -604,15 +632,13 @@ public class ClassScope extends Scope {
sourceType.superclass = getJavaLangObject();
return !detectCycle(sourceType, sourceType.superclass, null);
}
- ReferenceBinding superclass = findSupertype(referenceContext.superclass);
- if (superclass != null) { // is null if a cycle was detected cycle
- referenceContext.superclass.resolvedType = superclass; // hold onto the problem type
- if (!superclass.isValidBinding()) {
- problemReporter().invalidSuperclass(sourceType, referenceContext.superclass, superclass);
- } else if (superclass.isInterface()) {
- problemReporter().superclassMustBeAClass(sourceType, referenceContext.superclass, superclass);
+ TypeReference superclassRef = referenceContext.superclass;
+ ReferenceBinding superclass = findSupertype(superclassRef);
+ if (superclass != null) { // is null if a cycle was detected cycle or a problem
+ if (superclass.isInterface()) {
+ problemReporter().superclassMustBeAClass(sourceType, superclassRef, superclass);
} else if (superclass.isFinal()) {
- problemReporter().classExtendFinalClass(sourceType, referenceContext.superclass, superclass);
+ problemReporter().classExtendFinalClass(sourceType, superclassRef, superclass);
} else {
// only want to reach here when no errors are reported
sourceType.superclass = superclass;
@@ -649,21 +675,14 @@ public class ClassScope extends Scope {
ReferenceBinding[] interfaceBindings = new ReferenceBinding[length];
int count = 0;
nextInterface : for (int i = 0; i < length; i++) {
- ReferenceBinding superInterface = findSupertype(referenceContext.superInterfaces[i]);
+ TypeReference superInterfaceRef = referenceContext.superInterfaces[i];
+ ReferenceBinding superInterface = findSupertype(superInterfaceRef);
if (superInterface == null) { // detected cycle
- noProblems = false;
- continue nextInterface;
- }
- referenceContext.superInterfaces[i].resolvedType = superInterface; // hold onto the problem type
- if (!superInterface.isValidBinding()) {
- problemReporter().invalidSuperinterface(
- sourceType,
- referenceContext.superInterfaces[i],
- superInterface);
sourceType.tagBits |= HierarchyHasProblems;
noProblems = false;
continue nextInterface;
}
+ superInterfaceRef.resolvedType = superInterface; // hold onto the problem type
// Check for a duplicate interface once the name is resolved, otherwise we may be confused (ie : a.b.I and c.d.I)
for (int k = 0; k < count; k++) {
if (interfaceBindings[k] == superInterface) {
@@ -678,6 +697,18 @@ public class ClassScope extends Scope {
noProblems = false;
continue nextInterface;
}
+ ReferenceBinding invalid = findAmbiguousInterface(superInterface, sourceType);
+ if (invalid != null) {
+ ReferenceBinding generic = null;
+ if (superInterface.isParameterizedType())
+ generic = ((ParameterizedTypeBinding) superInterface).type;
+ else if (invalid.isParameterizedType())
+ generic = ((ParameterizedTypeBinding) invalid).type;
+ problemReporter().superinterfacesCollide(generic, referenceContext, superInterface, invalid);
+ sourceType.tagBits |= HierarchyHasProblems;
+ noProblems = false;
+ continue nextInterface;
+ }
// only want to reach here when no errors are reported
interfaceBindings[count++] = superInterface;
@@ -694,10 +725,11 @@ public class ClassScope extends Scope {
void connectTypeHierarchy() {
SourceTypeBinding sourceType = referenceContext.binding;
if ((sourceType.tagBits & BeginHierarchyCheck) == 0) {
- boolean noProblems = true;
sourceType.tagBits |= BeginHierarchyCheck;
+ boolean noProblems = true;
if (sourceType.isClass())
noProblems &= connectSuperclass();
+ noProblems &= connectTypeVariables(referenceContext.typeParameters);
noProblems &= connectSuperInterfaces();
sourceType.tagBits |= EndHierarchyCheck;
if (noProblems && sourceType.isHierarchyInconsistent())
@@ -727,27 +759,50 @@ public class ClassScope extends Scope {
if ((sourceType.tagBits & BeginHierarchyCheck) != 0)
return;
- boolean noProblems = true;
sourceType.tagBits |= BeginHierarchyCheck;
+ boolean noProblems = true;
if (sourceType.isClass())
noProblems &= connectSuperclass();
+ noProblems &= connectTypeVariables(referenceContext.typeParameters);
noProblems &= connectSuperInterfaces();
sourceType.tagBits |= EndHierarchyCheck;
if (noProblems && sourceType.isHierarchyInconsistent())
problemReporter().hierarchyHasProblems(sourceType);
}
-
+
+ public boolean detectCycle(ReferenceBinding superType, TypeReference reference) {
+ if (reference == this.superTypeReference) // see findSuperType()
+ return detectCycle(referenceContext.binding, superType, reference);
+
+ if ((superType.tagBits & BeginHierarchyCheck) == 0 && superType instanceof SourceTypeBinding)
+ // ensure if this is a source superclass that it has already been checked
+ ((SourceTypeBinding) superType).scope.connectTypeHierarchyWithoutMembers();
+ return false;
+ }
+
// Answer whether a cycle was found between the sourceType & the superType
- private boolean detectCycle(
- SourceTypeBinding sourceType,
- ReferenceBinding superType,
- TypeReference reference) {
+ private boolean detectCycle(SourceTypeBinding sourceType, ReferenceBinding superType, TypeReference reference) {
+ if (superType.isRawType())
+ superType = ((RawTypeBinding) superType).type;
+
if (sourceType == superType) {
problemReporter().hierarchyCircularity(sourceType, superType, reference);
sourceType.tagBits |= HierarchyHasProblems;
return true;
}
+ if (superType.isMemberType()) {
+ ReferenceBinding current = superType.enclosingType();
+ do {
+ if (current.isHierarchyBeingConnected()) {
+ problemReporter().hierarchyCircularity(sourceType, current, reference);
+ sourceType.tagBits |= HierarchyHasProblems;
+ current.tagBits |= HierarchyHasProblems;
+ return true;
+ }
+ } while ((current = current.enclosingType()) != null);
+ }
+
if (superType.isBinaryBinding()) {
// force its superclass & superinterfaces to be found... 2 possibilities exist - the source type is included in the hierarchy of:
// - a binary type... this case MUST be caught & reported here
@@ -760,10 +815,13 @@ public class ClassScope extends Scope {
superType.tagBits |= HierarchyHasProblems;
return true;
}
- hasCycle |= detectCycle(sourceType, superType.superclass(), reference);
- if ((superType.superclass().tagBits & HierarchyHasProblems) != 0) {
+ ReferenceBinding parentType = superType.superclass();
+ if (parentType.isParameterizedType())
+ parentType = ((ParameterizedTypeBinding) parentType).type;
+ hasCycle |= detectCycle(sourceType, parentType, reference);
+ if ((parentType.tagBits & HierarchyHasProblems) != 0) {
sourceType.tagBits |= HierarchyHasProblems;
- superType.tagBits |= HierarchyHasProblems; // propagate down the hierarchy
+ parentType.tagBits |= HierarchyHasProblems; // propagate down the hierarchy
}
}
@@ -777,6 +835,8 @@ public class ClassScope extends Scope {
superType.tagBits |= HierarchyHasProblems;
return true;
}
+ if (anInterface.isParameterizedType())
+ anInterface = ((ParameterizedTypeBinding) anInterface).type;
hasCycle |= detectCycle(sourceType, anInterface, reference);
if ((anInterface.tagBits & HierarchyHasProblems) != 0) {
sourceType.tagBits |= HierarchyHasProblems;
@@ -787,8 +847,7 @@ public class ClassScope extends Scope {
return hasCycle;
}
- if ((superType.tagBits & EndHierarchyCheck) == 0
- && (superType.tagBits & BeginHierarchyCheck) != 0) {
+ if (superType.isHierarchyBeingConnected()) {
problemReporter().hierarchyCircularity(sourceType, superType, reference);
sourceType.tagBits |= HierarchyHasProblems;
superType.tagBits |= HierarchyHasProblems;
@@ -801,79 +860,63 @@ public class ClassScope extends Scope {
sourceType.tagBits |= HierarchyHasProblems;
return false;
}
-
+
+ private ReferenceBinding findAmbiguousInterface(ReferenceBinding newInterface, ReferenceBinding currentType) {
+ TypeBinding newErasure = newInterface.erasure();
+ if (newInterface == newErasure) return null;
+
+ ReferenceBinding[][] interfacesToVisit = new ReferenceBinding[5][];
+ int lastPosition = -1;
+ do {
+ ReferenceBinding[] itsInterfaces = currentType.superInterfaces();
+ if (itsInterfaces != NoSuperInterfaces) {
+ if (++lastPosition == interfacesToVisit.length)
+ System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[lastPosition * 2][], 0, lastPosition);
+ interfacesToVisit[lastPosition] = itsInterfaces;
+ }
+ } while ((currentType = currentType.superclass()) != null);
+
+ for (int i = 0; i <= lastPosition; i++) {
+ ReferenceBinding[] interfaces = interfacesToVisit[i];
+ for (int j = 0, length = interfaces.length; j < length; j++) {
+ currentType = interfaces[j];
+ if (currentType.erasure() == newErasure)
+ if (currentType != newInterface)
+ return currentType;
+
+ ReferenceBinding[] itsInterfaces = currentType.superInterfaces();
+ if (itsInterfaces != NoSuperInterfaces) {
+ if (++lastPosition == interfacesToVisit.length)
+ System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[lastPosition * 2][], 0, lastPosition);
+ interfacesToVisit[lastPosition] = itsInterfaces;
+ }
+ }
+ }
+ return null;
+ }
+
private ReferenceBinding findSupertype(TypeReference typeReference) {
try {
typeReference.aboutToResolve(this); // allows us to trap completion & selection nodes
- char[][] compoundName = typeReference.getTypeName();
- compilationUnitScope().recordQualifiedReference(compoundName);
- SourceTypeBinding sourceType = referenceContext.binding;
- int size = compoundName.length;
- int n = 1;
- ReferenceBinding superType;
-
- // resolve the first name of the compoundName
- if (CharOperation.equals(compoundName[0], sourceType.sourceName)) {
- superType = sourceType;
- // match against the sourceType even though nested members cannot be supertypes
- } else {
- Binding typeOrPackage = parent.getTypeOrPackage(compoundName[0], TYPE | PACKAGE);
- if (typeOrPackage == null || !typeOrPackage.isValidBinding())
- return new ProblemReferenceBinding(
- compoundName[0],
- typeOrPackage == null ? NotFound : typeOrPackage.problemId());
-
- boolean checkVisibility = false;
- for (; n < size; n++) {
- if (!(typeOrPackage instanceof PackageBinding))
- break;
- PackageBinding packageBinding = (PackageBinding) typeOrPackage;
- typeOrPackage = packageBinding.getTypeOrPackage(compoundName[n]);
- if (typeOrPackage == null || !typeOrPackage.isValidBinding())
- return new ProblemReferenceBinding(
- CharOperation.subarray(compoundName, 0, n + 1),
- typeOrPackage == null ? NotFound : typeOrPackage.problemId());
- checkVisibility = true;
- }
+ compilationUnitScope().recordQualifiedReference(typeReference.getTypeName());
+ this.superTypeReference = typeReference;
+ ReferenceBinding superType = (ReferenceBinding) typeReference.resolveSuperType(this);
+ this.superTypeReference = null;
+ if (superType == null) return null;
- // convert to a ReferenceBinding
- if (typeOrPackage instanceof PackageBinding) // error, the compoundName is a packageName
- return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, n), NotFound);
- superType = (ReferenceBinding) typeOrPackage;
- compilationUnitScope().recordTypeReference(superType); // to record supertypes
-
- if (checkVisibility
- && n == size) { // if we're finished and know the final supertype then check visibility
- if (!superType.canBeSeenBy(sourceType.fPackage))
- // its a toplevel type so just check package access
- return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, n), superType, NotVisible);
- }
- }
- // at this point we know we have a type but we have to look for cycles
- while (true) {
- // must detect cycles & force connection up the hierarchy... also handle cycles with binary types.
- // must be guaranteed that the superType knows its entire hierarchy
- if (detectCycle(sourceType, superType, typeReference))
- return null; // cycle error was already reported
-
- if (n >= size)
- break;
-
- // retrieve the next member type
- char[] typeName = compoundName[n++];
- superType = findMemberType(typeName, superType);
- if (superType == null)
- return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, n), NotFound);
- if (!superType.isValidBinding()) {
- superType.compoundName = CharOperation.subarray(compoundName, 0, n);
- return superType;
- }
- }
+ compilationUnitScope().recordTypeReference(superType); // to record supertypes
+ if (superType.isParameterizedType())
+ return superType; // already checked cycle before resolving its type variables
+
+ // must detect cycles & force connection up the hierarchy... also handle cycles with binary types.
+ // must be guaranteed that the superType knows its entire hierarchy
+ if (detectCycle(referenceContext.binding, superType, typeReference))
+ return null; // cycle error was already reported
return superType;
} catch (AbortCompilation e) {
e.updateContext(typeReference, referenceCompilationUnit().compilationResult);
throw e;
- }
+ }
}
/* Answer the problem reporter to use for raising new problems.
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
index d4a8d4f480..449e57a0c9 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
@@ -11,16 +11,10 @@
package org.eclipse.jdt.internal.compiler.lookup;
import org.eclipse.jdt.core.compiler.CharOperation;
-import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
-import org.eclipse.jdt.internal.compiler.ast.ImportReference;
-import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.*;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
-import org.eclipse.jdt.internal.compiler.util.CompoundNameVector;
-import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
-import org.eclipse.jdt.internal.compiler.util.HashtableOfType;
-import org.eclipse.jdt.internal.compiler.util.ObjectVector;
-import org.eclipse.jdt.internal.compiler.util.SimpleNameVector;
+import org.eclipse.jdt.internal.compiler.util.*;
public class CompilationUnitScope extends Scope {
@@ -505,6 +499,11 @@ void recordReference(char[][] qualifiedEnclosingName, char[] simpleName) {
recordQualifiedReference(qualifiedEnclosingName);
recordSimpleReference(simpleName);
}
+void recordReference(ReferenceBinding type, char[] simpleName) {
+ ReferenceBinding actualType = typeToRecord(type);
+ if (actualType != null)
+ recordReference(actualType.compoundName, simpleName);
+}
void recordSimpleReference(char[] simpleName) {
if (simpleNameReferences == null) return; // not recording dependencies
@@ -514,14 +513,9 @@ void recordSimpleReference(char[] simpleName) {
void recordTypeReference(TypeBinding type) {
if (referencedTypes == null) return; // not recording dependencies
- if (type.isArrayType())
- type = ((ArrayBinding) type).leafComponentType;
-
- if (type.isBaseType()) return;
- if (referencedTypes.containsIdentical(type)) return;
- if (((ReferenceBinding) type).isLocalType()) return;
-
- referencedTypes.add(type);
+ ReferenceBinding actualType = typeToRecord(type);
+ if (actualType != null && !referencedTypes.containsIdentical(actualType))
+ referencedTypes.add(actualType);
}
void recordTypeReferences(TypeBinding[] types) {
if (qualifiedReferences == null) return; // not recording dependencies
@@ -530,16 +524,11 @@ void recordTypeReferences(TypeBinding[] types) {
for (int i = 0, max = types.length; i < max; i++) {
// No need to record supertypes of method arguments & thrown exceptions, just the compoundName
// If a field/method is retrieved from such a type then a separate call does the job
- TypeBinding type = types[i];
- if (type.isArrayType())
- type = ((ArrayBinding) type).leafComponentType;
- if (!type.isBaseType()) {
- ReferenceBinding actualType = (ReferenceBinding) type;
- if (!actualType.isLocalType())
- recordQualifiedReference(actualType.isMemberType()
- ? CharOperation.splitOn('.', actualType.readableName())
- : actualType.compoundName);
- }
+ ReferenceBinding actualType = typeToRecord(types[i]);
+ if (actualType != null)
+ recordQualifiedReference(actualType.isMemberType()
+ ? CharOperation.splitOn('.', actualType.readableName())
+ : actualType.compoundName);
}
}
Binding resolveSingleTypeImport(ImportBinding importBinding) {
@@ -597,6 +586,23 @@ public void storeDependencyInfo() {
public String toString() {
return "--- CompilationUnit Scope : " + new String(referenceContext.getFileName()); //$NON-NLS-1$
}
+private ReferenceBinding typeToRecord(TypeBinding type) {
+ if (type.isArrayType())
+ type = ((ArrayBinding) type).leafComponentType;
+
+ if (type.isParameterizedType())
+ type = type.erasure();
+ else if (type.isRawType())
+ type = type.erasure();
+ else if (type.isWildcard())
+ return null;
+
+ if (type.isBaseType()) return null;
+ if (type.isTypeVariable()) return null;
+ if (((ReferenceBinding) type).isLocalType()) return null;
+
+ return (ReferenceBinding) type;
+}
public void verifyMethods(MethodVerifier verifier) {
for (int i = 0, length = topLevelTypes.length; i < length; i++)
topLevelTypes[i].verifyMethods(verifier);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilerModifiers.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilerModifiers.java
index 31f21cc868..5b0d922fde 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilerModifiers.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilerModifiers.java
@@ -10,30 +10,34 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
+import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
public interface CompilerModifiers extends ClassFileConstants { // modifier constant
// those constants are depending upon ClassFileConstants (relying that classfiles only use the 16 lower bits)
final int AccDefault = 0;
- final int AccJustFlag = 0xFFFF;
- final int AccCatchesExceptions = 0x10000; // bit17
- final int AccThrowsExceptions = 0x20000; // bit18 - also IConstants.AccSynthetic
- final int AccProblem = 0x40000; // bit19
- final int AccFromClassFile = 0x80000; // bit20
- final int AccIsConstantValue = 0x80000; // bit20
- final int AccDefaultAbstract = 0x80000; // bit20
+ final int AccJustFlag = // 16 lower bits
+ ASTNode.Bit1|ASTNode.Bit2|ASTNode.Bit3|ASTNode.Bit4|ASTNode.Bit5|ASTNode.Bit6|ASTNode.Bit7|ASTNode.Bit8|
+ ASTNode.Bit9|ASTNode.Bit10|ASTNode.Bit11|ASTNode.Bit12|ASTNode.Bit13|ASTNode.Bit14|ASTNode.Bit15|ASTNode.Bit16;
+ final int AccCatchesExceptions = ASTNode.Bit17;
+ final int AccThrowsExceptions = ASTNode.Bit18; // also IConstants.AccSynthetic
+ final int AccProblem = ASTNode.Bit19;
+ final int AccFromClassFile = ASTNode.Bit20;
+ final int AccIsConstantValue = ASTNode.Bit20;
+ final int AccDefaultAbstract = ASTNode.Bit20;
// bit21 - IConstants.AccDeprecated
- final int AccDeprecatedImplicitly = 0x200000; // bit22 to record whether deprecated itself or contained by a deprecated type
- final int AccAlternateModifierProblem = 0x400000; // bit23
- final int AccModifierProblem = 0x800000; // bit24
- final int AccSemicolonBody = 0x1000000; // bit25
- final int AccUnresolved = 0x2000000; // bit26
- final int AccClearPrivateModifier = 0x4000000; // bit27 might be requested during private access emulation
- final int AccBlankFinal = 0x4000000; // bit27 for blank final variables
- final int AccIsDefaultConstructor = 0x4000000; // bit27 for default constructor
- final int AccPrivateUsed = 0x8000000; // bit28 used to diagnose unused private members
+ final int AccDeprecatedImplicitly = ASTNode.Bit22; // record whether deprecated itself or contained by a deprecated type
+ final int AccAlternateModifierProblem = ASTNode.Bit23;
+ final int AccModifierProblem = ASTNode.Bit24;
+ final int AccSemicolonBody = ASTNode.Bit25;
+ final int AccUnresolved = ASTNode.Bit26;
+ final int AccClearPrivateModifier = ASTNode.Bit27; // might be requested during private access emulation
+ final int AccBlankFinal = ASTNode.Bit27; // for blank final variables
+ final int AccIsDefaultConstructor = ASTNode.Bit27; // for default constructor
+ final int AccPrivateUsed = ASTNode.Bit28; // used to diagnose unused private members
final int AccVisibilityMASK = AccPublic | AccProtected | AccPrivate;
- final int AccOverriding = 0x10000000; // bit29 to record fact a method overrides another one
- final int AccImplementing = 0x20000000; // bit30 to record fact a method implements another one (it is concrete and overrides an abstract one)
+ final int AccOverriding = ASTNode.Bit29; // record fact a method overrides another one
+ final int AccImplementing = ASTNode.Bit30; // record fact a method implements another one (it is concrete and overrides an abstract one)
+ final int AccGenericSignature = ASTNode.Bit31; // record fact a type/method/field involves generics in its signature (and need special signature attr)
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java
index 488909660e..ff48d517af 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java
@@ -136,6 +136,15 @@ public final boolean canBeSeenBy(TypeBinding receiverType, InvocationSite invoca
} while ((currentType = currentType.superclass()) != null);
return false;
}
+
+/**
+ * X<T> t --> LX<TT;>;
+ */
+public char[] genericSignature() {
+ if ((this.modifiers & AccGenericSignature) == 0) return null;
+ return this.type.genericTypeSignature();
+}
+
public final int getAccessFlags() {
return modifiers & AccJustFlag;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java
index e9703baa93..462f95eb7c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java
@@ -11,6 +11,8 @@
package org.eclipse.jdt.internal.compiler.lookup;
public interface InvocationSite {
+
+ TypeBinding[] genericTypeArguments();
boolean isSuperAccess();
boolean isTypeAccess();
void setDepth(int depth);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalTypeBinding.java
index cacc6052d8..541448ffeb 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalTypeBinding.java
@@ -13,7 +13,6 @@ package org.eclipse.jdt.internal.compiler.lookup;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ast.CaseStatement;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
-import org.eclipse.jdt.internal.compiler.util.Util;
public final class LocalTypeBinding extends NestedTypeBinding {
final static char[] LocalTypePrefix = { '$', 'L', 'o', 'c', 'a', 'l', '$' };
@@ -65,7 +64,7 @@ public char[] constantPoolName() /* java/lang/Object */ {
ArrayBinding createArrayType(int dimensionCount) {
if (localArrayBindings == null) {
- localArrayBindings = new ArrayBinding[] {new ArrayBinding(this, dimensionCount)};
+ localArrayBindings = new ArrayBinding[] {new ArrayBinding(this, dimensionCount, scope.environment())};
return localArrayBindings[0];
}
@@ -77,33 +76,63 @@ ArrayBinding createArrayType(int dimensionCount) {
// no matching array
System.arraycopy(localArrayBindings, 0, localArrayBindings = new ArrayBinding[length + 1], 0, length);
- return localArrayBindings[length] = new ArrayBinding(this, dimensionCount);
+ return localArrayBindings[length] = new ArrayBinding(this, dimensionCount, scope.environment());
}
-public char[] readableName() {
+public char[] readableName() /*java.lang.Object, p.X<T> */ {
+ char[] readableName;
if (isAnonymousType()) {
if (superInterfaces == NoSuperInterfaces)
- return ("<"+Util.bind("binding.subclass",new String(superclass.readableName())) + ">").toCharArray(); //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-1$
+ readableName = CharOperation.concat(TypeConstants.ANONYM_PREFIX, superclass.readableName(), TypeConstants.ANONYM_SUFFIX);
else
- return ("<"+Util.bind("binding.implementation",new String(superInterfaces[0].readableName())) + ">").toCharArray(); //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-1$
+ readableName = CharOperation.concat(TypeConstants.ANONYM_PREFIX, superInterfaces[0].readableName(), TypeConstants.ANONYM_SUFFIX);
} else if (isMemberType()) {
- return CharOperation.concat(enclosingType().readableName(), sourceName, '.');
+ readableName = CharOperation.concat(enclosingType().readableName(), this.sourceName, '.');
} else {
- return sourceName;
+ readableName = this.sourceName;
+ }
+ TypeVariableBinding[] typeVars;
+ if ((typeVars = this.typeVariables()) != NoTypeVariables) {
+ StringBuffer nameBuffer = new StringBuffer(10);
+ nameBuffer.append(readableName).append('<');
+ for (int i = 0, length = typeVars.length; i < length; i++) {
+ if (i > 0) nameBuffer.append(',');
+ nameBuffer.append(typeVars[i].readableName());
+ }
+ nameBuffer.append('>');
+ int nameLength = nameBuffer.length();
+ readableName = new char[nameLength];
+ nameBuffer.getChars(0, nameLength, readableName, 0);
}
+ return readableName;
}
-public char[] shortReadableName() {
+public char[] shortReadableName() /*Object*/ {
+ char[] shortReadableName;
if (isAnonymousType()) {
if (superInterfaces == NoSuperInterfaces)
- return ("<"+Util.bind("binding.subclass",new String(superclass.shortReadableName())) + ">").toCharArray(); //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-1$
+ shortReadableName = CharOperation.concat(TypeConstants.ANONYM_PREFIX, superclass.shortReadableName(), TypeConstants.ANONYM_SUFFIX);
else
- return ("<"+Util.bind("binding.implementation",new String(superInterfaces[0].shortReadableName())) + ">").toCharArray(); //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-1$
+ shortReadableName = CharOperation.concat(TypeConstants.ANONYM_PREFIX, superInterfaces[0].shortReadableName(), TypeConstants.ANONYM_SUFFIX);
} else if (isMemberType()) {
- return CharOperation.concat(enclosingType().shortReadableName(), sourceName, '.');
+ shortReadableName = CharOperation.concat(enclosingType().shortReadableName(), sourceName, '.');
} else {
- return sourceName;
+ shortReadableName = sourceName;
+ }
+ TypeVariableBinding[] typeVars;
+ if ((typeVars = this.typeVariables()) != NoTypeVariables) {
+ StringBuffer nameBuffer = new StringBuffer(10);
+ nameBuffer.append(shortReadableName).append('<');
+ for (int i = 0, length = typeVars.length; i < length; i++) {
+ if (i > 0) nameBuffer.append(',');
+ nameBuffer.append(typeVars[i].shortReadableName());
+ }
+ nameBuffer.append('>');
+ int nameLength = nameBuffer.length();
+ shortReadableName = new char[nameLength];
+ nameBuffer.getChars(0, nameLength, shortReadableName, 0);
}
+ return shortReadableName;
}
// Record that the type is a local member type
@@ -117,11 +146,10 @@ public void setConstantPoolName(char[] computedConstantPoolName) /* java/lang/Ob
public char[] sourceName() {
if (isAnonymousType()) {
- //return readableName();
if (superInterfaces == NoSuperInterfaces)
- return ("<"+Util.bind("binding.subclass",new String(superclass.sourceName())) + ">").toCharArray(); //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-1$
+ return CharOperation.concat(TypeConstants.ANONYM_PREFIX, superclass.sourceName(), TypeConstants.ANONYM_SUFFIX);
else
- return ("<"+Util.bind("binding.implementation",new String(superInterfaces[0].sourceName())) + ">").toCharArray(); //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-1$
+ return CharOperation.concat(TypeConstants.ANONYM_PREFIX, superInterfaces[0].sourceName(), TypeConstants.ANONYM_SUFFIX);
} else
return sourceName;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java
index 0ab99f22c0..d98a361d64 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java
@@ -30,6 +30,8 @@ public class LocalVariableBinding extends VariableBinding {
public int initializationCount = 0;
// for synthetic local variables
+ // if declaration slot is not positionned, the variable will not be listed in attribute
+ // note that the name of a variable should be chosen so as not to conflict with user ones (usually starting with a space char is all needed)
public LocalVariableBinding(char[] name, TypeBinding type, int modifiers, boolean isArgument) {
this.name = name;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
index a7a9c9c4b6..bd763a808c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
@@ -12,14 +12,13 @@ package org.eclipse.jdt.internal.compiler.lookup;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
-import org.eclipse.jdt.internal.compiler.env.IBinaryType;
-import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
-import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer;
+import org.eclipse.jdt.internal.compiler.ast.Wildcard;
+import org.eclipse.jdt.internal.compiler.env.*;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.impl.ITypeRequestor;
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
import org.eclipse.jdt.internal.compiler.util.HashtableOfPackage;
-import org.eclipse.jdt.internal.compiler.util.Util;
+import org.eclipse.jdt.internal.core.util.SimpleLookupTable;
public class LookupEnvironment implements BaseTypes, ProblemReasons, TypeConstants {
public CompilerOptions options;
@@ -35,6 +34,9 @@ public class LookupEnvironment implements BaseTypes, ProblemReasons, TypeConstan
private INameEnvironment nameEnvironment;
private MethodVerifier verifier;
private ArrayBinding[][] uniqueArrayBindings;
+ private SimpleLookupTable uniqueParameterizedTypeBindings;
+ private SimpleLookupTable uniqueRawTypeBindings;
+ private SimpleLookupTable uniqueWildcardBindings;
private CompilationUnitDeclaration[] units = new CompilationUnitDeclaration[4];
private int lastUnitIndex = -1;
@@ -66,6 +68,9 @@ public LookupEnvironment(ITypeRequestor typeRequestor, CompilerOptions options,
this.knownPackages = new HashtableOfPackage();
this.uniqueArrayBindings = new ArrayBinding[5][];
this.uniqueArrayBindings[0] = new ArrayBinding[50]; // start off the most common 1 dimension array @ 50
+ this.uniqueParameterizedTypeBindings = new SimpleLookupTable(3);
+ this.uniqueRawTypeBindings = new SimpleLookupTable(3);
+ this.uniqueWildcardBindings = new SimpleLookupTable(3);
}
/* Ask the oracle for a type which corresponds to the compoundName.
* Answer null if the name cannot be found.
@@ -280,7 +285,7 @@ ArrayBinding createArrayType(TypeBinding type, int dimensionCount) {
while (++index < length) {
ArrayBinding currentBinding = arrayBindings[index];
if (currentBinding == null) // no matching array, but space left
- return arrayBindings[index] = new ArrayBinding(type, dimensionCount);
+ return arrayBindings[index] = new ArrayBinding(type, dimensionCount, this);
if (currentBinding.leafComponentType == type)
return currentBinding;
}
@@ -291,7 +296,7 @@ ArrayBinding createArrayType(TypeBinding type, int dimensionCount) {
(arrayBindings = new ArrayBinding[length * 2]), 0,
length);
uniqueArrayBindings[dimIndex] = arrayBindings;
- return arrayBindings[length] = new ArrayBinding(type, dimensionCount);
+ return arrayBindings[length] = new ArrayBinding(type, dimensionCount, this);
}
public BinaryTypeBinding createBinaryTypeFrom(IBinaryType binaryType, PackageBinding packageBinding) {
return createBinaryTypeFrom(binaryType, packageBinding, true);
@@ -305,9 +310,7 @@ public BinaryTypeBinding createBinaryTypeFrom(IBinaryType binaryType, PackageBin
if (cachedType.isBinaryBinding()) // sanity check before the cast... at this point the cache should ONLY contain unresolved types
return (BinaryTypeBinding) cachedType;
- UnresolvedReferenceBinding unresolvedType = (UnresolvedReferenceBinding) cachedType;
- unresolvedType.resolvedType = binaryBinding;
- updateArrayCache(unresolvedType, binaryBinding);
+ ((UnresolvedReferenceBinding) cachedType).setResolvedType(binaryBinding, this);
}
packageBinding.addType(binaryBinding);
@@ -348,6 +351,113 @@ PackageBinding createPackage(char[][] compoundName) {
}
return packageBinding;
}
+
+public ParameterizedTypeBinding createParameterizedType(ReferenceBinding genericType, TypeBinding[] typeArguments, ReferenceBinding enclosingType) {
+
+ // cached info is array of already created parameterized types for this type
+ ParameterizedTypeBinding[] cachedInfo = (ParameterizedTypeBinding[])this.uniqueParameterizedTypeBindings.get(genericType);
+ int argLength = typeArguments == null ? 0: typeArguments.length;
+ boolean needToGrow = false;
+ if (cachedInfo != null){
+ nextCachedType :
+ // iterate existing parameterized for reusing one with same type arguments if any
+ for (int i = 0, max = cachedInfo.length; i < max; i++){
+ ParameterizedTypeBinding cachedType = cachedInfo[i];
+ if (cachedType.type != genericType) continue nextCachedType; // remain of unresolved type
+ if (cachedType.enclosingType != enclosingType) continue nextCachedType;
+ TypeBinding[] cachedArguments = cachedType.arguments;
+ int cachedArgLength = cachedArguments == null ? 0 : cachedArguments.length;
+ if (argLength != cachedArgLength) continue nextCachedType; // would be an error situation (from unresolved binaries)
+ for (int j = 0; j < cachedArgLength; j++){
+ if (typeArguments[j] != cachedArguments[j]) continue nextCachedType;
+ }
+ // all arguments match, reuse current
+ return cachedType;
+ }
+ needToGrow = true;
+ } else {
+ cachedInfo = new ParameterizedTypeBinding[1];
+ this.uniqueParameterizedTypeBindings.put(genericType, cachedInfo);
+ }
+ // grow cache ?
+ if (needToGrow){
+ int length = cachedInfo.length;
+ System.arraycopy(cachedInfo, 0, cachedInfo = new ParameterizedTypeBinding[length+1], 0, length);
+ this.uniqueParameterizedTypeBindings.put(genericType, cachedInfo);
+ }
+ // add new binding
+ ParameterizedTypeBinding parameterizedType = new ParameterizedTypeBinding(genericType,typeArguments, enclosingType, this);
+ cachedInfo[cachedInfo.length-1] = parameterizedType;
+ return parameterizedType;
+}
+
+public RawTypeBinding createRawType(ReferenceBinding genericType, ReferenceBinding enclosingType) {
+
+ // cached info is array of already created raw types for this type
+ RawTypeBinding[] cachedInfo = (RawTypeBinding[])this.uniqueRawTypeBindings.get(genericType);
+ boolean needToGrow = false;
+ if (cachedInfo != null){
+ nextCachedType :
+ // iterate existing parameterized for reusing one with same type arguments if any
+ for (int i = 0, max = cachedInfo.length; i < max; i++){
+ RawTypeBinding cachedType = cachedInfo[i];
+ if (cachedType.type != genericType) continue nextCachedType; // remain of unresolved type
+ if (cachedType.enclosingType != enclosingType) continue nextCachedType;
+ // all enclosing type match, reuse current
+ return cachedType;
+ }
+ needToGrow = true;
+ } else {
+ cachedInfo = new RawTypeBinding[1];
+ this.uniqueRawTypeBindings.put(genericType, cachedInfo);
+ }
+ // grow cache ?
+ if (needToGrow){
+ int length = cachedInfo.length;
+ System.arraycopy(cachedInfo, 0, cachedInfo = new RawTypeBinding[length+1], 0, length);
+ this.uniqueRawTypeBindings.put(genericType, cachedInfo);
+ }
+ // add new binding
+ RawTypeBinding rawType = new RawTypeBinding(genericType, enclosingType, this);
+ cachedInfo[cachedInfo.length-1] = rawType;
+ return rawType;
+
+}
+
+public WildcardBinding createWildcard(ReferenceBinding genericType, int rank, TypeBinding bound, int kind) {
+
+ // cached info is array of already created wildcard types for this type
+ WildcardBinding[] cachedInfo = (WildcardBinding[])this.uniqueWildcardBindings.get(genericType);
+ boolean needToGrow = false;
+ if (cachedInfo != null){
+ nextCachedType :
+ // iterate existing wildcards for reusing one with same information if any
+ for (int i = 0, max = cachedInfo.length; i < max; i++){
+ WildcardBinding cachedType = cachedInfo[i];
+ if (cachedType.genericType != genericType) continue nextCachedType; // remain of unresolved type
+ if (cachedType.rank != rank) continue nextCachedType;
+ if (cachedType.kind != kind) continue nextCachedType;
+ if (cachedType.bound != bound) continue nextCachedType;
+ // all match, reuse current
+ return cachedType;
+ }
+ needToGrow = true;
+ } else {
+ cachedInfo = new WildcardBinding[1];
+ this.uniqueWildcardBindings.put(genericType, cachedInfo);
+ }
+ // grow cache ?
+ if (needToGrow){
+ int length = cachedInfo.length;
+ System.arraycopy(cachedInfo, 0, cachedInfo = new WildcardBinding[length+1], 0, length);
+ this.uniqueWildcardBindings.put(genericType, cachedInfo);
+ }
+ // add new binding
+ WildcardBinding wildcard = new WildcardBinding(genericType, rank, bound, kind, this);
+ cachedInfo[cachedInfo.length-1] = wildcard;
+ return wildcard;
+}
+
/* Answer the type for the compoundName if it exists in the cache.
* Answer theNotFoundType if it could not be resolved the first time
* it was looked up, otherwise answer null.
@@ -444,14 +554,24 @@ public ReferenceBinding getType(char[][] compoundName) {
if (referenceBinding == null || referenceBinding == TheNotFoundType)
return null;
- if (referenceBinding instanceof UnresolvedReferenceBinding)
- referenceBinding = ((UnresolvedReferenceBinding) referenceBinding).resolve(this);
+ referenceBinding = BinaryTypeBinding.resolveType(referenceBinding, this, false); // no raw conversion for now
// compoundName refers to a nested type incorrectly (for example, package1.A$B)
if (referenceBinding.isNestedType())
return new ProblemReferenceBinding(compoundName, InternalNameProvided);
return referenceBinding;
}
+private TypeBinding[] getTypeArgumentsFromSignature(SignatureWrapper wrapper, TypeVariableBinding[] staticVariables, ReferenceBinding enclosingType, ReferenceBinding genericType) {
+ java.util.ArrayList args = new java.util.ArrayList(2);
+ int rank = 0;
+ do {
+ args.add(getTypeFromVariantTypeSignature(wrapper, staticVariables, enclosingType, genericType, rank++));
+ } while (wrapper.signature[wrapper.start] != '>');
+ wrapper.start++; // skip '>'
+ TypeBinding[] typeArguments = new TypeBinding[args.size()];
+ args.toArray(typeArguments);
+ return typeArguments;
+}
/* Answer the type corresponding to the name from the binary file.
* Does not ask the oracle for the type if its not found in the cache... instead an
* unresolved type is returned which must be resolved before used.
@@ -461,7 +581,7 @@ public ReferenceBinding getType(char[][] compoundName) {
* NOTE: Aborts compilation if the class file cannot be found.
*/
-ReferenceBinding getTypeFromConstantPoolName(char[] signature, int start, int end) {
+ReferenceBinding getTypeFromConstantPoolName(char[] signature, int start, int end, boolean isParameterized) {
if (end == -1)
end = signature.length;
@@ -474,6 +594,9 @@ ReferenceBinding getTypeFromConstantPoolName(char[] signature, int start, int en
} else if (binding == TheNotFoundType) {
problemReporter.isClassPathCorrect(compoundName, null);
return null; // will not get here since the above error aborts the compilation
+ } else if (!isParameterized && binding.isGenericType()) {
+ // check raw type, only for resolved types
+ binding = createRawType(binding, null);
}
return binding;
}
@@ -486,7 +609,7 @@ ReferenceBinding getTypeFromConstantPoolName(char[] signature, int start, int en
* NOTE: Aborts compilation if the class file cannot be found.
*/
-TypeBinding getTypeFromSignature(char[] signature, int start, int end) {
+TypeBinding getTypeFromSignature(char[] signature, int start, int end, boolean isParameterized, TypeBinding enclosingType) {
int dimension = 0;
while (signature[start] == '[') {
start++;
@@ -527,16 +650,102 @@ TypeBinding getTypeFromSignature(char[] signature, int start, int end) {
binding = ShortBinding;
break;
default :
- throw new Error(Util.bind("error.undefinedBaseType",String.valueOf(signature[start]))); //$NON-NLS-1$
+ problemReporter.corruptedSignature(enclosingType, signature, start);
+ // will never reach here, since error will cause abort
}
} else {
- binding = getTypeFromConstantPoolName(signature, start + 1, end);
+ binding = getTypeFromConstantPoolName(signature, start + 1, end, isParameterized);
}
if (dimension == 0)
return binding;
return createArrayType(binding, dimension);
}
+TypeBinding getTypeFromTypeSignature(SignatureWrapper wrapper, TypeVariableBinding[] staticVariables, ReferenceBinding enclosingType) {
+ // TypeVariableSignature = 'T' Identifier ';'
+ // ArrayTypeSignature = '[' TypeSignature
+ // ClassTypeSignature = 'L' Identifier TypeArgs(optional) ';'
+ // or ClassTypeSignature '.' 'L' Identifier TypeArgs(optional) ';'
+ // TypeArgs = '<' VariantTypeSignature VariantTypeSignatures '>'
+ int dimension = 0;
+ while (wrapper.signature[wrapper.start] == '[') {
+ wrapper.start++;
+ dimension++;
+ }
+
+ if (wrapper.signature[wrapper.start] == 'T') {
+ int varStart = wrapper.start + 1;
+ int varEnd = wrapper.computeEnd();
+ for (int i = staticVariables.length; --i >= 0;)
+ if (CharOperation.equals(staticVariables[i].sourceName, wrapper.signature, varStart, varEnd))
+ return dimension == 0 ? (TypeBinding) staticVariables[i] : createArrayType(staticVariables[i], dimension);
+ ReferenceBinding initialType = enclosingType;
+ do {
+ if (enclosingType instanceof BinaryTypeBinding) { // per construction can only be binary type binding
+ TypeVariableBinding[] enclosingVariables = ((BinaryTypeBinding)enclosingType).typeVariables; // do not trigger resolution of variables
+ for (int i = enclosingVariables.length; --i >= 0;)
+ if (CharOperation.equals(enclosingVariables[i].sourceName, wrapper.signature, varStart, varEnd))
+ return dimension == 0 ? (TypeBinding) enclosingVariables[i] : createArrayType(enclosingVariables[i], dimension);
+ }
+ } while ((enclosingType = enclosingType.enclosingType()) != null);
+ problemReporter.undefinedTypeVariableSignature(CharOperation.subarray(wrapper.signature, varStart, varEnd), initialType);
+ return null; // cannot reach this, since previous problem will abort compilation
+ }
+
+ TypeBinding type = getTypeFromSignature(wrapper.signature, wrapper.start, wrapper.computeEnd(), true, enclosingType);
+ if (wrapper.end != wrapper.bracket)
+ return dimension == 0 ? type : createArrayType(type, dimension);
+
+ // type must be a ReferenceBinding at this point, cannot be a BaseTypeBinding or ArrayTypeBinding
+ ReferenceBinding actualType = (ReferenceBinding) type;
+ TypeBinding[] typeArguments = getTypeArgumentsFromSignature(wrapper, staticVariables, enclosingType, actualType);
+ ParameterizedTypeBinding parameterizedType = createParameterizedType(actualType, typeArguments, null);
+
+ while (wrapper.signature[wrapper.start] == '.') {
+ wrapper.start++; // skip '.'
+ char[] memberName = wrapper.nextWord();
+ BinaryTypeBinding.resolveType(parameterizedType, this, false);
+ ReferenceBinding memberType = parameterizedType.type.getMemberType(memberName);
+ if (wrapper.signature[wrapper.start] == '<') {
+ wrapper.start++; // skip '<'
+ typeArguments = getTypeArgumentsFromSignature(wrapper, staticVariables, enclosingType, memberType);
+ } else {
+ typeArguments = null;
+ }
+ parameterizedType = createParameterizedType(memberType, typeArguments, parameterizedType);
+ }
+ wrapper.start++; // skip ';'
+ return dimension == 0 ? (TypeBinding) parameterizedType : createArrayType(parameterizedType, dimension);
+}
+TypeBinding getTypeFromVariantTypeSignature(
+ SignatureWrapper wrapper,
+ TypeVariableBinding[] staticVariables,
+ ReferenceBinding enclosingType,
+ ReferenceBinding genericType,
+ int rank) {
+ // VariantTypeSignature = '-' TypeSignature
+ // or '+' TypeSignature
+ // or TypeSignature
+ // or '*'
+ switch (wrapper.signature[wrapper.start]) {
+ case '-' :
+ // ? super aType
+ wrapper.start++;
+ TypeBinding bound = getTypeFromTypeSignature(wrapper, staticVariables, enclosingType);
+ return createWildcard(genericType, rank, bound, Wildcard.SUPER);
+ case '+' :
+ // ? extends aType
+ wrapper.start++;
+ bound = getTypeFromTypeSignature(wrapper, staticVariables, enclosingType);
+ return createWildcard(genericType, rank, bound, Wildcard.EXTENDS);
+ case '*' :
+ // ?
+ wrapper.start++;
+ return createWildcard(genericType, rank, null, Wildcard.UNBOUND);
+ default :
+ return getTypeFromTypeSignature(wrapper, staticVariables, enclosingType);
+ }
+}
/* Ask the oracle if a package exists named name in the package named compoundName.
*/
@@ -558,31 +767,44 @@ public void reset() {
this.knownPackages = new HashtableOfPackage();
this.verifier = null;
- for (int i = this.uniqueArrayBindings.length; --i >= 0;)
- this.uniqueArrayBindings[i] = null;
- this.uniqueArrayBindings[0] = new ArrayBinding[50]; // start off the most common 1 dimension array @ 50
+ for (int i = this.uniqueArrayBindings.length; --i >= 0;) {
+ ArrayBinding[] arrayBindings = this.uniqueArrayBindings[i];
+ if (arrayBindings != null)
+ for (int j = arrayBindings.length; --j >= 0;)
+ arrayBindings[j] = null;
+ }
+ this.uniqueParameterizedTypeBindings = new SimpleLookupTable(3);
+ this.uniqueRawTypeBindings = new SimpleLookupTable(3);
+ this.uniqueWildcardBindings = new SimpleLookupTable(3);
for (int i = this.units.length; --i >= 0;)
this.units[i] = null;
this.lastUnitIndex = -1;
this.lastCompletedUnitIndex = -1;
this.unitBeingCompleted = null; // in case AbortException occurred
-
+
// name environment has a longer life cycle, and must be reset in
// the code which created it.
}
-void updateArrayCache(UnresolvedReferenceBinding unresolvedType, ReferenceBinding resolvedType) {
- nextDimension : for (int i = 0, length = uniqueArrayBindings.length; i < length; i++) {
- ArrayBinding[] arrayBindings = uniqueArrayBindings[i];
- if (arrayBindings != null) {
- for (int j = 0, max = arrayBindings.length; j < max; j++) {
- ArrayBinding currentBinding = arrayBindings[j];
- if (currentBinding == null)
- continue nextDimension;
- if (currentBinding.leafComponentType == unresolvedType) {
- currentBinding.leafComponentType = resolvedType;
- continue nextDimension;
- }
+void updateCaches(UnresolvedReferenceBinding unresolvedType, ReferenceBinding resolvedType) {
+ // walk all the unique collections & replace the unresolvedType with the resolvedType
+ // must prevent 2 entries so == still works (1 containing the unresolvedType and the other containing the resolvedType)
+ if (uniqueParameterizedTypeBindings.get(unresolvedType) != null) { // update the key
+ Object[] keys = uniqueParameterizedTypeBindings.keyTable;
+ for (int i = 0, l = keys.length; i < l; i++) {
+ if (keys[i] == unresolvedType) {
+ keys[i] = resolvedType; // hashCode is based on compoundName so this works - cannot be raw since type of parameterized type
+ break;
+ }
+ }
+ }
+
+ if (uniqueWildcardBindings.get(unresolvedType) != null) { // update the key
+ Object[] keys = uniqueWildcardBindings.keyTable;
+ for (int i = 0, l = keys.length; i < l; i++) {
+ if (keys[i] == unresolvedType) {
+ keys[i] = resolvedType.isGenericType() ? createRawType(resolvedType, null) : resolvedType; // hashCode is based on compoundName so this works
+ break;
}
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java
index 0441fb3381..a86aa1f4f9 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java
@@ -21,20 +21,21 @@ public class MethodBinding extends Binding implements BaseTypes, TypeConstants {
public TypeBinding[] parameters;
public ReferenceBinding[] thrownExceptions;
public ReferenceBinding declaringClass;
+ public TypeVariableBinding[] typeVariables = NoTypeVariables;
char[] signature;
protected MethodBinding() {
// for creating problem or synthetic method
}
-public MethodBinding(int modifiers, char[] selector, TypeBinding returnType, TypeBinding[] args, ReferenceBinding[] exceptions, ReferenceBinding declaringClass) {
+public MethodBinding(int modifiers, char[] selector, TypeBinding returnType, TypeBinding[] parameters, ReferenceBinding[] thrownExceptions, ReferenceBinding declaringClass) {
this.modifiers = modifiers;
this.selector = selector;
this.returnType = returnType;
- this.parameters = (args == null || args.length == 0) ? NoParameters : args;
- this.thrownExceptions = (exceptions == null || exceptions.length == 0) ? NoExceptions : exceptions;
+ this.parameters = (parameters == null || parameters.length == 0) ? NoParameters : parameters;
+ this.thrownExceptions = (thrownExceptions == null || thrownExceptions.length == 0) ? NoExceptions : thrownExceptions;
this.declaringClass = declaringClass;
-
+
// propagate the strictfp & deprecated modifiers
if (this.declaringClass != null) {
if (this.declaringClass.isStrictfp())
@@ -44,8 +45,8 @@ public MethodBinding(int modifiers, char[] selector, TypeBinding returnType, Typ
this.modifiers |= AccDeprecatedImplicitly;
}
}
-public MethodBinding(int modifiers, TypeBinding[] args, ReferenceBinding[] exceptions, ReferenceBinding declaringClass) {
- this(modifiers, ConstructorDeclaration.ConstantPoolName, VoidBinding, args, exceptions, declaringClass);
+public MethodBinding(int modifiers, TypeBinding[] parameters, ReferenceBinding[] thrownExceptions, ReferenceBinding declaringClass) {
+ this(modifiers, ConstructorDeclaration.ConstantPoolName, VoidBinding, parameters, thrownExceptions, declaringClass);
}
// special API used to change method declaring class for runtime visibility check
public MethodBinding(MethodBinding initialMethodBinding, ReferenceBinding declaringClass) {
@@ -58,7 +59,6 @@ public MethodBinding(MethodBinding initialMethodBinding, ReferenceBinding declar
}
/* Answer true if the argument types & the receiver's parameters are equal
*/
-
public final boolean areParametersEqual(MethodBinding method) {
TypeBinding[] args = method.parameters;
if (parameters == args)
@@ -73,6 +73,22 @@ public final boolean areParametersEqual(MethodBinding method) {
return false;
return true;
}
+/* Answer true if the argument types & the receiver's parameters have the same erasure
+*/
+public final boolean areParameterErasuresEqual(MethodBinding method) {
+ TypeBinding[] args = method.parameters;
+ if (parameters == args)
+ return true;
+
+ int length = parameters.length;
+ if (length != args.length)
+ return false;
+
+ for (int i = 0; i < length; i++) {
+ if (parameters[i].erasure() != args[i].erasure()) return false;
+ }
+ return true;
+}
/* API
* Answer the receiver's binding type from Binding.BindingID.
*/
@@ -208,6 +224,7 @@ public final boolean canBeSeenBy(TypeBinding receiverType, InvocationSite invoca
} while ((type = type.superclass()) != null);
return false;
}
+
/*
* Answer the declaring class to use in the constant pool
* may not be a reference binding (see subtypes)
@@ -224,9 +241,63 @@ public TypeBinding constantPoolDeclaringClass() {
public final char[] constantPoolName() {
return selector;
}
+/**
+ *<typeParam1 ... typeParamM>(param1 ... paramN)returnType thrownException1 ... thrownExceptionP
+ * T foo(T t) throws X<T> ---> (TT;)TT;LX<TT;>;
+ * void bar(X<T> t) --> (LX<TT;>;)V
+ * <T> void bar(X<T> t) --> <T:Ljava.lang.Object;>(LX<TT;>;)V
+ */
+public char[] genericSignature() {
+ if ((this.modifiers & AccGenericSignature) == 0) return null;
+ StringBuffer sig = new StringBuffer(10);
+ if (this.typeVariables != NoTypeVariables) {
+ sig.append('<');
+ for (int i = 0, length = this.typeVariables.length; i < length; i++) {
+ sig.append(this.typeVariables[i].genericSignature());
+ }
+ sig.append('>');
+ }
+ sig.append('(');
+ for (int i = 0, length = this.parameters.length; i < length; i++) {
+ sig.append(this.parameters[i].genericTypeSignature());
+ }
+ sig.append(')').append(this.returnType.genericTypeSignature());
+ // only append thrown exception if any is generic/parameterized
+ for (int i = 0, length = this.thrownExceptions.length; i < length; i++) {
+ if((this.thrownExceptions[i].modifiers & AccGenericSignature) != 0) {
+ for (int j = 0; j < length; j++) {
+ sig.append(this.thrownExceptions[j].genericTypeSignature());
+ }
+ break;
+ }
+ }
+ int sigLength = sig.length();
+ char[] genericSignature = new char[sigLength];
+ sig.getChars(0, sigLength, genericSignature, 0);
+ return genericSignature;
+}
public final int getAccessFlags() {
return modifiers & AccJustFlag;
}
+public TypeVariableBinding getTypeVariable(char[] variableName) {
+ for (int i = this.typeVariables.length; --i >= 0;)
+ if (CharOperation.equals(this.typeVariables[i].sourceName, variableName))
+ return this.typeVariables[i];
+ return null;
+}
+/**
+ * Returns true if method got substituted parameter types
+ * (see ParameterizedMethodBinding)
+ */
+public boolean hasSubstitutedParameters() {
+ return false;
+}
+
+/* Answer true if the return type got substituted.
+ */
+public boolean hasSubstitutedReturnType() {
+ return false;
+}
/* Answer true if the receiver is an abstract method
*/
@@ -376,6 +447,13 @@ public final boolean isViewedAsDeprecated() {
(modifiers & AccDeprecatedImplicitly) != 0;
}
+/**
+ * Returns the original method (as opposed to parameterized instances)
+ */
+public MethodBinding original() {
+ return this;
+}
+
public char[] readableName() /* foo(int, Thread) */ {
StringBuffer buffer = new StringBuffer(parameters.length + 1 * 20);
if (isConstructor())
@@ -412,7 +490,10 @@ public char[] shortReadableName() {
}
}
buffer.append(')');
- return buffer.toString().toCharArray();
+ int nameLength = buffer.length();
+ char[] shortReadableName = new char[nameLength];
+ buffer.getChars(0, nameLength, shortReadableName, 0);
+ return shortReadableName;
}
protected final void setSelector(char[] selector) {
@@ -467,7 +548,11 @@ public final char[] signature() /* (ILjava/lang/Thread;)Ljava/lang/Object; */ {
}
buffer.append(')');
buffer.append(returnType.signature());
- return signature = buffer.toString().toCharArray();
+ int nameLength = buffer.length();
+ signature = new char[nameLength];
+ buffer.getChars(0, nameLength, signature, 0);
+
+ return signature;
}
public final int sourceEnd() {
AbstractMethodDeclaration method = sourceMethod();
@@ -495,6 +580,7 @@ public final int sourceStart() {
return 0;
return method.sourceStart;
}
+
/* During private access emulation, the binding can be requested to loose its
* private visibility when the class file is dumped.
*/
@@ -535,4 +621,7 @@ public String toString() {
}
return s;
}
+public TypeVariableBinding[] typeVariables() {
+ return this.typeVariables;
+}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java
index 92b806bf20..8cc69fe710 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java
@@ -16,6 +16,7 @@ import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration;
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
import org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo;
@@ -313,6 +314,15 @@ public class MethodScope extends BlockScope {
checkAndSetModifiersForMethod(method.binding);
}
this.isStatic = method.binding.isStatic();
+
+ TypeParameter[] typeParameters = method.typeParameters();
+ // do not construct type variables if source < 1.5
+ if (typeParameters == null || environment().options.sourceLevel < ClassFileConstants.JDK1_5) {
+ method.binding.typeVariables = NoTypeVariables;
+ } else {
+ method.binding.typeVariables = createTypeVariables(typeParameters, method.binding);
+ method.binding.modifiers |= AccGenericSignature;
+ }
return method.binding;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java
index 05ebfa1767..ab36ef4ddb 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java
@@ -48,18 +48,20 @@ public MethodVerifier(LookupEnvironment environment) {
this.errorException = null;
this.environment = environment;
}
-private boolean areParametersEqual(MethodBinding one, MethodBinding two) {
+private boolean areParameterErasuresEqual(MethodBinding one, MethodBinding two) {
TypeBinding[] oneArgs = one.parameters;
TypeBinding[] twoArgs = two.parameters;
if (oneArgs == twoArgs) return true;
int length = oneArgs.length;
if (length != twoArgs.length) return false;
-
for (int i = 0; i < length; i++)
- if (!areTypesEqual(oneArgs[i], twoArgs[i])) return false;
+ if (!areTypesEqual(oneArgs[i].erasure(), twoArgs[i].erasure())) return false;
return true;
}
+private boolean areReturnTypeErasuresEqual(MethodBinding one, MethodBinding two) {
+ return areTypesEqual(one.returnType.erasure(), two.returnType.erasure());
+}
private boolean areTypesEqual(TypeBinding one, TypeBinding two) {
if (one == two) return true;
if (one instanceof ReferenceBinding && two instanceof ReferenceBinding)
@@ -82,31 +84,43 @@ private void checkAgainstInheritedMethods(MethodBinding currentMethod, MethodBin
currentMethod.modifiers |= CompilerModifiers.AccOverriding;
nextMethod : for (int i = length; --i >= 0;) {
MethodBinding inheritedMethod = methods[i];
+ if (currentMethod.isStatic() != inheritedMethod.isStatic()) { // Cannot override a static method or hide an instance method
+ this.problemReporter(currentMethod).staticAndInstanceConflict(currentMethod, inheritedMethod);
+ continue nextMethod;
+ }
+
if (!currentMethod.isAbstract() && inheritedMethod.isAbstract())
currentMethod.modifiers |= CompilerModifiers.AccImplementing;
- if (!areTypesEqual(currentMethod.returnType, inheritedMethod.returnType)) {
+ boolean addBridgeMethod = inheritedMethod.hasSubstitutedReturnType()
+ && isSameOrSubTypeOf(currentMethod.returnType, inheritedMethod.returnType);
+ if (!addBridgeMethod && !areTypesEqual(currentMethod.returnType, inheritedMethod.returnType)) {
this.problemReporter(currentMethod).incompatibleReturnType(currentMethod, inheritedMethod);
- } else if (currentMethod.isStatic() != inheritedMethod.isStatic()) { // Cannot override a static method or hide an instance method
- this.problemReporter(currentMethod).staticAndInstanceConflict(currentMethod, inheritedMethod);
- } else {
- if (currentMethod.thrownExceptions != NoExceptions)
- this.checkExceptions(currentMethod, inheritedMethod);
- if (inheritedMethod.isFinal())
- this.problemReporter(currentMethod).finalMethodCannotBeOverridden(currentMethod, inheritedMethod);
- if (!this.isAsVisible(currentMethod, inheritedMethod))
- this.problemReporter(currentMethod).visibilityConflict(currentMethod, inheritedMethod);
- if (environment.options.reportDeprecationWhenOverridingDeprecatedMethod && inheritedMethod.isViewedAsDeprecated()) {
- if (!currentMethod.isViewedAsDeprecated() || environment.options.reportDeprecationInsideDeprecatedCode) {
- // check against the other inherited methods to see if they hide this inheritedMethod
- ReferenceBinding declaringClass = inheritedMethod.declaringClass;
- if (declaringClass.isInterface())
- for (int j = length; --j >= 0;)
- if (i != j && methods[j].declaringClass.implementsInterface(declaringClass, false))
- continue nextMethod;
+ continue nextMethod;
+ }
- this.problemReporter(currentMethod).overridesDeprecatedMethod(currentMethod, inheritedMethod);
- }
+ if (addBridgeMethod || inheritedMethod.hasSubstitutedParameters()) {
+ MethodBinding original = inheritedMethod.original();
+ if (!areReturnTypeErasuresEqual(original, currentMethod) || !areParameterErasuresEqual(original, currentMethod))
+ this.type.addSyntheticBridgeMethod(original, currentMethod);
+ }
+
+ if (currentMethod.thrownExceptions != NoExceptions)
+ this.checkExceptions(currentMethod, inheritedMethod);
+ if (inheritedMethod.isFinal())
+ this.problemReporter(currentMethod).finalMethodCannotBeOverridden(currentMethod, inheritedMethod);
+ if (!this.isAsVisible(currentMethod, inheritedMethod))
+ this.problemReporter(currentMethod).visibilityConflict(currentMethod, inheritedMethod);
+ if (environment.options.reportDeprecationWhenOverridingDeprecatedMethod && inheritedMethod.isViewedAsDeprecated()) {
+ if (!currentMethod.isViewedAsDeprecated() || environment.options.reportDeprecationInsideDeprecatedCode) {
+ // check against the other inherited methods to see if they hide this inheritedMethod
+ ReferenceBinding declaringClass = inheritedMethod.declaringClass;
+ if (declaringClass.isInterface())
+ for (int j = length; --j >= 0;)
+ if (i != j && methods[j].declaringClass.implementsInterface(declaringClass, false))
+ continue nextMethod;
+
+ this.problemReporter(currentMethod).overridesDeprecatedMethod(currentMethod, inheritedMethod);
}
}
}
@@ -130,9 +144,9 @@ private void checkExceptions(MethodBinding newMethod, MethodBinding inheritedMet
}
}
private void checkInheritedMethods(MethodBinding[] methods, int length) {
- TypeBinding returnType = methods[0].returnType;
+ MethodBinding first = methods[0];
int index = length;
- while (--index > 0 && areTypesEqual(returnType, methods[index].returnType)){/*empty*/}
+ while (--index > 0 && areReturnTypeErasuresEqual(first, methods[index])){/*empty*/}
if (index > 0) { // All inherited methods do NOT have the same vmSignature
this.problemReporter().inheritedMethodsHaveIncompatibleReturnTypes(this.type, methods, length);
return;
@@ -226,7 +240,8 @@ private void checkMethods() {
while (index >= 0) matchingInherited[index--] = null; // clear the previous contents of the matching methods
MethodBinding currentMethod = current[i];
for (int j = 0, length2 = inherited.length; j < length2; j++) {
- if (inherited[j] != null && areParametersEqual(currentMethod, inherited[j])) {
+ MethodBinding inheritedMethod = inherited[j];
+ if (inherited[j] != null && areParameterErasuresEqual(currentMethod, inheritedMethod)) {
matchingInherited[++index] = inherited[j];
inherited[j] = null; // do not want to find it again
}
@@ -238,10 +253,11 @@ private void checkMethods() {
for (int i = 0, length = inherited.length; i < length; i++) {
while (index >= 0) matchingInherited[index--] = null; // clear the previous contents of the matching methods
- if (inherited[i] != null) {
- matchingInherited[++index] = inherited[i];
+ MethodBinding inheritedMethod = inherited[i];
+ if (inheritedMethod != null) {
+ matchingInherited[++index] = inheritedMethod;
for (int j = i + 1; j < length; j++) {
- if (inherited[j] != null && areParametersEqual(inherited[i], inherited[j])) {
+ if (inherited[j] != null && areParameterErasuresEqual(inheritedMethod, inherited[j])) {
matchingInherited[++index] = inherited[j];
inherited[j] = null; // do not want to find it again
}
@@ -264,7 +280,7 @@ private void checkPackagePrivateAbstractMethod(MethodBinding abstractMethod) {
MethodBinding[] methods = superType.getMethods(selector);
nextMethod : for (int m = methods.length; --m >= 0;) {
MethodBinding method = methods[m];
- if (!areTypesEqual(method.returnType, abstractMethod.returnType) || !areParametersEqual(method, abstractMethod))
+ if (!areReturnTypeErasuresEqual(method, abstractMethod) || !areParameterErasuresEqual(method, abstractMethod))
continue nextMethod;
if (method.isPrivate() || method.isConstructor() || method.isDefaultAbstract())
continue nextMethod;
@@ -316,7 +332,7 @@ private void computeInheritedMethods() {
MethodBinding[] existingMethods = (MethodBinding[]) this.inheritedMethods.get(method.selector);
if (existingMethods != null) {
for (int i = 0, length = existingMethods.length; i < length; i++) {
- if (areTypesEqual(method.returnType, existingMethods[i].returnType) && areParametersEqual(method, existingMethods[i])) {
+ if (areReturnTypeErasuresEqual(method, existingMethods[i]) && areParameterErasuresEqual(method, existingMethods[i])) {
if (method.isDefault() && method.isAbstract() && method.declaringClass.fPackage != type.fPackage)
checkPackagePrivateAbstractMethod(method);
continue nextMethod;
@@ -326,8 +342,8 @@ private void computeInheritedMethods() {
if (nonVisibleDefaultMethods != null)
for (int i = 0; i < nonVisibleCount; i++)
if (CharOperation.equals(method.selector, nonVisibleDefaultMethods[i].selector)
- && areTypesEqual(method.returnType, nonVisibleDefaultMethods[i].returnType)
- && areParametersEqual(method, nonVisibleDefaultMethods[i]))
+ && areReturnTypeErasuresEqual(method, nonVisibleDefaultMethods[i])
+ && areParameterErasuresEqual(method, nonVisibleDefaultMethods[i]))
continue nextMethod;
if (!method.isDefault() || method.declaringClass.fPackage == type.fPackage) {
@@ -352,7 +368,7 @@ private void computeInheritedMethods() {
MethodBinding[] current = (MethodBinding[]) this.currentMethods.get(method.selector);
if (current != null) { // non visible methods cannot be overridden so a warning is issued
foundMatch : for (int i = 0, length = current.length; i < length; i++) {
- if (areTypesEqual(method.returnType, current[i].returnType) && areParametersEqual(method, current[i])) {
+ if (areReturnTypeErasuresEqual(method, current[i]) && areParameterErasuresEqual(method, current[i])) {
this.problemReporter().overridesPackageDefaultMethod(current[i], method);
break foundMatch;
}
@@ -442,6 +458,23 @@ private boolean isSameClassOrSubclassOf(ReferenceBinding testClass, ReferenceBin
} while ((testClass = testClass.superclass()) != null);
return false;
}
+private boolean isSameOrSubTypeOf(TypeBinding one, TypeBinding two) {
+ if (one.isArrayType() || two.isArrayType()) {
+ if (one.isArrayType() != two.isArrayType()) return false;
+ ArrayBinding arrayOne = (ArrayBinding) one;
+ ArrayBinding arrayTwo = (ArrayBinding) two;
+ if (arrayOne.dimensions != arrayTwo.dimensions) return false;
+ one = arrayOne.leafComponentType;
+ two = arrayTwo.leafComponentType;
+ }
+ if (one.isBaseType() || two.isBaseType()) return false;
+
+ ReferenceBinding subType = (ReferenceBinding) one;
+ ReferenceBinding superType = (ReferenceBinding) two;
+ if (superType.isInterface())
+ return subType.implementsInterface(superType, true);
+ return subType.isClass() && isSameClassOrSubclassOf(subType, superType);
+}
private boolean mustImplementAbstractMethod(MethodBinding abstractMethod) {
// if the type's superclass is an abstract class, then all abstract methods must be implemented
// otherwise, skip it if the type's superclass must implement any of the inherited methods
@@ -470,18 +503,16 @@ private ProblemReporter problemReporter(MethodBinding currentMethod) {
reporter.referenceContext = currentMethod.sourceMethod();
return reporter;
}
-ReferenceBinding[] resolvedExceptionTypesFor(MethodBinding method) {
+private ReferenceBinding[] resolvedExceptionTypesFor(MethodBinding method) {
ReferenceBinding[] exceptions = method.thrownExceptions;
if ((method.modifiers & CompilerModifiers.AccUnresolved) == 0)
return exceptions;
if (!(method.declaringClass instanceof BinaryTypeBinding))
return TypeConstants.NoExceptions; // safety check
- BinaryTypeBinding binaryType = (BinaryTypeBinding) method.declaringClass;
for (int i = exceptions.length; --i >= 0;)
- if (exceptions[i] instanceof UnresolvedReferenceBinding)
- exceptions[i] = (ReferenceBinding) binaryType.resolveType(exceptions[i]);
+ exceptions[i] = BinaryTypeBinding.resolveType(exceptions[i], this.environment, true);
return exceptions;
}
private ReferenceBinding runtimeException() {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java
index ee68a49c87..fff5dd8fbb 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java
@@ -112,22 +112,22 @@ PackageBinding getPackage0(char[] name) {
*/
ReferenceBinding getType(char[] name) {
- ReferenceBinding binding = getType0(name);
- if (binding == null) {
- if ((binding = environment.askForType(this, name)) == null) {
+ ReferenceBinding typeBinding = getType0(name);
+ if (typeBinding == null) {
+ if ((typeBinding = environment.askForType(this, name)) == null) {
// not found so remember a problem type binding in the cache for future lookups
addNotFoundType(name);
return null;
}
}
- if (binding == LookupEnvironment.TheNotFoundType)
+ if (typeBinding == LookupEnvironment.TheNotFoundType)
return null;
- if (binding instanceof UnresolvedReferenceBinding)
- binding = ((UnresolvedReferenceBinding) binding).resolve(environment);
- if (binding.isNestedType())
+
+ typeBinding = BinaryTypeBinding.resolveType(typeBinding, environment, false); // no raw conversion for now
+ if (typeBinding.isNestedType())
return new ProblemReferenceBinding(name, InternalNameProvided);
- return binding;
+ return typeBinding;
}
/* Answer the type named name if it exists in the cache.
* Answer theNotFoundType if it could not be resolved the first time
@@ -155,8 +155,7 @@ ReferenceBinding getType0(char[] name) {
public Binding getTypeOrPackage(char[] name) {
ReferenceBinding typeBinding = getType0(name);
if (typeBinding != null && typeBinding != LookupEnvironment.TheNotFoundType) {
- if (typeBinding instanceof UnresolvedReferenceBinding)
- typeBinding = ((UnresolvedReferenceBinding) typeBinding).resolve(environment);
+ typeBinding = BinaryTypeBinding.resolveType(typeBinding, environment, false); // no raw conversion for now
if (typeBinding.isNestedType())
return new ProblemReferenceBinding(name, InternalNameProvided);
return typeBinding;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedFieldBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedFieldBinding.java
new file mode 100644
index 0000000000..c91021bf71
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedFieldBinding.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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.lookup;
+
+/**
+ * Binding denoting a field after type substitution got performed.
+ * On parameterized type bindings, all fields got substituted, regardless whether
+ * their signature did involve generics or not, so as to get the proper declaringClass for
+ * these fields.
+ */
+public class ParameterizedFieldBinding extends FieldBinding {
+
+ public FieldBinding originalField;
+
+ public ParameterizedFieldBinding(ParameterizedTypeBinding parameterizedDeclaringClass, FieldBinding originalField) {
+ super (
+ originalField.name,
+ parameterizedDeclaringClass.substitute(originalField.type),
+ originalField.modifiers,
+ parameterizedDeclaringClass,
+ originalField.constant);
+ this.originalField = originalField;
+ }
+}
+
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java
new file mode 100644
index 0000000000..ffc35ce762
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * 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.lookup;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.jdt.internal.compiler.ast.MessageSend;
+import org.eclipse.jdt.internal.compiler.ast.Wildcard;
+
+/**
+ * Binding denoting a generic method after type parameter substitutions got performed.
+ * On parameterized type bindings, all methods got substituted, regardless whether
+ * their signature did involve generics or not, so as to get the proper declaringClass for
+ * these methods.
+ */
+public class ParameterizedGenericMethodBinding extends ParameterizedMethodBinding implements Substitution {
+
+ public TypeBinding[] typeArguments;
+ private LookupEnvironment environment;
+ public boolean inferredReturnType;
+
+ /**
+ * Create method of parameterized type, substituting original parameters with type arguments.
+ */
+ public ParameterizedGenericMethodBinding(MethodBinding originalMethod, TypeBinding[] typeArguments, LookupEnvironment environment) {
+
+ this.environment = environment;
+ this.modifiers = originalMethod.modifiers;
+ this.selector = originalMethod.selector;
+ this.declaringClass = originalMethod.declaringClass;
+ this.typeVariables = NoTypeVariables;
+ this.typeArguments = typeArguments;
+ this.originalMethod = originalMethod;
+ this.parameters = Scope.substitute(this, originalMethod.parameters);
+ this.thrownExceptions = Scope.substitute(this, originalMethod.thrownExceptions);
+ this.returnType = this.substitute(originalMethod.returnType);
+ }
+ /**
+ * Perform inference of generic method type parameters and/or expected type
+ */
+ public static MethodBinding computeCompatibleMethod(MethodBinding originalMethod, TypeBinding[] arguments, Scope scope, InvocationSite invocationSite) {
+
+ ParameterizedGenericMethodBinding methodSubstitute;
+ TypeVariableBinding[] typeVariables = originalMethod.typeVariables;
+ TypeBinding[] substitutes = invocationSite.genericTypeArguments();
+
+ if (substitutes != null) {
+ if (substitutes.length != typeVariables.length) {
+ // incompatible due to wrong arity
+ return new ProblemMethodBinding(originalMethod, originalMethod.selector, substitutes, TypeParameterArityMismatch);
+ }
+ methodSubstitute = new ParameterizedGenericMethodBinding(originalMethod, substitutes, scope.environment());
+ } else {
+ // perform type inference based on argument types and expected type
+
+ // collect substitutes by pattern matching parameters and arguments
+ int argLength = arguments.length;
+ TypeBinding[] parameters = originalMethod.parameters;
+ int varLength = typeVariables.length;
+ HashMap collectedSubstitutes = new HashMap(varLength);
+ for (int i = 0; i < varLength; i++)
+ collectedSubstitutes.put(typeVariables[i], new TypeBinding[1]);
+ for (int i = 0; i < argLength; i++)
+ parameters[i].collectSubstitutes(arguments[i], collectedSubstitutes);
+ substitutes = new TypeBinding[varLength];
+ boolean needReturnTypeInference = false;
+ for (int i = 0; i < varLength; i++) {
+ TypeBinding[] variableSubstitutes = (TypeBinding[]) collectedSubstitutes.get(typeVariables[i]);
+ TypeBinding mostSpecificSubstitute = scope.mostSpecificCommonType(variableSubstitutes);
+ if (mostSpecificSubstitute == null)
+ return null; // incompatible
+ if (mostSpecificSubstitute == VoidBinding) {
+ needReturnTypeInference = true;
+ mostSpecificSubstitute = typeVariables[i];
+ }
+ substitutes[i] = mostSpecificSubstitute;
+ }
+ // apply inferred variable substitutions
+ methodSubstitute = new ParameterizedGenericMethodBinding(originalMethod, substitutes, scope.environment());
+
+ if (needReturnTypeInference && invocationSite instanceof MessageSend) {
+ MessageSend message = (MessageSend) invocationSite;
+ TypeBinding expectedType = message.expectedType;
+ if (expectedType != null)
+ methodSubstitute.inferFromExpectedType(message.expectedType, scope);
+ }
+ }
+ // check bounds
+ for (int i = 0, length = typeVariables.length; i < length; i++) {
+ TypeVariableBinding typeVariable = typeVariables[i];
+ if (!typeVariable.boundCheck(methodSubstitute, substitutes[i]))
+ // incompatible due to bound check
+ return new ProblemMethodBinding(methodSubstitute, originalMethod.selector, new TypeBinding[]{substitutes[i], typeVariables[i] }, ParameterBoundMismatch);
+ }
+
+ return methodSubstitute;
+ }
+
+ public void inferFromExpectedType(TypeBinding expectedType, Scope scope) {
+ if (this.returnType == expectedType)
+ return;
+ if ((this.returnType.tagBits & TagBits.HasTypeVariable) == 0)
+ return;
+ Map substitutes = new HashMap(1);
+ int length = this.typeArguments.length;
+ TypeVariableBinding[] originalVariables = this.original().typeVariables;
+ boolean hasUnboundParameters = false;
+ for (int i = 0; i < length; i++) {
+ if (this.typeArguments[i] == originalVariables[i]) {
+ hasUnboundParameters = true;
+ substitutes.put(originalVariables[i], new TypeBinding[1]);
+ } else {
+ substitutes.put(originalVariables[i], new TypeBinding[] { this.typeArguments[i] });
+ }
+ }
+ if (!hasUnboundParameters)
+ return;
+ returnType.collectSubstitutes(expectedType, substitutes);
+ for (int i = 0; i < length; i++) {
+ TypeBinding[] variableSubstitutes = (TypeBinding[]) substitutes.get(originalVariables[i]);
+ TypeBinding mostSpecificSubstitute = scope.mostSpecificCommonType(variableSubstitutes);
+ if (mostSpecificSubstitute == null) {
+ return; // TODO (philippe) should report no way to infer type
+ }
+ if (mostSpecificSubstitute != VoidBinding)
+ this.typeArguments[i] = mostSpecificSubstitute;
+ }
+ TypeBinding oldReturnType = this.returnType;
+ this.returnType = this.substitute(this.returnType);
+ this.inferredReturnType = this.returnType != oldReturnType;
+ this.parameters = Scope.substitute(this, this.parameters);
+ this.thrownExceptions = Scope.substitute(this, this.thrownExceptions);
+ }
+
+ /**
+ * Returns a type, where original type was substituted using the receiver
+ * parameterized method.
+ */
+ public TypeBinding substitute(TypeBinding originalType) {
+
+ if ((originalType.tagBits & TagBits.HasTypeVariable) != 0) {
+ if (originalType.isTypeVariable()) {
+ TypeVariableBinding originalVariable = (TypeVariableBinding) originalType;
+ TypeVariableBinding[] variables = this.originalMethod.typeVariables;
+ int length = variables.length;
+ // check this variable can be substituted given parameterized type
+ if (originalVariable.rank < length && variables[originalVariable.rank] == originalVariable) {
+ return this.typeArguments[originalVariable.rank];
+ }
+ } else if (originalType.isParameterizedType()) {
+ ParameterizedTypeBinding originalParameterizedType = (ParameterizedTypeBinding) originalType;
+ TypeBinding[] originalArguments = originalParameterizedType.arguments;
+ TypeBinding[] substitutedArguments = Scope.substitute(this, originalArguments);
+ if (substitutedArguments != originalArguments) {
+ identicalVariables: { // if substituted with original variables, then answer the generic type itself
+ TypeVariableBinding[] originalVariables = originalParameterizedType.type.typeVariables();
+ for (int i = 0, length = originalVariables.length; i < length; i++) {
+ if (substitutedArguments[i] != originalVariables[i]) break identicalVariables;
+ }
+ return originalParameterizedType.type;
+ }
+ return this.environment.createParameterizedType(
+ originalParameterizedType.type, substitutedArguments, originalParameterizedType.enclosingType);
+ }
+ } else if (originalType.isArrayType()) {
+ TypeBinding originalLeafComponentType = originalType.leafComponentType();
+ TypeBinding substitute = substitute(originalLeafComponentType); // substitute could itself be array type
+ if (substitute != originalLeafComponentType) {
+ return this.environment.createArrayType(substitute.leafComponentType(), substitute.dimensions() + originalType.dimensions());
+ }
+ } else if (originalType.isWildcard()) {
+ WildcardBinding wildcard = (WildcardBinding) originalType;
+ if (wildcard.kind != Wildcard.UNBOUND) {
+ TypeBinding originalBound = wildcard.bound;
+ TypeBinding substitutedBound = substitute(originalBound);
+ if (substitutedBound != originalBound) {
+ return this.environment.createWildcard(wildcard.genericType, wildcard.rank, substitutedBound, wildcard.kind);
+ }
+ }
+ }
+ } else if (originalType.isGenericType()) {
+ // treat as if parameterized with its type variables
+ ReferenceBinding originalGenericType = (ReferenceBinding) originalType;
+ TypeVariableBinding[] originalVariables = originalGenericType.typeVariables();
+ int length = originalVariables.length;
+ TypeBinding[] originalArguments;
+ System.arraycopy(originalVariables, 0, originalArguments = new TypeBinding[length], 0, length);
+ TypeBinding[] substitutedArguments = Scope.substitute(this, originalArguments);
+ if (substitutedArguments != originalArguments) {
+ return this.environment.createParameterizedType(
+ originalGenericType, substitutedArguments, null);
+ }
+ }
+ return originalType;
+ }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java
new file mode 100644
index 0000000000..4fe2539f58
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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.lookup;
+
+import org.eclipse.jdt.internal.compiler.ast.Wildcard;
+
+/**
+ * Binding denoting a method after type parameter substitutions got performed.
+ * On parameterized type bindings, all methods got substituted, regardless whether
+ * their signature did involve generics or not, so as to get the proper declaringClass for
+ * these methods.
+ */
+public class ParameterizedMethodBinding extends MethodBinding {
+
+ protected MethodBinding originalMethod;
+
+ /**
+ * Create method of parameterized type, substituting original parameters/exception/return type with type arguments.
+ */
+ public ParameterizedMethodBinding(ParameterizedTypeBinding parameterizedDeclaringClass, MethodBinding originalMethod) {
+
+ super(
+ originalMethod.modifiers,
+ originalMethod.selector,
+ parameterizedDeclaringClass.substitute(originalMethod.returnType),
+ Scope.substitute(parameterizedDeclaringClass, originalMethod.parameters),
+ Scope.substitute(parameterizedDeclaringClass, originalMethod.thrownExceptions),
+ parameterizedDeclaringClass);
+ this.originalMethod = originalMethod;
+ this.typeVariables = originalMethod.typeVariables;
+ }
+
+ public ParameterizedMethodBinding() {
+ // no init
+ }
+
+ /**
+ * The type of x.getClass() is substituted from 'Class<? extends Object>' into: 'Class<? extends |X|> where |X| is X's erasure.
+ */
+ public static ParameterizedMethodBinding instantiateGetClass(TypeBinding receiverType, MethodBinding originalMethod, Scope scope) {
+ ParameterizedMethodBinding method = new ParameterizedMethodBinding();
+ method.modifiers = originalMethod.modifiers;
+ method.selector = originalMethod.selector;
+ method.declaringClass = originalMethod.declaringClass;
+ method.typeVariables = NoTypeVariables;
+ method.originalMethod = originalMethod;
+ method.parameters = originalMethod.parameters;
+ method.thrownExceptions = originalMethod.thrownExceptions;
+ ReferenceBinding genericClassType = scope.getJavaLangClass();
+ method.returnType = scope.createParameterizedType(
+ genericClassType,
+ new TypeBinding[] { scope.environment().createWildcard(genericClassType, 0, receiverType.erasure(), Wildcard.EXTENDS) },
+ null);
+ return method;
+ }
+
+ /**
+ * Returns true if some parameters got substituted.
+ */
+ public boolean hasSubstitutedParameters() {
+ return this.parameters != originalMethod.parameters;
+ }
+
+ /**
+ * Returns true if the return type got substituted.
+ */
+ public boolean hasSubstitutedReturnType() {
+ return this.returnType != originalMethod.returnType;
+ }
+
+ /**
+ * Returns the original method (as opposed to parameterized instances)
+ */
+ public MethodBinding original() {
+ return this.originalMethod.original();
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java
new file mode 100644
index 0000000000..0a11f05e70
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java
@@ -0,0 +1,756 @@
+/*******************************************************************************
+ * 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.lookup;
+
+import java.util.Map;
+import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.Wildcard;
+
+/**
+ * A parameterized type encapsulates a type with type arguments,
+ */
+public class ParameterizedTypeBinding extends ReferenceBinding implements Substitution {
+
+ public ReferenceBinding type;
+ public TypeBinding[] arguments;
+ public LookupEnvironment environment;
+ public char[] genericTypeSignature;
+ public ReferenceBinding superclass;
+ public ReferenceBinding[] superInterfaces;
+ public FieldBinding[] fields;
+ public ReferenceBinding[] memberTypes;
+ public MethodBinding[] methods;
+ public ReferenceBinding enclosingType;
+
+ public ParameterizedTypeBinding(ReferenceBinding type, TypeBinding[] arguments, ReferenceBinding enclosingType, LookupEnvironment environment){
+ this.environment = environment;
+ initialize(type, arguments);
+ this.enclosingType = enclosingType; // never unresolved, never lazy per construction
+
+ if (type instanceof UnresolvedReferenceBinding)
+ ((UnresolvedReferenceBinding) type).addWrapper(this);
+ for (int i = 0, l = arguments == null ? 0 : arguments.length; i < l; i++)
+ if (arguments[i] instanceof UnresolvedReferenceBinding)
+ ((UnresolvedReferenceBinding) arguments[i]).addWrapper(this);
+ }
+
+ /**
+ * Collect the substitutes into a map for certain type variables inside the receiver type
+ * e.g. Collection<T>.findSubstitute(T, Collection<List<X>>): T --> List<X>
+ */
+ public void collectSubstitutes(TypeBinding otherType, Map substitutes) {
+ if (otherType instanceof ReferenceBinding) {
+ // allow List<T> to match with LinkedList<String>
+ ReferenceBinding otherEquivalent = ((ReferenceBinding)otherType).findSuperTypeErasingTo((ReferenceBinding)this.type.erasure());
+ if (otherEquivalent != null && otherEquivalent.isParameterizedType()) {
+ ParameterizedTypeBinding otherParameterizedType = (ParameterizedTypeBinding) otherEquivalent;
+ for (int i = 0, length = this.arguments.length; i < length; i++) {
+ this.arguments[i].collectSubstitutes(otherParameterizedType.arguments[i], substitutes);
+ }
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#computeId()
+ */
+ public void computeId() {
+ this.id = NoId;
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#constantPoolName()
+ */
+ public char[] constantPoolName() {
+ return this.type.constantPoolName(); // erasure
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#debugName()
+ */
+ public String debugName() {
+ StringBuffer nameBuffer = new StringBuffer(10);
+ nameBuffer.append(this.type.sourceName());
+ if (this.arguments != null) {
+ nameBuffer.append('<');
+ for (int i = 0, length = this.arguments.length; i < length; i++) {
+ if (i > 0) nameBuffer.append(',');
+ nameBuffer.append(this.arguments[i].debugName());
+ }
+ nameBuffer.append('>');
+ }
+ return nameBuffer.toString();
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#enclosingType()
+ */
+ public ReferenceBinding enclosingType() {
+ if (this.enclosingType == null) { // if not positionned, use default
+ this.enclosingType = this.type.enclosingType();
+ }
+ return this.enclosingType;
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#erasure()
+ */
+ public TypeBinding erasure() {
+ return this.type.erasure(); // erasure
+ }
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#fieldCount()
+ */
+ public int fieldCount() {
+ return this.type.fieldCount(); // same as erasure (lazy)
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#fields()
+ */
+ public FieldBinding[] fields() {
+ if (this.fields == null) {
+ try {
+ FieldBinding[] originalFields = this.type.fields();
+ int length = originalFields.length;
+ FieldBinding[] parameterizedFields = new FieldBinding[length];
+ for (int i = 0; i < length; i++)
+ // substitute all fields, so as to get updated declaring class at least
+ parameterizedFields[i] = new ParameterizedFieldBinding(this, originalFields[i]);
+ this.fields = parameterizedFields;
+ } finally {
+ // if the original fields cannot be retrieved (ex. AbortCompilation), then assume we do not have any fields
+ if (this.fields == null)
+ this.fields = NoFields;
+ }
+ }
+ return this.fields;
+ }
+
+ /**
+ * Ltype<param1 ... paremN>;
+ * LY<TT;>;
+ */
+ public char[] genericTypeSignature() {
+ if (this.genericTypeSignature == null) {
+ StringBuffer sig = new StringBuffer(10);
+ if (this.isMemberType() && this.enclosingType().isParameterizedType()) {
+ char[] typeSig = this.enclosingType().genericTypeSignature();
+ for (int i = 0; i < typeSig.length-1; i++) sig.append(typeSig[i]); // copy all but trailing semicolon
+ sig.append('.').append(this.sourceName());
+ } else {
+ char[] typeSig = this.type.signature();
+ for (int i = 0; i < typeSig.length-1; i++) sig.append(typeSig[i]); // copy all but trailing semicolon
+ }
+ if (this.arguments != null) {
+ sig.append('<');
+ for (int i = 0, length = this.arguments.length; i < length; i++) {
+ sig.append(this.arguments[i].genericTypeSignature());
+ }
+ sig.append('>'); //$NON-NLS-1$
+ }
+ sig.append(';');
+ int sigLength = sig.length();
+ this.genericTypeSignature = new char[sigLength];
+ sig.getChars(0, sigLength, this.genericTypeSignature, 0);
+ }
+ return this.genericTypeSignature;
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#getExactConstructor(TypeBinding[])
+ */
+ public MethodBinding getExactConstructor(TypeBinding[] argumentTypes) {
+ int argCount = argumentTypes.length;
+
+ if ((modifiers & AccUnresolved) == 0) { // have resolved all arg types & return type of the methods
+ nextMethod : for (int m = methods.length; --m >= 0;) {
+ MethodBinding method = methods[m];
+ if (method.selector == ConstructorDeclaration.ConstantPoolName && method.parameters.length == argCount) {
+ TypeBinding[] toMatch = method.parameters;
+ for (int p = 0; p < argCount; p++)
+ if (toMatch[p] != argumentTypes[p])
+ continue nextMethod;
+ return method;
+ }
+ }
+ } else {
+ MethodBinding[] constructors = getMethods(ConstructorDeclaration.ConstantPoolName); // takes care of duplicates & default abstract methods
+ nextConstructor : for (int c = constructors.length; --c >= 0;) {
+ MethodBinding constructor = constructors[c];
+ TypeBinding[] toMatch = constructor.parameters;
+ if (toMatch.length == argCount) {
+ for (int p = 0; p < argCount; p++)
+ if (toMatch[p] != argumentTypes[p])
+ continue nextConstructor;
+ return constructor;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#getExactMethod(char[], TypeBinding[])
+ */
+ public MethodBinding getExactMethod(char[] selector, TypeBinding[] argumentTypes) {
+ int argCount = argumentTypes.length;
+ int selectorLength = selector.length;
+ boolean foundNothing = true;
+ MethodBinding match = null;
+
+ if ((modifiers & AccUnresolved) == 0) { // have resolved all arg types & return type of the methods
+ nextMethod : for (int m = methods.length; --m >= 0;) {
+ MethodBinding method = methods[m];
+ if (method.selector.length == selectorLength && CharOperation.equals(method.selector, selector)) {
+ foundNothing = false; // inner type lookups must know that a method with this name exists
+ if (method.parameters.length == argCount) {
+ TypeBinding[] toMatch = method.parameters;
+ for (int p = 0; p < argCount; p++)
+ if (toMatch[p] != argumentTypes[p])
+ continue nextMethod;
+ if (match != null) return null; // collision case
+ match = method;
+ }
+ }
+ }
+ } else {
+ MethodBinding[] matchingMethods = getMethods(selector); // takes care of duplicates & default abstract methods
+ foundNothing = matchingMethods == NoMethods;
+ nextMethod : for (int m = matchingMethods.length; --m >= 0;) {
+ MethodBinding method = matchingMethods[m];
+ TypeBinding[] toMatch = method.parameters;
+ if (toMatch.length == argCount) {
+ for (int p = 0; p < argCount; p++)
+ if (toMatch[p] != argumentTypes[p])
+ continue nextMethod;
+ if (match != null) return null; // collision case
+ match = method;
+ }
+ }
+ }
+ if (match != null) return match;
+
+ if (foundNothing) {
+ if (isInterface()) {
+ if (superInterfaces().length == 1)
+ return superInterfaces[0].getExactMethod(selector, argumentTypes);
+ } else if (superclass() != null) {
+ return superclass.getExactMethod(selector, argumentTypes);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#getField(char[], boolean)
+ */
+ public FieldBinding getField(char[] fieldName, boolean needResolve) {
+ fields(); // ensure fields have been initialized... must create all at once unlike methods
+ int fieldLength = fieldName.length;
+ for (int i = fields.length; --i >= 0;) {
+ FieldBinding field = fields[i];
+ if (field.name.length == fieldLength && CharOperation.equals(field.name, fieldName))
+ return field;
+ }
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#getMemberType(char[])
+ */
+ public ReferenceBinding getMemberType(char[] typeName) {
+ memberTypes(); // ensure memberTypes have been initialized... must create all at once unlike methods
+ int typeLength = typeName.length;
+ for (int i = this.memberTypes.length; --i >= 0;) {
+ ReferenceBinding memberType = this.memberTypes[i];
+ if (memberType.sourceName.length == typeLength && CharOperation.equals(memberType.sourceName, typeName))
+ return memberType;
+ }
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#getMethods(char[])
+ */
+ public MethodBinding[] getMethods(char[] selector) {
+ java.util.ArrayList matchingMethods = null;
+ if (this.methods != null) {
+ int selectorLength = selector.length;
+ for (int i = 0, length = this.methods.length; i < length; i++) {
+ MethodBinding method = methods[i];
+ if (method.selector.length == selectorLength && CharOperation.equals(method.selector, selector)) {
+ if (matchingMethods == null)
+ matchingMethods = new java.util.ArrayList(2);
+ matchingMethods.add(method);
+ }
+ }
+ if (matchingMethods != null) {
+ MethodBinding[] result = new MethodBinding[matchingMethods.size()];
+ matchingMethods.toArray(result);
+ return result;
+ }
+ }
+ if ((modifiers & AccUnresolved) == 0) return NoMethods; // have created all the methods and there are no matches
+
+ MethodBinding[] parameterizedMethods = null;
+ try {
+ MethodBinding[] originalMethods = this.type.getMethods(selector);
+ int length = originalMethods.length;
+ if (length == 0) return NoMethods;
+
+ parameterizedMethods = new MethodBinding[length];
+ for (int i = 0; i < length; i++)
+ // substitute methods, so as to get updated declaring class at least
+ parameterizedMethods[i] = new ParameterizedMethodBinding(this, originalMethods[i]);
+ if (this.methods == null) {
+ this.methods = parameterizedMethods;
+ } else {
+ MethodBinding[] temp = new MethodBinding[length + this.methods.length];
+ System.arraycopy(parameterizedMethods, 0, temp, 0, length);
+ System.arraycopy(this.methods, 0, temp, length, this.methods.length);
+ this.methods = temp;
+ }
+ return parameterizedMethods;
+ } finally {
+ // if the original methods cannot be retrieved (ex. AbortCompilation), then assume we do not have any methods
+ if (parameterizedMethods == null)
+ this.methods = parameterizedMethods = NoMethods;
+ }
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#implementsMethod(MethodBinding)
+ */
+ public boolean implementsMethod(MethodBinding method) {
+ return this.type.implementsMethod(method); // erasure
+ }
+
+ void initialize(ReferenceBinding someType, TypeBinding[] someArguments) {
+ this.type = someType;
+ this.sourceName = someType.sourceName;
+ this.compoundName = someType.compoundName;
+ this.fPackage = someType.fPackage;
+ this.fileName = someType.fileName;
+ // should not be set yet
+ // this.superclass = null;
+ // this.superInterfaces = null;
+ // this.fields = null;
+ // this.methods = null;
+ this.modifiers = someType.modifiers | AccGenericSignature | AccUnresolved; // until methods() is sent
+ if (someArguments != null) {
+ this.arguments = someArguments;
+ for (int i = 0, length = someArguments.length; i < length; i++)
+ this.tagBits |= someArguments[i].tagBits & (HasTypeVariable | HasWildcard);
+ }
+ this.tagBits |= someType.tagBits & (IsLocalType| IsMemberType | IsNestedType);
+ }
+
+ protected void initializeArguments() {
+ // do nothing for true parameterized types (only for raw types)
+ }
+
+ public boolean isEquivalentTo(TypeBinding otherType) {
+ if (this == otherType)
+ return true;
+ if (otherType == null)
+ return false;
+ if (otherType.isRawType())
+ return erasure() == otherType.erasure();
+ if (otherType.isParameterizedType()) {
+ if ((otherType.tagBits & HasWildcard) == 0 && (!this.isMemberType() || !otherType.isMemberType()))
+ return false; // should have been identical
+ ParameterizedTypeBinding otherParamType = (ParameterizedTypeBinding) otherType;
+ if (this.type != otherParamType.type)
+ return false;
+ ReferenceBinding enclosing = enclosingType();
+ if (enclosing != null && !enclosing.isEquivalentTo(otherParamType.enclosingType()))
+ return false;
+ int length = this.arguments == null ? 0 : this.arguments.length;
+ int otherLength = otherParamType.arguments == null ? 0 : otherParamType.arguments.length;
+ if (otherLength != length)
+ return false;
+ for (int i = 0; i < length; i++) {
+ if (!this.arguments[i].isEquivalentTo(otherParamType.arguments[i]))
+ return false;
+ }
+ return true;
+ } else if (otherType.isWildcard()){ // wildcard
+ return ((WildcardBinding) otherType).boundCheck(this);
+ }
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#isParameterizedType()
+ */
+ public boolean isParameterizedType() {
+ return true;
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#memberTypes()
+ */
+ public ReferenceBinding[] memberTypes() {
+ if (this.memberTypes == null) {
+ try {
+ ReferenceBinding[] originalMemberTypes = this.type.memberTypes();
+ int length = originalMemberTypes.length;
+ ReferenceBinding[] parameterizedMemberTypes = new ReferenceBinding[length];
+ for (int i = 0; i < length; i++)
+ // substitute all member types, so as to get updated enclosing types
+ parameterizedMemberTypes[i] = this.environment.createParameterizedType(originalMemberTypes[i], null, this);
+ this.memberTypes = parameterizedMemberTypes;
+ } finally {
+ // if the original fields cannot be retrieved (ex. AbortCompilation), then assume we do not have any fields
+ if (this.memberTypes == null)
+ this.memberTypes = NoMemberTypes;
+ }
+ }
+ return this.memberTypes;
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#methods()
+ */
+ public MethodBinding[] methods() {
+ if ((modifiers & AccUnresolved) == 0)
+ return this.methods;
+
+ try {
+ MethodBinding[] originalMethods = this.type.methods();
+ int length = originalMethods.length;
+ MethodBinding[] parameterizedMethods = new MethodBinding[length];
+ for (int i = 0; i < length; i++)
+ // substitute all methods, so as to get updated declaring class at least
+ parameterizedMethods[i] = new ParameterizedMethodBinding(this, originalMethods[i]);
+ this.methods = parameterizedMethods;
+ } finally {
+ // if the original methods cannot be retrieved (ex. AbortCompilation), then assume we do not have any methods
+ if (this.methods == null)
+ this.methods = NoMethods;
+
+ modifiers ^= AccUnresolved;
+ }
+ return this.methods;
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#qualifiedSourceName()
+ */
+ public char[] qualifiedSourceName() {
+ return this.type.qualifiedSourceName();
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.Binding#readableName()
+ */
+ public char[] readableName() {
+ StringBuffer nameBuffer = new StringBuffer(10);
+ if (this.isMemberType()) {
+ nameBuffer.append(CharOperation.concat(this.enclosingType().readableName(), sourceName, '.'));
+ } else {
+ nameBuffer.append(CharOperation.concatWith(this.type.compoundName, '.'));
+ }
+ if (this.arguments != null) {
+ nameBuffer.append('<');
+ for (int i = 0, length = this.arguments.length; i < length; i++) {
+ if (i > 0) nameBuffer.append(',');
+ nameBuffer.append(this.arguments[i].readableName());
+ }
+ nameBuffer.append('>');
+ }
+ int nameLength = nameBuffer.length();
+ char[] readableName = new char[nameLength];
+ nameBuffer.getChars(0, nameLength, readableName, 0);
+ return readableName;
+ }
+
+ ReferenceBinding resolve() {
+ // TODO need flag to know that this has already been done... should it be on ReferenceBinding?
+ ReferenceBinding resolvedType = BinaryTypeBinding.resolveType(this.type, this.environment, false); // still part of parameterized type ref
+ if (this.arguments != null) {
+ int argLength = this.arguments.length;
+ for (int i = 0; i < argLength; i++)
+ BinaryTypeBinding.resolveType(this.arguments[i], this.environment, this, i);
+ // arity check
+ TypeVariableBinding[] refTypeVariables = resolvedType.typeVariables();
+ if (refTypeVariables == NoTypeVariables) { // check generic
+ this.environment.problemReporter.nonGenericTypeCannotBeParameterized(null, resolvedType, this.arguments);
+ return this; // cannot reach here as AbortCompilation is thrown
+ } else if (argLength != refTypeVariables.length) { // check arity
+ this.environment.problemReporter.incorrectArityForParameterizedType(null, resolvedType, this.arguments);
+ return this; // cannot reach here as AbortCompilation is thrown
+ }
+ // check argument type compatibility
+ for (int i = 0; i < argLength; i++) {
+ TypeBinding resolvedArgument = this.arguments[i];
+ if (!refTypeVariables[i].boundCheck(this, resolvedArgument)) {
+ this.environment.problemReporter.typeMismatchError(resolvedArgument, refTypeVariables[i], resolvedType, null);
+ }
+ }
+ }
+ return this;
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.Binding#shortReadableName()
+ */
+ public char[] shortReadableName() {
+ StringBuffer nameBuffer = new StringBuffer(10);
+ if (this.isMemberType()) {
+ nameBuffer.append(CharOperation.concat(this.enclosingType().shortReadableName(), sourceName, '.'));
+ } else {
+ nameBuffer.append(this.type.sourceName);
+ }
+ if (this.arguments != null) {
+ nameBuffer.append('<');
+ for (int i = 0, length = this.arguments.length; i < length; i++) {
+ if (i > 0) nameBuffer.append(',');
+ nameBuffer.append(this.arguments[i].shortReadableName());
+ }
+ nameBuffer.append('>');
+ }
+ int nameLength = nameBuffer.length();
+ char[] shortReadableName = new char[nameLength];
+ nameBuffer.getChars(0, nameLength, shortReadableName, 0);
+ return shortReadableName;
+ }
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#signature()
+ */
+ public char[] signature() {
+ if (this.signature == null) {
+ this.signature = this.type.signature(); // erasure
+ }
+ return this.signature;
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#sourceName()
+ */
+ public char[] sourceName() {
+ return this.type.sourceName();
+ }
+
+ /**
+ * Returns a type, where original type was substituted using the receiver
+ * parameterized type.
+ */
+ public TypeBinding substitute(TypeBinding originalType) {
+ if ((originalType.tagBits & TagBits.HasTypeVariable) != 0) {
+ if (originalType.isTypeVariable()) {
+ TypeVariableBinding originalVariable = (TypeVariableBinding) originalType;
+ ParameterizedTypeBinding currentType = this;
+ while (true) {
+ if (currentType.arguments != null) {
+ TypeVariableBinding[] typeVariables = currentType.type.typeVariables();
+ int length = typeVariables.length;
+ // check this variable can be substituted given parameterized type
+ if (originalVariable.rank < length && typeVariables[originalVariable.rank] == originalVariable) {
+ return currentType.arguments[originalVariable.rank];
+ }
+ }
+ // recurse on enclosing type, as it may hold more substitutions to perform
+ ReferenceBinding enclosing = currentType.enclosingType();
+ if (!(enclosing instanceof ParameterizedTypeBinding))
+ break;
+ currentType = (ParameterizedTypeBinding) enclosing;
+ }
+ } else if (originalType.isParameterizedType()) {
+ ParameterizedTypeBinding originalParameterizedType = (ParameterizedTypeBinding) originalType;
+ TypeBinding[] originalArguments = originalParameterizedType.arguments;
+ TypeBinding[] substitutedArguments = Scope.substitute(this, originalArguments);
+ if (substitutedArguments != originalArguments) {
+ identicalVariables: { // if substituted with original variables, then answer the generic type itself
+ TypeVariableBinding[] originalVariables = originalParameterizedType.type.typeVariables();
+ for (int i = 0, length = originalVariables.length; i < length; i++) {
+ if (substitutedArguments[i] != originalVariables[i]) break identicalVariables;
+ }
+ return originalParameterizedType.type;
+ }
+ return this.environment.createParameterizedType(
+ originalParameterizedType.type, substitutedArguments, originalParameterizedType.enclosingType);
+ }
+ } else if (originalType.isArrayType()) {
+ TypeBinding originalLeafComponentType = originalType.leafComponentType();
+ TypeBinding substitute = substitute(originalLeafComponentType); // substitute could itself be array type
+ if (substitute != originalLeafComponentType) {
+ return this.environment.createArrayType(substitute.leafComponentType(), substitute.dimensions() + originalType.dimensions());
+ }
+ } else if (originalType.isWildcard()) {
+ WildcardBinding wildcard = (WildcardBinding) originalType;
+ if (wildcard.kind != Wildcard.UNBOUND) {
+ TypeBinding originalBound = wildcard.bound;
+ TypeBinding substitutedBound = substitute(originalBound);
+ if (substitutedBound != originalBound) {
+ return this.environment.createWildcard(wildcard.genericType, wildcard.rank, substitutedBound, wildcard.kind);
+ }
+ }
+ }
+ } else if (originalType.isGenericType()) {
+ // treat as if parameterized with its type variables
+ ReferenceBinding originalGenericType = (ReferenceBinding) originalType;
+ TypeVariableBinding[] originalVariables = originalGenericType.typeVariables();
+ int length = originalVariables.length;
+ TypeBinding[] originalArguments;
+ System.arraycopy(originalVariables, 0, originalArguments = new TypeBinding[length], 0, length);
+ TypeBinding[] substitutedArguments = Scope.substitute(this, originalArguments);
+ if (substitutedArguments != originalArguments) {
+ return this.environment.createParameterizedType(
+ originalGenericType, substitutedArguments, null);
+ }
+ }
+ return originalType;
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#superclass()
+ */
+ public ReferenceBinding superclass() {
+ if (this.superclass == null) {
+ // note: Object cannot be generic
+ ReferenceBinding genericSuperclass = this.type.superclass();
+ if (genericSuperclass == null) return null; // e.g. interfaces
+ this.superclass = (ReferenceBinding) substitute(genericSuperclass);
+ }
+ return this.superclass;
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#superInterfaces()
+ */
+ public ReferenceBinding[] superInterfaces() {
+ if (this.superInterfaces == null) {
+ this.superInterfaces = Scope.substitute(this, this.type.superInterfaces());
+ }
+ return this.superInterfaces;
+ }
+
+ public void swapUnresolved(UnresolvedReferenceBinding unresolvedType, ReferenceBinding resolvedType, LookupEnvironment env) {
+ boolean update = false;
+ if (this.type == unresolvedType) {
+ this.type = resolvedType; // cannot be raw since being parameterized below
+ update = true;
+ }
+ if (this.arguments != null) {
+ for (int i = 0, l = this.arguments.length; i < l; i++) {
+ if (this.arguments[i] == unresolvedType) {
+ this.arguments[i] = resolvedType.isGenericType() ? env.createRawType(resolvedType, null) : resolvedType;
+ update = true;
+ }
+ }
+ }
+ if (update)
+ initialize(this.type, this.arguments);
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#syntheticEnclosingInstanceTypes()
+ */
+ public ReferenceBinding[] syntheticEnclosingInstanceTypes() {
+ return this.type.syntheticEnclosingInstanceTypes();
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#syntheticOuterLocalVariables()
+ */
+ public SyntheticArgumentBinding[] syntheticOuterLocalVariables() {
+ return this.type.syntheticOuterLocalVariables();
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#leafComponentType()
+ */
+ public TypeBinding leafComponentType() {
+ return this.type.leafComponentType();
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#qualifiedPackageName()
+ */
+ public char[] qualifiedPackageName() {
+ return this.type.qualifiedPackageName();
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ StringBuffer buffer = new StringBuffer(30);
+ if (isDeprecated()) buffer.append("deprecated "); //$NON-NLS-1$
+ if (isPublic()) buffer.append("public "); //$NON-NLS-1$
+ if (isProtected()) buffer.append("protected "); //$NON-NLS-1$
+ if (isPrivate()) buffer.append("private "); //$NON-NLS-1$
+ if (isAbstract() && isClass()) buffer.append("abstract "); //$NON-NLS-1$
+ if (isStatic() && isNestedType()) buffer.append("static "); //$NON-NLS-1$
+ if (isFinal()) buffer.append("final "); //$NON-NLS-1$
+
+ buffer.append(isInterface() ? "interface " : "class "); //$NON-NLS-1$ //$NON-NLS-2$
+ buffer.append(this.debugName());
+
+ buffer.append("\n\textends "); //$NON-NLS-1$
+ buffer.append((superclass != null) ? superclass.debugName() : "NULL TYPE"); //$NON-NLS-1$
+
+ if (superInterfaces != null) {
+ if (superInterfaces != NoSuperInterfaces) {
+ buffer.append("\n\timplements : "); //$NON-NLS-1$
+ for (int i = 0, length = superInterfaces.length; i < length; i++) {
+ if (i > 0)
+ buffer.append(", "); //$NON-NLS-1$
+ buffer.append((superInterfaces[i] != null) ? superInterfaces[i].debugName() : "NULL TYPE"); //$NON-NLS-1$
+ }
+ }
+ } else {
+ buffer.append("NULL SUPERINTERFACES"); //$NON-NLS-1$
+ }
+
+ if (enclosingType() != null) {
+ buffer.append("\n\tenclosing type : "); //$NON-NLS-1$
+ buffer.append(enclosingType().debugName());
+ }
+
+ if (fields != null) {
+ if (fields != NoFields) {
+ buffer.append("\n/* fields */"); //$NON-NLS-1$
+ for (int i = 0, length = fields.length; i < length; i++)
+ buffer.append('\n').append((fields[i] != null) ? fields[i].toString() : "NULL FIELD"); //$NON-NLS-1$
+ }
+ } else {
+ buffer.append("NULL FIELDS"); //$NON-NLS-1$
+ }
+
+ if (methods != null) {
+ if (methods != NoMethods) {
+ buffer.append("\n/* methods */"); //$NON-NLS-1$
+ for (int i = 0, length = methods.length; i < length; i++)
+ buffer.append('\n').append((methods[i] != null) ? methods[i].toString() : "NULL METHOD"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ } else {
+ buffer.append("NULL METHODS"); //$NON-NLS-1$
+ }
+
+// if (memberTypes != null) {
+// if (memberTypes != NoMemberTypes) {
+// buffer.append("\n/* members */"); //$NON-NLS-1$
+// for (int i = 0, length = memberTypes.length; i < length; i++)
+// buffer.append('\n').append((memberTypes[i] != null) ? memberTypes[i].toString() : "NULL TYPE"); //$NON-NLS-1$ //$NON-NLS-2$
+// }
+// } else {
+// buffer.append("NULL MEMBER TYPES"); //$NON-NLS-1$
+// }
+
+ buffer.append("\n\n"); //$NON-NLS-1$
+ return buffer.toString();
+
+ }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java
index 71f05473f0..e5ae8dbd0a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java
@@ -11,21 +11,23 @@
package org.eclipse.jdt.internal.compiler.lookup;
public class ProblemMethodBinding extends MethodBinding {
- private int problemId;
- public MethodBinding closestMatch;
-public ProblemMethodBinding(char[] selector, TypeBinding[] args, int problemId) {
+
+ private int problemReason;
+ public MethodBinding closestMatch; // TODO (philippe) should rename into #alternateMatch
+
+public ProblemMethodBinding(char[] selector, TypeBinding[] args, int problemReason) {
this.selector = selector;
this.parameters = (args == null || args.length == 0) ? NoParameters : args;
- this.problemId = problemId;
+ this.problemReason = problemReason;
}
-public ProblemMethodBinding(char[] selector, TypeBinding[] args, ReferenceBinding declaringClass, int problemId) {
+public ProblemMethodBinding(char[] selector, TypeBinding[] args, ReferenceBinding declaringClass, int problemReason) {
this.selector = selector;
this.parameters = (args == null || args.length == 0) ? NoParameters : args;
this.declaringClass = declaringClass;
- this.problemId = problemId;
+ this.problemReason = problemReason;
}
-public ProblemMethodBinding(MethodBinding closestMatch, char[] selector, TypeBinding[] args, int problemId) {
- this(selector, args, problemId);
+public ProblemMethodBinding(MethodBinding closestMatch, char[] selector, TypeBinding[] args, int problemReason) {
+ this(selector, args, problemReason);
this.closestMatch = closestMatch;
if (closestMatch != null) this.declaringClass = closestMatch.declaringClass;
}
@@ -35,6 +37,6 @@ public ProblemMethodBinding(MethodBinding closestMatch, char[] selector, TypeBin
*/
public final int problemId() {
- return problemId;
+ return this.problemReason;
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReasons.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReasons.java
index b34f200140..f62f58dc33 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReasons.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReasons.java
@@ -20,4 +20,8 @@ public interface ProblemReasons {
final int NonStaticReferenceInConstructorInvocation = 6;
final int NonStaticReferenceInStaticContext = 7;
final int ReceiverTypeNotVisible = 8;
+ final int IllegalSuperTypeVariable = 9;
+ final int ParameterBoundMismatch = 10; // for generic method
+ final int TypeParameterArityMismatch = 11; // for generic method
+ final int ParameterizedMethodTypeMismatch = 12; // for generic method
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java
index 7225ba7e69..00d8a18c51 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java
@@ -12,31 +12,32 @@ package org.eclipse.jdt.internal.compiler.lookup;
public class ProblemReferenceBinding extends ReferenceBinding {
public ReferenceBinding original;
- private int problemId;
+ private int problemReason;
+ public ReferenceBinding alternateMatch;
+
// NOTE: must only answer the subset of the name related to the problem
-public ProblemReferenceBinding(char[][] compoundName, int problemId) {
- this(compoundName, null, problemId);
+public ProblemReferenceBinding(char[][] compoundName, int problemReason) {
+ this(compoundName, null, problemReason);
}
-public ProblemReferenceBinding(char[] name, int problemId) {
- this(new char[][] {name}, null, problemId);
+public ProblemReferenceBinding(char[] name, int problemReason) {
+ this(new char[][] {name}, null, problemReason);
}
-public ProblemReferenceBinding(char[][] compoundName, ReferenceBinding original, int problemId) {
+public ProblemReferenceBinding(char[][] compoundName, ReferenceBinding original, int problemReason) {
this.compoundName = compoundName;
this.original = original;
- this.problemId = problemId;
+ this.problemReason = problemReason;
}
-public ProblemReferenceBinding(char[] name, ReferenceBinding original, int problemId) {
- this(new char[][] {name}, original, problemId);
+public ProblemReferenceBinding(char[] name, ReferenceBinding original, int problemReason) {
+ this(new char[][] {name}, original, problemReason);
}
/* API
* Answer the problem id associated with the receiver.
* NoError if the receiver is a valid binding.
*/
-
-public final int problemId() {
- return problemId;
+public int problemId() {
+ return this.problemReason;
}
/**
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java
new file mode 100644
index 0000000000..2342322583
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * 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.lookup;
+
+import org.eclipse.jdt.core.compiler.CharOperation;
+
+/**
+ * Denote a raw type, i.e. a generic type referenced without any type arguments.
+ * e.g. X<T extends Exception> can be used a raw type 'X', in which case it
+ * will behave as X<Exception>
+ */
+public class RawTypeBinding extends ParameterizedTypeBinding {
+
+ /**
+ * Raw type arguments are erasure of respective parameter bounds. But we may not have resolved
+ * these bounds yet if creating raw types while supertype hierarchies are being connected.
+ * Therefore, use 'null' instead, and access these in a lazy way later on (when substituting).
+ */
+ public RawTypeBinding(ReferenceBinding type, ReferenceBinding enclosingType, LookupEnvironment environment){
+ super(type, null, enclosingType, environment);
+ if (enclosingType == null || (enclosingType.modifiers & AccGenericSignature) == 0)
+ this.modifiers ^= AccGenericSignature; // only need signature if enclosing needs one
+ }
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#debugName()
+ */
+ public String debugName() {
+ StringBuffer nameBuffer = new StringBuffer(10);
+ nameBuffer.append(this.type.sourceName()).append("#RAW"); //$NON-NLS-1$
+ return nameBuffer.toString();
+ }
+ /**
+ * Ltype<param1 ... paramN>;
+ * LY<TT;>;
+ */
+ public char[] genericTypeSignature() {
+
+ if (this.genericTypeSignature == null) {
+ StringBuffer sig = new StringBuffer(10);
+ if (this.isMemberType() && this.enclosingType().isParameterizedType()) {
+ char[] typeSig = this.enclosingType().genericTypeSignature();
+ for (int i = 0; i < typeSig.length-1; i++) sig.append(typeSig[i]); // copy all but trailing semicolon
+ sig.append('.').append(this.sourceName()).append(';');
+ int sigLength = sig.length();
+ this.genericTypeSignature = new char[sigLength];
+ sig.getChars(0, sigLength, this.genericTypeSignature, 0);
+ } else {
+ this.genericTypeSignature = this.type.signature(); // erasure
+ }
+ }
+ return this.genericTypeSignature;
+ }
+
+ public boolean isEquivalentTo(TypeBinding otherType) {
+ if (this == otherType) return true;
+ if (otherType == null) return false;
+ if (otherType.isWildcard()) // wildcard
+ return ((WildcardBinding) otherType).boundCheck(this);
+ return otherType.erasure() == this.erasure();
+ }
+ /**
+ * Raw type is not treated as a standard parameterized type
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#isParameterizedType()
+ */
+ public boolean isParameterizedType() {
+ return false;
+ }
+ public boolean isRawType() {
+ return true;
+ }
+
+ protected void initializeArguments() {
+ TypeVariableBinding[] typeVariables = this.type.typeVariables();
+ int length = typeVariables.length;
+ TypeBinding[] typeArguments = new TypeBinding[length];
+ for (int i = 0; i < length; i++) {
+ typeArguments[i] = typeVariables[i].erasure();
+ }
+ this.arguments = typeArguments;
+ }
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.Binding#readableName()
+ */
+ public char[] readableName() /*java.lang.Object, p.X<T> */ {
+ char[] readableName;
+ if (isMemberType()) {
+ readableName = CharOperation.concat(this.type.enclosingType().readableName(), sourceName, '.');
+ } else {
+ readableName = CharOperation.concatWith(this.type.compoundName, '.');
+ }
+ return readableName;
+ }
+
+ /**
+ * Returns a type, where original type was substituted using the receiver
+ * raw type.
+ * On raw types, all parameterized type denoting same original type are converted
+ * to raw types. e.g.
+ * class X <T> {
+ * X<T> foo;
+ * X<String> bar;
+ * } when used in raw fashion, then type of both foo and bar is raw type X.
+ */
+ public TypeBinding substitute(TypeBinding originalType) {
+
+ if (originalType.isTypeVariable()) {
+ TypeVariableBinding originalVariable = (TypeVariableBinding) originalType;
+ ParameterizedTypeBinding currentType = this;
+ while (true) {
+ TypeVariableBinding[] typeVariables = currentType.type.typeVariables();
+ int length = typeVariables.length;
+ // check this variable can be substituted given parameterized type
+ if (originalVariable.rank < length && typeVariables[originalVariable.rank] == originalVariable) {
+ // lazy init, since cannot do so during binding creation if during supertype connection
+ if (currentType.arguments == null) currentType.initializeArguments();
+ if (currentType.arguments != null)
+ return currentType.arguments[originalVariable.rank];
+ }
+ // recurse on enclosing type, as it may hold more substitutions to perform
+ ReferenceBinding enclosing = currentType.enclosingType();
+ if (!(enclosing instanceof ParameterizedTypeBinding))
+ break;
+ currentType = (ParameterizedTypeBinding) enclosing;
+ }
+ } else if (originalType.isParameterizedType()) {
+ ParameterizedTypeBinding originalParameterizedType = (ParameterizedTypeBinding) originalType;
+ return this.environment.createRawType(originalParameterizedType.type, originalParameterizedType.enclosingType);
+ } else if (originalType.isGenericType()) {
+ return this.environment.createRawType((ReferenceBinding)originalType, null);
+ } else if (originalType.isArrayType()) {
+ TypeBinding originalLeafComponentType = originalType.leafComponentType();
+ TypeBinding substitute = substitute(originalLeafComponentType); // substitute could itself be array type
+ if (substitute != originalLeafComponentType) {
+ return this.environment.createArrayType(substitute.leafComponentType(), substitute.dimensions() + originalType.dimensions());
+ }
+ }
+ return originalType;
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.Binding#shortReadableName()
+ */
+ public char[] shortReadableName() /*Object*/ {
+ char[] shortReadableName;
+ if (isMemberType()) {
+ shortReadableName = CharOperation.concat(this.type.enclosingType().shortReadableName(), sourceName, '.');
+ } else {
+ shortReadableName = this.type.sourceName;
+ }
+ return shortReadableName;
+ }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
index 6cda282e33..98a4549a31 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
@@ -194,6 +194,8 @@ public void computeId() {
if (!CharOperation.equals(LANG, compoundName[1])) {
if (CharOperation.equals(JAVA_IO_PRINTSTREAM, compoundName))
id = T_JavaIoPrintStream;
+ else if (CharOperation.equals(JAVA_UTIL_ITERATOR, compoundName))
+ id = T_JavaUtilIterator;
else if (CharOperation.equals(JAVA_IO_SERIALIZABLE, compoundName))
id = T_JavaIoSerializable;
return;
@@ -240,6 +242,8 @@ public void computeId() {
case 'I' :
if (CharOperation.equals(typeName, JAVA_LANG_INTEGER[2]))
id = T_JavaLangInteger;
+ else if (CharOperation.equals(typeName, JAVA_LANG_ITERABLE[2]))
+ id = T_JavaLangIterable;
return;
case 'L' :
if (CharOperation.equals(typeName, JAVA_LANG_LONG[2]))
@@ -258,6 +262,8 @@ public void computeId() {
id = T_JavaLangString;
else if (CharOperation.equals(typeName, JAVA_LANG_STRINGBUFFER[2]))
id = T_JavaLangStringBuffer;
+ else if (CharOperation.equals(typeName, JAVA_LANG_STRINGBUILDER[2]))
+ id = T_JavaLangStringBuilder;
else if (CharOperation.equals(typeName, JAVA_LANG_SYSTEM[2]))
id = T_JavaLangSystem;
else if (CharOperation.equals(typeName, JAVA_LANG_SHORT[2]))
@@ -282,7 +288,7 @@ public char[] constantPoolName() /* java/lang/Object */ {
if (constantPoolName != null) return constantPoolName;
return constantPoolName = CharOperation.concatWith(compoundName, '/');
}
-String debugName() {
+public String debugName() {
return (compoundName != null) ? new String(readableName()) : "UNNAMED TYPE"; //$NON-NLS-1$
}
public final int depth() {
@@ -304,12 +310,55 @@ public final ReferenceBinding enclosingTypeAt(int relativeDepth) {
current = current.enclosingType();
return current;
}
+
public int fieldCount() {
return fields().length;
}
public FieldBinding[] fields() {
return NoFields;
}
+
+/**
+ * Find supertype which erases to a given type, or null if not found
+ */
+public ReferenceBinding findSuperTypeErasingTo(ReferenceBinding erasure) {
+
+ if (erasure() == erasure) return this;
+ ReferenceBinding currentType = this;
+ if (erasure.isClass()) {
+ while ((currentType = currentType.superclass()) != null) {
+ if (currentType.erasure() == erasure) return currentType;
+ }
+ return null;
+ }
+ ReferenceBinding[][] interfacesToVisit = new ReferenceBinding[5][];
+ int lastPosition = -1;
+ do {
+ ReferenceBinding[] itsInterfaces = currentType.superInterfaces();
+ if (itsInterfaces != NoSuperInterfaces) {
+ if (++lastPosition == interfacesToVisit.length)
+ System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[lastPosition * 2][], 0, lastPosition);
+ interfacesToVisit[lastPosition] = itsInterfaces;
+ }
+ } while ((currentType = currentType.superclass()) != null);
+
+ for (int i = 0; i <= lastPosition; i++) {
+ ReferenceBinding[] interfaces = interfacesToVisit[i];
+ for (int j = 0, length = interfaces.length; j < length; j++) {
+ if ((currentType = interfaces[j]).erasure() == erasure)
+ return currentType;
+
+ ReferenceBinding[] itsInterfaces = currentType.superInterfaces();
+ if (itsInterfaces != NoSuperInterfaces) {
+ if (++lastPosition == interfacesToVisit.length)
+ System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[lastPosition * 2][], 0, lastPosition);
+ interfacesToVisit[lastPosition] = itsInterfaces;
+ }
+ }
+ }
+ return null;
+}
+
public final int getAccessFlags() {
return modifiers & AccJustFlag;
}
@@ -352,6 +401,21 @@ public PackageBinding getPackage() {
public boolean hasMemberTypes() {
return false;
}
+public TypeVariableBinding getTypeVariable(char[] variableName) {
+ TypeVariableBinding[] typeVariables = typeVariables();
+ for (int i = typeVariables.length; --i >= 0;)
+ if (CharOperation.equals(typeVariables[i].sourceName, variableName))
+ return typeVariables[i];
+ return null;
+}
+public int hashCode() {
+ // ensure ReferenceBindings hash to the same posiiton as UnresolvedReferenceBindings so they can be replaced without rehashing
+ // ALL ReferenceBindings are unique when created so equals() is the same as ==
+ return (this.compoundName == null || this.compoundName.length == 0)
+ ? super.hashCode()
+ : CharOperation.hashCode(this.compoundName[this.compoundName.length - 1]);
+}
+
/* Answer true if the receiver implements anInterface or is identical to anInterface.
* If searchHierarchy is true, then also search the receiver's superclasses.
*
@@ -377,7 +441,7 @@ public boolean implementsInterface(ReferenceBinding anInterface, boolean searchH
for (int i = 0; i <= lastPosition; i++) {
ReferenceBinding[] interfaces = interfacesToVisit[i];
for (int j = 0, length = interfaces.length; j < length; j++) {
- if ((currentType = interfaces[j]) == anInterface)
+ if ((currentType = interfaces[j]).isEquivalentTo(anInterface))
return true;
ReferenceBinding[] itsInterfaces = currentType.superInterfaces();
@@ -415,26 +479,35 @@ public final boolean isAnonymousType() {
public final boolean isBinaryBinding() {
return (tagBits & IsBinaryBinding) != 0;
}
-public final boolean isClass() {
+public boolean isClass() {
return (modifiers & AccInterface) == 0;
}
+/*
+ * Returns true if the type hierarchy is being connected
+ */
+public boolean isHierarchyBeingConnected() {
+ return (this.tagBits & EndHierarchyCheck) == 0 && (this.tagBits & BeginHierarchyCheck) != 0;
+}
/* Answer true if the receiver type can be assigned to the argument type (right)
*/
-
-public boolean isCompatibleWith(TypeBinding right) {
- if (right == this)
+public boolean isCompatibleWith(TypeBinding otherType) {
+
+ if (otherType == this)
return true;
- if (right.id == T_Object)
+ if (otherType.id == T_Object)
return true;
- if (!(right instanceof ReferenceBinding))
+ if (!(otherType instanceof ReferenceBinding))
return false;
-
- ReferenceBinding referenceBinding = (ReferenceBinding) right;
- if (referenceBinding.isInterface())
- return implementsInterface(referenceBinding, true);
+ ReferenceBinding otherReferenceType = (ReferenceBinding) otherType;
+ if (this.isEquivalentTo(otherReferenceType)) return true;
+ if (otherReferenceType.isWildcard()) {
+ return ((WildcardBinding) otherReferenceType).boundCheck(this);
+ }
+ if (otherReferenceType.isInterface())
+ return implementsInterface(otherReferenceType, true);
if (isInterface()) // Explicit conversion from an interface to a class is not allowed
return false;
- return referenceBinding.isSuperclassOf(this);
+ return otherReferenceType.isSuperclassOf(this);
}
/* Answer true if the receiver has default visibility
*/
@@ -450,22 +523,13 @@ public final boolean isDeprecated() {
}
/* Answer true if the receiver is final and cannot be subclassed
*/
-
public final boolean isFinal() {
return (modifiers & AccFinal) != 0;
}
-public final boolean isInterface() {
+public boolean isInterface() {
return (modifiers & AccInterface) != 0;
}
-public final boolean isLocalType() {
- return (tagBits & IsLocalType) != 0;
-}
-public final boolean isMemberType() {
- return (tagBits & IsMemberType) != 0;
-}
-public final boolean isNestedType() {
- return (tagBits & IsNestedType) != 0;
-}
+
/* Answer true if the receiver has private visibility
*/
@@ -508,13 +572,13 @@ public final boolean isStrictfp() {
* NOTE: Object.isSuperclassOf(Object) -> false
*/
-public boolean isSuperclassOf(ReferenceBinding type) {
- do {
- if (this == (type = type.superclass())) return true;
- } while (type != null);
-
+public boolean isSuperclassOf(ReferenceBinding otherType) {
+ while ((otherType = otherType.superclass()) != null) {
+ if (this.isEquivalentTo(otherType)) return true;
+ }
return false;
}
+
/* Answer true if the receiver is deprecated (or any of its enclosing types)
*/
@@ -540,16 +604,50 @@ public char[] qualifiedSourceName() {
return sourceName();
}
-public char[] readableName() /*java.lang.Object*/ {
- if (isMemberType())
- return CharOperation.concat(enclosingType().readableName(), sourceName, '.');
- return CharOperation.concatWith(compoundName, '.');
+public char[] readableName() /*java.lang.Object, p.X<T> */ {
+ char[] readableName;
+ if (isMemberType()) {
+ readableName = CharOperation.concat(enclosingType().readableName(), sourceName, '.');
+ } else {
+ readableName = CharOperation.concatWith(compoundName, '.');
+ }
+ TypeVariableBinding[] typeVars;
+ if ((typeVars = this.typeVariables()) != NoTypeVariables) {
+ StringBuffer nameBuffer = new StringBuffer(10);
+ nameBuffer.append(readableName).append('<');
+ for (int i = 0, length = typeVars.length; i < length; i++) {
+ if (i > 0) nameBuffer.append(',');
+ nameBuffer.append(typeVars[i].readableName());
+ }
+ nameBuffer.append('>');
+ int nameLength = nameBuffer.length();
+ readableName = new char[nameLength];
+ nameBuffer.getChars(0, nameLength, readableName, 0);
+ }
+ return readableName;
}
public char[] shortReadableName() /*Object*/ {
- if (isMemberType())
- return CharOperation.concat(enclosingType().shortReadableName(), sourceName, '.');
- return sourceName;
+ char[] shortReadableName;
+ if (isMemberType()) {
+ shortReadableName = CharOperation.concat(enclosingType().shortReadableName(), sourceName, '.');
+ } else {
+ shortReadableName = this.sourceName;
+ }
+ TypeVariableBinding[] typeVars;
+ if ((typeVars = this.typeVariables()) != NoTypeVariables) {
+ StringBuffer nameBuffer = new StringBuffer(10);
+ nameBuffer.append(shortReadableName).append('<');
+ for (int i = 0, length = typeVars.length; i < length; i++) {
+ if (i > 0) nameBuffer.append(',');
+ nameBuffer.append(typeVars[i].shortReadableName());
+ }
+ nameBuffer.append('>');
+ int nameLength = nameBuffer.length();
+ shortReadableName = new char[nameLength];
+ nameBuffer.getChars(0, nameLength, shortReadableName, 0);
+ }
+ return shortReadableName;
}
/* Answer the receiver's signature.
@@ -566,6 +664,7 @@ public char[] signature() /* Ljava/lang/Object; */ {
public char[] sourceName() {
return sourceName;
}
+
public ReferenceBinding superclass() {
return null;
}
@@ -583,6 +682,11 @@ public ReferenceBinding[] syntheticEnclosingInstanceTypes() {
public SyntheticArgumentBinding[] syntheticOuterLocalVariables() {
return null; // is null if no enclosing instances are required
}
+
+public TypeVariableBinding[] typeVariables() {
+ return NoTypeVariables;
+}
+
MethodBinding[] unResolvedMethods() { // for the MethodVerifier so it doesn't resolve types
return methods();
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
index 335f9b15cb..0c546197c1 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
+import java.util.ArrayList;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ast.*;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
@@ -48,22 +49,6 @@ public abstract class Scope
return MoreGeneric;
return NotRelated;
}
-
- // Internal use only
- protected final boolean areParametersAssignable(TypeBinding[] parameters, TypeBinding[] arguments) {
- if (parameters == arguments)
- return true;
-
- int length = parameters.length;
- if (length != arguments.length)
- return false;
-
- for (int i = 0; i < length; i++)
- if (parameters[i] != arguments[i])
- if (!arguments[i].isCompatibleWith(parameters[i]))
- return false;
- return true;
- }
public final ClassScope classScope() {
Scope scope = this;
@@ -97,10 +82,205 @@ public abstract class Scope
return (CompilationUnitScope) lastScope;
}
- public ArrayBinding createArray(TypeBinding type, int dimension) {
- if (!type.isValidBinding())
- return new ArrayBinding(type, dimension);
- return environment().createArrayType(type, dimension);
+ /**
+ * Internal use only
+ * Given a method, returns null if arguments cannot be converted to parameters.
+ * Will answer a subsituted method in case the method was generic and type inference got triggered;
+ * in case the method was originally compatible, then simply answer it back.
+ */
+ protected final MethodBinding computeCompatibleMethod(MethodBinding method, TypeBinding[] arguments, InvocationSite invocationSite) {
+
+ TypeBinding[] genericTypeArguments = invocationSite.genericTypeArguments();
+ TypeBinding[] parameters = method.parameters;
+ if (parameters == arguments
+ && (method.returnType.tagBits & HasTypeVariable) == 0
+ && genericTypeArguments == null)
+ return method;
+
+ int argLength = arguments.length;
+ if (argLength != parameters.length)
+ return null; // incompatible
+
+ TypeVariableBinding[] typeVariables = method.typeVariables;
+ if (typeVariables != NoTypeVariables) { // generic method
+ method = ParameterizedGenericMethodBinding.computeCompatibleMethod(method, arguments, this, invocationSite);
+ if (method == null) return null; // incompatible
+ if (!method.isValidBinding()) return method; // bound check issue is taking precedence
+ parameters = method.parameters; // reacquire them after type inference has performed
+ } else if (genericTypeArguments != null && !(method instanceof ParameterizedGenericMethodBinding)) {
+ return new ProblemMethodBinding(method, method.selector, genericTypeArguments, TypeParameterArityMismatch);
+ }
+
+ argumentCompatibility: {
+ for (int i = 0; i < argLength; i++)
+ if (parameters[i] != arguments[i] && !arguments[i].isCompatibleWith(parameters[i]))
+ break argumentCompatibility;
+ return method; // compatible
+ }
+ if (genericTypeArguments != null) {
+ return new ProblemMethodBinding(method, method.selector, arguments, ParameterizedMethodTypeMismatch);
+ }
+ return null; // incompatible
+ }
+
+ protected boolean connectTypeVariables(TypeParameter[] typeParameters) {
+ boolean noProblems = true;
+ if (typeParameters == null || environment().options.sourceLevel < ClassFileConstants.JDK1_5) return true;
+ nextVariable : for (int i = 0, paramLength = typeParameters.length; i < paramLength; i++) {
+ TypeParameter typeParameter = typeParameters[i];
+ TypeVariableBinding typeVariable = typeParameter.binding;
+ if (typeVariable == null) return false;
+
+ typeVariable.superclass = getJavaLangObject();
+ typeVariable.superInterfaces = NoSuperInterfaces;
+ // set firstBound to the binding of the first explicit bound in parameter declaration
+ typeVariable.firstBound = null; // first bound used to compute erasure
+
+ TypeReference typeRef = typeParameter.type;
+ if (typeRef == null)
+ continue nextVariable;
+ ReferenceBinding superType = this.kind == METHOD_SCOPE
+ ? (ReferenceBinding) typeRef.resolveType((BlockScope)this)
+ : (ReferenceBinding) typeRef.resolveType((ClassScope)this);
+ if (superType == null) {
+ typeVariable.tagBits |= HierarchyHasProblems;
+ noProblems = false;
+ continue nextVariable;
+ }
+ if (superType.isTypeVariable()) {
+ TypeVariableBinding varSuperType = (TypeVariableBinding) superType;
+ if (varSuperType.rank >= typeVariable.rank) {
+ problemReporter().forwardTypeVariableReference(typeParameter, varSuperType);
+ typeVariable.tagBits |= HierarchyHasProblems;
+ noProblems = false;
+ continue nextVariable;
+ }
+ }
+ if (superType.isFinal()) {
+ problemReporter().finalVariableBound(typeVariable, typeRef);
+ }
+ typeRef.resolvedType = superType; // hold onto the problem type
+ if (superType.isClass()) {
+ typeVariable.superclass = superType;
+ } else {
+ typeVariable.superInterfaces = new ReferenceBinding[] {superType};
+ typeVariable.modifiers |= AccInterface;
+ }
+ typeVariable.firstBound = superType; // first bound used to compute erasure
+
+ TypeReference[] boundRefs = typeParameter.bounds;
+ if (boundRefs != null) {
+ for (int j = 0, k = boundRefs.length; j < k; j++) {
+ typeRef = boundRefs[j];
+ superType = this.kind == METHOD_SCOPE
+ ? (ReferenceBinding) typeRef.resolveType((BlockScope)this)
+ : (ReferenceBinding) typeRef.resolveType((ClassScope)this);
+ if (superType == null) {
+ typeVariable.tagBits |= HierarchyHasProblems;
+ noProblems = false;
+ continue nextVariable;
+ }
+ typeRef.resolvedType = superType; // hold onto the problem type
+ if (superType.isClass()) {
+ problemReporter().boundsMustBeAnInterface(typeRef, superType);
+ typeVariable.tagBits |= HierarchyHasProblems;
+ noProblems = false;
+ continue nextVariable;
+ }
+ int size = typeVariable.superInterfaces.length;
+ System.arraycopy(typeVariable.superInterfaces, 0, typeVariable.superInterfaces = new ReferenceBinding[size + 1], 0, size);
+ typeVariable.superInterfaces[size] = superType;
+ }
+ }
+ }
+ return noProblems;
+ }
+
+ public TypeVariableBinding[] createTypeVariables(TypeParameter[] typeParameters, Binding declaringElement) {
+
+ PackageBinding unitPackage = compilationUnitScope().fPackage;
+
+ // do not construct type variables if source < 1.5
+ if (typeParameters == null || environment().options.sourceLevel < ClassFileConstants.JDK1_5) {
+ return NoTypeVariables;
+ }
+ TypeVariableBinding[] typeVariableBindings = NoTypeVariables;
+
+ int length = typeParameters.length;
+ typeVariableBindings = new TypeVariableBinding[length];
+ HashtableOfObject knownTypeParameterNames = new HashtableOfObject(length);
+ int count = 0;
+ nextParameter : for (int i = 0; i < length; i++) {
+ TypeParameter typeParameter = typeParameters[i];
+ TypeVariableBinding parameterBinding = new TypeVariableBinding(typeParameter.name, declaringElement, i);
+ parameterBinding.fPackage = unitPackage;
+ typeParameter.binding = parameterBinding;
+
+ if (knownTypeParameterNames.containsKey(typeParameter.name)) {
+ TypeVariableBinding previousBinding = (TypeVariableBinding) knownTypeParameterNames.get(typeParameter.name);
+ if (previousBinding != null) {
+ for (int j = 0; j < i; j++) {
+ TypeParameter previousParameter = typeParameters[j];
+ if (previousParameter.binding == previousBinding) {
+ problemReporter().duplicateTypeParameterInType(previousParameter);
+ previousParameter.binding = null;
+ break;
+ }
+ }
+ }
+ knownTypeParameterNames.put(typeParameter.name, null); // ensure that the duplicate parameter is found & removed
+ problemReporter().duplicateTypeParameterInType(typeParameter);
+ typeParameter.binding = null;
+ } else {
+ knownTypeParameterNames.put(typeParameter.name, parameterBinding);
+ // remember that we have seen a field with this name
+ if (parameterBinding != null)
+ typeVariableBindings[count++] = parameterBinding;
+ }
+// TODO should offer warnings to inform about hiding declaring, enclosing or member types
+// ReferenceBinding type = sourceType;
+// // check that the member does not conflict with an enclosing type
+// do {
+// if (CharOperation.equals(type.sourceName, memberContext.name)) {
+// problemReporter().hidingEnclosingType(memberContext);
+// continue nextParameter;
+// }
+// type = type.enclosingType();
+// } while (type != null);
+// // check that the member type does not conflict with another sibling member type
+// for (int j = 0; j < i; j++) {
+// if (CharOperation.equals(referenceContext.memberTypes[j].name, memberContext.name)) {
+// problemReporter().duplicateNestedType(memberContext);
+// continue nextParameter;
+// }
+// }
+ }
+ if (count != length) {
+ System.arraycopy(typeVariableBindings, 0, typeVariableBindings = new TypeVariableBinding[count], 0, count);
+ }
+ return typeVariableBindings;
+ }
+
+ public ArrayBinding createArrayType(TypeBinding type, int dimension) {
+ if (type.isValidBinding() && !type.isParameterizedType())
+ return environment().createArrayType(type, dimension);
+ // do not cache obvious invalid types
+ return new ArrayBinding(type, dimension, environment());
+ }
+
+ public ParameterizedTypeBinding createParameterizedType(ReferenceBinding genericType, TypeBinding[] arguments, ReferenceBinding enclosingType) {
+ valid: {
+ if (!genericType.isValidBinding()) break valid;
+ for (int i = 0, max = arguments == null ? 0 : arguments.length; i < max; i++){
+ if (!arguments[i].isValidBinding()) break valid;
+ }
+ return environment().createParameterizedType(genericType, arguments, enclosingType);
+ }
+ return new ParameterizedTypeBinding(genericType, arguments, enclosingType, environment());
+ }
+
+ public boolean detectCycle(ReferenceBinding superType) {
+ return false;
}
public final ClassScope enclosingClassScope() {
@@ -182,17 +362,25 @@ public abstract class Scope
}
MethodBinding[] candidates = new MethodBinding[foundSize - startFoundSize];
int candidatesCount = 0;
+ MethodBinding problemMethod = null;
// argument type compatibility check
for (int i = startFoundSize; i < foundSize; i++) {
MethodBinding methodBinding = (MethodBinding) found.elementAt(i);
- if (areParametersAssignable(methodBinding.parameters, argumentTypes))
- candidates[candidatesCount++] = methodBinding;
+ MethodBinding compatibleMethod = computeCompatibleMethod(methodBinding, argumentTypes, invocationSite);
+ if (compatibleMethod != null) {
+ if (compatibleMethod.isValidBinding())
+ candidates[candidatesCount++] = compatibleMethod;
+ else if (problemMethod == null)
+ problemMethod = compatibleMethod;
+ }
}
+
if (candidatesCount == 1) {
compilationUnitScope().recordTypeReferences(candidates[0].thrownExceptions);
return candidates[0];
}
if (candidatesCount == 0) { // try to find a close match when the parameter order is wrong or missing some parameters
+ if (problemMethod != null) return problemMethod;
int argLength = argumentTypes.length;
nextMethod : for (int i = 0; i < foundSize; i++) {
MethodBinding methodBinding = (MethodBinding) found.elementAt(i);
@@ -210,7 +398,7 @@ public abstract class Scope
return (MethodBinding) found.elementAt(0); // no good match so just use the first one found
}
// no need to check for visibility - interface methods are public
- return mostSpecificInterfaceMethodBinding(candidates, candidatesCount);
+ return mostSpecificInterfaceMethodBinding(candidates, candidatesCount, invocationSite);
}
// Internal use only
@@ -219,7 +407,7 @@ public abstract class Scope
return null; // know it has no member types (nor inherited member types)
SourceTypeBinding enclosingSourceType = enclosingSourceType();
- compilationUnitScope().recordReference(enclosingType.compoundName, typeName);
+ compilationUnitScope().recordReference(enclosingType, typeName);
ReferenceBinding memberType = enclosingType.getMemberType(typeName);
if (memberType != null) {
compilationUnitScope().recordTypeReference(memberType); // to record supertypes
@@ -245,8 +433,19 @@ public abstract class Scope
MethodBinding exactMethod = receiverType.getExactMethod(selector, argumentTypes);
if (exactMethod != null) {
compilationUnitScope().recordTypeReferences(exactMethod.thrownExceptions);
- if (receiverType.isInterface() || exactMethod.canBeSeenBy(receiverType, invocationSite, this))
+ // special treatment for Object.getClass() in 1.5 mode (substitute parameterized return type)
+ if (receiverType.isInterface() || exactMethod.canBeSeenBy(receiverType, invocationSite, this)) {
+ if (receiverType.id != T_Object
+ && argumentTypes == NoParameters
+ && CharOperation.equals(selector, GETCLASS)
+ && exactMethod.returnType.isParameterizedType()/*1.5*/) {
+ return ParameterizedMethodBinding.instantiateGetClass(receiverType, exactMethod, this);
+ }
+ // targeting a generic method could find an exact match with variable return type
+ if (exactMethod.typeVariables != NoTypeVariables || invocationSite.genericTypeArguments() != null)
+ exactMethod = computeCompatibleMethod(exactMethod, argumentTypes, invocationSite);
return exactMethod;
+ }
}
return null;
}
@@ -382,7 +581,7 @@ public abstract class Scope
SourceTypeBinding enclosingSourceType = enclosingSourceType();
PackageBinding currentPackage = getCurrentPackage();
- compilationUnitScope().recordReference(enclosingType.compoundName, typeName);
+ compilationUnitScope().recordReference(enclosingType, typeName);
ReferenceBinding memberType = enclosingType.getMemberType(typeName);
if (memberType != null) {
compilationUnitScope().recordTypeReference(memberType); // to record supertypes
@@ -418,7 +617,7 @@ public abstract class Scope
if ((currentType = currentType.superclass()) == null)
break;
- compilationUnitScope().recordReference(currentType.compoundName, typeName);
+ compilationUnitScope().recordReference(currentType, typeName);
if ((memberType = currentType.getMemberType(typeName)) != null) {
compilationUnitScope().recordTypeReference(memberType); // to record supertypes
keepLooking = false;
@@ -444,7 +643,7 @@ public abstract class Scope
if ((anInterface.tagBits & InterfaceVisited) == 0) {
// if interface as not already been visited
anInterface.tagBits |= InterfaceVisited;
- compilationUnitScope().recordReference(anInterface.compoundName, typeName);
+ compilationUnitScope().recordReference(anInterface, typeName);
if ((memberType = anInterface.getMemberType(typeName)) != null) {
compilationUnitScope().recordTypeReference(memberType); // to record supertypes
if (visibleMemberType == null) {
@@ -495,7 +694,7 @@ public abstract class Scope
ReferenceBinding currentType = receiverType;
MethodBinding matchingMethod = null;
- ObjectVector found = new ObjectVector(); //TODO should rewrite to remove #matchingMethod since found is allocated anyway
+ ObjectVector found = new ObjectVector(); //TODO (kent) should rewrite to remove #matchingMethod since found is allocated anyway
faultInReceiverType(receiverType);
compilationUnitScope().recordTypeReference(receiverType);
@@ -573,41 +772,65 @@ public abstract class Scope
MethodBinding[] candidates = null;
int candidatesCount = 0;
boolean checkedMatchingMethod = false; // is matchingMethod meeting argument expectation ?
+ MethodBinding problemMethod = null;
if (foundSize > 0) {
// argument type compatibility check
for (int i = 0; i < foundSize; i++) {
MethodBinding methodBinding = (MethodBinding) found.elementAt(i);
- if (areParametersAssignable(methodBinding.parameters, argumentTypes)) {
- switch (candidatesCount) {
- case 0:
- matchingMethod = methodBinding; // if only one match, reuse matchingMethod
- checkedMatchingMethod = true; // matchingMethod is known to exist and match params here
- break;
- case 1:
- candidates = new MethodBinding[foundSize]; // only lazily created if more than one match
- candidates[0] = matchingMethod; // copy back
- matchingMethod = null;
- // fall through
- default:
- candidates[candidatesCount] = methodBinding;
+ MethodBinding compatibleMethod = computeCompatibleMethod(methodBinding, argumentTypes, invocationSite);
+ if (compatibleMethod != null) {
+ if (compatibleMethod.isValidBinding()) {
+ switch (candidatesCount) {
+ case 0:
+ matchingMethod = compatibleMethod; // if only one match, reuse matchingMethod
+ checkedMatchingMethod = true; // matchingMethod is known to exist and match params here
+ break;
+ case 1:
+ candidates = new MethodBinding[foundSize]; // only lazily created if more than one match
+ candidates[0] = matchingMethod; // copy back
+ matchingMethod = null;
+ // fall through
+ default:
+ candidates[candidatesCount] = compatibleMethod;
+ }
+ candidatesCount++;
+ } else if (problemMethod == null) {
+ problemMethod = compatibleMethod;
}
- candidatesCount++;
}
}
}
+ if (candidatesCount > 0)
+ problemMethod = null; // forget the problem method if candidates were found
+
// if only one matching method left (either from start or due to elimination of rivals), then match is in matchingMethod
if (matchingMethod != null) {
- if (checkedMatchingMethod || areParametersAssignable(matchingMethod.parameters, argumentTypes)) {
+ if (!checkedMatchingMethod) {
+ MethodBinding compatibleMethod = computeCompatibleMethod(matchingMethod, argumentTypes, invocationSite);
+ if (compatibleMethod != null) {
+ if (compatibleMethod.isValidBinding()) {
+ matchingMethod = compatibleMethod;
+ checkedMatchingMethod = true;
+ } else {
+ problemMethod = compatibleMethod;
+ }
+ }
+ }
+ if (checkedMatchingMethod) {
// (if no default abstract) must explicitly look for one instead, which could be a better match
if (!matchingMethod.canBeSeenBy(receiverType, invocationSite, this)) {
// ignore matching method (to be consistent with multiple matches, none visible (matching method is then null)
- MethodBinding interfaceMethod = findDefaultAbstractMethod(receiverType, selector, argumentTypes, invocationSite, classHierarchyStart, null, found);
+ MethodBinding interfaceMethod =
+ findDefaultAbstractMethod(receiverType, selector, argumentTypes, invocationSite, classHierarchyStart, null, found);
if (interfaceMethod != null) return interfaceMethod;
compilationUnitScope().recordTypeReferences(matchingMethod.thrownExceptions);
return matchingMethod;
}
}
- return findDefaultAbstractMethod(receiverType, selector, argumentTypes, invocationSite, classHierarchyStart, matchingMethod, found);
+ matchingMethod =
+ findDefaultAbstractMethod(receiverType, selector, argumentTypes, invocationSite, classHierarchyStart, matchingMethod, found);
+ if (matchingMethod != null) return matchingMethod;
+ return problemMethod;
}
// no match was found, try to find a close match when the parameter order is wrong or missing some parameters
@@ -615,6 +838,7 @@ public abstract class Scope
MethodBinding interfaceMethod =
findDefaultAbstractMethod(receiverType, selector, argumentTypes, invocationSite, classHierarchyStart, matchingMethod, found);
if (interfaceMethod != null) return interfaceMethod;
+ if (problemMethod != null) return problemMethod;
int argLength = argumentTypes.length;
foundSize = found.size;
@@ -634,6 +858,17 @@ public abstract class Scope
return (MethodBinding) found.elementAt(0); // no good match so just use the first one found
}
+ // check for duplicate parameterized methods
+ if (compilationUnitScope().environment.options.sourceLevel >= ClassFileConstants.JDK1_5) {
+ for (int i = 0; i < candidatesCount; i++) {
+ MethodBinding current = candidates[i];
+ if (current instanceof ParameterizedMethodBinding)
+ for (int j = i + 1; j < candidatesCount; j++)
+ if (current.declaringClass == candidates[j].declaringClass && current.areParametersEqual(candidates[j]))
+ return new ProblemMethodBinding(candidates[i].selector, candidates[i].parameters, Ambiguous);
+ }
+ }
+
// tiebreak using visibility check
int visiblesCount = 0;
for (int i = 0; i < candidatesCount; i++) {
@@ -657,10 +892,10 @@ public abstract class Scope
return new ProblemMethodBinding(candidates[0], candidates[0].selector, candidates[0].parameters, NotVisible);
}
if (isCompliant14)
- return mostSpecificMethodBinding(candidates, visiblesCount);
+ return mostSpecificMethodBinding(candidates, visiblesCount, invocationSite);
return candidates[0].declaringClass.isClass()
- ? mostSpecificClassMethodBinding(candidates, visiblesCount)
- : mostSpecificInterfaceMethodBinding(candidates, visiblesCount);
+ ? mostSpecificClassMethodBinding(candidates, visiblesCount, invocationSite)
+ : mostSpecificInterfaceMethodBinding(candidates, visiblesCount, invocationSite);
}
// Internal use only
@@ -680,15 +915,26 @@ public abstract class Scope
MethodBinding methodBinding = object.getExactMethod(selector, argumentTypes);
if (methodBinding != null) {
// handle the method clone() specially... cannot be protected or throw exceptions
- if (argumentTypes == NoParameters && CharOperation.equals(selector, CLONE))
- return new UpdatedMethodBinding(
- environment().options.targetJDK >= ClassFileConstants.JDK1_4 ? (TypeBinding)receiverType : (TypeBinding)object, // remember its array type for codegen purpose on target>=1.4.0
- (methodBinding.modifiers ^ AccProtected) | AccPublic,
- CLONE,
- methodBinding.returnType,
- argumentTypes,
- null,
- object);
+ if (argumentTypes == NoParameters) {
+ switch (selector[0]) {
+ case 'c':
+ if (CharOperation.equals(selector, CLONE))
+ return new UpdatedMethodBinding(
+ environment().options.targetJDK >= ClassFileConstants.JDK1_4 ? (TypeBinding)receiverType : (TypeBinding)object, // remember its array type for codegen purpose on target>=1.4.0
+ (methodBinding.modifiers ^ AccProtected) | AccPublic,
+ CLONE,
+ methodBinding.returnType,
+ argumentTypes,
+ null,
+ object);
+ break;
+ case 'g':
+ if (CharOperation.equals(selector, GETCLASS) && methodBinding.returnType.isParameterizedType()/*1.5*/) {
+ return ParameterizedMethodBinding.instantiateGetClass(receiverType, methodBinding, this);
+ }
+ break;
+ }
+ }
if (methodBinding.canBeSeenBy(receiverType, invocationSite, this))
return methodBinding;
}
@@ -697,18 +943,15 @@ public abstract class Scope
if (methodBinding == null)
return new ProblemMethodBinding(selector, argumentTypes, NotFound);
if (methodBinding.isValidBinding()) {
- if (!areParametersAssignable(methodBinding.parameters, argumentTypes))
- return new ProblemMethodBinding(
- methodBinding,
- selector,
- argumentTypes,
- NotFound);
+ MethodBinding compatibleMethod = computeCompatibleMethod(methodBinding, argumentTypes, invocationSite);
+ if (compatibleMethod == null)
+ return new ProblemMethodBinding(methodBinding, selector, argumentTypes, NotFound);
+ if (!compatibleMethod.isValidBinding())
+ return compatibleMethod;
+
+ methodBinding = compatibleMethod;
if (!methodBinding.canBeSeenBy(receiverType, invocationSite, this))
- return new ProblemMethodBinding(
- methodBinding,
- selector,
- methodBinding.parameters,
- NotVisible);
+ return new ProblemMethodBinding(methodBinding, selector, methodBinding.parameters, NotVisible);
}
return methodBinding;
}
@@ -858,7 +1101,7 @@ public abstract class Scope
}
/* API
- *
+ *
* Answer the binding that corresponds to the argument name.
* flag is a mask of the following values VARIABLE (= FIELD or LOCAL), TYPE, PACKAGE.
* Only bindings corresponding to the mask can be answered.
@@ -877,7 +1120,7 @@ public abstract class Scope
* Limitations: cannot request FIELD independently of LOCAL, or vice versa
*/
public Binding getBinding(char[] name, int mask, InvocationSite invocationSite, boolean needResolve) {
-
+
try {
Binding binding = null;
FieldBinding problemField = null;
@@ -1032,7 +1275,6 @@ public abstract class Scope
}
if (problemField != null) return problemField;
return new ProblemBinding(name, enclosingSourceType(), NotFound);
-
} catch (AbortCompilation e) {
e.updateContext(invocationSite, referenceCompilationUnit().compilationResult);
throw e;
@@ -1045,8 +1287,12 @@ public abstract class Scope
compilationUnitScope().recordTypeReference(receiverType);
compilationUnitScope().recordTypeReferences(argumentTypes);
MethodBinding methodBinding = receiverType.getExactConstructor(argumentTypes);
- if (methodBinding != null && methodBinding.canBeSeenBy(invocationSite, this))
+ if (methodBinding != null && methodBinding.canBeSeenBy(invocationSite, this)) {
+ // targeting a non generic constructor with type arguments ?
+ if (invocationSite.genericTypeArguments() != null)
+ methodBinding = computeCompatibleMethod(methodBinding, argumentTypes, invocationSite);
return methodBinding;
+ }
MethodBinding[] methods = receiverType.getMethods(ConstructorDeclaration.ConstantPoolName);
if (methods == NoMethods)
return new ProblemMethodBinding(
@@ -1056,14 +1302,21 @@ public abstract class Scope
MethodBinding[] compatible = new MethodBinding[methods.length];
int compatibleIndex = 0;
- for (int i = 0, length = methods.length; i < length; i++)
- if (areParametersAssignable(methods[i].parameters, argumentTypes))
- compatible[compatibleIndex++] = methods[i];
- if (compatibleIndex == 0)
- return new ProblemMethodBinding(
- ConstructorDeclaration.ConstantPoolName,
- argumentTypes,
- NotFound);
+ MethodBinding problemMethod = null;
+ for (int i = 0, length = methods.length; i < length; i++) {
+ MethodBinding compatibleMethod = computeCompatibleMethod(methods[i], argumentTypes, invocationSite);
+ if (compatibleMethod != null) {
+ if (compatibleMethod.isValidBinding())
+ compatible[compatibleIndex++] = compatibleMethod;
+ else if (problemMethod == null)
+ problemMethod = compatibleMethod;
+ }
+ }
+ if (compatibleIndex == 0) {
+ if (problemMethod == null)
+ return new ProblemMethodBinding(ConstructorDeclaration.ConstantPoolName, argumentTypes, NotFound);
+ return problemMethod;
+ }
// need a more descriptive error... cannot convert from X to Y
MethodBinding[] visible = new MethodBinding[compatibleIndex];
@@ -1080,7 +1333,7 @@ public abstract class Scope
ConstructorDeclaration.ConstantPoolName,
compatible[0].parameters,
NotVisible);
- return mostSpecificClassMethodBinding(visible, visibleIndex);
+ return mostSpecificClassMethodBinding(visible, visibleIndex, invocationSite);
} catch (AbortCompilation e) {
e.updateContext(invocationSite, referenceCompilationUnit().compilationResult);
throw e;
@@ -1143,7 +1396,7 @@ public abstract class Scope
} catch (AbortCompilation e) {
e.updateContext(invocationSite, referenceCompilationUnit().compilationResult);
throw e;
- }
+ }
}
/* API
@@ -1159,17 +1412,14 @@ public abstract class Scope
*
* If no visible method is discovered, an error binding is answered.
*/
- public MethodBinding getImplicitMethod(
- char[] selector,
- TypeBinding[] argumentTypes,
- InvocationSite invocationSite) {
+ public MethodBinding getImplicitMethod(char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) {
boolean insideStaticContext = false;
boolean insideConstructorCall = false;
MethodBinding foundMethod = null;
- ProblemMethodBinding foundFuzzyProblem = null;
+ MethodBinding foundFuzzyProblem = null;
// the weird method lookup case (matches method name in scope, then arg types, then visibility)
- ProblemMethodBinding foundInsideProblem = null;
+ MethodBinding foundInsideProblem = null;
// inside Constructor call or inside static context
Scope scope = this;
int depth = 0;
@@ -1187,24 +1437,15 @@ public abstract class Scope
// retrieve an exact visible match (if possible)
MethodBinding methodBinding =
(foundMethod == null)
- ? classScope.findExactMethod(
- receiverType,
- selector,
- argumentTypes,
- invocationSite)
- : classScope.findExactMethod(
- receiverType,
- foundMethod.selector,
- foundMethod.parameters,
- invocationSite);
- // ? findExactMethod(receiverType, selector, argumentTypes, invocationSite)
- // : findExactMethod(receiverType, foundMethod.selector, foundMethod.parameters, invocationSite);
+ ? classScope.findExactMethod(receiverType, selector, argumentTypes, invocationSite)
+ : classScope.findExactMethod( receiverType, foundMethod.selector, foundMethod.parameters, invocationSite);
+ // ? findExactMethod(receiverType, selector, argumentTypes, invocationSite)
+ // : findExactMethod(receiverType, foundMethod.selector, foundMethod.parameters, invocationSite);
if (methodBinding == null) {
// answers closest approximation, may not check argumentTypes or visibility
isExactMatch = false;
- methodBinding =
- classScope.findMethod(receiverType, selector, argumentTypes, invocationSite);
- // methodBinding = findMethod(receiverType, selector, argumentTypes, invocationSite);
+ methodBinding = classScope.findMethod(receiverType, selector, argumentTypes, invocationSite);
+ // methodBinding = findMethod(receiverType, selector, argumentTypes, invocationSite);
}
if (methodBinding != null) { // skip it if we did not find anything
if (methodBinding.problemId() == Ambiguous) {
@@ -1219,26 +1460,25 @@ public abstract class Scope
argumentTypes,
InheritedNameHidesEnclosingName);
}
- ProblemMethodBinding fuzzyProblem = null;
- ProblemMethodBinding insideProblem = null;
+ MethodBinding fuzzyProblem = null;
+ MethodBinding insideProblem = null;
if (methodBinding.isValidBinding()) {
if (!isExactMatch) {
- if (!areParametersAssignable(methodBinding.parameters, argumentTypes)) {
- if (foundMethod == null || foundMethod.problemId() == NotVisible){
+ MethodBinding compatibleMethod = computeCompatibleMethod(methodBinding, argumentTypes, invocationSite);
+ if (compatibleMethod == null) {
+ if (foundMethod == null || foundMethod.problemId() == NotVisible)
// inherited mismatch is reported directly, not looking at enclosing matches
return new ProblemMethodBinding(methodBinding, selector, argumentTypes, NotFound);
- }
// make the user qualify the method, likely wants the first inherited method (javac generates an ambiguous error instead)
- fuzzyProblem = new ProblemMethodBinding(selector, methodBinding.parameters, InheritedNameHidesEnclosingName);
-
- } else if (!methodBinding.canBeSeenBy(receiverType, invocationSite, classScope)) {
- // using <classScope> instead of <this> for visibility check does grant all access to innerclass
- fuzzyProblem =
- new ProblemMethodBinding(
- methodBinding,
- selector,
- methodBinding.parameters,
- NotVisible);
+ fuzzyProblem = new ProblemMethodBinding(methodBinding, selector, methodBinding.parameters, InheritedNameHidesEnclosingName);
+ } else if (!compatibleMethod.isValidBinding()) {
+ fuzzyProblem = compatibleMethod;
+ } else {
+ methodBinding = compatibleMethod;
+ if (!methodBinding.canBeSeenBy(receiverType, invocationSite, classScope)) {
+ // using <classScope> instead of <this> for visibility check does grant all access to innerclass
+ fuzzyProblem = new ProblemMethodBinding(methodBinding, selector, methodBinding.parameters, NotVisible);
+ }
}
}
if (fuzzyProblem == null && !methodBinding.isStatic()) {
@@ -1371,7 +1611,22 @@ public abstract class Scope
problemReporter().isClassPathCorrect(JAVA_LANG_ERROR, referenceCompilationUnit());
return null; // will not get here since the above error aborts the compilation
}
-
+ public final ReferenceBinding getJavaLangIterable() {
+ compilationUnitScope().recordQualifiedReference(JAVA_LANG_ITERABLE);
+ ReferenceBinding type = environment().getType(JAVA_LANG_ITERABLE);
+ if (type != null) return type;
+
+ problemReporter().isClassPathCorrect(JAVA_LANG_ITERABLE, referenceCompilationUnit());
+ return null; // will not get here since the above error aborts the compilation
+ }
+ public final ReferenceBinding getJavaUtilIterator() {
+ compilationUnitScope().recordQualifiedReference(JAVA_UTIL_ITERATOR);
+ ReferenceBinding type = environment().getType(JAVA_UTIL_ITERATOR);
+ if (type != null) return type;
+
+ problemReporter().isClassPathCorrect(JAVA_UTIL_ITERATOR, referenceCompilationUnit());
+ return null; // will not get here since the above error aborts the compilation
+ }
public final ReferenceBinding getJavaLangObject() {
compilationUnitScope().recordQualifiedReference(JAVA_LANG_OBJECT);
ReferenceBinding type = environment().getType(JAVA_LANG_OBJECT);
@@ -1436,21 +1691,17 @@ public abstract class Scope
if (methodBinding == null)
return new ProblemMethodBinding(selector, argumentTypes, NotFound);
if (methodBinding.isValidBinding()) {
- if (!areParametersAssignable(methodBinding.parameters, argumentTypes))
- return new ProblemMethodBinding(
- methodBinding,
- selector,
- argumentTypes,
- NotFound);
+ MethodBinding compatibleMethod = computeCompatibleMethod(methodBinding, argumentTypes, invocationSite);
+ if (compatibleMethod == null)
+ return new ProblemMethodBinding(methodBinding, selector, argumentTypes, NotFound);
+ if (!compatibleMethod.isValidBinding())
+ return compatibleMethod;
+
+ methodBinding = compatibleMethod;
if (!methodBinding.canBeSeenBy(currentType, invocationSite, this))
- return new ProblemMethodBinding(
- methodBinding,
- selector,
- methodBinding.parameters,
- NotVisible);
+ return new ProblemMethodBinding( methodBinding, selector, methodBinding.parameters, NotVisible);
}
return methodBinding;
-
} catch (AbortCompilation e) {
e.updateContext(invocationSite, referenceCompilationUnit().compilationResult);
throw e;
@@ -1475,8 +1726,7 @@ public abstract class Scope
* NOTE: If a problem binding is returned, senders should extract the compound name
* from the binding & not assume the problem applies to the entire compoundName.
*/
- public final TypeBinding getType(char[][] compoundName) {
- int typeNameLength = compoundName.length;
+ public final TypeBinding getType(char[][] compoundName, int typeNameLength) {
if (typeNameLength == 1) {
// Would like to remove this test and require senders to specially handle base types
TypeBinding binding = getBaseType(compoundName[0]);
@@ -1544,150 +1794,181 @@ public abstract class Scope
return typeBinding;
}
- /* Internal use only
- */
- final Binding getTypeOrPackage(char[] name, int mask) {
- Scope scope = this;
- ReferenceBinding foundType = null;
- if ((mask & TYPE) == 0) {
- Scope next = scope;
- while ((next = scope.parent) != null)
- scope = next;
- } else {
- done : while (true) { // done when a COMPILATION_UNIT_SCOPE is found
- switch (scope.kind) {
- case METHOD_SCOPE :
- case BLOCK_SCOPE :
- ReferenceBinding localType = ((BlockScope) scope).findLocalType(name); // looks in this scope only
- if (localType != null) {
- if (foundType != null && foundType != localType)
- return new ProblemReferenceBinding(name, InheritedNameHidesEnclosingName);
- return localType;
- }
- break;
- case CLASS_SCOPE :
- SourceTypeBinding sourceType = ((ClassScope) scope).referenceContext.binding;
- // 6.5.5.1 - simple name favors member type over top-level type in same unit
- ReferenceBinding memberType = findMemberType(name, sourceType);
- if (memberType != null) { // skip it if we did not find anything
- if (memberType.problemId() == Ambiguous) {
- if (foundType == null || foundType.problemId() == NotVisible)
- // supercedes any potential InheritedNameHidesEnclosingName problem
- return memberType;
- // make the user qualify the type, likely wants the first inherited type
- return new ProblemReferenceBinding(name, InheritedNameHidesEnclosingName);
+ /* Internal use only
+ */
+ final Binding getTypeOrPackage(char[] name, int mask) {
+ Scope scope = this;
+ ReferenceBinding foundType = null;
+ boolean insideStaticContext = false;
+ boolean resolvingHierarchy = false;
+ if ((mask & TYPE) == 0) {
+ Scope next = scope;
+ while ((next = scope.parent) != null)
+ scope = next;
+ } else {
+ done : while (true) { // done when a COMPILATION_UNIT_SCOPE is found
+ switch (scope.kind) {
+ case METHOD_SCOPE :
+ MethodScope methodScope = (MethodScope) scope;
+ AbstractMethodDeclaration methodDecl = methodScope.referenceMethod();
+ if (methodDecl != null && methodDecl.binding != null) {
+ TypeVariableBinding typeVariable = methodDecl.binding.getTypeVariable(name);
+ if (typeVariable != null) return typeVariable;
+ }
+ insideStaticContext |= methodScope.isStatic;
+ case BLOCK_SCOPE :
+ ReferenceBinding localType = ((BlockScope) scope).findLocalType(name); // looks in this scope only
+ if (localType != null) {
+ if (foundType != null && foundType != localType)
+ return new ProblemReferenceBinding(name, InheritedNameHidesEnclosingName);
+ return localType;
}
- if (memberType.isValidBinding()) {
- if (sourceType == memberType.enclosingType()
- || environment().options.complianceLevel >= ClassFileConstants.JDK1_4) {
- // found a valid type in the 'immediate' scope (ie. not inherited)
- // OR in 1.4 mode (inherited shadows enclosing)
- if (foundType == null)
- return memberType;
- if (foundType.isValidBinding())
- // if a valid type was found, complain when another is found in an 'immediate' enclosing type (ie. not inherited)
- if (foundType != memberType)
- return new ProblemReferenceBinding(name, InheritedNameHidesEnclosingName);
+ break;
+ case CLASS_SCOPE :
+ SourceTypeBinding sourceType = ((ClassScope) scope).referenceContext.binding;
+ if (sourceType.isHierarchyBeingConnected()) {
+ // type variables take precedence over the source type, ex. class X <X> extends X == class X <Y> extends Y
+ TypeVariableBinding typeVariable = sourceType.getTypeVariable(name);
+ if (typeVariable != null)
+ return typeVariable;
+ if (CharOperation.equals(name, sourceType.sourceName))
+ return sourceType;
+ resolvingHierarchy = true;
+ break;
+ }
+ // type variables take precedence over member types
+ TypeVariableBinding typeVariable = sourceType.getTypeVariable(name);
+ if (typeVariable != null) {
+ if (resolvingHierarchy)
+ // class X <T> { class MX extends T {}}
+ return new ProblemReferenceBinding(name, IllegalSuperTypeVariable); // cannot bind to a type variable
+ if (insideStaticContext) // do not consider this type modifiers: access is legite within same type
+ return new ProblemReferenceBinding(name, NonStaticReferenceInStaticContext);
+ return typeVariable;
+ }
+ insideStaticContext |= (sourceType.modifiers & AccStatic) != 0; // not isStatic()
+ // 6.5.5.1 - member types have precedence over top-level type in same unit
+ ReferenceBinding memberType = findMemberType(name, sourceType);
+ if (memberType != null) { // skip it if we did not find anything
+ if (memberType.problemId() == Ambiguous) {
+ if (foundType == null || foundType.problemId() == NotVisible)
+ // supercedes any potential InheritedNameHidesEnclosingName problem
+ return memberType;
+ else
+ // make the user qualify the type, likely wants the first inherited type
+ return new ProblemReferenceBinding(name, InheritedNameHidesEnclosingName);
}
+ if (memberType.isValidBinding()) {
+ if (sourceType == memberType.enclosingType()
+ || environment().options.complianceLevel >= ClassFileConstants.JDK1_4) {
+ // found a valid type in the 'immediate' scope (ie. not inherited)
+ // OR in 1.4 mode (inherited shadows enclosing)
+ if (foundType == null)
+ return memberType;
+ if (foundType.isValidBinding())
+ // if a valid type was found, complain when another is found in an 'immediate' enclosing type (ie. not inherited)
+ if (foundType != memberType)
+ return new ProblemReferenceBinding(name, InheritedNameHidesEnclosingName);
+ }
+ }
+ if (foundType == null || (foundType.problemId() == NotVisible && memberType.problemId() != NotVisible))
+ // only remember the memberType if its the first one found or the previous one was not visible & memberType is...
+ foundType = memberType;
}
- if (foundType == null || (foundType.problemId() == NotVisible && memberType.problemId() != NotVisible))
- // only remember the memberType if its the first one found or the previous one was not visible & memberType is...
- foundType = memberType;
- }
- if (CharOperation.equals(sourceType.sourceName, name)) {
- if (foundType != null && foundType != sourceType && foundType.problemId() != NotVisible)
- return new ProblemReferenceBinding(name, InheritedNameHidesEnclosingName);
- return sourceType;
- }
- break;
- case COMPILATION_UNIT_SCOPE :
- break done;
+ if (CharOperation.equals(sourceType.sourceName, name)) {
+ if (foundType != null && foundType != sourceType && foundType.problemId() != NotVisible)
+ return new ProblemReferenceBinding(name, InheritedNameHidesEnclosingName);
+ return sourceType;
+ }
+ break;
+ case COMPILATION_UNIT_SCOPE :
+ break done;
+ }
+ scope = scope.parent;
}
- scope = scope.parent;
+ if (foundType != null && foundType.problemId() != NotVisible)
+ return foundType;
}
- if (foundType != null && foundType.problemId() != NotVisible)
- return foundType;
- }
-
- // at this point the scope is a compilation unit scope
- CompilationUnitScope unitScope = (CompilationUnitScope) scope;
- PackageBinding currentPackage = unitScope.fPackage;
- // ask for the imports + name
- if ((mask & TYPE) != 0) {
- // check single type imports.
-
- ImportBinding[] imports = unitScope.imports;
- if (imports != null) {
- HashtableOfObject typeImports = unitScope.resolvedSingeTypeImports;
- if (typeImports != null) {
- ImportBinding typeImport = (ImportBinding) typeImports.get(name);
- if (typeImport != null) {
- ImportReference importReference = typeImport.reference;
- if (importReference != null) importReference.used = true;
- return typeImport.resolvedImport; // already know its visible
- }
- } else {
- // walk all the imports since resolvedSingeTypeImports is not yet initialized
- for (int i = 0, length = imports.length; i < length; i++) {
- ImportBinding typeImport = imports[i];
- if (!typeImport.onDemand) {
- if (CharOperation.equals(typeImport.compoundName[typeImport.compoundName.length - 1], name)) {
- if (unitScope.resolveSingleTypeImport(typeImport) != null) {
- ImportReference importReference = typeImport.reference;
- if (importReference != null) importReference.used = true;
- return typeImport.resolvedImport; // already know its visible
+
+ // at this point the scope is a compilation unit scope
+ CompilationUnitScope unitScope = (CompilationUnitScope) scope;
+ PackageBinding currentPackage = unitScope.fPackage;
+ // ask for the imports + name
+ if ((mask & TYPE) != 0) {
+ // check single type imports.
+
+ ImportBinding[] imports = unitScope.imports;
+ if (imports != null) {
+ HashtableOfObject typeImports = unitScope.resolvedSingeTypeImports;
+ if (typeImports != null) {
+ ImportBinding typeImport = (ImportBinding) typeImports.get(name);
+ if (typeImport != null) {
+ ImportReference importReference = typeImport.reference;
+ if (importReference != null) importReference.used = true;
+ return typeImport.resolvedImport; // already know its visible
+ }
+ } else {
+ // walk all the imports since resolvedSingeTypeImports is not yet initialized
+ for (int i = 0, length = imports.length; i < length; i++) {
+ ImportBinding typeImport = imports[i];
+ if (!typeImport.onDemand) {
+ if (CharOperation.equals(typeImport.compoundName[typeImport.compoundName.length - 1], name)) {
+ if (unitScope.resolveSingleTypeImport(typeImport) != null) {
+ ImportReference importReference = typeImport.reference;
+ if (importReference != null) importReference.used = true;
+ return typeImport.resolvedImport; // already know its visible
+ }
}
}
}
}
}
- }
- // check if the name is in the current package, skip it if its a sub-package
- unitScope.recordReference(currentPackage.compoundName, name);
- Binding binding = currentPackage.getTypeOrPackage(name);
- if (binding instanceof ReferenceBinding) return binding; // type is always visible to its own package
-
- // check on demand imports
- if (imports != null) {
- boolean foundInImport = false;
- ReferenceBinding type = null;
- for (int i = 0, length = imports.length; i < length; i++) {
- ImportBinding someImport = imports[i];
- if (someImport.onDemand) {
- Binding resolvedImport = someImport.resolvedImport;
- ReferenceBinding temp = resolvedImport instanceof PackageBinding
- ? findType(name, (PackageBinding) resolvedImport, currentPackage)
- : findDirectMemberType(name, (ReferenceBinding) resolvedImport);
- if (temp != null) {
- if (temp.isValidBinding()) {
- ImportReference importReference = someImport.reference;
- if (importReference != null) importReference.used = true;
- if (foundInImport)
- // Answer error binding -- import on demand conflict; name found in two import on demand packages.
- return new ProblemReferenceBinding(name, Ambiguous);
- type = temp;
- foundInImport = true;
- } else if (foundType == null) {
- foundType = temp;
+ // check if the name is in the current package, skip it if its a sub-package
+ unitScope.recordReference(currentPackage.compoundName, name);
+ Binding binding = currentPackage.getTypeOrPackage(name);
+ if (binding instanceof ReferenceBinding) return binding; // type is always visible to its own package
+
+ // check on demand imports
+ if (imports != null) {
+ boolean foundInImport = false;
+ ReferenceBinding type = null;
+ for (int i = 0, length = imports.length; i < length; i++) {
+ ImportBinding someImport = imports[i];
+ if (someImport.onDemand) {
+ Binding resolvedImport = someImport.resolvedImport;
+ ReferenceBinding temp = resolvedImport instanceof PackageBinding
+ ? findType(name, (PackageBinding) resolvedImport, currentPackage)
+ : findDirectMemberType(name, (ReferenceBinding) resolvedImport);
+ if (temp != null) {
+ if (temp.isValidBinding()) {
+ ImportReference importReference = someImport.reference;
+ if (importReference != null) importReference.used = true;
+ if (foundInImport)
+ // Answer error binding -- import on demand conflict; name found in two import on demand packages.
+ return new ProblemReferenceBinding(name, Ambiguous);
+ type = temp;
+ foundInImport = true;
+ } else if (foundType == null) {
+ foundType = temp;
+ }
}
}
}
+ if (type != null) return type;
}
- if (type != null) return type;
}
+
+ unitScope.recordSimpleReference(name);
+ if ((mask & PACKAGE) != 0) {
+ PackageBinding packageBinding = unitScope.environment.getTopLevelPackage(name);
+ if (packageBinding != null) return packageBinding;
+ }
+
+ // Answer error binding -- could not find name
+ if (foundType != null) return foundType; // problem type from above
+ return new ProblemReferenceBinding(name, NotFound);
}
- unitScope.recordSimpleReference(name);
- if ((mask & PACKAGE) != 0) {
- PackageBinding packageBinding = unitScope.environment.getTopLevelPackage(name);
- if (packageBinding != null) return packageBinding;
- }
-
- // Answer error binding -- could not find name
- if (foundType != null) return foundType; // problem type from above
- return new ProblemReferenceBinding(name, NotFound);
- }
-
// Added for code assist... NOT Public API
public final Binding getTypeOrPackage(char[][] compoundName) {
int nameLength = compoundName.length;
@@ -1741,8 +2022,8 @@ public abstract class Scope
}
/* Answer true if the scope is nested inside a given field declaration.
- * Note: it works as long as the scope.fieldDeclarationIndex is reflecting the field being traversed
- * e.g. during name resolution.
+ * Note: it works as long as the scope.fieldDeclarationIndex is reflecting the field being traversed
+ * e.g. during name resolution.
*/
public final boolean isDefinedInField(FieldBinding field) {
Scope scope = this;
@@ -1851,6 +2132,105 @@ public abstract class Scope
return null;
}
+ /**
+ * Returns the most specific type compatible with all given types.
+ * (i.e. most specific common super type)
+ * If no types is given, will return VoidBinding. If not compatible
+ * reference type is found, returns null.
+ */
+ public TypeBinding mostSpecificCommonType(TypeBinding[] types) {
+ int length = types.length;
+ int indexOfFirst = -1, actualLength = 0;
+ for (int i = 0; i < length; i++) {
+ TypeBinding type = types[i];
+ if (type == null) continue;
+ if (type.isBaseType()) return null;
+ if (indexOfFirst < 0) indexOfFirst = i;
+ actualLength ++;
+ }
+ switch (actualLength) {
+ case 0: return VoidBinding;
+ case 1: return types[indexOfFirst];
+ }
+
+ // record all supertypes of type
+ // intersect with all supertypes of otherType
+ TypeBinding firstType = types[indexOfFirst];
+ TypeBinding[] superTypes;
+ int superLength;
+ if (firstType.isBaseType()) {
+ return null;
+ } else if (firstType.isArrayType()) {
+ superLength = 4;
+ superTypes = new TypeBinding[] {
+ firstType,
+ getJavaIoSerializable(),
+ getJavaLangCloneable(),
+ getJavaLangObject(),
+ };
+ } else {
+ ArrayList typesToVisit = new ArrayList(5);
+ typesToVisit.add(firstType);
+ ReferenceBinding currentType = (ReferenceBinding)firstType;
+ for (int i = 0, max = 1; i < max; i++) {
+ currentType = (ReferenceBinding) typesToVisit.get(i);
+ ReferenceBinding itsSuperclass = currentType.superclass();
+ if (itsSuperclass != null && !typesToVisit.contains(itsSuperclass)) {
+ typesToVisit.add(itsSuperclass);
+ max++;
+ }
+ ReferenceBinding[] itsInterfaces = currentType.superInterfaces();
+ for (int j = 0, count = itsInterfaces.length; j < count; j++)
+ if (!typesToVisit.contains(itsInterfaces[j])) {
+ typesToVisit.add(itsInterfaces[j]);
+ max++;
+ }
+ }
+ superLength = typesToVisit.size();
+ superTypes = new TypeBinding[superLength];
+ typesToVisit.toArray(superTypes);
+ }
+ int remaining = superLength;
+ nextOtherType: for (int i = indexOfFirst+1; i < length; i++) {
+ TypeBinding otherType = types[i];
+ if (otherType == null)
+ continue nextOtherType;
+ else if (otherType.isArrayType()) {
+ nextSuperType: for (int j = 0; j < superLength; j++) {
+ TypeBinding superType = superTypes[j];
+ if (superType == null || superType == otherType) continue nextSuperType;
+ switch (superType.id) {
+ case T_JavaIoSerializable :
+ case T_JavaLangCloneable :
+ case T_JavaLangObject :
+ continue nextSuperType;
+ }
+ superTypes[j] = null;
+ if (--remaining == 0) return null;
+
+ }
+ continue nextOtherType;
+ }
+ ReferenceBinding otherRefType = (ReferenceBinding) otherType;
+ nextSuperType: for (int j = 0; j < superLength; j++) {
+ TypeBinding superType = superTypes[j];
+ if (superType == null) continue nextSuperType;
+ if (otherRefType.isCompatibleWith(superType)) {
+ break nextSuperType;
+ } else {
+ superTypes[j] = null;
+ if (--remaining == 0) return null;
+ }
+ }
+ }
+ // per construction, first non-null supertype is most specific common supertype
+ for (int i = 0; i < superLength; i++) {
+ TypeBinding superType = superTypes[i];
+ if (superType != null) return superType;
+ }
+ return null;
+ }
+
// Internal use only
/* All methods in visible are acceptable matches for the method in question...
* The methods defined by the receiver type appear before those defined by its
@@ -1861,27 +2241,30 @@ public abstract class Scope
* is defined by a superclass, when a lesser match is defined by the receiver type
* or a closer superclass.
*/
- protected final MethodBinding mostSpecificClassMethodBinding(MethodBinding[] visible, int visibleSize) {
-
- MethodBinding method = null;
+ protected final MethodBinding mostSpecificClassMethodBinding(MethodBinding[] visible, int visibleSize, InvocationSite invocationSite) {
+ MethodBinding problemMethod = null;
MethodBinding previous = null;
-
nextVisible : for (int i = 0; i < visibleSize; i++) {
- method = visible[i];
-
+ MethodBinding method = visible[i];
if (previous != null && method.declaringClass != previous.declaringClass)
break; // cannot answer a method farther up the hierarchy than the first method found
+
previous = method;
for (int j = 0; j < visibleSize; j++) {
if (i == j) continue;
- MethodBinding next = visible[j];
- if (!areParametersAssignable(next.parameters, method.parameters))
+ MethodBinding compatibleMethod = computeCompatibleMethod(visible[j], method.parameters, invocationSite);
+ if (compatibleMethod == null || !compatibleMethod.isValidBinding()) {
+ if (problemMethod == null)
+ problemMethod = compatibleMethod;
continue nextVisible;
+ }
}
compilationUnitScope().recordTypeReferences(method.thrownExceptions);
return method;
}
- return new ProblemMethodBinding(visible[0].selector, visible[0].parameters, Ambiguous);
+ if (problemMethod == null)
+ return new ProblemMethodBinding(visible[0].selector, visible[0].parameters, Ambiguous);
+ return problemMethod;
}
// Internal use only
@@ -1913,42 +2296,46 @@ public abstract class Scope
public void foo(I i, X x) { i.bar(x); }
}
*/
- protected final MethodBinding mostSpecificInterfaceMethodBinding(MethodBinding[] visible, int visibleSize) {
- MethodBinding method = null;
+ protected final MethodBinding mostSpecificInterfaceMethodBinding(MethodBinding[] visible, int visibleSize, InvocationSite invocationSite) {
+ MethodBinding problemMethod = null;
nextVisible : for (int i = 0; i < visibleSize; i++) {
- method = visible[i];
+ MethodBinding method = visible[i];
for (int j = 0; j < visibleSize; j++) {
if (i == j) continue;
- MethodBinding next = visible[j];
- if (!areParametersAssignable(next.parameters, method.parameters))
+ MethodBinding compatibleMethod = computeCompatibleMethod(visible[j], method.parameters, invocationSite);
+ if (compatibleMethod == null || !compatibleMethod.isValidBinding()) {
+ if (problemMethod == null)
+ problemMethod = compatibleMethod;
continue nextVisible;
+ }
}
compilationUnitScope().recordTypeReferences(method.thrownExceptions);
return method;
}
- return new ProblemMethodBinding(visible[0].selector, visible[0].parameters, Ambiguous);
+ if (problemMethod == null)
+ return new ProblemMethodBinding(visible[0].selector, visible[0].parameters, Ambiguous);
+ return problemMethod;
}
-
// Internal use only
/* All methods in visible are acceptable matches for the method in question...
* Since 1.4, the inherited ambiguous case has been removed from mostSpecificClassMethodBinding
*/
- protected final MethodBinding mostSpecificMethodBinding(MethodBinding[] visible, int visibleSize) {
+ protected final MethodBinding mostSpecificMethodBinding(MethodBinding[] visible, int visibleSize, InvocationSite invocationSite) {
MethodBinding method = null;
nextVisible : for (int i = 0; i < visibleSize; i++) {
method = visible[i];
for (int j = 0; j < visibleSize; j++) {
if (i == j) continue;
- MethodBinding next = visible[j];
- if (!areParametersAssignable(next.parameters, method.parameters))
+ MethodBinding compatibleMethod = computeCompatibleMethod(visible[j], method.parameters, invocationSite);
+ if (compatibleMethod == null)
continue nextVisible;
}
compilationUnitScope().recordTypeReferences(method.thrownExceptions);
return method;
}
return new ProblemMethodBinding(visible[0].selector, visible[0].parameters, Ambiguous);
- }
+ }
public final ClassScope outerMostClassScope() {
ClassScope lastClassScope = null;
@@ -1986,6 +2373,48 @@ public abstract class Scope
}
/**
+ * Returns an array of types, where original types got substituted given a substitution.
+ * Only allocate an array if anything is different.
+ */
+ public static TypeBinding[] substitute(Substitution substitution, TypeBinding[] originalTypes) {
+ TypeBinding[] substitutedTypes = originalTypes;
+ for (int i = 0, length = originalTypes.length; i < length; i++) {
+ TypeBinding originalType = originalTypes[i];
+ TypeBinding substitutedParameter = substitution.substitute(originalType);
+ if (substitutedParameter != originalType) {
+ if (substitutedTypes == originalTypes) {
+ System.arraycopy(originalTypes, 0, substitutedTypes = new TypeBinding[length], 0, i);
+ }
+ substitutedTypes[i] = substitutedParameter;
+ } else if (substitutedTypes != originalTypes) {
+ substitutedTypes[i] = originalType;
+ }
+ }
+ return substitutedTypes;
+ }
+
+ /**
+ * Returns an array of types, where original types got substituted given a substitution.
+ * Only allocate an array if anything is different.
+ */
+ public static ReferenceBinding[] substitute(Substitution substitution, ReferenceBinding[] originalTypes) {
+ ReferenceBinding[] substitutedTypes = originalTypes;
+ for (int i = 0, length = originalTypes.length; i < length; i++) {
+ ReferenceBinding originalType = originalTypes[i];
+ ReferenceBinding substitutedParameter = (ReferenceBinding)substitution.substitute(originalType);
+ if (substitutedParameter != originalType) {
+ if (substitutedTypes == originalTypes) {
+ System.arraycopy(originalTypes, 0, substitutedTypes = new ReferenceBinding[length], 0, i);
+ }
+ substitutedTypes[i] = substitutedParameter;
+ } else if (substitutedTypes != originalTypes) {
+ substitutedTypes[i] = originalType;
+ }
+ }
+ return substitutedTypes;
+ }
+
+ /**
* Returns the immediately enclosing switchCase statement (carried by closest blockScope),
*/
public CaseStatement switchCase() {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SignatureWrapper.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SignatureWrapper.java
new file mode 100644
index 0000000000..b4293a0f07
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SignatureWrapper.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.lookup;
+
+import org.eclipse.jdt.core.compiler.CharOperation;
+
+public class SignatureWrapper {
+ public char[] signature;
+ public int start;
+ public int end;
+ public int bracket;
+
+ public SignatureWrapper(char[] signature) {
+ this.signature = signature;
+ this.start = 0;
+ this.end = this.bracket = -1;
+ }
+ public boolean atEnd() {
+ return this.start < 0 || this.start >= this.signature.length;
+ }
+ public int computeEnd() {
+ int index = this.start;
+ while (this.signature[index] == '[')
+ index++;
+ switch (this.signature[index]) {
+ case 'L' :
+ case 'T' :
+ this.end = CharOperation.indexOf(';', this.signature, this.start);
+ if (this.bracket <= this.start) // already know it if its > start
+ this.bracket = CharOperation.indexOf('<', this.signature, this.start);
+
+ if (this.bracket > this.start && this.bracket < this.end)
+ this.end = this.bracket;
+ else if (this.end == -1)
+ this.end = this.signature.length + 1;
+ break;
+ default :
+ this.end = this.start;
+ }
+
+ this.start = this.end + 1; // skip ';'
+ return this.end;
+ }
+ public char[] nextWord() {
+ this.end = CharOperation.indexOf(';', this.signature, this.start);
+ if (this.bracket <= this.start) // already know it if its > start
+ this.bracket = CharOperation.indexOf('<', this.signature, this.start);
+ int dot = CharOperation.indexOf('.', this.signature, this.start);
+
+ if (this.bracket > this.start && this.bracket < this.end)
+ this.end = this.bracket;
+ if (dot > this.start && dot < this.end)
+ this.end = dot;
+
+ return CharOperation.subarray(this.signature, this.start, this.start = this.end); // skip word
+ }
+ public String toString() {
+ return new String(this.signature) + " @ " + this.start; //$NON-NLS-1$
+ }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
index e791f1e03e..30c3032dd1 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
@@ -10,21 +10,23 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
-import java.util.Enumeration;
+import java.util.HashMap;
import java.util.Hashtable;
+import java.util.Iterator;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.AnnotationTypeMemberDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Argument;
import org.eclipse.jdt.internal.compiler.ast.AssertStatement;
import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration;
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.impl.Constant;
-import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
public class SourceTypeBinding extends ReferenceBinding {
public ReferenceBinding superclass;
@@ -32,16 +34,18 @@ public class SourceTypeBinding extends ReferenceBinding {
public FieldBinding[] fields;
public MethodBinding[] methods;
public ReferenceBinding[] memberTypes;
+ public TypeVariableBinding[] typeVariables;
public ClassScope scope;
- // Synthetics are separated into 4 categories: methods, super methods, fields, class literals and changed declaring type bindings
+ // Synthetics are separated into 5 categories: methods, super methods, fields, class literals, changed declaring type bindings and bridge methods
public final static int METHOD_EMUL = 0;
public final static int FIELD_EMUL = 1;
public final static int CLASS_LITERAL_EMUL = 2;
public final static int RECEIVER_TYPE_EMUL = 3;
+ HashMap[] synthetics;
+ char[] genericReferenceTypeSignature;
- Hashtable[] synthetics;
public SourceTypeBinding(char[][] compoundName, PackageBinding fPackage, ClassScope scope) {
this.compoundName = compoundName;
@@ -112,10 +116,10 @@ public void addDefaultAbstractMethods() {
public FieldBinding addSyntheticField(LocalVariableBinding actualOuterLocalVariable) {
if (synthetics == null) {
- synthetics = new Hashtable[4];
+ synthetics = new HashMap[4];
}
if (synthetics[FIELD_EMUL] == null) {
- synthetics[FIELD_EMUL] = new Hashtable(5);
+ synthetics[FIELD_EMUL] = new HashMap(5);
}
FieldBinding synthField = (FieldBinding) synthetics[FIELD_EMUL].get(actualOuterLocalVariable);
@@ -160,10 +164,10 @@ public FieldBinding addSyntheticField(LocalVariableBinding actualOuterLocalVaria
public FieldBinding addSyntheticField(ReferenceBinding enclosingType) {
if (synthetics == null) {
- synthetics = new Hashtable[4];
+ synthetics = new HashMap[4];
}
if (synthetics[FIELD_EMUL] == null) {
- synthetics[FIELD_EMUL] = new Hashtable(5);
+ synthetics[FIELD_EMUL] = new HashMap(5);
}
FieldBinding synthField = (FieldBinding) synthetics[FIELD_EMUL].get(enclosingType);
@@ -200,10 +204,10 @@ public FieldBinding addSyntheticField(ReferenceBinding enclosingType) {
public FieldBinding addSyntheticField(TypeBinding targetType, BlockScope blockScope) {
if (synthetics == null) {
- synthetics = new Hashtable[4];
+ synthetics = new HashMap[4];
}
if (synthetics[CLASS_LITERAL_EMUL] == null) {
- synthetics[CLASS_LITERAL_EMUL] = new Hashtable(5);
+ synthetics[CLASS_LITERAL_EMUL] = new HashMap(5);
}
// use a different table than FIELDS, given there might be a collision between emulation of X.this$0 and X.class.
@@ -239,10 +243,10 @@ public FieldBinding addSyntheticField(TypeBinding targetType, BlockScope blockSc
public FieldBinding addSyntheticField(AssertStatement assertStatement, BlockScope blockScope) {
if (synthetics == null) {
- synthetics = new Hashtable[4];
+ synthetics = new HashMap[4];
}
if (synthetics[FIELD_EMUL] == null) {
- synthetics[FIELD_EMUL] = new Hashtable(5);
+ synthetics[FIELD_EMUL] = new HashMap(5);
}
FieldBinding synthField = (FieldBinding) synthetics[FIELD_EMUL].get("assertionEmulation"); //$NON-NLS-1$
@@ -287,10 +291,10 @@ public FieldBinding addSyntheticField(AssertStatement assertStatement, BlockScop
public SyntheticAccessMethodBinding addSyntheticMethod(FieldBinding targetField, boolean isReadAccess) {
if (synthetics == null) {
- synthetics = new Hashtable[4];
+ synthetics = new HashMap[4];
}
if (synthetics[METHOD_EMUL] == null) {
- synthetics[METHOD_EMUL] = new Hashtable(5);
+ synthetics[METHOD_EMUL] = new HashMap(5);
}
SyntheticAccessMethodBinding accessMethod = null;
@@ -315,10 +319,10 @@ public SyntheticAccessMethodBinding addSyntheticMethod(FieldBinding targetField,
public SyntheticAccessMethodBinding addSyntheticMethod(MethodBinding targetMethod, boolean isSuperAccess) {
if (synthetics == null) {
- synthetics = new Hashtable[4];
+ synthetics = new HashMap[4];
}
if (synthetics[METHOD_EMUL] == null) {
- synthetics[METHOD_EMUL] = new Hashtable(5);
+ synthetics[METHOD_EMUL] = new HashMap(5);
}
SyntheticAccessMethodBinding accessMethod = null;
@@ -335,12 +339,31 @@ public SyntheticAccessMethodBinding addSyntheticMethod(MethodBinding targetMetho
}
return accessMethod;
}
+/*
+ * Record the fact that bridge methods need to be generated to override certain inherited methods
+ */
+public SyntheticAccessMethodBinding addSyntheticBridgeMethod(MethodBinding inheritedMethodToBridge, MethodBinding localTargetMethod) {
+
+ if (synthetics == null) {
+ synthetics = new HashMap[4];
+ }
+ if (synthetics[METHOD_EMUL] == null) {
+ synthetics[METHOD_EMUL] = new HashMap(5);
+ }
-public FieldBinding[] availableFields() {
- return fields();
-}
-public MethodBinding[] availableMethods() {
- return methods();
+ SyntheticAccessMethodBinding accessMethod = null;
+ SyntheticAccessMethodBinding[] accessors = (SyntheticAccessMethodBinding[]) synthetics[METHOD_EMUL].get(inheritedMethodToBridge);
+ if (accessors == null) {
+ accessMethod = new SyntheticAccessMethodBinding(inheritedMethodToBridge, localTargetMethod);
+ synthetics[METHOD_EMUL].put(inheritedMethodToBridge, accessors = new SyntheticAccessMethodBinding[2]);
+ accessors[1] = accessMethod;
+ } else {
+ if ((accessMethod = accessors[1]) == null) {
+ accessMethod = new SyntheticAccessMethodBinding(inheritedMethodToBridge, localTargetMethod);
+ accessors[1] = accessMethod;
+ }
+ }
+ return accessMethod;
}
void faultInTypesForFieldsAndMethods() {
fields();
@@ -349,48 +372,92 @@ void faultInTypesForFieldsAndMethods() {
for (int i = 0, length = memberTypes.length; i < length; i++)
((SourceTypeBinding) memberTypes[i]).faultInTypesForFieldsAndMethods();
}
-// NOTE: the type of each field of a source type is resolved when needed
+// NOTE: the type of each field of a source type is resolved when needed
public FieldBinding[] fields() {
-
+ int failed = 0;
try {
- int failed = 0;
- for (int f = 0, max = fields.length; f < max; f++) {
- if (resolveTypeFor(fields[f]) == null) {
- fields[f] = null;
+ for (int i = 0, length = fields.length; i < length; i++) {
+ if (resolveTypeFor(fields[i]) == null) {
+ fields[i] = null;
failed++;
}
}
+ } finally {
if (failed > 0) {
+ // ensure fields are consistent reqardless of the error
int newSize = fields.length - failed;
if (newSize == 0)
return fields = NoFields;
FieldBinding[] newFields = new FieldBinding[newSize];
- for (int i = 0, n = 0, max = fields.length; i < max; i++)
+ for (int i = 0, j = 0, length = fields.length; i < length; i++)
if (fields[i] != null)
- newFields[n++] = fields[i];
+ newFields[j++] = fields[i];
fields = newFields;
}
- } catch(AbortCompilation e){
- // ensure null fields are removed
- FieldBinding[] newFields = null;
- int count = 0;
- for (int i = 0, max = fields.length; i < max; i++){
- FieldBinding field = fields[i];
- if (field == null && newFields == null){
- System.arraycopy(fields, 0, newFields = new FieldBinding[max], 0, i);
- } else if (newFields != null && field != null) {
- newFields[count++] = field;
- }
- }
- if (newFields != null){
- System.arraycopy(newFields, 0, fields = new FieldBinding[count], 0, count);
- }
- throw e;
}
return fields;
}
+/**
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#genericTypeSignature()
+ */
+public char[] genericTypeSignature() {
+ if (this.genericReferenceTypeSignature == null) {
+ if (this.typeVariables == NoTypeVariables) {
+ this.genericReferenceTypeSignature = this.signature();
+ } else {
+ char[] typeSig = this.signature();
+ StringBuffer sig = new StringBuffer(10);
+ for (int i = 0; i < typeSig.length-1; i++) { // copy all but trailing semicolon
+ sig.append(typeSig[i]);
+ }
+ sig.append('<');
+ for (int i = 0, length = this.typeVariables.length; i < length; i++) {
+ sig.append(this.typeVariables[i].genericTypeSignature());
+ }
+ sig.append(">;"); //$NON-NLS-1$
+ int sigLength = sig.length();
+ this.genericReferenceTypeSignature = new char[sigLength];
+ sig.getChars(0, sigLength, this.genericReferenceTypeSignature, 0);
+ }
+ }
+ return this.genericReferenceTypeSignature;
+}
+/**
+ * <param1 ... paramN>superclass superinterface1 ... superinterfaceN
+ * <T:LY<TT;>;U:Ljava/lang/Object;V::Ljava/lang/Runnable;:Ljava/lang/Cloneable;:Ljava/util/Map;>Ljava/lang/Exception;Ljava/lang/Runnable;
+ */
+public char[] genericSignature() {
+ StringBuffer sig = null;
+ if (this.typeVariables != NoTypeVariables) {
+ sig = new StringBuffer(10);
+ sig.append('<');
+ for (int i = 0, length = this.typeVariables.length; i < length; i++) {
+ sig.append(this.typeVariables[i].genericSignature());
+ }
+ sig.append('>');
+ } else {
+ // could still need a signature if any of supertypes is parameterized
+ noSignature: if (this.superclass == null || !this.superclass.isParameterizedType()) {
+ for (int i = 0, length = this.superInterfaces.length; i < length; i++) {
+ if (this.superInterfaces[i].isParameterizedType()) break noSignature;
+ }
+ return null;
+ }
+ sig = new StringBuffer(10);
+ }
+ if (this.superclass != null) {
+ sig.append(this.superclass.genericTypeSignature());
+ } else {
+ // interface scenario only (as Object cannot be generic) - 65953
+ sig.append(scope.getJavaLangObject().genericTypeSignature());
+ }
+ for (int i = 0, length = this.superInterfaces.length; i < length; i++) {
+ sig.append(this.superInterfaces[i].genericTypeSignature());
+ }
+ return sig.toString().toCharArray();
+}
public MethodBinding[] getDefaultAbstractMethods() {
int count = 0;
for (int i = methods.length; --i >= 0;)
@@ -483,144 +550,70 @@ public MethodBinding getExactMethod(char[] selector, TypeBinding[] argumentTypes
}
return null;
}
-// NOTE: the type of a field of a source type is resolved when needed
+// NOTE: the type of a field of a source type is resolved when needed
public FieldBinding getField(char[] fieldName, boolean needResolve) {
// always resolve anyway on source types
int fieldLength = fieldName.length;
- for (int f = fields.length; --f >= 0;) {
- FieldBinding field = fields[f];
+ for (int i = 0, length = fields.length; i < length; i++) {
+ FieldBinding field = fields[i];
if (field.name.length == fieldLength && CharOperation.equals(field.name, fieldName)) {
- if (resolveTypeFor(field) != null)
- return field;
-
- int newSize = fields.length - 1;
- if (newSize == 0) {
- fields = NoFields;
- } else {
- FieldBinding[] newFields = new FieldBinding[newSize];
- System.arraycopy(fields, 0, newFields, 0, f);
- System.arraycopy(fields, f + 1, newFields, f, newSize - f);
- fields = newFields;
+ FieldBinding result = null;
+ try {
+ result = resolveTypeFor(field);
+ return result;
+ } finally {
+ if (result == null) {
+ // ensure fields are consistent reqardless of the error
+ int newSize = fields.length - 1;
+ if (newSize == 0) {
+ fields = NoFields;
+ } else {
+ FieldBinding[] newFields = new FieldBinding[newSize];
+ System.arraycopy(fields, 0, newFields, 0, i);
+ System.arraycopy(fields, i + 1, newFields, i, newSize - i);
+ fields = newFields;
+ }
+ }
}
- return null;
}
}
return null;
}
-// NOTE: the return type, arg & exception types of each method of a source type are resolved when needed
+// NOTE: the return type, arg & exception types of each method of a source type are resolved when needed
public MethodBinding[] getMethods(char[] selector) {
- // handle forward references to potential default abstract methods
- addDefaultAbstractMethods();
-
- try{
- int count = 0;
- int lastIndex = -1;
- int selectorLength = selector.length;
- if ((modifiers & AccUnresolved) == 0) { // have resolved all arg types & return type of the methods
- for (int m = 0, length = methods.length; m < length; m++) {
- MethodBinding method = methods[m];
- if (method.selector.length == selectorLength && CharOperation.equals(method.selector, selector)) {
- count++;
- lastIndex = m;
- }
- }
- } else {
- boolean foundProblem = false;
- int failed = 0;
- for (int m = 0, length = methods.length; m < length; m++) {
- MethodBinding method = methods[m];
- if (method.selector.length == selectorLength && CharOperation.equals(method.selector, selector)) {
- if (resolveTypesFor(method) == null) {
- foundProblem = true;
- methods[m] = null; // unable to resolve parameters
- failed++;
- } else if (method.returnType == null) {
- foundProblem = true;
- } else {
- count++;
- lastIndex = m;
- }
- }
- }
-
- if (foundProblem || count > 1) {
- for (int m = methods.length; --m >= 0;) {
- MethodBinding method = methods[m];
- if (method != null && method.selector.length == selectorLength && CharOperation.equals(method.selector, selector)) {
- AbstractMethodDeclaration methodDecl = null;
- for (int i = 0; i < m; i++) {
- MethodBinding method2 = methods[i];
- if (method2 != null && CharOperation.equals(method.selector, method2.selector)) {
- if (method.areParametersEqual(method2)) {
- if (methodDecl == null) {
- methodDecl = method.sourceMethod(); // cannot be retrieved after binding is lost
- scope.problemReporter().duplicateMethodInType(this, methodDecl);
- methodDecl.binding = null;
- methods[m] = null;
- failed++;
- }
- scope.problemReporter().duplicateMethodInType(this, method2.sourceMethod());
- method2.sourceMethod().binding = null;
- methods[i] = null;
- failed++;
- }
- }
- }
- if (method.returnType == null && methodDecl == null) { // forget method with invalid return type... was kept to detect possible collisions
- method.sourceMethod().binding = null;
- methods[m] = null;
- failed++;
- }
- }
- }
-
- if (failed > 0) {
- int newSize = methods.length - failed;
- if (newSize == 0)
- return methods = NoMethods;
-
- MethodBinding[] newMethods = new MethodBinding[newSize];
- for (int i = 0, n = 0, max = methods.length; i < max; i++)
- if (methods[i] != null)
- newMethods[n++] = methods[i];
- methods = newMethods;
- return getMethods(selector); // try again now that the problem methods have been removed
- }
- }
- }
- if (count == 1)
- return new MethodBinding[] {methods[lastIndex]};
- if (count > 1) {
- MethodBinding[] result = new MethodBinding[count];
- count = 0;
- for (int m = 0; m <= lastIndex; m++) {
- MethodBinding method = methods[m];
- if (method.selector.length == selectorLength && CharOperation.equals(method.selector, selector))
- result[count++] = method;
+ int selectorLength = selector.length;
+ boolean methodsAreResolved = (modifiers & AccUnresolved) == 0; // have resolved all arg types & return type of the methods
+ java.util.ArrayList matchingMethods = null;
+ for (int i = 0, length = methods.length; i < length; i++) {
+ MethodBinding method = methods[i];
+ if (method.selector.length == selectorLength && CharOperation.equals(method.selector, selector)) {
+ if (!methodsAreResolved && resolveTypesFor(method) == null || method.returnType == null) {
+ methods();
+ return getMethods(selector); // try again since the problem methods have been removed
}
- return result;
+ if (matchingMethods == null)
+ matchingMethods = new java.util.ArrayList(2);
+ matchingMethods.add(method);
}
- } catch(AbortCompilation e){
- // ensure null methods are removed
- MethodBinding[] newMethods = null;
- int count = 0;
- for (int i = 0, max = methods.length; i < max; i++){
- MethodBinding method = methods[i];
- if (method == null && newMethods == null){
- System.arraycopy(methods, 0, newMethods = new MethodBinding[max], 0, i);
- } else if (newMethods != null && method != null) {
- newMethods[count++] = method;
+ }
+ if (matchingMethods == null) return NoMethods;
+
+ MethodBinding[] result = new MethodBinding[matchingMethods.size()];
+ matchingMethods.toArray(result);
+ if (!methodsAreResolved) {
+ for (int i = 0, length = result.length - 1; i < length; i++) {
+ MethodBinding method = result[i];
+ for (int j = length; j > i; j--) {
+ if (method.areParameterErasuresEqual(result[j])) {
+ methods();
+ return getMethods(selector); // try again since the duplicate methods have been removed
+ }
}
}
- if (newMethods != null){
- System.arraycopy(newMethods, 0, methods = new MethodBinding[count], 0, count);
- }
- modifiers ^= AccUnresolved;
- throw e;
- }
- return NoMethods;
+ }
+ return result;
}
/* Answer the synthetic field for <actualOuterLocalVariable>
* or null if one does not exist.
@@ -631,16 +624,46 @@ public FieldBinding getSyntheticField(LocalVariableBinding actualOuterLocalVaria
if (synthetics == null || synthetics[FIELD_EMUL] == null) return null;
return (FieldBinding) synthetics[FIELD_EMUL].get(actualOuterLocalVariable);
}
+/*
+ * Answer the bridge method associated for an inherited methods or null if one does not exist
+ */
+public SyntheticAccessMethodBinding getSyntheticBridgeMethod(MethodBinding inheritedMethodToBridge) {
+
+ if (synthetics == null) return null;
+ if (synthetics[METHOD_EMUL] == null) return null;
+ SyntheticAccessMethodBinding[] accessors = (SyntheticAccessMethodBinding[]) synthetics[METHOD_EMUL].get(inheritedMethodToBridge);
+ if (accessors == null) return null;
+ return accessors[1];
+}
+/**
+ * Returns true if a type is identical to another one,
+ * or for generic types, true if compared to its raw type.
+ */
+public boolean isEquivalentTo(TypeBinding otherType) {
+ if (this == otherType) return true;
+ if (otherType == null) return false;
+ if (otherType.isWildcard()) // wildcard
+ return ((WildcardBinding) otherType).boundCheck(this);
+ if (this.typeVariables == NoTypeVariables) return false;
+ if (otherType.isRawType())
+ return otherType.erasure() == this;
+ return false;
+}
+
+public boolean isGenericType() {
+ return this.typeVariables != NoTypeVariables;
+}
+
public ReferenceBinding[] memberTypes() {
return this.memberTypes;
}
public FieldBinding getUpdatedFieldBinding(FieldBinding targetField, ReferenceBinding newDeclaringClass) {
if (this.synthetics == null) {
- this.synthetics = new Hashtable[4];
+ this.synthetics = new HashMap[4];
}
if (this.synthetics[RECEIVER_TYPE_EMUL] == null) {
- this.synthetics[RECEIVER_TYPE_EMUL] = new Hashtable(5);
+ this.synthetics[RECEIVER_TYPE_EMUL] = new HashMap(5);
}
Hashtable fieldMap = (Hashtable) this.synthetics[RECEIVER_TYPE_EMUL].get(targetField);
@@ -659,10 +682,10 @@ public FieldBinding getUpdatedFieldBinding(FieldBinding targetField, ReferenceBi
public MethodBinding getUpdatedMethodBinding(MethodBinding targetMethod, ReferenceBinding newDeclaringClass) {
if (this.synthetics == null) {
- this.synthetics = new Hashtable[4];
+ this.synthetics = new HashMap[4];
}
if (this.synthetics[RECEIVER_TYPE_EMUL] == null) {
- this.synthetics[RECEIVER_TYPE_EMUL] = new Hashtable(5);
+ this.synthetics[RECEIVER_TYPE_EMUL] = new HashMap(5);
}
@@ -683,82 +706,68 @@ public boolean hasMemberTypes() {
}
// NOTE: the return type, arg & exception types of each method of a source type are resolved when needed
public MethodBinding[] methods() {
+ if ((modifiers & AccUnresolved) == 0)
+ return methods;
+
+ int failed = 0;
try {
- if ((modifiers & AccUnresolved) == 0)
- return methods;
-
- int failed = 0;
- for (int m = 0, max = methods.length; m < max; m++) {
- if (resolveTypesFor(methods[m]) == null) {
- methods[m] = null; // unable to resolve parameters
+ for (int i = 0, length = methods.length; i < length; i++) {
+ if (resolveTypesFor(methods[i]) == null) {
+ methods[i] = null; // unable to resolve parameters
failed++;
}
}
-
- for (int m = methods.length; --m >= 0;) {
- MethodBinding method = methods[m];
+
+ // find & report collision cases
+ for (int i = 0, length = methods.length; i < length; i++) {
+ MethodBinding method = methods[i];
if (method != null) {
AbstractMethodDeclaration methodDecl = null;
- for (int i = 0; i < m; i++) {
- MethodBinding method2 = methods[i];
+ for (int j = length - 1; j > i; j--) {
+ MethodBinding method2 = methods[j];
if (method2 != null && CharOperation.equals(method.selector, method2.selector)) {
- if (method.areParametersEqual(method2)) {
+ if (method.areParameterErasuresEqual(method2)) {
if (methodDecl == null) {
methodDecl = method.sourceMethod(); // cannot be retrieved after binding is lost
scope.problemReporter().duplicateMethodInType(this, methodDecl);
methodDecl.binding = null;
- methods[m] = null;
+ methods[i] = null;
failed++;
}
- scope.problemReporter().duplicateMethodInType(this, method2.sourceMethod());
- method2.sourceMethod().binding = null;
- methods[i] = null;
+ AbstractMethodDeclaration method2Decl = method2.sourceMethod();
+ scope.problemReporter().duplicateMethodInType(this, method2Decl);
+ method2Decl.binding = null;
+ methods[j] = null;
failed++;
}
}
}
if (method.returnType == null && methodDecl == null) { // forget method with invalid return type... was kept to detect possible collisions
method.sourceMethod().binding = null;
- methods[m] = null;
+ methods[i] = null;
failed++;
}
}
}
-
+ } finally {
if (failed > 0) {
int newSize = methods.length - failed;
if (newSize == 0) {
methods = NoMethods;
} else {
MethodBinding[] newMethods = new MethodBinding[newSize];
- for (int m = 0, n = 0, max = methods.length; m < max; m++)
- if (methods[m] != null)
- newMethods[n++] = methods[m];
+ for (int i = 0, j = 0, length = methods.length; i < length; i++)
+ if (methods[i] != null)
+ newMethods[j++] = methods[i];
methods = newMethods;
}
}
-
+
// handle forward references to potential default abstract methods
addDefaultAbstractMethods();
- } catch(AbortCompilation e){
- // ensure null methods are removed
- MethodBinding[] newMethods = null;
- int count = 0;
- for (int i = 0, max = methods.length; i < max; i++){
- MethodBinding method = methods[i];
- if (method == null && newMethods == null){
- System.arraycopy(methods, 0, newMethods = new MethodBinding[max], 0, i);
- } else if (newMethods != null && method != null) {
- newMethods[count++] = method;
- }
- }
- if (newMethods != null){
- System.arraycopy(newMethods, 0, methods = new MethodBinding[count], 0, count);
- }
+
modifiers ^= AccUnresolved;
- throw e;
}
- modifiers ^= AccUnresolved;
return methods;
}
private FieldBinding resolveTypeFor(FieldBinding field) {
@@ -770,33 +779,49 @@ private FieldBinding resolveTypeFor(FieldBinding field) {
if (fieldDecls[f].binding != field)
continue;
- field.type = fieldDecls[f].getTypeBinding(scope);
- field.modifiers ^= AccUnresolved;
- if (!field.type.isValidBinding()) {
- scope.problemReporter().fieldTypeProblem(this, fieldDecls[f], field.type);
- //scope.problemReporter().invalidType(fieldDecls[f].type, field.type);
- fieldDecls[f].binding = null;
- return null;
- }
- if (field.type == VoidBinding) {
- scope.problemReporter().variableTypeCannotBeVoid(fieldDecls[f]);
- fieldDecls[f].binding = null;
- return null;
- }
- if (field.type.isArrayType() && ((ArrayBinding) field.type).leafComponentType == VoidBinding) {
- scope.problemReporter().variableTypeCannotBeVoidArray(fieldDecls[f]);
- fieldDecls[f].binding = null;
- return null;
- }
+ MethodScope initializationScope = field.isStatic()
+ ? scope.referenceContext.staticInitializerScope
+ : scope.referenceContext.initializerScope;
+ FieldBinding previousField = initializationScope.initializedField;
+ try {
+ initializationScope.initializedField = field;
+ TypeBinding fieldType = fieldDecls[f].type.resolveType(initializationScope);
+ field.type = fieldType;
+ field.modifiers ^= AccUnresolved;
+ if (fieldType == null) {
+ fieldDecls[f].binding = null;
+ return null;
+ }
+ if (fieldType == VoidBinding) {
+ scope.problemReporter().variableTypeCannotBeVoid(fieldDecls[f]);
+ fieldDecls[f].binding = null;
+ return null;
+ }
+ if (fieldType.isArrayType() && ((ArrayBinding) fieldType).leafComponentType == VoidBinding) {
+ scope.problemReporter().variableTypeCannotBeVoidArray(fieldDecls[f]);
+ fieldDecls[f].binding = null;
+ return null;
+ }
+ if (fieldType instanceof ReferenceBinding && (((ReferenceBinding)fieldType).modifiers & AccGenericSignature) != 0) {
+ field.modifiers |= AccGenericSignature;
+ }
+ } finally {
+ initializationScope.initializedField = previousField;
+ }
return field;
}
return null; // should never reach this point
}
private MethodBinding resolveTypesFor(MethodBinding method) {
+
if ((method.modifiers & AccUnresolved) == 0)
return method;
AbstractMethodDeclaration methodDecl = method.sourceMethod();
+ if (methodDecl == null) return null; // method could not be resolved in previous iteration
+
+ TypeParameter[] typeParameters = methodDecl.typeParameters();
+ if (typeParameters != null) methodDecl.scope.connectTypeVariables(typeParameters);
TypeReference[] exceptionTypes = methodDecl.thrownExceptions;
if (exceptionTypes != null) {
int size = exceptionTypes.length;
@@ -805,16 +830,21 @@ private MethodBinding resolveTypesFor(MethodBinding method) {
int count = 0;
ReferenceBinding resolvedExceptionType;
for (int i = 0; i < size; i++) {
- resolvedExceptionType = (ReferenceBinding) exceptionTypes[i].getTypeBinding(scope);
- if (!resolvedExceptionType.isValidBinding()) {
- methodDecl.scope.problemReporter().exceptionTypeProblem(this, methodDecl, exceptionTypes[i], resolvedExceptionType);
- //methodDecl.scope.problemReporter().invalidType(exceptionTypes[i], resolvedExceptionType);
+ resolvedExceptionType = (ReferenceBinding) exceptionTypes[i].resolveType(methodDecl.scope);
+ if (resolvedExceptionType == null) {
+ continue;
+ }
+ if (resolvedExceptionType.isGenericType() || resolvedExceptionType.isParameterizedType()) {
+ methodDecl.scope.problemReporter().invalidParameterizedExceptionType(resolvedExceptionType, exceptionTypes[i]);
continue;
}
if (throwable != resolvedExceptionType && !throwable.isSuperclassOf(resolvedExceptionType)) {
methodDecl.scope.problemReporter().cannotThrowType(this, methodDecl, exceptionTypes[i], resolvedExceptionType);
continue;
}
+ if ((resolvedExceptionType.modifiers & AccGenericSignature) != 0) {
+ method.modifiers |= AccGenericSignature;
+ }
method.thrownExceptions[count++] = resolvedExceptionType;
}
if (count < size)
@@ -828,39 +858,45 @@ private MethodBinding resolveTypesFor(MethodBinding method) {
method.parameters = new TypeBinding[size];
for (int i = 0; i < size; i++) {
Argument arg = arguments[i];
- method.parameters[i] = arg.type.getTypeBinding(scope);
- if (!method.parameters[i].isValidBinding()) {
- methodDecl.scope.problemReporter().argumentTypeProblem(this, methodDecl, arg, method.parameters[i]);
- //methodDecl.scope.problemReporter().invalidType(arg, method.parameters[i]);
+ TypeBinding parameterType = arg.type.resolveType(methodDecl.scope);
+ if (parameterType == null) {
foundArgProblem = true;
- } else if (method.parameters[i] == VoidBinding) {
+ } else if (parameterType == VoidBinding) {
methodDecl.scope.problemReporter().argumentTypeCannotBeVoid(this, methodDecl, arg);
foundArgProblem = true;
- } else if (method.parameters[i].isArrayType() && ((ArrayBinding) method.parameters[i]).leafComponentType == VoidBinding) {
+ } else if (parameterType.isArrayType() && ((ArrayBinding) parameterType).leafComponentType == VoidBinding) {
methodDecl.scope.problemReporter().argumentTypeCannotBeVoidArray(this, methodDecl, arg);
foundArgProblem = true;
+ } else {
+ if (parameterType instanceof ReferenceBinding && (((ReferenceBinding)parameterType).modifiers & AccGenericSignature) != 0) {
+ method.modifiers |= AccGenericSignature;
+ }
+ method.parameters[i] = parameterType;
}
}
}
boolean foundReturnTypeProblem = false;
if (!method.isConstructor()) {
- TypeReference returnType = ((MethodDeclaration) methodDecl).returnType;
+ TypeReference returnType = methodDecl instanceof MethodDeclaration
+ ? ((MethodDeclaration) methodDecl).returnType
+ : ((AnnotationTypeMemberDeclaration) methodDecl).returnType;
if (returnType == null) {
methodDecl.scope.problemReporter().missingReturnType(methodDecl);
method.returnType = null;
foundReturnTypeProblem = true;
} else {
- method.returnType = returnType.getTypeBinding(scope);
- if (!method.returnType.isValidBinding()) {
- methodDecl.scope.problemReporter().returnTypeProblem(this, (MethodDeclaration) methodDecl, method.returnType);
- //methodDecl.scope.problemReporter().invalidType(returnType, method.returnType);
- method.returnType = null;
+ TypeBinding methodType = returnType.resolveType(methodDecl.scope);
+ if (methodType == null) {
foundReturnTypeProblem = true;
- } else if (method.returnType.isArrayType() && ((ArrayBinding) method.returnType).leafComponentType == VoidBinding) {
+ } else if (methodType.isArrayType() && ((ArrayBinding) methodType).leafComponentType == VoidBinding) {
methodDecl.scope.problemReporter().returnTypeCannotBeVoidArray(this, (MethodDeclaration) methodDecl);
- method.returnType = null;
foundReturnTypeProblem = true;
+ } else {
+ method.returnType = methodType;
+ if (methodType instanceof ReferenceBinding && (((ReferenceBinding)methodType).modifiers & AccGenericSignature) != 0) {
+ method.modifiers |= AccGenericSignature;
+ }
}
}
}
@@ -886,6 +922,7 @@ public ReferenceBinding superclass() {
public ReferenceBinding[] superInterfaces() {
return superInterfaces;
}
+// TODO (philippe) could be a performance issue since some senders are building the list just to count them
public SyntheticAccessMethodBinding[] syntheticAccessMethods() {
if (synthetics == null || synthetics[METHOD_EMUL] == null || synthetics[METHOD_EMUL].size() == 0) return null;
@@ -893,10 +930,10 @@ public SyntheticAccessMethodBinding[] syntheticAccessMethods() {
// difficult to compute size up front because of the embedded arrays so assume there is only 1
int index = 0;
SyntheticAccessMethodBinding[] bindings = new SyntheticAccessMethodBinding[1];
- Enumeration fieldsOrMethods = synthetics[METHOD_EMUL].keys();
- while (fieldsOrMethods.hasMoreElements()) {
+ Iterator fieldsOrMethods = synthetics[METHOD_EMUL].keySet().iterator();
+ while (fieldsOrMethods.hasNext()) {
- Object fieldOrMethod = fieldsOrMethods.nextElement();
+ Object fieldOrMethod = fieldsOrMethods.next();
if (fieldOrMethod instanceof MethodBinding) {
@@ -909,7 +946,7 @@ public SyntheticAccessMethodBinding[] syntheticAccessMethods() {
if (methodAccessors[0] != null)
bindings[index++] = methodAccessors[0]; // super access
if (methodAccessors[1] != null)
- bindings[index++] = methodAccessors[1]; // normal access
+ bindings[index++] = methodAccessors[1]; // normal access or bridge
} else {
@@ -950,89 +987,108 @@ public FieldBinding[] syntheticFields() {
// add innerclass synthetics
if (synthetics[FIELD_EMUL] != null){
- Enumeration elements = synthetics[FIELD_EMUL].elements();
+ Iterator elements = synthetics[FIELD_EMUL].values().iterator();
for (int i = 0; i < fieldSize; i++) {
- SyntheticFieldBinding synthBinding = (SyntheticFieldBinding) elements.nextElement();
+ SyntheticFieldBinding synthBinding = (SyntheticFieldBinding) elements.next();
bindings[synthBinding.index] = synthBinding;
}
}
// add class literal synthetics
if (synthetics[CLASS_LITERAL_EMUL] != null){
- Enumeration elements = synthetics[CLASS_LITERAL_EMUL].elements();
+ Iterator elements = synthetics[CLASS_LITERAL_EMUL].values().iterator();
for (int i = 0; i < literalSize; i++) {
- SyntheticFieldBinding synthBinding = (SyntheticFieldBinding) elements.nextElement();
+ SyntheticFieldBinding synthBinding = (SyntheticFieldBinding) elements.next();
bindings[fieldSize+synthBinding.index] = synthBinding;
}
}
return bindings;
}
public String toString() {
- String s = "(id="+(id == NoId ? "NoId" : (""+id) ) +")\n"; //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-4$ //$NON-NLS-1$
-
- if (isDeprecated()) s += "deprecated "; //$NON-NLS-1$
- if (isPublic()) s += "public "; //$NON-NLS-1$
- if (isProtected()) s += "protected "; //$NON-NLS-1$
- if (isPrivate()) s += "private "; //$NON-NLS-1$
- if (isAbstract() && isClass()) s += "abstract "; //$NON-NLS-1$
- if (isStatic() && isNestedType()) s += "static "; //$NON-NLS-1$
- if (isFinal()) s += "final "; //$NON-NLS-1$
-
- s += isInterface() ? "interface " : "class "; //$NON-NLS-1$ //$NON-NLS-2$
- s += (compoundName != null) ? CharOperation.toString(compoundName) : "UNNAMED TYPE"; //$NON-NLS-1$
-
- s += "\n\textends "; //$NON-NLS-1$
- s += (superclass != null) ? superclass.debugName() : "NULL TYPE"; //$NON-NLS-1$
+ StringBuffer buffer = new StringBuffer(30);
+ buffer.append("(id="); //$NON-NLS-1$
+ if (id == NoId)
+ buffer.append("NoId"); //$NON-NLS-1$
+ else
+ buffer.append(id);
+ buffer.append(")\n"); //$NON-NLS-1$
+ if (isDeprecated()) buffer.append("deprecated "); //$NON-NLS-1$
+ if (isPublic()) buffer.append("public "); //$NON-NLS-1$
+ if (isProtected()) buffer.append("protected "); //$NON-NLS-1$
+ if (isPrivate()) buffer.append("private "); //$NON-NLS-1$
+ if (isAbstract() && isClass()) buffer.append("abstract "); //$NON-NLS-1$
+ if (isStatic() && isNestedType()) buffer.append("static "); //$NON-NLS-1$
+ if (isFinal()) buffer.append("final "); //$NON-NLS-1$
+
+ buffer.append(isInterface() ? "interface " : "class "); //$NON-NLS-1$ //$NON-NLS-2$
+ buffer.append((compoundName != null) ? CharOperation.toString(compoundName) : "UNNAMED TYPE"); //$NON-NLS-1$
+
+ if (this.typeVariables != null && this.typeVariables != NoTypeVariables) {
+ buffer.append("\n\t<"); //$NON-NLS-1$
+ for (int i = 0, length = this.typeVariables.length; i < length; i++) {
+ if (i > 0)
+ buffer.append(", "); //$NON-NLS-1$
+ buffer.append((this.typeVariables[i] != null) ? this.typeVariables[i].toString() : "NULL TYPE VARIABLE"); //$NON-NLS-1$
+ }
+ buffer.append(">"); //$NON-NLS-1$
+ } else {
+ buffer.append("<NULL TYPE VARIABLES>"); //$NON-NLS-1$
+ }
+ buffer.append("\n\textends "); //$NON-NLS-1$
+ buffer.append((superclass != null) ? superclass.debugName() : "NULL TYPE"); //$NON-NLS-1$
if (superInterfaces != null) {
if (superInterfaces != NoSuperInterfaces) {
- s += "\n\timplements : "; //$NON-NLS-1$
+ buffer.append("\n\timplements : "); //$NON-NLS-1$
for (int i = 0, length = superInterfaces.length; i < length; i++) {
if (i > 0)
- s += ", "; //$NON-NLS-1$
- s += (superInterfaces[i] != null) ? superInterfaces[i].debugName() : "NULL TYPE"; //$NON-NLS-1$
+ buffer.append(", "); //$NON-NLS-1$
+ buffer.append((superInterfaces[i] != null) ? superInterfaces[i].debugName() : "NULL TYPE"); //$NON-NLS-1$
}
}
} else {
- s += "NULL SUPERINTERFACES"; //$NON-NLS-1$
+ buffer.append("NULL SUPERINTERFACES"); //$NON-NLS-1$
}
if (enclosingType() != null) {
- s += "\n\tenclosing type : "; //$NON-NLS-1$
- s += enclosingType().debugName();
+ buffer.append("\n\tenclosing type : "); //$NON-NLS-1$
+ buffer.append(enclosingType().debugName());
}
if (fields != null) {
if (fields != NoFields) {
- s += "\n/* fields */"; //$NON-NLS-1$
+ buffer.append("\n/* fields */"); //$NON-NLS-1$
for (int i = 0, length = fields.length; i < length; i++)
- s += (fields[i] != null) ? "\n" + fields[i].toString() : "\nNULL FIELD"; //$NON-NLS-1$ //$NON-NLS-2$
+ buffer.append('\n').append((fields[i] != null) ? fields[i].toString() : "NULL FIELD"); //$NON-NLS-1$
}
} else {
- s += "NULL FIELDS"; //$NON-NLS-1$
+ buffer.append("NULL FIELDS"); //$NON-NLS-1$
}
if (methods != null) {
if (methods != NoMethods) {
- s += "\n/* methods */"; //$NON-NLS-1$
+ buffer.append("\n/* methods */"); //$NON-NLS-1$
for (int i = 0, length = methods.length; i < length; i++)
- s += (methods[i] != null) ? "\n" + methods[i].toString() : "\nNULL METHOD"; //$NON-NLS-1$ //$NON-NLS-2$
+ buffer.append('\n').append((methods[i] != null) ? methods[i].toString() : "NULL METHOD"); //$NON-NLS-1$ //$NON-NLS-2$
}
} else {
- s += "NULL METHODS"; //$NON-NLS-1$
+ buffer.append("NULL METHODS"); //$NON-NLS-1$
}
if (memberTypes != null) {
if (memberTypes != NoMemberTypes) {
- s += "\n/* members */"; //$NON-NLS-1$
+ buffer.append("\n/* members */"); //$NON-NLS-1$
for (int i = 0, length = memberTypes.length; i < length; i++)
- s += (memberTypes[i] != null) ? "\n" + memberTypes[i].toString() : "\nNULL TYPE"; //$NON-NLS-1$ //$NON-NLS-2$
+ buffer.append('\n').append((memberTypes[i] != null) ? memberTypes[i].toString() : "NULL TYPE"); //$NON-NLS-1$ //$NON-NLS-2$
}
} else {
- s += "NULL MEMBER TYPES"; //$NON-NLS-1$
+ buffer.append("NULL MEMBER TYPES"); //$NON-NLS-1$
}
- s += "\n\n\n"; //$NON-NLS-1$
- return s;
+ buffer.append("\n\n"); //$NON-NLS-1$
+ return buffer.toString();
+}
+public TypeVariableBinding[] typeVariables() {
+ return this.typeVariables;
}
void verifyMethods(MethodVerifier verifier) {
verifier.verify(this);
@@ -1055,9 +1111,9 @@ public FieldBinding getSyntheticField(ReferenceBinding targetEnclosingType, bool
// class T { class M{}}
// class S extends T { class N extends M {}} --> need to use S as a default enclosing instance for the super constructor call in N().
if (!onlyExactMatch){
- Enumeration accessFields = synthetics[FIELD_EMUL].elements();
- while (accessFields.hasMoreElements()) {
- field = (FieldBinding) accessFields.nextElement();
+ Iterator accessFields = synthetics[FIELD_EMUL].values().iterator();
+ while (accessFields.hasNext()) {
+ field = (FieldBinding) accessFields.next();
if (CharOperation.prefixEquals(SyntheticArgumentBinding.EnclosingInstancePrefix, field.name)
&& targetEnclosingType.isSuperclassOf((ReferenceBinding) field.type))
return field;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Substitution.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Substitution.java
new file mode 100644
index 0000000000..8d40cd0f64
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Substitution.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.lookup;
+
+/*
+ * Encapsulates aspects related to type variable substitution
+ */
+public interface Substitution {
+
+ /**
+ * Returns the type substitute for a given type, or itself
+ * if no substitution got performed.
+ */
+ TypeBinding substitute(TypeBinding originalType);
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticAccessMethodBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticAccessMethodBinding.java
index 0803da42d0..3c50d30315 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticAccessMethodBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticAccessMethodBinding.java
@@ -27,6 +27,7 @@ public class SyntheticAccessMethodBinding extends MethodBinding {
public final static int MethodAccess = 3; // normal method
public final static int ConstructorAccess = 4; // constructor
public final static int SuperMethodAccess = 5; // super method
+ public final static int BridgeMethodAccess = 6; // bridge method
final static char[] AccessMethodPrefix = { 'a', 'c', 'c', 'e', 's', 's', '$' };
@@ -135,6 +136,24 @@ public class SyntheticAccessMethodBinding extends MethodBinding {
}
}
+ /*
+ * Construct a bridge method
+ */
+ public SyntheticAccessMethodBinding(MethodBinding overridenMethodToBridge, MethodBinding localTargetMethod) {
+ this.declaringClass = localTargetMethod.declaringClass;
+ this.selector = overridenMethodToBridge.selector;
+ this.modifiers = overridenMethodToBridge.modifiers | AccBridge | AccSynthetic;
+ this.modifiers &= ~(AccAbstract | AccNative);
+ this.returnType = overridenMethodToBridge.returnType;
+ this.parameters = overridenMethodToBridge.parameters;
+ this.thrownExceptions = overridenMethodToBridge.thrownExceptions;
+ this.targetMethod = localTargetMethod;
+ this.accessType = BridgeMethodAccess;
+ SyntheticAccessMethodBinding[] knownAccessMethods = ((SourceTypeBinding)this.declaringClass).syntheticAccessMethods();
+ int methodId = knownAccessMethods == null ? 0 : knownAccessMethods.length;
+ this.index = methodId;
+ }
+
/**
* An constructor accessor is a constructor with an extra argument (declaringClass), in case of
* collision with an existing constructor, then add again an extra argument (declaringClass again).
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java
index 556a7c41e5..358a7c46ec 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java
@@ -10,36 +10,50 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
+import org.eclipse.jdt.internal.compiler.ast.ASTNode;
+
public interface TagBits {
+
// Tag bits in the tagBits int of every TypeBinding
- final int IsArrayType = 0x0001;
- final int IsBaseType = 0x0002;
- final int IsNestedType = 0x0004;
- final int IsMemberType = 0x0008;
+ final int IsArrayType = ASTNode.Bit1;
+ final int IsBaseType = ASTNode.Bit2;
+ final int IsNestedType = ASTNode.Bit3;
+ final int IsMemberType = ASTNode.Bit4;
final int MemberTypeMask = IsNestedType | IsMemberType;
- final int IsLocalType = 0x0010;
+ final int IsLocalType = ASTNode.Bit5;
final int LocalTypeMask = IsNestedType | IsLocalType;
- final int IsAnonymousType = 0x0020;
+ final int IsAnonymousType = ASTNode.Bit6;
final int AnonymousTypeMask = LocalTypeMask | IsAnonymousType;
- final int IsBinaryBinding = 0x0040;
-
+ final int IsBinaryBinding = ASTNode.Bit7;
+
// for the type hierarchy check used by ClassScope
- final int BeginHierarchyCheck = 0x0100;
- final int EndHierarchyCheck = 0x0200;
+ final int BeginHierarchyCheck = ASTNode.Bit9;
+ final int EndHierarchyCheck = ASTNode.Bit10;
// test bit to see if default abstract methods were computed
- final int KnowsDefaultAbstractMethods = 0x0400;
+ final int KnowsDefaultAbstractMethods = ASTNode.Bit11;
// Reusable bit currently used by Scopes
- final int InterfaceVisited = 0x0800;
+ final int InterfaceVisited = ASTNode.Bit12;
// test bits to see if parts of binary types are faulted
- final int AreFieldsComplete = 0x1000;
- final int AreMethodsComplete = 0x2000;
+ final int AreFieldsComplete = ASTNode.Bit13;
+ final int AreMethodsComplete = ASTNode.Bit14;
// test bit to avoid asking a type for a member type (includes inherited member types)
- final int HasNoMemberTypes = 0x4000;
+ final int HasNoMemberTypes = ASTNode.Bit15;
// test bit to identify if the type's hierarchy is inconsistent
- final int HierarchyHasProblems = 0x8000;
+ final int HierarchyHasProblems = ASTNode.Bit16;
+
+ // used by BinaryTypeBinding
+ final int HasUnresolvedTypeVariables = ASTNode.Bit25;
+ final int HasUnresolvedSuperclass = ASTNode.Bit26;
+ final int HasUnresolvedSuperinterfaces = ASTNode.Bit27;
+ final int HasUnresolvedEnclosingType = ASTNode.Bit28;
+ final int HasUnresolvedMemberTypes = ASTNode.Bit29;
+
+ final int HasTypeVariable = ASTNode.Bit30; // set either for type variables (direct) or parameterized types indirectly referencing type variables
+ final int HasWildcard = ASTNode.Bit31; // set either for wildcards (direct) or parameterized types indirectly referencing wildcards
+
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java
index c6cd627c2f..1bcc7e2373 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java
@@ -10,7 +10,9 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
+import java.util.Map;
import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.compiler.ast.Wildcard;
/*
* Not all fields defined by this type (& its subclasses) are initialized when it is created.
@@ -38,13 +40,20 @@ public boolean canBeInstantiated() {
return !isBaseType();
}
/**
+ * Collect the substitutes into a map for certain type variables inside the receiver type
+ * e.g. Collection<T>.findSubstitute(T, Collection<List<X>>): T --> List<X>
+ */
+public void collectSubstitutes(TypeBinding otherType, Map substitutes) {
+ // no substitute by default
+}
+/**
* Answer the receiver's constant pool name.
* NOTE: This method should only be used during/after code gen.
* e.g. 'java/lang/Object'
*/
public abstract char[] constantPoolName();
-String debugName() {
+public String debugName() {
return new String(readableName());
}
/*
@@ -53,16 +62,30 @@ String debugName() {
public int dimensions(){
return 0;
}
+public TypeBinding erasure() {
+ return this;
+}
+/**
+ * Returns the type to use for generic cast, or null if none required
+ */
+public TypeBinding genericCast(TypeBinding otherType) {
+ if (this == otherType) return null;
+ if (otherType.isWildcard() && ((WildcardBinding)otherType).kind != Wildcard.EXTENDS) return null;
+ TypeBinding otherErasure = otherType.erasure();
+ if (otherErasure == this.erasure()) return null;
+ return otherErasure;
+}
+public char[] genericTypeSignature() {
+ return signature();
+}
public abstract PackageBinding getPackage();
/* Answer true if the receiver is an array
*/
-
public final boolean isArrayType() {
return (tagBits & IsArrayType) != 0;
}
/* Answer true if the receiver is a base type
*/
-
public final boolean isBaseType() {
return (tagBits & IsBaseType) != 0;
}
@@ -71,17 +94,39 @@ public boolean isClass() {
}
/* Answer true if the receiver type can be assigned to the argument type (right)
*/
-
public abstract boolean isCompatibleWith(TypeBinding right);
+
+/**
+ * Returns true if a type is identical to another one,
+ * or for generic types, true if compared to its raw type.
+ */
+public boolean isEquivalentTo(TypeBinding otherType) {
+ return this == otherType;
+}
+
+public boolean isGenericType() {
+ return false;
+}
+
/* Answer true if the receiver's hierarchy has problems (always false for arrays & base types)
*/
-
public final boolean isHierarchyInconsistent() {
return (tagBits & HierarchyHasProblems) != 0;
}
public boolean isInterface() {
return false;
}
+public final boolean isLocalType() {
+ return (tagBits & IsLocalType) != 0;
+}
+
+public final boolean isMemberType() {
+ return (tagBits & IsMemberType) != 0;
+}
+
+public final boolean isNestedType() {
+ return (tagBits & IsNestedType) != 0;
+}
public final boolean isNumericType() {
switch (id) {
case T_int :
@@ -97,6 +142,27 @@ public final boolean isNumericType() {
}
}
+/**
+ * Returns true if the type is parameterized, e.g. List<String>
+ */
+public boolean isParameterizedType() {
+ return false;
+}
+
+/**
+ * Returns true if the type was declared as a type variable
+ */
+public boolean isTypeVariable() {
+ return false;
+}
+
+/**
+ * Returns true if the type is a wildcard
+ */
+public boolean isWildcard() {
+ return false;
+}
+
public TypeBinding leafComponentType(){
return this;
}
@@ -121,6 +187,11 @@ public char[] qualifiedPackageName() {
*/
public abstract char[] qualifiedSourceName();
+
+public boolean isRawType() {
+ return false;
+}
+
/* Answer the receiver's signature.
*
* Arrays & base types do not distinguish between signature() & constantPoolName().
@@ -131,8 +202,12 @@ public abstract char[] qualifiedSourceName();
public char[] signature() {
return constantPoolName();
}
+
public abstract char[] sourceName();
+public void swapUnresolved(UnresolvedReferenceBinding unresolvedType, ReferenceBinding resolvedType, LookupEnvironment environment) {
+ // subclasses must override if they wrap another type binding
+}
/**
* Match a well-known type id to its binding
*/
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
index 5f6064f3e1..2403287f68 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java
@@ -18,6 +18,7 @@ public interface TypeConstants {
final char[] CharArray_JAVA_LANG_OBJECT = "java.lang.Object".toCharArray(); //$NON-NLS-1$
final char[] LENGTH = "length".toCharArray(); //$NON-NLS-1$
final char[] CLONE = "clone".toCharArray(); //$NON-NLS-1$
+ final char[] GETCLASS = "getClass".toCharArray(); //$NON-NLS-1$
final char[] OBJECT = "Object".toCharArray(); //$NON-NLS-1$
final char[] MAIN = "main".toCharArray(); //$NON-NLS-1$
final char[] SERIALVERSIONUID = "serialVersionUID".toCharArray(); //$NON-NLS-1$
@@ -29,8 +30,15 @@ public interface TypeConstants {
final char[] CharArray_JAVA_IO_OBJECTINPUTSTREAM = "java.io.ObjectInputStream".toCharArray(); //$NON-NLS-1$
final char[] CharArray_JAVA_IO_OBJECTOUTPUTSTREAM = "java.io.ObjectOutputStream".toCharArray(); //$NON-NLS-1$
final char[] CharArray_JAVA_IO_OBJECTSTREAMFIELD = "java.io.ObjectStreamField".toCharArray(); //$NON-NLS-1$
-
-
+ final char[] ANONYM_PREFIX = "new ".toCharArray(); //$NON-NLS-1$
+ final char[] ANONYM_SUFFIX = "(){}".toCharArray(); //$NON-NLS-1$
+ final char[] WILDCARD_NAME = { '?' };
+ final char[] WILDCARD_SUPER = " super ".toCharArray(); //$NON-NLS-1$
+ final char[] WILDCARD_EXTENDS = " extends ".toCharArray(); //$NON-NLS-1$
+ final char[] WILDCARD_MINUS = { '-' };
+ final char[] WILDCARD_STAR = { '*' };
+ final char[] WILDCARD_PLUS = { '+' };
+
// Constant compound names
final char[][] JAVA_LANG = {JAVA, LANG};
final char[][] JAVA_IO = {JAVA, IO};
@@ -40,10 +48,12 @@ public interface TypeConstants {
final char[][] JAVA_LANG_CLONEABLE = {JAVA, LANG, "Cloneable".toCharArray()}; //$NON-NLS-1$
final char[][] JAVA_LANG_EXCEPTION = {JAVA, LANG, "Exception".toCharArray()}; //$NON-NLS-1$
final char[][] JAVA_LANG_ERROR = {JAVA, LANG, "Error".toCharArray()}; //$NON-NLS-1$
+ final char[][] JAVA_LANG_ITERABLE = {JAVA, LANG, "Iterable".toCharArray()}; //$NON-NLS-1$
final char[][] JAVA_LANG_NOCLASSDEFERROR = {JAVA, LANG, "NoClassDefError".toCharArray()}; //$NON-NLS-1$
final char[][] JAVA_LANG_OBJECT = {JAVA, LANG, OBJECT};
final char[][] JAVA_LANG_STRING = {JAVA, LANG, "String".toCharArray()}; //$NON-NLS-1$
final char[][] JAVA_LANG_STRINGBUFFER = {JAVA, LANG, "StringBuffer".toCharArray()}; //$NON-NLS-1$
+ final char[][] JAVA_LANG_STRINGBUILDER = {JAVA, LANG, "StringBuilder".toCharArray()}; //$NON-NLS-1$
final char[][] JAVA_LANG_SYSTEM = {JAVA, LANG, "System".toCharArray()}; //$NON-NLS-1$
final char[][] JAVA_LANG_RUNTIMEEXCEPTION = {JAVA, LANG, "RuntimeException".toCharArray()}; //$NON-NLS-1$
final char[][] JAVA_LANG_THROWABLE = {JAVA, LANG, "Throwable".toCharArray()}; //$NON-NLS-1$
@@ -59,6 +69,7 @@ public interface TypeConstants {
final char[][] JAVA_LANG_DOUBLE = {JAVA, LANG, "Double".toCharArray()}; //$NON-NLS-1$
final char[][] JAVA_LANG_BOOLEAN = {JAVA, LANG, "Boolean".toCharArray()}; //$NON-NLS-1$
final char[][] JAVA_LANG_VOID = {JAVA, LANG, "Void".toCharArray()}; //$NON-NLS-1$
+ final char[][] JAVA_UTIL_ITERATOR = {JAVA, "util".toCharArray(), "Iterator".toCharArray()}; //$NON-NLS-1$//$NON-NLS-2$
// Constants used by the flow analysis
final int EqualOrMoreSpecific = -1;
@@ -74,4 +85,5 @@ public interface TypeConstants {
final MethodBinding[] NoMethods = new MethodBinding[0];
final ReferenceBinding[] NoSuperInterfaces = new ReferenceBinding[0];
final ReferenceBinding[] NoMemberTypes = new ReferenceBinding[0];
+ final TypeVariableBinding[] NoTypeVariables = new TypeVariableBinding[0];
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java
index 5fe8af075c..d4b3d25870 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java
@@ -11,9 +11,10 @@
package org.eclipse.jdt.internal.compiler.lookup;
public interface TypeIds {
- //base type void null undefined Object String
- //should have an id that is 0<= id <= 15
+ //base type void null undefined Object String
+ //should have an id that is 0<= id <= 15
+ // The IDs below must be representable using 4 bits so as to fit in operator signatures.
final int T_undefined = 0; // should not be changed
final int T_Object = 1;
final int T_char = 2;
@@ -27,8 +28,6 @@ public interface TypeIds {
final int T_int = 10;
final int T_String = 11;
final int T_null = 12;
- //final int T_extendedDouble = 13;
- //final int T_extendedLong = 14
//=========end of 4 bits constraint===========
@@ -58,12 +57,17 @@ public interface TypeIds {
final int T_JavaLangBoolean = 33;
final int T_JavaLangVoid = 34;
- // 1.4 feature
+ // 1.4 features
final int T_JavaLangAssertionError = 35;
-
+
// array interfaces
final int T_JavaLangCloneable = 36;
final int T_JavaIoSerializable = 37;
+
+ // 1.5 features
+ final int T_JavaLangIterable = 38;
+ final int T_JavaUtilIterator = 39;
+ final int T_JavaLangStringBuilder = 40;
final int NoId = Integer.MAX_VALUE;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java
new file mode 100644
index 0000000000..f84296a049
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 International Business Machines Corp. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jdt.internal.compiler.lookup;
+
+import java.util.Map;
+import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.compiler.ast.Wildcard;
+
+/**
+ * Binding for a type parameter, held by source/binary type or method.
+ */
+public class TypeVariableBinding extends ReferenceBinding {
+
+ public Binding declaringElement; // binding of declaring type or method
+ public int rank; // declaration rank, can be used to match variable in parameterized type
+
+ /**
+ * Denote the first explicit (binding) bound amongst the supertypes (from declaration in source)
+ * If no superclass was specified, then it denotes the first superinterface, or null if none was specified.
+ */
+ public ReferenceBinding firstBound;
+
+ // actual resolved variable supertypes (if no superclass bound, then associated to Object)
+ public ReferenceBinding superclass;
+ public ReferenceBinding[] superInterfaces;
+ public char[] genericTypeSignature;
+
+ public TypeVariableBinding(char[] sourceName, Binding declaringElement, int rank) {
+ this.sourceName = sourceName;
+ this.declaringElement = declaringElement;
+ this.rank = rank;
+ this.modifiers = AccPublic | AccGenericSignature; // treat type var as public
+ this.tagBits |= HasTypeVariable;
+ }
+
+ /**
+ * Returns true if the argument type satisfies all bounds of the type parameter
+ */
+ public boolean boundCheck(Substitution substitution, TypeBinding argumentType) {
+ if (argumentType == NullBinding)
+ return true;
+ if (!(argumentType instanceof ReferenceBinding || argumentType.isArrayType()))
+ return false;
+ if (this.superclass.id != T_Object && !argumentType.isCompatibleWith(substitution.substitute(this.superclass))) {
+ return false;
+ }
+ for (int i = 0, length = this.superInterfaces.length; i < length; i++) {
+ if (!argumentType.isCompatibleWith(substitution.substitute(this.superInterfaces[i]))) {
+ return false;
+ }
+ }
+ if (argumentType.isWildcard()) {
+ WildcardBinding wildcard = (WildcardBinding) argumentType;
+ if (wildcard.kind == Wildcard.SUPER) {
+ if (!boundCheck(substitution, wildcard.bound)) return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Collect the substitutes into a map for certain type variables inside the receiver type
+ * e.g. Collection<T>.findSubstitute(T, Collection<List<X>>): T --> List<X>
+ */
+ public void collectSubstitutes(TypeBinding otherType, Map substitutes) {
+ // cannot infer anything from a null type
+ if (otherType == NullBinding) return;
+
+ TypeBinding[] variableSubstitutes = (TypeBinding[])substitutes.get(this);
+ if (variableSubstitutes != null) {
+ int length = variableSubstitutes.length;
+ for (int i = 0; i < length; i++) {
+ if (variableSubstitutes[i] == otherType) return; // already there
+ if (variableSubstitutes[i] == null) {
+ variableSubstitutes[i] = otherType;
+ return;
+ }
+ }
+ // no free spot found, need to grow
+ System.arraycopy(variableSubstitutes, 0, variableSubstitutes = new TypeBinding[2*length], 0, length);
+ variableSubstitutes[length] = otherType;
+ substitutes.put(this, variableSubstitutes);
+ }
+ }
+
+ public char[] constantPoolName() { /* java/lang/Object */
+ if (this.firstBound != null) {
+ return this.firstBound.constantPoolName();
+ }
+ return this.superclass.constantPoolName(); // java/lang/Object
+ }
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#debugName()
+ */
+ public String debugName() {
+ return new String(this.sourceName);
+ }
+ public TypeBinding erasure() {
+ if (this.firstBound != null) {
+ return this.firstBound.erasure();
+ }
+ return this.superclass; // java/lang/Object
+ }
+
+ /**
+ * T::Ljava/util/Map;:Ljava/io/Serializable;
+ * T:LY<TT;>
+ */
+ public char[] genericSignature() {
+ StringBuffer sig = new StringBuffer(10);
+ sig.append(this.sourceName).append(':');
+ int interfaceLength = this.superInterfaces.length;
+ if (interfaceLength == 0 || this.firstBound == this.superclass) {
+ sig.append(this.superclass.genericTypeSignature());
+ }
+ for (int i = 0; i < interfaceLength; i++) {
+ sig.append(':').append(this.superInterfaces[i].genericTypeSignature());
+ }
+ int sigLength = sig.length();
+ char[] genericSignature = new char[sigLength];
+ sig.getChars(0, sigLength, genericSignature, 0);
+ return genericSignature;
+ }
+ /**
+ * T::Ljava/util/Map;:Ljava/io/Serializable;
+ * T:LY<TT;>
+ */
+ public char[] genericTypeSignature() {
+ if (this.genericTypeSignature != null) return this.genericTypeSignature;
+ return this.genericTypeSignature = CharOperation.concat('T', this.sourceName, ';');
+ }
+ /**
+ * Returns true if a type is identical to another one,
+ * or for generic types, true if compared to its raw type.
+ */
+ public boolean isEquivalentTo(TypeBinding otherType) {
+ if (this == otherType) return true;
+ if (otherType == null) return false;
+ if (otherType.isWildcard()) // wildcard
+ return ((WildcardBinding) otherType).boundCheck(this);
+ return false;
+ }
+ /**
+ * Returns true if the type was declared as a type variable
+ */
+ public boolean isTypeVariable() {
+ return true;
+ }
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#readableName()
+ */
+ public char[] readableName() {
+ return this.sourceName;
+ }
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#shortReadableName()
+ */
+ public char[] shortReadableName() {
+ return this.readableName();
+ }
+ public ReferenceBinding superclass() {
+ return superclass;
+ }
+ public ReferenceBinding[] superInterfaces() {
+ return superInterfaces;
+ }
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ StringBuffer buffer = new StringBuffer(10);
+ buffer.append('<').append(this.sourceName);//.append('[').append(this.rank).append(']');
+ if (this.superclass != null && this.firstBound == this.superclass) {
+ buffer.append(" extends ").append(this.superclass.debugName()); //$NON-NLS-1$
+ }
+ if (this.superInterfaces != null && this.superInterfaces != NoSuperInterfaces) {
+ if (this.firstBound != this.superclass) {
+ buffer.append(" extends "); //$NON-NLS-1$
+ }
+ for (int i = 0, length = this.superInterfaces.length; i < length; i++) {
+ if (i > 0 || this.firstBound == this.superclass) {
+ buffer.append(" & "); //$NON-NLS-1$
+ }
+ buffer.append(this.superInterfaces[i].debugName());
+ }
+ }
+ buffer.append('>');
+ return buffer.toString();
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java
index 65ff088d9c..69a03b77bd 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java
@@ -13,29 +13,56 @@ package org.eclipse.jdt.internal.compiler.lookup;
import org.eclipse.jdt.core.compiler.CharOperation;
public class UnresolvedReferenceBinding extends ReferenceBinding {
- ReferenceBinding resolvedType;
+
+ReferenceBinding resolvedType;
+TypeBinding[] wrappers;
+
UnresolvedReferenceBinding(char[][] compoundName, PackageBinding packageBinding) {
this.compoundName = compoundName;
this.sourceName = compoundName[compoundName.length - 1]; // reasonable guess
this.fPackage = packageBinding;
+ this.wrappers = null;
+}
+void addWrapper(TypeBinding wrapper) {
+ if (this.wrappers == null) {
+ this.wrappers = new TypeBinding[] {wrapper};
+ } else {
+ int length = this.wrappers.length;
+ System.arraycopy(this.wrappers, 0, this.wrappers = new TypeBinding[length + 1], 0, length);
+ this.wrappers[length] = wrapper;
+ }
}
-String debugName() {
+public String debugName() {
return toString();
}
-ReferenceBinding resolve(LookupEnvironment environment) {
- if (resolvedType != null) return resolvedType;
-
- ReferenceBinding environmentType = fPackage.getType0(compoundName[compoundName.length - 1]);
- if (environmentType == this)
- environmentType = environment.askForType(compoundName);
- if (environmentType != null && environmentType != this) { // could not resolve any better, error was already reported against it
- resolvedType = environmentType;
- environment.updateArrayCache(this, environmentType);
- return environmentType; // when found, it replaces the unresolved type in the cache
+ReferenceBinding resolve(LookupEnvironment environment, boolean convertGenericToRawType) {
+ ReferenceBinding targetType = this.resolvedType;
+ if (targetType == null) {
+ targetType = this.fPackage.getType0(this.compoundName[this.compoundName.length - 1]);
+ if (targetType == this)
+ targetType = environment.askForType(this.compoundName);
+ if (targetType != null && targetType != this) { // could not resolve any better, error was already reported against it
+ setResolvedType(targetType, environment);
+ } else {
+ environment.problemReporter.isClassPathCorrect(this.compoundName, null);
+ return null; // will not get here since the above error aborts the compilation
+ }
}
+ if (convertGenericToRawType && targetType.isGenericType()) // raw reference to generic ?
+ return environment.createRawType(targetType, null);
+ return targetType;
+}
+void setResolvedType(ReferenceBinding targetType, LookupEnvironment environment) {
+ if (this.resolvedType == targetType) return; // already resolved
- environment.problemReporter.isClassPathCorrect(compoundName, null);
- return null; // will not get here since the above error aborts the compilation
+ // targetType may be a source or binary type
+ this.resolvedType = targetType;
+ // must ensure to update any other type bindings that can contain the resolved type
+ // otherwise we could create 2 : 1 for this unresolved type & 1 for the resolved type
+ if (this.wrappers != null)
+ for (int i = 0, l = this.wrappers.length; i < l; i++)
+ this.wrappers[i].swapUnresolved(this, targetType, environment);
+ environment.updateCaches(this, targetType);
}
public String toString() {
return "Unresolved type " + ((compoundName != null) ? CharOperation.toString(compoundName) : "UNNAMED"); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/VariableBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/VariableBinding.java
index 2e06558b5c..7d49c0117e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/VariableBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/VariableBinding.java
@@ -13,6 +13,7 @@ package org.eclipse.jdt.internal.compiler.lookup;
import org.eclipse.jdt.internal.compiler.impl.Constant;
public abstract class VariableBinding extends Binding {
+
public int modifiers;
public TypeBinding type;
public char[] name;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java
new file mode 100644
index 0000000000..c906361327
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java
@@ -0,0 +1,315 @@
+/*******************************************************************************
+ * 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.lookup;
+
+import java.util.Map;
+import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.compiler.ast.Wildcard;
+
+/*
+ * A wildcard acts as an argument for parameterized types, allowing to
+ * abstract parameterized types, e.g. List<String> is not compatible with List<Object>,
+ * but compatible with List<?>.
+ */
+public class WildcardBinding extends ReferenceBinding {
+
+ ReferenceBinding genericType;
+ int rank;
+ TypeBinding bound; // when unbound denotes the corresponding type variable (so as to retrieve its bound lazily)
+ char[] genericSignature;
+ int kind;
+ ReferenceBinding superclass;
+ ReferenceBinding[] superInterfaces;
+ TypeVariableBinding typeVariable; // corresponding variable
+ LookupEnvironment environment;
+
+ /**
+ * When unbound, the bound denotes the corresponding type variable (so as to retrieve its bound lazily)
+ */
+ public WildcardBinding(ReferenceBinding genericType, int rank, TypeBinding bound, int kind, LookupEnvironment environment) {
+ this.genericType = genericType;
+ this.rank = rank;
+ this.kind = kind;
+ this.modifiers = AccPublic | AccGenericSignature; // treat wildcard as public
+ this.tagBits |= HasWildcard;
+ this.environment = environment;
+ initialize(genericType, bound);
+
+ if (genericType instanceof UnresolvedReferenceBinding)
+ ((UnresolvedReferenceBinding) genericType).addWrapper(this);
+ if (bound instanceof UnresolvedReferenceBinding)
+ ((UnresolvedReferenceBinding) bound).addWrapper(this);
+ }
+
+ /**
+ * Returns true if the argument type satisfies all bounds of the type parameter
+ */
+ public boolean boundCheck(TypeBinding argumentType) {
+ switch (this.kind) {
+ case Wildcard.UNBOUND :
+ return true;
+ case Wildcard.EXTENDS :
+ return argumentType.isCompatibleWith(this.bound);
+ default: // SUPER
+ return this.bound.isCompatibleWith(argumentType);
+ }
+ }
+
+ /**
+ * Collect the substitutes into a map for certain type variables inside the receiver type
+ * e.g. Collection<T>.findSubstitute(T, Collection<List<X>>): T --> List<X>
+ */
+ public void collectSubstitutes(TypeBinding otherType, Map substitutes) {
+ switch(this.kind) {
+ case Wildcard.UNBOUND :
+ return;
+ case Wildcard.EXTENDS :
+ this.bound.collectSubstitutes(otherType, substitutes);
+ return;
+ default: // SUPER
+ this.bound.collectSubstitutes(otherType, substitutes);
+ return;
+ }
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#debugName()
+ */
+ public String debugName() {
+ return toString();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#erasure()
+ */
+ public TypeBinding erasure() {
+ if (this.kind == Wildcard.EXTENDS)
+ return this.bound.erasure();
+ return typeVariable().erasure();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#signature()
+ */
+ public char[] genericTypeSignature() {
+ if (this.genericSignature == null) {
+ switch (this.kind) {
+ case Wildcard.UNBOUND :
+ this.genericSignature = WILDCARD_STAR;
+ break;
+ case Wildcard.EXTENDS :
+ this.genericSignature = CharOperation.concat(WILDCARD_PLUS, this.bound.genericTypeSignature());
+ break;
+ default: // SUPER
+ this.genericSignature = CharOperation.concat(WILDCARD_MINUS, this.bound.genericTypeSignature());
+ }
+ }
+ return this.genericSignature;
+ }
+
+ void initialize(ReferenceBinding someGenericType, TypeBinding someBound) {
+ this.genericType = someGenericType;
+ this.bound = someBound;
+ if (someGenericType != null) {
+ this.fPackage = someGenericType.getPackage();
+ }
+ if (someBound != null) {
+ if (someBound.isTypeVariable())
+ this.tagBits |= HasTypeVariable;
+ }
+ }
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#isClass()
+ */
+ public boolean isClass() {
+ return erasure().isClass();
+ }
+ /**
+ * Returns true if a type is identical to another one,
+ * or for generic types, true if compared to its raw type.
+ */
+ public boolean isEquivalentTo(TypeBinding otherType) {
+ if (this == otherType) return true;
+ if (otherType == null) return false;
+ switch (this.kind) {
+ case Wildcard.UNBOUND :
+ return this.typeVariable().isCompatibleWith(otherType);
+ case Wildcard.EXTENDS :
+ return otherType.isCompatibleWith(this.bound);
+ default: // SUPER
+ return this.bound.isCompatibleWith(otherType);
+ }
+ }
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#isInterface()
+ */
+ public boolean isInterface() {
+ return erasure().isInterface();
+ }
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#isSuperclassOf(org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding)
+ */
+ public boolean isSuperclassOf(ReferenceBinding otherType) {
+ if (this.kind == Wildcard.SUPER) {
+ if (this.bound instanceof ReferenceBinding) {
+ return ((ReferenceBinding) this.bound).isSuperclassOf(otherType);
+ } else { // array bound
+ return otherType.id == T_Object;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns true if the type is a wildcard
+ */
+ public boolean isWildcard() {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.compiler.lookup.Binding#readableName()
+ */
+ public char[] readableName() {
+ switch (this.kind) {
+ case Wildcard.UNBOUND :
+ return WILDCARD_NAME;
+ case Wildcard.EXTENDS :
+ return CharOperation.concat(WILDCARD_NAME, WILDCARD_EXTENDS, this.bound.readableName());
+ default: // SUPER
+ return CharOperation.concat(WILDCARD_NAME, WILDCARD_SUPER, this.bound.readableName());
+ }
+ }
+
+ ReferenceBinding resolve() {
+ BinaryTypeBinding.resolveType(this.genericType, this.environment, null, 0);
+ switch(this.kind) {
+ case Wildcard.EXTENDS :
+ case Wildcard.SUPER :
+ BinaryTypeBinding.resolveType(this.bound, this.environment, null, 0);
+ break;
+ case Wildcard.UNBOUND :
+ }
+ return this;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.compiler.lookup.Binding#shortReadableName()
+ */
+ public char[] shortReadableName() {
+ switch (this.kind) {
+ case Wildcard.UNBOUND :
+ return WILDCARD_NAME;
+ case Wildcard.EXTENDS :
+ return CharOperation.concat(WILDCARD_NAME, WILDCARD_EXTENDS, this.bound.shortReadableName());
+ default: // SUPER
+ return CharOperation.concat(WILDCARD_NAME, WILDCARD_SUPER, this.bound.shortReadableName());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#signature()
+ */
+ public char[] signature() {
+ if (this.signature == null) {
+ this.signature = this.bound.signature();
+ }
+ return this.signature;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#sourceName()
+ */
+ public char[] sourceName() {
+ switch (this.kind) {
+ case Wildcard.UNBOUND :
+ return WILDCARD_NAME;
+ case Wildcard.EXTENDS :
+ return CharOperation.concat(WILDCARD_NAME, WILDCARD_EXTENDS, this.bound.sourceName());
+ default: // SUPER
+ return CharOperation.concat(WILDCARD_NAME, WILDCARD_SUPER, this.bound.sourceName());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding#superclass()
+ */
+ public ReferenceBinding superclass() {
+ if (this.superclass == null) {
+ if (isInterface()) return null;
+ TypeBinding superType = null;
+ if (this.kind == Wildcard.EXTENDS) {
+ superType = this.bound;
+ } else if (this.typeVariable() != null) {
+ superType = this.typeVariable.firstBound;
+ }
+ this.superclass = superType != null && superType.isClass()
+ ? (ReferenceBinding) superType
+ : environment.getType(JAVA_LANG_OBJECT);
+ }
+ return this.superclass;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#superInterfaces()
+ */
+ public ReferenceBinding[] superInterfaces() {
+ if (this.superInterfaces == null) {
+ TypeBinding superType = null;
+ if (this.kind == Wildcard.EXTENDS) {
+ superType = this.bound;
+ } else if (this.typeVariable() != null) {
+ superType = this.typeVariable.firstBound; // TODO (philippe) shouldn't it retrieve variable superinterfaces ?
+ }
+ this.superInterfaces = superType != null && superType.isInterface()
+ ? new ReferenceBinding[] { (ReferenceBinding) superType }
+ : NoSuperInterfaces;
+ }
+ return this.superInterfaces;
+ }
+
+ public void swapUnresolved(UnresolvedReferenceBinding unresolvedType, ReferenceBinding resolvedType, LookupEnvironment env) {
+ boolean affected = false;
+ if (this.genericType == unresolvedType) {
+ this.genericType = resolvedType; // no raw conversion
+ affected = true;
+ } else if (this.bound == unresolvedType) {
+ this.bound = resolvedType.isGenericType() ? env.createRawType(resolvedType, null) : resolvedType;
+ affected = true;
+ }
+ if (affected)
+ initialize(this.genericType, this.bound);
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ switch (this.kind) {
+ case Wildcard.UNBOUND :
+ return new String(WILDCARD_NAME);
+ case Wildcard.EXTENDS :
+ return new String(CharOperation.concat(WILDCARD_NAME, WILDCARD_EXTENDS, this.bound.debugName().toCharArray()));
+ default: // SUPER
+ return new String(CharOperation.concat(WILDCARD_NAME, WILDCARD_SUPER, this.bound.debugName().toCharArray()));
+ }
+ }
+ /**
+ * Returns associated type variable, or null in case of inconsistency
+ */
+ public TypeVariableBinding typeVariable() {
+ if (this.typeVariable == null) {
+ TypeVariableBinding[] typeVariables = this.genericType.typeVariables();
+ if (this.rank < typeVariables.length)
+ this.typeVariable = typeVariables[this.rank];
+ }
+ return this.typeVariable;
+ }
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
index 81fd8d4827..ef0f538027 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
@@ -24,6 +24,7 @@ import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.core.compiler.InvalidInputException;
import org.eclipse.jdt.internal.compiler.CompilationResult;
import org.eclipse.jdt.internal.compiler.ast.*;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
@@ -37,119 +38,144 @@ import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
import org.eclipse.jdt.internal.compiler.util.Util;
public class Parser implements BindingIds, ParserBasicInformation, TerminalTokens, CompilerModifiers, OperatorIds, TypeIds {
- protected ProblemReporter problemReporter;
- protected CompilerOptions options;
- public int firstToken ; // handle for multiple parsing goals
- public int lastAct ; //handle for multiple parsing goals
- public ReferenceContext referenceContext;
- public int currentToken;
- private int synchronizedBlockSourceStart;
+ public static char asb[] = null;
+ public static char asr[] = null;
+ //ast stack
+ final static int AstStackIncrement = 100;
+ public static char base_action[] = null;
+ public static final int BracketKinds = 3;
+
+ public static short check_table[] = null;
+ public static final int CurlyBracket = 2;
+ // TODO remove once testing is done
+ private static final boolean DEBUG = false;
+ private static final String EOF_TOKEN = "$eof" ; //$NON-NLS-1$
+ private static final String ERROR_TOKEN = "$error" ; //$NON-NLS-1$
+ //expression stack
+ final static int ExpressionStackIncrement = 100;
- //error recovery management
- protected int lastCheckPoint;
- protected RecoveredElement currentElement;
- public static boolean VERBOSE_RECOVERY = false;
- protected boolean restartRecovery;
- protected int listLength; // for recovering some incomplete list (interfaces, throws or parameters)
- protected boolean hasError;
- protected boolean hasReportedError;
- public boolean reportSyntaxErrorIsRequired = true;
- public boolean reportOnlyOneSyntaxError = false;
- protected int recoveredStaticInitializerStart;
- protected int lastIgnoredToken, nextIgnoredToken;
- protected int lastErrorEndPosition;
- protected boolean ignoreNextOpeningBrace;
+ final static int GenericsStackIncrement = 10;
+
+ private final static String FILEPREFIX = "parser"; //$NON-NLS-1$
+ public static char in_symb[] = null;
+ private static final String INVALID_CHARACTER = "Invalid Character" ; //$NON-NLS-1$
+ public static char lhs[] = null;
+
+ public static String name[] = null;
+ public static char nasb[] = null;
+ public static char nasr[] = null;
+ public static char non_terminal_index[] = null;
+ private final static String READABLE_NAMES_FILE = "readableNames"; //$NON-NLS-1$
+ private final static String READABLE_NAMES_FILE_NAME =
+ "org.eclipse.jdt.internal.compiler.parser." + READABLE_NAMES_FILE; //$NON-NLS-1$
+ public static String readableName[] = null;
+
+ public static byte rhs[] = null;
+
+ public static long rules_compliance[] = null;
+
+ public static final int RoundBracket = 0;
+
+ public static byte scope_la[] = null;
+ public static char scope_lhs[] = null;
+
+ public static char scope_prefix[] = null;
+ public static char scope_rhs[] = null;
+ public static char scope_state[] = null;
+
+ public static char scope_state_set[] = null;
+ public static char scope_suffix[] = null;
+ public static final int SquareBracket = 1;
//internal data for the automat
protected final static int StackIncrement = 255;
- protected int stateStackTop;
- protected int[] stack = new int[StackIncrement];
- //scanner token
- public Scanner scanner;
- //ast stack
- final static int AstStackIncrement = 100;
- protected int astPtr;
- protected ASTNode[] astStack = new ASTNode[AstStackIncrement];
+
+ public static char term_action[] = null;
+ public static byte term_check[] = null;
+
+ public static char terminal_index[] = null;
+
+ private static final String UNEXPECTED_EOF = "Unexpected End Of File" ; //$NON-NLS-1$
+ public static boolean VERBOSE_RECOVERY = false;
+
+
+
protected int astLengthPtr;
protected int[] astLengthStack;
+ protected int astPtr;
+ protected ASTNode[] astStack = new ASTNode[AstStackIncrement];
public CompilationUnitDeclaration compilationUnit; /*the result from parse()*/
- ASTNode [] noAstNodes = new ASTNode[AstStackIncrement];
- //expression stack
- final static int ExpressionStackIncrement = 100;
- protected int expressionPtr;
- protected Expression[] expressionStack = new Expression[ExpressionStackIncrement];
+ protected RecoveredElement currentElement;
+ public int currentToken;
+ protected boolean diet = false; //tells the scanner to jump over some parts of the code/expressions like method bodies
+ protected int dietInt = 0; // if > 0 force the none-diet-parsing mode (even if diet if requested) [field parsing with anonymous inner classes...]
+ protected int endPosition; //accurate only when used ! (the start position is pushed into intStack while the end the current one)
+ protected int endStatementPosition;
protected int expressionLengthPtr;
protected int[] expressionLengthStack;
- Expression [] noExpressions = new Expression[ExpressionStackIncrement];
+ protected int expressionPtr;
+ protected Expression[] expressionStack = new Expression[ExpressionStackIncrement];
+ public int firstToken ; // handle for multiple parsing goals
+
+ // generics management
+ protected int genericsIdentifiersLengthPtr;
+ protected int[] genericsIdentifiersLengthStack = new int[GenericsStackIncrement];
+ protected int genericsLengthPtr;
+ protected int[] genericsLengthStack = new int[GenericsStackIncrement];
+ protected int genericsPtr;
+ protected ASTNode[] genericsStack = new ASTNode[GenericsStackIncrement];
+
+ protected boolean hasError;
+ protected boolean hasReportedError;
+
//identifiers stacks
- protected int identifierPtr;
- protected char[][] identifierStack;
protected int identifierLengthPtr;
protected int[] identifierLengthStack;
protected long[] identifierPositionStack;
+ protected int identifierPtr;
+ protected char[][] identifierStack;
+
+ protected boolean ignoreNextOpeningBrace;
//positions , dimensions , .... (int stacks)
protected int intPtr;
protected int[] intStack;
- protected int endPosition; //accurate only when used ! (the start position is pushed into intStack while the end the current one)
- protected int endStatementPosition;
+ public int lastAct ; //handle for multiple parsing goals
+
+ //error recovery management
+ protected int lastCheckPoint;
+ protected int lastErrorEndPosition;
+ protected int lastErrorEndPositionBeforeRecovery = -1;
+ protected int lastIgnoredToken, nextIgnoredToken;
+ protected int listLength; // for recovering some incomplete list (interfaces, throws or parameters)
+ protected int listTypeParameterLength; // for recovering some incomplete list (type parameters)
protected int lParenPos,rParenPos; //accurate only when used !
- protected int rBraceStart, rBraceEnd, rBraceSuccessorStart; //accurate only when used !
- //modifiers dimensions nestedType etc.......
- protected boolean optimizeStringLiterals =true;
protected int modifiers;
protected int modifiersSourceStart;
- protected int nestedType, dimensions;
protected int[] nestedMethod; //the ptr is nestedType
- protected int[] realBlockStack;
+ protected int nestedType, dimensions;
+ ASTNode [] noAstNodes = new ASTNode[AstStackIncrement];
+ Expression [] noExpressions = new Expression[ExpressionStackIncrement];
+ //modifiers dimensions nestedType etc.......
+ protected boolean optimizeStringLiterals =true;
+ protected CompilerOptions options;
+ protected ProblemReporter problemReporter;
+ protected int rBraceStart, rBraceEnd, rBraceSuccessorStart; //accurate only when used !
protected int realBlockPtr;
- protected boolean diet = false; //tells the scanner to jump over some parts of the code/expressions like method bodies
- protected int dietInt = 0; // if > 0 force the none-diet-parsing mode (even if diet if requested) [field parsing with anonymous inner classes...]
+ protected int[] realBlockStack;
+ protected int recoveredStaticInitializerStart;
+ public ReferenceContext referenceContext;
+ public boolean reportOnlyOneSyntaxError = false;
+ public boolean reportSyntaxErrorIsRequired = true;
+ protected boolean restartRecovery;
+ //scanner token
+ public Scanner scanner;
+ protected int[] stack = new int[StackIncrement];
+ protected int stateStackTop;
+ private int synchronizedBlockSourceStart;
protected int[] variablesCounter;
- // javadoc
- public JavadocParser javadocParser;
public Javadoc javadoc;
-
- public static byte rhs[] = null;
- public static char asb[] = null;
- public static char asr[] = null;
- public static char nasb[] = null;
- public static char nasr[] = null;
-
- public static char terminal_index[] = null;
- public static char non_terminal_index[] = null;
-
- public static char term_action[] = null;
- public static byte term_check[] = null;
-
- private static final String UNEXPECTED_EOF = "Unexpected End Of File" ; //$NON-NLS-1$
- private static final String INVALID_CHARACTER = "Invalid Character" ; //$NON-NLS-1$
- private static final String EOF_TOKEN = "$eof" ; //$NON-NLS-1$
- private static final String ERROR_TOKEN = "$error" ; //$NON-NLS-1$
-
- public static String name[] = null;
- public static String readableName[] = null;
-
- public static short check_table[] = null;
- public static char lhs[] = null;
- public static char base_action[] = lhs;
-
- public static char scope_prefix[] = null;
- public static char scope_suffix[] = null;
- public static char scope_lhs[] = null;
-
- public static byte scope_la[] = null;
-
- public static char scope_state_set[] = null;
- public static char scope_rhs[] = null;
- public static char scope_state[] = null;
- public static char in_symb[] = null;
-
- private final static String FILEPREFIX = "parser"; //$NON-NLS-1$
- private final static String READABLE_NAMES_FILE = "readableNames"; //$NON-NLS-1$
- private final static String READABLE_NAMES =
- "org.eclipse.jdt.internal.compiler.parser." + READABLE_NAMES_FILE; //$NON-NLS-1$
-
+ public JavadocParser javadocParser;
static {
try{
initTables();
@@ -157,136 +183,21 @@ public class Parser implements BindingIds, ParserBasicInformation, TerminalToken
throw new ExceptionInInitializerError(ex.getMessage());
}
}
-
- public static final int RoundBracket = 0;
- public static final int SquareBracket = 1;
- public static final int CurlyBracket = 2;
- public static final int BracketKinds = 3;
-
-public Parser(ProblemReporter problemReporter, boolean optimizeStringLiterals) {
-
- this.problemReporter = problemReporter;
- this.options = problemReporter.options;
- this.optimizeStringLiterals = optimizeStringLiterals;
- this.initializeScanner();
- this.astLengthStack = new int[50];
- this.expressionLengthStack = new int[30];
- this.intStack = new int[50];
- this.identifierStack = new char[30][];
- this.identifierLengthStack = new int[30];
- this.nestedMethod = new int[30];
- this.realBlockStack = new int[30];
- this.identifierPositionStack = new long[30];
- this.variablesCounter = new int[30];
-
- // javadoc support
- this.javadocParser = new JavadocParser(this);
-}
-/**
- *
- * INTERNAL USE-ONLY
- */
-protected void adjustInterfaceModifiers() {
- this.intStack[this.intPtr - 1] |= AccInterface;
-}
-public final void arrayInitializer(int length) {
- //length is the size of the array Initializer
- //expressionPtr points on the last elt of the arrayInitializer,
- // in other words, it has not been decremented yet.
-
- ArrayInitializer ai = new ArrayInitializer();
- if (length != 0) {
- this.expressionPtr -= length;
- System.arraycopy(this.expressionStack, this.expressionPtr + 1, ai.expressions = new Expression[length], 0, length);
- }
- pushOnExpressionStack(ai);
- //positionning
- ai.sourceEnd = this.endStatementPosition;
- int searchPosition = length == 0 ? this.endPosition + 1 : ai.expressions[0].sourceStart;
- try {
- //does not work with comments(that contain '{') nor '{' describes as a unicode....
- while (this.scanner.source[--searchPosition] != '{'){/*empty*/}
- } catch (IndexOutOfBoundsException ex) {
- //should never occur (except for strange cases like whose describe above)
- searchPosition = (length == 0 ? this.endPosition : ai.expressions[0].sourceStart) - 1;
- }
- ai.sourceStart = searchPosition;
-}
public static int asi(int state) {
return asb[original_state(state)];
}
-protected void blockReal() {
- // See consumeLocalVariableDeclarationStatement in case of change: duplicated code
- // increment the amount of declared variables for this block
- this.realBlockStack[this.realBlockPtr]++;
-}
-private final static void buildFileOfByteFor(String filename, String tag, String[] tokens) throws java.io.IOException {
-
- //transform the String tokens into chars before dumping then into file
-
- int i = 0;
- //read upto the tag
- while (!tokens[i++].equals(tag)){/*empty*/}
- //read upto the }
-
- byte[] bytes = new byte[tokens.length]; //can't be bigger
- int ic = 0;
- String token;
- while (!(token = tokens[i++]).equals("}")) { //$NON-NLS-1$
- int c = Integer.parseInt(token);
- bytes[ic++] = (byte) c;
- }
-
- //resize
- System.arraycopy(bytes, 0, bytes = new byte[ic], 0, ic);
-
- buildFileForTable(filename, bytes);
-}
-private final static char[] buildFileOfIntFor(String filename, String tag, String[] tokens) throws java.io.IOException {
-
- //transform the String tokens into chars before dumping then into file
-
- int i = 0;
- //read upto the tag
- while (!tokens[i++].equals(tag)){/*empty*/}
- //read upto the }
-
- char[] chars = new char[tokens.length]; //can't be bigger
- int ic = 0;
- String token;
- while (!(token = tokens[i++]).equals("}")) { //$NON-NLS-1$
- int c = Integer.parseInt(token);
- chars[ic++] = (char) c;
- }
-
- //resize
- System.arraycopy(chars, 0, chars = new char[ic], 0, ic);
-
- buildFileForTable(filename, chars);
- return chars;
+public final static short base_check(int i) {
+ return check_table[i - (NUM_RULES + 1)];
}
-private final static void buildFileOfShortFor(String filename, String tag, String[] tokens) throws java.io.IOException {
-
- //transform the String tokens into chars before dumping then into file
-
- int i = 0;
- //read upto the tag
- while (!tokens[i++].equals(tag)){/*empty*/}
- //read upto the }
-
- char[] chars = new char[tokens.length]; //can't be bigger
- int ic = 0;
- String token;
- while (!(token = tokens[i++]).equals("}")) { //$NON-NLS-1$
- int c = Integer.parseInt(token);
- chars[ic++] = (char) (c + 32768);
+private final static void buildFile(String filename, List listToDump) throws java.io.IOException {
+ BufferedWriter writer = new BufferedWriter(new FileWriter(filename));
+ for (Iterator iterator = listToDump.iterator(); iterator.hasNext(); ) {
+ writer.write(String.valueOf(iterator.next()));
}
-
- //resize
- System.arraycopy(chars, 0, chars = new char[ic], 0, ic);
-
- buildFileForTable(filename, chars);
+ writer.flush();
+ writer.close();
+ System.out.println(filename + " creation complete"); //$NON-NLS-1$
}
private final static String[] buildFileForName(String filename, String contents) throws java.io.IOException {
String[] result = new String[contents.length()];
@@ -351,16 +262,18 @@ private static void buildFileForReadableName(
boolean[] alreadyAdded = new boolean[newName.length];
- for (int i = 0; i < tokens.length; i = i + 2) {
- int index = newNonTerminalIndex[newLhs[Integer.parseInt(tokens[i])]];
- StringBuffer buffer = new StringBuffer();
- if(!alreadyAdded[index]) {
- alreadyAdded[index] = true;
- buffer.append(newName[index]);
- buffer.append('=');
- buffer.append(tokens[i+1].trim());
- buffer.append('\n');
- entries.add(String.valueOf(buffer));
+ for (int i = 0; i < tokens.length; i = i + 3) {
+ if("1".equals(tokens[i])) { //$NON-NLS-1$
+ int index = newNonTerminalIndex[newLhs[Integer.parseInt(tokens[i + 1])]];
+ StringBuffer buffer = new StringBuffer();
+ if(!alreadyAdded[index]) {
+ alreadyAdded[index] = true;
+ buffer.append(newName[index]);
+ buffer.append('=');
+ buffer.append(tokens[i+2].trim());
+ buffer.append('\n');
+ entries.add(String.valueOf(buffer));
+ }
}
}
int i = 1;
@@ -374,13 +287,44 @@ private static void buildFileForReadableName(
Collections.sort(entries);
buildFile(file, entries);
}
-private final static void buildFile(String filename, List listToDump) throws java.io.IOException {
- BufferedWriter writer = new BufferedWriter(new FileWriter(filename));
- for (Iterator iterator = listToDump.iterator(); iterator.hasNext(); ) {
- writer.write(String.valueOf(iterator.next()));
+private static void buildFileForCompliance(
+ String file,
+ int length,
+ String[] tokens) throws java.io.IOException {
+
+ byte[] result = new byte[length * 8];
+
+ for (int i = 0; i < tokens.length; i = i + 3) {
+ if("2".equals(tokens[i])) { //$NON-NLS-1$
+ int index = Integer.parseInt(tokens[i + 1]);
+ String token = tokens[i + 2].trim();
+ long compliance = 0;
+ if("1.4".equals(token)) { //$NON-NLS-1$
+ compliance = ClassFileConstants.JDK1_4;
+ } else if("1.5".equals(token)) { //$NON-NLS-1$
+ compliance = ClassFileConstants.JDK1_5;
+ } else if("recovery".equals(token)) { //$NON-NLS-1$
+ compliance = ClassFileConstants.JDK_DEFERRED;
+ }
+
+ int j = index * 8;
+ result[j] = (byte)(compliance >>> 56);
+ result[j + 1] = (byte)(compliance >>> 48);
+ result[j + 2] = (byte)(compliance >>> 40);
+ result[j + 3] = (byte)(compliance >>> 32);
+ result[j + 4] = (byte)(compliance >>> 24);
+ result[j + 5] = (byte)(compliance >>> 16);
+ result[j + 6] = (byte)(compliance >>> 8);
+ result[j + 7] = (byte)(compliance);
+ }
+ }
+
+ buildFileForTable(file, result); //$NON-NLS-1$
}
- writer.flush();
- writer.close();
+private final static void buildFileForTable(String filename, byte[] bytes) throws java.io.IOException {
+ java.io.FileOutputStream stream = new java.io.FileOutputStream(filename);
+ stream.write(bytes);
+ stream.close();
System.out.println(filename + " creation complete"); //$NON-NLS-1$
}
private final static void buildFileForTable(String filename, char[] chars) throws java.io.IOException {
@@ -396,11 +340,73 @@ private final static void buildFileForTable(String filename, char[] chars) throw
stream.close();
System.out.println(filename + " creation complete"); //$NON-NLS-1$
}
-private final static void buildFileForTable(String filename, byte[] bytes) throws java.io.IOException {
- java.io.FileOutputStream stream = new java.io.FileOutputStream(filename);
- stream.write(bytes);
- stream.close();
- System.out.println(filename + " creation complete"); //$NON-NLS-1$
+private final static byte[] buildFileOfByteFor(String filename, String tag, String[] tokens) throws java.io.IOException {
+
+ //transform the String tokens into chars before dumping then into file
+
+ int i = 0;
+ //read upto the tag
+ while (!tokens[i++].equals(tag)){/*empty*/}
+ //read upto the }
+
+ byte[] bytes = new byte[tokens.length]; //can't be bigger
+ int ic = 0;
+ String token;
+ while (!(token = tokens[i++]).equals("}")) { //$NON-NLS-1$
+ int c = Integer.parseInt(token);
+ bytes[ic++] = (byte) c;
+ }
+
+ //resize
+ System.arraycopy(bytes, 0, bytes = new byte[ic], 0, ic);
+
+ buildFileForTable(filename, bytes);
+ return bytes;
+}
+private final static char[] buildFileOfIntFor(String filename, String tag, String[] tokens) throws java.io.IOException {
+
+ //transform the String tokens into chars before dumping then into file
+
+ int i = 0;
+ //read upto the tag
+ while (!tokens[i++].equals(tag)){/*empty*/}
+ //read upto the }
+
+ char[] chars = new char[tokens.length]; //can't be bigger
+ int ic = 0;
+ String token;
+ while (!(token = tokens[i++]).equals("}")) { //$NON-NLS-1$
+ int c = Integer.parseInt(token);
+ chars[ic++] = (char) c;
+ }
+
+ //resize
+ System.arraycopy(chars, 0, chars = new char[ic], 0, ic);
+
+ buildFileForTable(filename, chars);
+ return chars;
+}
+private final static void buildFileOfShortFor(String filename, String tag, String[] tokens) throws java.io.IOException {
+
+ //transform the String tokens into chars before dumping then into file
+
+ int i = 0;
+ //read upto the tag
+ while (!tokens[i++].equals(tag)){/*empty*/}
+ //read upto the }
+
+ char[] chars = new char[tokens.length]; //can't be bigger
+ int ic = 0;
+ String token;
+ while (!(token = tokens[i++]).equals("}")) { //$NON-NLS-1$
+ int c = Integer.parseInt(token);
+ chars[ic++] = (char) (c + 32768);
+ }
+
+ //resize
+ System.arraycopy(chars, 0, chars = new char[ic], 0, ic);
+
+ buildFileForTable(filename, chars);
}
public final static void buildFilesFromLPG(String dataFilename, String dataFilename2) throws java.io.IOException {
@@ -421,12 +427,12 @@ public final static void buildFilesFromLPG(String dataFilename, String dataFilen
java.util.StringTokenizer st =
new java.util.StringTokenizer(new String(contents), " \t\n\r[]={,;"); //$NON-NLS-1$
String[] tokens = new String[st.countTokens()];
- int i = 0;
+ int j = 0;
while (st.hasMoreTokens()) {
- tokens[i++] = st.nextToken();
+ tokens[j++] = st.nextToken();
}
final String prefix = FILEPREFIX;
- i = 0;
+ int i = 0;
char[] newLhs = buildFileOfIntFor(prefix + (++i) + ".rsc", "lhs", tokens); //$NON-NLS-1$ //$NON-NLS-2$
buildFileOfShortFor(prefix + (++i) + ".rsc", "check_table", tokens); //$NON-NLS-2$ //$NON-NLS-1$
@@ -446,7 +452,7 @@ public final static void buildFilesFromLPG(String dataFilename, String dataFilen
buildFileOfIntFor(prefix + (++i) + ".rsc", "scope_state", tokens); //$NON-NLS-2$ //$NON-NLS-1$
buildFileOfIntFor(prefix + (++i) + ".rsc", "in_symb", tokens); //$NON-NLS-2$ //$NON-NLS-1$
- buildFileOfByteFor(prefix + (++i) + ".rsc", "rhs", tokens); //$NON-NLS-2$ //$NON-NLS-1$
+ byte[] newRhs = buildFileOfByteFor(prefix + (++i) + ".rsc", "rhs", tokens); //$NON-NLS-2$ //$NON-NLS-1$
buildFileOfByteFor(prefix + (++i) + ".rsc", "term_check", tokens); //$NON-NLS-2$ //$NON-NLS-1$
buildFileOfByteFor(prefix + (++i) + ".rsc", "scope_la", tokens); //$NON-NLS-2$ //$NON-NLS-1$
@@ -459,16 +465,270 @@ public final static void buildFilesFromLPG(String dataFilename, String dataFilen
System.out.println(Util.bind("parser.incorrectPath")); //$NON-NLS-1$
return;
}
- st = new java.util.StringTokenizer(new String(contents), "\t\n\r="); //$NON-NLS-1$
+ st = new java.util.StringTokenizer(new String(contents), "\t\n\r=#"); //$NON-NLS-1$
tokens = new String[st.countTokens()];
- i = 0;
+ j = 0;
while (st.hasMoreTokens()) {
- tokens[i++] = st.nextToken();
+ tokens[j++] = st.nextToken();
}
+
+ buildFileForCompliance(prefix + (++i) + ".rsc", newRhs.length, tokens);//$NON-NLS-1$
buildFileForReadableName(READABLE_NAMES_FILE+".properties", newLhs, newNonTerminalIndex, newName, tokens);//$NON-NLS-1$
System.out.println(Util.bind("parser.moveFiles")); //$NON-NLS-1$
}
+public static int in_symbol(int state) {
+ return in_symb[original_state(state)];
+}
+public final static void initTables() throws java.io.IOException {
+
+ final String prefix = FILEPREFIX;
+ int i = 0;
+ lhs = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+ char[] chars = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+ check_table = new short[chars.length];
+ for (int c = chars.length; c-- > 0;) {
+ check_table[c] = (short) (chars[c] - 32768);
+ }
+ asb = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+ asr = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+ nasb = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+ nasr = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+ terminal_index = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+ non_terminal_index = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+ term_action = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+
+ scope_prefix = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+ scope_suffix = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+ scope_lhs = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+ scope_state_set = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+ scope_rhs = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+ scope_state = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+ in_symb = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+
+ rhs = readByteTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+ term_check = readByteTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+ scope_la = readByteTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+
+ name = readNameTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+
+ rules_compliance = readLongTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
+
+ readableName = readReadableNameTable(READABLE_NAMES_FILE_NAME);
+
+ base_action = lhs;
+}
+public static int nasi(int state) {
+ return nasb[original_state(state)];
+}
+public static int ntAction(int state, int sym) {
+ return base_action[state + sym];
+}
+protected static int original_state(int state) {
+ return -base_check(state);
+}
+protected static byte[] readByteTable(String filename) throws java.io.IOException {
+
+ //files are located at Parser.class directory
+
+ InputStream stream = Parser.class.getResourceAsStream(filename);
+ if (stream == null) {
+ throw new java.io.IOException(Util.bind("parser.missingFile",filename)); //$NON-NLS-1$
+ }
+ byte[] bytes = null;
+ try {
+ stream = new BufferedInputStream(stream);
+ bytes = Util.getInputStreamAsByteArray(stream, -1);
+ } finally {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ return bytes;
+}
+
+protected static String[] readNameTable(String filename) throws java.io.IOException {
+ char[] contents = readTable(filename);
+ char[][] nameAsChar = CharOperation.splitOn('\n', contents);
+
+ String[] result = new String[nameAsChar.length + 1];
+ result[0] = null;
+ for (int i = 0; i < nameAsChar.length; i++) {
+ result[i + 1] = new String(nameAsChar[i]);
+ }
+
+ return result;
+}
+protected static String[] readReadableNameTable(String filename) {
+ String[] result = new String[name.length];
+
+ ResourceBundle bundle;
+ try {
+ bundle = ResourceBundle.getBundle(filename, Locale.getDefault());
+ } catch(MissingResourceException e) {
+ System.out.println("Missing resource : " + filename.replace('.', '/') + ".properties for locale " + Locale.getDefault()); //$NON-NLS-1$//$NON-NLS-2$
+ throw e;
+ }
+ for (int i = 0; i < NT_OFFSET + 1; i++) {
+ result[i] = name[i];
+ }
+ for (int i = NT_OFFSET; i < name.length; i++) {
+ try {
+ String n = bundle.getString(name[i]);
+ if(n != null && n.length() > 0) {
+ result[i] = n;
+ } else {
+ result[i] = name[i];
+ }
+ } catch(MissingResourceException e) {
+ result[i] = name[i];
+ }
+ }
+ return result;
+}
+protected static char[] readTable(String filename) throws java.io.IOException {
+
+ //files are located at Parser.class directory
+
+ InputStream stream = Parser.class.getResourceAsStream(filename);
+ if (stream == null) {
+ throw new java.io.IOException(Util.bind("parser.missingFile",filename)); //$NON-NLS-1$
+ }
+ byte[] bytes = null;
+ try {
+ stream = new BufferedInputStream(stream);
+ bytes = Util.getInputStreamAsByteArray(stream, -1);
+ } finally {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+
+ //minimal integrity check (even size expected)
+ int length = bytes.length;
+ if (length % 2 != 0)
+ throw new java.io.IOException(Util.bind("parser.corruptedFile",filename)); //$NON-NLS-1$
+
+ // convert bytes into chars
+ char[] chars = new char[length / 2];
+ int i = 0;
+ int charIndex = 0;
+
+ while (true) {
+ chars[charIndex++] = (char) (((bytes[i++] & 0xFF) << 8) + (bytes[i++] & 0xFF));
+ if (i == length)
+ break;
+ }
+ return chars;
+}
+protected static long[] readLongTable(String filename) throws java.io.IOException {
+
+ //files are located at Parser.class directory
+
+ InputStream stream = Parser.class.getResourceAsStream(filename);
+ if (stream == null) {
+ throw new java.io.IOException(Util.bind("parser.missingFile",filename)); //$NON-NLS-1$
+ }
+ byte[] bytes = null;
+ try {
+ stream = new BufferedInputStream(stream);
+ bytes = Util.getInputStreamAsByteArray(stream, -1);
+ } finally {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+
+ //minimal integrity check (even size expected)
+ int length = bytes.length;
+ if (length % 8 != 0)
+ throw new java.io.IOException(Util.bind("parser.corruptedFile",filename)); //$NON-NLS-1$
+
+ // convert bytes into longs
+ long[] longs = new long[length / 8];
+ int i = 0;
+ int longIndex = 0;
+
+ while (true) {
+ longs[longIndex++] =
+ (((long) (bytes[i++] & 0xFF)) << 56)
+ + (((long) (bytes[i++] & 0xFF)) << 48)
+ + (((long) (bytes[i++] & 0xFF)) << 40)
+ + (((long) (bytes[i++] & 0xFF)) << 32)
+ + (((long) (bytes[i++] & 0xFF)) << 24)
+ + (((long) (bytes[i++] & 0xFF)) << 16)
+ + (((long) (bytes[i++] & 0xFF)) << 8)
+ + (bytes[i++] & 0xFF);
+
+ if (i == length)
+ break;
+ }
+ return longs;
+}
+public static int tAction(int state, int sym) {
+ return term_action[term_check[base_action[state]+sym] == sym ? base_action[state] + sym : base_action[state]];
+}
+
+public Parser(ProblemReporter problemReporter, boolean optimizeStringLiterals) {
+
+ this.problemReporter = problemReporter;
+ this.options = problemReporter.options;
+ this.optimizeStringLiterals = optimizeStringLiterals;
+ this.initializeScanner();
+ this.astLengthStack = new int[50];
+ this.expressionLengthStack = new int[30];
+ this.intStack = new int[50];
+ this.identifierStack = new char[30][];
+ this.identifierLengthStack = new int[30];
+ this.nestedMethod = new int[30];
+ this.realBlockStack = new int[30];
+ this.identifierPositionStack = new long[30];
+ this.variablesCounter = new int[30];
+
+ // javadoc support
+ this.javadocParser = new JavadocParser(this);
+}
+/**
+ *
+ * INTERNAL USE-ONLY
+ */
+protected void adjustInterfaceModifiers() {
+ this.intStack[this.intPtr - 1] |= AccInterface;
+}
+public final void arrayInitializer(int length) {
+ //length is the size of the array Initializer
+ //expressionPtr points on the last elt of the arrayInitializer,
+ // in other words, it has not been decremented yet.
+
+ ArrayInitializer ai = new ArrayInitializer();
+ if (length != 0) {
+ this.expressionPtr -= length;
+ System.arraycopy(this.expressionStack, this.expressionPtr + 1, ai.expressions = new Expression[length], 0, length);
+ }
+ pushOnExpressionStack(ai);
+ //positionning
+ ai.sourceEnd = this.endStatementPosition;
+ int searchPosition = length == 0 ? this.endPosition + 1 : ai.expressions[0].sourceStart;
+ try {
+ //does not work with comments(that contain '{') nor '{' describes as a unicode....
+ while (this.scanner.source[--searchPosition] != '{'){/*empty*/}
+ } catch (IndexOutOfBoundsException ex) {
+ //should never occur (except for strange cases like whose describe above)
+ searchPosition = (length == 0 ? this.endPosition : ai.expressions[0].sourceStart) - 1;
+ }
+ ai.sourceStart = searchPosition;
+}
+protected void blockReal() {
+ // See consumeLocalVariableDeclarationStatement in case of change: duplicated code
+ // increment the amount of declared variables for this block
+ this.realBlockStack[this.realBlockPtr]++;
+}
/*
* Build initial recovery state.
* Recovery state is inferred from the current state of the parser (reduced node stack).
@@ -479,6 +739,7 @@ public RecoveredElement buildInitialRecoveryState(){
* also rebuild bracket balance
*/
this.lastCheckPoint = 0;
+ this.lastErrorEndPositionBeforeRecovery = this.scanner.currentPosition;
RecoveredElement element = null;
if (this.referenceContext instanceof CompilationUnitDeclaration){
@@ -492,6 +753,7 @@ public RecoveredElement buildInitialRecoveryState(){
this.compilationUnit.types = null;
this.currentToken = 0;
this.listLength = 0;
+ this.listTypeParameterLength = 0;
this.endPosition = 0;
this.endStatementPosition = 0;
return element;
@@ -586,16 +848,14 @@ public RecoveredElement buildInitialRecoveryState(){
}
return element;
}
-public final static short base_check(int i) {
- return check_table[i - (NUM_RULES + 1)];
-}
+
public final void checkAndSetModifiers(int flag){
/*modify the current modifiers buffer.
When the startPosition of the modifiers is 0
it means that the modifier being parsed is the first
of a list of several modifiers. The startPosition
is zeroed when a copy of modifiers-buffer is push
- onto the astStack. */
+ onto the this.astStack. */
if ((this.modifiers & flag) != 0){ // duplicate modifier
this.modifiers |= AccAlternateModifierProblem;
@@ -656,24 +916,6 @@ protected void checkNonNLSAfterBodyEnd(int declarationEnd){
}
}
}
-protected char getNextCharacter(char[] comment, int[] index) {
- char nextCharacter = comment[index[0]++];
- switch(nextCharacter) {
- case '\\' :
- int c1, c2, c3, c4;
- index[0]++;
- while (comment[index[0]] == 'u') index[0]++;
- if (!(((c1 = Character.getNumericValue(comment[index[0]++])) > 15
- || c1 < 0)
- || ((c2 = Character.getNumericValue(comment[index[0]++])) > 15 || c2 < 0)
- || ((c3 = Character.getNumericValue(comment[index[0]++])) > 15 || c3 < 0)
- || ((c4 = Character.getNumericValue(comment[index[0]++])) > 15 || c4 < 0))) {
- nextCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
- }
- break;
- }
- return nextCharacter;
-}
protected void classInstanceCreation(boolean alwaysQualified) {
// ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' ClassBodyopt
@@ -703,6 +945,7 @@ protected void classInstanceCreation(boolean alwaysQualified) {
length);
}
alloc.type = getTypeReference(0);
+
//the default constructor with the correct number of argument
//will be created and added by the TC (see createsInternalConstructorWithBinding)
alloc.sourceStart = this.intStack[this.intPtr--];
@@ -720,7 +963,7 @@ protected void classInstanceCreation(boolean alwaysQualified) {
}
this.astPtr--;
this.astLengthPtr--;
-
+
// mark initializers with local type mark if needed
markInitializersWithLocalType(anonymousTypeDeclaration);
}
@@ -728,22 +971,38 @@ protected void classInstanceCreation(boolean alwaysQualified) {
protected final void concatExpressionLists() {
this.expressionLengthStack[--this.expressionLengthPtr]++;
}
+private final void concatGenericsLists() {
+ this.genericsLengthStack[this.genericsLengthPtr - 1] += this.genericsLengthStack[this.genericsLengthPtr--];
+}
private final void concatNodeLists() {
/*
- * This is a case where you have two sublists into the astStack that you want
- * to merge in one list. There is no action required on the astStack. The only
+ * This is a case where you have two sublists into the this.astStack that you want
+ * to merge in one list. There is no action required on the this.astStack. The only
* thing you need to do is merge the two lengths specified on the astStackLength.
* The top two length are for example:
* ... p n
* and you want to result in a list like:
* ... n+p
* This means that the p could be equals to 0 in case there is no astNode pushed
- * on the astStack.
+ * on the this.astStack.
* Look at the InterfaceMemberDeclarations for an example.
*/
this.astLengthStack[this.astLengthPtr - 1] += this.astLengthStack[this.astLengthPtr--];
}
+protected void consumeAdditionalBound() {
+ pushOnGenericsStack(getTypeReference(this.intStack[this.intPtr--]));
+}
+protected void consumeAdditionalBound1() {
+ // nothing to be done.
+ // The reference type1 is consumed by consumeReferenceType1 method.
+}
+protected void consumeAdditionalBoundList() {
+ concatGenericsLists();
+}
+protected void consumeAdditionalBoundList1() {
+ concatGenericsLists();
+}
protected void consumeAllocationHeader() {
// ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' ClassBodyopt
@@ -774,10 +1033,179 @@ protected void consumeAllocationHeader() {
this.lastCheckPoint = this.scanner.startPosition; // force to restart at this exact position
this.restartRecovery = true; // request to restart from here on
}
+protected void consumeAnnotationTypeDeclaration() {
+ int length;
+ if ((length = this.astLengthStack[this.astLengthPtr--]) != 0) {
+ //there are length declarations
+ //dispatch according to the type of the declarations
+ dispatchDeclarationInto(length);
+ }
+
+ TypeDeclaration typeDecl = (TypeDeclaration) this.astStack[this.astPtr];
+
+ // mark initializers with local type mark if needed
+ markInitializersWithLocalType(typeDecl);
+
+ //convert constructor that do not have the type's name into methods
+ typeDecl.checkConstructors(this);
+
+ //always add <clinit> (will be remove at code gen time if empty)
+ if (this.scanner.containsAssertKeyword) {
+ typeDecl.bits |= ASTNode.AddAssertionMASK;
+ }
+ typeDecl.addClinit();
+ typeDecl.bodyEnd = this.endStatementPosition;
+ if (length == 0 && !containsComment(typeDecl.bodyStart, typeDecl.bodyEnd)) {
+ typeDecl.bits |= ASTNode.UndocumentedEmptyBlockMASK;
+ }
+ typeDecl.declarationSourceEnd = flushCommentsDefinedPriorTo(this.endStatementPosition);
+}
+protected void consumeAnnotationTypeDeclarationHeader() {
+ // consumeAnnotationTypeDeclarationHeader ::= Modifiers '@' PushModifiers interface Identifier
+ // consumeAnnotationTypeDeclarationHeader ::= '@' PushModifiers interface Identifier
+ AnnotationTypeDeclaration annotationTypeDeclaration = new AnnotationTypeDeclaration(this.compilationUnit.compilationResult);
+ if (this.nestedMethod[this.nestedType] == 0) {
+ if (this.nestedType != 0) {
+ annotationTypeDeclaration.bits |= ASTNode.IsMemberTypeMASK;
+ }
+ } else {
+ // Record that the block has a declaration for local types
+ annotationTypeDeclaration.bits |= ASTNode.IsLocalTypeMASK;
+ markEnclosingMemberWithLocalType();
+ blockReal();
+ }
+
+ //highlight the name of the type
+ long pos = this.identifierPositionStack[this.identifierPtr];
+ annotationTypeDeclaration.sourceEnd = (int) pos;
+ annotationTypeDeclaration.sourceStart = (int) (pos >>> 32);
+ annotationTypeDeclaration.name = this.identifierStack[this.identifierPtr--];
+ this.identifierLengthPtr--;
+
+ //compute the declaration source too
+ // 'interface' push two int positions: the beginning of the class token and its end.
+ // we want to keep the beginning position but get rid of the end position
+ // it is only used for the ClassLiteralAccess positions.
+ this.intPtr--; // remove the start position of the interface token
+ this.intPtr--; // remove the end position of the interface token
+
+ annotationTypeDeclaration.modifiersSourceStart = this.intStack[this.intPtr--];
+ annotationTypeDeclaration.modifiers = this.intStack[this.intPtr--];
+ if (annotationTypeDeclaration.modifiersSourceStart >= 0) {
+ annotationTypeDeclaration.declarationSourceStart = annotationTypeDeclaration.modifiersSourceStart;
+ this.intPtr--; // remove the position of the '@' token as we have modifiers
+ } else {
+ int atPosition = this.intStack[this.intPtr--];
+ // remove the position of the '@' token as we don't have modifiers
+ annotationTypeDeclaration.declarationSourceStart = atPosition;
+ }
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ annotationTypeDeclaration.annotations = new Annotation[length],
+ 0,
+ length);
+ }
+ annotationTypeDeclaration.bodyStart = annotationTypeDeclaration.sourceEnd + 1;
+
+ // javadoc
+ annotationTypeDeclaration.javadoc = this.javadoc;
+ this.javadoc = null;
+ pushOnAstStack(annotationTypeDeclaration);
+}
+protected void consumeAnnotationTypeMemberDeclarationHeader() {
+ // AnnotationTypeMemberDeclarationHeader ::= Modifiersopt Type Identifier '(' ')'
+ AnnotationTypeMemberDeclaration annotationTypeMemberDeclaration = new AnnotationTypeMemberDeclaration(this.compilationUnit.compilationResult);
+
+ //name
+ annotationTypeMemberDeclaration.selector = this.identifierStack[this.identifierPtr];
+ long selectorSource = this.identifierPositionStack[this.identifierPtr--];
+ this.identifierLengthPtr--;
+ //type
+ annotationTypeMemberDeclaration.returnType = getTypeReference(this.intStack[this.intPtr--]);
+ //modifiers
+ annotationTypeMemberDeclaration.declarationSourceStart = this.intStack[this.intPtr--];
+ annotationTypeMemberDeclaration.modifiers = this.intStack[this.intPtr--];
+ // javadoc
+ annotationTypeMemberDeclaration.javadoc = this.javadoc;
+ this.javadoc = null;
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ annotationTypeMemberDeclaration.annotations = new Annotation[length],
+ 0,
+ length);
+ }
+
+ //highlight starts at selector start
+ annotationTypeMemberDeclaration.sourceStart = (int) (selectorSource >>> 32);
+ annotationTypeMemberDeclaration.sourceEnd = (int) selectorSource;
+
+ annotationTypeMemberDeclaration.bodyStart = this.rParenPos + 1;
+ pushOnAstStack(annotationTypeMemberDeclaration);
+}
+protected void consumeAnnotationTypeMemberHeaderExtendedDims() {
+ // AnnotationTypeMemberHeaderExtendedDims ::= Dimsopt
+ AnnotationTypeMemberDeclaration annotationTypeMemberDeclaration = (AnnotationTypeMemberDeclaration) this.astStack[this.astPtr];
+ int extendedDims = this.intStack[this.intPtr--];
+ annotationTypeMemberDeclaration.extendedDimensions = extendedDims;
+ if (extendedDims != 0) {
+ TypeReference returnType = annotationTypeMemberDeclaration.returnType;
+ annotationTypeMemberDeclaration.sourceEnd = this.endPosition;
+ int dims = returnType.dimensions() + extendedDims;
+ int baseType;
+ if ((baseType = this.identifierLengthStack[this.identifierLengthPtr + 1]) < 0) {
+ //it was a baseType
+ int sourceStart = returnType.sourceStart;
+ int sourceEnd = returnType.sourceEnd;
+ returnType = TypeReference.baseTypeReference(-baseType, dims);
+ returnType.sourceStart = sourceStart;
+ returnType.sourceEnd = sourceEnd;
+ annotationTypeMemberDeclaration.returnType = returnType;
+ } else {
+ annotationTypeMemberDeclaration.returnType = this.copyDims(annotationTypeMemberDeclaration.returnType, dims);
+ }
+ if (this.currentToken == TokenNameSEMICOLON){
+ annotationTypeMemberDeclaration.bodyStart = this.endPosition + 1;
+ }
+ }
+}
+protected void consumeAnnotationTypeMemberDeclaration() {
+ // AnnotationTypeMemberDeclaration ::= AnnotationTypeMemberDeclarationHeader AnnotationTypeMemberHeaderExtendedDims DefaultValueopt ';'
+ AnnotationTypeMemberDeclaration annotationTypeMemberDeclaration = (AnnotationTypeMemberDeclaration) this.astStack[this.astPtr];
+
+ int length = this.expressionLengthStack[this.expressionLengthPtr--];
+ if (length == 1) {
+ intPtr--; // we get rid of the position of the default keyword
+ intPtr--; // we get rid of the position of the default keyword
+ annotationTypeMemberDeclaration.memberValue = this.expressionStack[this.expressionPtr--];
+ }
+
+ // store the this.endPosition (position just before the '}') in case there is
+ // a trailing comment behind the end of the method
+ int declarationEndPosition = flushCommentsDefinedPriorTo(this.endStatementPosition);
+ annotationTypeMemberDeclaration.bodyStart = this.endStatementPosition;
+ annotationTypeMemberDeclaration.bodyEnd = declarationEndPosition;
+ annotationTypeMemberDeclaration.declarationSourceEnd = declarationEndPosition;
+}
+protected void consumeAnnotationTypeMemberDeclarations() {
+ // AnnotationTypeMemberDeclarations ::= AnnotationTypeMemberDeclarations AnnotationTypeMemberDeclaration
+ concatNodeLists();
+}
protected void consumeArgumentList() {
// ArgumentList ::= ArgumentList ',' Expression
concatExpressionLists();
}
+protected void consumeArguments() {
+ // Arguments ::= '(' ArgumentListopt ')'
+ // nothing to do, the expression stack is already updated
+}
protected void consumeArrayAccess(boolean unspecifiedReference) {
// ArrayAccess ::= Name '[' Expression ']' ==> true
// ArrayAccess ::= PrimaryNoNewArray '[' Expression ']' ==> false
@@ -802,12 +1230,15 @@ protected void consumeArrayAccess(boolean unspecifiedReference) {
}
exp.sourceEnd = this.endPosition;
}
-protected void consumeArrayCreationExpressionWithoutInitializer() {
- // ArrayCreationWithoutArrayInitializer ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs
- // ArrayCreationWithoutArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs
+protected void consumeArrayCreationExpressionWithInitializer() {
+ // ArrayCreationWithArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs ArrayInitializer
+ // ArrayCreationWithArrayInitializer ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs ArrayInitializer
int length;
ArrayAllocationExpression aae = new ArrayAllocationExpression();
+ this.expressionLengthPtr -- ;
+ aae.initializer = (ArrayInitializer) this.expressionStack[this.expressionPtr--];
+
aae.type = getTypeReference(0);
length = (this.expressionLengthStack[this.expressionLengthPtr--]);
this.expressionPtr -= length ;
@@ -825,19 +1256,12 @@ protected void consumeArrayCreationExpressionWithoutInitializer() {
}
pushOnExpressionStack(aae);
}
-
-protected void consumeArrayCreationHeader() {
- // nothing to do
-}
-protected void consumeArrayCreationExpressionWithInitializer() {
- // ArrayCreationWithArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs ArrayInitializer
- // ArrayCreationWithArrayInitializer ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs ArrayInitializer
+protected void consumeArrayCreationExpressionWithoutInitializer() {
+ // ArrayCreationWithoutArrayInitializer ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs
+ // ArrayCreationWithoutArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs
int length;
ArrayAllocationExpression aae = new ArrayAllocationExpression();
- this.expressionLengthPtr -- ;
- aae.initializer = (ArrayInitializer) this.expressionStack[this.expressionPtr--];
-
aae.type = getTypeReference(0);
length = (this.expressionLengthStack[this.expressionLengthPtr--]);
this.expressionPtr -= length ;
@@ -855,19 +1279,23 @@ protected void consumeArrayCreationExpressionWithInitializer() {
}
pushOnExpressionStack(aae);
}
+protected void consumeArrayCreationHeader() {
+ // nothing to do
+}
protected void consumeArrayInitializer() {
// ArrayInitializer ::= '{' VariableInitializers '}'
// ArrayInitializer ::= '{' VariableInitializers , '}'
arrayInitializer(this.expressionLengthStack[this.expressionLengthPtr--]);
}
-
+protected void consumeArrayTypeWithTypeArgumentsName() {
+ this.intStack[this.intPtr] += this.identifierLengthStack[this.identifierLengthPtr];
+}
protected void consumeAssertStatement() {
// AssertStatement ::= 'assert' Expression ':' Expression ';'
this.expressionLengthPtr-=2;
pushOnAstStack(new AssertStatement(this.expressionStack[this.expressionPtr--], this.expressionStack[this.expressionPtr--], this.intStack[this.intPtr--]));
}
-
protected void consumeAssignment() {
// Assignment ::= LeftHandSide AssignmentOperator AssignmentExpression
//optimize the push/pop
@@ -987,6 +1415,117 @@ protected void consumeBinaryExpression(int op) {
op);
}
}
+/**
+ * @param op binary operator
+ */
+protected void consumeBinaryExpressionWithName(int op) {
+ pushOnExpressionStack(getUnspecifiedReferenceOptimized());
+ this.expressionPtr--;
+ this.expressionLengthPtr--;
+ /*
+ if (op == OR_OR) {
+ this.expressionStack[this.expressionPtr] =
+ new OR_OR_Expression(
+ this.expressionStack[this.expressionPtr + 1],
+ this.expressionStack[this.expressionPtr],
+ op);
+ } else {
+ if (op == AND_AND) {
+ this.expressionStack[this.expressionPtr] =
+ new AND_AND_Expression(
+ this.expressionStack[this.expressionPtr + 1],
+ this.expressionStack[this.expressionPtr],
+ op);
+ } else {
+ // look for "string1" + "string2"
+ if ((op == PLUS) && this.optimizeStringLiterals) {
+ Expression expr1, expr2;
+ expr1 = this.expressionStack[this.expressionPtr + 1];
+ expr2 = this.expressionStack[this.expressionPtr];
+ if (expr1 instanceof StringLiteral) {
+ if (expr2 instanceof CharLiteral) { // string+char
+ this.expressionStack[this.expressionPtr] =
+ ((StringLiteral) expr1).extendWith((CharLiteral) expr2);
+ } else if (expr2 instanceof StringLiteral) { //string+string
+ this.expressionStack[this.expressionPtr] =
+ ((StringLiteral) expr1).extendWith((StringLiteral) expr2);
+ } else {
+ this.expressionStack[this.expressionPtr] = new BinaryExpression(expr1, expr2, PLUS);
+ }
+ } else {
+ this.expressionStack[this.expressionPtr] = new BinaryExpression(expr1, expr2, PLUS);
+ }
+ } else {
+ this.expressionStack[this.expressionPtr] =
+ new BinaryExpression(
+ this.expressionStack[this.expressionPtr + 1],
+ this.expressionStack[this.expressionPtr],
+ op);
+ }
+ }
+ }
+ */
+ Expression expr1 = this.expressionStack[this.expressionPtr + 1];
+ Expression expr2 = this.expressionStack[this.expressionPtr];
+ switch(op) {
+ case OR_OR :
+ this.expressionStack[this.expressionPtr] =
+ new OR_OR_Expression(
+ expr1,
+ expr2,
+ op);
+ break;
+ case AND_AND :
+ this.expressionStack[this.expressionPtr] =
+ new AND_AND_Expression(
+ expr1,
+ expr2,
+ op);
+ break;
+ case PLUS :
+ // look for "string1" + "string2"
+ if (this.optimizeStringLiterals) {
+ if (expr1 instanceof StringLiteral) {
+ if (expr2 instanceof CharLiteral) { // string+char
+ this.expressionStack[this.expressionPtr] =
+ ((StringLiteral) expr1).extendWith((CharLiteral) expr2);
+ } else if (expr2 instanceof StringLiteral) { //string+string
+ this.expressionStack[this.expressionPtr] =
+ ((StringLiteral) expr1).extendWith((StringLiteral) expr2);
+ } else {
+ this.expressionStack[this.expressionPtr] = new BinaryExpression(expr1, expr2, PLUS);
+ }
+ } else {
+ this.expressionStack[this.expressionPtr] = new BinaryExpression(expr1, expr2, PLUS);
+ }
+ } else if (expr1 instanceof StringLiteral) {
+ if (expr2 instanceof StringLiteral) {
+ // string + string
+ this.expressionStack[this.expressionPtr] =
+ ((StringLiteral) expr1).extendsWith((StringLiteral) expr2);
+ } else {
+ this.expressionStack[this.expressionPtr] =
+ new BinaryExpression(
+ expr1,
+ expr2,
+ op);
+ }
+ } else {
+ this.expressionStack[this.expressionPtr] =
+ new BinaryExpression(
+ expr1,
+ expr2,
+ op);
+ }
+ break;
+ default :
+ this.expressionStack[this.expressionPtr] =
+ new BinaryExpression(
+ expr1,
+ expr2,
+ op);
+ }
+}
protected void consumeBlock() {
// Block ::= OpenBlock '{' BlockStatementsopt '}'
// simpler action for empty blocks
@@ -1026,21 +1565,6 @@ protected void consumeCaseLabel() {
Expression expression = this.expressionStack[this.expressionPtr--];
pushOnAstStack(new CaseStatement(expression, expression.sourceEnd, this.intStack[this.intPtr--]));
}
-protected void consumeCastExpression() {
- // CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN InsideCastExpression UnaryExpression
- // CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
-
- //this.intStack : posOfLeftParen dim posOfRightParen
-
- //optimize the push/pop
-
- Expression exp, cast, castType;
- int end = this.intStack[this.intPtr--];
- this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr], castType = getTypeReference(this.intStack[this.intPtr--]));
- castType.sourceEnd = end - 1;
- castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
- cast.sourceEnd = exp.sourceEnd;
-}
protected void consumeCastExpressionLL1() {
//CastExpression ::= '(' Expression ')' InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
// Expression is used in order to make the grammar LL1
@@ -1057,6 +1581,122 @@ protected void consumeCastExpressionLL1() {
updateSourcePosition(cast);
cast.sourceEnd=exp.sourceEnd;
}
+protected void consumeCastExpressionWithGenericsArray() {
+ // CastExpression ::= PushLPAREN Name TypeArguments Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
+
+ Expression exp, cast, castType;
+ int end = this.intStack[this.intPtr--];
+
+ int dim = this.intStack[this.intPtr--];
+ pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
+
+ this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr], castType = getTypeReference(dim));
+ castType.sourceEnd = end - 1;
+ castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
+ cast.sourceEnd = exp.sourceEnd;
+}
+protected void consumeCastExpressionWithNameArray() {
+ // CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
+
+ Expression exp, cast, castType;
+ int end = this.intStack[this.intPtr--];
+
+ // handle type arguments
+ pushOnGenericsLengthStack(0);
+ pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
+
+ this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr], castType = getTypeReference(this.intStack[this.intPtr--]));
+ castType.sourceEnd = end - 1;
+ castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
+ cast.sourceEnd = exp.sourceEnd;
+}
+protected void consumeCastExpressionWithPrimitiveType() {
+ // CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN InsideCastExpression UnaryExpression
+
+ //this.intStack : posOfLeftParen dim posOfRightParen
+
+ //optimize the push/pop
+
+ Expression exp, cast, castType;
+ int end = this.intStack[this.intPtr--];
+ this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr], castType = getTypeReference(this.intStack[this.intPtr--]));
+ castType.sourceEnd = end - 1;
+ castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
+ cast.sourceEnd = exp.sourceEnd;
+}
+protected ParameterizedQualifiedTypeReference computeQualifiedGenericsFromRightSide(TypeReference rightSide, int dim) {
+ int nameSize = this.identifierLengthStack[this.identifierLengthPtr];
+ int tokensSize = nameSize;
+ if (rightSide instanceof ParameterizedSingleTypeReference) {
+ tokensSize ++;
+ } else if (rightSide instanceof SingleTypeReference) {
+ tokensSize ++;
+ } else if (rightSide instanceof ParameterizedQualifiedTypeReference) {
+ tokensSize += ((QualifiedTypeReference) rightSide).tokens.length;
+ } else if (rightSide instanceof QualifiedTypeReference) {
+ tokensSize += ((QualifiedTypeReference) rightSide).tokens.length;
+ }
+ TypeReference[][] typeArguments = new TypeReference[tokensSize][];
+ char[][] tokens = new char[tokensSize][];
+ long[] positions = new long[tokensSize];
+ if (rightSide instanceof ParameterizedSingleTypeReference) {
+ ParameterizedSingleTypeReference singleParameterizedTypeReference = (ParameterizedSingleTypeReference) rightSide;
+ tokens[nameSize] = singleParameterizedTypeReference.token;
+ positions[nameSize] = (((long) singleParameterizedTypeReference.sourceStart) << 32) + singleParameterizedTypeReference.sourceEnd;
+ typeArguments[nameSize] = singleParameterizedTypeReference.typeArguments;
+ } else if (rightSide instanceof SingleTypeReference) {
+ SingleTypeReference singleTypeReference = (SingleTypeReference) rightSide;
+ tokens[nameSize] = singleTypeReference.token;
+ positions[nameSize] = (((long) singleTypeReference.sourceStart) << 32) + singleTypeReference.sourceEnd;
+ } else if (rightSide instanceof ParameterizedQualifiedTypeReference) {
+ ParameterizedQualifiedTypeReference parameterizedTypeReference = (ParameterizedQualifiedTypeReference) rightSide;
+ TypeReference[][] rightSideTypeArguments = parameterizedTypeReference.typeArguments;
+ System.arraycopy(rightSideTypeArguments, 0, typeArguments, nameSize, rightSideTypeArguments.length);
+ char[][] rightSideTokens = parameterizedTypeReference.tokens;
+ System.arraycopy(rightSideTokens, 0, tokens, nameSize, rightSideTokens.length);
+ long[] rightSidePositions = parameterizedTypeReference.sourcePositions;
+ System.arraycopy(rightSidePositions, 0, positions, nameSize, rightSidePositions.length);
+ } else if (rightSide instanceof QualifiedTypeReference) {
+ QualifiedTypeReference qualifiedTypeReference = (QualifiedTypeReference) rightSide;
+ char[][] rightSideTokens = qualifiedTypeReference.tokens;
+ System.arraycopy(rightSideTokens, 0, tokens, nameSize, rightSideTokens.length);
+ long[] rightSidePositions = qualifiedTypeReference.sourcePositions;
+ System.arraycopy(rightSidePositions, 0, positions, nameSize, rightSidePositions.length);
+ }
+
+ int currentTypeArgumentsLength = this.genericsLengthStack[this.genericsLengthPtr--];
+ TypeReference[] currentTypeArguments = new TypeReference[currentTypeArgumentsLength];
+ this.genericsPtr -= currentTypeArgumentsLength;
+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, currentTypeArguments, 0, currentTypeArgumentsLength);
+
+ if (nameSize == 1) {
+ tokens[0] = this.identifierStack[this.identifierPtr];
+ positions[0] = this.identifierPositionStack[this.identifierPtr--];
+ typeArguments[0] = currentTypeArguments;
+ } else {
+ this.identifierPtr -= nameSize;
+ System.arraycopy(this.identifierStack, this.identifierPtr + 1, tokens, 0, nameSize);
+ System.arraycopy(this.identifierPositionStack, this.identifierPtr + 1, positions, 0, nameSize);
+ typeArguments[nameSize - 1] = currentTypeArguments;
+ }
+
+ return new ParameterizedQualifiedTypeReference(tokens, typeArguments, dim, positions);
+}
+protected void consumeCastExpressionWithQualifiedGenericsArray() {
+ // CastExpression ::= PushLPAREN Name OnlyTypeArguments '.' ClassOrInterfaceType Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
+ Expression exp, cast, castType;
+ int end = this.intStack[this.intPtr--];
+
+ int dim = this.intStack[this.intPtr--];
+ TypeReference rightSide = getTypeReference(0);
+
+ ParameterizedQualifiedTypeReference qualifiedParameterizedTypeReference = computeQualifiedGenericsFromRightSide(rightSide, dim);
+
+ this.expressionStack[this.expressionPtr] = cast = new CastExpression(exp = this.expressionStack[this.expressionPtr], castType = qualifiedParameterizedTypeReference);
+ castType.sourceEnd = end - 1;
+ castType.sourceStart = (cast.sourceStart = this.intStack[this.intPtr--]) + 1;
+ cast.sourceEnd = exp.sourceEnd;
+}
protected void consumeCatches() {
// Catches ::= Catches CatchClause
optimizedConcatNodeLists();
@@ -1184,10 +1824,11 @@ protected void consumeClassHeader() {
}
protected void consumeClassHeaderExtends() {
// ClassHeaderExtends ::= 'extends' ClassType
+ //superclass
+ TypeReference superClass = getTypeReference(0);
// There is a class declaration on the top of stack
TypeDeclaration typeDecl = (TypeDeclaration) this.astStack[this.astPtr];
- //superclass
- typeDecl.superclass = getTypeReference(0);
+ typeDecl.superclass = superClass;
typeDecl.bodyStart = typeDecl.superclass.sourceEnd + 1;
// recovery
if (this.currentElement != null){
@@ -1214,8 +1855,8 @@ protected void consumeClassHeaderImplements() {
this.lastCheckPoint = typeDecl.bodyStart;
}
}
-protected void consumeClassHeaderName() {
- // ClassHeaderName ::= Modifiersopt 'class' 'Identifier'
+protected void consumeClassHeaderName1() {
+ // ClassHeaderName1 ::= Modifiersopt 'class' 'Identifier'
TypeDeclaration typeDecl = new TypeDeclaration(this.compilationUnit.compilationResult);
if (this.nestedMethod[this.nestedType] == 0) {
if (this.nestedType != 0) {
@@ -1247,6 +1888,16 @@ protected void consumeClassHeaderName() {
if (typeDecl.modifiersSourceStart >= 0) {
typeDecl.declarationSourceStart = typeDecl.modifiersSourceStart;
}
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ typeDecl.annotations = new Annotation[length],
+ 0,
+ length);
+ }
typeDecl.bodyStart = typeDecl.sourceEnd + 1;
pushOnAstStack(typeDecl);
@@ -1261,6 +1912,24 @@ protected void consumeClassHeaderName() {
typeDecl.javadoc = this.javadoc;
this.javadoc = null;
}
+protected void consumeTypeHeaderNameWithTypeParameters() {
+ // ClassHeaderName ::= ClassHeaderName1 TypeParameters
+ // InterfaceHeaderName ::= InterfaceHeaderName1 TypeParameters
+ TypeDeclaration typeDecl = (TypeDeclaration)this.astStack[this.astPtr];
+
+ // consume type parameters
+ int length = this.genericsLengthStack[this.genericsLengthPtr--];
+ this.genericsPtr -= length;
+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, typeDecl.typeParameters = new TypeParameter[length], 0, length);
+
+ typeDecl.bodyStart = typeDecl.typeParameters[length-1].declarationSourceEnd + 1;
+
+ this.listTypeParameterLength = 0;
+
+ if (this.currentElement != null) { // is recovering
+ this.lastCheckPoint = typeDecl.bodyStart;
+ }
+}
protected void consumeClassInstanceCreationExpression() {
// ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' ClassBodyopt
classInstanceCreation(false);
@@ -1272,8 +1941,69 @@ protected void consumeClassInstanceCreationExpressionName() {
protected void consumeClassInstanceCreationExpressionQualified() {
// ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
// ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
+ classInstanceCreation(true);
+
+ this.expressionLengthPtr--;
+ QualifiedAllocationExpression qae =
+ (QualifiedAllocationExpression) this.expressionStack[this.expressionPtr--];
+ qae.enclosingInstance = this.expressionStack[this.expressionPtr];
+ this.expressionStack[this.expressionPtr] = qae;
+ qae.sourceStart = qae.enclosingInstance.sourceStart;
+}
+protected void consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() {
+ // ClassInstanceCreationExpression ::= Primary '.' 'new' TypeArguments SimpleName '(' ArgumentListopt ')' ClassBodyopt
+ // ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' TypeArguments SimpleName '(' ArgumentListopt ')' ClassBodyopt
+
+ QualifiedAllocationExpression alloc;
+ int length;
+ if (((length = this.astLengthStack[this.astLengthPtr--]) == 1) && (this.astStack[this.astPtr] == null)) {
+ //NO ClassBody
+ this.astPtr--;
+ alloc = new QualifiedAllocationExpression();
+ alloc.sourceEnd = this.endPosition; //the position has been stored explicitly
+
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ this.expressionPtr -= length;
+ System.arraycopy(
+ this.expressionStack,
+ this.expressionPtr + 1,
+ alloc.arguments = new Expression[length],
+ 0,
+ length);
+ }
+ alloc.type = getTypeReference(0);
+
+ length = this.genericsLengthStack[this.genericsLengthPtr--];
+ this.genericsPtr -= length;
+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, alloc.typeArguments = new TypeReference[length], 0, length);
+
+ //the default constructor with the correct number of argument
+ //will be created and added by the TC (see createsInternalConstructorWithBinding)
+ alloc.sourceStart = this.intStack[this.intPtr--];
+ pushOnExpressionStack(alloc);
+ } else {
+ dispatchDeclarationInto(length);
+ TypeDeclaration anonymousTypeDeclaration = (TypeDeclaration)this.astStack[this.astPtr];
+ anonymousTypeDeclaration.declarationSourceEnd = this.endStatementPosition;
+ anonymousTypeDeclaration.bodyEnd = this.endStatementPosition;
+ if (length == 0 && !containsComment(anonymousTypeDeclaration.bodyStart, anonymousTypeDeclaration.bodyEnd)) {
+ anonymousTypeDeclaration.bits |= ASTNode.UndocumentedEmptyBlockMASK;
+ }
+ this.astPtr--;
+ this.astLengthPtr--;
- classInstanceCreation(true); // <-- push the Qualifed....
+ QualifiedAllocationExpression anonymousTypeDeclarationAllocationExpression = anonymousTypeDeclaration.allocation;
+ if (anonymousTypeDeclarationAllocationExpression != null) {
+ anonymousTypeDeclarationAllocationExpression.sourceEnd = this.endStatementPosition;
+ // handle type arguments
+ length = this.genericsLengthStack[this.genericsLengthPtr--];
+ this.genericsPtr -= length;
+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, anonymousTypeDeclarationAllocationExpression.typeArguments = new TypeReference[length], 0, length);
+ }
+
+ // mark initializers with local type mark if needed
+ markInitializersWithLocalType(anonymousTypeDeclaration);
+ }
this.expressionLengthPtr--;
QualifiedAllocationExpression qae =
@@ -1282,10 +2012,72 @@ protected void consumeClassInstanceCreationExpressionQualified() {
this.expressionStack[this.expressionPtr] = qae;
qae.sourceStart = qae.enclosingInstance.sourceStart;
}
+protected void consumeClassInstanceCreationExpressionWithTypeArguments() {
+ // ClassInstanceCreationExpression ::= 'new' TypeArguments ClassType '(' ArgumentListopt ')' ClassBodyopt
+ AllocationExpression alloc;
+ int length;
+ if (((length = this.astLengthStack[this.astLengthPtr--]) == 1)
+ && (this.astStack[this.astPtr] == null)) {
+ //NO ClassBody
+ this.astPtr--;
+ alloc = new AllocationExpression();
+ alloc.sourceEnd = this.endPosition; //the position has been stored explicitly
+
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ this.expressionPtr -= length;
+ System.arraycopy(
+ this.expressionStack,
+ this.expressionPtr + 1,
+ alloc.arguments = new Expression[length],
+ 0,
+ length);
+ }
+ alloc.type = getTypeReference(0);
+
+ length = this.genericsLengthStack[this.genericsLengthPtr--];
+ this.genericsPtr -= length;
+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, alloc.typeArguments = new TypeReference[length], 0, length);
+
+ //the default constructor with the correct number of argument
+ //will be created and added by the TC (see createsInternalConstructorWithBinding)
+ alloc.sourceStart = this.intStack[this.intPtr--];
+ pushOnExpressionStack(alloc);
+ } else {
+ dispatchDeclarationInto(length);
+ TypeDeclaration anonymousTypeDeclaration = (TypeDeclaration)this.astStack[this.astPtr];
+ anonymousTypeDeclaration.declarationSourceEnd = this.endStatementPosition;
+ anonymousTypeDeclaration.bodyEnd = this.endStatementPosition;
+ if (length == 0 && !containsComment(anonymousTypeDeclaration.bodyStart, anonymousTypeDeclaration.bodyEnd)) {
+ anonymousTypeDeclaration.bits |= ASTNode.UndocumentedEmptyBlockMASK;
+ }
+ this.astPtr--;
+ this.astLengthPtr--;
+
+ QualifiedAllocationExpression anonymousTypeDeclarationAllocationExpression = anonymousTypeDeclaration.allocation;
+ if (anonymousTypeDeclarationAllocationExpression != null) {
+ anonymousTypeDeclarationAllocationExpression.sourceEnd = this.endStatementPosition;
+ // handle type arguments
+ length = this.genericsLengthStack[this.genericsLengthPtr--];
+ this.genericsPtr -= length;
+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, anonymousTypeDeclarationAllocationExpression.typeArguments = new TypeReference[length], 0, length);
+ }
+
+ // mark initializers with local type mark if needed
+ markInitializersWithLocalType(anonymousTypeDeclaration);
+ }
+}
+protected void consumeClassOrInterface() {
+ this.genericsIdentifiersLengthStack[this.genericsIdentifiersLengthPtr] += this.identifierLengthStack[this.identifierLengthPtr];
+ pushOnGenericsLengthStack(0); // handle type arguments
+}
+protected void consumeClassOrInterfaceName() {
+ pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
+ pushOnGenericsLengthStack(0); // handle type arguments
+}
protected void consumeClassTypeElt() {
// ClassTypeElt ::= ClassType
pushOnAstStack(getTypeReference(0));
- /* if incomplete thrown exception list, listLength counter will not have been reset,
+ /* if incomplete thrown exception list, this.listLength counter will not have been reset,
indicating that some items are available on the stack */
this.listLength++;
}
@@ -1294,13 +2086,13 @@ protected void consumeClassTypeList() {
optimizedConcatNodeLists();
}
protected void consumeCompilationUnit() {
- // CompilationUnit ::= EnterCompilationUnit PackageDeclarationopt ImportDeclarationsopt
+ // CompilationUnit ::= EnterCompilationUnit InternalCompilationUnit
// do nothing by default
}
protected void consumeConditionalExpression(int op) {
// ConditionalExpression ::= ConditionalOrExpression '?' Expression ':' ConditionalExpression
//optimize the push/pop
-
+ this.intPtr -= 2;//consume position of the question mark
this.expressionPtr -= 2;
this.expressionLengthPtr -= 2;
this.expressionStack[this.expressionPtr] =
@@ -1309,6 +2101,21 @@ protected void consumeConditionalExpression(int op) {
this.expressionStack[this.expressionPtr + 1],
this.expressionStack[this.expressionPtr + 2]);
}
+/**
+ * @param op
+ */
+protected void consumeConditionalExpressionWithName(int op) {
+ // ConditionalExpression ::= Name '?' Expression ':' ConditionalExpression
+ this.intPtr -= 2;//consume position of the question mark
+ pushOnExpressionStack(getUnspecifiedReferenceOptimized());
+ this.expressionPtr -= 2;
+ this.expressionLengthPtr -= 2;
+ this.expressionStack[this.expressionPtr] =
+ new ConditionalExpression(
+ this.expressionStack[this.expressionPtr + 2],
+ this.expressionStack[this.expressionPtr],
+ this.expressionStack[this.expressionPtr + 1]);
+}
protected void consumeConstructorBlockStatements() {
// ConstructorBody ::= NestedMethod '{' ExplicitConstructorInvocation BlockStatements '}'
concatNodeLists(); // explictly add the first statement into the list of statements
@@ -1322,11 +2129,11 @@ protected void consumeConstructorDeclaration() {
// ConstructorDeclaration ::= ConstructorHeader ConstructorBody
/*
- astStack : MethodDeclaration statements
- identifierStack : name
+ this.astStack : MethodDeclaration statements
+ this.identifierStack : name
==>
- astStack : MethodDeclaration
- identifierStack :
+ this.astStack : MethodDeclaration
+ this.identifierStack :
*/
//must provide a default constructor call when needed
@@ -1396,23 +2203,11 @@ protected void consumeConstructorDeclaration() {
}
//watch for } that could be given as a unicode ! ( u007D is '}' )
- // store the endPosition (position just before the '}') in case there is
+ // store the this.endPosition (position just before the '}') in case there is
// a trailing comment behind the end of the method
cd.bodyEnd = this.endPosition;
cd.declarationSourceEnd = flushCommentsDefinedPriorTo(this.endStatementPosition);
}
-
-protected void consumeInvalidConstructorDeclaration() {
- // ConstructorDeclaration ::= ConstructorHeader ';'
- // now we know that the top of stack is a constructorDeclaration
- ConstructorDeclaration cd = (ConstructorDeclaration) this.astStack[this.astPtr];
-
- cd.bodyEnd = this.endPosition; // position just before the trailing semi-colon
- cd.declarationSourceEnd = flushCommentsDefinedPriorTo(this.endStatementPosition);
- // report the problem and continue the parsing - narrowing the problem onto the method
-
- cd.modifiers |= AccSemicolonBody; // remember semi-colon body
-}
protected void consumeConstructorHeader() {
// ConstructorHeader ::= ConstructorHeaderName MethodHeaderParameters MethodHeaderThrowsClauseopt
@@ -1456,6 +2251,73 @@ protected void consumeConstructorHeaderName() {
//modifiers
cd.declarationSourceStart = this.intStack[this.intPtr--];
cd.modifiers = this.intStack[this.intPtr--];
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ cd.annotations = new Annotation[length],
+ 0,
+ length);
+ }
+ // javadoc
+ cd.javadoc = this.javadoc;
+ this.javadoc = null;
+
+ //highlight starts at the selector starts
+ cd.sourceStart = (int) (selectorSource >>> 32);
+ pushOnAstStack(cd);
+ cd.sourceEnd = this.lParenPos;
+ cd.bodyStart = this.lParenPos+1;
+ this.listLength = 0; // initialize this.listLength before reading parameters/throws
+
+ // recovery
+ if (this.currentElement != null){
+ this.lastCheckPoint = cd.bodyStart;
+ if ((this.currentElement instanceof RecoveredType && this.lastIgnoredToken != TokenNameDOT)
+ || cd.modifiers != 0){
+ this.currentElement = this.currentElement.add(cd, 0);
+ this.lastIgnoredToken = -1;
+ }
+ }
+}
+protected void consumeConstructorHeaderNameWithTypeParameters() {
+
+ /* recovering - might be an empty message send */
+ if (this.currentElement != null){
+ if (this.lastIgnoredToken == TokenNamenew){ // was an allocation expression
+ this.lastCheckPoint = this.scanner.startPosition; // force to restart at this exact position
+ this.restartRecovery = true;
+ return;
+ }
+ }
+
+ // ConstructorHeaderName ::= Modifiersopt TypeParameters 'Identifier' '('
+ ConstructorDeclaration cd = new ConstructorDeclaration(this.compilationUnit.compilationResult);
+
+ //name -- this is not really revelant but we do .....
+ cd.selector = this.identifierStack[this.identifierPtr];
+ long selectorSource = this.identifierPositionStack[this.identifierPtr--];
+ this.identifierLengthPtr--;
+
+ // consume type parameters
+ int length = this.genericsLengthStack[this.genericsLengthPtr--];
+ this.genericsPtr -= length;
+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, cd.typeParameters = new TypeParameter[length], 0, length);
+
+ //modifiers
+ cd.declarationSourceStart = this.intStack[this.intPtr--];
+ cd.modifiers = this.intStack[this.intPtr--];
+ // consume annotations
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ cd.annotations = new Annotation[length],
+ 0,
+ length);
+ }
// javadoc
cd.javadoc = this.javadoc;
this.javadoc = null;
@@ -1465,7 +2327,7 @@ protected void consumeConstructorHeaderName() {
pushOnAstStack(cd);
cd.sourceEnd = this.lParenPos;
cd.bodyStart = this.lParenPos+1;
- this.listLength = 0; // initialize listLength before reading parameters/throws
+ this.listLength = 0; // initialize this.listLength before reading parameters/throws
// recovery
if (this.currentElement != null){
@@ -1487,6 +2349,7 @@ protected void consumeDefaultModifiers() {
pushOnIntStack(
this.modifiersSourceStart >= 0 ? this.modifiersSourceStart : this.scanner.startPosition);
resetModifiers();
+ pushOnExpressionStackLengthStack(0); // no annotation
}
protected void consumeDiet() {
// Diet ::= $empty
@@ -1513,10 +2376,18 @@ protected void consumeDimWithOrWithOutExprs() {
// DimWithOrWithOutExprs ::= DimWithOrWithOutExprs DimWithOrWithOutExpr
concatExpressionLists();
}
+protected void consumeEmptyAnnotationTypeMemberDeclarationsopt() {
+ // AnnotationTypeMemberDeclarationsopt ::= $empty
+ pushOnAstLengthStack(0);
+}
protected void consumeEmptyArgumentListopt() {
// ArgumentListopt ::= $empty
pushOnExpressionStackLengthStack(0);
}
+protected void consumeEmptyArguments() {
+ // Argumentsopt ::= $empty
+ pushOnExpressionStackLengthStack(0);
+}
protected void consumeEmptyArrayInitializer() {
// ArrayInitializer ::= '{' ,opt '}'
arrayInitializer(0);
@@ -1543,10 +2414,18 @@ protected void consumeEmptyClassMemberDeclaration() {
problemReporter().superfluousSemicolon(this.endPosition+1, this.endStatementPosition);
flushCommentsDefinedPriorTo(this.endStatementPosition);
}
+protected void consumeEmptyDefaultValue() {
+ // DefaultValueopt ::= $empty
+ pushOnExpressionStackLengthStack(0);
+}
protected void consumeEmptyDimsopt() {
// Dimsopt ::= $empty
pushOnIntStack(0);
}
+protected void consumeEmptyEnumDeclarations() {
+ // EnumBodyDeclarationsopt ::= $empty
+ pushOnAstLengthStack(0);
+}
protected void consumeEmptyExpression() {
// Expressionopt ::= $empty
pushOnExpressionStackLengthStack(0);
@@ -1559,10 +2438,6 @@ protected void consumeEmptyForUpdateopt() {
// ForUpdateopt ::= $empty
pushOnExpressionStackLengthStack(0);
}
-protected void consumeEmptyImportDeclarationsopt() {
- // ImportDeclarationsopt ::= $empty
- pushOnAstLengthStack(0);
-}
protected void consumeEmptyInterfaceMemberDeclaration() {
// InterfaceMemberDeclaration ::= ';'
pushOnAstLengthStack(0);
@@ -1571,6 +2446,19 @@ protected void consumeEmptyInterfaceMemberDeclarationsopt() {
// InterfaceMemberDeclarationsopt ::= $empty
pushOnAstLengthStack(0);
}
+protected void consumeEmptyInternalCompilationUnit() {
+ // InternalCompilationUnit ::= $empty
+ // nothing to do by default
+}
+protected void consumeEmptyMemberValuePairsopt() {
+ // MemberValuePairsopt ::= $empty
+ pushOnAstLengthStack(0);
+}
+protected void consumeEmptyMemberValueArrayInitializer() {
+ // MemberValueArrayInitializer ::= '{' ',' '}'
+ // MemberValueArrayInitializer ::= '{' '}'
+ memberValueArrayInitializer(0);
+}
protected void consumeEmptyStatement() {
// EmptyStatement ::= ';'
if (this.scanner.source[this.endStatementPosition] == ';') {
@@ -1590,12 +2478,128 @@ protected void consumeEmptyTypeDeclaration() {
problemReporter().superfluousSemicolon(this.endPosition+1, this.endStatementPosition);
flushCommentsDefinedPriorTo(this.endStatementPosition);
}
-protected void consumeEmptyTypeDeclarationsopt() {
- // TypeDeclarationsopt ::= $empty
- pushOnAstLengthStack(0);
+protected void consumeEnhancedForStatementHeader(boolean hasModifiers){
+ // EnhancedForStatementHeader ::= 'for' '(' Type PushModifiers Identifier Dimsopt ':' Expression ')'
+ // EnhancedForStatementHeader ::= 'for' '(' Modifiers Type PushRealModifiers Identifier Dimsopt ':' Expression ')'
+ TypeReference type;
+
+ char[] identifierName = this.identifierStack[this.identifierPtr];
+ long namePosition = this.identifierPositionStack[this.identifierPtr];
+
+ int extraDims = this.intStack[this.intPtr--];
+ this.identifierPtr--;
+ this.identifierLengthPtr--;
+ // remove fake modifiers/modifiers start
+ int declarationSourceStart = 0;
+ int modifiersValue = 0;
+ if (hasModifiers) {
+ declarationSourceStart = this.intStack[this.intPtr--];
+ modifiersValue = this.intStack[this.intPtr--];
+ } else {
+ this.intPtr-=2;
+ }
+
+ //updates are on the expression stack
+ this.expressionLengthPtr--;
+ Expression collection = this.expressionStack[this.expressionPtr--];
+
+ type = getTypeReference(this.intStack[this.intPtr--] + extraDims); // type dimension
+
+ LocalDeclaration localDeclaration = createLocalDeclaration(identifierName, (int) (namePosition >>> 32), (int) namePosition);
+ localDeclaration.declarationSourceEnd = localDeclaration.declarationEnd;
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--])!= 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ localDeclaration.annotations = new Annotation[length],
+ 0,
+ length);
+ }
+ if (hasModifiers) {
+ localDeclaration.declarationSourceStart = declarationSourceStart;
+ localDeclaration.modifiers = modifiersValue;
+ } else {
+ localDeclaration.declarationSourceStart = type.sourceStart;
+ }
+ localDeclaration.type = type;
+
+ ForeachStatement iteratorForStatement =
+ new ForeachStatement(
+ localDeclaration,
+ collection,
+ this.intStack[this.intPtr--]);
+ pushOnAstStack(iteratorForStatement);
+
+ if(options.sourceLevel < ClassFileConstants.JDK1_5 &&
+ this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) {
+ this.problemReporter().invalidUsageOfForeachStatements(localDeclaration, collection);
+ }
+}
+protected void consumeEnhancedForStatement() {
+ // EnhancedForStatement ::= EnhancedForStatementHeader Statement
+ // EnhancedForStatementNoShortIf ::= EnhancedForStatementHeader StatementNoShortIf
+
+ //statements
+ this.astLengthPtr--;
+ Statement statement = (Statement) this.astStack[this.astPtr--];
+
+ // foreach statement is on the ast stack
+ ForeachStatement foreachStatement = (ForeachStatement) this.astStack[this.astPtr];
+ foreachStatement.action = statement;
+ // remember useful empty statement
+ if (statement instanceof EmptyStatement) statement.bits |= ASTNode.IsUsefulEmptyStatementMASK;
+
+ foreachStatement.sourceEnd = this.endStatementPosition;
}
protected void consumeEnterAnonymousClassBody() {
// EnterAnonymousClassBody ::= $empty
+ TypeReference typeReference = getTypeReference(0);
+
+ QualifiedAllocationExpression alloc;
+ TypeDeclaration anonymousType = new TypeDeclaration(this.compilationUnit.compilationResult);
+ anonymousType.name = TypeDeclaration.ANONYMOUS_EMPTY_NAME;
+ anonymousType.bits |= ASTNode.AnonymousAndLocalMask;
+ alloc = anonymousType.allocation = new QualifiedAllocationExpression(anonymousType);
+ markEnclosingMemberWithLocalType();
+ pushOnAstStack(anonymousType);
+
+ alloc.sourceEnd = this.rParenPos; //the position has been stored explicitly
+ int argumentLength;
+ if ((argumentLength = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ this.expressionPtr -= argumentLength;
+ System.arraycopy(
+ this.expressionStack,
+ this.expressionPtr + 1,
+ alloc.arguments = new Expression[argumentLength],
+ 0,
+ argumentLength);
+ }
+ alloc.type = typeReference;
+
+ anonymousType.sourceEnd = alloc.sourceEnd;
+ //position at the type while it impacts the anonymous declaration
+ anonymousType.sourceStart = anonymousType.declarationSourceStart = alloc.type.sourceStart;
+ alloc.sourceStart = this.intStack[this.intPtr--];
+ pushOnExpressionStack(alloc);
+
+ anonymousType.bodyStart = this.scanner.currentPosition;
+ this.listLength = 0; // will be updated when reading super-interfaces
+ // recovery
+ if (this.currentElement != null){
+ this.lastCheckPoint = anonymousType.bodyStart;
+ this.currentElement = this.currentElement.add(anonymousType, 0);
+ this.currentToken = 0; // opening brace already taken into account
+ this.lastIgnoredToken = -1;
+ }
+}
+protected void consumeEnterAnonymousClassBodySimpleName() {
+ // EnterAnonymousClassBody ::= $empty
+ pushOnGenericsLengthStack(0);
+ pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
+ TypeReference typeReference = getTypeReference(0);
+
QualifiedAllocationExpression alloc;
TypeDeclaration anonymousType = new TypeDeclaration(this.compilationUnit.compilationResult);
anonymousType.name = TypeDeclaration.ANONYMOUS_EMPTY_NAME;
@@ -1615,7 +2619,7 @@ protected void consumeEnterAnonymousClassBody() {
0,
argumentLength);
}
- alloc.type = getTypeReference(0);
+ alloc.type = typeReference;
anonymousType.sourceEnd = alloc.sourceEnd;
//position at the type while it impacts the anonymous declaration
@@ -1667,6 +2671,16 @@ protected void consumeEnterVariable() {
if (isLocalDeclaration) {
declaration.declarationSourceStart = this.intStack[this.intPtr--];
declaration.modifiers = this.intStack[this.intPtr--];
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ declaration.annotations = new Annotation[length],
+ 0,
+ length);
+ }
type = getTypeReference(typeDim = this.intStack[this.intPtr--]); // type dimension
if (declaration.declarationSourceStart == -1) {
// this is true if there is no modifiers for the local variable declaration
@@ -1678,7 +2692,16 @@ protected void consumeEnterVariable() {
pushOnAstStack(type);
declaration.declarationSourceStart = this.intStack[this.intPtr--];
declaration.modifiers = this.intStack[this.intPtr--];
-
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ declaration.annotations = new Annotation[length],
+ 0,
+ length);
+ }
// Store javadoc only on first declaration as it is the same for all ones
FieldDeclaration fieldDeclaration = (FieldDeclaration) declaration;
fieldDeclaration.javadoc = this.javadoc;
@@ -1697,7 +2720,7 @@ protected void consumeEnterVariable() {
declaration.type = type;
} else {
int dimension = typeDim + extendedDimension;
- //on the identifierLengthStack there is the information about the type....
+ //on the this.identifierLengthStack there is the information about the type....
int baseType;
if ((baseType = this.identifierLengthStack[this.identifierLengthPtr + 1]) < 0) {
//it was a baseType
@@ -1736,6 +2759,167 @@ protected void consumeEnterVariable() {
this.lastIgnoredToken = -1;
}
}
+protected void consumeEnumBodyNoConstants() {
+ // nothing to do
+ // The 0 on the astLengthStack has been pushed by EnumBodyDeclarationsopt
+}
+protected void consumeEnumBodyWithConstants() {
+ // merge the constants values with the class body
+ concatNodeLists();
+}
+protected void consumeEnumConstantHeader() {
+ EnumConstant enumConstant = new EnumConstant(this.compilationUnit.compilationResult);
+ long pos = this.identifierPositionStack[this.identifierPtr];
+ enumConstant.sourceEnd = (int) pos;
+ final int start = (int) (pos >>> 32);
+ enumConstant.sourceStart = start;
+ enumConstant.declarationSourceStart = start;
+ enumConstant.name = this.identifierStack[this.identifierPtr--];
+ this.identifierLengthPtr--;
+
+ // fill arguments if needed
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ this.expressionPtr -= length;
+ System.arraycopy(
+ this.expressionStack,
+ this.expressionPtr + 1,
+ enumConstant.arguments = new Expression[length],
+ 0,
+ length);
+ }
+ if (this.currentToken == TokenNameLBRACE) {
+ enumConstant.bodyStart = this.scanner.currentPosition;
+ }
+ pushOnAstStack(enumConstant);
+}
+protected void consumeEnumConstantNoClassBody() {
+ EnumConstant enumConstant = (EnumConstant) this.astStack[this.astPtr];
+ enumConstant.modifiers = CompilerModifiers.AccSemicolonBody;
+ enumConstant.declarationSourceEnd = flushCommentsDefinedPriorTo(rParenPos);
+ enumConstant.bodyStart = rParenPos;
+ enumConstant.bodyEnd = rParenPos;
+}
+protected void consumeEnumConstants() {
+ concatNodeLists();
+}
+protected void consumeEnumConstantWithClassBody() {
+ dispatchDeclarationInto(this.astLengthStack[this.astLengthPtr--]);
+ EnumConstant enumConstant = (EnumConstant) this.astStack[this.astPtr];
+ enumConstant.modifiers = 0;
+ enumConstant.bodyEnd = this.endPosition;
+ enumConstant.declarationSourceEnd = flushCommentsDefinedPriorTo(this.endStatementPosition);
+}
+protected void consumeEnumDeclaration() {
+ // EnumDeclaration ::= EnumHeader ClassHeaderImplementsopt EnumBody
+ int length;
+ if ((length = this.astLengthStack[this.astLengthPtr--]) != 0) {
+ //there are length declarations
+ //dispatch according to the type of the declarations
+ dispatchDeclarationIntoEnumDeclaration(length);
+ }
+
+ EnumDeclaration enumDeclaration = (EnumDeclaration) this.astStack[this.astPtr];
+
+ // mark initializers with local type mark if needed
+ markInitializersWithLocalType(enumDeclaration);
+
+ //convert constructor that do not have the type's name into methods
+ boolean hasConstructor = enumDeclaration.checkConstructors(this);
+
+ //add the default constructor when needed (interface don't have it)
+ if (!hasConstructor && !enumDeclaration.isInterface()) {
+ boolean insideFieldInitializer = false;
+ if (this.diet) {
+ for (int i = this.nestedType; i > 0; i--){
+ if (this.variablesCounter[i] > 0) {
+ insideFieldInitializer = true;
+ break;
+ }
+ }
+ }
+ enumDeclaration.createsInternalConstructor(!this.diet || insideFieldInitializer, true);
+ }
+
+ //always add <clinit> (will be remove at code gen time if empty)
+ if (this.scanner.containsAssertKeyword) {
+ enumDeclaration.bits |= ASTNode.AddAssertionMASK;
+ }
+ enumDeclaration.addClinit();
+ enumDeclaration.bodyEnd = this.endStatementPosition;
+ if (length == 0 && !containsComment(enumDeclaration.bodyStart, enumDeclaration.bodyEnd)) {
+ enumDeclaration.bits |= ASTNode.UndocumentedEmptyBlockMASK;
+ }
+
+ enumDeclaration.declarationSourceEnd = flushCommentsDefinedPriorTo(this.endStatementPosition);
+}
+protected void consumeEnumHeader() {
+ // EnumHeader ::= Modifiersopt 'enum' Identifier
+ EnumDeclaration enumDeclaration;
+ if (this.nestedMethod[this.nestedType] == 0) {
+ if (this.nestedType != 0) {
+ enumDeclaration = new EnumDeclaration(this.compilationUnit.compilationResult);
+ } else {
+ enumDeclaration = new EnumDeclaration(this.compilationUnit.compilationResult);
+ }
+ } else {
+ // Record that the block has a declaration for local types
+ enumDeclaration = new EnumDeclaration(this.compilationUnit.compilationResult);
+// markEnclosingMemberWithLocalType();
+ blockReal();
+ }
+ //highlight the name of the type
+ long pos = this.identifierPositionStack[this.identifierPtr];
+ enumDeclaration.sourceEnd = (int) pos;
+ enumDeclaration.sourceStart = (int) (pos >>> 32);
+ enumDeclaration.name = this.identifierStack[this.identifierPtr--];
+ this.identifierLengthPtr--;
+
+ //compute the declaration source too
+ // 'class' and 'interface' push two int positions: the beginning of the class token and its end.
+ // we want to keep the beginning position but get rid of the end position
+ // it is only used for the ClassLiteralAccess positions.
+ enumDeclaration.declarationSourceStart = this.intStack[this.intPtr--];
+ this.intPtr--; // remove the end position of the class token
+
+ enumDeclaration.modifiersSourceStart = this.intStack[this.intPtr--];
+ enumDeclaration.modifiers = this.intStack[this.intPtr--];
+ if (enumDeclaration.modifiersSourceStart >= 0) {
+ enumDeclaration.declarationSourceStart = enumDeclaration.modifiersSourceStart;
+ }
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ enumDeclaration.annotations = new Annotation[length],
+ 0,
+ length);
+ }
+ if (this.currentToken == TokenNameLBRACE) {
+ enumDeclaration.bodyStart = this.scanner.currentPosition;
+ }
+ pushOnAstStack(enumDeclaration);
+
+ this.listLength = 0; // will be updated when reading super-interfaces
+
+ if(options.sourceLevel < ClassFileConstants.JDK1_5 &&
+ this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) {
+ //TODO this code will be never run while 'enum' is an identifier in 1.3 scanner
+ this.problemReporter().invalidUsageOfEnumsDeclarations(enumDeclaration);
+ }
+
+ // recovery
+ if (this.currentElement != null){
+ this.lastCheckPoint = enumDeclaration.bodyStart;
+ this.currentElement = this.currentElement.add(enumDeclaration, 0);
+ this.lastIgnoredToken = -1;
+ }
+ // javadoc
+ enumDeclaration.javadoc = this.javadoc;
+ this.javadoc = null;
+}
protected void consumeEqualityExpression(int op) {
// EqualityExpression ::= EqualityExpression '==' RelationalExpression
// EqualityExpression ::= EqualityExpression '!=' RelationalExpression
@@ -1750,6 +2934,21 @@ protected void consumeEqualityExpression(int op) {
this.expressionStack[this.expressionPtr + 1],
op);
}
+/*
+ * @param op
+ */
+protected void consumeEqualityExpressionWithName(int op) {
+ // EqualityExpression ::= Name '==' RelationalExpression
+ // EqualityExpression ::= Name '!=' RelationalExpression
+ pushOnExpressionStack(getUnspecifiedReferenceOptimized());
+ this.expressionPtr--;
+ this.expressionLengthPtr--;
+ this.expressionStack[this.expressionPtr] =
+ new EqualExpression(
+ this.expressionStack[this.expressionPtr + 1],
+ this.expressionStack[this.expressionPtr],
+ op);
+}
protected void consumeExitTryBlock() {
//ExitTryBlock ::= $empty
if(this.currentElement != null) {
@@ -1813,6 +3012,46 @@ protected void consumeExplicitConstructorInvocation(int flag, int recFlag) {
pushOnAstStack(ecc);
ecc.sourceEnd = this.endPosition;
}
+protected void consumeExplicitConstructorInvocationWithTypeArguments(int flag, int recFlag) {
+
+ /* flag allows to distinguish 3 cases :
+ (0) :
+ ExplicitConstructorInvocation ::= TypeArguments 'this' '(' ArgumentListopt ')' ';'
+ ExplicitConstructorInvocation ::= TypeArguments 'super' '(' ArgumentListopt ')' ';'
+ (1) :
+ ExplicitConstructorInvocation ::= Primary '.' TypeArguments 'super' '(' ArgumentListopt ')' ';'
+ ExplicitConstructorInvocation ::= Primary '.' TypeArguments 'this' '(' ArgumentListopt ')' ';'
+ (2) :
+ ExplicitConstructorInvocation ::= Name '.' TypeArguments 'super' '(' ArgumentListopt ')' ';'
+ ExplicitConstructorInvocation ::= Name '.' TypeArguments 'this' '(' ArgumentListopt ')' ';'
+ */
+ int startPosition = this.intStack[this.intPtr--];
+ ExplicitConstructorCall ecc = new ExplicitConstructorCall(recFlag);
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ this.expressionPtr -= length;
+ System.arraycopy(this.expressionStack, this.expressionPtr + 1, ecc.arguments = new Expression[length], 0, length);
+ }
+ length = this.genericsLengthStack[this.genericsLengthPtr--];
+ this.genericsPtr -= length;
+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, ecc.typeArguments = new TypeReference[length], 0, length);
+
+ switch (flag) {
+ case 0 :
+ ecc.sourceStart = startPosition;
+ break;
+ case 1 :
+ this.expressionLengthPtr--;
+ ecc.sourceStart = (ecc.qualification = this.expressionStack[this.expressionPtr--]).sourceStart;
+ break;
+ case 2 :
+ ecc.sourceStart = (ecc.qualification = getUnspecifiedReferenceOptimized()).sourceStart;
+ break;
+ }
+
+ pushOnAstStack(ecc);
+ ecc.sourceEnd = this.endPosition;
+}
protected void consumeExpressionStatement() {
// ExpressionStatement ::= StatementExpression ';'
this.expressionLengthPtr--;
@@ -1846,15 +3085,15 @@ protected void consumeFieldDeclaration() {
// FieldDeclaration ::= Modifiersopt Type VariableDeclarators ';'
/*
- astStack :
- expressionStack: Expression Expression ...... Expression
- identifierStack : type identifier identifier ...... identifier
- intStack : typeDim dim dim dim
+ this.astStack :
+ this.expressionStack: Expression Expression ...... Expression
+ this.identifierStack : type identifier identifier ...... identifier
+ this.intStack : typeDim dim dim dim
==>
- astStack : FieldDeclaration FieldDeclaration ...... FieldDeclaration
- expressionStack :
- identifierStack :
- intStack :
+ this.astStack : FieldDeclaration FieldDeclaration ...... FieldDeclaration
+ this.expressionStack :
+ this.identifierStack :
+ this.intStack :
*/
int variableDeclaratorsCounter = this.astLengthStack[this.astLengthPtr];
@@ -1873,7 +3112,7 @@ protected void consumeFieldDeclaration() {
fieldDeclaration.declarationSourceEnd = endPos;
}
}
- // update the astStack, astPtr and astLengthStack
+ // update the this.astStack, this.astPtr and this.astLengthStack
int startIndex = this.astPtr - this.variablesCounter[this.nestedType] + 1;
System.arraycopy(
this.astStack,
@@ -1904,17 +3143,17 @@ protected void consumeForInit() {
// ForInit ::= StatementExpressionList
pushOnAstLengthStack(-1);
}
-protected void consumeFormalParameter() {
+protected void consumeFormalParameter(boolean isVarArgs) {
// FormalParameter ::= Type VariableDeclaratorId ==> false
// FormalParameter ::= Modifiers Type VariableDeclaratorId ==> true
/*
- astStack :
- identifierStack : type identifier
- intStack : dim dim
+ this.astStack :
+ this.identifierStack : type identifier
+ this.intStack : dim dim
==>
- astStack : Argument
- identifierStack :
- intStack :
+ this.astStack : Argument
+ this.identifierStack :
+ this.intStack :
*/
this.identifierLengthPtr--;
@@ -1928,13 +3167,30 @@ protected void consumeFormalParameter() {
identifierName,
namePositions,
type,
- this.intStack[this.intPtr + 1] & ~AccDeprecated); // modifiers
+ this.intStack[this.intPtr + 1] & ~AccDeprecated,
+ isVarArgs); // modifiers
arg.declarationSourceStart = modifierPositions;
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ arg.annotations = new Annotation[length],
+ 0,
+ length);
+ }
pushOnAstStack(arg);
- /* if incomplete method header, listLength counter will not have been reset,
+ /* if incomplete method header, this.listLength counter will not have been reset,
indicating that some arguments are available on the stack */
this.listLength++;
+
+ if(isVarArgs &&
+ options.sourceLevel < ClassFileConstants.JDK1_5 &&
+ this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) {
+ this.problemReporter().invalidUsageOfVarargs(arg);
+ }
}
protected void consumeFormalParameterList() {
// FormalParameterList ::= FormalParameterList ',' FormalParameter
@@ -1944,30 +3200,44 @@ protected void consumeFormalParameterListopt() {
// FormalParameterListopt ::= $empty
pushOnAstLengthStack(0);
}
+protected void consumeGenericTypeArrayType() {
+ // nothing to do
+ // Will be consume by a getTypeRefence call
+}
+protected void consumeGenericTypeNameArrayType() {
+ pushOnGenericsLengthStack(0); // handle type arguments
+}
+protected void consumeImportDeclaration() {
+ // SingleTypeImportDeclaration ::= SingleTypeImportDeclarationName ';'
+ ImportReference impt = (ImportReference) this.astStack[this.astPtr];
+ // flush annotations defined prior to import statements
+ impt.declarationEnd = this.endStatementPosition;
+ impt.declarationSourceEnd =
+ this.flushCommentsDefinedPriorTo(impt.declarationSourceEnd);
+
+ // recovery
+ if (this.currentElement != null) {
+ this.lastCheckPoint = impt.declarationSourceEnd + 1;
+ this.currentElement = this.currentElement.add(impt, 0);
+ this.lastIgnoredToken = -1;
+ this.restartRecovery = true;
+ // used to avoid branching back into the regular automaton
+ }
+}
protected void consumeImportDeclarations() {
// ImportDeclarations ::= ImportDeclarations ImportDeclaration
optimizedConcatNodeLists();
}
-protected void consumeImportDeclarationsopt() {
- // ImportDeclarationsopt ::= ImportDeclarations
- int length;
- if ((length = this.astLengthStack[this.astLengthPtr--]) != 0) {
- this.astPtr -= length;
- System.arraycopy(
- this.astStack,
- this.astPtr + 1,
- this.compilationUnit.imports = new ImportReference[length],
- 0,
- length);
- }
-}
protected void consumeInsideCastExpression() {
// InsideCastExpression ::= $empty
}
protected void consumeInsideCastExpressionLL1() {
// InsideCastExpressionLL1 ::= $empty
+ pushOnExpressionStack(getUnspecifiedReferenceOptimized());
+}
+protected void consumeInsideCastExpressionWithQualifiedGenerics() {
+ // InsideCastExpressionWithQualifiedGenerics ::= $empty
}
-
protected void consumeInstanceOfExpression(int op) {
// RelationalExpression ::= RelationalExpression 'instanceof' ReferenceType
//optimize the push/pop
@@ -1985,6 +3255,28 @@ protected void consumeInstanceOfExpression(int op) {
}
//the scanner is on the next token already....
}
+/**
+ * @param op
+ */
+protected void consumeInstanceOfExpressionWithName(int op) {
+ // RelationalExpression_NotName ::= Name instanceof ReferenceType
+ //optimize the push/pop
+
+ //by construction, no base type may be used in getTypeReference
+ TypeReference reference = getTypeReference(this.intStack[this.intPtr--]);
+ pushOnExpressionStack(getUnspecifiedReferenceOptimized());
+ Expression exp;
+ this.expressionStack[this.expressionPtr] = exp =
+ new InstanceOfExpression(
+ this.expressionStack[this.expressionPtr],
+ reference,
+ op);
+ if (exp.sourceEnd == 0) {
+ //array on base type....
+ exp.sourceEnd = this.scanner.startPosition - 1;
+ }
+ //the scanner is on the next token already....
+}
protected void consumeInterfaceDeclaration() {
// see consumeClassDeclaration in case of changes: duplicated code
// InterfaceDeclaration ::= InterfaceHeader InterfaceBody
@@ -2046,7 +3338,7 @@ protected void consumeInterfaceHeaderExtends() {
this.lastCheckPoint = typeDecl.bodyStart;
}
}
-protected void consumeInterfaceHeaderName() {
+protected void consumeInterfaceHeaderName1() {
// InterfaceHeaderName ::= Modifiersopt 'interface' 'Identifier'
TypeDeclaration typeDecl = new TypeDeclaration(this.compilationUnit.compilationResult);
@@ -2079,6 +3371,16 @@ protected void consumeInterfaceHeaderName() {
if (typeDecl.modifiersSourceStart >= 0) {
typeDecl.declarationSourceStart = typeDecl.modifiersSourceStart;
}
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ typeDecl.annotations = new Annotation[length],
+ 0,
+ length);
+ }
typeDecl.bodyStart = typeDecl.sourceEnd + 1;
pushOnAstStack(typeDecl);
this.listLength = 0; // will be updated when reading super-interfaces
@@ -2103,7 +3405,7 @@ protected void consumeInterfaceMemberDeclarationsopt() {
protected void consumeInterfaceType() {
// InterfaceType ::= ClassOrInterfaceType
pushOnAstStack(getTypeReference(0));
- /* if incomplete type header, listLength counter will not have been reset,
+ /* if incomplete type header, this.listLength counter will not have been reset,
indicating that some interfaces are available on the stack */
this.listLength++;
}
@@ -2111,6 +3413,34 @@ protected void consumeInterfaceTypeList() {
// InterfaceTypeList ::= InterfaceTypeList ',' InterfaceType
optimizedConcatNodeLists();
}
+protected void consumeInternalCompilationUnit() {
+ // InternalCompilationUnit ::= PackageDeclaration
+ // InternalCompilationUnit ::= PackageDeclaration ImportDeclarations ReduceImports
+ // InternalCompilationUnit ::= ImportDeclarations ReduceImports
+}
+protected void consumeInternalCompilationUnitWithTypes() {
+ // InternalCompilationUnit ::= PackageDeclaration ImportDeclarations ReduceImports TypeDeclarations
+ // InternalCompilationUnit ::= PackageDeclaration TypeDeclarations
+ // InternalCompilationUnit ::= TypeDeclarations
+ // InternalCompilationUnit ::= ImportDeclarations ReduceImports TypeDeclarations
+ // consume type declarations
+ int length;
+ if ((length = this.astLengthStack[this.astLengthPtr--]) != 0) {
+ this.astPtr -= length;
+ System.arraycopy(this.astStack, this.astPtr + 1, this.compilationUnit.types = new TypeDeclaration[length], 0, length);
+ }
+}
+protected void consumeInvalidConstructorDeclaration() {
+ // ConstructorDeclaration ::= ConstructorHeader ';'
+ // now we know that the top of stack is a constructorDeclaration
+ ConstructorDeclaration cd = (ConstructorDeclaration) this.astStack[this.astPtr];
+
+ cd.bodyEnd = this.endPosition; // position just before the trailing semi-colon
+ cd.declarationSourceEnd = flushCommentsDefinedPriorTo(this.endStatementPosition);
+ // report the problem and continue the parsing - narrowing the problem onto the method
+
+ cd.modifiers |= AccSemicolonBody; // remember semi-colon body
+}
protected void consumeLeftParen() {
// PushLPAREN ::= '('
pushOnIntStack(this.lParenPos);
@@ -2119,20 +3449,20 @@ protected void consumeLocalVariableDeclaration() {
// LocalVariableDeclaration ::= Modifiers Type VariableDeclarators ';'
/*
- astStack :
- expressionStack: Expression Expression ...... Expression
- identifierStack : type identifier identifier ...... identifier
- intStack : typeDim dim dim dim
+ this.astStack :
+ this.expressionStack: Expression Expression ...... Expression
+ this.identifierStack : type identifier identifier ...... identifier
+ this.intStack : typeDim dim dim dim
==>
- astStack : FieldDeclaration FieldDeclaration ...... FieldDeclaration
- expressionStack :
- identifierStack :
- intStack :
+ this.astStack : FieldDeclaration FieldDeclaration ...... FieldDeclaration
+ this.expressionStack :
+ this.identifierStack :
+ this.intStack :
*/
int variableDeclaratorsCounter = this.astLengthStack[this.astLengthPtr];
- // update the astStack, astPtr and astLengthStack
+ // update the this.astStack, this.astPtr and this.astLengthStack
int startIndex = this.astPtr - this.variablesCounter[this.nestedType] + 1;
System.arraycopy(
this.astStack,
@@ -2159,6 +3489,59 @@ protected void consumeLocalVariableDeclarationStatement() {
}
}
+protected void consumeMarkerAnnotation() {
+ // MarkerAnnotation ::= '@' Name
+ MarkerAnnotation markerAnnotation = null;
+ int length = this.identifierLengthStack[this.identifierLengthPtr--];
+ if (length == 1) {
+ markerAnnotation = new MarkerAnnotation(this.identifierStack[this.identifierPtr], this.identifierPositionStack[this.identifierPtr--], this.intStack[this.intPtr--]);
+ } else {
+ char[][] tokens = new char[length][];
+ this.identifierPtr -= length;
+ long[] positions = new long[length];
+ System.arraycopy(this.identifierStack, this.identifierPtr + 1, tokens, 0, length);
+ System.arraycopy(
+ this.identifierPositionStack,
+ this.identifierPtr + 1,
+ positions,
+ 0,
+ length);
+ markerAnnotation = new MarkerAnnotation(tokens, positions, this.intStack[this.intPtr--]);
+ }
+ int sourceStart = markerAnnotation.sourceStart;
+ if (this.modifiersSourceStart < 0) {
+ this.modifiersSourceStart = sourceStart;
+ } else if (this.modifiersSourceStart > sourceStart) {
+ this.modifiersSourceStart = sourceStart;
+ }
+ markerAnnotation.declarationSourceEnd = markerAnnotation.sourceEnd;
+ pushOnExpressionStack(markerAnnotation);
+}
+protected void consumeMemberValueArrayInitializer() {
+ // MemberValueArrayInitializer ::= '{' MemberValues ',' '}'
+ // MemberValueArrayInitializer ::= '{' MemberValues '}'
+ memberValueArrayInitializer(this.expressionLengthStack[this.expressionLengthPtr--]);
+}
+protected void consumeMemberValuePair() {
+ // MemberValuePair ::= SimpleName '=' MemberValue
+ char[] simpleName = this.identifierStack[this.identifierPtr];
+ long position = this.identifierPositionStack[this.identifierPtr--];
+ this.identifierLengthPtr--;
+ int end = (int) position;
+ int start = (int) (position >>> 32);
+ Expression value = this.expressionStack[this.expressionPtr--];
+ this.expressionLengthPtr--;
+ MemberValuePair memberValuePair = new MemberValuePair(simpleName, start, end, value);
+ pushOnAstStack(memberValuePair);
+}
+protected void consumeMemberValuePairs() {
+ // MemberValuePairs ::= MemberValuePairs ',' MemberValuePair
+ concatNodeLists();
+}
+protected void consumeMemberValues() {
+ // MemberValues ::= MemberValues ',' MemberValue
+ concatExpressionLists();
+}
protected void consumeMethodBody() {
// MethodBody ::= NestedMethod '{' BlockStatementsopt '}'
this.nestedMethod[this.nestedType] --;
@@ -2168,13 +3551,13 @@ protected void consumeMethodDeclaration(boolean isNotAbstract) {
// AbstractMethodDeclaration ::= MethodHeader ';'
/*
- astStack : modifiers arguments throws statements
- identifierStack : type name
- intStack : dim dim dim
+ this.astStack : modifiers arguments throws statements
+ this.identifierStack : type name
+ this.intStack : dim dim dim
==>
- astStack : MethodDeclaration
- identifierStack :
- intStack :
+ this.astStack : MethodDeclaration
+ this.identifierStack :
+ this.intStack :
*/
int length;
@@ -2215,7 +3598,7 @@ protected void consumeMethodDeclaration(boolean isNotAbstract) {
}
}
}
- // store the endPosition (position just before the '}') in case there is
+ // store the this.endPosition (position just before the '}') in case there is
// a trailing comment behind the end of the method
md.bodyEnd = this.endPosition;
md.declarationSourceEnd = flushCommentsDefinedPriorTo(this.endStatementPosition);
@@ -2284,6 +3667,16 @@ protected void consumeMethodHeaderName() {
//modifiers
md.declarationSourceStart = this.intStack[this.intPtr--];
md.modifiers = this.intStack[this.intPtr--];
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ md.annotations = new Annotation[length],
+ 0,
+ length);
+ }
// javadoc
md.javadoc = this.javadoc;
this.javadoc = null;
@@ -2293,7 +3686,7 @@ protected void consumeMethodHeaderName() {
pushOnAstStack(md);
md.sourceEnd = this.lParenPos;
md.bodyStart = this.lParenPos+1;
- this.listLength = 0; // initialize listLength before reading parameters/throws
+ this.listLength = 0; // initialize this.listLength before reading parameters/throws
// recovery
if (this.currentElement != null){
@@ -2310,7 +3703,61 @@ protected void consumeMethodHeaderName() {
}
}
}
-protected void consumeMethodHeaderParameters() {
+protected void consumeMethodHeaderNameWithTypeParameters() {
+ // MethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
+ MethodDeclaration md = new MethodDeclaration(this.compilationUnit.compilationResult);
+
+ //name
+ md.selector = this.identifierStack[this.identifierPtr];
+ long selectorSource = this.identifierPositionStack[this.identifierPtr--];
+ this.identifierLengthPtr--;
+ //type
+ md.returnType = getTypeReference(this.intStack[this.intPtr--]);
+
+ // consume type parameters
+ int length = this.genericsLengthStack[this.genericsLengthPtr--];
+ this.genericsPtr -= length;
+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, md.typeParameters = new TypeParameter[length], 0, length);
+
+ //modifiers
+ md.declarationSourceStart = this.intStack[this.intPtr--];
+ md.modifiers = this.intStack[this.intPtr--];
+ // consume annotations
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ md.annotations = new Annotation[length],
+ 0,
+ length);
+ }
+ // javadoc
+ md.javadoc = this.javadoc;
+ this.javadoc = null;
+
+ //highlight starts at selector start
+ md.sourceStart = (int) (selectorSource >>> 32);
+ pushOnAstStack(md);
+ md.sourceEnd = this.lParenPos;
+ md.bodyStart = this.lParenPos+1;
+ this.listLength = 0; // initialize this.listLength before reading parameters/throws
+
+ // recovery
+ if (this.currentElement != null){
+ if (this.currentElement instanceof RecoveredType
+ //|| md.modifiers != 0
+ || (this.scanner.getLineNumber(md.returnType.sourceStart)
+ == this.scanner.getLineNumber(md.sourceStart))){
+ this.lastCheckPoint = md.bodyStart;
+ this.currentElement = this.currentElement.add(md, 0);
+ this.lastIgnoredToken = -1;
+ } else {
+ this.lastCheckPoint = md.sourceStart;
+ this.restartRecovery = true;
+ }
+ }
+}
+protected void consumeMethodHeaderRightParen() {
// MethodHeaderParameters ::= FormalParameterListopt ')'
int length = this.astLengthStack[this.astLengthPtr--];
this.astPtr -= length;
@@ -2326,7 +3773,7 @@ protected void consumeMethodHeaderParameters() {
length);
}
md.bodyStart = this.rParenPos+1;
- this.listLength = 0; // reset listLength after having read all parameters
+ this.listLength = 0; // reset this.listLength after having read all parameters
// recovery
if (this.currentElement != null){
this.lastCheckPoint = md.bodyStart;
@@ -2356,11 +3803,11 @@ protected void consumeMethodHeaderThrowsClause() {
length);
md.sourceEnd = md.thrownExceptions[length-1].sourceEnd;
md.bodyStart = md.thrownExceptions[length-1].sourceEnd + 1;
- this.listLength = 0; // reset listLength after having read all thrown exceptions
+ this.listLength = 0; // reset this.listLength after having read all thrown exceptions
// recovery
if (this.currentElement != null){
this.lastCheckPoint = md.bodyStart;
- }
+ }
}
protected void consumeMethodInvocationName() {
// MethodInvocation ::= Name '(' ArgumentListopt ')'
@@ -2382,6 +3829,27 @@ protected void consumeMethodInvocationName() {
}
pushOnExpressionStack(m);
}
+protected void consumeMethodInvocationNameWithTypeArguments() {
+ // MethodInvocation ::= Name '.' TypeArguments 'Identifier' '(' ArgumentListopt ')'
+
+ // when the name is only an identifier...we have a message send to "this" (implicit)
+
+ MessageSend m = newMessageSendWithTypeArguments();
+ m.sourceEnd = this.rParenPos;
+ m.sourceStart =
+ (int) ((m.nameSourcePosition = this.identifierPositionStack[this.identifierPtr]) >>> 32);
+ m.selector = this.identifierStack[this.identifierPtr--];
+ this.identifierLengthPtr--;
+
+ // handle type arguments
+ int length = this.genericsLengthStack[this.genericsLengthPtr--];
+ this.genericsPtr -= length;
+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, m.typeArguments = new TypeReference[length], 0, length);
+
+ m.receiver = getUnspecifiedReference();
+ m.sourceStart = m.receiver.sourceStart;
+ pushOnExpressionStack(m);
+}
protected void consumeMethodInvocationPrimary() {
//optimize the push/pop
//MethodInvocation ::= Primary '.' 'Identifier' '(' ArgumentListopt ')'
@@ -2396,6 +3864,26 @@ protected void consumeMethodInvocationPrimary() {
m.sourceEnd = this.rParenPos;
this.expressionStack[this.expressionPtr] = m;
}
+protected void consumeMethodInvocationPrimaryWithTypeArguments() {
+ //optimize the push/pop
+ //MethodInvocation ::= Primary '.' TypeArguments 'Identifier' '(' ArgumentListopt ')'
+
+ MessageSend m = newMessageSendWithTypeArguments();
+ m.sourceStart =
+ (int) ((m.nameSourcePosition = this.identifierPositionStack[this.identifierPtr]) >>> 32);
+ m.selector = this.identifierStack[this.identifierPtr--];
+ this.identifierLengthPtr--;
+
+ // handle type arguments
+ int length = this.genericsLengthStack[this.genericsLengthPtr--];
+ this.genericsPtr -= length;
+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, m.typeArguments = new TypeReference[length], 0, length);
+
+ m.receiver = this.expressionStack[this.expressionPtr];
+ m.sourceStart = m.receiver.sourceStart;
+ m.sourceEnd = this.rParenPos;
+ this.expressionStack[this.expressionPtr] = m;
+}
protected void consumeMethodInvocationSuper() {
// MethodInvocation ::= 'super' '.' 'Identifier' '(' ArgumentListopt ')'
@@ -2408,6 +3896,24 @@ protected void consumeMethodInvocationSuper() {
m.receiver = new SuperReference(m.sourceStart, this.endPosition);
pushOnExpressionStack(m);
}
+protected void consumeMethodInvocationSuperWithTypeArguments() {
+ // MethodInvocation ::= 'super' '.' TypeArguments 'Identifier' '(' ArgumentListopt ')'
+
+ MessageSend m = newMessageSendWithTypeArguments();
+ m.sourceStart = this.intStack[this.intPtr--];
+ m.sourceEnd = this.rParenPos;
+ m.nameSourcePosition = this.identifierPositionStack[this.identifierPtr];
+ m.selector = this.identifierStack[this.identifierPtr--];
+ this.identifierLengthPtr--;
+
+ // handle type arguments
+ int length = this.genericsLengthStack[this.genericsLengthPtr--];
+ this.genericsPtr -= length;
+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, m.typeArguments = new TypeReference[length], 0, length);
+
+ m.receiver = new SuperReference(m.sourceStart, this.endPosition);
+ pushOnExpressionStack(m);
+}
protected void consumeModifiers() {
int savedModifiersSourceStart = this.modifiersSourceStart;
checkComment(); // might update modifiers with AccDeprecated
@@ -2418,6 +3924,13 @@ protected void consumeModifiers() {
pushOnIntStack(this.modifiersSourceStart);
resetModifiers();
}
+protected void consumeModifiers2() {
+ this.expressionLengthStack[this.expressionLengthPtr - 1] += this.expressionLengthStack[this.expressionLengthPtr--];
+}
+protected void consumeNameArrayType() {
+ pushOnGenericsLengthStack(0); // handle type arguments
+ pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
+}
protected void consumeNestedMethod() {
// NestedMethod ::= $empty
jumpOverMethodBody();
@@ -2442,6 +3955,42 @@ protected void consumeNestedType() {
this.nestedMethod[this.nestedType] = 0;
this.variablesCounter[this.nestedType] = 0;
}
+protected void consumeNormalAnnotation() {
+ // NormalAnnotation ::= '@' Name '(' MemberValuePairsopt ')'
+ NormalAnnotation normalAnnotation = null;
+ int length = this.identifierLengthStack[this.identifierLengthPtr--];
+ if (length == 1) {
+ normalAnnotation = new NormalAnnotation(this.identifierStack[this.identifierPtr], this.identifierPositionStack[this.identifierPtr--], this.intStack[this.intPtr--]);
+ } else {
+ char[][] tokens = new char[length][];
+ this.identifierPtr -= length;
+ long[] positions = new long[length];
+ System.arraycopy(this.identifierStack, this.identifierPtr + 1, tokens, 0, length);
+ System.arraycopy(
+ this.identifierPositionStack,
+ this.identifierPtr + 1,
+ positions,
+ 0,
+ length);
+ normalAnnotation = new NormalAnnotation(tokens, positions, this.intStack[this.intPtr--]);
+ }
+ if ((length = this.astLengthStack[this.astLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.astStack,
+ (this.astPtr -= length) + 1,
+ normalAnnotation.memberValuePairs = new MemberValuePair[length],
+ 0,
+ length);
+ }
+ int sourceStart = normalAnnotation.sourceStart;
+ if (this.modifiersSourceStart < 0) {
+ this.modifiersSourceStart = sourceStart;
+ } else if (this.modifiersSourceStart > sourceStart) {
+ this.modifiersSourceStart = sourceStart;
+ }
+ normalAnnotation.declarationSourceEnd = this.rParenPos;
+ pushOnExpressionStack(normalAnnotation);
+}
protected void consumeOneDimLoop() {
// OneDimLoop ::= '[' ']'
this.dimensions++;
@@ -2450,6 +3999,19 @@ protected void consumeOnlySynchronized() {
// OnlySynchronized ::= 'synchronized'
pushOnIntStack(this.synchronizedBlockSourceStart);
resetModifiers();
+ this.expressionLengthPtr--;
+}
+protected void consumeOnlyTypeArguments() {
+ if(options.sourceLevel < ClassFileConstants.JDK1_5 &&
+ this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) {
+ int length = this.genericsLengthStack[this.genericsLengthPtr];
+ this.problemReporter().invalidUsageOfTypeArguments(
+ (TypeReference)this.genericsStack[this.genericsPtr - length + 1],
+ (TypeReference)this.genericsStack[this.genericsPtr]);
+ }
+}
+protected void consumeOnlyTypeArgumentsForCastExpression() {
+ // OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments
}
protected void consumeOpenBlock() {
// OpenBlock ::= $empty
@@ -2491,9 +4053,10 @@ protected void consumePackageDeclarationName() {
this.identifierPtr--,
positions,
0,
- length);
- this.compilationUnit.currentPackage =
- impt = new ImportReference(tokens, positions, true, AccDefault);
+ length);
+
+ impt = new ImportReference(tokens, positions, true, AccDefault);
+ this.compilationUnit.currentPackage = impt;
if (this.currentToken == TokenNameSEMICOLON){
impt.declarationSourceEnd = this.scanner.currentPosition - 1;
@@ -2501,7 +4064,7 @@ protected void consumePackageDeclarationName() {
impt.declarationSourceEnd = impt.sourceEnd;
}
impt.declarationEnd = impt.declarationSourceEnd;
- //endPosition is just before the ;
+ //this.endPosition is just before the ;
impt.declarationSourceStart = this.intStack[this.intPtr--];
// recovery
@@ -2510,6 +4073,57 @@ protected void consumePackageDeclarationName() {
this.restartRecovery = true; // used to avoid branching back into the regular automaton
}
}
+protected void consumePackageDeclarationNameWithModifiers() {
+ // PackageDeclarationName ::= Modifiers 'package' Name
+ /* build an ImportRef build from the last name
+ stored in the identifier stack. */
+
+ ImportReference impt;
+ int length;
+ char[][] tokens =
+ new char[length = this.identifierLengthStack[this.identifierLengthPtr--]][];
+ this.identifierPtr -= length;
+ long[] positions = new long[length];
+ System.arraycopy(this.identifierStack, ++this.identifierPtr, tokens, 0, length);
+ System.arraycopy(
+ this.identifierPositionStack,
+ this.identifierPtr--,
+ positions,
+ 0,
+ length);
+
+ int packageModifiersSourceStart = this.intStack[this.intPtr--]; // we don't need the modifiers start
+ int packageModifiers = this.intStack[this.intPtr--];
+
+ impt = new ImportReference(tokens, positions, true, packageModifiers);
+ this.compilationUnit.currentPackage = impt;
+ // consume annotations
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ impt.annotations = new Annotation[length],
+ 0,
+ length);
+ impt.declarationSourceStart = packageModifiersSourceStart;
+ intPtr--; // we don't need the position of the 'package keyword
+ } else {
+ impt.declarationSourceStart = this.intStack[this.intPtr--];
+ }
+
+ if (this.currentToken == TokenNameSEMICOLON){
+ impt.declarationSourceEnd = this.scanner.currentPosition - 1;
+ } else {
+ impt.declarationSourceEnd = impt.sourceEnd;
+ }
+ impt.declarationEnd = impt.declarationSourceEnd;
+
+ // recovery
+ if (this.currentElement != null){
+ this.lastCheckPoint = impt.declarationSourceEnd+1;
+ this.restartRecovery = true; // used to avoid branching back into the regular automaton
+ }
+}
protected void consumePostfixExpression() {
// PostfixExpression ::= Name
pushOnExpressionStack(getUnspecifiedReferenceOptimized());
@@ -2523,54 +4137,97 @@ protected void consumePrimaryNoNewArray() {
parenthesizedExpression.bits |= (numberOfParenthesis + 1) << ASTNode.ParenthesizedSHIFT;
}
protected void consumePrimaryNoNewArrayArrayType() {
- // PrimaryNoNewArray ::= ArrayType '.' 'class'
- this.intPtr--;
+ // PrimaryNoNewArray ::= Name Dims '.' 'class'
+ this.intPtr--; // remove the class start position
+
+ pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
+ pushOnGenericsLengthStack(0);
+
pushOnExpressionStack(
- new ClassLiteralAccess(this.intStack[this.intPtr--],
- getTypeReference(this.intStack[this.intPtr--])));
+ new ClassLiteralAccess(this.intStack[this.intPtr--], getTypeReference(this.intStack[this.intPtr--])));
}
protected void consumePrimaryNoNewArrayName() {
// PrimaryNoNewArray ::= Name '.' 'class'
- this.intPtr--;
+ this.intPtr--; // remove the class start position
+
+ // handle type arguments
+ pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
+ pushOnGenericsLengthStack(0);
+ TypeReference typeReference = getTypeReference(0);
+
pushOnExpressionStack(
- new ClassLiteralAccess(this.intStack[this.intPtr--],
- getTypeReference(0)));
+ new ClassLiteralAccess(this.intStack[this.intPtr--], typeReference));
}
protected void consumePrimaryNoNewArrayNameSuper() {
// PrimaryNoNewArray ::= Name '.' 'super'
+ // handle type arguments
+ pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
+ pushOnGenericsLengthStack(0);
+ TypeReference typeReference = getTypeReference(0);
+
pushOnExpressionStack(
new QualifiedSuperReference(
- getTypeReference(0),
+ typeReference,
this.intStack[this.intPtr--],
this.endPosition));
}
protected void consumePrimaryNoNewArrayNameThis() {
// PrimaryNoNewArray ::= Name '.' 'this'
+ // handle type arguments
+ pushOnGenericsIdentifiersLengthStack(this.identifierLengthStack[this.identifierLengthPtr]);
+ pushOnGenericsLengthStack(0); // handle type arguments
+
+ TypeReference typeReference = getTypeReference(0);
+
pushOnExpressionStack(
new QualifiedThisReference(
- getTypeReference(0),
+ typeReference,
this.intStack[this.intPtr--],
this.endPosition));
}
+protected void consumePrimaryNoNewArrayPrimitiveArrayType() {
+ // PrimaryNoNewArray ::= PrimitiveType Dims '.' 'class'
+ this.intPtr--; // remove the class start position
+ pushOnExpressionStack(
+ new ClassLiteralAccess(this.intStack[this.intPtr--], getTypeReference(this.intStack[this.intPtr--])));
+}
protected void consumePrimaryNoNewArrayPrimitiveType() {
// PrimaryNoNewArray ::= PrimitiveType '.' 'class'
- this.intPtr--;
+ this.intPtr--; // remove the class start position
pushOnExpressionStack(
- new ClassLiteralAccess(this.intStack[this.intPtr--],
- getTypeReference(0)));
+ new ClassLiteralAccess(this.intStack[this.intPtr--], getTypeReference(0)));
}
protected void consumePrimaryNoNewArrayThis() {
// PrimaryNoNewArray ::= 'this'
pushOnExpressionStack(new ThisReference(this.intStack[this.intPtr--], this.endPosition));
}
+protected void consumePrimaryNoNewArrayWithName() {
+ // PrimaryNoNewArray ::= PushLPAREN Expression PushRPAREN
+ pushOnExpressionStack(getUnspecifiedReferenceOptimized());
+ final Expression parenthesizedExpression = this.expressionStack[this.expressionPtr];
+ updateSourcePosition(parenthesizedExpression);
+ int numberOfParenthesis = (parenthesizedExpression.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
+ parenthesizedExpression.bits &= ~ASTNode.ParenthesizedMASK;
+ parenthesizedExpression.bits |= (numberOfParenthesis + 1) << ASTNode.ParenthesizedSHIFT;
+}
+protected void consumePrimitiveArrayType() {
+ // nothing to do
+ // Will be consume by a getTypeRefence call
+}
protected void consumePrimitiveType() {
// Type ::= PrimitiveType
pushOnIntStack(0);
}
+protected void consumePushRealModifiers() {
+ pushOnIntStack(this.modifiers); // modifiers
+ pushOnIntStack(this.modifiersSourceStart);
+ resetModifiers();
+}
protected void consumePushModifiers() {
pushOnIntStack(this.modifiers); // modifiers
pushOnIntStack(this.modifiersSourceStart);
resetModifiers();
+ pushOnExpressionStackLengthStack(0);
}
protected void consumePushPosition() {
// for source managment purpose
@@ -2584,9 +4241,30 @@ protected void consumeQualifiedName() {
this.identifierLengthStack[--this.identifierLengthPtr]++;
}
+protected void consumeReduceImports() {
+ // Consume imports
+ int length;
+ if ((length = this.astLengthStack[this.astLengthPtr--]) != 0) {
+ this.astPtr -= length;
+ System.arraycopy(
+ this.astStack,
+ this.astPtr + 1,
+ this.compilationUnit.imports = new ImportReference[length],
+ 0,
+ length);
+ }
+}
protected void consumeReferenceType() {
- // ReferenceType ::= ClassOrInterfaceType
- pushOnIntStack(0);
+ pushOnIntStack(0); // handle array type
+}
+protected void consumeReferenceType1() {
+ pushOnGenericsStack(getTypeReference(this.intStack[this.intPtr--]));
+}
+protected void consumeReferenceType2() {
+ pushOnGenericsStack(getTypeReference(this.intStack[this.intPtr--]));
+}
+protected void consumeReferenceType3() {
+ pushOnGenericsStack(getTypeReference(this.intStack[this.intPtr--]));
}
protected void consumeRestoreDiet() {
// RestoreDiet ::= $empty
@@ -2598,895 +4276,1565 @@ protected void consumeRightParen() {
}
// This method is part of an automatic generation : do NOT edit-modify
protected void consumeRule(int act) {
- switch ( act ) {
- case 26 : // System.out.println("Type ::= PrimitiveType"); //$NON-NLS-1$
- consumePrimitiveType();
- break ;
-
- case 40 : // System.out.println("ReferenceType ::= ClassOrInterfaceType"); //$NON-NLS-1$
- consumeReferenceType();
- break ;
-
- case 49 : // System.out.println("QualifiedName ::= Name DOT SimpleName"); //$NON-NLS-1$
- consumeQualifiedName();
- break ;
-
- case 50 : // System.out.println("CompilationUnit ::= EnterCompilationUnit PackageDeclarationopt..."); //$NON-NLS-1$
- consumeCompilationUnit();
- break ;
-
- case 51 : // System.out.println("EnterCompilationUnit ::="); //$NON-NLS-1$
- consumeEnterCompilationUnit();
- break ;
-
- case 64 : // System.out.println("CatchHeader ::= catch LPAREN FormalParameter RPAREN LBRACE"); //$NON-NLS-1$
- consumeCatchHeader();
- break ;
-
- case 66 : // System.out.println("ImportDeclarations ::= ImportDeclarations ImportDeclaration"); //$NON-NLS-1$
- consumeImportDeclarations();
- break ;
-
- case 68 : // System.out.println("TypeDeclarations ::= TypeDeclarations TypeDeclaration"); //$NON-NLS-1$
- consumeTypeDeclarations();
- break ;
-
- case 69 : // System.out.println("PackageDeclaration ::= PackageDeclarationName SEMICOLON"); //$NON-NLS-1$
- consumePackageDeclaration();
- break ;
-
- case 70 : // System.out.println("PackageDeclarationName ::= package Name"); //$NON-NLS-1$
- consumePackageDeclarationName();
- break ;
-
- case 73 : // System.out.println("SingleTypeImportDeclaration ::= SingleTypeImportDeclarationName..."); //$NON-NLS-1$
- consumeSingleTypeImportDeclaration();
- break ;
-
- case 74 : // System.out.println("SingleTypeImportDeclarationName ::= import Name"); //$NON-NLS-1$
- consumeSingleTypeImportDeclarationName();
- break ;
-
- case 75 : // System.out.println("TypeImportOnDemandDeclaration ::= TypeImportOnDemandDeclarationName"); //$NON-NLS-1$
- consumeTypeImportOnDemandDeclaration();
- break ;
-
- case 76 : // System.out.println("TypeImportOnDemandDeclarationName ::= import Name DOT MULTIPLY"); //$NON-NLS-1$
- consumeTypeImportOnDemandDeclarationName();
- break ;
-
- case 79 : // System.out.println("TypeDeclaration ::= SEMICOLON"); //$NON-NLS-1$
- consumeEmptyTypeDeclaration();
- break ;
-
- case 93 : // System.out.println("ClassDeclaration ::= ClassHeader ClassBody"); //$NON-NLS-1$
- consumeClassDeclaration();
- break ;
-
- case 94 : // System.out.println("ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt..."); //$NON-NLS-1$
- consumeClassHeader();
- break ;
-
- case 95 : // System.out.println("ClassHeaderName ::= Modifiersopt class Identifier"); //$NON-NLS-1$
- consumeClassHeaderName();
- break ;
-
- case 96 : // System.out.println("ClassHeaderExtends ::= extends ClassType"); //$NON-NLS-1$
- consumeClassHeaderExtends();
- break ;
-
- case 97 : // System.out.println("ClassHeaderImplements ::= implements InterfaceTypeList"); //$NON-NLS-1$
- consumeClassHeaderImplements();
- break ;
-
- case 99 : // System.out.println("InterfaceTypeList ::= InterfaceTypeList COMMA InterfaceType"); //$NON-NLS-1$
- consumeInterfaceTypeList();
- break ;
-
- case 100 : // System.out.println("InterfaceType ::= ClassOrInterfaceType"); //$NON-NLS-1$
- consumeInterfaceType();
- break ;
-
- case 103 : // System.out.println("ClassBodyDeclarations ::= ClassBodyDeclarations ClassBodyDeclaration"); //$NON-NLS-1$
- consumeClassBodyDeclarations();
- break ;
-
- case 107 : // System.out.println("ClassBodyDeclaration ::= Diet NestedMethod Block"); //$NON-NLS-1$
- consumeClassBodyDeclaration();
- break ;
-
- case 108 : // System.out.println("Diet ::="); //$NON-NLS-1$
- consumeDiet();
- break ;
+ switch ( act ) {
+ case 26 : if (DEBUG) { System.out.println("Type ::= PrimitiveType"); } //$NON-NLS-1$
+ consumePrimitiveType();
+ break;
+
+ case 40 : if (DEBUG) { System.out.println("ReferenceType ::= ClassOrInterfaceType"); } //$NON-NLS-1$
+ consumeReferenceType();
+ break;
+
+ case 44 : if (DEBUG) { System.out.println("ClassOrInterface ::= Name"); } //$NON-NLS-1$
+ consumeClassOrInterfaceName();
+ break;
+
+ case 45 : if (DEBUG) { System.out.println("ClassOrInterface ::= ClassOrInterface TypeArguments DOT"); } //$NON-NLS-1$
+ consumeClassOrInterface();
+ break;
+
+ case 46 : if (DEBUG) { System.out.println("ArrayTypeWithTypeArgumentsName ::= ClassOrInterface..."); } //$NON-NLS-1$
+ consumeArrayTypeWithTypeArgumentsName();
+ break;
+
+ case 47 : if (DEBUG) { System.out.println("ArrayType ::= PrimitiveType Dims"); } //$NON-NLS-1$
+ consumePrimitiveArrayType();
+ break;
+
+ case 48 : if (DEBUG) { System.out.println("ArrayType ::= Name Dims"); } //$NON-NLS-1$
+ consumeNameArrayType();
+ break;
+
+ case 49 : if (DEBUG) { System.out.println("ArrayType ::= ArrayTypeWithTypeArgumentsName Dims"); } //$NON-NLS-1$
+ consumeGenericTypeNameArrayType();
+ break;
+
+ case 50 : if (DEBUG) { System.out.println("ArrayType ::= ClassOrInterface TypeArguments Dims"); } //$NON-NLS-1$
+ consumeGenericTypeArrayType();
+ break;
+
+ case 55 : if (DEBUG) { System.out.println("QualifiedName ::= Name DOT SimpleName"); } //$NON-NLS-1$
+ consumeQualifiedName();
+ break;
+
+ case 56 : if (DEBUG) { System.out.println("CompilationUnit ::= EnterCompilationUnit..."); } //$NON-NLS-1$
+ consumeCompilationUnit();
+ break;
+
+ case 57 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration"); } //$NON-NLS-1$
+ consumeInternalCompilationUnit();
+ break;
+
+ case 58 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$
+ consumeInternalCompilationUnit();
+ break;
+
+ case 59 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$
+ consumeInternalCompilationUnitWithTypes();
+ break;
+
+ case 60 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$
+ consumeInternalCompilationUnitWithTypes();
+ break;
+
+ case 61 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$
+ consumeInternalCompilationUnit();
+ break;
+
+ case 62 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= TypeDeclarations"); } //$NON-NLS-1$
+ consumeInternalCompilationUnitWithTypes();
+ break;
+
+ case 63 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$
+ consumeInternalCompilationUnitWithTypes();
+ break;
+
+ case 64 : if (DEBUG) { System.out.println("InternalCompilationUnit ::="); } //$NON-NLS-1$
+ consumeEmptyInternalCompilationUnit();
+ break;
+
+ case 65 : if (DEBUG) { System.out.println("ReduceImports ::="); } //$NON-NLS-1$
+ consumeReduceImports();
+ break;
+
+ case 66 : if (DEBUG) { System.out.println("EnterCompilationUnit ::="); } //$NON-NLS-1$
+ consumeEnterCompilationUnit();
+ break;
+
+ case 77 : if (DEBUG) { System.out.println("CatchHeader ::= catch LPAREN FormalParameter RPAREN..."); } //$NON-NLS-1$
+ consumeCatchHeader();
+ break;
+
+ case 79 : if (DEBUG) { System.out.println("ImportDeclarations ::= ImportDeclarations..."); } //$NON-NLS-1$
+ consumeImportDeclarations();
+ break;
+
+ case 81 : if (DEBUG) { System.out.println("TypeDeclarations ::= TypeDeclarations TypeDeclaration"); } //$NON-NLS-1$
+ consumeTypeDeclarations();
+ break;
+
+ case 82 : if (DEBUG) { System.out.println("PackageDeclaration ::= PackageDeclarationName SEMICOLON"); } //$NON-NLS-1$
+ consumePackageDeclaration();
+ break;
+
+ case 83 : if (DEBUG) { System.out.println("PackageDeclarationName ::= Modifiers package..."); } //$NON-NLS-1$
+ consumePackageDeclarationNameWithModifiers();
+ break;
+
+ case 84 : if (DEBUG) { System.out.println("PackageDeclarationName ::= package Name"); } //$NON-NLS-1$
+ consumePackageDeclarationName();
+ break;
+
+ case 89 : if (DEBUG) { System.out.println("SingleTypeImportDeclaration ::=..."); } //$NON-NLS-1$
+ consumeImportDeclaration();
+ break;
+
+ case 90 : if (DEBUG) { System.out.println("SingleTypeImportDeclarationName ::= import Name"); } //$NON-NLS-1$
+ consumeSingleTypeImportDeclarationName();
+ break;
+
+ case 91 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$
+ consumeImportDeclaration();
+ break;
+
+ case 92 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclarationName ::= import Name DOT..."); } //$NON-NLS-1$
+ consumeTypeImportOnDemandDeclarationName();
+ break;
+
+ case 95 : if (DEBUG) { System.out.println("TypeDeclaration ::= SEMICOLON"); } //$NON-NLS-1$
+ consumeEmptyTypeDeclaration();
+ break;
+
+ case 99 : if (DEBUG) { System.out.println("Modifiers ::= Modifiers Modifier"); } //$NON-NLS-1$
+ consumeModifiers2();
+ break;
+
+ case 112 : if (DEBUG) { System.out.println("ClassDeclaration ::= ClassHeader ClassBody"); } //$NON-NLS-1$
+ consumeClassDeclaration();
+ break;
+
+ case 113 : if (DEBUG) { System.out.println("ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt..."); } //$NON-NLS-1$
+ consumeClassHeader();
+ break;
+
+ case 114 : if (DEBUG) { System.out.println("ClassHeaderName ::= ClassHeaderName1 TypeParameters"); } //$NON-NLS-1$
+ consumeTypeHeaderNameWithTypeParameters();
+ break;
+
+ case 116 : if (DEBUG) { System.out.println("ClassHeaderName1 ::= Modifiersopt class Identifier"); } //$NON-NLS-1$
+ consumeClassHeaderName1();
+ break;
+
+ case 117 : if (DEBUG) { System.out.println("ClassHeaderExtends ::= extends ClassType"); } //$NON-NLS-1$
+ consumeClassHeaderExtends();
+ break;
+
+ case 118 : if (DEBUG) { System.out.println("ClassHeaderImplements ::= implements InterfaceTypeList"); } //$NON-NLS-1$
+ consumeClassHeaderImplements();
+ break;
+
+ case 120 : if (DEBUG) { System.out.println("InterfaceTypeList ::= InterfaceTypeList COMMA..."); } //$NON-NLS-1$
+ consumeInterfaceTypeList();
+ break;
+
+ case 121 : if (DEBUG) { System.out.println("InterfaceType ::= ClassOrInterfaceType"); } //$NON-NLS-1$
+ consumeInterfaceType();
+ break;
+
+ case 124 : if (DEBUG) { System.out.println("ClassBodyDeclarations ::= ClassBodyDeclarations..."); } //$NON-NLS-1$
+ consumeClassBodyDeclarations();
+ break;
+
+ case 128 : if (DEBUG) { System.out.println("ClassBodyDeclaration ::= Diet NestedMethod Block"); } //$NON-NLS-1$
+ consumeClassBodyDeclaration();
+ break;
+
+ case 129 : if (DEBUG) { System.out.println("Diet ::="); } //$NON-NLS-1$
+ consumeDiet();
+ break;
- case 109 : // System.out.println("Initializer ::= Diet NestedMethod Block"); //$NON-NLS-1$
- consumeClassBodyDeclaration();
- break ;
-
- case 116 : // System.out.println("ClassMemberDeclaration ::= SEMICOLON"); //$NON-NLS-1$
- consumeEmptyClassMemberDeclaration();
- break ;
+ case 130 : if (DEBUG) { System.out.println("Initializer ::= Diet NestedMethod Block"); } //$NON-NLS-1$
+ consumeClassBodyDeclaration();
+ break;
+
+ case 136 : if (DEBUG) { System.out.println("ClassMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$
+ consumeEmptyClassMemberDeclaration();
+ break;
- case 117 : // System.out.println("FieldDeclaration ::= Modifiersopt Type VariableDeclarators SEMICOLON"); //$NON-NLS-1$
- consumeFieldDeclaration();
- break ;
-
- case 119 : // System.out.println("VariableDeclarators ::= VariableDeclarators COMMA VariableDeclarator"); //$NON-NLS-1$
- consumeVariableDeclarators();
- break ;
-
- case 122 : // System.out.println("EnterVariable ::="); //$NON-NLS-1$
- consumeEnterVariable();
- break ;
-
- case 123 : // System.out.println("ExitVariableWithInitialization ::="); //$NON-NLS-1$
- consumeExitVariableWithInitialization();
- break ;
-
- case 124 : // System.out.println("ExitVariableWithoutInitialization ::="); //$NON-NLS-1$
- consumeExitVariableWithoutInitialization();
- break ;
-
- case 125 : // System.out.println("ForceNoDiet ::="); //$NON-NLS-1$
- consumeForceNoDiet();
- break ;
-
- case 126 : // System.out.println("RestoreDiet ::="); //$NON-NLS-1$
- consumeRestoreDiet();
- break ;
-
- case 131 : // System.out.println("MethodDeclaration ::= MethodHeader MethodBody"); //$NON-NLS-1$
- // set to true to consume a method with a body
- consumeMethodDeclaration(true);
- break ;
-
- case 132 : // System.out.println("AbstractMethodDeclaration ::= MethodHeader SEMICOLON"); //$NON-NLS-1$
- // set to false to consume a method without body
- consumeMethodDeclaration(false);
- break ;
-
- case 133 : // System.out.println("MethodHeader ::= MethodHeaderName MethodHeaderParameters..."); //$NON-NLS-1$
- consumeMethodHeader();
- break ;
-
- case 134 : // System.out.println("MethodHeaderName ::= Modifiersopt Type Identifier LPAREN"); //$NON-NLS-1$
- consumeMethodHeaderName();
- break ;
-
- case 135 : // System.out.println("MethodHeaderParameters ::= FormalParameterListopt RPAREN"); //$NON-NLS-1$
- consumeMethodHeaderParameters();
- break ;
-
- case 136 : // System.out.println("MethodHeaderExtendedDims ::= Dimsopt"); //$NON-NLS-1$
- consumeMethodHeaderExtendedDims();
- break ;
-
- case 137 : // System.out.println("MethodHeaderThrowsClause ::= throws ClassTypeList"); //$NON-NLS-1$
- consumeMethodHeaderThrowsClause();
- break ;
-
- case 138 : // System.out.println("ConstructorHeader ::= ConstructorHeaderName MethodHeaderParameters"); //$NON-NLS-1$
- consumeConstructorHeader();
- break ;
-
- case 139 : // System.out.println("ConstructorHeaderName ::= Modifiersopt Identifier LPAREN"); //$NON-NLS-1$
- consumeConstructorHeaderName();
- break ;
-
- case 141 : // System.out.println("FormalParameterList ::= FormalParameterList COMMA FormalParameter"); //$NON-NLS-1$
- consumeFormalParameterList();
- break ;
-
- case 142 : // System.out.println("FormalParameter ::= Modifiersopt Type VariableDeclaratorId"); //$NON-NLS-1$
- // the boolean is used to know if the modifiers should be reset
- consumeFormalParameter();
- break ;
-
- case 144 : // System.out.println("ClassTypeList ::= ClassTypeList COMMA ClassTypeElt"); //$NON-NLS-1$
- consumeClassTypeList();
- break ;
-
- case 145 : // System.out.println("ClassTypeElt ::= ClassType"); //$NON-NLS-1$
- consumeClassTypeElt();
- break ;
-
- case 146 : // System.out.println("MethodBody ::= NestedMethod LBRACE BlockStatementsopt RBRACE"); //$NON-NLS-1$
- consumeMethodBody();
- break ;
-
- case 147 : // System.out.println("NestedMethod ::="); //$NON-NLS-1$
- consumeNestedMethod();
- break ;
-
- case 148 : // System.out.println("StaticInitializer ::= StaticOnly Block"); //$NON-NLS-1$
- consumeStaticInitializer();
- break ;
+ case 139 : if (DEBUG) { System.out.println("FieldDeclaration ::= Modifiersopt Type..."); } //$NON-NLS-1$
+ consumeFieldDeclaration();
+ break;
+
+ case 141 : if (DEBUG) { System.out.println("VariableDeclarators ::= VariableDeclarators COMMA..."); } //$NON-NLS-1$
+ consumeVariableDeclarators();
+ break;
+
+ case 144 : if (DEBUG) { System.out.println("EnterVariable ::="); } //$NON-NLS-1$
+ consumeEnterVariable();
+ break;
+
+ case 145 : if (DEBUG) { System.out.println("ExitVariableWithInitialization ::="); } //$NON-NLS-1$
+ consumeExitVariableWithInitialization();
+ break;
+
+ case 146 : if (DEBUG) { System.out.println("ExitVariableWithoutInitialization ::="); } //$NON-NLS-1$
+ consumeExitVariableWithoutInitialization();
+ break;
+
+ case 147 : if (DEBUG) { System.out.println("ForceNoDiet ::="); } //$NON-NLS-1$
+ consumeForceNoDiet();
+ break;
+
+ case 148 : if (DEBUG) { System.out.println("RestoreDiet ::="); } //$NON-NLS-1$
+ consumeRestoreDiet();
+ break;
+
+ case 153 : if (DEBUG) { System.out.println("MethodDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$
+ // set to true to consume a method with a body
+ consumeMethodDeclaration(true);
+ break;
+
+ case 154 : if (DEBUG) { System.out.println("AbstractMethodDeclaration ::= MethodHeader SEMICOLON"); } //$NON-NLS-1$
+ // set to false to consume a method without body
+ consumeMethodDeclaration(false);
+ break;
+
+ case 155 : if (DEBUG) { System.out.println("MethodHeader ::= MethodHeaderName FormalParameterListopt"); } //$NON-NLS-1$
+ consumeMethodHeader();
+ break;
+
+ case 156 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt TypeParameters Type..."); } //$NON-NLS-1$
+ consumeMethodHeaderNameWithTypeParameters();
+ break;
+
+ case 157 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt Type Identifier LPAREN"); } //$NON-NLS-1$
+ consumeMethodHeaderName();
+ break;
+
+ case 158 : if (DEBUG) { System.out.println("MethodHeaderRightParen ::= RPAREN"); } //$NON-NLS-1$
+ consumeMethodHeaderRightParen();
+ break;
+
+ case 159 : if (DEBUG) { System.out.println("MethodHeaderExtendedDims ::= Dimsopt"); } //$NON-NLS-1$
+ consumeMethodHeaderExtendedDims();
+ break;
+
+ case 160 : if (DEBUG) { System.out.println("MethodHeaderThrowsClause ::= throws ClassTypeList"); } //$NON-NLS-1$
+ consumeMethodHeaderThrowsClause();
+ break;
+
+ case 161 : if (DEBUG) { System.out.println("ConstructorHeader ::= ConstructorHeaderName..."); } //$NON-NLS-1$
+ consumeConstructorHeader();
+ break;
+
+ case 162 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt TypeParameters..."); } //$NON-NLS-1$
+ consumeConstructorHeaderNameWithTypeParameters();
+ break;
+
+ case 163 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt Identifier LPAREN"); } //$NON-NLS-1$
+ consumeConstructorHeaderName();
+ break;
+
+ case 165 : if (DEBUG) { System.out.println("FormalParameterList ::= FormalParameterList COMMA..."); } //$NON-NLS-1$
+ consumeFormalParameterList();
+ break;
+
+ case 166 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type..."); } //$NON-NLS-1$
+ consumeFormalParameter(false);
+ break;
+
+ case 167 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type ELLIPSIS..."); } //$NON-NLS-1$
+ consumeFormalParameter(true);
+ break;
+
+ case 169 : if (DEBUG) { System.out.println("ClassTypeList ::= ClassTypeList COMMA ClassTypeElt"); } //$NON-NLS-1$
+ consumeClassTypeList();
+ break;
+
+ case 170 : if (DEBUG) { System.out.println("ClassTypeElt ::= ClassType"); } //$NON-NLS-1$
+ consumeClassTypeElt();
+ break;
+
+ case 171 : if (DEBUG) { System.out.println("MethodBody ::= NestedMethod LBRACE BlockStatementsopt..."); } //$NON-NLS-1$
+ consumeMethodBody();
+ break;
+
+ case 172 : if (DEBUG) { System.out.println("NestedMethod ::="); } //$NON-NLS-1$
+ consumeNestedMethod();
+ break;
+
+ case 173 : if (DEBUG) { System.out.println("StaticInitializer ::= StaticOnly Block"); } //$NON-NLS-1$
+ consumeStaticInitializer();
+ break;
- case 149 : // System.out.println("StaticOnly ::= static"); //$NON-NLS-1$
- consumeStaticOnly();
- break ;
-
- case 150 : // System.out.println("ConstructorDeclaration ::= ConstructorHeader MethodBody"); //$NON-NLS-1$
- consumeConstructorDeclaration() ;
- break ;
-
- case 151 : // System.out.println("ConstructorDeclaration ::= ConstructorHeader SEMICOLON"); //$NON-NLS-1$
- consumeInvalidConstructorDeclaration() ;
- break ;
-
- case 152 : // System.out.println("ExplicitConstructorInvocation ::= this LPAREN ArgumentListopt RPAREN"); //$NON-NLS-1$
- consumeExplicitConstructorInvocation(0,ExplicitConstructorCall.This);
- break ;
-
- case 153 : // System.out.println("ExplicitConstructorInvocation ::= super LPAREN ArgumentListopt..."); //$NON-NLS-1$
- consumeExplicitConstructorInvocation(0,ExplicitConstructorCall.Super);
- break ;
-
- case 154 : // System.out.println("ExplicitConstructorInvocation ::= Primary DOT super LPAREN..."); //$NON-NLS-1$
- consumeExplicitConstructorInvocation(1, ExplicitConstructorCall.Super);
- break ;
-
- case 155 : // System.out.println("ExplicitConstructorInvocation ::= Name DOT super LPAREN..."); //$NON-NLS-1$
- consumeExplicitConstructorInvocation(2, ExplicitConstructorCall.Super);
- break ;
-
- case 156 : // System.out.println("ExplicitConstructorInvocation ::= Primary DOT this LPAREN..."); //$NON-NLS-1$
- consumeExplicitConstructorInvocation(1, ExplicitConstructorCall.This);
- break ;
-
- case 157 : // System.out.println("ExplicitConstructorInvocation ::= Name DOT this LPAREN..."); //$NON-NLS-1$
- consumeExplicitConstructorInvocation(2, ExplicitConstructorCall.This);
- break ;
-
- case 158 : // System.out.println("InterfaceDeclaration ::= InterfaceHeader InterfaceBody"); //$NON-NLS-1$
- consumeInterfaceDeclaration();
- break ;
-
- case 159 : // System.out.println("InterfaceHeader ::= InterfaceHeaderName InterfaceHeaderExtendsopt"); //$NON-NLS-1$
- consumeInterfaceHeader();
- break ;
-
- case 160 : // System.out.println("InterfaceHeaderName ::= Modifiersopt interface Identifier"); //$NON-NLS-1$
- consumeInterfaceHeaderName();
- break ;
-
- case 162 : // System.out.println("InterfaceHeaderExtends ::= extends InterfaceTypeList"); //$NON-NLS-1$
- consumeInterfaceHeaderExtends();
- break ;
-
- case 165 : // System.out.println("InterfaceMemberDeclarations ::= InterfaceMemberDeclarations..."); //$NON-NLS-1$
- consumeInterfaceMemberDeclarations();
- break ;
-
- case 166 : // System.out.println("InterfaceMemberDeclaration ::= SEMICOLON"); //$NON-NLS-1$
- consumeEmptyInterfaceMemberDeclaration();
- break ;
-
- case 169 : // System.out.println("InterfaceMemberDeclaration ::= InvalidMethodDeclaration"); //$NON-NLS-1$
- ignoreMethodBody();
- break ;
-
- case 170 : // System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader MethodBody"); //$NON-NLS-1$
- ignoreInvalidConstructorDeclaration(true);
- break ;
-
- case 171 : // System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader SEMICOLON"); //$NON-NLS-1$
- ignoreInvalidConstructorDeclaration(false);
- break ;
-
- case 177 : // System.out.println("ArrayInitializer ::= LBRACE ,opt RBRACE"); //$NON-NLS-1$
- consumeEmptyArrayInitializer();
- break ;
-
- case 178 : // System.out.println("ArrayInitializer ::= LBRACE VariableInitializers RBRACE"); //$NON-NLS-1$
- consumeArrayInitializer();
- break ;
-
- case 179 : // System.out.println("ArrayInitializer ::= LBRACE VariableInitializers COMMA RBRACE"); //$NON-NLS-1$
- consumeArrayInitializer();
- break ;
-
- case 181 : // System.out.println("VariableInitializers ::= VariableInitializers COMMA..."); //$NON-NLS-1$
- consumeVariableInitializers();
- break ;
-
- case 182 : // System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); //$NON-NLS-1$
- consumeBlock();
- break ;
-
- case 183 : // System.out.println("OpenBlock ::="); //$NON-NLS-1$
- consumeOpenBlock() ;
- break ;
-
- case 185 : // System.out.println("BlockStatements ::= BlockStatements BlockStatement"); //$NON-NLS-1$
- consumeBlockStatements() ;
- break ;
-
- case 189 : // System.out.println("BlockStatement ::= InvalidInterfaceDeclaration"); //$NON-NLS-1$
- ignoreInterfaceDeclaration();
- break ;
-
- case 190 : // System.out.println("LocalVariableDeclarationStatement ::= LocalVariableDeclaration..."); //$NON-NLS-1$
- consumeLocalVariableDeclarationStatement();
- break ;
-
- case 191 : // System.out.println("LocalVariableDeclaration ::= Type PushModifiers VariableDeclarators"); //$NON-NLS-1$
- consumeLocalVariableDeclaration();
- break ;
-
- case 192 : // System.out.println("LocalVariableDeclaration ::= Modifiers Type PushModifiers..."); //$NON-NLS-1$
- consumeLocalVariableDeclaration();
- break ;
-
- case 193 : // System.out.println("PushModifiers ::="); //$NON-NLS-1$
- consumePushModifiers();
- break ;
-
- case 217 : // System.out.println("EmptyStatement ::= SEMICOLON"); //$NON-NLS-1$
- consumeEmptyStatement();
- break ;
-
- case 218 : // System.out.println("LabeledStatement ::= Identifier COLON Statement"); //$NON-NLS-1$
- consumeStatementLabel() ;
- break ;
-
- case 219 : // System.out.println("LabeledStatementNoShortIf ::= Identifier COLON StatementNoShortIf"); //$NON-NLS-1$
- consumeStatementLabel() ;
- break ;
-
- case 220 : // System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); //$NON-NLS-1$
- consumeExpressionStatement();
- break ;
-
- case 229 : // System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN Statement"); //$NON-NLS-1$
- consumeStatementIfNoElse();
- break ;
-
- case 230 : // System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN..."); //$NON-NLS-1$
- consumeStatementIfWithElse();
- break ;
-
- case 231 : // System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression RPAREN..."); //$NON-NLS-1$
- consumeStatementIfWithElse();
- break ;
-
- case 232 : // System.out.println("SwitchStatement ::= switch LPAREN Expression RPAREN OpenBlock..."); //$NON-NLS-1$
- consumeStatementSwitch() ;
- break ;
-
- case 233 : // System.out.println("SwitchBlock ::= LBRACE RBRACE"); //$NON-NLS-1$
- consumeEmptySwitchBlock() ;
- break ;
-
- case 236 : // System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements SwitchLabels RBRACE"); //$NON-NLS-1$
- consumeSwitchBlock() ;
- break ;
-
- case 238 : // System.out.println("SwitchBlockStatements ::= SwitchBlockStatements SwitchBlockStatement"); //$NON-NLS-1$
- consumeSwitchBlockStatements() ;
- break ;
-
- case 239 : // System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); //$NON-NLS-1$
- consumeSwitchBlockStatement() ;
- break ;
-
- case 241 : // System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); //$NON-NLS-1$
- consumeSwitchLabels() ;
- break ;
-
- case 242 : // System.out.println("SwitchLabel ::= case ConstantExpression COLON"); //$NON-NLS-1$
- consumeCaseLabel();
- break ;
-
- case 243 : // System.out.println("SwitchLabel ::= default COLON"); //$NON-NLS-1$
- consumeDefaultLabel();
- break ;
-
- case 244 : // System.out.println("WhileStatement ::= while LPAREN Expression RPAREN Statement"); //$NON-NLS-1$
- consumeStatementWhile() ;
- break ;
-
- case 245 : // System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression RPAREN..."); //$NON-NLS-1$
- consumeStatementWhile() ;
- break ;
-
- case 246 : // System.out.println("DoStatement ::= do Statement while LPAREN Expression RPAREN..."); //$NON-NLS-1$
- consumeStatementDo() ;
- break ;
-
- case 247 : // System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON Expressionopt..."); //$NON-NLS-1$
- consumeStatementFor() ;
- break ;
-
- case 248 : // System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt SEMICOLON..."); //$NON-NLS-1$
- consumeStatementFor() ;
- break ;
-
- case 249 : // System.out.println("ForInit ::= StatementExpressionList"); //$NON-NLS-1$
- consumeForInit() ;
- break ;
-
- case 253 : // System.out.println("StatementExpressionList ::= StatementExpressionList COMMA..."); //$NON-NLS-1$
- consumeStatementExpressionList() ;
- break ;
-
- case 254 : // System.out.println("AssertStatement ::= assert Expression SEMICOLON"); //$NON-NLS-1$
- consumeSimpleAssertStatement() ;
- break ;
-
- case 255 : // System.out.println("AssertStatement ::= assert Expression COLON Expression SEMICOLON"); //$NON-NLS-1$
- consumeAssertStatement() ;
- break ;
-
- case 256 : // System.out.println("BreakStatement ::= break SEMICOLON"); //$NON-NLS-1$
- consumeStatementBreak() ;
- break ;
-
- case 257 : // System.out.println("BreakStatement ::= break Identifier SEMICOLON"); //$NON-NLS-1$
- consumeStatementBreakWithLabel() ;
- break ;
-
- case 258 : // System.out.println("ContinueStatement ::= continue SEMICOLON"); //$NON-NLS-1$
- consumeStatementContinue() ;
- break ;
-
- case 259 : // System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); //$NON-NLS-1$
- consumeStatementContinueWithLabel() ;
- break ;
-
- case 260 : // System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); //$NON-NLS-1$
- consumeStatementReturn() ;
- break ;
-
- case 261 : // System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); //$NON-NLS-1$
- consumeStatementThrow();
-
- break ;
-
- case 262 : // System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN Expression RPAREN"); //$NON-NLS-1$
- consumeStatementSynchronized();
- break ;
-
- case 263 : // System.out.println("OnlySynchronized ::= synchronized"); //$NON-NLS-1$
- consumeOnlySynchronized();
- break ;
-
- case 264 : // System.out.println("TryStatement ::= try TryBlock Catches"); //$NON-NLS-1$
- consumeStatementTry(false);
- break ;
-
- case 265 : // System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); //$NON-NLS-1$
- consumeStatementTry(true);
- break ;
-
- case 267 : // System.out.println("ExitTryBlock ::="); //$NON-NLS-1$
- consumeExitTryBlock();
- break ;
-
- case 269 : // System.out.println("Catches ::= Catches CatchClause"); //$NON-NLS-1$
- consumeCatches();
- break ;
-
- case 270 : // System.out.println("CatchClause ::= catch LPAREN FormalParameter RPAREN Block"); //$NON-NLS-1$
- consumeStatementCatch() ;
- break ;
-
- case 272 : // System.out.println("PushLPAREN ::= LPAREN"); //$NON-NLS-1$
- consumeLeftParen();
- break ;
-
- case 273 : // System.out.println("PushRPAREN ::= RPAREN"); //$NON-NLS-1$
- consumeRightParen();
- break ;
-
- case 278 : // System.out.println("PrimaryNoNewArray ::= this"); //$NON-NLS-1$
- consumePrimaryNoNewArrayThis();
- break ;
-
- case 279 : // System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression PushRPAREN"); //$NON-NLS-1$
- consumePrimaryNoNewArray();
- break ;
-
- case 282 : // System.out.println("PrimaryNoNewArray ::= Name DOT this"); //$NON-NLS-1$
- consumePrimaryNoNewArrayNameThis();
- break ;
-
- case 283 : // System.out.println("PrimaryNoNewArray ::= Name DOT super"); //$NON-NLS-1$
- consumePrimaryNoNewArrayNameSuper();
- break ;
-
- case 284 : // System.out.println("PrimaryNoNewArray ::= Name DOT class"); //$NON-NLS-1$
- consumePrimaryNoNewArrayName();
- break ;
-
- case 285 : // System.out.println("PrimaryNoNewArray ::= ArrayType DOT class"); //$NON-NLS-1$
- consumePrimaryNoNewArrayArrayType();
- break ;
-
- case 286 : // System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); //$NON-NLS-1$
- consumePrimaryNoNewArrayPrimitiveType();
- break ;
-
- case 289 : // System.out.println("AllocationHeader ::= new ClassType LPAREN ArgumentListopt RPAREN"); //$NON-NLS-1$
- consumeAllocationHeader();
- break ;
-
- case 290 : // System.out.println("ClassInstanceCreationExpression ::= new ClassType LPAREN..."); //$NON-NLS-1$
- consumeClassInstanceCreationExpression();
- break ;
-
- case 291 : // System.out.println("ClassInstanceCreationExpression ::= Primary DOT new SimpleName..."); //$NON-NLS-1$
- consumeClassInstanceCreationExpressionQualified() ;
- break ;
-
- case 292 : // System.out.println("ClassInstanceCreationExpression ::=..."); //$NON-NLS-1$
- consumeClassInstanceCreationExpressionQualified() ;
- break ;
-
- case 293 : // System.out.println("ClassInstanceCreationExpressionName ::= Name DOT"); //$NON-NLS-1$
- consumeClassInstanceCreationExpressionName() ;
- break ;
-
- case 294 : // System.out.println("ClassBodyopt ::="); //$NON-NLS-1$
- consumeClassBodyopt();
- break ;
-
- case 296 : // System.out.println("EnterAnonymousClassBody ::="); //$NON-NLS-1$
- consumeEnterAnonymousClassBody();
- break ;
-
- case 298 : // System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); //$NON-NLS-1$
- consumeArgumentList();
- break ;
-
- case 299 : // System.out.println("ArrayCreationHeader ::= new PrimitiveType DimWithOrWithOutExprs"); //$NON-NLS-1$
- consumeArrayCreationHeader();
- break ;
-
- case 300 : // System.out.println("ArrayCreationHeader ::= new ClassOrInterfaceType..."); //$NON-NLS-1$
- consumeArrayCreationHeader();
- break ;
-
- case 301 : // System.out.println("ArrayCreationWithoutArrayInitializer ::= new PrimitiveType..."); //$NON-NLS-1$
- consumeArrayCreationExpressionWithoutInitializer();
- break ;
-
- case 302 : // System.out.println("ArrayCreationWithArrayInitializer ::= new PrimitiveType..."); //$NON-NLS-1$
- consumeArrayCreationExpressionWithInitializer();
- break ;
-
- case 303 : // System.out.println("ArrayCreationWithoutArrayInitializer ::= new ClassOrInterfaceType..."); //$NON-NLS-1$
- consumeArrayCreationExpressionWithoutInitializer();
- break ;
-
- case 304 : // System.out.println("ArrayCreationWithArrayInitializer ::= new ClassOrInterfaceType..."); //$NON-NLS-1$
- consumeArrayCreationExpressionWithInitializer();
- break ;
-
- case 306 : // System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs DimWithOrWithOutExpr"); //$NON-NLS-1$
- consumeDimWithOrWithOutExprs();
- break ;
-
- case 308 : // System.out.println("DimWithOrWithOutExpr ::= LBRACKET RBRACKET"); //$NON-NLS-1$
- consumeDimWithOrWithOutExpr();
- break ;
-
- case 309 : // System.out.println("Dims ::= DimsLoop"); //$NON-NLS-1$
- consumeDims();
- break ;
-
- case 312 : // System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); //$NON-NLS-1$
- consumeOneDimLoop();
- break ;
-
- case 313 : // System.out.println("FieldAccess ::= Primary DOT Identifier"); //$NON-NLS-1$
- consumeFieldAccess(false);
- break ;
-
- case 314 : // System.out.println("FieldAccess ::= super DOT Identifier"); //$NON-NLS-1$
- consumeFieldAccess(true);
- break ;
-
- case 315 : // System.out.println("MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN"); //$NON-NLS-1$
- consumeMethodInvocationName();
- break ;
-
- case 316 : // System.out.println("MethodInvocation ::= Primary DOT Identifier LPAREN ArgumentListopt"); //$NON-NLS-1$
- consumeMethodInvocationPrimary();
- break ;
-
- case 317 : // System.out.println("MethodInvocation ::= super DOT Identifier LPAREN ArgumentListopt..."); //$NON-NLS-1$
- consumeMethodInvocationSuper();
- break ;
-
- case 318 : // System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); //$NON-NLS-1$
- consumeArrayAccess(true);
- break ;
-
- case 319 : // System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression RBRACKET"); //$NON-NLS-1$
- consumeArrayAccess(false);
- break ;
-
- case 320 : // System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer LBRACKET..."); //$NON-NLS-1$
- consumeArrayAccess(false);
- break ;
-
- case 322 : // System.out.println("PostfixExpression ::= Name"); //$NON-NLS-1$
- consumePostfixExpression();
- break ;
-
- case 325 : // System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); //$NON-NLS-1$
- consumeUnaryExpression(OperatorIds.PLUS,true);
- break ;
-
- case 326 : // System.out.println("PostDecrementExpression ::= PostfixExpression MINUS_MINUS"); //$NON-NLS-1$
- consumeUnaryExpression(OperatorIds.MINUS,true);
- break ;
-
- case 327 : // System.out.println("PushPosition ::="); //$NON-NLS-1$
- consumePushPosition();
- break ;
-
- case 330 : // System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); //$NON-NLS-1$
- consumeUnaryExpression(OperatorIds.PLUS);
- break ;
-
- case 331 : // System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); //$NON-NLS-1$
- consumeUnaryExpression(OperatorIds.MINUS);
- break ;
-
- case 333 : // System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition UnaryExpression"); //$NON-NLS-1$
- consumeUnaryExpression(OperatorIds.PLUS,false);
- break ;
-
- case 334 : // System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition UnaryExpression"); //$NON-NLS-1$
- consumeUnaryExpression(OperatorIds.MINUS,false);
- break ;
-
- case 336 : // System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition UnaryExpression"); //$NON-NLS-1$
- consumeUnaryExpression(OperatorIds.TWIDDLE);
- break ;
-
- case 337 : // System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition UnaryExpression"); //$NON-NLS-1$
- consumeUnaryExpression(OperatorIds.NOT);
- break ;
-
- case 339 : // System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN..."); //$NON-NLS-1$
- consumeCastExpression();
- break ;
-
- case 340 : // System.out.println("CastExpression ::= PushLPAREN Name Dims PushRPAREN..."); //$NON-NLS-1$
- consumeCastExpression();
- break ;
-
- case 341 : // System.out.println("CastExpression ::= PushLPAREN Expression PushRPAREN..."); //$NON-NLS-1$
- consumeCastExpressionLL1();
- break ;
-
- case 342 : // System.out.println("InsideCastExpression ::="); //$NON-NLS-1$
- consumeInsideCastExpression();
- break ;
-
- case 343 : // System.out.println("InsideCastExpressionLL1 ::="); //$NON-NLS-1$
- consumeInsideCastExpressionLL1();
- break ;
-
- case 345 : // System.out.println("MultiplicativeExpression ::= MultiplicativeExpression MULTIPLY..."); //$NON-NLS-1$
- consumeBinaryExpression(OperatorIds.MULTIPLY);
- break ;
-
- case 346 : // System.out.println("MultiplicativeExpression ::= MultiplicativeExpression DIVIDE..."); //$NON-NLS-1$
- consumeBinaryExpression(OperatorIds.DIVIDE);
- break ;
-
- case 347 : // System.out.println("MultiplicativeExpression ::= MultiplicativeExpression REMAINDER..."); //$NON-NLS-1$
- consumeBinaryExpression(OperatorIds.REMAINDER);
- break ;
-
- case 349 : // System.out.println("AdditiveExpression ::= AdditiveExpression PLUS..."); //$NON-NLS-1$
- consumeBinaryExpression(OperatorIds.PLUS);
- break ;
-
- case 350 : // System.out.println("AdditiveExpression ::= AdditiveExpression MINUS..."); //$NON-NLS-1$
- consumeBinaryExpression(OperatorIds.MINUS);
- break ;
-
- case 352 : // System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT AdditiveExpression"); //$NON-NLS-1$
- consumeBinaryExpression(OperatorIds.LEFT_SHIFT);
- break ;
-
- case 353 : // System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT AdditiveExpression"); //$NON-NLS-1$
- consumeBinaryExpression(OperatorIds.RIGHT_SHIFT);
- break ;
-
- case 354 : // System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT..."); //$NON-NLS-1$
- consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT);
- break ;
-
- case 356 : // System.out.println("RelationalExpression ::= RelationalExpression LESS ShiftExpression"); //$NON-NLS-1$
- consumeBinaryExpression(OperatorIds.LESS);
- break ;
-
- case 357 : // System.out.println("RelationalExpression ::= RelationalExpression GREATER..."); //$NON-NLS-1$
- consumeBinaryExpression(OperatorIds.GREATER);
- break ;
-
- case 358 : // System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL..."); //$NON-NLS-1$
- consumeBinaryExpression(OperatorIds.LESS_EQUAL);
- break ;
-
- case 359 : // System.out.println("RelationalExpression ::= RelationalExpression GREATER_EQUAL..."); //$NON-NLS-1$
- consumeBinaryExpression(OperatorIds.GREATER_EQUAL);
- break ;
-
- case 360 : // System.out.println("RelationalExpression ::= RelationalExpression instanceof..."); //$NON-NLS-1$
- consumeInstanceOfExpression(OperatorIds.INSTANCEOF);
- break ;
-
- case 362 : // System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL..."); //$NON-NLS-1$
- consumeEqualityExpression(OperatorIds.EQUAL_EQUAL);
- break ;
-
- case 363 : // System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL..."); //$NON-NLS-1$
- consumeEqualityExpression(OperatorIds.NOT_EQUAL);
- break ;
-
- case 365 : // System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); //$NON-NLS-1$
- consumeBinaryExpression(OperatorIds.AND);
- break ;
-
- case 367 : // System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR AndExpression"); //$NON-NLS-1$
- consumeBinaryExpression(OperatorIds.XOR);
- break ;
-
- case 369 : // System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR..."); //$NON-NLS-1$
- consumeBinaryExpression(OperatorIds.OR);
- break ;
-
- case 371 : // System.out.println("ConditionalAndExpression ::= ConditionalAndExpression AND_AND..."); //$NON-NLS-1$
- consumeBinaryExpression(OperatorIds.AND_AND);
- break ;
-
- case 373 : // System.out.println("ConditionalOrExpression ::= ConditionalOrExpression OR_OR..."); //$NON-NLS-1$
- consumeBinaryExpression(OperatorIds.OR_OR);
- break ;
-
- case 375 : // System.out.println("ConditionalExpression ::= ConditionalOrExpression QUESTION..."); //$NON-NLS-1$
- consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ;
- break ;
-
- case 378 : // System.out.println("Assignment ::= PostfixExpression AssignmentOperator..."); //$NON-NLS-1$
- consumeAssignment();
- break ;
-
- case 380 : // System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); //$NON-NLS-1$
- ignoreExpressionAssignment();
- break ;
-
- case 381 : // System.out.println("AssignmentOperator ::= EQUAL"); //$NON-NLS-1$
- consumeAssignmentOperator(EQUAL);
- break ;
-
- case 382 : // System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); //$NON-NLS-1$
- consumeAssignmentOperator(MULTIPLY);
- break ;
-
- case 383 : // System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); //$NON-NLS-1$
- consumeAssignmentOperator(DIVIDE);
- break ;
-
- case 384 : // System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); //$NON-NLS-1$
- consumeAssignmentOperator(REMAINDER);
- break ;
-
- case 385 : // System.out.println("AssignmentOperator ::= PLUS_EQUAL"); //$NON-NLS-1$
- consumeAssignmentOperator(PLUS);
- break ;
-
- case 386 : // System.out.println("AssignmentOperator ::= MINUS_EQUAL"); //$NON-NLS-1$
- consumeAssignmentOperator(MINUS);
- break ;
-
- case 387 : // System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); //$NON-NLS-1$
- consumeAssignmentOperator(LEFT_SHIFT);
- break ;
-
- case 388 : // System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); //$NON-NLS-1$
- consumeAssignmentOperator(RIGHT_SHIFT);
- break ;
-
- case 389 : // System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); //$NON-NLS-1$
- consumeAssignmentOperator(UNSIGNED_RIGHT_SHIFT);
- break ;
-
- case 390 : // System.out.println("AssignmentOperator ::= AND_EQUAL"); //$NON-NLS-1$
- consumeAssignmentOperator(AND);
- break ;
-
- case 391 : // System.out.println("AssignmentOperator ::= XOR_EQUAL"); //$NON-NLS-1$
- consumeAssignmentOperator(XOR);
- break ;
-
- case 392 : // System.out.println("AssignmentOperator ::= OR_EQUAL"); //$NON-NLS-1$
- consumeAssignmentOperator(OR);
- break ;
-
- case 399 : // System.out.println("Expressionopt ::="); //$NON-NLS-1$
- consumeEmptyExpression();
- break ;
-
- case 403 : // System.out.println("ImportDeclarationsopt ::="); //$NON-NLS-1$
- consumeEmptyImportDeclarationsopt();
- break ;
-
- case 404 : // System.out.println("ImportDeclarationsopt ::= ImportDeclarations"); //$NON-NLS-1$
- consumeImportDeclarationsopt();
- break ;
-
- case 405 : // System.out.println("TypeDeclarationsopt ::="); //$NON-NLS-1$
- consumeEmptyTypeDeclarationsopt();
- break ;
-
- case 406 : // System.out.println("TypeDeclarationsopt ::= TypeDeclarations"); //$NON-NLS-1$
- consumeTypeDeclarationsopt();
- break ;
-
- case 407 : // System.out.println("ClassBodyDeclarationsopt ::="); //$NON-NLS-1$
- consumeEmptyClassBodyDeclarationsopt();
- break ;
-
- case 408 : // System.out.println("ClassBodyDeclarationsopt ::= NestedType ClassBodyDeclarations"); //$NON-NLS-1$
- consumeClassBodyDeclarationsopt();
- break ;
-
- case 409 : // System.out.println("Modifiersopt ::="); //$NON-NLS-1$
- consumeDefaultModifiers();
- break ;
-
- case 410 : // System.out.println("Modifiersopt ::= Modifiers"); //$NON-NLS-1$
- consumeModifiers();
- break ;
-
- case 411 : // System.out.println("BlockStatementsopt ::="); //$NON-NLS-1$
- consumeEmptyBlockStatementsopt();
- break ;
-
- case 413 : // System.out.println("Dimsopt ::="); //$NON-NLS-1$
- consumeEmptyDimsopt();
- break ;
-
- case 415 : // System.out.println("ArgumentListopt ::="); //$NON-NLS-1$
- consumeEmptyArgumentListopt();
- break ;
-
- case 419 : // System.out.println("FormalParameterListopt ::="); //$NON-NLS-1$
- consumeFormalParameterListopt();
- break ;
-
- case 423 : // System.out.println("InterfaceMemberDeclarationsopt ::="); //$NON-NLS-1$
- consumeEmptyInterfaceMemberDeclarationsopt();
- break ;
-
- case 424 : // System.out.println("InterfaceMemberDeclarationsopt ::= NestedType..."); //$NON-NLS-1$
- consumeInterfaceMemberDeclarationsopt();
- break ;
-
- case 425 : // System.out.println("NestedType ::="); //$NON-NLS-1$
- consumeNestedType();
- break ;
+ case 174 : if (DEBUG) { System.out.println("StaticOnly ::= static"); } //$NON-NLS-1$
+ consumeStaticOnly();
+ break;
+
+ case 175 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader MethodBody"); } //$NON-NLS-1$
+ consumeConstructorDeclaration() ;
+ break;
+
+ case 176 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader SEMICOLON"); } //$NON-NLS-1$
+ consumeInvalidConstructorDeclaration() ;
+ break;
+
+ case 177 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= this LPAREN..."); } //$NON-NLS-1$
+ consumeExplicitConstructorInvocation(0,ExplicitConstructorCall.This);
+ break;
+
+ case 178 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments this"); } //$NON-NLS-1$
+ consumeExplicitConstructorInvocationWithTypeArguments(0,ExplicitConstructorCall.This);
+ break;
+
+ case 179 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= super LPAREN..."); } //$NON-NLS-1$
+ consumeExplicitConstructorInvocation(0,ExplicitConstructorCall.Super);
+ break;
+
+ case 180 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments..."); } //$NON-NLS-1$
+ consumeExplicitConstructorInvocationWithTypeArguments(0,ExplicitConstructorCall.Super);
+ break;
+
+ case 181 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT super..."); } //$NON-NLS-1$
+ consumeExplicitConstructorInvocation(1, ExplicitConstructorCall.Super);
+ break;
+
+ case 182 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$
+ consumeExplicitConstructorInvocationWithTypeArguments(1, ExplicitConstructorCall.Super);
+ break;
+
+ case 183 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT super LPAREN"); } //$NON-NLS-1$
+ consumeExplicitConstructorInvocation(2, ExplicitConstructorCall.Super);
+ break;
+
+ case 184 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$
+ consumeExplicitConstructorInvocationWithTypeArguments(2, ExplicitConstructorCall.Super);
+ break;
+
+ case 185 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT this..."); } //$NON-NLS-1$
+ consumeExplicitConstructorInvocation(1, ExplicitConstructorCall.This);
+ break;
+
+ case 186 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$
+ consumeExplicitConstructorInvocationWithTypeArguments(1, ExplicitConstructorCall.This);
+ break;
+
+ case 187 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT this LPAREN"); } //$NON-NLS-1$
+ consumeExplicitConstructorInvocation(2, ExplicitConstructorCall.This);
+ break;
+
+ case 188 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$
+ consumeExplicitConstructorInvocationWithTypeArguments(2, ExplicitConstructorCall.This);
+ break;
+
+ case 189 : if (DEBUG) { System.out.println("InterfaceDeclaration ::= InterfaceHeader InterfaceBody"); } //$NON-NLS-1$
+ consumeInterfaceDeclaration();
+ break;
+
+ case 190 : if (DEBUG) { System.out.println("InterfaceHeader ::= InterfaceHeaderName..."); } //$NON-NLS-1$
+ consumeInterfaceHeader();
+ break;
+
+ case 191 : if (DEBUG) { System.out.println("InterfaceHeaderName ::= InterfaceHeaderName1..."); } //$NON-NLS-1$
+ consumeTypeHeaderNameWithTypeParameters();
+ break;
+
+ case 193 : if (DEBUG) { System.out.println("InterfaceHeaderName1 ::= Modifiersopt interface..."); } //$NON-NLS-1$
+ consumeInterfaceHeaderName1();
+ break;
+
+ case 195 : if (DEBUG) { System.out.println("InterfaceHeaderExtends ::= extends InterfaceTypeList"); } //$NON-NLS-1$
+ consumeInterfaceHeaderExtends();
+ break;
+
+ case 198 : if (DEBUG) { System.out.println("InterfaceMemberDeclarations ::=..."); } //$NON-NLS-1$
+ consumeInterfaceMemberDeclarations();
+ break;
+
+ case 199 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$
+ consumeEmptyInterfaceMemberDeclaration();
+ break;
+
+ case 202 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= InvalidMethodDeclaration"); } //$NON-NLS-1$
+ ignoreMethodBody();
+ break;
+
+ case 203 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$
+ ignoreInvalidConstructorDeclaration(true);
+ break;
+
+ case 204 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$
+ ignoreInvalidConstructorDeclaration(false);
+ break;
+
+ case 210 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE ,opt RBRACE"); } //$NON-NLS-1$
+ consumeEmptyArrayInitializer();
+ break;
+
+ case 211 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE VariableInitializers RBRACE"); } //$NON-NLS-1$
+ consumeArrayInitializer();
+ break;
+
+ case 212 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE VariableInitializers COMMA"); } //$NON-NLS-1$
+ consumeArrayInitializer();
+ break;
+
+ case 214 : if (DEBUG) { System.out.println("VariableInitializers ::= VariableInitializers COMMA..."); } //$NON-NLS-1$
+ consumeVariableInitializers();
+ break;
+
+ case 215 : if (DEBUG) { System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); } //$NON-NLS-1$
+ consumeBlock();
+ break;
+
+ case 216 : if (DEBUG) { System.out.println("OpenBlock ::="); } //$NON-NLS-1$
+ consumeOpenBlock() ;
+ break;
+
+ case 218 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatements BlockStatement"); } //$NON-NLS-1$
+ consumeBlockStatements() ;
+ break;
+
+ case 222 : if (DEBUG) { System.out.println("BlockStatement ::= InvalidInterfaceDeclaration"); } //$NON-NLS-1$
+ ignoreInterfaceDeclaration();
+ break;
+
+ case 223 : if (DEBUG) { System.out.println("LocalVariableDeclarationStatement ::=..."); } //$NON-NLS-1$
+ consumeLocalVariableDeclarationStatement();
+ break;
+
+ case 224 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Type PushModifiers..."); } //$NON-NLS-1$
+ consumeLocalVariableDeclaration();
+ break;
+
+ case 225 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Modifiers Type..."); } //$NON-NLS-1$
+ consumeLocalVariableDeclaration();
+ break;
+
+ case 226 : if (DEBUG) { System.out.println("PushModifiers ::="); } //$NON-NLS-1$
+ consumePushModifiers();
+ break;
+
+ case 227 : if (DEBUG) { System.out.println("PushRealModifiers ::="); } //$NON-NLS-1$
+ consumePushRealModifiers();
+ break;
+
+ case 253 : if (DEBUG) { System.out.println("EmptyStatement ::= SEMICOLON"); } //$NON-NLS-1$
+ consumeEmptyStatement();
+ break;
+
+ case 254 : if (DEBUG) { System.out.println("LabeledStatement ::= Identifier COLON Statement"); } //$NON-NLS-1$
+ consumeStatementLabel() ;
+ break;
+
+ case 255 : if (DEBUG) { System.out.println("LabeledStatementNoShortIf ::= Identifier COLON..."); } //$NON-NLS-1$
+ consumeStatementLabel() ;
+ break;
+
+ case 256 : if (DEBUG) { System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); } //$NON-NLS-1$
+ consumeExpressionStatement();
+ break;
+
+ case 265 : if (DEBUG) { System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$
+ consumeStatementIfNoElse();
+ break;
+
+ case 266 : if (DEBUG) { System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$
+ consumeStatementIfWithElse();
+ break;
+
+ case 267 : if (DEBUG) { System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression..."); } //$NON-NLS-1$
+ consumeStatementIfWithElse();
+ break;
+
+ case 268 : if (DEBUG) { System.out.println("SwitchStatement ::= switch LPAREN Expression RPAREN..."); } //$NON-NLS-1$
+ consumeStatementSwitch() ;
+ break;
+
+ case 269 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE RBRACE"); } //$NON-NLS-1$
+ consumeEmptySwitchBlock() ;
+ break;
+
+ case 272 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements..."); } //$NON-NLS-1$
+ consumeSwitchBlock() ;
+ break;
+
+ case 274 : if (DEBUG) { System.out.println("SwitchBlockStatements ::= SwitchBlockStatements..."); } //$NON-NLS-1$
+ consumeSwitchBlockStatements() ;
+ break;
+
+ case 275 : if (DEBUG) { System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); } //$NON-NLS-1$
+ consumeSwitchBlockStatement() ;
+ break;
+
+ case 277 : if (DEBUG) { System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); } //$NON-NLS-1$
+ consumeSwitchLabels() ;
+ break;
+
+ case 278 : if (DEBUG) { System.out.println("SwitchLabel ::= case ConstantExpression COLON"); } //$NON-NLS-1$
+ consumeCaseLabel();
+ break;
+
+ case 279 : if (DEBUG) { System.out.println("SwitchLabel ::= default COLON"); } //$NON-NLS-1$
+ consumeDefaultLabel();
+ break;
+
+ case 280 : if (DEBUG) { System.out.println("WhileStatement ::= while LPAREN Expression RPAREN..."); } //$NON-NLS-1$
+ consumeStatementWhile() ;
+ break;
+
+ case 281 : if (DEBUG) { System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression..."); } //$NON-NLS-1$
+ consumeStatementWhile() ;
+ break;
+
+ case 282 : if (DEBUG) { System.out.println("DoStatement ::= do Statement while LPAREN Expression..."); } //$NON-NLS-1$
+ consumeStatementDo() ;
+ break;
+
+ case 283 : if (DEBUG) { System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON..."); } //$NON-NLS-1$
+ consumeStatementFor() ;
+ break;
+
+ case 284 : if (DEBUG) { System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt..."); } //$NON-NLS-1$
+ consumeStatementFor() ;
+ break;
+
+ case 285 : if (DEBUG) { System.out.println("ForInit ::= StatementExpressionList"); } //$NON-NLS-1$
+ consumeForInit() ;
+ break;
+
+ case 289 : if (DEBUG) { System.out.println("StatementExpressionList ::= StatementExpressionList..."); } //$NON-NLS-1$
+ consumeStatementExpressionList() ;
+ break;
+
+ case 290 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression SEMICOLON"); } //$NON-NLS-1$
+ consumeSimpleAssertStatement() ;
+ break;
+
+ case 291 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression COLON Expression"); } //$NON-NLS-1$
+ consumeAssertStatement() ;
+ break;
+
+ case 292 : if (DEBUG) { System.out.println("BreakStatement ::= break SEMICOLON"); } //$NON-NLS-1$
+ consumeStatementBreak() ;
+ break;
+
+ case 293 : if (DEBUG) { System.out.println("BreakStatement ::= break Identifier SEMICOLON"); } //$NON-NLS-1$
+ consumeStatementBreakWithLabel() ;
+ break;
+
+ case 294 : if (DEBUG) { System.out.println("ContinueStatement ::= continue SEMICOLON"); } //$NON-NLS-1$
+ consumeStatementContinue() ;
+ break;
+
+ case 295 : if (DEBUG) { System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); } //$NON-NLS-1$
+ consumeStatementContinueWithLabel() ;
+ break;
+
+ case 296 : if (DEBUG) { System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); } //$NON-NLS-1$
+ consumeStatementReturn() ;
+ break;
+
+ case 297 : if (DEBUG) { System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); } //$NON-NLS-1$
+ consumeStatementThrow();
+ break;
+
+ case 298 : if (DEBUG) { System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN..."); } //$NON-NLS-1$
+ consumeStatementSynchronized();
+ break;
+
+ case 299 : if (DEBUG) { System.out.println("OnlySynchronized ::= synchronized"); } //$NON-NLS-1$
+ consumeOnlySynchronized();
+ break;
+
+ case 300 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); } //$NON-NLS-1$
+ consumeStatementTry(false);
+ break;
+
+ case 301 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); } //$NON-NLS-1$
+ consumeStatementTry(true);
+ break;
+
+ case 303 : if (DEBUG) { System.out.println("ExitTryBlock ::="); } //$NON-NLS-1$
+ consumeExitTryBlock();
+ break;
+
+ case 305 : if (DEBUG) { System.out.println("Catches ::= Catches CatchClause"); } //$NON-NLS-1$
+ consumeCatches();
+ break;
+
+ case 306 : if (DEBUG) { System.out.println("CatchClause ::= catch LPAREN FormalParameter RPAREN..."); } //$NON-NLS-1$
+ consumeStatementCatch() ;
+ break;
+
+ case 308 : if (DEBUG) { System.out.println("PushLPAREN ::= LPAREN"); } //$NON-NLS-1$
+ consumeLeftParen();
+ break;
+
+ case 309 : if (DEBUG) { System.out.println("PushRPAREN ::= RPAREN"); } //$NON-NLS-1$
+ consumeRightParen();
+ break;
+
+ case 314 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= this"); } //$NON-NLS-1$
+ consumePrimaryNoNewArrayThis();
+ break;
+
+ case 315 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression_NotName..."); } //$NON-NLS-1$
+ consumePrimaryNoNewArray();
+ break;
+
+ case 316 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN"); } //$NON-NLS-1$
+ consumePrimaryNoNewArrayWithName();
+ break;
+
+ case 319 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT this"); } //$NON-NLS-1$
+ consumePrimaryNoNewArrayNameThis();
+ break;
+
+ case 320 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT super"); } //$NON-NLS-1$
+ consumePrimaryNoNewArrayNameSuper();
+ break;
+
+ case 321 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT class"); } //$NON-NLS-1$
+ consumePrimaryNoNewArrayName();
+ break;
+
+ case 322 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name Dims DOT class"); } //$NON-NLS-1$
+ consumePrimaryNoNewArrayArrayType();
+ break;
+
+ case 323 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType Dims DOT class"); } //$NON-NLS-1$
+ consumePrimaryNoNewArrayPrimitiveArrayType();
+ break;
+
+ case 324 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); } //$NON-NLS-1$
+ consumePrimaryNoNewArrayPrimitiveType();
+ break;
+
+ case 327 : if (DEBUG) { System.out.println("AllocationHeader ::= new ClassType LPAREN..."); } //$NON-NLS-1$
+ consumeAllocationHeader();
+ break;
+
+ case 328 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new..."); } //$NON-NLS-1$
+ consumeClassInstanceCreationExpressionWithTypeArguments();
+ break;
+
+ case 329 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new ClassType LPAREN"); } //$NON-NLS-1$
+ consumeClassInstanceCreationExpression();
+ break;
+
+ case 330 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$
+ consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ;
+ break;
+
+ case 331 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$
+ consumeClassInstanceCreationExpressionQualified() ;
+ break;
+
+ case 332 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$
+ consumeClassInstanceCreationExpressionQualified() ;
+ break;
+
+ case 333 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$
+ consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ;
+ break;
+
+ case 334 : if (DEBUG) { System.out.println("ClassInstanceCreationExpressionName ::= Name DOT"); } //$NON-NLS-1$
+ consumeClassInstanceCreationExpressionName() ;
+ break;
+
+ case 335 : if (DEBUG) { System.out.println("ClassBodyopt ::="); } //$NON-NLS-1$
+ consumeClassBodyopt();
+ break;
+
+ case 337 : if (DEBUG) { System.out.println("ClassBodySimpleNameopt ::="); } //$NON-NLS-1$
+ consumeClassBodyopt();
+ break;
+
+ case 339 : if (DEBUG) { System.out.println("EnterAnonymousClassBodySimpleName ::="); } //$NON-NLS-1$
+ consumeEnterAnonymousClassBodySimpleName();
+ break;
+
+ case 340 : if (DEBUG) { System.out.println("EnterAnonymousClassBody ::="); } //$NON-NLS-1$
+ consumeEnterAnonymousClassBody();
+ break;
+
+ case 342 : if (DEBUG) { System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); } //$NON-NLS-1$
+ consumeArgumentList();
+ break;
+
+ case 343 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new PrimitiveType..."); } //$NON-NLS-1$
+ consumeArrayCreationHeader();
+ break;
+
+ case 344 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new ClassOrInterfaceType..."); } //$NON-NLS-1$
+ consumeArrayCreationHeader();
+ break;
+
+ case 345 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$
+ consumeArrayCreationExpressionWithoutInitializer();
+ break;
+
+ case 346 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new PrimitiveType"); } //$NON-NLS-1$
+ consumeArrayCreationExpressionWithInitializer();
+ break;
+
+ case 347 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$
+ consumeArrayCreationExpressionWithoutInitializer();
+ break;
+
+ case 348 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new..."); } //$NON-NLS-1$
+ consumeArrayCreationExpressionWithInitializer();
+ break;
+
+ case 350 : if (DEBUG) { System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs..."); } //$NON-NLS-1$
+ consumeDimWithOrWithOutExprs();
+ break;
+
+ case 352 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= LBRACKET RBRACKET"); } //$NON-NLS-1$
+ consumeDimWithOrWithOutExpr();
+ break;
+
+ case 353 : if (DEBUG) { System.out.println("Dims ::= DimsLoop"); } //$NON-NLS-1$
+ consumeDims();
+ break;
+
+ case 356 : if (DEBUG) { System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); } //$NON-NLS-1$
+ consumeOneDimLoop();
+ break;
+
+ case 357 : if (DEBUG) { System.out.println("FieldAccess ::= Primary DOT Identifier"); } //$NON-NLS-1$
+ consumeFieldAccess(false);
+ break;
+
+ case 358 : if (DEBUG) { System.out.println("FieldAccess ::= super DOT Identifier"); } //$NON-NLS-1$
+ consumeFieldAccess(true);
+ break;
+
+ case 359 : if (DEBUG) { System.out.println("MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$
+ consumeMethodInvocationName();
+ break;
+
+ case 360 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT OnlyTypeArguments..."); } //$NON-NLS-1$
+ consumeMethodInvocationNameWithTypeArguments();
+ break;
+
+ case 361 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT OnlyTypeArguments..."); } //$NON-NLS-1$
+ consumeMethodInvocationPrimaryWithTypeArguments();
+ break;
+
+ case 362 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT Identifier LPAREN..."); } //$NON-NLS-1$
+ consumeMethodInvocationPrimary();
+ break;
+
+ case 363 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT OnlyTypeArguments..."); } //$NON-NLS-1$
+ consumeMethodInvocationSuperWithTypeArguments();
+ break;
+
+ case 364 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT Identifier LPAREN..."); } //$NON-NLS-1$
+ consumeMethodInvocationSuper();
+ break;
+
+ case 365 : if (DEBUG) { System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); } //$NON-NLS-1$
+ consumeArrayAccess(true);
+ break;
+
+ case 366 : if (DEBUG) { System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression..."); } //$NON-NLS-1$
+ consumeArrayAccess(false);
+ break;
+
+ case 367 : if (DEBUG) { System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer..."); } //$NON-NLS-1$
+ consumeArrayAccess(false);
+ break;
+
+ case 369 : if (DEBUG) { System.out.println("PostfixExpression ::= Name"); } //$NON-NLS-1$
+ consumePostfixExpression();
+ break;
+
+ case 372 : if (DEBUG) { System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); } //$NON-NLS-1$
+ consumeUnaryExpression(OperatorIds.PLUS,true);
+ break;
+
+ case 373 : if (DEBUG) { System.out.println("PostDecrementExpression ::= PostfixExpression..."); } //$NON-NLS-1$
+ consumeUnaryExpression(OperatorIds.MINUS,true);
+ break;
+
+ case 374 : if (DEBUG) { System.out.println("PushPosition ::="); } //$NON-NLS-1$
+ consumePushPosition();
+ break;
+
+ case 377 : if (DEBUG) { System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); } //$NON-NLS-1$
+ consumeUnaryExpression(OperatorIds.PLUS);
+ break;
+
+ case 378 : if (DEBUG) { System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); } //$NON-NLS-1$
+ consumeUnaryExpression(OperatorIds.MINUS);
+ break;
+
+ case 380 : if (DEBUG) { System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition..."); } //$NON-NLS-1$
+ consumeUnaryExpression(OperatorIds.PLUS,false);
+ break;
+
+ case 381 : if (DEBUG) { System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition..."); } //$NON-NLS-1$
+ consumeUnaryExpression(OperatorIds.MINUS,false);
+ break;
+
+ case 383 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition..."); } //$NON-NLS-1$
+ consumeUnaryExpression(OperatorIds.TWIDDLE);
+ break;
+
+ case 384 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition..."); } //$NON-NLS-1$
+ consumeUnaryExpression(OperatorIds.NOT);
+ break;
+
+ case 386 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt..."); } //$NON-NLS-1$
+ consumeCastExpressionWithPrimitiveType();
+ break;
+
+ case 387 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$
+ consumeCastExpressionWithGenericsArray();
+ break;
+
+ case 388 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$
+ consumeCastExpressionWithQualifiedGenericsArray();
+ break;
+
+ case 389 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name PushRPAREN..."); } //$NON-NLS-1$
+ consumeCastExpressionLL1();
+ break;
+
+ case 390 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name Dims PushRPAREN..."); } //$NON-NLS-1$
+ consumeCastExpressionWithNameArray();
+ break;
+
+ case 391 : if (DEBUG) { System.out.println("OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments"); } //$NON-NLS-1$
+ consumeOnlyTypeArgumentsForCastExpression();
+ break;
+
+ case 392 : if (DEBUG) { System.out.println("InsideCastExpression ::="); } //$NON-NLS-1$
+ consumeInsideCastExpression();
+ break;
+
+ case 393 : if (DEBUG) { System.out.println("InsideCastExpressionLL1 ::="); } //$NON-NLS-1$
+ consumeInsideCastExpressionLL1();
+ break;
+
+ case 394 : if (DEBUG) { System.out.println("InsideCastExpressionWithQualifiedGenerics ::="); } //$NON-NLS-1$
+ consumeInsideCastExpressionWithQualifiedGenerics();
+ break;
+
+ case 396 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.MULTIPLY);
+ break;
+
+ case 397 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.DIVIDE);
+ break;
+
+ case 398 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.REMAINDER);
+ break;
+
+ case 400 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression PLUS..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.PLUS);
+ break;
+
+ case 401 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression MINUS..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.MINUS);
+ break;
+
+ case 403 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.LEFT_SHIFT);
+ break;
+
+ case 404 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.RIGHT_SHIFT);
+ break;
+
+ case 405 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT);
+ break;
+
+ case 407 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.LESS);
+ break;
+
+ case 408 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression GREATER..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.GREATER);
+ break;
+
+ case 409 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL"); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.LESS_EQUAL);
+ break;
+
+ case 410 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.GREATER_EQUAL);
+ break;
+
+ case 412 : if (DEBUG) { System.out.println("InstanceofExpression ::= InstanceofExpression instanceof"); } //$NON-NLS-1$
+ consumeInstanceOfExpression(OperatorIds.INSTANCEOF);
+ break;
+
+ case 414 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL..."); } //$NON-NLS-1$
+ consumeEqualityExpression(OperatorIds.EQUAL_EQUAL);
+ break;
+
+ case 415 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL..."); } //$NON-NLS-1$
+ consumeEqualityExpression(OperatorIds.NOT_EQUAL);
+ break;
+
+ case 417 : if (DEBUG) { System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.AND);
+ break;
+
+ case 419 : if (DEBUG) { System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.XOR);
+ break;
+
+ case 421 : if (DEBUG) { System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.OR);
+ break;
+
+ case 423 : if (DEBUG) { System.out.println("ConditionalAndExpression ::= ConditionalAndExpression..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.AND_AND);
+ break;
+
+ case 425 : if (DEBUG) { System.out.println("ConditionalOrExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.OR_OR);
+ break;
+
+ case 427 : if (DEBUG) { System.out.println("ConditionalExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$
+ consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ;
+ break;
+
+ case 430 : if (DEBUG) { System.out.println("Assignment ::= PostfixExpression AssignmentOperator..."); } //$NON-NLS-1$
+ consumeAssignment();
+ break;
+
+ case 432 : if (DEBUG) { System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); } //$NON-NLS-1$
+ ignoreExpressionAssignment();
+ break;
+
+ case 433 : if (DEBUG) { System.out.println("AssignmentOperator ::= EQUAL"); } //$NON-NLS-1$
+ consumeAssignmentOperator(EQUAL);
+ break;
+
+ case 434 : if (DEBUG) { System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); } //$NON-NLS-1$
+ consumeAssignmentOperator(MULTIPLY);
+ break;
+
+ case 435 : if (DEBUG) { System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); } //$NON-NLS-1$
+ consumeAssignmentOperator(DIVIDE);
+ break;
+
+ case 436 : if (DEBUG) { System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); } //$NON-NLS-1$
+ consumeAssignmentOperator(REMAINDER);
+ break;
+
+ case 437 : if (DEBUG) { System.out.println("AssignmentOperator ::= PLUS_EQUAL"); } //$NON-NLS-1$
+ consumeAssignmentOperator(PLUS);
+ break;
+
+ case 438 : if (DEBUG) { System.out.println("AssignmentOperator ::= MINUS_EQUAL"); } //$NON-NLS-1$
+ consumeAssignmentOperator(MINUS);
+ break;
+
+ case 439 : if (DEBUG) { System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); } //$NON-NLS-1$
+ consumeAssignmentOperator(LEFT_SHIFT);
+ break;
+
+ case 440 : if (DEBUG) { System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$
+ consumeAssignmentOperator(RIGHT_SHIFT);
+ break;
+
+ case 441 : if (DEBUG) { System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$
+ consumeAssignmentOperator(UNSIGNED_RIGHT_SHIFT);
+ break;
+
+ case 442 : if (DEBUG) { System.out.println("AssignmentOperator ::= AND_EQUAL"); } //$NON-NLS-1$
+ consumeAssignmentOperator(AND);
+ break;
+
+ case 443 : if (DEBUG) { System.out.println("AssignmentOperator ::= XOR_EQUAL"); } //$NON-NLS-1$
+ consumeAssignmentOperator(XOR);
+ break;
+
+ case 444 : if (DEBUG) { System.out.println("AssignmentOperator ::= OR_EQUAL"); } //$NON-NLS-1$
+ consumeAssignmentOperator(OR);
+ break;
+
+ case 448 : if (DEBUG) { System.out.println("Expressionopt ::="); } //$NON-NLS-1$
+ consumeEmptyExpression();
+ break;
+
+ case 453 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::="); } //$NON-NLS-1$
+ consumeEmptyClassBodyDeclarationsopt();
+ break;
+
+ case 454 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$
+ consumeClassBodyDeclarationsopt();
+ break;
+
+ case 455 : if (DEBUG) { System.out.println("Modifiersopt ::="); } //$NON-NLS-1$
+ consumeDefaultModifiers();
+ break;
+
+ case 456 : if (DEBUG) { System.out.println("Modifiersopt ::= Modifiers"); } //$NON-NLS-1$
+ consumeModifiers();
+ break;
+
+ case 457 : if (DEBUG) { System.out.println("BlockStatementsopt ::="); } //$NON-NLS-1$
+ consumeEmptyBlockStatementsopt();
+ break;
+
+ case 459 : if (DEBUG) { System.out.println("Dimsopt ::="); } //$NON-NLS-1$
+ consumeEmptyDimsopt();
+ break;
+
+ case 461 : if (DEBUG) { System.out.println("ArgumentListopt ::="); } //$NON-NLS-1$
+ consumeEmptyArgumentListopt();
+ break;
+
+ case 465 : if (DEBUG) { System.out.println("FormalParameterListopt ::="); } //$NON-NLS-1$
+ consumeFormalParameterListopt();
+ break;
+
+ case 469 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::="); } //$NON-NLS-1$
+ consumeEmptyInterfaceMemberDeclarationsopt();
+ break;
+
+ case 470 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$
+ consumeInterfaceMemberDeclarationsopt();
+ break;
+
+ case 471 : if (DEBUG) { System.out.println("NestedType ::="); } //$NON-NLS-1$
+ consumeNestedType();
+ break;
- case 426 : // System.out.println("ForInitopt ::="); //$NON-NLS-1$
- consumeEmptyForInitopt();
- break ;
-
- case 428 : // System.out.println("ForUpdateopt ::="); //$NON-NLS-1$
- consumeEmptyForUpdateopt();
- break ;
-
- case 432 : // System.out.println("Catchesopt ::="); //$NON-NLS-1$
- consumeEmptyCatchesopt();
- break ;
-
+ case 472 : if (DEBUG) { System.out.println("ForInitopt ::="); } //$NON-NLS-1$
+ consumeEmptyForInitopt();
+ break;
+
+ case 474 : if (DEBUG) { System.out.println("ForUpdateopt ::="); } //$NON-NLS-1$
+ consumeEmptyForUpdateopt();
+ break;
+
+ case 478 : if (DEBUG) { System.out.println("Catchesopt ::="); } //$NON-NLS-1$
+ consumeEmptyCatchesopt();
+ break;
+
+ case 480 : if (DEBUG) { System.out.println("EnumDeclaration ::= EnumHeader ClassHeaderImplementsopt"); } //$NON-NLS-1$
+ consumeEnumDeclaration();
+ break;
+
+ case 481 : if (DEBUG) { System.out.println("EnumHeader ::= Modifiersopt enum Identifier"); } //$NON-NLS-1$
+ consumeEnumHeader();
+ break;
+
+ case 482 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumBodyDeclarationsopt RBRACE"); } //$NON-NLS-1$
+ consumeEnumBodyNoConstants();
+ break;
+
+ case 483 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE COMMA EnumBodyDeclarationsopt..."); } //$NON-NLS-1$
+ consumeEnumBodyNoConstants();
+ break;
+
+ case 484 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants COMMA..."); } //$NON-NLS-1$
+ consumeEnumBodyWithConstants();
+ break;
+
+ case 485 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants..."); } //$NON-NLS-1$
+ consumeEnumBodyWithConstants();
+ break;
+
+ case 487 : if (DEBUG) { System.out.println("EnumConstants ::= EnumConstants COMMA EnumConstant"); } //$NON-NLS-1$
+ consumeEnumConstants();
+ break;
+
+ case 488 : if (DEBUG) { System.out.println("EnumConstantHeader ::= Identifier Argumentsopt"); } //$NON-NLS-1$
+ consumeEnumConstantHeader();
+ break;
+
+ case 489 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader ClassBody"); } //$NON-NLS-1$
+ consumeEnumConstantWithClassBody();
+ break;
+
+ case 490 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader"); } //$NON-NLS-1$
+ consumeEnumConstantNoClassBody();
+ break;
+
+ case 491 : if (DEBUG) { System.out.println("Arguments ::= LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$
+ consumeArguments();
+ break;
+
+ case 492 : if (DEBUG) { System.out.println("Argumentsopt ::="); } //$NON-NLS-1$
+ consumeEmptyArguments();
+ break;
+
+ case 495 : if (DEBUG) { System.out.println("EnumBodyDeclarationsopt ::="); } //$NON-NLS-1$
+ consumeEmptyEnumDeclarations();
+ break;
+
+ case 497 : if (DEBUG) { System.out.println("EnhancedForStatement ::= EnhancedForStatementHeader..."); } //$NON-NLS-1$
+ consumeEnhancedForStatement();
+ break;
+
+ case 498 : if (DEBUG) { System.out.println("EnhancedForStatementNoShortIf ::=..."); } //$NON-NLS-1$
+ consumeEnhancedForStatement();
+ break;
+
+ case 499 : if (DEBUG) { System.out.println("EnhancedForStatementHeader ::= for LPAREN Type..."); } //$NON-NLS-1$
+ consumeEnhancedForStatementHeader(false);
+ break;
+
+ case 500 : if (DEBUG) { System.out.println("EnhancedForStatementHeader ::= for LPAREN Modifiers Type"); } //$NON-NLS-1$
+ consumeEnhancedForStatementHeader(true);
+ break;
+
+ case 501 : if (DEBUG) { System.out.println("SingleStaticImportDeclaration ::=..."); } //$NON-NLS-1$
+ consumeImportDeclaration();
+ break;
+
+ case 502 : if (DEBUG) { System.out.println("SingleStaticImportDeclarationName ::= import static Name"); } //$NON-NLS-1$
+ consumeSingleStaticImportDeclarationName();
+ break;
+
+ case 503 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$
+ consumeImportDeclaration();
+ break;
+
+ case 504 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclarationName ::= import static..."); } //$NON-NLS-1$
+ consumeStaticImportOnDemandDeclarationName();
+ break;
+
+ case 505 : if (DEBUG) { System.out.println("TypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$
+ consumeTypeArguments();
+ break;
+
+ case 506 : if (DEBUG) { System.out.println("OnlyTypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$
+ consumeOnlyTypeArguments();
+ break;
+
+ case 508 : if (DEBUG) { System.out.println("TypeArgumentList1 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$
+ consumeTypeArgumentList1();
+ break;
+
+ case 510 : if (DEBUG) { System.out.println("TypeArgumentList ::= TypeArgumentList COMMA TypeArgument"); } //$NON-NLS-1$
+ consumeTypeArgumentList();
+ break;
+
+ case 511 : if (DEBUG) { System.out.println("TypeArgument ::= ReferenceType"); } //$NON-NLS-1$
+ consumeTypeArgument();
+ break;
+
+ case 515 : if (DEBUG) { System.out.println("ReferenceType1 ::= ReferenceType GREATER"); } //$NON-NLS-1$
+ consumeReferenceType1();
+ break;
+
+ case 516 : if (DEBUG) { System.out.println("ReferenceType1 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$
+ consumeTypeArgumentReferenceType1();
+ break;
+
+ case 518 : if (DEBUG) { System.out.println("TypeArgumentList2 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$
+ consumeTypeArgumentList2();
+ break;
+
+ case 521 : if (DEBUG) { System.out.println("ReferenceType2 ::= ReferenceType RIGHT_SHIFT"); } //$NON-NLS-1$
+ consumeReferenceType2();
+ break;
+
+ case 522 : if (DEBUG) { System.out.println("ReferenceType2 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$
+ consumeTypeArgumentReferenceType2();
+ break;
+
+ case 524 : if (DEBUG) { System.out.println("TypeArgumentList3 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$
+ consumeTypeArgumentList3();
+ break;
+
+ case 527 : if (DEBUG) { System.out.println("ReferenceType3 ::= ReferenceType UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$
+ consumeReferenceType3();
+ break;
+
+ case 528 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION"); } //$NON-NLS-1$
+ consumeWildcard();
+ break;
+
+ case 529 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION WildcardBounds"); } //$NON-NLS-1$
+ consumeWildcardWithBounds();
+ break;
+
+ case 530 : if (DEBUG) { System.out.println("WildcardBounds ::= extends ReferenceType"); } //$NON-NLS-1$
+ consumeWildcardBoundsExtends();
+ break;
+
+ case 531 : if (DEBUG) { System.out.println("WildcardBounds ::= super ReferenceType"); } //$NON-NLS-1$
+ consumeWildcardBoundsSuper();
+ break;
+
+ case 532 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION GREATER"); } //$NON-NLS-1$
+ consumeWildcard1();
+ break;
+
+ case 533 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION WildcardBounds1"); } //$NON-NLS-1$
+ consumeWildcard1WithBounds();
+ break;
+
+ case 534 : if (DEBUG) { System.out.println("WildcardBounds1 ::= extends ReferenceType1"); } //$NON-NLS-1$
+ consumeWildcardBounds1Extends();
+ break;
+
+ case 535 : if (DEBUG) { System.out.println("WildcardBounds1 ::= super ReferenceType1"); } //$NON-NLS-1$
+ consumeWildcardBounds1Super();
+ break;
+
+ case 536 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION RIGHT_SHIFT"); } //$NON-NLS-1$
+ consumeWildcard2();
+ break;
+
+ case 537 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION WildcardBounds2"); } //$NON-NLS-1$
+ consumeWildcard2WithBounds();
+ break;
+
+ case 538 : if (DEBUG) { System.out.println("WildcardBounds2 ::= extends ReferenceType2"); } //$NON-NLS-1$
+ consumeWildcardBounds2Extends();
+ break;
+
+ case 539 : if (DEBUG) { System.out.println("WildcardBounds2 ::= super ReferenceType2"); } //$NON-NLS-1$
+ consumeWildcardBounds2Super();
+ break;
+
+ case 540 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$
+ consumeWildcard3();
+ break;
+
+ case 541 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION WildcardBounds3"); } //$NON-NLS-1$
+ consumeWildcard3WithBounds();
+ break;
+
+ case 542 : if (DEBUG) { System.out.println("WildcardBounds3 ::= extends ReferenceType3"); } //$NON-NLS-1$
+ consumeWildcardBounds3Extends();
+ break;
+
+ case 543 : if (DEBUG) { System.out.println("WildcardBounds3 ::= super ReferenceType3"); } //$NON-NLS-1$
+ consumeWildcardBounds3Super();
+ break;
+
+ case 544 : if (DEBUG) { System.out.println("TypeParameterHeader ::= Identifier"); } //$NON-NLS-1$
+ consumeTypeParameterHeader();
+ break;
+
+ case 545 : if (DEBUG) { System.out.println("TypeParameters ::= LESS TypeParameterList1"); } //$NON-NLS-1$
+ consumeTypeParameters();
+ break;
+
+ case 547 : if (DEBUG) { System.out.println("TypeParameterList ::= TypeParameterList COMMA..."); } //$NON-NLS-1$
+ consumeTypeParameterList();
+ break;
+
+ case 549 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
+ consumeTypeParameterWithExtends();
+ break;
+
+ case 550 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
+ consumeTypeParameterWithExtendsAndBounds();
+ break;
+
+ case 552 : if (DEBUG) { System.out.println("AdditionalBoundList ::= AdditionalBoundList..."); } //$NON-NLS-1$
+ consumeAdditionalBoundList();
+ break;
+
+ case 553 : if (DEBUG) { System.out.println("AdditionalBound ::= AND ReferenceType"); } //$NON-NLS-1$
+ consumeAdditionalBound();
+ break;
+
+ case 555 : if (DEBUG) { System.out.println("TypeParameterList1 ::= TypeParameterList COMMA..."); } //$NON-NLS-1$
+ consumeTypeParameterList1();
+ break;
+
+ case 556 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader GREATER"); } //$NON-NLS-1$
+ consumeTypeParameter1();
+ break;
+
+ case 557 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
+ consumeTypeParameter1WithExtends();
+ break;
+
+ case 558 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
+ consumeTypeParameter1WithExtendsAndBounds();
+ break;
+
+ case 560 : if (DEBUG) { System.out.println("AdditionalBoundList1 ::= AdditionalBoundList..."); } //$NON-NLS-1$
+ consumeAdditionalBoundList1();
+ break;
+
+ case 561 : if (DEBUG) { System.out.println("AdditionalBound1 ::= AND ReferenceType1"); } //$NON-NLS-1$
+ consumeAdditionalBound1();
+ break;
+
+ case 567 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= PLUS PushPosition..."); } //$NON-NLS-1$
+ consumeUnaryExpression(OperatorIds.PLUS);
+ break;
+
+ case 568 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= MINUS PushPosition..."); } //$NON-NLS-1$
+ consumeUnaryExpression(OperatorIds.MINUS);
+ break;
+
+ case 571 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= TWIDDLE..."); } //$NON-NLS-1$
+ consumeUnaryExpression(OperatorIds.TWIDDLE);
+ break;
+
+ case 572 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= NOT PushPosition"); } //$NON-NLS-1$
+ consumeUnaryExpression(OperatorIds.NOT);
+ break;
+
+ case 575 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.MULTIPLY);
+ break;
+
+ case 576 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name MULTIPLY..."); } //$NON-NLS-1$
+ consumeBinaryExpressionWithName(OperatorIds.MULTIPLY);
+ break;
+
+ case 577 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.DIVIDE);
+ break;
+
+ case 578 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name DIVIDE..."); } //$NON-NLS-1$
+ consumeBinaryExpressionWithName(OperatorIds.DIVIDE);
+ break;
+
+ case 579 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.REMAINDER);
+ break;
+
+ case 580 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name REMAINDER..."); } //$NON-NLS-1$
+ consumeBinaryExpressionWithName(OperatorIds.REMAINDER);
+ break;
+
+ case 582 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.PLUS);
+ break;
+
+ case 583 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name PLUS..."); } //$NON-NLS-1$
+ consumeBinaryExpressionWithName(OperatorIds.PLUS);
+ break;
+
+ case 584 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.MINUS);
+ break;
+
+ case 585 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name MINUS..."); } //$NON-NLS-1$
+ consumeBinaryExpressionWithName(OperatorIds.MINUS);
+ break;
+
+ case 587 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.LEFT_SHIFT);
+ break;
+
+ case 588 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name LEFT_SHIFT..."); } //$NON-NLS-1$
+ consumeBinaryExpressionWithName(OperatorIds.LEFT_SHIFT);
+ break;
+
+ case 589 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.RIGHT_SHIFT);
+ break;
+
+ case 590 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name RIGHT_SHIFT..."); } //$NON-NLS-1$
+ consumeBinaryExpressionWithName(OperatorIds.RIGHT_SHIFT);
+ break;
+
+ case 591 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT);
+ break;
+
+ case 592 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name UNSIGNED_RIGHT_SHIFT..."); } //$NON-NLS-1$
+ consumeBinaryExpressionWithName(OperatorIds.UNSIGNED_RIGHT_SHIFT);
+ break;
+
+ case 594 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.LESS);
+ break;
+
+ case 595 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS..."); } //$NON-NLS-1$
+ consumeBinaryExpressionWithName(OperatorIds.LESS);
+ break;
+
+ case 596 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.GREATER);
+ break;
+
+ case 597 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER..."); } //$NON-NLS-1$
+ consumeBinaryExpressionWithName(OperatorIds.GREATER);
+ break;
+
+ case 598 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.LESS_EQUAL);
+ break;
+
+ case 599 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS_EQUAL..."); } //$NON-NLS-1$
+ consumeBinaryExpressionWithName(OperatorIds.LESS_EQUAL);
+ break;
+
+ case 600 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.GREATER_EQUAL);
+ break;
+
+ case 601 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER_EQUAL..."); } //$NON-NLS-1$
+ consumeBinaryExpressionWithName(OperatorIds.GREATER_EQUAL);
+ break;
+
+ case 603 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::= Name instanceof..."); } //$NON-NLS-1$
+ consumeInstanceOfExpressionWithName(OperatorIds.INSTANCEOF);
+ break;
+
+ case 604 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::=..."); } //$NON-NLS-1$
+ consumeInstanceOfExpression(OperatorIds.INSTANCEOF);
+ break;
+
+ case 606 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$
+ consumeEqualityExpression(OperatorIds.EQUAL_EQUAL);
+ break;
+
+ case 607 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name EQUAL_EQUAL..."); } //$NON-NLS-1$
+ consumeEqualityExpressionWithName(OperatorIds.EQUAL_EQUAL);
+ break;
+
+ case 608 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$
+ consumeEqualityExpression(OperatorIds.NOT_EQUAL);
+ break;
+
+ case 609 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name NOT_EQUAL..."); } //$NON-NLS-1$
+ consumeEqualityExpressionWithName(OperatorIds.NOT_EQUAL);
+ break;
+
+ case 611 : if (DEBUG) { System.out.println("AndExpression_NotName ::= AndExpression_NotName AND..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.AND);
+ break;
+
+ case 612 : if (DEBUG) { System.out.println("AndExpression_NotName ::= Name AND EqualityExpression"); } //$NON-NLS-1$
+ consumeBinaryExpressionWithName(OperatorIds.AND);
+ break;
+
+ case 614 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.XOR);
+ break;
+
+ case 615 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::= Name XOR AndExpression"); } //$NON-NLS-1$
+ consumeBinaryExpressionWithName(OperatorIds.XOR);
+ break;
+
+ case 617 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.OR);
+ break;
+
+ case 618 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::= Name OR..."); } //$NON-NLS-1$
+ consumeBinaryExpressionWithName(OperatorIds.OR);
+ break;
+
+ case 620 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::=..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.AND_AND);
+ break;
+
+ case 621 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::= Name AND_AND..."); } //$NON-NLS-1$
+ consumeBinaryExpressionWithName(OperatorIds.AND_AND);
+ break;
+
+ case 623 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::=..."); } //$NON-NLS-1$
+ consumeBinaryExpression(OperatorIds.OR_OR);
+ break;
+
+ case 624 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::= Name OR_OR..."); } //$NON-NLS-1$
+ consumeBinaryExpressionWithName(OperatorIds.OR_OR);
+ break;
+
+ case 626 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::=..."); } //$NON-NLS-1$
+ consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ;
+ break;
+
+ case 627 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::= Name QUESTION..."); } //$NON-NLS-1$
+ consumeConditionalExpressionWithName(OperatorIds.QUESTIONCOLON) ;
+ break;
+
+ case 631 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeader ::= Modifiers AT..."); } //$NON-NLS-1$
+ consumeAnnotationTypeDeclarationHeader() ;
+ break;
+
+ case 632 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeader ::= AT PushModifiers..."); } //$NON-NLS-1$
+ consumeAnnotationTypeDeclarationHeader() ;
+ break;
+
+ case 633 : if (DEBUG) { System.out.println("AnnotationTypeDeclaration ::=..."); } //$NON-NLS-1$
+ consumeAnnotationTypeDeclaration() ;
+ break;
+
+ case 635 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::="); } //$NON-NLS-1$
+ consumeEmptyAnnotationTypeMemberDeclarationsopt() ;
+ break;
+
+ case 638 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarations ::=..."); } //$NON-NLS-1$
+ consumeAnnotationTypeMemberDeclarations() ;
+ break;
+
+ case 639 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationHeader ::= Modifiersopt"); } //$NON-NLS-1$
+ consumeAnnotationTypeMemberDeclarationHeader() ;
+ break;
+
+ case 640 : if (DEBUG) { System.out.println("AnnotationTypeMemberHeaderExtendedDims ::= Dimsopt"); } //$NON-NLS-1$
+ consumeAnnotationTypeMemberHeaderExtendedDims() ;
+ break;
+
+ case 641 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclaration ::=..."); } //$NON-NLS-1$
+ consumeAnnotationTypeMemberDeclaration() ;
+ break;
+
+ case 644 : if (DEBUG) { System.out.println("DefaultValueopt ::="); } //$NON-NLS-1$
+ consumeEmptyDefaultValue() ;
+ break;
+
+ case 650 : if (DEBUG) { System.out.println("NormalAnnotation ::= AT Name LPAREN MemberValuePairsopt"); } //$NON-NLS-1$
+ consumeNormalAnnotation() ;
+ break;
+
+ case 651 : if (DEBUG) { System.out.println("MemberValuePairsopt ::="); } //$NON-NLS-1$
+ consumeEmptyMemberValuePairsopt() ;
+ break;
+
+ case 654 : if (DEBUG) { System.out.println("MemberValuePairs ::= MemberValuePairs COMMA..."); } //$NON-NLS-1$
+ consumeMemberValuePairs() ;
+ break;
+
+ case 655 : if (DEBUG) { System.out.println("MemberValuePair ::= SimpleName EQUAL MemberValue"); } //$NON-NLS-1$
+ consumeMemberValuePair() ;
+ break;
+
+ case 659 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::= LBRACE MemberValues..."); } //$NON-NLS-1$
+ consumeMemberValueArrayInitializer() ;
+ break;
+
+ case 660 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::= LBRACE MemberValues..."); } //$NON-NLS-1$
+ consumeMemberValueArrayInitializer() ;
+ break;
+
+ case 661 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::= LBRACE COMMA RBRACE"); } //$NON-NLS-1$
+ consumeEmptyMemberValueArrayInitializer() ;
+ break;
+
+ case 662 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::= LBRACE RBRACE"); } //$NON-NLS-1$
+ consumeEmptyMemberValueArrayInitializer() ;
+ break;
+
+ case 664 : if (DEBUG) { System.out.println("MemberValues ::= MemberValues COMMA MemberValue"); } //$NON-NLS-1$
+ consumeMemberValues() ;
+ break;
+
+ case 665 : if (DEBUG) { System.out.println("MarkerAnnotation ::= AT Name"); } //$NON-NLS-1$
+ consumeMarkerAnnotation() ;
+ break;
+
+ case 666 : if (DEBUG) { System.out.println("SingleMemberAnnotation ::= AT Name LPAREN MemberValue..."); } //$NON-NLS-1$
+ consumeSingleMemberAnnotation() ;
+ break;
+
}
}
protected void consumeSimpleAssertStatement() {
@@ -3494,23 +5842,73 @@ protected void consumeSimpleAssertStatement() {
this.expressionLengthPtr--;
pushOnAstStack(new AssertStatement(this.expressionStack[this.expressionPtr--], this.intStack[this.intPtr--]));
}
-
-protected void consumeSingleTypeImportDeclaration() {
- // SingleTypeImportDeclaration ::= SingleTypeImportDeclarationName ';'
+protected void consumeSingleMemberAnnotation() {
+ // SingleMemberAnnotation ::= '@' Name '(' MemberValue ')'
+ SingleMemberAnnotation singleMemberAnnotation = null;
+ int length = this.identifierLengthStack[this.identifierLengthPtr--];
+ if (length == 1) {
+ singleMemberAnnotation = new SingleMemberAnnotation(this.identifierStack[this.identifierPtr], this.identifierPositionStack[this.identifierPtr--], this.intStack[this.intPtr--]);
+ } else {
+ char[][] tokens = new char[length][];
+ this.identifierPtr -= length;
+ long[] positions = new long[length];
+ System.arraycopy(this.identifierStack, this.identifierPtr + 1, tokens, 0, length);
+ System.arraycopy(
+ this.identifierPositionStack,
+ this.identifierPtr + 1,
+ positions,
+ 0,
+ length);
+ singleMemberAnnotation = new SingleMemberAnnotation(tokens, positions, this.intStack[this.intPtr--]);
+ }
+ singleMemberAnnotation.memberValue = this.expressionStack[this.expressionPtr--];
+ this.expressionLengthPtr--;
+ int sourceStart = singleMemberAnnotation.sourceStart;
+ if (this.modifiersSourceStart < 0) {
+ this.modifiersSourceStart = sourceStart;
+ } else if (this.modifiersSourceStart > sourceStart) {
+ this.modifiersSourceStart = sourceStart;
+ }
+ singleMemberAnnotation.declarationSourceEnd = this.rParenPos;
+ pushOnExpressionStack(singleMemberAnnotation);
+}
+protected void consumeSingleStaticImportDeclarationName() {
+ // SingleTypeImportDeclarationName ::= 'import' 'static' Name
+ /* push an ImportRef build from the last name
+ stored in the identifier stack. */
- ImportReference impt = (ImportReference) this.astStack[this.astPtr];
- // flush comments defined prior to import statements
- impt.declarationEnd = this.endStatementPosition;
- impt.declarationSourceEnd =
- this.flushCommentsDefinedPriorTo(impt.declarationSourceEnd);
+ ImportReference impt;
+ int length;
+ char[][] tokens = new char[length = this.identifierLengthStack[this.identifierLengthPtr--]][];
+ this.identifierPtr -= length;
+ long[] positions = new long[length];
+ System.arraycopy(this.identifierStack, this.identifierPtr + 1, tokens, 0, length);
+ System.arraycopy(this.identifierPositionStack, this.identifierPtr + 1, positions, 0, length);
+ pushOnAstStack(impt = new ImportReference(tokens, positions, false, AccStatic));
+
+ this.modifiers = AccDefault;
+ this.modifiersSourceStart = -1; // <-- see comment into modifiersFlag(int)
+
+ if (this.currentToken == TokenNameSEMICOLON){
+ impt.declarationSourceEnd = this.scanner.currentPosition - 1;
+ } else {
+ impt.declarationSourceEnd = impt.sourceEnd;
+ }
+ impt.declarationEnd = impt.declarationSourceEnd;
+ //this.endPosition is just before the ;
+ impt.declarationSourceStart = this.intStack[this.intPtr--];
+ if(this.options.sourceLevel < ClassFileConstants.JDK1_5 &&
+ this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) {
+ this.problemReporter().invalidUsageOfStaticImports(impt);
+ }
+
// recovery
- if (this.currentElement != null) {
- this.lastCheckPoint = impt.declarationSourceEnd + 1;
+ if (this.currentElement != null){
+ this.lastCheckPoint = impt.declarationSourceEnd+1;
this.currentElement = this.currentElement.add(impt, 0);
this.lastIgnoredToken = -1;
- this.restartRecovery = true;
- // used to avoid branching back into the regular automaton
+ this.restartRecovery = true; // used to avoid branching back into the regular automaton
}
}
protected void consumeSingleTypeImportDeclarationName() {
@@ -3533,7 +5931,7 @@ protected void consumeSingleTypeImportDeclarationName() {
impt.declarationSourceEnd = impt.sourceEnd;
}
impt.declarationEnd = impt.declarationSourceEnd;
- //endPosition is just before the ;
+ //this.endPosition is just before the ;
impt.declarationSourceStart = this.intStack[this.intPtr--];
// recovery
@@ -3546,13 +5944,13 @@ protected void consumeSingleTypeImportDeclarationName() {
}
protected void consumeStatementBreak() {
// BreakStatement ::= 'break' ';'
- // break pushs a position on intStack in case there is no label
+ // break pushs a position on this.intStack in case there is no label
pushOnAstStack(new BreakStatement(null, this.intStack[this.intPtr--], this.endPosition));
}
protected void consumeStatementBreakWithLabel() {
// BreakStatement ::= 'break' Identifier ';'
- // break pushs a position on intStack in case there is no label
+ // break pushs a position on this.intStack in case there is no label
pushOnAstStack(
new BreakStatement(
@@ -3575,7 +5973,7 @@ protected void consumeStatementCatch() {
}
protected void consumeStatementContinue() {
// ContinueStatement ::= 'continue' ';'
- // continue pushs a position on intStack in case there is no label
+ // continue pushs a position on this.intStack in case there is no label
pushOnAstStack(
new ContinueStatement(
@@ -3585,7 +5983,7 @@ protected void consumeStatementContinue() {
}
protected void consumeStatementContinueWithLabel() {
// ContinueStatement ::= 'continue' Identifier ';'
- // continue pushs a position on intStack in case there is no label
+ // continue pushs a position on this.intStack in case there is no label
pushOnAstStack(
new ContinueStatement(
@@ -3597,7 +5995,7 @@ protected void consumeStatementContinueWithLabel() {
protected void consumeStatementDo() {
// DoStatement ::= 'do' Statement 'while' '(' Expression ')' ';'
- //the 'while' pushes a value on intStack that we need to remove
+ //the 'while' pushes a value on this.intStack that we need to remove
this.intPtr--;
Statement statement = (Statement) this.astStack[this.astPtr];
@@ -3647,7 +6045,7 @@ protected void consumeStatementFor() {
inits = null;
scope = false;
} else {
- if (length == -1) { //on expressionStack
+ if (length == -1) { //on this.expressionStack
scope = false;
length = this.expressionLengthStack[this.expressionLengthPtr--];
this.expressionPtr -= length;
@@ -3657,7 +6055,7 @@ protected void consumeStatementFor() {
inits = new Statement[length],
0,
length);
- } else { //on astStack
+ } else { //on this.astStack
this.astPtr -= length;
System.arraycopy(
this.astStack,
@@ -3724,7 +6122,7 @@ protected void consumeStatementLabel() {
}
protected void consumeStatementReturn() {
// ReturnStatement ::= 'return' Expressionopt ';'
- // return pushs a position on intStack in case there is no expression
+ // return pushs a position on this.intStack in case there is no expression
if (this.expressionLengthStack[this.expressionLengthPtr--] != 0) {
pushOnAstStack(
@@ -3842,6 +6240,45 @@ protected void consumeStatementWhile() {
this.intStack[this.intPtr--],
this.endStatementPosition);
}
+protected void consumeStaticImportOnDemandDeclarationName() {
+ // TypeImportOnDemandDeclarationName ::= 'import' 'static' Name '.' '*'
+ /* push an ImportRef build from the last name
+ stored in the identifier stack. */
+
+ ImportReference impt;
+ int length;
+ char[][] tokens = new char[length = this.identifierLengthStack[this.identifierLengthPtr--]][];
+ this.identifierPtr -= length;
+ long[] positions = new long[length];
+ System.arraycopy(this.identifierStack, this.identifierPtr + 1, tokens, 0, length);
+ System.arraycopy(this.identifierPositionStack, this.identifierPtr + 1, positions, 0, length);
+ pushOnAstStack(impt = new ImportReference(tokens, positions, true, AccStatic));
+
+ this.modifiers = AccDefault;
+ this.modifiersSourceStart = -1; // <-- see comment into modifiersFlag(int)
+
+ if (this.currentToken == TokenNameSEMICOLON){
+ impt.declarationSourceEnd = this.scanner.currentPosition - 1;
+ } else {
+ impt.declarationSourceEnd = impt.sourceEnd;
+ }
+ impt.declarationEnd = impt.declarationSourceEnd;
+ //this.endPosition is just before the ;
+ impt.declarationSourceStart = this.intStack[this.intPtr--];
+
+ if(options.sourceLevel < ClassFileConstants.JDK1_5 &&
+ this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) {
+ this.problemReporter().invalidUsageOfStaticImports(impt);
+ }
+
+ // recovery
+ if (this.currentElement != null){
+ this.lastCheckPoint = impt.declarationSourceEnd+1;
+ this.currentElement = this.currentElement.add(impt, 0);
+ this.lastIgnoredToken = -1;
+ this.restartRecovery = true; // used to avoid branching back into the regular automaton
+ }
+}
protected void consumeStaticInitializer() {
// StaticInitializer ::= StaticOnly Block
//push an Initializer
@@ -3927,110 +6364,111 @@ protected void consumeToken(int type) {
switch (type) {
case TokenNameIdentifier :
pushIdentifier();
- if (this.scanner.useAssertAsAnIndentifier) {
+ if (this.scanner.useAssertAsAnIndentifier &&
+ this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) {
long positions = this.identifierPositionStack[this.identifierPtr];
problemReporter().useAssertAsAnIdentifier((int) (positions >>> 32), (int) positions);
}
-// this.scanner.commentPtr = -1;
break;
case TokenNameinterface :
adjustInterfaceModifiers();
//'class' is pushing two int (positions) on the stack ==> 'interface' needs to do it too....
pushOnIntStack(this.scanner.currentPosition - 1);
pushOnIntStack(this.scanner.startPosition);
-// this.scanner.commentPtr = -1;
break;
case TokenNameabstract :
checkAndSetModifiers(AccAbstract);
+ pushOnExpressionStackLengthStack(0);
break;
case TokenNamestrictfp :
checkAndSetModifiers(AccStrictfp);
+ pushOnExpressionStackLengthStack(0);
break;
case TokenNamefinal :
checkAndSetModifiers(AccFinal);
+ pushOnExpressionStackLengthStack(0);
break;
case TokenNamenative :
checkAndSetModifiers(AccNative);
+ pushOnExpressionStackLengthStack(0);
break;
case TokenNameprivate :
checkAndSetModifiers(AccPrivate);
+ pushOnExpressionStackLengthStack(0);
break;
case TokenNameprotected :
checkAndSetModifiers(AccProtected);
+ pushOnExpressionStackLengthStack(0);
break;
case TokenNamepublic :
checkAndSetModifiers(AccPublic);
+ pushOnExpressionStackLengthStack(0);
break;
case TokenNametransient :
checkAndSetModifiers(AccTransient);
+ pushOnExpressionStackLengthStack(0);
break;
case TokenNamevolatile :
checkAndSetModifiers(AccVolatile);
+ pushOnExpressionStackLengthStack(0);
break;
case TokenNamestatic :
checkAndSetModifiers(AccStatic);
+ pushOnExpressionStackLengthStack(0);
break;
case TokenNamesynchronized :
this.synchronizedBlockSourceStart = this.scanner.startPosition;
checkAndSetModifiers(AccSynchronized);
+ pushOnExpressionStackLengthStack(0);
break;
//==============================
case TokenNamevoid :
pushIdentifier(-T_void);
pushOnIntStack(this.scanner.currentPosition - 1);
pushOnIntStack(this.scanner.startPosition);
-// this.scanner.commentPtr = -1;
break;
//push a default dimension while void is not part of the primitive
//declaration baseType and so takes the place of a type without getting into
- //regular type parsing that generates a dimension on intStack
+ //regular type parsing that generates a dimension on this.intStack
case TokenNameboolean :
pushIdentifier(-T_boolean);
pushOnIntStack(this.scanner.currentPosition - 1);
pushOnIntStack(this.scanner.startPosition);
-// this.scanner.commentPtr = -1;
break;
case TokenNamebyte :
pushIdentifier(-T_byte);
pushOnIntStack(this.scanner.currentPosition - 1);
pushOnIntStack(this.scanner.startPosition);
-// this.scanner.commentPtr = -1;
break;
case TokenNamechar :
pushIdentifier(-T_char);
pushOnIntStack(this.scanner.currentPosition - 1);
pushOnIntStack(this.scanner.startPosition);
-// this.scanner.commentPtr = -1;
break;
case TokenNamedouble :
pushIdentifier(-T_double);
pushOnIntStack(this.scanner.currentPosition - 1);
pushOnIntStack(this.scanner.startPosition);
-// this.scanner.commentPtr = -1;
break;
case TokenNamefloat :
pushIdentifier(-T_float);
pushOnIntStack(this.scanner.currentPosition - 1);
pushOnIntStack(this.scanner.startPosition);
-// this.scanner.commentPtr = -1;
break;
case TokenNameint :
pushIdentifier(-T_int);
pushOnIntStack(this.scanner.currentPosition - 1);
pushOnIntStack(this.scanner.startPosition);
-// this.scanner.commentPtr = -1;
break;
case TokenNamelong :
pushIdentifier(-T_long);
pushOnIntStack(this.scanner.currentPosition - 1);
pushOnIntStack(this.scanner.startPosition);
-// this.scanner.commentPtr = -1;
break;
case TokenNameshort :
pushIdentifier(-T_short);
pushOnIntStack(this.scanner.currentPosition - 1);
pushOnIntStack(this.scanner.startPosition);
-// this.scanner.commentPtr = -1;
break;
//==============================
case TokenNameIntegerLiteral :
@@ -4039,7 +6477,6 @@ protected void consumeToken(int type) {
this.scanner.getCurrentTokenSource(),
this.scanner.startPosition,
this.scanner.currentPosition - 1));
-// this.scanner.commentPtr = -1;
break;
case TokenNameLongLiteral :
pushOnExpressionStack(
@@ -4047,7 +6484,6 @@ protected void consumeToken(int type) {
this.scanner.getCurrentTokenSource(),
this.scanner.startPosition,
this.scanner.currentPosition - 1));
-// this.scanner.commentPtr = -1;
break;
case TokenNameFloatingPointLiteral :
pushOnExpressionStack(
@@ -4055,7 +6491,6 @@ protected void consumeToken(int type) {
this.scanner.getCurrentTokenSource(),
this.scanner.startPosition,
this.scanner.currentPosition - 1));
-// this.scanner.commentPtr = -1;
break;
case TokenNameDoubleLiteral :
pushOnExpressionStack(
@@ -4063,7 +6498,6 @@ protected void consumeToken(int type) {
this.scanner.getCurrentTokenSource(),
this.scanner.startPosition,
this.scanner.currentPosition - 1));
-// this.scanner.commentPtr = -1;
break;
case TokenNameCharacterLiteral :
pushOnExpressionStack(
@@ -4071,7 +6505,6 @@ protected void consumeToken(int type) {
this.scanner.getCurrentTokenSource(),
this.scanner.startPosition,
this.scanner.currentPosition - 1));
-// this.scanner.commentPtr = -1;
break;
case TokenNameStringLiteral :
StringLiteral stringLiteral = new StringLiteral(
@@ -4079,12 +6512,10 @@ protected void consumeToken(int type) {
this.scanner.startPosition,
this.scanner.currentPosition - 1);
pushOnExpressionStack(stringLiteral);
-// this.scanner.commentPtr = -1;
break;
case TokenNamefalse :
pushOnExpressionStack(
new FalseLiteral(this.scanner.startPosition, this.scanner.currentPosition - 1));
-// this.scanner.commentPtr = -1;
break;
case TokenNametrue :
pushOnExpressionStack(
@@ -4125,6 +6556,10 @@ protected void consumeToken(int type) {
pushOnIntStack(this.scanner.currentPosition - 1);
pushOnIntStack(this.scanner.startPosition);
break;
+ case TokenNameenum :
+ pushOnIntStack(this.scanner.currentPosition - 1);
+ pushOnIntStack(this.scanner.startPosition);
+ break;
case TokenNamedefault :
pushOnIntStack(this.scanner.startPosition);
pushOnIntStack(this.scanner.currentPosition - 1);
@@ -4148,14 +6583,20 @@ protected void consumeToken(int type) {
this.endPosition = this.scanner.startPosition - 1;
//the item is not part of the potential futur expression/statement
break;
- // in order to handle ( expression) ////// (cast)expression///// foo(x)
case TokenNameRPAREN :
+ // in order to handle ( expression) ////// (cast)expression///// foo(x)
this.rParenPos = this.scanner.currentPosition - 1; // position of the end of right parenthesis (in case of unicode \u0029) lex00101
break;
case TokenNameLPAREN :
this.lParenPos = this.scanner.startPosition;
break;
- // case TokenNameQUESTION :
+ case TokenNameAT :
+ pushOnIntStack(this.scanner.startPosition);
+ break;
+ case TokenNameQUESTION :
+ pushOnIntStack(this.scanner.startPosition);
+ pushOnIntStack(this.scanner.currentPosition - 1);
+ break;
// case TokenNameCOMMA :
// case TokenNameCOLON :
// case TokenNameEQUAL :
@@ -4201,36 +6642,43 @@ protected void consumeToken(int type) {
// case TokenNameLESS :
}
}
-protected void consumeTypeDeclarations() {
- // TypeDeclarations ::= TypeDeclarations TypeDeclaration
- concatNodeLists();
+protected void consumeTypeArgument() {
+ pushOnGenericsStack(getTypeReference(this.intStack[this.intPtr--]));
}
-protected void consumeTypeDeclarationsopt() {
- // TypeDeclarationsopt ::= TypeDeclarations
- int length;
- if ((length = this.astLengthStack[this.astLengthPtr--]) != 0) {
- this.astPtr -= length;
- System.arraycopy(this.astStack, this.astPtr + 1, this.compilationUnit.types = new TypeDeclaration[length], 0, length);
- }
+protected void consumeTypeArgumentList() {
+ concatGenericsLists();
}
-protected void consumeTypeImportOnDemandDeclaration() {
- // TypeImportOnDemandDeclaration ::= TypeImportOnDemandDeclarationName ';'
-
- ImportReference impt = (ImportReference) this.astStack[this.astPtr];
- // flush comments defined prior to import statements
- impt.declarationEnd = this.endStatementPosition;
- impt.declarationSourceEnd =
- this.flushCommentsDefinedPriorTo(impt.declarationSourceEnd);
-
- // recovery
- if (this.currentElement != null) {
- this.lastCheckPoint = impt.declarationSourceEnd + 1;
- this.currentElement = this.currentElement.add(impt, 0);
- this.restartRecovery = true;
- this.lastIgnoredToken = -1;
- // used to avoid branching back into the regular automaton
+protected void consumeTypeArgumentList1() {
+ concatGenericsLists();
+}
+protected void consumeTypeArgumentList2() {
+ concatGenericsLists();
+}
+protected void consumeTypeArgumentList3() {
+ concatGenericsLists();
+}
+protected void consumeTypeArgumentReferenceType1() {
+ concatGenericsLists();
+ pushOnGenericsStack(getTypeReference(0));
+}
+protected void consumeTypeArgumentReferenceType2() {
+ concatGenericsLists();
+ pushOnGenericsStack(getTypeReference(0));
+}
+protected void consumeTypeArguments() {
+ concatGenericsLists();
+ if(options.sourceLevel < ClassFileConstants.JDK1_5 &&
+ this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) {
+ int length = this.genericsLengthStack[this.genericsLengthPtr];
+ this.problemReporter().invalidUsageOfTypeArguments(
+ (TypeReference)this.genericsStack[this.genericsPtr - length + 1],
+ (TypeReference)this.genericsStack[this.genericsPtr]);
}
}
+protected void consumeTypeDeclarations() {
+ // TypeDeclarations ::= TypeDeclarations TypeDeclaration
+ concatNodeLists();
+}
protected void consumeTypeImportOnDemandDeclarationName() {
// TypeImportOnDemandDeclarationName ::= 'import' Name '.' '*'
/* push an ImportRef build from the last name
@@ -4251,7 +6699,7 @@ protected void consumeTypeImportOnDemandDeclarationName() {
impt.declarationSourceEnd = impt.sourceEnd;
}
impt.declarationEnd = impt.declarationSourceEnd;
- //endPosition is just before the ;
+ //this.endPosition is just before the ;
impt.declarationSourceStart = this.intStack[this.intPtr--];
// recovery
@@ -4262,6 +6710,82 @@ protected void consumeTypeImportOnDemandDeclarationName() {
this.restartRecovery = true; // used to avoid branching back into the regular automaton
}
}
+protected void consumeTypeParameterHeader() {
+ //TypeParameterHeader ::= Identifier
+ TypeParameter typeParameter = new TypeParameter();
+ long pos = this.identifierPositionStack[this.identifierPtr];
+ final int end = (int) pos;
+ typeParameter.declarationSourceEnd = end;
+ typeParameter.sourceEnd = end;
+ final int start = (int) (pos >>> 32);
+ typeParameter.declarationSourceStart = start;
+ typeParameter.sourceStart = start;
+ typeParameter.name = this.identifierStack[this.identifierPtr--];
+ this.identifierLengthPtr--;
+ pushOnGenericsStack(typeParameter);
+
+ this.listTypeParameterLength++;
+}
+protected void consumeTypeParameter1() {
+ // nothing to do
+}
+protected void consumeTypeParameter1WithExtends() {
+ //TypeParameter1 ::= TypeParameterHeader 'extends' ReferenceType1
+ TypeReference superType = (TypeReference) this.genericsStack[this.genericsPtr--];
+ this.genericsLengthPtr--;
+ TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr];
+ typeParameter.declarationSourceEnd = superType.sourceEnd;
+ typeParameter.type = superType;
+ this.genericsStack[this.genericsPtr] = typeParameter;
+}
+protected void consumeTypeParameter1WithExtendsAndBounds() {
+ //TypeParameter1 ::= TypeParameterHeader 'extends' ReferenceType AdditionalBoundList1
+ int additionalBoundsLength = this.genericsLengthStack[this.genericsLengthPtr--];
+ TypeReference[] bounds = new TypeReference[additionalBoundsLength];
+ this.genericsPtr -= additionalBoundsLength;
+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, bounds, 0, additionalBoundsLength);
+ TypeReference superType = getTypeReference(this.intStack[this.intPtr--]);
+ TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr];
+ typeParameter.declarationSourceEnd = bounds[additionalBoundsLength - 1].sourceEnd;
+ typeParameter.type = superType;
+ typeParameter.bounds = bounds;
+}
+protected void consumeTypeParameterList() {
+ //TypeParameterList ::= TypeParameterList ',' TypeParameter
+ concatGenericsLists();
+}
+protected void consumeTypeParameterList1() {
+ //TypeParameterList1 ::= TypeParameterList ',' TypeParameter1
+ concatGenericsLists();
+}
+protected void consumeTypeParameters() {
+ if(options.sourceLevel < ClassFileConstants.JDK1_5&&
+ this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) {
+ int length = this.genericsLengthStack[this.genericsLengthPtr];
+ this.problemReporter().invalidUsageOfTypeParameters(
+ (TypeParameter) this.genericsStack[genericsPtr - length + 1],
+ (TypeParameter) this.genericsStack[genericsPtr]);
+ }
+}
+protected void consumeTypeParameterWithExtends() {
+ //TypeParameter ::= TypeParameterHeader 'extends' ReferenceType
+ TypeReference superType = getTypeReference(this.intStack[this.intPtr--]);
+ TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr];
+ typeParameter.declarationSourceEnd = superType.sourceEnd;
+ typeParameter.type = superType;
+}
+protected void consumeTypeParameterWithExtendsAndBounds() {
+ //TypeParameter ::= TypeParameterHeader 'extends' ReferenceType AdditionalBoundList
+ int additionalBoundsLength = this.genericsLengthStack[this.genericsLengthPtr--];
+ TypeReference[] bounds = new TypeReference[additionalBoundsLength];
+ this.genericsPtr -= additionalBoundsLength;
+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, bounds, 0, additionalBoundsLength);
+ TypeReference superType = getTypeReference(this.intStack[this.intPtr--]);
+ TypeParameter typeParameter = (TypeParameter) this.genericsStack[this.genericsPtr];
+ typeParameter.type = superType;
+ typeParameter.bounds = bounds;
+ typeParameter.declarationSourceEnd = bounds[additionalBoundsLength - 1].sourceEnd;
+}
protected void consumeUnaryExpression(int op) {
// UnaryExpression ::= '+' PushPosition UnaryExpression
// UnaryExpression ::= '-' PushPosition UnaryExpression
@@ -4275,7 +6799,7 @@ protected void consumeUnaryExpression(int op) {
//is Integer.MAX_VALUE+1.....)
//Same for -9223372036854775808L ............
- //intStack have the position of the operator
+ //this.intStack have the position of the operator
Expression r, exp = this.expressionStack[this.expressionPtr];
if (op == MINUS) {
@@ -4301,7 +6825,7 @@ protected void consumeUnaryExpression(int op, boolean post) {
// ++ and -- operators
//optimize the push/pop
- //intStack has the position of the operator when prefix
+ //this.intStack has the position of the operator when prefix
Expression leftHandSide = this.expressionStack[this.expressionPtr];
if (leftHandSide instanceof Reference) {
@@ -4337,6 +6861,114 @@ protected void consumeVariableInitializers() {
// VariableInitializers ::= VariableInitializers ',' VariableInitializer
concatExpressionLists();
}
+protected void consumeWildcard() {
+ final Wildcard wildcard = new Wildcard(Wildcard.UNBOUND);
+ wildcard.sourceEnd = this.intStack[this.intPtr--];
+ wildcard.sourceStart = this.intStack[this.intPtr--];
+ pushOnGenericsStack(wildcard);
+}
+protected void consumeWildcard1() {
+ final Wildcard wildcard = new Wildcard(Wildcard.UNBOUND);
+ wildcard.sourceEnd = this.intStack[this.intPtr--];
+ wildcard.sourceStart = this.intStack[this.intPtr--];
+ pushOnGenericsStack(wildcard);
+}
+protected void consumeWildcard1WithBounds() {
+ // Nothing to do
+ // The wildcard is created by the consumeWildcardBounds1Extends or by consumeWildcardBounds1Super
+}
+protected void consumeWildcard2() {
+ final Wildcard wildcard = new Wildcard(Wildcard.UNBOUND);
+ wildcard.sourceEnd = this.intStack[this.intPtr--];
+ wildcard.sourceStart = this.intStack[this.intPtr--];
+ pushOnGenericsStack(wildcard);
+}
+protected void consumeWildcard2WithBounds() {
+ // Nothing to do
+ // The wildcard is created by the consumeWildcardBounds2Extends or by consumeWildcardBounds2Super
+}
+protected void consumeWildcard3() {
+ final Wildcard wildcard = new Wildcard(Wildcard.UNBOUND);
+ wildcard.sourceEnd = this.intStack[this.intPtr--];
+ wildcard.sourceStart = this.intStack[this.intPtr--];
+ pushOnGenericsStack(wildcard);
+}
+protected void consumeWildcard3WithBounds() {
+ // Nothing to do
+ // The wildcard is created by the consumeWildcardBounds3Extends or by consumeWildcardBounds3Super
+}
+protected void consumeWildcardBounds1Extends() {
+ Wildcard wildcard = new Wildcard(Wildcard.EXTENDS);
+ wildcard.bound = (TypeReference) this.genericsStack[this.genericsPtr];
+ wildcard.sourceEnd = wildcard.bound.sourceEnd;
+ this.intPtr--; // remove end position of the '?'
+ wildcard.sourceStart = this.intStack[this.intPtr--];
+ this.genericsStack[this.genericsPtr] = wildcard;
+}
+protected void consumeWildcardBounds1Super() {
+ Wildcard wildcard = new Wildcard(Wildcard.SUPER);
+ wildcard.bound = (TypeReference) this.genericsStack[this.genericsPtr];
+ this.intPtr--; // remove the starting position of the super keyword
+ wildcard.sourceEnd = wildcard.bound.sourceEnd;
+ this.intPtr--; // remove end position of the '?'
+ wildcard.sourceStart = this.intStack[this.intPtr--];
+ this.genericsStack[this.genericsPtr] = wildcard;
+}
+protected void consumeWildcardBounds2Extends() {
+ Wildcard wildcard = new Wildcard(Wildcard.EXTENDS);
+ wildcard.bound = (TypeReference) this.genericsStack[this.genericsPtr];
+ wildcard.sourceEnd = wildcard.bound.sourceEnd;
+ this.intPtr--; // remove end position of the '?'
+ wildcard.sourceStart = this.intStack[this.intPtr--];
+ this.genericsStack[this.genericsPtr] = wildcard;
+}
+protected void consumeWildcardBounds2Super() {
+ Wildcard wildcard = new Wildcard(Wildcard.SUPER);
+ wildcard.bound = (TypeReference) this.genericsStack[this.genericsPtr];
+ this.intPtr--; // remove the starting position of the super keyword
+ wildcard.sourceEnd = wildcard.bound.sourceEnd;
+ this.intPtr--; // remove end position of the '?'
+ wildcard.sourceStart = this.intStack[this.intPtr--];
+ this.genericsStack[this.genericsPtr] = wildcard;
+}
+protected void consumeWildcardBounds3Extends() {
+ Wildcard wildcard = new Wildcard(Wildcard.EXTENDS);
+ wildcard.bound = (TypeReference) this.genericsStack[this.genericsPtr];
+ wildcard.sourceEnd = wildcard.bound.sourceEnd;
+ this.intPtr--; // remove end position of the '?'
+ wildcard.sourceStart = this.intStack[this.intPtr--];
+ this.genericsStack[this.genericsPtr] = wildcard;
+}
+protected void consumeWildcardBounds3Super() {
+ Wildcard wildcard = new Wildcard(Wildcard.SUPER);
+ wildcard.bound = (TypeReference) this.genericsStack[this.genericsPtr];
+ this.intPtr--; // remove the starting position of the super keyword
+ wildcard.sourceEnd = wildcard.bound.sourceEnd;
+ this.intPtr--; // remove end position of the '?'
+ wildcard.sourceStart = this.intStack[this.intPtr--];
+ this.genericsStack[this.genericsPtr] = wildcard;
+}
+protected void consumeWildcardBoundsExtends() {
+ Wildcard wildcard = new Wildcard(Wildcard.EXTENDS);
+ wildcard.bound = getTypeReference(this.intStack[this.intPtr--]);
+ wildcard.sourceEnd = wildcard.bound.sourceEnd;
+ this.intPtr--; // remove end position of the '?'
+ wildcard.sourceStart = this.intStack[this.intPtr--];
+ pushOnGenericsStack(wildcard);
+}
+protected void consumeWildcardBoundsSuper() {
+ Wildcard wildcard = new Wildcard(Wildcard.SUPER);
+ wildcard.bound = getTypeReference(this.intStack[this.intPtr--]);
+ this.intPtr--; // remove the starting position of the super keyword
+ wildcard.sourceEnd = wildcard.bound.sourceEnd;
+ this.intPtr--; // remove end position of the '?'
+ wildcard.sourceStart = this.intStack[this.intPtr--];
+ pushOnGenericsStack(wildcard);
+}
+protected void consumeWildcardWithBounds() {
+ // Nothing to do
+ // The wildcard is created by the consumeWildcardBoundsExtends or by consumeWildcardBoundsSuper
+}
/**
* Given the current comment stack, answer whether some comment is available in a certain exclusive range
*
@@ -4358,6 +6990,7 @@ public boolean containsComment(int sourceStart, int sourceEnd) {
}
public MethodDeclaration convertToMethodDeclaration(ConstructorDeclaration c, CompilationResult compilationResult) {
MethodDeclaration m = new MethodDeclaration(compilationResult);
+ m.typeParameters = c.typeParameters;
m.sourceStart = c.sourceStart;
m.sourceEnd = c.sourceEnd;
m.bodyStart = c.bodyStart;
@@ -4367,6 +7000,7 @@ public MethodDeclaration convertToMethodDeclaration(ConstructorDeclaration c, Co
m.selector = c.selector;
m.statements = c.statements;
m.modifiers = c.modifiers;
+ m.annotations = c.annotations;
m.arguments = c.arguments;
m.thrownExceptions = c.thrownExceptions;
m.explicitDeclarations = c.explicitDeclarations;
@@ -4398,7 +7032,7 @@ public CompilationUnitDeclaration dietParse(ICompilationUnit sourceUnit, Compila
return parsedUnit;
}
protected void dispatchDeclarationInto(int length) {
- /* they are length on astStack that should go into
+ /* they are length on this.astStack that should go into
methods fields constructors lists of the typeDecl
Return if there is a constructor declaration in the methods declaration */
@@ -4409,36 +7043,43 @@ protected void dispatchDeclarationInto(int length) {
if (length == 0)
return;
int[] flag = new int[length + 1]; //plus one -- see <HERE>
- int size1 = 0, size2 = 0, size3 = 0;
+ int size1 = 0, size2 = 0, size3 = 0, size4 = 0;
for (int i = length - 1; i >= 0; i--) {
ASTNode astNode = this.astStack[this.astPtr--];
if (astNode instanceof AbstractMethodDeclaration) {
//methods and constructors have been regrouped into one single list
flag[i] = 3;
size2++;
+ } else if (astNode instanceof EnumDeclaration) {
+ flag[i] = 2;
+ size4++;
+ } else if (astNode instanceof TypeDeclaration) {
+ flag[i] = 4;
+ size3++;
} else {
- if (astNode instanceof TypeDeclaration) {
- flag[i] = 4;
- size3++;
- } else {
- //field
- flag[i] = 1;
- size1++;
- }
+ //field
+ flag[i] = 1;
+ size1++;
}
}
//arrays creation
TypeDeclaration typeDecl = (TypeDeclaration) this.astStack[this.astPtr];
- if (size1 != 0)
+ if (size1 != 0) {
typeDecl.fields = new FieldDeclaration[size1];
- if (size2 != 0)
+ }
+ if (size2 != 0) {
typeDecl.methods = new AbstractMethodDeclaration[size2];
- if (size3 != 0)
+ }
+ if (size3 != 0) {
typeDecl.memberTypes = new TypeDeclaration[size3];
+ }
+ if (size4 != 0) {
+ typeDecl.enums = new EnumDeclaration[size4];
+ }
//arrays fill up
- size1 = size2 = size3 = 0;
+ size1 = size2 = size3 = size4 = 0;
int flagI = flag[0], start = 0;
int length2;
for (int end = 0; end <= length; end++) //<HERE> the plus one allows to
@@ -4455,6 +7096,15 @@ protected void dispatchDeclarationInto(int length) {
size1 - length2,
length2);
break;
+ case 2 :
+ size4 += (length2 = end - start);
+ System.arraycopy(
+ this.astStack,
+ this.astPtr + start + 1,
+ typeDecl.enums,
+ size4 - length2,
+ length2);
+ break;
case 3 :
size2 += (length2 = end - start);
System.arraycopy(
@@ -4484,6 +7134,101 @@ protected void dispatchDeclarationInto(int length) {
}
}
}
+protected void dispatchDeclarationIntoEnumDeclaration(int length) {
+ if (length == 0)
+ return;
+ int[] flag = new int[length + 1]; //plus one -- see <HERE>
+ int size1 = 0, size2 = 0, size3 = 0, size4 = 0;
+ for (int i = length - 1; i >= 0; i--) {
+ ASTNode astNode = this.astStack[this.astPtr--];
+ if (astNode instanceof AbstractMethodDeclaration) {
+ //methods and constructors have been regrouped into one single list
+ flag[i] = 3;
+ size2++;
+ } else if (astNode instanceof EnumConstant) {
+ // enum constants
+ flag[i] = 2;
+ size4++;
+ } else if (astNode instanceof TypeDeclaration) {
+ flag[i] = 4;
+ size3++;
+ } else if (astNode instanceof FieldDeclaration) {
+ flag[i] = 1;
+ size1++;
+ }
+ }
+
+ //arrays creation
+ EnumDeclaration enumDeclaration = (EnumDeclaration) this.astStack[this.astPtr];
+ if (size1 != 0) {
+ enumDeclaration.fields = new FieldDeclaration[size1];
+ }
+ if (size2 != 0) {
+ enumDeclaration.methods = new AbstractMethodDeclaration[size2];
+ }
+ if (size3 != 0) {
+ enumDeclaration.memberTypes = new TypeDeclaration[size3];
+ }
+ if (size4 != 0) {
+ enumDeclaration.enumConstants = new EnumConstant[size4];
+ }
+
+ //arrays fill up
+ size1 = size2 = size3 = size4 = 0;
+ int flagI = flag[0], start = 0;
+ int length2;
+ for (int end = 0; end <= length; end++) //<HERE> the plus one allows to
+ {
+ if (flagI != flag[end]) //treat the last element as a ended flag.....
+ { //array copy
+ switch (flagI) {
+ case 1 :
+ size1 += (length2 = end - start);
+ System.arraycopy(
+ this.astStack,
+ this.astPtr + start + 1,
+ enumDeclaration.fields,
+ size1 - length2,
+ length2);
+ break;
+ case 2 :
+ size4 += (length2 = end - start);
+ System.arraycopy(
+ this.astStack,
+ this.astPtr + start + 1,
+ enumDeclaration.enumConstants,
+ size4 - length2,
+ length2);
+ break;
+ case 3 :
+ size2 += (length2 = end - start);
+ System.arraycopy(
+ this.astStack,
+ this.astPtr + start + 1,
+ enumDeclaration.methods,
+ size2 - length2,
+ length2);
+ break;
+ case 4 :
+ size3 += (length2 = end - start);
+ System.arraycopy(
+ this.astStack,
+ this.astPtr + start + 1,
+ enumDeclaration.memberTypes,
+ size3 - length2,
+ length2);
+ break;
+ }
+ flagI = flag[start = end];
+ }
+ }
+
+ if (enumDeclaration.memberTypes != null) {
+ for (int i = enumDeclaration.memberTypes.length - 1; i >= 0; i--) {
+ enumDeclaration.memberTypes[i].enclosingType = enumDeclaration;
+ }
+ }
+}
protected CompilationUnitDeclaration endParse(int act) {
this.lastAct = act;
@@ -4671,37 +7416,69 @@ public int[] getJavaDocPositions() {
this.scanner.lineEnds = oldLineEnds;
this.scanner.linePtr = oldLinePtr;
}
-protected TypeReference getTypeReference(int dim) { /* build a Reference on a variable that may be qualified or not
-This variable is a type reference and dim will be its dimensions*/
+protected char getNextCharacter(char[] comment, int[] index) {
+ char nextCharacter = comment[index[0]++];
+ switch(nextCharacter) {
+ case '\\' :
+ int c1, c2, c3, c4;
+ index[0]++;
+ while (comment[index[0]] == 'u') index[0]++;
+ if (!(((c1 = Character.getNumericValue(comment[index[0]++])) > 15
+ || c1 < 0)
+ || ((c2 = Character.getNumericValue(comment[index[0]++])) > 15 || c2 < 0)
+ || ((c3 = Character.getNumericValue(comment[index[0]++])) > 15 || c3 < 0)
+ || ((c4 = Character.getNumericValue(comment[index[0]++])) > 15 || c4 < 0))) {
+ nextCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
+ }
+ break;
+ }
+ return nextCharacter;
+}
+protected Expression getTypeReference(Expression exp) {
+
+ exp.bits &= ~ASTNode.RestrictiveFlagMASK;
+ exp.bits |= TYPE;
+ return exp;
+}
+protected TypeReference getTypeReference(int dim) {
+ /* build a Reference on a variable that may be qualified or not
+ This variable is a type reference and dim will be its dimensions*/
- int length;
TypeReference ref;
- if ((length = this.identifierLengthStack[this.identifierLengthPtr--]) == 1) {
- // single variable reference
+ int length = this.identifierLengthStack[this.identifierLengthPtr--];
+ if (length < 0) { //flag for precompiled type reference on base types
+ ref = TypeReference.baseTypeReference(-length, dim);
+ ref.sourceStart = this.intStack[this.intPtr--];
if (dim == 0) {
- ref =
- new SingleTypeReference(
- this.identifierStack[this.identifierPtr],
- this.identifierPositionStack[this.identifierPtr--]);
+ ref.sourceEnd = this.intStack[this.intPtr--];
} else {
- ref =
- new ArrayTypeReference(
- this.identifierStack[this.identifierPtr],
- dim,
- this.identifierPositionStack[this.identifierPtr--]);
- ref.sourceEnd = this.endPosition;
+ this.intPtr--;
+ ref.sourceEnd = this.endPosition;
}
} else {
- if (length < 0) { //flag for precompiled type reference on base types
- ref = TypeReference.baseTypeReference(-length, dim);
- ref.sourceStart = this.intStack[this.intPtr--];
+ int numberOfIdentifiers = this.genericsIdentifiersLengthStack[this.genericsIdentifiersLengthPtr--];
+ if (length != numberOfIdentifiers || this.genericsLengthStack[this.genericsLengthPtr] != 0) {
+ // generic type
+ ref = getTypeReferenceForGenericType(dim, length, numberOfIdentifiers);
+ } else if (length == 1) {
+ // single variable reference
+ this.genericsLengthPtr--; // pop the 0
if (dim == 0) {
- ref.sourceEnd = this.intStack[this.intPtr--];
+ ref =
+ new SingleTypeReference(
+ this.identifierStack[this.identifierPtr],
+ this.identifierPositionStack[this.identifierPtr--]);
} else {
- this.intPtr--;
- ref.sourceEnd = this.endPosition;
+ ref =
+ new ArrayTypeReference(
+ this.identifierStack[this.identifierPtr],
+ dim,
+ this.identifierPositionStack[this.identifierPtr--]);
+ ref.sourceEnd = this.endPosition;
}
- } else { //Qualified variable reference
+ } else {
+ this.genericsLengthPtr--;
+ //Qualified variable reference
char[][] tokens = new char[length][];
this.identifierPtr -= length;
long[] positions = new long[length];
@@ -4722,11 +7499,44 @@ This variable is a type reference and dim will be its dimensions*/
}
return ref;
}
-protected Expression getTypeReference(Expression exp) {
-
- exp.bits &= ~ASTNode.RestrictiveFlagMASK;
- exp.bits |= TYPE;
- return exp;
+protected TypeReference getTypeReferenceForGenericType(int dim, int identifierLength, int numberOfIdentifiers) {
+ if (identifierLength == 1 && numberOfIdentifiers == 1) {
+ int currentTypeArgumentsLength = this.genericsLengthStack[this.genericsLengthPtr--];
+ TypeReference[] typeArguments = new TypeReference[currentTypeArgumentsLength];
+ this.genericsPtr -= currentTypeArgumentsLength;
+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, typeArguments, 0, currentTypeArgumentsLength);
+ return new ParameterizedSingleTypeReference(this.identifierStack[this.identifierPtr], typeArguments, dim, this.identifierPositionStack[this.identifierPtr--]);
+ } else {
+ TypeReference[][] typeArguments = new TypeReference[numberOfIdentifiers][];
+ char[][] tokens = new char[numberOfIdentifiers][];
+ long[] positions = new long[numberOfIdentifiers];
+ int index = numberOfIdentifiers;
+ int currentIdentifiersLength = identifierLength;
+ while (index > 0) {
+ int currentTypeArgumentsLength = this.genericsLengthStack[this.genericsLengthPtr--];
+ if (currentTypeArgumentsLength != 0) {
+ this.genericsPtr -= currentTypeArgumentsLength;
+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, typeArguments[index - 1] = new TypeReference[currentTypeArgumentsLength], 0, currentTypeArgumentsLength);
+ }
+ switch(currentIdentifiersLength) {
+ case 1 :
+ // we are in a case A<B>.C<D> or A<B>.C<D>
+ tokens[index - 1] = this.identifierStack[this.identifierPtr];
+ positions[index - 1] = this.identifierPositionStack[this.identifierPtr--];
+ break;
+ default:
+ // we are in a case A.B.C<B>.C<D> or A.B.C<B>...
+ this.identifierPtr -= currentIdentifiersLength;
+ System.arraycopy(this.identifierStack, this.identifierPtr + 1, tokens, index - currentIdentifiersLength, currentIdentifiersLength);
+ System.arraycopy(this.identifierPositionStack, this.identifierPtr + 1, positions, index - currentIdentifiersLength, currentIdentifiersLength);
+ }
+ index -= currentIdentifiersLength;
+ if (index > 0) {
+ currentIdentifiersLength = this.identifierLengthStack[this.identifierLengthPtr--];
+ }
+ }
+ return new ParameterizedQualifiedTypeReference(tokens, typeArguments, dim, positions);
+ }
}
protected NameReference getUnspecifiedReference() {
/* build a (unspecified) NameReference which may be qualified*/
@@ -4918,11 +7728,11 @@ protected void ignoreInvalidConstructorDeclaration(boolean hasBody) {
// InvalidConstructorDeclaration ::= ConstructorHeader ';' ==> false
/*
- astStack : modifiers arguments throws statements
- identifierStack : name
+ this.astStack : modifiers arguments throws statements
+ this.identifierStack : name
==>
- astStack : MethodDeclaration
- identifierStack :
+ this.astStack : MethodDeclaration
+ this.identifierStack :
*/
if (hasBody) {
// pop the position of the { (body of the method) pushed in block decl
@@ -4949,13 +7759,13 @@ protected void ignoreMethodBody() {
// InterfaceMemberDeclaration ::= InvalidMethodDeclaration
/*
- astStack : modifiers arguments throws statements
- identifierStack : type name
- intStack : dim dim dim
+ this.astStack : modifiers arguments throws statements
+ this.identifierStack : type name
+ this.intStack : dim dim dim
==>
- astStack : MethodDeclaration
- identifierStack :
- intStack :
+ this.astStack : MethodDeclaration
+ this.identifierStack :
+ this.intStack :
*/
// pop the position of the { (body of the method) pushed in block decl
@@ -5013,7 +7823,7 @@ public void initialize() {
}
System.arraycopy(this.noExpressions, 0, this.expressionStack, 0, expressionLength);
- // reset scanner state
+ // reset this.scanner state
this.scanner.commentPtr = -1;
this.scanner.foundTaskCount = 0;
this.scanner.eofPosition = Integer.MAX_VALUE;
@@ -5031,11 +7841,17 @@ public void initialize() {
this.recoveredStaticInitializerStart = 0;
this.lastIgnoredToken = -1;
this.lastErrorEndPosition = -1;
+ this.lastErrorEndPositionBeforeRecovery = -1;
this.listLength = 0;
+ this.listTypeParameterLength = 0;
this.rBraceStart = 0;
this.rBraceEnd = 0;
this.rBraceSuccessorStart = 0;
+
+ this.genericsIdentifiersLengthPtr = -1;
+ this.genericsLengthPtr = -1;
+ this.genericsPtr = -1;
}
public void initializeScanner(){
this.scanner = new Scanner(
@@ -5047,44 +7863,6 @@ public void initializeScanner(){
this.options.taskPriorites/*taskPriorities*/,
this.options.isTaskCaseSensitive/*taskCaseSensitive*/);
}
-public final static void initTables() throws java.io.IOException {
-
- final String prefix = FILEPREFIX;
- int i = 0;
- lhs = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
- char[] chars = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
- check_table = new short[chars.length];
- for (int c = chars.length; c-- > 0;) {
- check_table[c] = (short) (chars[c] - 32768);
- }
- asb = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
- asr = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
- nasb = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
- nasr = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
- terminal_index = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
- non_terminal_index = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
- term_action = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
-
- scope_prefix = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
- scope_suffix = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
- scope_lhs = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
- scope_state_set = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
- scope_rhs = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
- scope_state = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
- in_symb = readTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
-
- rhs = readByteTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
- term_check = readByteTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
- scope_la = readByteTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
-
- name = readNameTable(prefix + (++i) + ".rsc"); //$NON-NLS-1$
- readableName = readReadableNameTable(READABLE_NAMES);
-
- base_action = lhs;
-}
-public static int in_symbol(int state) {
- return in_symb[original_state(state)];
-}
public final void jumpOverMethodBody() {
//on diet parsing.....do not buffer method statements
@@ -5121,6 +7899,29 @@ protected void markInitializersWithLocalType(TypeDeclaration type) {
}
}
}
+public final void memberValueArrayInitializer(int length) {
+ //length is the size of the array Initializer
+ //expressionPtr points on the last elt of the arrayInitializer,
+ // in other words, it has not been decremented yet.
+
+ MemberValueArrayInitializer memberValueArrayInitializer = new MemberValueArrayInitializer();
+ if (length != 0) {
+ this.expressionPtr -= length;
+ System.arraycopy(this.expressionStack, this.expressionPtr + 1, memberValueArrayInitializer.memberValues = new Expression[length], 0, length);
+ }
+ pushOnExpressionStack(memberValueArrayInitializer);
+ //positionning
+ memberValueArrayInitializer.sourceEnd = this.endStatementPosition;
+ int searchPosition = length == 0 ? this.endPosition + 1 : memberValueArrayInitializer.memberValues[0].sourceStart;
+ try {
+ //does not work with comments(that contain '{') nor '{' describes as a unicode....
+ while (this.scanner.source[--searchPosition] != '{') {/*empty*/}
+ } catch (IndexOutOfBoundsException ex) {
+ //should never occur (except for strange cases like whose describe above)
+ searchPosition = (length == 0 ? this.endPosition : memberValueArrayInitializer.memberValues[0].sourceStart) - 1;
+ }
+ memberValueArrayInitializer.sourceStart = searchPosition;
+}
/*
* Move checkpoint location (current implementation is moving it by one token)
*
@@ -5130,7 +7931,7 @@ protected void markInitializersWithLocalType(TypeDeclaration type) {
protected boolean moveRecoveryCheckpoint() {
int pos = this.lastCheckPoint;
- /* reset scanner, and move checkpoint by one token */
+ /* reset this.scanner, and move checkpoint by one token */
this.scanner.startPosition = pos;
this.scanner.currentPosition = pos;
this.scanner.diet = false; // quit jumping over method bodies
@@ -5166,7 +7967,7 @@ protected boolean moveRecoveryCheckpoint() {
}
this.lastCheckPoint = this.scanner.currentPosition;
- /* reset scanner again to previous checkpoint location*/
+ /* reset this.scanner again to previous checkpoint location*/
this.scanner.startPosition = pos;
this.scanner.currentPosition = pos;
this.scanner.commentPtr = -1;
@@ -5179,7 +7980,7 @@ protected boolean moveRecoveryCheckpoint() {
The following implementation moves the checkpoint location by one line:
int pos = this.lastCheckPoint;
- // reset scanner, and move checkpoint by one token
+ // reset this.scanner, and move checkpoint by one token
this.scanner.startPosition = pos;
this.scanner.currentPosition = pos;
this.scanner.diet = false; // quit jumping over method bodies
@@ -5234,7 +8035,7 @@ protected boolean moveRecoveryCheckpoint() {
}
this.lastCheckPoint = this.scanner.currentPosition;
- // reset scanner again to previous checkpoint location
+ // reset this.scanner again to previous checkpoint location
this.scanner.startPosition = pos;
this.scanner.currentPosition = pos;
this.scanner.commentPtr = -1;
@@ -5259,35 +8060,40 @@ protected MessageSend newMessageSend() {
}
return m;
}
-public static int nasi(int state) {
- return nasb[original_state(state)];
-}
-public static int ntAction(int state, int sym) {
- return base_action[state + sym];
+protected MessageSend newMessageSendWithTypeArguments() {
+ MessageSend m = new MessageSend();
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ this.expressionPtr -= length;
+ System.arraycopy(
+ this.expressionStack,
+ this.expressionPtr + 1,
+ m.arguments = new Expression[length],
+ 0,
+ length);
+ }
+ return m;
}
private final void optimizedConcatNodeLists() {
/*back from a recursive loop. Virtualy group the
- astNode into an array using astLengthStack*/
+ astNode into an array using this.astLengthStack*/
/*
- * This is a case where you have two sublists into the astStack that you want
- * to merge in one list. There is no action required on the astStack. The only
+ * This is a case where you have two sublists into the this.astStack that you want
+ * to merge in one list. There is no action required on the this.astStack. The only
* thing you need to do is merge the two lengths specified on the astStackLength.
* The top two length are for example:
* ... p n
* and you want to result in a list like:
* ... n+p
* This means that the p could be equals to 0 in case there is no astNode pushed
- * on the astStack.
+ * on the this.astStack.
* Look at the InterfaceMemberDeclarations for an example.
* This case optimizes the fact that p == 1.
*/
this.astLengthStack[--this.astLengthPtr]++;
}
-protected static int original_state(int state) {
- return -base_check(state);
-}
/*main loop of the automat
When a rule is reduced, the method consumeRule(int) is called with the number
of the consumed rule. When a terminal is consumed, the method consumeToken(int) is
@@ -5295,6 +8101,7 @@ called in order to remember (when needed) the consumed token */
// (int)asr[asi(act)]
// name[symbol_index[currentKind]]
protected void parse() {
+ if (DEBUG) System.out.println("-- ENTER INSIDE PARSE METHOD --"); //$NON-NLS-1$
boolean isDietParse = this.diet;
int oldFirstToken = getFirstToken();
this.hasError = false;
@@ -5314,10 +8121,9 @@ protected void parse() {
this.stack[this.stateStackTop] = act;
act = tAction(act, this.currentToken);
-
if (act == ERROR_ACTION || this.restartRecovery) {
int errorPos = this.scanner.currentPosition;
- if (!this.hasReportedError){
+ if (!this.hasReportedError) {
this.hasError = true;
}
if (resumeOnSyntaxError()) {
@@ -5332,7 +8138,7 @@ protected void parse() {
}
if (act <= NUM_RULES) {
this.stateStackTop--;
-
+
} else if (act > ERROR_ACTION) { /* shift-reduce */
consumeToken(this.currentToken);
if (this.currentElement != null) this.recoveryTokenCheck();
@@ -5366,6 +8172,7 @@ protected void parse() {
}
break ProcessTerminals;
}
+
ProcessNonTerminals : do { /* reduce */
consumeRule(act);
this.stateStackTop -= (rhs[act] - 1);
@@ -5377,68 +8184,7 @@ protected void parse() {
if (this.reportSyntaxErrorIsRequired && this.hasError) {
reportSyntaxErrors(isDietParse, oldFirstToken);
}
-}
-// A P I
-protected void reportSyntaxErrors(boolean isDietParse, int oldFirstToken) {
- if(this.referenceContext instanceof MethodDeclaration) {
- MethodDeclaration methodDeclaration = (MethodDeclaration) this.referenceContext;
- if(methodDeclaration.errorInSignature){
- return;
- }
- }
- this.compilationUnit.compilationResult.lineSeparatorPositions = this.scanner.getLineEnds();
- this.scanner.recordLineSeparator = false;
-
- int start = this.scanner.initialPosition;
- int end = this.scanner.eofPosition <= Integer.MAX_VALUE ? this.scanner.eofPosition - 1 : this.scanner.eofPosition;
- if(isDietParse) {
- TypeDeclaration[] types = this.compilationUnit.types;
-
- int[][] intervalToSkip = org.eclipse.jdt.internal.compiler.parser.diagnose.RangeUtil.computeDietRange(types);
- DiagnoseParser diagnoseParser = new DiagnoseParser(this, oldFirstToken, start, end, intervalToSkip[0], intervalToSkip[1], intervalToSkip[2]);
- diagnoseParser.diagnoseParse();
-
- reportSyntaxErrorsForSkippedMethod(types);
- this.scanner.resetTo(start, end);
- } else {
- DiagnoseParser diagnoseParser = new DiagnoseParser(this, oldFirstToken, start, end);
- diagnoseParser.diagnoseParse();
- }
-}
-private void reportSyntaxErrorsForSkippedMethod(TypeDeclaration[] types){
- if(types != null) {
- for (int i = 0; i < types.length; i++) {
- TypeDeclaration[] memberTypes = types[i].memberTypes;
- if(memberTypes != null) {
- reportSyntaxErrorsForSkippedMethod(memberTypes);
- }
-
- AbstractMethodDeclaration[] methods = types[i].methods;
- if(methods != null) {
- for (int j = 0; j < methods.length; j++) {
- AbstractMethodDeclaration method = methods[j];
- if(methods[j].errorInSignature) {
- DiagnoseParser diagnoseParser = new DiagnoseParser(this, TokenNameDIVIDE, method.declarationSourceStart, method.declarationSourceEnd);
- diagnoseParser.diagnoseParse();
- }
- }
- }
-
- FieldDeclaration[] fields = types[i].fields;
- if (fields != null) {
- int length = fields.length;
- for (int j = 0; j < length; j++) {
- if (fields[j] instanceof Initializer) {
- Initializer initializer = (Initializer)fields[j];
- if(initializer.errorInSignature){
- DiagnoseParser diagnoseParser = new DiagnoseParser(this, TokenNameRIGHT_SHIFT, initializer.declarationSourceStart, initializer.declarationSourceEnd);
- diagnoseParser.diagnoseParse();
- }
- }
- }
- }
- }
- }
+ if (DEBUG) System.out.println("-- EXIT FROM PARSE METHOD --"); //$NON-NLS-1$
}
public void parse(ConstructorDeclaration cd, CompilationUnitDeclaration unit) {
parse(cd, unit, false);
@@ -5553,6 +8299,57 @@ public void parse(
}
// A P I
+public CompilationUnitDeclaration parse(
+ ICompilationUnit sourceUnit,
+ CompilationResult compilationResult) {
+ // parses a compilation unit and manages error handling (even bugs....)
+
+ return parse(sourceUnit, compilationResult, -1, -1/*parse without reseting the scanner*/);
+}
+// A P I
+
+public CompilationUnitDeclaration parse(
+ ICompilationUnit sourceUnit,
+ CompilationResult compilationResult,
+ int start,
+ int end) {
+ // parses a compilation unit and manages error handling (even bugs....)
+
+ CompilationUnitDeclaration unit;
+ try {
+ /* automaton initialization */
+ initialize();
+ goForCompilationUnit();
+
+ /* scanners initialization */
+ char[] contents = sourceUnit.getContents();
+ this.scanner.setSource(contents);
+ if (end != -1) this.scanner.resetTo(start, end);
+ if (this.javadocParser != null && this.javadocParser.checkDocComment) {
+ this.javadocParser.scanner.setSource(contents);
+ if (end != -1) {
+ this.javadocParser.scanner.resetTo(start, end);
+ }
+ }
+ /* unit creation */
+ this.referenceContext =
+ this.compilationUnit =
+ new CompilationUnitDeclaration(
+ this.problemReporter,
+ compilationResult,
+ this.scanner.source.length);
+ /* run automaton */
+ parse();
+ } finally {
+ unit = this.compilationUnit;
+ this.compilationUnit = null; // reset parser
+ // tag unit has having read bodies
+ if (!this.diet) unit.bits |= ASTNode.HasAllMethodBodies;
+ }
+ return unit;
+}
+// A P I
+
public void parse(
Initializer initializer,
TypeDeclaration type,
@@ -5657,57 +8454,6 @@ public void parse(MethodDeclaration md, CompilationUnitDeclaration unit) {
}
}
}
-// A P I
-
-public CompilationUnitDeclaration parse(
- ICompilationUnit sourceUnit,
- CompilationResult compilationResult) {
- // parses a compilation unit and manages error handling (even bugs....)
-
- return parse(sourceUnit, compilationResult, -1, -1/*parse without reseting the scanner*/);
-}
-// A P I
-
-public CompilationUnitDeclaration parse(
- ICompilationUnit sourceUnit,
- CompilationResult compilationResult,
- int start,
- int end) {
- // parses a compilation unit and manages error handling (even bugs....)
-
- CompilationUnitDeclaration unit;
- try {
- /* automaton initialization */
- initialize();
- goForCompilationUnit();
-
- /* scanners initialization */
- char[] contents = sourceUnit.getContents();
- this.scanner.setSource(contents);
- if (end != -1) this.scanner.resetTo(start, end);
- if (this.javadocParser != null && this.javadocParser.checkDocComment) {
- this.javadocParser.scanner.setSource(contents);
- if (end != -1) {
- this.javadocParser.scanner.resetTo(start, end);
- }
- }
- /* unit creation */
- this.referenceContext =
- this.compilationUnit =
- new CompilationUnitDeclaration(
- this.problemReporter,
- compilationResult,
- this.scanner.source.length);
- /* run automaton */
- parse();
- } finally {
- unit = this.compilationUnit;
- this.compilationUnit = null; // reset parser
- // tag unit has having read bodies
- if (!this.diet) unit.bits |= ASTNode.HasAllMethodBodies;
- }
- return unit;
-}
public ASTNode[] parseClassBodyDeclarations(char[] source, int offset, int length, CompilationUnitDeclaration unit) {
/* automaton initialization */
initialize();
@@ -5899,6 +8645,48 @@ protected void pushOnExpressionStackLengthStack(int pos) {
}
this.expressionLengthStack[this.expressionLengthPtr] = pos;
}
+protected void pushOnGenericsStack(ASTNode node) {
+ /*add a new obj on top of the generics stack
+ genericsPtr points on the top*/
+
+ int stackLength = this.genericsStack.length;
+ if (++this.genericsPtr >= stackLength) {
+ System.arraycopy(
+ this.genericsStack, 0,
+ this.genericsStack = new ASTNode[stackLength + GenericsStackIncrement], 0,
+ stackLength);
+ }
+ this.genericsStack[this.genericsPtr] = node;
+
+ stackLength = this.genericsLengthStack.length;
+ if (++this.genericsLengthPtr >= stackLength) {
+ System.arraycopy(
+ this.genericsLengthStack, 0,
+ this.genericsLengthStack = new int[stackLength + GenericsStackIncrement], 0,
+ stackLength);
+ }
+ this.genericsLengthStack[this.genericsLengthPtr] = 1;
+}
+protected void pushOnGenericsIdentifiersLengthStack(int pos) {
+ int stackLength = this.genericsIdentifiersLengthStack.length;
+ if (++this.genericsIdentifiersLengthPtr >= stackLength) {
+ System.arraycopy(
+ this.genericsIdentifiersLengthStack, 0,
+ this.genericsIdentifiersLengthStack = new int[stackLength + GenericsStackIncrement], 0,
+ stackLength);
+ }
+ this.genericsIdentifiersLengthStack[this.genericsIdentifiersLengthPtr] = pos;
+}
+protected void pushOnGenericsLengthStack(int pos) {
+ int stackLength = this.genericsLengthStack.length;
+ if (++this.genericsLengthPtr >= stackLength) {
+ System.arraycopy(
+ this.genericsLengthStack, 0,
+ this.genericsLengthStack = new int[stackLength + GenericsStackIncrement], 0,
+ stackLength);
+ }
+ this.genericsLengthStack[this.genericsLengthPtr] = pos;
+}
protected void pushOnIntStack(int pos) {
int stackLength = this.intStack.length;
@@ -5921,104 +8709,6 @@ protected void pushOnRealBlockStack(int i){
}
this.realBlockStack[this.realBlockPtr] = i;
}
-protected static char[] readTable(String filename) throws java.io.IOException {
-
- //files are located at Parser.class directory
-
- InputStream stream = Parser.class.getResourceAsStream(filename);
- if (stream == null) {
- throw new java.io.IOException(Util.bind("parser.missingFile",filename)); //$NON-NLS-1$
- }
- byte[] bytes = null;
- try {
- stream = new BufferedInputStream(stream);
- bytes = Util.getInputStreamAsByteArray(stream, -1);
- } finally {
- try {
- stream.close();
- } catch (IOException e) {
- // ignore
- }
- }
-
- //minimal integrity check (even size expected)
- int length = bytes.length;
- if (length % 2 != 0)
- throw new java.io.IOException(Util.bind("parser.corruptedFile",filename)); //$NON-NLS-1$
-
- // convert bytes into chars
- char[] chars = new char[length / 2];
- int i = 0;
- int charIndex = 0;
-
- while (true) {
- chars[charIndex++] = (char) (((bytes[i++] & 0xFF) << 8) + (bytes[i++] & 0xFF));
- if (i == length)
- break;
- }
- return chars;
-}
-protected static byte[] readByteTable(String filename) throws java.io.IOException {
-
- //files are located at Parser.class directory
-
- InputStream stream = Parser.class.getResourceAsStream(filename);
- if (stream == null) {
- throw new java.io.IOException(Util.bind("parser.missingFile",filename)); //$NON-NLS-1$
- }
- byte[] bytes = null;
- try {
- stream = new BufferedInputStream(stream);
- bytes = Util.getInputStreamAsByteArray(stream, -1);
- } finally {
- try {
- stream.close();
- } catch (IOException e) {
- // ignore
- }
- }
- return bytes;
-}
-protected static String[] readReadableNameTable(String filename) {
- String[] result = new String[name.length];
-
- ResourceBundle bundle;
- try {
- bundle = ResourceBundle.getBundle(filename, Locale.getDefault());
- } catch(MissingResourceException e) {
- System.out.println("Missing resource : " + filename.replace('.', '/') + ".properties for locale " + Locale.getDefault()); //$NON-NLS-1$//$NON-NLS-2$
- throw e;
- }
- for (int i = 0; i < NT_OFFSET + 1; i++) {
- result[i] = name[i];
- }
- for (int i = NT_OFFSET; i < name.length; i++) {
- try {
- String n = bundle.getString(name[i]);
- if(n != null && n.length() > 0) {
- result[i] = n;
- } else {
- result[i] = name[i];
- }
- } catch(MissingResourceException e) {
- result[i] = name[i];
- }
- }
- return result;
-}
-
-protected static String[] readNameTable(String filename) throws java.io.IOException {
- char[] contents = readTable(filename);
- char[][] nameAsChar = CharOperation.splitOn('\n', contents);
-
- String[] result = new String[nameAsChar.length + 1];
- result[0] = null;
- for (int i = 0; i < nameAsChar.length; i++) {
- result[i + 1] = new String(nameAsChar[i]);
- }
-
- return result;
-}
public void recoveryExitFromVariable() {
if(this.currentElement != null && this.currentElement.parent != null) {
if(this.currentElement instanceof RecoveredLocalVariable) {
@@ -6076,6 +8766,68 @@ public void recoveryTokenCheck() {
}
this.ignoreNextOpeningBrace = false;
}
+// A P I
+protected void reportSyntaxErrors(boolean isDietParse, int oldFirstToken) {
+ if(this.referenceContext instanceof MethodDeclaration) {
+ MethodDeclaration methodDeclaration = (MethodDeclaration) this.referenceContext;
+ if(methodDeclaration.errorInSignature){
+ return;
+ }
+ }
+ this.compilationUnit.compilationResult.lineSeparatorPositions = this.scanner.getLineEnds();
+ this.scanner.recordLineSeparator = false;
+
+ int start = this.scanner.initialPosition;
+ int end = this.scanner.eofPosition <= Integer.MAX_VALUE ? this.scanner.eofPosition - 1 : this.scanner.eofPosition;
+ if(isDietParse) {
+ TypeDeclaration[] types = this.compilationUnit.types;
+
+ int[][] intervalToSkip = org.eclipse.jdt.internal.compiler.parser.diagnose.RangeUtil.computeDietRange(types);
+ DiagnoseParser diagnoseParser = new DiagnoseParser(this, oldFirstToken, start, end, intervalToSkip[0], intervalToSkip[1], intervalToSkip[2], this.options);
+ diagnoseParser.diagnoseParse();
+
+ reportSyntaxErrorsForSkippedMethod(types);
+ this.scanner.resetTo(start, end);
+ } else {
+ DiagnoseParser diagnoseParser = new DiagnoseParser(this, oldFirstToken, start, end, this.options);
+ diagnoseParser.diagnoseParse();
+ }
+}
+private void reportSyntaxErrorsForSkippedMethod(TypeDeclaration[] types){
+ if(types != null) {
+ for (int i = 0; i < types.length; i++) {
+ TypeDeclaration[] memberTypes = types[i].memberTypes;
+ if(memberTypes != null) {
+ reportSyntaxErrorsForSkippedMethod(memberTypes);
+ }
+
+ AbstractMethodDeclaration[] methods = types[i].methods;
+ if(methods != null) {
+ for (int j = 0; j < methods.length; j++) {
+ AbstractMethodDeclaration method = methods[j];
+ if(methods[j].errorInSignature) {
+ DiagnoseParser diagnoseParser = new DiagnoseParser(this, TokenNameDIVIDE, method.declarationSourceStart, method.declarationSourceEnd, this.options);
+ diagnoseParser.diagnoseParse();
+ }
+ }
+ }
+
+ FieldDeclaration[] fields = types[i].fields;
+ if (fields != null) {
+ int length = fields.length;
+ for (int j = 0; j < length; j++) {
+ if (fields[j] instanceof Initializer) {
+ Initializer initializer = (Initializer)fields[j];
+ if(initializer.errorInSignature){
+ DiagnoseParser diagnoseParser = new DiagnoseParser(this, TokenNameRIGHT_SHIFT, initializer.declarationSourceStart, initializer.declarationSourceEnd, this.options);
+ diagnoseParser.diagnoseParse();
+ }
+ }
+ }
+ }
+ }
+ }
+}
protected void resetModifiers() {
this.modifiers = AccDefault;
this.modifiersSourceStart = -1; // <-- see comment into modifiersFlag(int)
@@ -6099,8 +8851,13 @@ protected void resetStacks() {
this.realBlockStack[this.realBlockPtr = 0] = 0;
this.recoveredStaticInitializerStart = 0;
this.listLength = 0;
+ this.listTypeParameterLength = 0;
// Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=29365
if (this.scanner != null) this.scanner.currentLine = null;
+
+ this.genericsIdentifiersLengthPtr = -1;
+ this.genericsLengthPtr = -1;
+ this.genericsPtr = -1;
}
/*
* Reset context so as to resume to regular parse loop
@@ -6155,43 +8912,54 @@ protected boolean resumeOnSyntaxError() {
/* attempt to reset state in order to resume to parse loop */
return this.resumeAfterRecovery();
}
-public static int tAction(int state, int sym) {
- return term_action[term_check[base_action[state]+sym] == sym ? base_action[state] + sym : base_action[state]];
-}
public String toString() {
- String s = "identifierStack : char[][] = {"; //$NON-NLS-1$
+ String s = "identifierStack : char["+(this.identifierPtr + 1)+"][] = {"; //$NON-NLS-1$ //$NON-NLS-2$
for (int i = 0; i <= this.identifierPtr; i++) {
s = s + "\"" + String.valueOf(this.identifierStack[i]) + "\","; //$NON-NLS-1$ //$NON-NLS-2$
}
s = s + "}\n"; //$NON-NLS-1$
- s = s + "identierLengthStack : int[] = {"; //$NON-NLS-1$
+ s = s + "identifierLengthStack : int["+(this.identifierLengthPtr + 1)+"] = {"; //$NON-NLS-1$ //$NON-NLS-2$
for (int i = 0; i <= this.identifierLengthPtr; i++) {
s = s + this.identifierLengthStack[i] + ","; //$NON-NLS-1$
}
s = s + "}\n"; //$NON-NLS-1$
- s = s + "astLengthStack : int[] = {"; //$NON-NLS-1$
+ s = s + "astLengthStack : int["+(this.astLengthPtr + 1)+"] = {"; //$NON-NLS-1$ //$NON-NLS-2$
for (int i = 0; i <= this.astLengthPtr; i++) {
s = s + this.astLengthStack[i] + ","; //$NON-NLS-1$
}
s = s + "}\n"; //$NON-NLS-1$
s = s + "astPtr : int = " + String.valueOf(this.astPtr) + "\n"; //$NON-NLS-1$ //$NON-NLS-2$
- s = s + "intStack : int[] = {"; //$NON-NLS-1$
+ s = s + "intStack : int["+(this.intPtr + 1)+"] = {"; //$NON-NLS-1$ //$NON-NLS-2$
for (int i = 0; i <= this.intPtr; i++) {
s = s + this.intStack[i] + ","; //$NON-NLS-1$
}
s = s + "}\n"; //$NON-NLS-1$
- s = s + "expressionLengthStack : int[] = {"; //$NON-NLS-1$
+ s = s + "expressionLengthStack : int["+(this.expressionLengthPtr + 1)+"] = {"; //$NON-NLS-1$ //$NON-NLS-2$
for (int i = 0; i <= this.expressionLengthPtr; i++) {
s = s + this.expressionLengthStack[i] + ","; //$NON-NLS-1$
}
s = s + "}\n"; //$NON-NLS-1$
s = s + "expressionPtr : int = " + String.valueOf(this.expressionPtr) + "\n"; //$NON-NLS-1$ //$NON-NLS-2$
+
+ s = s + "genericsIdentifiersLengthStack : int["+(this.genericsIdentifiersLengthPtr + 1)+"] = {"; //$NON-NLS-1$ //$NON-NLS-2$
+ for (int i = 0; i <= this.genericsIdentifiersLengthPtr; i++) {
+ s = s + this.genericsIdentifiersLengthStack[i] + ","; //$NON-NLS-1$
+ }
+ s = s + "}\n"; //$NON-NLS-1$
+
+ s = s + "genericsLengthStack : int["+(this.genericsLengthPtr + 1)+"] = {"; //$NON-NLS-1$ //$NON-NLS-2$
+ for (int i = 0; i <= this.genericsLengthPtr; i++) {
+ s = s + this.genericsLengthStack[i] + ","; //$NON-NLS-1$
+ }
+ s = s + "}\n"; //$NON-NLS-1$
+
+ s = s + "genericsPtr : int = " + String.valueOf(this.genericsPtr) + "\n"; //$NON-NLS-1$ //$NON-NLS-2$
s = s + "\n\n\n----------------Scanner--------------\n" + this.scanner.toString(); //$NON-NLS-1$
return s;
@@ -6234,11 +9002,11 @@ protected void updateSourceDeclarationParts(int variableDeclaratorsCounter) {
protected void updateSourcePosition(Expression exp) {
//update the source Position of the expression
- //intStack : int int
+ //this.intStack : int int
//-->
- //intStack :
+ //this.intStack :
exp.sourceEnd = this.intStack[this.intPtr--];
exp.sourceStart = this.intStack[this.intPtr--];
}
-}
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java
index bdb077bf72..5ef3a9dc3d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java
@@ -12,25 +12,23 @@ package org.eclipse.jdt.internal.compiler.parser;
/*An interface that contains static declarations for some basic information
about the parser such as the number of rules in the grammar, the starting state, etc...*/
-
public interface ParserBasicInformation {
- public final static int
- ERROR_SYMBOL = 105,
- MAX_NAME_LENGTH = 36,
- NUM_STATES = 597,
- NT_OFFSET = 105,
- SCOPE_UBOUND = 63,
- SCOPE_SIZE = 64,
- LA_STATE_OFFSET = 5981,
- MAX_LA = 1,
- NUM_RULES = 433,
- NUM_TERMINALS = 105,
- NUM_NON_TERMINALS = 203,
- NUM_SYMBOLS = 308,
- START_STATE = 529,
- EOFT_SYMBOL = 54,
- EOLT_SYMBOL = 54,
- ACCEPT_ACTION = 5980,
- ERROR_ACTION = 5981;
-}
+ int ERROR_SYMBOL = 108,
+ MAX_NAME_LENGTH = 41,
+ NUM_STATES = 928,
+ NT_OFFSET = 108,
+ SCOPE_UBOUND = 128,
+ SCOPE_SIZE = 129,
+ LA_STATE_OFFSET = 11283,
+ MAX_LA = 1,
+ NUM_RULES = 666,
+ NUM_TERMINALS = 108,
+ NUM_NON_TERMINALS = 296,
+ NUM_SYMBOLS = 404,
+ START_STATE = 762,
+ EOFT_SYMBOL = 68,
+ EOLT_SYMBOL = 68,
+ ACCEPT_ACTION = 11282,
+ ERROR_ACTION = 11283;
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java
index b76bf04442..98aab657cd 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java
@@ -391,7 +391,7 @@ public void updateFromParserState(){
}
}
if(canConsume) {
- parser.consumeMethodHeaderParameters();
+ parser.consumeMethodHeaderRightParen();
/* fix-up positions, given they were updated against rParenPos, which did not get set */
if (parser.currentElement == this){ // parameter addition might have added an awaiting (no return type) method - see 1FVXQZ4 */
methodDeclaration.sourceEnd = methodDeclaration.arguments[methodDeclaration.arguments.length-1].sourceEnd;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java
index 9ac355eca7..16a3fe4127 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java
@@ -17,6 +17,7 @@ import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Initializer;
import org.eclipse.jdt.internal.compiler.ast.Statement;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.eclipse.jdt.internal.compiler.lookup.CompilerModifiers;
@@ -179,7 +180,11 @@ public int bodyEnd(){
public boolean bodyStartsAtHeaderEnd(){
if (typeDeclaration.superInterfaces == null){
if (typeDeclaration.superclass == null){
- return typeDeclaration.bodyStart == typeDeclaration.sourceEnd+1;
+ if(typeDeclaration.typeParameters == null) {
+ return typeDeclaration.bodyStart == typeDeclaration.sourceEnd+1;
+ } else {
+ return typeDeclaration.bodyStart == typeDeclaration.typeParameters[typeDeclaration.typeParameters.length-1].sourceEnd+1;
+ }
} else {
return typeDeclaration.bodyStart == typeDeclaration.superclass.sourceEnd+1;
}
@@ -409,6 +414,30 @@ public void updateFromParserState(){
// will reset typeListLength to zero
// thus this check will only be performed on first errorCheck after class X implements Y,Z,
}
+ } else if (parser.listTypeParameterLength > 0) {
+ int length = parser.listTypeParameterLength;
+ int genericsPtr = parser.genericsPtr;
+ boolean canConsume = genericsPtr + 1 >= length && parser.astPtr > -1;
+ if(canConsume) {
+ if (!(parser.astStack[parser.astPtr] instanceof TypeDeclaration)) {
+ canConsume = false;
+ }
+ while(genericsPtr + 1 > length && !(parser.genericsStack[genericsPtr] instanceof TypeParameter)) {
+ genericsPtr--;
+ }
+ for (int i = 0; i < length; i++) {
+ if(!(parser.genericsStack[genericsPtr - i] instanceof TypeParameter)) {
+ canConsume = false;
+ }
+ }
+ }
+ if(canConsume) {
+ TypeDeclaration typeDecl = (TypeDeclaration)parser.astStack[parser.astPtr];
+ System.arraycopy(parser.genericsStack, genericsPtr - length + 1, typeDecl.typeParameters = new TypeParameter[length], 0, length);
+ typeDecl.bodyStart = typeDecl.typeParameters[length-1].declarationSourceEnd + 1;
+ parser.listTypeParameterLength = 0;
+ parser.lastCheckPoint = typeDecl.bodyStart;
+ }
}
}
}
@@ -440,6 +469,9 @@ public RecoveredElement updateOnOpeningBrace(int braceStart, int braceEnd){
case -1 :
case TokenNameextends :
case TokenNameimplements :
+ case TokenNameGREATER :
+ case TokenNameRIGHT_SHIFT :
+ case TokenNameUNSIGNED_RIGHT_SHIFT :
if (parser.recoveredStaticInitializerStart == 0) break;
default:
this.foundOpeningBrace = true;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
index ecd2e33340..2995107ab3 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
@@ -34,9 +34,8 @@ public class Scanner implements TerminalTokens {
- sourceStart gives the position into the stream
- currentPosition-1 gives the sourceEnd position into the stream
*/
-
+ private long sourceLevel;
// 1.4 feature
- private boolean assertMode = false;
public boolean useAssertAsAnIndentifier = false;
//flag indicating if processed source contains occurrences of keyword assert
public boolean containsAssertKeyword = false;
@@ -146,6 +145,9 @@ public class Scanner implements TerminalTokens {
public boolean checkNonExternalizedStringLiterals = false;
public boolean wasNonExternalizedStringLiteral = false;
+ // generic support
+ public boolean returnOnlyGreater = false;
+
/*static*/ {
for (int i = 0; i < 6; i++) {
for (int j = 0; j < TableSize; j++) {
@@ -183,7 +185,7 @@ public Scanner(
this.tokenizeComments = tokenizeComments;
this.tokenizeWhiteSpace = tokenizeWhiteSpace;
this.checkNonExternalizedStringLiterals = checkNonExternalizedStringLiterals;
- this.assertMode = sourceLevel >= ClassFileConstants.JDK1_4;
+ this.sourceLevel = sourceLevel;
this.taskTags = taskTags;
this.taskPriorities = taskPriorities;
this.isTaskCaseSensitive = isTaskCaseSensitive;
@@ -925,6 +927,13 @@ public int getNextToken() throws InvalidInputException {
// ---------Identify the next token-------------
switch (this.currentCharacter) {
+ case '@' :
+/* if (this.sourceLevel >= ClassFileConstants.JDK1_5) {
+ return TokenNameAT;
+ } else {
+ return TokenNameERROR;
+ }*/
+ return TokenNameAT;
case '(' :
return TokenNameLPAREN;
case ')' :
@@ -942,9 +951,37 @@ public int getNextToken() throws InvalidInputException {
case ',' :
return TokenNameCOMMA;
case '.' :
- if (getNextCharAsDigit())
+ if (getNextCharAsDigit()) {
return scanNumber(true);
- return TokenNameDOT;
+ }
+/* if (this.sourceLevel >= ClassFileConstants.JDK1_5) {
+ int temp = this.currentPosition;
+ if (getNextChar('.')) {
+ if (getNextChar('.')) {
+ return TokenNameELLIPSIS;
+ } else {
+ this.currentPosition = temp;
+ return TokenNameDOT;
+ }
+ } else {
+ this.currentPosition = temp;
+ return TokenNameDOT;
+ }
+ } else {
+ return TokenNameDOT;
+ }*/
+ int temp = this.currentPosition;
+ if (getNextChar('.')) {
+ if (getNextChar('.')) {
+ return TokenNameELLIPSIS;
+ } else {
+ this.currentPosition = temp;
+ return TokenNameDOT;
+ }
+ } else {
+ this.currentPosition = temp;
+ return TokenNameDOT;
+ }
case '+' :
{
int test;
@@ -992,6 +1029,9 @@ public int getNextToken() throws InvalidInputException {
case '>' :
{
int test;
+ if (this.returnOnlyGreater) {
+ return TokenNameGREATER;
+ }
if ((test = getNextChar('=', '>')) == 0)
return TokenNameGREATER_EQUAL;
if (test > 0) {
@@ -2440,7 +2480,7 @@ public int scanIdentifierOrKeyword() {
&& (data[++index] == 'e')
&& (data[++index] == 'r')
&& (data[++index] == 't')) {
- if (this.assertMode) {
+ if (this.sourceLevel >= ClassFileConstants.JDK1_4) {
this.containsAssertKeyword = true;
return TokenNameassert;
} else {
@@ -2565,8 +2605,17 @@ public int scanIdentifierOrKeyword() {
case 4 :
if ((data[++index] == 'l') && (data[++index] == 's') && (data[++index] == 'e'))
return TokenNameelse;
- else
- return TokenNameIdentifier;
+ else if ((data[index] == 'n')
+ && (data[++index] == 'u')
+ && (data[++index] == 'm')) {
+ if (this.sourceLevel >= ClassFileConstants.JDK1_5) {
+ return TokenNameenum;
+ } else {
+ return TokenNameIdentifier;
+ }
+ } else {
+ return TokenNameIdentifier;
+ }
case 7 :
if ((data[++index] == 'x')
&& (data[++index] == 't')
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java
index c05ff331aa..5852dbb7fc 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java
@@ -8,9 +8,8 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-
package org.eclipse.jdt.internal.compiler.parser;
-
+
/**
* IMPORTANT NOTE: These constants are dedicated to the internal Scanner implementation.
* It is mirrored in org.eclipse.jdt.core.compiler public package where it is API.
@@ -18,7 +17,6 @@ package org.eclipse.jdt.internal.compiler.parser;
* definitions (stable with 2.0), whereas the internal implementation uses TerminalTokens
* which constant values reflect the latest parser generation state.
*/
-
/**
* Maps each terminal symbol in the java-grammar into a unique integer.
* This integer is used to represent the terminal when computing a parsing action.
@@ -30,116 +28,117 @@ package org.eclipse.jdt.internal.compiler.parser;
public interface TerminalTokens {
// special tokens not part of grammar - not autogenerated
- int
- TokenNameWHITESPACE = 1000,
+ int TokenNameWHITESPACE = 1000,
TokenNameCOMMENT_LINE = 1001,
TokenNameCOMMENT_BLOCK = 1002,
TokenNameCOMMENT_JAVADOC = 1003;
-
- int
- TokenNameIdentifier = 28,
- TokenNameabstract = 60,
- TokenNameassert = 71,
- TokenNameboolean = 31,
- TokenNamebreak = 72,
- TokenNamebyte = 32,
- TokenNamecase = 83,
- TokenNamecatch = 86,
- TokenNamechar = 33,
- TokenNameclass = 81,
- TokenNamecontinue = 73,
- TokenNamedefault = 84,
- TokenNamedo = 74,
- TokenNamedouble = 34,
- TokenNameelse = 87,
- TokenNameextends = 91,
- TokenNamefalse = 44,
- TokenNamefinal = 61,
- TokenNamefinally = 88,
- TokenNamefloat = 35,
- TokenNamefor = 75,
- TokenNameif = 76,
- TokenNameimplements = 103,
- TokenNameimport = 82,
- TokenNameinstanceof = 13,
- TokenNameint = 36,
- TokenNameinterface = 89,
- TokenNamelong = 37,
- TokenNamenative = 62,
- TokenNamenew = 41,
- TokenNamenull = 45,
- TokenNamepackage = 85,
- TokenNameprivate = 63,
- TokenNameprotected = 64,
- TokenNamepublic = 65,
- TokenNamereturn = 77,
- TokenNameshort = 38,
- TokenNamestatic = 57,
- TokenNamestrictfp = 66,
- TokenNamesuper = 42,
- TokenNameswitch = 78,
- TokenNamesynchronized = 55,
- TokenNamethis = 43,
- TokenNamethrow = 79,
- TokenNamethrows = 104,
- TokenNametransient = 67,
- TokenNametrue = 46,
- TokenNametry = 80,
- TokenNamevoid = 39,
- TokenNamevolatile = 68,
- TokenNamewhile = 70,
- TokenNameIntegerLiteral = 47,
- TokenNameLongLiteral = 48,
- TokenNameFloatingPointLiteral = 49,
- TokenNameDoubleLiteral = 50,
- TokenNameCharacterLiteral = 51,
- TokenNameStringLiteral = 52,
- TokenNamePLUS_PLUS = 7,
- TokenNameMINUS_MINUS = 8,
- TokenNameEQUAL_EQUAL = 18,
- TokenNameLESS_EQUAL = 14,
- TokenNameGREATER_EQUAL = 15,
- TokenNameNOT_EQUAL = 19,
- TokenNameLEFT_SHIFT = 11,
- TokenNameRIGHT_SHIFT = 9,
- TokenNameUNSIGNED_RIGHT_SHIFT = 10,
- TokenNamePLUS_EQUAL = 92,
- TokenNameMINUS_EQUAL = 93,
- TokenNameMULTIPLY_EQUAL = 94,
- TokenNameDIVIDE_EQUAL = 95,
- TokenNameAND_EQUAL = 96,
- TokenNameOR_EQUAL = 97,
- TokenNameXOR_EQUAL = 98,
- TokenNameREMAINDER_EQUAL = 99,
- TokenNameLEFT_SHIFT_EQUAL = 100,
- TokenNameRIGHT_SHIFT_EQUAL = 101,
- TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = 102,
- TokenNameOR_OR = 24,
- TokenNameAND_AND = 25,
- TokenNamePLUS = 1,
- TokenNameMINUS = 2,
- TokenNameNOT = 58,
- TokenNameREMAINDER = 5,
- TokenNameXOR = 21,
- TokenNameAND = 20,
- TokenNameMULTIPLY = 4,
- TokenNameOR = 22,
- TokenNameTWIDDLE = 56,
- TokenNameDIVIDE = 6,
- TokenNameGREATER = 16,
- TokenNameLESS = 17,
- TokenNameLPAREN = 27,
- TokenNameRPAREN = 29,
- TokenNameLBRACE = 59,
- TokenNameRBRACE = 40,
- TokenNameLBRACKET = 12,
- TokenNameRBRACKET = 69,
- TokenNameSEMICOLON = 23,
- TokenNameQUESTION = 26,
- TokenNameCOLON = 53,
- TokenNameCOMMA = 30,
- TokenNameDOT = 3,
- TokenNameEQUAL = 90,
- TokenNameEOF = 54,
- TokenNameERROR = 105;
-}
+
+ int TokenNameIdentifier = 27,
+ TokenNameabstract = 56,
+ TokenNameassert = 75,
+ TokenNameboolean = 32,
+ TokenNamebreak = 76,
+ TokenNamebyte = 33,
+ TokenNamecase = 100,
+ TokenNamecatch = 101,
+ TokenNamechar = 34,
+ TokenNameclass = 71,
+ TokenNamecontinue = 77,
+ TokenNamedefault = 98,
+ TokenNamedo = 78,
+ TokenNamedouble = 35,
+ TokenNameelse = 102,
+ TokenNameenum = 103,
+ TokenNameextends = 86,
+ TokenNamefalse = 44,
+ TokenNamefinal = 57,
+ TokenNamefinally = 104,
+ TokenNamefloat = 36,
+ TokenNamefor = 79,
+ TokenNameif = 80,
+ TokenNameimplements = 105,
+ TokenNameimport = 99,
+ TokenNameinstanceof = 12,
+ TokenNameint = 37,
+ TokenNameinterface = 72,
+ TokenNamelong = 38,
+ TokenNamenative = 58,
+ TokenNamenew = 43,
+ TokenNamenull = 45,
+ TokenNamepackage = 85,
+ TokenNameprivate = 59,
+ TokenNameprotected = 60,
+ TokenNamepublic = 61,
+ TokenNamereturn = 81,
+ TokenNameshort = 39,
+ TokenNamestatic = 54,
+ TokenNamestrictfp = 62,
+ TokenNamesuper = 41,
+ TokenNameswitch = 82,
+ TokenNamesynchronized = 55,
+ TokenNamethis = 42,
+ TokenNamethrow = 83,
+ TokenNamethrows = 106,
+ TokenNametransient = 63,
+ TokenNametrue = 46,
+ TokenNametry = 84,
+ TokenNamevoid = 40,
+ TokenNamevolatile = 64,
+ TokenNamewhile = 73,
+ TokenNameIntegerLiteral = 47,
+ TokenNameLongLiteral = 48,
+ TokenNameFloatingPointLiteral = 49,
+ TokenNameDoubleLiteral = 50,
+ TokenNameCharacterLiteral = 51,
+ TokenNameStringLiteral = 52,
+ TokenNamePLUS_PLUS = 9,
+ TokenNameMINUS_MINUS = 10,
+ TokenNameEQUAL_EQUAL = 18,
+ TokenNameLESS_EQUAL = 14,
+ TokenNameGREATER_EQUAL = 15,
+ TokenNameNOT_EQUAL = 19,
+ TokenNameLEFT_SHIFT = 17,
+ TokenNameRIGHT_SHIFT = 8,
+ TokenNameUNSIGNED_RIGHT_SHIFT = 11,
+ TokenNamePLUS_EQUAL = 87,
+ TokenNameMINUS_EQUAL = 88,
+ TokenNameMULTIPLY_EQUAL = 89,
+ TokenNameDIVIDE_EQUAL = 90,
+ TokenNameAND_EQUAL = 91,
+ TokenNameOR_EQUAL = 92,
+ TokenNameXOR_EQUAL = 93,
+ TokenNameREMAINDER_EQUAL = 94,
+ TokenNameLEFT_SHIFT_EQUAL = 95,
+ TokenNameRIGHT_SHIFT_EQUAL = 96,
+ TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = 97,
+ TokenNameOR_OR = 26,
+ TokenNameAND_AND = 25,
+ TokenNamePLUS = 1,
+ TokenNameMINUS = 2,
+ TokenNameNOT = 69,
+ TokenNameREMAINDER = 5,
+ TokenNameXOR = 21,
+ TokenNameAND = 20,
+ TokenNameMULTIPLY = 4,
+ TokenNameOR = 22,
+ TokenNameTWIDDLE = 67,
+ TokenNameDIVIDE = 6,
+ TokenNameGREATER = 16,
+ TokenNameLESS = 7,
+ TokenNameLPAREN = 28,
+ TokenNameRPAREN = 29,
+ TokenNameLBRACE = 66,
+ TokenNameRBRACE = 31,
+ TokenNameLBRACKET = 13,
+ TokenNameRBRACKET = 70,
+ TokenNameSEMICOLON = 24,
+ TokenNameQUESTION = 23,
+ TokenNameCOLON = 65,
+ TokenNameCOMMA = 30,
+ TokenNameDOT = 3,
+ TokenNameEQUAL = 74,
+ TokenNameAT = 53,
+ TokenNameELLIPSIS = 107,
+ TokenNameEOF = 68,
+ TokenNameERROR = 108;
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java
index 58e0506e94..6c53f6a0d3 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java
@@ -11,6 +11,7 @@
package org.eclipse.jdt.internal.compiler.parser.diagnose;
import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.parser.Parser;
import org.eclipse.jdt.internal.compiler.parser.ParserBasicInformation;
import org.eclipse.jdt.internal.compiler.parser.TerminalTokens;
@@ -18,6 +19,7 @@ import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
public class DiagnoseParser implements ParserBasicInformation, TerminalTokens {
private static final boolean DEBUG = false;
+ private boolean DEBUG_PARSECHECK = false;
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
private static final int STACK_INCREMENT = 256;
@@ -39,6 +41,8 @@ public class DiagnoseParser implements ParserBasicInformation, TerminalTokens {
private static final int MAX_DISTANCE = 30;
private static final int MIN_DISTANCE = 3;
+ private CompilerOptions options;
+
private LexStream lexStream;
private int errorToken;
private int errorTokenStart;
@@ -133,12 +137,13 @@ public class DiagnoseParser implements ParserBasicInformation, TerminalTokens {
}
}
- public DiagnoseParser(Parser parser, int firstToken, int start, int end) {
- this(parser, firstToken, start, end, new int[0], new int[0], new int[0]);
+ public DiagnoseParser(Parser parser, int firstToken, int start, int end, CompilerOptions options) {
+ this(parser, firstToken, start, end, new int[0], new int[0], new int[0], options);
}
- public DiagnoseParser(Parser parser, int firstToken, int start, int end, int[] intervalStartToSkip, int[] intervalEndToSkip, int[] intervalFlagsToSkip) {
+ public DiagnoseParser(Parser parser, int firstToken, int start, int end, int[] intervalStartToSkip, int[] intervalEndToSkip, int[] intervalFlagsToSkip, CompilerOptions options) {
this.parser = parser;
+ this.options = options;
this.lexStream = new LexStream(BUFF_SIZE, parser.scanner, intervalStartToSkip, intervalEndToSkip, intervalFlagsToSkip, firstToken, start, end);
}
@@ -1912,6 +1917,9 @@ public class DiagnoseParser implements ParserBasicInformation, TerminalTokens {
act = stck[stack_top];
if (first_token > NT_OFFSET) {
tempStackTop = stack_top;
+ if(DEBUG_PARSECHECK) {
+ System.out.println(tempStackTop);
+ }
max_pos = stack_top;
indx = buffer_position;
ct = lexStream.kind(buffer[indx]);
@@ -1919,8 +1927,26 @@ public class DiagnoseParser implements ParserBasicInformation, TerminalTokens {
int lhs_symbol = first_token - NT_OFFSET;
act = Parser.ntAction(act, lhs_symbol);
if (act <= NUM_RULES) {
+ // same loop as 'process_non_terminal'
do {
tempStackTop -= (Parser.rhs[act]-1);
+
+ if(DEBUG_PARSECHECK) {
+ System.out.print(tempStackTop);
+ System.out.print(" ("); //$NON-NLS-1$
+ System.out.print(-(Parser.rhs[act]-1));
+ System.out.print(") [max:"); //$NON-NLS-1$
+ System.out.print(max_pos);
+ System.out.print("]\tprocess_non_terminal\t"); //$NON-NLS-1$
+ System.out.print(act);
+ System.out.print("\t"); //$NON-NLS-1$
+ System.out.print(Parser.name[Parser.non_terminal_index[Parser.lhs[act]]]);
+ System.out.println();
+ }
+
+ if(Parser.rules_compliance[act] > this.options.sourceLevel) {
+ return 0;
+ }
lhs_symbol = Parser.lhs[act];
act = (tempStackTop > max_pos
? tempStack[tempStackTop]
@@ -1932,6 +1958,11 @@ public class DiagnoseParser implements ParserBasicInformation, TerminalTokens {
}
} else {
tempStackTop = stack_top - 1;
+
+ if(DEBUG_PARSECHECK) {
+ System.out.println(tempStackTop);
+ }
+
max_pos = tempStackTop;
indx = buffer_position - 1;
ct = first_token;
@@ -1939,6 +1970,17 @@ public class DiagnoseParser implements ParserBasicInformation, TerminalTokens {
}
process_terminal: for (;;) {
+ if(DEBUG_PARSECHECK) {
+ System.out.print(tempStackTop + 1);
+ System.out.print(" (+1) [max:"); //$NON-NLS-1$
+ System.out.print(max_pos);
+ System.out.print("]\tprocess_terminal \t"); //$NON-NLS-1$
+ System.out.print(ct);
+ System.out.print("\t"); //$NON-NLS-1$
+ System.out.print(Parser.name[Parser.terminal_index[ct]]);
+ System.out.println();
+ }
+
if (++tempStackTop >= stackLength) // Stack overflow!!!
return indx;
tempStack[tempStackTop] = act;
@@ -1947,6 +1989,14 @@ public class DiagnoseParser implements ParserBasicInformation, TerminalTokens {
if (act <= NUM_RULES) { // reduce action
tempStackTop--;
+
+ if(DEBUG_PARSECHECK) {
+ System.out.print(tempStackTop);
+ System.out.print(" (-1) [max:"); //$NON-NLS-1$
+ System.out.print(max_pos);
+ System.out.print("]\treduce"); //$NON-NLS-1$
+ System.out.println();
+ }
} else if (act < ACCEPT_ACTION || // shift action
act > ERROR_ACTION) { // shift-reduce action
if (indx == MAX_DISTANCE)
@@ -1955,8 +2005,17 @@ public class DiagnoseParser implements ParserBasicInformation, TerminalTokens {
ct = lexStream.kind(buffer[indx]);
lexStream.reset(lexStream.next(buffer[indx]));
if (act > ERROR_ACTION) {
- act -= ERROR_ACTION;
+ act -= ERROR_ACTION;
+
+ if(DEBUG_PARSECHECK) {
+ System.out.print(tempStackTop);
+ System.out.print("\tshift reduce"); //$NON-NLS-1$
+ System.out.println();
+ }
} else {
+ if(DEBUG_PARSECHECK) {
+ System.out.println("\tshift"); //$NON-NLS-1$
+ }
continue process_terminal;
}
} else if (act == ACCEPT_ACTION) { // accept action
@@ -1965,9 +2024,29 @@ public class DiagnoseParser implements ParserBasicInformation, TerminalTokens {
return indx; // error action
}
+ // same loop as first token initialization
process_non_terminal:
do {
tempStackTop -= (Parser.rhs[act]-1);
+
+ if(DEBUG_PARSECHECK) {
+ System.out.print(tempStackTop);
+ System.out.print(" ("); //$NON-NLS-1$
+ System.out.print(-(Parser.rhs[act]-1));
+ System.out.print(") [max:"); //$NON-NLS-1$
+ System.out.print(max_pos);
+ System.out.print("]\tprocess_non_terminal\t"); //$NON-NLS-1$
+ System.out.print(act);
+ System.out.print("\t"); //$NON-NLS-1$
+ System.out.print(Parser.name[Parser.non_terminal_index[Parser.lhs[act]]]);
+ System.out.println();
+ }
+
+ if(act <= NUM_RULES) {
+ if(Parser.rules_compliance[act] > this.options.sourceLevel) {
+ return 0;
+ }
+ }
int lhs_symbol = Parser.lhs[act];
act = (tempStackTop > max_pos
? tempStack[tempStackTop]
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc
index a35d6d8daf..2eb7a430eb 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser10.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser10.rsc
index 57084e83b6..24f26101d6 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser10.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser10.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser11.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser11.rsc
index 4ed7d3b5b2..f3f99bf04f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser11.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser11.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc
index a114c91f3f..88798a74e6 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc
index 6b56156124..8bde9f6b47 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc
index e701a9e700..66c9975178 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc
index 44979131e0..4f7221cf2f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc
index 0046bb9f60..75a83ddbb5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc
index ca3af176f2..5cecaae824 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc
index 66f0156b57..341a8837a8 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc
index 0f1c471f48..1ac11b304b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc
@@ -1 +1 @@
-WWEEE;;X(((5EV5(((((S5F ZZ \ No newline at end of file
+ffFFFBBhAAA!BFeA dAI KK!BBB gJJH!G!!!! \ No newline at end of file
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc
index 3d7327b765..2fd2d34571 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc
index 8dc5ace328..d2e77e20b2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc
new file mode 100644
index 0000000000..4892af7fb4
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc
index 81f96e1cea..abd386be2a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc
index 2842e17833..b3f94b304b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc
index 26aa971004..75f6d98c3d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc
index 69c1580933..64ef663102 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc
index a4e445af87..c1f2c72ee4 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc
index 8ce79a7503..201874dc94 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc
index 6f684684b7..ac8da8bf5e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.properties b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.properties
index ecc98bf1fd..796779aba6 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.properties
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.properties
@@ -1,19 +1,38 @@
,opt=,
AbstractMethodDeclaration=AbstractMethodDeclaration
+AdditionalBound1=AdditionalBound1
+AdditionalBound=AdditionalBound
+AdditionalBoundList1=AdditionalBoundList1
+AdditionalBoundList=AdditionalBoundList
AdditiveExpression=Expression
+AdditiveExpression_NotName=Expression
AllocationHeader=AllocationHeader
AndExpression=Expression
+AndExpression_NotName=Expression
+Annotation=Annotation
+AnnotationTypeBody=AnnotationTypeBody
+AnnotationTypeDeclaration=AnnotationTypeDeclaration
+AnnotationTypeDeclarationHeader=AnnotationTypeDeclarationHeader
+AnnotationTypeMemberDeclaration=AnnotationTypeMemberDeclaration
+AnnotationTypeMemberDeclarationHeader=AnnotationTypeMemberDeclarationHeader
+AnnotationTypeMemberDeclarations=AnnotationTypeMemberDeclarations
+AnnotationTypeMemberDeclarationsopt=AnnotationTypeMemberDeclarationsopt
+AnnotationTypeMemberHeaderExtendedDims=AnnotationTypeMemberHeaderExtendedDims
ArgumentList=ArgumentList
ArgumentListopt=ArgumentList
+Arguments=Arguments
+Argumentsopt=Argumentsopt
ArrayAccess=ArrayAccess
ArrayCreationHeader=ArrayCreationHeader
ArrayCreationWithArrayInitializer=ArrayCreationWithArrayInitializer
ArrayCreationWithoutArrayInitializer=ArrayCreationWithoutArrayInitializer
ArrayInitializer=ArrayInitializer
ArrayType=ArrayType
+ArrayTypeWithTypeArgumentsName=ArrayTypeWithTypeArgumentsName
AssertStatement=AssertStatement
Assignment=Assignment
AssignmentExpression=Expression
+AssignmentExpression_NotName=Expression
AssignmentOperator=AssignmentOperator
Block=Block
BlockStatement=BlockStatement
@@ -30,6 +49,7 @@ ClassBody=ClassBody
ClassBodyDeclaration=ClassBodyDeclaration
ClassBodyDeclarations=ClassBodyDeclarations
ClassBodyDeclarationsopt=ClassBodyDeclarations
+ClassBodySimpleNameopt=ClassBody
ClassBodyopt=ClassBody
ClassDeclaration=ClassDeclaration
ClassHeader=ClassHeader
@@ -37,24 +57,31 @@ ClassHeaderExtends=ClassHeaderExtends
ClassHeaderExtendsopt=ClassHeaderExtends
ClassHeaderImplements=ClassHeaderImplements
ClassHeaderImplementsopt=ClassHeaderImplements
+ClassHeaderName1=ClassHeaderName
ClassHeaderName=ClassHeaderName
ClassInstanceCreationExpression=ClassInstanceCreationExpression
ClassInstanceCreationExpressionName=ClassInstanceCreationExpressionName
ClassMemberDeclaration=ClassMemberDeclaration
+ClassOrInterface=Type
ClassOrInterfaceType=Type
ClassType=ClassType
ClassTypeElt=ClassType
ClassTypeList=ClassTypeList
CompilationUnit=CompilationUnit
ConditionalAndExpression=Expression
+ConditionalAndExpression_NotName=Expression
ConditionalExpression=Expression
+ConditionalExpression_NotName=Expression
ConditionalOrExpression=Expression
+ConditionalOrExpression_NotName=Expression
ConstantDeclaration=ConstantDeclaration
ConstantExpression=ConstantExpression
ConstructorDeclaration=ConstructorDeclaration
-ConstructorHeader=ConstructorHeader
+ConstructorHeader=ConstructorDeclaration
ConstructorHeaderName=ConstructorHeaderName
ContinueStatement=ContinueStatement
+DefaultValue=DefaultValue
+DefaultValueopt=DefaultValueopt
Diet=Diet
DimWithOrWithOutExpr=Dimension
DimWithOrWithOutExprs=Dimensions
@@ -63,17 +90,32 @@ DimsLoop=Dimensions
Dimsopt=Dimensions
DoStatement=DoStatement
EmptyStatement=EmptyStatement
+EnhancedForStatement=EnhancedForStatement
+EnhancedForStatementHeader=EnhancedForStatementHeader
+EnhancedForStatementNoShortIf=EnhancedForStatementNoShortIf
EnterAnonymousClassBody=EnterAnonymousClassBody
+EnterAnonymousClassBodySimpleName=EnterAnonymousClassBodySimpleName
EnterCompilationUnit=EnterCompilationUnit
EnterVariable=EnterVariable
+EnumBody=EnumBody
+EnumBodyDeclarationsopt=EnumBodyDeclarationsopt
+EnumConstant=EnumConstant
+EnumConstantHeader=EnumConstantHeader
+EnumConstants=EnumConstants
+EnumDeclaration=EnumDeclaration
+EnumDeclarations=EnumDeclarations
+EnumHeader=EnumHeader
EqualityExpression=Expression
+EqualityExpression_NotName=Expression
ExclusiveOrExpression=Expression
+ExclusiveOrExpression_NotName=Expression
ExitTryBlock=ExitTryBlock
ExitVariableWithInitialization=ExitVariableWithInitialization
ExitVariableWithoutInitialization=ExitVariableWithoutInitialization
ExplicitConstructorInvocation=ExplicitConstructorInvocation
Expression=Expression
ExpressionStatement=Statement
+Expression_NotName=Expression
Expressionopt=Expression
FieldAccess=FieldAccess
FieldDeclaration=FieldDeclaration
@@ -92,29 +134,33 @@ FormalParameterListopt=FormalParameterList
GenericMethodDeclaration=GenericMethodDeclaration
Goal=Goal
Header=Header
-Headers=Headers
IfThenElseStatement=IfStatement
IfThenElseStatementNoShortIf=IfStatement
IfThenStatement=IfStatement
ImportDeclaration=ImportDeclaration
ImportDeclarations=ImportDeclarations
-ImportDeclarationsopt=ImportDeclarations
InclusiveOrExpression=Expression
+InclusiveOrExpression_NotName=Expression
Initializer=Initializer
InsideCastExpression=InsideCastExpression
InsideCastExpressionLL1=InsideCastExpression
+InsideCastExpressionWithQualifiedGenerics=InsideCastExpression
+InstanceofExpression=Expression
+InstanceofExpression_NotName=Expression
IntegralType=IntegralType
InterfaceBody=InterfaceBody
InterfaceDeclaration=InterfaceDeclaration
InterfaceHeader=InterfaceHeader
InterfaceHeaderExtends=InterfaceHeaderExtends
InterfaceHeaderExtendsopt=InterfaceHeaderExtends
+InterfaceHeaderName1=InterfaceHeaderName
InterfaceHeaderName=InterfaceHeaderName
InterfaceMemberDeclaration=InterfaceMemberDeclaration
InterfaceMemberDeclarations=InterfaceMemberDeclarations
InterfaceMemberDeclarationsopt=InterfaceMemberDeclarations
InterfaceType=InterfaceType
InterfaceTypeList=InterfaceTypeList
+InternalCompilationUnit=CompilationUnit
InvalidArrayInitializerAssignement=ArrayInitializerAssignement
InvalidConstructorDeclaration=InvalidConstructorDeclaration
InvalidInterfaceDeclaration=InvalidInterfaceDeclaration
@@ -124,12 +170,19 @@ LabeledStatementNoShortIf=LabeledStatement
Literal=Literal
LocalVariableDeclaration=LocalVariableDeclaration
LocalVariableDeclarationStatement=LocalVariableDeclarationStatement
+MarkerAnnotation=MarkerAnnotation
+MemberValue=MemberValue
+MemberValueArrayInitializer=MemberValueArrayInitializer
+MemberValuePair=MemberValuePair
+MemberValuePairs=MemberValuePairs
+MemberValuePairsopt=MemberValuePairsopt
+MemberValues=MemberValues
MethodBody=MethodBody
MethodDeclaration=MethodDeclaration
-MethodHeader=MethodHeader
+MethodHeader=MethodDeclaration
MethodHeaderExtendedDims=MethodHeaderExtendedDims
MethodHeaderName=MethodHeaderName
-MethodHeaderParameters=MethodHeaderParameters
+MethodHeaderRightParen=)
MethodHeaderThrowsClause=MethodHeaderThrowsClause
MethodHeaderThrowsClauseopt=MethodHeaderThrowsClause
MethodInvocation=MethodInvocation
@@ -137,19 +190,23 @@ Modifier=Modifier
Modifiers=Modifiers
Modifiersopt=Modifiers
MultiplicativeExpression=Expression
+MultiplicativeExpression_NotName=Expression
Name=Name
NestedMethod=NestedMethod
NestedType=NestedType
+NormalAnnotation=NormalAnnotation
NumericType=NumericType
OneDimLoop=Dimension
OnlySynchronized=OnlySynchronized
+OnlyTypeArguments=TypeArguments
+OnlyTypeArgumentsForCastExpression=TypeArguments
OpenBlock=OpenBlock
PackageDeclaration=PackageDeclaration
PackageDeclarationName=PackageDeclarationName
-PackageDeclarationopt=PackageDeclaration
PostDecrementExpression=PostDecrementExpression
PostIncrementExpression=PostIncrementExpression
PostfixExpression=Expression
+PostfixExpression_NotName=Expression
PreDecrementExpression=PreDecrementExpression
PreIncrementExpression=PreIncrementExpression
Primary=Expression
@@ -159,13 +216,23 @@ PushLPAREN=(
PushModifiers=PushModifiers
PushPosition=PushPosition
PushRPAREN=)
+PushRealModifiers=PushModifiers
QualifiedName=QualifiedName
+ReduceImports=ReduceImports
+ReferenceType1=ReferenceType1
+ReferenceType2=ReferenceType2
+ReferenceType3=ReferenceType3
ReferenceType=ReferenceType
RelationalExpression=Expression
+RelationalExpression_NotName=Expression
RestoreDiet=RestoreDiet
ReturnStatement=ReturnStatement
ShiftExpression=Expression
+ShiftExpression_NotName=Expression
SimpleName=SimpleName
+SingleMemberAnnotation=SingleMemberAnnotation
+SingleStaticImportDeclaration=SingleStaticImportDeclaration
+SingleStaticImportDeclarationName=SingleStaticImportDeclarationName
SingleTypeImportDeclaration=SingleTypeImportDeclaration
SingleTypeImportDeclarationName=SingleTypeImportDeclarationName
Statement=Statement
@@ -173,6 +240,8 @@ StatementExpression=Expression
StatementExpressionList=StatementExpressionList
StatementNoShortIf=Statement
StatementWithoutTrailingSubstatement=Statement
+StaticImportOnDemandDeclaration=StaticImportOnDemandDeclaration
+StaticImportOnDemandDeclarationName=StaticImportOnDemandDeclarationName
StaticInitializer=StaticInitializer
StaticOnly=StaticOnly
SwitchBlock=SwitchBlock
@@ -186,13 +255,29 @@ ThrowStatement=ThrowStatement
TryBlock=Block
TryStatement=TryStatement
Type=Type
+TypeArgument1=TypeArgument1
+TypeArgument2=TypeArgument2
+TypeArgument3=TypeArgument3
+TypeArgument=TypeArgument
+TypeArgumentList1=TypeArgumentList1
+TypeArgumentList2=TypeArgumentList2
+TypeArgumentList3=TypeArgumentList3
+TypeArgumentList=TypeArgumentList
+TypeArguments=TypeArguments
TypeDeclaration=TypeDeclaration
TypeDeclarations=TypeDeclarations
-TypeDeclarationsopt=TypeDeclarations
TypeImportOnDemandDeclaration=TypeImportOnDemandDeclaration
TypeImportOnDemandDeclarationName=TypeImportOnDemandDeclarationName
+TypeParameter1=TypeParameter1
+TypeParameter=TypeParameter
+TypeParameterHeader=TypeParameter
+TypeParameterList1=TypeParameterList1
+TypeParameterList=TypeParameterList
+TypeParameters=TypeParameters
UnaryExpression=Expression
UnaryExpressionNotPlusMinus=Expression
+UnaryExpressionNotPlusMinus_NotName=Expression
+UnaryExpression_NotName=Expression
VariableDeclarator=VariableDeclarator
VariableDeclaratorId=VariableDeclaratorId
VariableDeclarators=VariableDeclarators
@@ -200,3 +285,11 @@ VariableInitializer=VariableInitializer
VariableInitializers=VariableInitializers
WhileStatement=WhileStatement
WhileStatementNoShortIf=WhileStatement
+Wildcard1=Wildcard1
+Wildcard2=Wildcard2
+Wildcard3=Wildcard3
+Wildcard=Wildcard
+WildcardBounds1=WildcardBounds1
+WildcardBounds2=WildcardBounds2
+WildcardBounds3=WildcardBound3
+WildcardBounds=WildcardBounds
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
index 96b74f2795..fee8a5ce2e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
@@ -119,6 +119,14 @@ public void alreadyDefinedLabel(char[] labelName, ASTNode location) {
location.sourceStart,
location.sourceEnd);
}
+public void annotationTypeMemberDeclarationWithConstructorName(AnnotationTypeMemberDeclaration annotationTypeMemberDeclaration) {
+ this.handle(
+ IProblem.AnnotationButConstructorName,
+ NoArgument,
+ NoArgument,
+ annotationTypeMemberDeclaration.sourceStart,
+ annotationTypeMemberDeclaration.sourceEnd);
+}
public void anonymousClassCannotExtendFinalClass(Expression expression, TypeBinding type) {
this.handle(
IProblem.AnonymousClassCannotExtendFinalClass,
@@ -145,37 +153,6 @@ public void argumentTypeCannotBeVoidArray(SourceTypeBinding type, AbstractMethod
methodDecl.sourceStart,
methodDecl.sourceEnd);
}
-public void argumentTypeProblem(SourceTypeBinding type, AbstractMethodDeclaration methodDecl, Argument arg, TypeBinding expectedType) {
- int problemId = expectedType.problemId();
- int id;
- switch (problemId) {
- case NotFound : // 1
- id = IProblem.ArgumentTypeNotFound;
- break;
- case NotVisible : // 2
- id = IProblem.ArgumentTypeNotVisible;
- break;
- case Ambiguous : // 3
- id = IProblem.ArgumentTypeAmbiguous;
- break;
- case InternalNameProvided : // 4
- id = IProblem.ArgumentTypeInternalNameProvided;
- break;
- case InheritedNameHidesEnclosingName : // 5
- id = IProblem.ArgumentTypeInheritedNameHidesEnclosingName;
- break;
- case NoError : // 0
- default :
- needImplementation(); // want to fail to see why we were here...
- return;
- }
- this.handle(
- id,
- new String[] {new String(methodDecl.selector), new String(arg.name), new String(expectedType.readableName())},
- new String[] {new String(methodDecl.selector), new String(arg.name), new String(expectedType.shortReadableName())},
- arg.type.sourceStart,
- arg.type.sourceEnd);
-}
public void arrayConstantsOnlyInArrayInitializers(int sourceStart, int sourceEnd) {
this.handle(
IProblem.ArrayConstantsOnlyInArrayInitializers,
@@ -209,21 +186,28 @@ public void attemptToReturnVoidValue(ReturnStatement returnStatement) {
returnStatement.sourceStart,
returnStatement.sourceEnd);
}
+public void boundsMustBeAnInterface(ASTNode location, TypeBinding type) {
+ this.handle(
+ IProblem.BoundsMustBeAnInterface,
+ new String[] {new String(type.readableName())},
+ new String[] {new String(type.shortReadableName())},
+ location.sourceStart,
+ location.sourceEnd);
+}
public void bytecodeExceeds64KLimit(AbstractMethodDeclaration location) {
- String[] arguments = new String[] {new String(location.selector), parametersAsString(location.binding)};
if (location.isConstructor()) {
this.handle(
IProblem.BytecodeExceeds64KLimitForConstructor,
- arguments,
- arguments,
+ new String[] {new String(location.selector), parametersAsString(location.binding.parameters, false)},
+ new String[] {new String(location.selector), parametersAsString(location.binding.parameters, true)},
Error | Abort,
location.sourceStart,
location.sourceEnd);
} else {
this.handle(
IProblem.BytecodeExceeds64KLimit,
- arguments,
- arguments,
+ new String[] {new String(location.selector), parametersAsString(location.binding.parameters, false)},
+ new String[] {new String(location.selector), parametersAsString(location.binding.parameters, true)},
Error | Abort,
location.sourceStart,
location.sourceEnd);
@@ -296,8 +280,8 @@ public void cannotDefineDimensionsAndInitializer(ArrayAllocationExpression expre
public void cannotDireclyInvokeAbstractMethod(MessageSend messageSend, MethodBinding method) {
this.handle(
IProblem.DirectInvocationOfAbstractMethod,
- new String[] {new String(method.declaringClass.readableName()), new String(method.selector), parametersAsString(method)},
- new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method)},
+ new String[] {new String(method.declaringClass.readableName()), new String(method.selector), parametersAsString(method.parameters, false)},
+ new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsString(method.parameters, true)},
messageSend.sourceStart,
messageSend.sourceEnd);
}
@@ -318,6 +302,14 @@ public void cannotInstantiate(TypeReference typeRef, TypeBinding type) {
typeRef.sourceStart,
typeRef.sourceEnd);
}
+public void cannotInstantiateWithWildcards(TypeReference typeRef, ParameterizedTypeBinding type) {
+ this.handle(
+ IProblem.InvalidClassInstantiationWithWildcards,
+ new String[] {new String(type.erasure().readableName()), parametersAsString(type.arguments, false) },
+ new String[] {new String(type.erasure().shortReadableName()), parametersAsString(type.arguments, true)},
+ typeRef.sourceStart,
+ typeRef.sourceEnd);
+}
public void cannotReferToNonFinalOuterLocal(LocalVariableBinding local, ASTNode location) {
String[] arguments =new String[]{ new String(local.readableName())};
this.handle(
@@ -526,6 +518,19 @@ public int computeSeverity(int problemId){
case IProblem.UnnecessaryElse:
return this.options.getSeverity(CompilerOptions.UnnecessaryElse);
+ case IProblem.UnsafeRawConstructorInvocation:
+ case IProblem.UnsafeRawMethodInvocation:
+ case IProblem.UnsafeRawExpressionAssignment:
+ case IProblem.UnsafeConstructorWithRawArguments:
+ case IProblem.UnsafeMethodWithRawArguments:
+ case IProblem.UnsafeRawFieldAssignment:
+ case IProblem.UnsafeGenericCast:
+ case IProblem.UnsafeRawReturnValue:
+ return this.options.getSeverity(CompilerOptions.UnsafeTypeOperation);
+
+ case IProblem.FinalBoundForTypeVariable:
+ return this.options.getSeverity(CompilerOptions.FinalParameterBound);
+
/*
* Javadoc syntax errors
*/
@@ -683,6 +688,15 @@ public void constantOutOfRange(Literal literal, TypeBinding literalType) {
literal.sourceStart,
literal.sourceEnd);
}
+public void corruptedSignature(TypeBinding enclosingType, char[] signature, int position) {
+ this.handle(
+ IProblem.CorruptedSignature,
+ new String[] { new String(enclosingType.readableName()), new String(signature), String.valueOf(position) },
+ new String[] { new String(enclosingType.shortReadableName()), new String(signature), String.valueOf(position) },
+ Error | Abort,
+ 0,
+ 0);
+}
public void deprecatedField(FieldBinding field, ASTNode location) {
this.handle(
IProblem.UsingDeprecatedField,
@@ -695,15 +709,15 @@ public void deprecatedMethod(MethodBinding method, ASTNode location) {
if (method.isConstructor()) {
this.handle(
IProblem.UsingDeprecatedConstructor,
- new String[] {new String(method.declaringClass.readableName()), parametersAsString(method)},
- new String[] {new String(method.declaringClass.shortReadableName()), parametersAsShortString(method)},
+ new String[] {new String(method.declaringClass.readableName()), parametersAsString(method.parameters, false)},
+ new String[] {new String(method.declaringClass.shortReadableName()), parametersAsString(method.parameters, true)},
location.sourceStart,
location.sourceEnd);
} else {
this.handle(
IProblem.UsingDeprecatedMethod,
- new String[] {new String(method.declaringClass.readableName()), new String(method.selector), parametersAsString(method)},
- new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method)},
+ new String[] {new String(method.declaringClass.readableName()), new String(method.selector), parametersAsString(method.parameters, false)},
+ new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsString(method.parameters, true)},
location.sourceStart,
location.sourceEnd);
}
@@ -741,6 +755,15 @@ public void duplicateFieldInType(SourceTypeBinding type, FieldDeclaration fieldD
fieldDecl.sourceStart,
fieldDecl.sourceEnd);
}
+public void duplicateTypeParameterInType(TypeParameter typeParameter) {
+ this.handle(
+ IProblem.DuplicateTypeVariable,
+ new String[] { new String(typeParameter.name)},
+ new String[] { new String(typeParameter.name)},
+ typeParameter.sourceStart,
+ typeParameter.sourceEnd);
+}
+
public void duplicateImport(ImportReference importRef) {
String[] arguments = new String[] {CharOperation.toString(importRef.tokens)};
this.handle(
@@ -769,13 +792,51 @@ public void duplicateInitializationOfFinalLocal(LocalVariableBinding local, ASTN
location.sourceEnd);
}
public void duplicateMethodInType(SourceTypeBinding type, AbstractMethodDeclaration methodDecl) {
- String[] arguments = new String[] {new String(methodDecl.selector), new String(type.sourceName())};
- this.handle(
- IProblem.DuplicateMethod,
- arguments,
- arguments,
- methodDecl.sourceStart,
- methodDecl.sourceEnd);
+ MethodBinding method = methodDecl.binding;
+ boolean duplicateErasure = false;
+ if ((method.modifiers & CompilerModifiers.AccGenericSignature) != 0) {
+ // chech it occurs in parameters (the bit is set for return type | params | thrown exceptions
+ for (int i = 0, length = method.parameters.length; i < length; i++) {
+ if ((method.parameters[i].tagBits & TagBits.HasTypeVariable) != 0) {
+ duplicateErasure = true;
+ break;
+ }
+ }
+ }
+ if (duplicateErasure) {
+ int length = method.parameters.length;
+ TypeBinding[] erasures = new TypeBinding[length];
+ for (int i = 0; i < length; i++) {
+ erasures[i] = method.parameters[i].erasure();
+ }
+ this.handle(
+ IProblem.DuplicateMethodErasure,
+ new String[] {
+ new String(methodDecl.selector),
+ new String(method.declaringClass.readableName()),
+ parametersAsString(method.parameters, false),
+ parametersAsString(erasures, false) } ,
+ new String[] {
+ new String(methodDecl.selector),
+ new String(method.declaringClass.shortReadableName()),
+ parametersAsString(method.parameters, true),
+ parametersAsString(erasures, true) },
+ methodDecl.sourceStart,
+ methodDecl.sourceEnd);
+ } else {
+ this.handle(
+ IProblem.DuplicateMethod,
+ new String[] {
+ new String(methodDecl.selector),
+ new String(method.declaringClass.readableName()),
+ parametersAsString(method.parameters, false)},
+ new String[] {
+ new String(methodDecl.selector),
+ new String(method.declaringClass.shortReadableName()),
+ parametersAsString(method.parameters, true)},
+ methodDecl.sourceStart,
+ methodDecl.sourceEnd);
+ }
}
public void duplicateModifierForField(ReferenceBinding type, FieldDeclaration fieldDecl) {
/* to highlight modifiers use:
@@ -897,37 +958,6 @@ public void errorThisSuperInStatic(ASTNode reference) {
reference.sourceStart,
reference.sourceEnd);
}
-public void exceptionTypeProblem(SourceTypeBinding type, AbstractMethodDeclaration methodDecl, TypeReference exceptionType, TypeBinding expectedType) {
- int problemId = expectedType.problemId();
- int id;
- switch (problemId) {
- case NotFound : // 1
- id = IProblem.ExceptionTypeNotFound;
- break;
- case NotVisible : // 2
- id = IProblem.ExceptionTypeNotVisible;
- break;
- case Ambiguous : // 3
- id = IProblem.ExceptionTypeAmbiguous;
- break;
- case InternalNameProvided : // 4
- id = IProblem.ExceptionTypeInternalNameProvided;
- break;
- case InheritedNameHidesEnclosingName : // 5
- id = IProblem.ExceptionTypeInheritedNameHidesEnclosingName;
- break;
- case NoError : // 0
- default :
- needImplementation(); // want to fail to see why we were here...
- return;
- }
- this.handle(
- id,
- new String[] {new String(methodDecl.selector), new String(expectedType.readableName())},
- new String[] {new String(methodDecl.selector), new String(expectedType.shortReadableName())},
- exceptionType.sourceStart,
- exceptionType.sourceEnd);
-}
public void expressionShouldBeAVariable(Expression expression) {
this.handle(
IProblem.ExpressionShouldBeAVariable,
@@ -988,37 +1018,6 @@ public void fieldsOrThisBeforeConstructorInvocation(ThisReference reference) {
reference.sourceStart,
reference.sourceEnd);
}
-public void fieldTypeProblem(SourceTypeBinding type, FieldDeclaration fieldDecl, TypeBinding expectedType) {
- int problemId = expectedType.problemId();
- int id;
- switch (problemId) {
- case NotFound : // 1
- id = IProblem.FieldTypeNotFound;
- break;
- case NotVisible : // 2
- id = IProblem.FieldTypeNotVisible;
- break;
- case Ambiguous : // 3
- id = IProblem.FieldTypeAmbiguous;
- break;
- case InternalNameProvided : // 4
- id = IProblem.FieldTypeInternalNameProvided;
- break;
- case InheritedNameHidesEnclosingName : // 5
- id = IProblem.FieldTypeInheritedNameHidesEnclosingName;
- break;
- case NoError : // 0
- default :
- needImplementation(); // want to fail to see why we were here...
- return;
- }
- this.handle(
- id,
- new String[] {new String(fieldDecl.name), new String(type.sourceName()), new String(expectedType.readableName())},
- new String[] {new String(fieldDecl.name), new String(type.sourceName()), new String(expectedType.shortReadableName())},
- fieldDecl.type.sourceStart,
- fieldDecl.type.sourceEnd);
-}
public void finallyMustCompleteNormally(Block finallyBlock) {
this.handle(
IProblem.FinallyMustCompleteNormally,
@@ -1037,6 +1036,14 @@ public void finalMethodCannotBeOverridden(MethodBinding currentMethod, MethodBin
currentMethod.sourceStart(),
currentMethod.sourceEnd());
}
+public void finalVariableBound(TypeVariableBinding typeVariable, TypeReference typeRef) {
+ this.handle(
+ IProblem.FinalBoundForTypeVariable,
+ new String[] { new String(typeVariable.sourceName), new String(typeRef.resolvedType.readableName())},
+ new String[] { new String(typeVariable.sourceName), new String(typeRef.resolvedType.shortReadableName())},
+ typeRef.sourceStart,
+ typeRef.sourceEnd);
+}
public void forwardReference(Reference reference, int indexInQualification, TypeBinding type) {
this.handle(
IProblem.ReferenceToForwardField,
@@ -1045,6 +1052,14 @@ public void forwardReference(Reference reference, int indexInQualification, Type
reference.sourceStart,
reference.sourceEnd);
}
+public void forwardTypeVariableReference(ASTNode location, TypeVariableBinding type) {
+ this.handle(
+ IProblem.ReferenceToForwardTypeVariable,
+ new String[] {new String(type.readableName())},
+ new String[] {new String(type.shortReadableName())},
+ location.sourceStart,
+ location.sourceEnd);
+}
// use this private API when the compilation unit result can be found through the
// reference context. Otherwise, use the other API taking a problem and a compilation result
// as arguments
@@ -1132,27 +1147,27 @@ public void hidingEnclosingType(TypeDeclaration typeDecl) {
public void hierarchyCircularity(SourceTypeBinding sourceType, ReferenceBinding superType, TypeReference reference) {
int start = 0;
int end = 0;
- String typeName = ""; //$NON-NLS-1$
- String shortTypeName = ""; //$NON-NLS-1$
+ String typeName = new String(superType.readableName());
+ String shortTypeName = new String(superType.sourceName());
if (reference == null) { // can only happen when java.lang.Object is busted
start = sourceType.sourceStart();
end = sourceType.sourceEnd();
- typeName = new String(superType.readableName());
- shortTypeName = new String(superType.sourceName());
} else {
start = reference.sourceStart;
end = reference.sourceEnd;
- char[][] qName = reference.getTypeName();
- typeName = CharOperation.toString(qName);
- shortTypeName = new String(qName[qName.length-1]);
+ if (sourceType != superType) {
+ char[][] qName = reference.getTypeName();
+ typeName = CharOperation.toString(qName);
+ shortTypeName = new String(qName[qName.length-1]);
+ }
}
if (sourceType == superType)
this.handle(
IProblem.HierarchyCircularitySelfReference,
- new String[] {new String(sourceType.sourceName()), typeName},
- new String[] {new String(sourceType.sourceName()), shortTypeName},
+ new String[] {typeName},
+ new String[] {shortTypeName},
start,
end);
else
@@ -1181,6 +1196,23 @@ public void illegalAbstractModifierCombinationForMethod(ReferenceBinding type, A
methodDecl.sourceStart,
methodDecl.sourceEnd);
}
+public void illegalInstanceOfGenericType(TypeBinding checkedType, ASTNode location) {
+ if (checkedType.isTypeVariable()) {
+ this.handle(
+ IProblem.IllegalInstanceofTypeParameter,
+ new String[] { new String(checkedType.readableName()), new String(checkedType.erasure().readableName())},
+ new String[] { new String(checkedType.shortReadableName()), new String(checkedType.erasure().shortReadableName())},
+ location.sourceStart,
+ location.sourceEnd);
+ return;
+ }
+ this.handle(
+ IProblem.IllegalInstanceofParameterizedType,
+ new String[] { new String(checkedType.readableName()), new String(checkedType.erasure().sourceName())},
+ new String[] { new String(checkedType.shortReadableName()), new String(checkedType.erasure().sourceName())},
+ location.sourceStart,
+ location.sourceEnd);
+}
public void illegalModifierCombinationFinalAbstractForClass(SourceTypeBinding type) {
String[] arguments = new String[] {new String(type.sourceName())};
this.handle(
@@ -1190,6 +1222,14 @@ public void illegalModifierCombinationFinalAbstractForClass(SourceTypeBinding ty
type.sourceStart(),
type.sourceEnd());
}
+public void illegalExtendedDimensions(AnnotationTypeMemberDeclaration annotationTypeMemberDeclaration) {
+ this.handle(
+ IProblem.IllegalExtendedDimensions,
+ NoArgument,
+ NoArgument,
+ annotationTypeMemberDeclaration.sourceStart,
+ annotationTypeMemberDeclaration.sourceEnd);
+}
public void illegalModifierCombinationFinalVolatileForField(ReferenceBinding type, FieldDeclaration fieldDecl) {
String[] arguments = new String[] {new String(fieldDecl.name)};
@@ -1310,6 +1350,21 @@ public void illegalStaticModifierForMemberType(SourceTypeBinding type) {
type.sourceStart(),
type.sourceEnd());
}
+public void illegalUsageOfQualifiedTypeReference(QualifiedTypeReference qualifiedTypeReference) {
+ StringBuffer buffer = new StringBuffer();
+ char[][] tokens = qualifiedTypeReference.tokens;
+ for (int i = 0; i < tokens.length; i++) {
+ if (i > 0) buffer.append('.');
+ buffer.append(tokens[i]);
+ }
+ String[] arguments = new String[] { String.valueOf(buffer)};
+ this.handle(
+ IProblem.IllegalUsageOfQualifiedTypeReference,
+ arguments,
+ arguments,
+ qualifiedTypeReference.sourceStart,
+ qualifiedTypeReference.sourceEnd);
+}
public void illegalVisibilityModifierCombinationForField(ReferenceBinding type, FieldDeclaration fieldDecl) {
String[] arguments = new String[] {new String(fieldDecl.name)};
this.handle(
@@ -1355,34 +1410,20 @@ public void illegalVoidExpression(ASTNode location) {
location.sourceEnd);
}
public void importProblem(ImportReference importRef, Binding expectedImport) {
- int problemId = expectedImport.problemId();
- int id;
- switch (problemId) {
- case NotFound : // 1
- id = IProblem.ImportNotFound;
- break;
- case NotVisible : // 2
- id = IProblem.ImportNotVisible;
- break;
- case Ambiguous : // 3
- id = IProblem.ImportAmbiguous;
- break;
- case InternalNameProvided : // 4
- id = IProblem.ImportInternalNameProvided;
- break;
- case InheritedNameHidesEnclosingName : // 5
- id = IProblem.ImportInheritedNameHidesEnclosingName;
- break;
- case NoError : // 0
- default :
- needImplementation(); // want to fail to see why we were here...
- return;
+ if (expectedImport.problemId() == NotFound) {
+ char[][] tokens = expectedImport instanceof ProblemReferenceBinding
+ ? ((ProblemReferenceBinding) expectedImport).compoundName
+ : importRef.tokens;
+ String[] arguments = new String[]{CharOperation.toString(tokens)};
+ this.handle(
+ IProblem.ImportNotFound,
+ arguments,
+ arguments,
+ importRef.sourceStart,
+ (int) importRef.sourcePositions[tokens.length - 1]);
+ return;
}
- char[][] tokens = expectedImport instanceof ProblemReferenceBinding
- ? ((ProblemReferenceBinding) expectedImport).compoundName
- : importRef.tokens;
- String[] arguments = new String[]{CharOperation.toString(tokens)};
- this.handle(id, arguments, arguments, importRef.sourceStart, (int) importRef.sourcePositions[tokens.length - 1]);
+ invalidType(importRef, (TypeBinding)expectedImport);
}
public void incompatibleExceptionInThrowsClause(SourceTypeBinding type, MethodBinding currentMethod, MethodBinding inheritedMethod, ReferenceBinding exceptionType) {
if (type == currentMethod.declaringClass) {
@@ -1472,6 +1513,23 @@ public void incompatibleReturnType(MethodBinding currentMethod, MethodBinding in
currentMethod.sourceStart(),
currentMethod.sourceEnd());
}
+public void incorrectArityForParameterizedType(ASTNode location, TypeBinding type, TypeBinding[] argumentTypes) {
+ if (location == null) {
+ this.handle(
+ IProblem.IncorrectArityForParameterizedType,
+ new String[] {new String(type.readableName()), parametersAsString(argumentTypes, false)},
+ new String[] {new String(type.shortReadableName()), parametersAsString(argumentTypes, true)},
+ AbortCompilation | Error,
+ 0,
+ 1);
+ }
+ this.handle(
+ IProblem.IncorrectArityForParameterizedType,
+ new String[] {new String(type.readableName()), parametersAsString(argumentTypes, false)},
+ new String[] {new String(type.shortReadableName()), parametersAsString(argumentTypes, true)},
+ location.sourceStart,
+ location.sourceEnd);
+}
public void incorrectLocationForEmptyDimension(ArrayAllocationExpression expression, int index) {
this.handle(
IProblem.IllegalDimension,
@@ -1480,6 +1538,14 @@ public void incorrectLocationForEmptyDimension(ArrayAllocationExpression express
expression.dimensions[index + 1].sourceStart,
expression.dimensions[index + 1].sourceEnd);
}
+public void incorrectSwitchType(Expression expression, TypeBinding testType) {
+ this.handle(
+ IProblem.IncorrectSwitchType,
+ new String[] {new String(testType.readableName())},
+ new String[] {new String(testType.shortReadableName())},
+ expression.sourceStart,
+ expression.sourceEnd);
+}
public void indirectAccessToStaticField(ASTNode location, FieldBinding field){
this.handle(
IProblem.IndirectAccessToStaticField,
@@ -1491,8 +1557,8 @@ public void indirectAccessToStaticField(ASTNode location, FieldBinding field){
public void indirectAccessToStaticMethod(ASTNode location, MethodBinding method) {
this.handle(
IProblem.IndirectAccessToStaticMethod,
- new String[] {new String(method.declaringClass.readableName()), new String(method.selector), parametersAsString(method)},
- new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method)},
+ new String[] {new String(method.declaringClass.readableName()), new String(method.selector), parametersAsString(method.parameters, false)},
+ new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsString(method.parameters, true)},
location.sourceStart,
location.sourceEnd);
}
@@ -1504,14 +1570,6 @@ public void indirectAccessToStaticType(ASTNode location, ReferenceBinding type)
location.sourceStart,
location.sourceEnd);
}
-public void incorrectSwitchType(Expression expression, TypeBinding testType) {
- this.handle(
- IProblem.IncorrectSwitchType,
- new String[] {new String(testType.readableName())},
- new String[] {new String(testType.shortReadableName())},
- expression.sourceStart,
- expression.sourceEnd);
-}
public void inheritedMethodReducesVisibility(SourceTypeBinding type, MethodBinding concreteMethod, MethodBinding[] abstractMethods) {
StringBuffer concreteSignature = new StringBuffer();
concreteSignature
@@ -1616,6 +1674,7 @@ public void invalidConstructor(Statement statement, MethodBinding targetConstruc
&& (((ExplicitConstructorCall) statement).accessMode == ExplicitConstructorCall.ImplicitSuper);
int id = IProblem.UndefinedConstructor; //default...
+ MethodBinding shownConstructor = targetConstructor;
switch (targetConstructor.problemId()) {
case NotFound :
if (insideDefaultConstructor){
@@ -1634,6 +1693,10 @@ public void invalidConstructor(Statement statement, MethodBinding targetConstruc
} else {
id = IProblem.NotVisibleConstructor;
}
+ ProblemMethodBinding problemConstructor = (ProblemMethodBinding) targetConstructor;
+ if (problemConstructor.closestMatch != null) {
+ shownConstructor = problemConstructor.closestMatch.original();
+ }
break;
case Ambiguous :
if (insideDefaultConstructor){
@@ -1644,6 +1707,91 @@ public void invalidConstructor(Statement statement, MethodBinding targetConstruc
id = IProblem.AmbiguousConstructor;
}
break;
+ case ParameterBoundMismatch :
+ problemConstructor = (ProblemMethodBinding) targetConstructor;
+ ParameterizedGenericMethodBinding substitutedConstructor = (ParameterizedGenericMethodBinding) problemConstructor.closestMatch;
+ shownConstructor = substitutedConstructor.original();
+ TypeBinding typeArgument = targetConstructor.parameters[0];
+ TypeVariableBinding typeParameter = (TypeVariableBinding) targetConstructor.parameters[1];
+ this.handle(
+ IProblem.GenericConstructorTypeArgumentMismatch,
+ new String[] {
+ new String(shownConstructor.declaringClass.sourceName()),
+ parametersAsString(shownConstructor.parameters, false),
+ new String(shownConstructor.declaringClass.readableName()),
+ parametersAsString(substitutedConstructor.parameters, false),
+ new String(typeArgument.readableName()),
+ new String(typeParameter.sourceName),
+ parameterBoundAsString(typeParameter, false) },
+ new String[] {
+ new String(shownConstructor.declaringClass.sourceName()),
+ parametersAsString(shownConstructor.parameters, true),
+ new String(shownConstructor.declaringClass.shortReadableName()),
+ parametersAsString(substitutedConstructor.parameters, true),
+ new String(typeArgument.shortReadableName()),
+ new String(typeParameter.sourceName),
+ parameterBoundAsString(typeParameter, true) },
+ statement.sourceStart,
+ statement.sourceEnd);
+ return;
+
+ case TypeParameterArityMismatch :
+ problemConstructor = (ProblemMethodBinding) targetConstructor;
+ shownConstructor = problemConstructor.closestMatch;
+ if (shownConstructor.typeVariables == TypeConstants.NoTypeVariables) {
+ this.handle(
+ IProblem.NonGenericConstructor,
+ new String[] {
+ new String(shownConstructor.declaringClass.sourceName()),
+ parametersAsString(shownConstructor.parameters, false),
+ new String(shownConstructor.declaringClass.readableName()),
+ parametersAsString(targetConstructor.parameters, false) },
+ new String[] {
+ new String(shownConstructor.declaringClass.sourceName()),
+ parametersAsString(shownConstructor.parameters, true),
+ new String(shownConstructor.declaringClass.shortReadableName()),
+ parametersAsString(targetConstructor.parameters, true) },
+ statement.sourceStart,
+ statement.sourceEnd);
+ } else {
+ this.handle(
+ IProblem.IncorrectArityForParameterizedConstructor ,
+ new String[] {
+ new String(shownConstructor.declaringClass.sourceName()),
+ parametersAsString(shownConstructor.parameters, false),
+ new String(shownConstructor.declaringClass.readableName()),
+ parametersAsString(shownConstructor.typeVariables, false),
+ parametersAsString(targetConstructor.parameters, false) },
+ new String[] {
+ new String(shownConstructor.declaringClass.sourceName()),
+ parametersAsString(shownConstructor.parameters, true),
+ new String(shownConstructor.declaringClass.shortReadableName()),
+ parametersAsString(shownConstructor.typeVariables, true),
+ parametersAsString(targetConstructor.parameters, true) },
+ statement.sourceStart,
+ statement.sourceEnd);
+ }
+ return;
+ case ParameterizedMethodTypeMismatch :
+ problemConstructor = (ProblemMethodBinding) targetConstructor;
+ shownConstructor = problemConstructor.closestMatch;
+ this.handle(
+ IProblem.ParameterizedConstructorArgumentTypeMismatch,
+ new String[] {
+ new String(shownConstructor.declaringClass.sourceName()),
+ parametersAsString(shownConstructor.parameters, false),
+ new String(shownConstructor.declaringClass.readableName()),
+ parametersAsString(((ParameterizedGenericMethodBinding)shownConstructor).typeArguments, false),
+ parametersAsString(targetConstructor.parameters, false) },
+ new String[] {
+ new String(shownConstructor.declaringClass.sourceName()),
+ parametersAsString(shownConstructor.parameters, true),
+ new String(shownConstructor.declaringClass.shortReadableName()),
+ parametersAsString(((ParameterizedGenericMethodBinding)shownConstructor).typeArguments, true),
+ parametersAsString(targetConstructor.parameters, true) },
+ statement.sourceStart,
+ statement.sourceEnd);
+ return;
case NoError : // 0
default :
needImplementation(); // want to fail to see why we were here...
@@ -1652,8 +1800,8 @@ public void invalidConstructor(Statement statement, MethodBinding targetConstruc
this.handle(
id,
- new String[] {new String(targetConstructor.declaringClass.readableName()), parametersAsString(targetConstructor)},
- new String[] {new String(targetConstructor.declaringClass.shortReadableName()), parametersAsShortString(targetConstructor)},
+ new String[] {new String(targetConstructor.declaringClass.readableName()), parametersAsString(shownConstructor.parameters, false)},
+ new String[] {new String(targetConstructor.declaringClass.shortReadableName()), parametersAsString(shownConstructor.parameters, true)},
statement.sourceStart,
statement.sourceEnd);
}
@@ -1705,6 +1853,14 @@ public void invalidEnclosingType(Expression expression, TypeBinding type, Refere
expression.sourceStart,
expression.sourceEnd);
}
+public void invalidParameterizedExceptionType(TypeBinding exceptionType, ASTNode location) {
+ this.handle(
+ IProblem.InvalidParameterizedExceptionType,
+ new String[] {new String(exceptionType.readableName())},
+ new String[] {new String(exceptionType.shortReadableName())},
+ location.sourceStart,
+ location.sourceEnd);
+}
public void invalidExpressionAsStatement(Expression expression){
this.handle(
IProblem.InvalidExpressionAsStatement,
@@ -1874,23 +2030,56 @@ public void invalidField(QualifiedNameReference nameRef, FieldBinding field, int
nameRef.sourceStart,
(int) nameRef.sourcePositions[index]);
}
+public void invalidFileNameForPackageAnnotations(Annotation annotation) {
+ this.handle(
+ IProblem.InvalidFileNameForPackageAnnotations,
+ NoArgument,
+ NoArgument,
+ annotation.sourceStart,
+ annotation.sourceEnd);
+}
public void invalidMethod(MessageSend messageSend, MethodBinding method) {
- // CODE should be UPDATED according to error coding in the different method binding errors
- // The different targetted errors should be :
- // UndefinedMethod
- // NotVisibleMethod
- // AmbiguousMethod
- // InheritedNameHidesEnclosingName
- // InstanceMethodDuringConstructorInvocation
- // StaticMethodRequested
-
int id = IProblem.UndefinedMethod; //default...
+ MethodBinding shownMethod = method;
switch (method.problemId()) {
case NotFound :
id = IProblem.UndefinedMethod;
+ ProblemMethodBinding problemMethod = (ProblemMethodBinding) method;
+ if (problemMethod.closestMatch != null) {
+ shownMethod = problemMethod.closestMatch;
+ String closestParameterTypeNames = parametersAsString(shownMethod.parameters, false);
+ String parameterTypeNames = parametersAsString(method.parameters, false);
+ String closestParameterTypeShortNames = parametersAsString(shownMethod.parameters, true);
+ String parameterTypeShortNames = parametersAsString(method.parameters, true);
+ if (closestParameterTypeShortNames.equals(parameterTypeShortNames)){
+ closestParameterTypeShortNames = closestParameterTypeNames;
+ parameterTypeShortNames = parameterTypeNames;
+ }
+ this.handle(
+ IProblem.ParameterMismatch,
+ new String[] {
+ new String(shownMethod.declaringClass.readableName()),
+ new String(shownMethod.selector),
+ closestParameterTypeNames,
+ parameterTypeNames
+ },
+ new String[] {
+ new String(shownMethod.declaringClass.shortReadableName()),
+ new String(shownMethod.selector),
+ closestParameterTypeShortNames,
+ parameterTypeShortNames
+ },
+ (int) (messageSend.nameSourcePosition >>> 32),
+ (int) messageSend.nameSourcePosition);
+ return;
+ }
break;
case NotVisible :
id = IProblem.NotVisibleMethod;
+ problemMethod = (ProblemMethodBinding) method;
+ if (problemMethod.closestMatch != null) {
+ shownMethod = problemMethod.closestMatch.original();
+ }
break;
case Ambiguous :
id = IProblem.AmbiguousMethod;
@@ -1912,53 +2101,105 @@ public void invalidMethod(MessageSend messageSend, MethodBinding method) {
messageSend.receiver.sourceStart,
messageSend.receiver.sourceEnd);
return;
-
+ case ParameterBoundMismatch :
+ problemMethod = (ProblemMethodBinding) method;
+ ParameterizedGenericMethodBinding substitutedMethod = (ParameterizedGenericMethodBinding) problemMethod.closestMatch;
+ shownMethod = substitutedMethod.original();
+ TypeBinding typeArgument = method.parameters[0];
+ TypeVariableBinding typeParameter = (TypeVariableBinding) method.parameters[1];
+ this.handle(
+ IProblem.GenericMethodTypeArgumentMismatch,
+ new String[] {
+ new String(shownMethod.selector),
+ parametersAsString(shownMethod.parameters, false),
+ new String(shownMethod.declaringClass.readableName()),
+ parametersAsString(substitutedMethod.parameters, false),
+ new String(typeArgument.readableName()),
+ new String(typeParameter.sourceName),
+ parameterBoundAsString(typeParameter, false) },
+ new String[] {
+ new String(shownMethod.selector),
+ parametersAsString(shownMethod.parameters, true),
+ new String(shownMethod.declaringClass.shortReadableName()),
+ parametersAsString(substitutedMethod.parameters, true),
+ new String(typeArgument.shortReadableName()),
+ new String(typeParameter.sourceName),
+ parameterBoundAsString(typeParameter, true) },
+ (int) (messageSend.nameSourcePosition >>> 32),
+ (int) messageSend.nameSourcePosition);
+ return;
+ case TypeParameterArityMismatch :
+ problemMethod = (ProblemMethodBinding) method;
+ shownMethod = problemMethod.closestMatch;
+ if (shownMethod.typeVariables == TypeConstants.NoTypeVariables) {
+ this.handle(
+ IProblem.NonGenericMethod ,
+ new String[] {
+ new String(shownMethod.selector),
+ parametersAsString(shownMethod.parameters, false),
+ new String(shownMethod.declaringClass.readableName()),
+ parametersAsString(method.parameters, false) },
+ new String[] {
+ new String(shownMethod.selector),
+ parametersAsString(shownMethod.parameters, true),
+ new String(shownMethod.declaringClass.shortReadableName()),
+ parametersAsString(method.parameters, true) },
+ (int) (messageSend.nameSourcePosition >>> 32),
+ (int) messageSend.nameSourcePosition);
+ } else {
+ this.handle(
+ IProblem.IncorrectArityForParameterizedMethod ,
+ new String[] {
+ new String(shownMethod.selector),
+ parametersAsString(shownMethod.parameters, false),
+ new String(shownMethod.declaringClass.readableName()),
+ parametersAsString(shownMethod.typeVariables, false),
+ parametersAsString(method.parameters, false) },
+ new String[] {
+ new String(shownMethod.selector),
+ parametersAsString(shownMethod.parameters, true),
+ new String(shownMethod.declaringClass.shortReadableName()),
+ parametersAsString(shownMethod.typeVariables, true),
+ parametersAsString(method.parameters, true) },
+ (int) (messageSend.nameSourcePosition >>> 32),
+ (int) messageSend.nameSourcePosition);
+ }
+ return;
+ case ParameterizedMethodTypeMismatch :
+ problemMethod = (ProblemMethodBinding) method;
+ shownMethod = problemMethod.closestMatch;
+ this.handle(
+ IProblem.ParameterizedMethodArgumentTypeMismatch,
+ new String[] {
+ new String(shownMethod.selector),
+ parametersAsString(shownMethod.parameters, false),
+ new String(shownMethod.declaringClass.readableName()),
+ parametersAsString(((ParameterizedGenericMethodBinding)shownMethod).typeArguments, false),
+ parametersAsString(method.parameters, false) },
+ new String[] {
+ new String(shownMethod.selector),
+ parametersAsString(shownMethod.parameters, true),
+ new String(shownMethod.declaringClass.shortReadableName()),
+ parametersAsString(((ParameterizedGenericMethodBinding)shownMethod).typeArguments, true),
+ parametersAsString(method.parameters, true) },
+ (int) (messageSend.nameSourcePosition >>> 32),
+ (int) messageSend.nameSourcePosition);
+ return;
+
case NoError : // 0
default :
needImplementation(); // want to fail to see why we were here...
break;
}
- if (id == IProblem.UndefinedMethod) {
- ProblemMethodBinding problemMethod = (ProblemMethodBinding) method;
- if (problemMethod.closestMatch != null) {
- String closestParameterTypeNames = parametersAsString(problemMethod.closestMatch);
- String parameterTypeNames = parametersAsString(method);
- String closestParameterTypeShortNames = parametersAsShortString(problemMethod.closestMatch);
- String parameterTypeShortNames = parametersAsShortString(method);
- if (closestParameterTypeShortNames.equals(parameterTypeShortNames)){
- closestParameterTypeShortNames = closestParameterTypeNames;
- parameterTypeShortNames = parameterTypeNames;
- }
- id = IProblem.ParameterMismatch;
- this.handle(
- id,
- new String[] {
- new String(problemMethod.closestMatch.declaringClass.readableName()),
- new String(problemMethod.closestMatch.selector),
- closestParameterTypeNames,
- parameterTypeNames
- },
- new String[] {
- new String(problemMethod.closestMatch.declaringClass.shortReadableName()),
- new String(problemMethod.closestMatch.selector),
- closestParameterTypeShortNames,
- parameterTypeShortNames
- },
- (int) (messageSend.nameSourcePosition >>> 32),
- (int) messageSend.nameSourcePosition);
- return;
- }
- }
-
this.handle(
id,
new String[] {
new String(method.declaringClass.readableName()),
- new String(method.selector), parametersAsString(method)},
+ new String(shownMethod.selector), parametersAsString(shownMethod.parameters, false)},
new String[] {
new String(method.declaringClass.shortReadableName()),
- new String(method.selector), parametersAsShortString(method)},
+ new String(shownMethod.selector), parametersAsString(shownMethod.parameters, true)},
(int) (messageSend.nameSourcePosition >>> 32),
(int) messageSend.nameSourcePosition);
}
@@ -2026,68 +2267,6 @@ public void invalidParenthesizedExpression(ASTNode reference) {
reference.sourceStart,
reference.sourceEnd);
}
-public void invalidSuperclass(SourceTypeBinding type, TypeReference superclassRef, ReferenceBinding expectedType) {
- int problemId = expectedType.problemId();
- int id;
- switch (problemId) {
- case NotFound : // 1
- id = IProblem.SuperclassNotFound;
- break;
- case NotVisible : // 2
- id = IProblem.SuperclassNotVisible;
- break;
- case Ambiguous : // 3
- id = IProblem.SuperclassAmbiguous;
- break;
- case InternalNameProvided : // 4
- id = IProblem.SuperclassInternalNameProvided;
- break;
- case InheritedNameHidesEnclosingName : // 5
- id = IProblem.SuperclassInheritedNameHidesEnclosingName;
- break;
- case NoError : // 0
- default :
- needImplementation(); // want to fail to see why we were here...
- return;
- }
- this.handle(
- id,
- new String[] {new String(expectedType.readableName()), new String(type.sourceName())},
- new String[] {new String(expectedType.shortReadableName()), new String(type.sourceName())},
- superclassRef.sourceStart,
- superclassRef.sourceEnd);
-}
-public void invalidSuperinterface(SourceTypeBinding type, TypeReference superinterfaceRef, ReferenceBinding expectedType) {
- int problemId = expectedType.problemId();
- int id;
- switch (problemId) {
- case NotFound : // 1
- id = IProblem.InterfaceNotFound;
- break;
- case NotVisible : // 2
- id = IProblem.InterfaceNotVisible;
- break;
- case Ambiguous : // 3
- id = IProblem.InterfaceAmbiguous;
- break;
- case InternalNameProvided : // 4
- id = IProblem.InterfaceInternalNameProvided;
- break;
- case InheritedNameHidesEnclosingName : // 5
- id = IProblem.InterfaceInheritedNameHidesEnclosingName;
- break;
- case NoError : // 0
- default :
- needImplementation(); // want to fail to see why we were here...
- return;
- }
- this.handle(
- id,
- new String[] {new String(expectedType.readableName()), new String(type.sourceName())},
- new String[] {new String(expectedType.shortReadableName()), new String(type.sourceName())},
- superinterfaceRef.sourceStart,
- superinterfaceRef.sourceEnd);
-}
public void invalidType(ASTNode location, TypeBinding type) {
int id = IProblem.UndefinedType; // default
switch (type.problemId()) {
@@ -2106,6 +2285,12 @@ public void invalidType(ASTNode location, TypeBinding type) {
case InheritedNameHidesEnclosingName :
id = IProblem.InheritedTypeHidesEnclosingName;
break;
+ case NonStaticReferenceInStaticContext :
+ id = IProblem.TypeVariableReferenceFromStaticContext;
+ break;
+ case IllegalSuperTypeVariable :
+ id = IProblem.IllegalTypeVariableSuperReference;
+ break;
case NoError : // 0
default :
needImplementation(); // want to fail to see why we were here...
@@ -2117,14 +2302,34 @@ public void invalidType(ASTNode location, TypeBinding type) {
QualifiedNameReference ref = (QualifiedNameReference) location;
if (ref.indexOfFirstFieldBinding >= 1)
end = (int) ref.sourcePositions[ref.indexOfFirstFieldBinding - 1];
+ } else if (location instanceof QualifiedTypeReference) {
+ QualifiedTypeReference ref = (QualifiedTypeReference) location;
+ if (type instanceof ReferenceBinding) {
+ char[][] name = ((ReferenceBinding) type).compoundName;
+ end = (int) ref.sourcePositions[name.length - 1];
+ }
+ } else if (location instanceof ImportReference) {
+ ImportReference ref = (ImportReference) location;
+ if (type instanceof ReferenceBinding) {
+ char[][] name = ((ReferenceBinding) type).compoundName;
+ end = (int) ref.sourcePositions[name.length - 1];
+ }
}
this.handle(
id,
- new String[] {new String(type.readableName())},
+ new String[] {new String(type.readableName()) },
new String[] {new String(type.shortReadableName())},
location.sourceStart,
end);
}
+public void invalidTypeForCollection(Expression expression) {
+ this.handle(
+ IProblem.InvalidTypeForCollection,
+ NoArgument,
+ NoArgument,
+ expression.sourceStart,
+ expression.sourceEnd);
+}
public void invalidTypeReference(Expression expression) {
this.handle(
IProblem.InvalidTypeExpression,
@@ -2178,15 +2383,15 @@ public void javadocDeprecatedMethod(MethodBinding method, ASTNode location, int
if (method.isConstructor()) {
this.handle(
IProblem.JavadocUsingDeprecatedConstructor,
- new String[] {new String(method.declaringClass.readableName()), parametersAsString(method)},
- new String[] {new String(method.declaringClass.shortReadableName()), parametersAsShortString(method)},
+ new String[] {new String(method.declaringClass.readableName()), parametersAsString(method.parameters, false)},
+ new String[] {new String(method.declaringClass.shortReadableName()), parametersAsString(method.parameters, true)},
location.sourceStart,
location.sourceEnd);
} else {
this.handle(
IProblem.JavadocUsingDeprecatedMethod,
- new String[] {new String(method.declaringClass.readableName()), new String(method.selector), parametersAsString(method)},
- new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method)},
+ new String[] {new String(method.declaringClass.readableName()), new String(method.selector), parametersAsString(method.parameters, false)},
+ new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsString(method.parameters, true)},
location.sourceStart,
location.sourceEnd);
}
@@ -2286,8 +2491,8 @@ public void javadocInvalidConstructor(Statement statement, MethodBinding targetC
this.handle(
id,
- new String[] {new String(targetConstructor.declaringClass.readableName()), parametersAsString(targetConstructor)},
- new String[] {new String(targetConstructor.declaringClass.shortReadableName()), parametersAsShortString(targetConstructor)},
+ new String[] {new String(targetConstructor.declaringClass.readableName()), parametersAsString(targetConstructor.parameters, false)},
+ new String[] {new String(targetConstructor.declaringClass.shortReadableName()), parametersAsString(targetConstructor.parameters, true)},
statement.sourceStart,
statement.sourceEnd);
}
@@ -2365,10 +2570,10 @@ public void javadocInvalidMethod(MessageSend messageSend, MethodBinding method,
if (id == IProblem.JavadocUndefinedMethod) {
ProblemMethodBinding problemMethod = (ProblemMethodBinding) method;
if (problemMethod.closestMatch != null) {
- String closestParameterTypeNames = parametersAsString(problemMethod.closestMatch);
- String parameterTypeNames = parametersAsString(method);
- String closestParameterTypeShortNames = parametersAsShortString(problemMethod.closestMatch);
- String parameterTypeShortNames = parametersAsShortString(method);
+ String closestParameterTypeNames = parametersAsString(problemMethod.closestMatch.parameters, false);
+ String parameterTypeNames = parametersAsString(method.parameters, false);
+ String closestParameterTypeShortNames = parametersAsString(problemMethod.closestMatch.parameters, true);
+ String parameterTypeShortNames = parametersAsString(method.parameters, true);
if (closestParameterTypeShortNames.equals(parameterTypeShortNames)){
closestParameterTypeShortNames = closestParameterTypeNames;
parameterTypeShortNames = parameterTypeNames;
@@ -2397,10 +2602,10 @@ public void javadocInvalidMethod(MessageSend messageSend, MethodBinding method,
id,
new String[] {
new String(method.declaringClass.readableName()),
- new String(method.selector), parametersAsString(method)},
+ new String(method.selector), parametersAsString(method.parameters, false)},
new String[] {
new String(method.declaringClass.shortReadableName()),
- new String(method.selector), parametersAsShortString(method)},
+ new String(method.selector), parametersAsString(method.parameters, true)},
(int) (messageSend.nameSourcePosition >>> 32),
(int) messageSend.nameSourcePosition);
}
@@ -2642,8 +2847,8 @@ public void mustSpecifyPackage(CompilationUnitDeclaration compUnitDecl) {
public void mustUseAStaticMethod(MessageSend messageSend, MethodBinding method) {
this.handle(
IProblem.StaticMethodRequested,
- new String[] {new String(method.declaringClass.readableName()), new String(method.selector), parametersAsString(method)},
- new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method)},
+ new String[] {new String(method.declaringClass.readableName()), new String(method.selector), parametersAsString(method.parameters, false)},
+ new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsString(method.parameters, true)},
messageSend.sourceStart,
messageSend.sourceEnd);
}
@@ -2660,17 +2865,11 @@ public void nativeMethodsCannotBeStrictfp(ReferenceBinding type, AbstractMethodD
public void needImplementation() {
this.abortDueToInternalError(Util.bind("abort.missingCode")); //$NON-NLS-1$
}
-public void needToEmulateFieldReadAccess(FieldBinding field, ASTNode location) {
- this.handle(
- IProblem.NeedToEmulateFieldReadAccess,
- new String[] {new String(field.declaringClass.readableName()), new String(field.name)},
- new String[] {new String(field.declaringClass.shortReadableName()), new String(field.name)},
- location.sourceStart,
- location.sourceEnd);
-}
-public void needToEmulateFieldWriteAccess(FieldBinding field, ASTNode location) {
+public void needToEmulateFieldAccess(FieldBinding field, ASTNode location, boolean isReadAccess) {
this.handle(
- IProblem.NeedToEmulateFieldWriteAccess,
+ isReadAccess
+ ? IProblem.NeedToEmulateFieldReadAccess
+ : IProblem.NeedToEmulateFieldWriteAccess,
new String[] {new String(field.declaringClass.readableName()), new String(field.name)},
new String[] {new String(field.declaringClass.shortReadableName()), new String(field.name)},
location.sourceStart,
@@ -2685,11 +2884,11 @@ public void needToEmulateMethodAccess(
IProblem.NeedToEmulateConstructorAccess,
new String[] {
new String(method.declaringClass.readableName()),
- parametersAsString(method)
+ parametersAsString(method.parameters, false)
},
new String[] {
new String(method.declaringClass.shortReadableName()),
- parametersAsShortString(method)
+ parametersAsString(method.parameters, true)
},
location.sourceStart,
location.sourceEnd);
@@ -2699,12 +2898,12 @@ public void needToEmulateMethodAccess(
new String[] {
new String(method.declaringClass.readableName()),
new String(method.selector),
- parametersAsString(method)
+ parametersAsString(method.parameters, false)
},
new String[] {
new String(method.declaringClass.shortReadableName()),
new String(method.selector),
- parametersAsShortString(method)
+ parametersAsString(method.parameters, true)
},
location.sourceStart,
location.sourceEnd);
@@ -2740,11 +2939,29 @@ public void noMoreAvailableSpaceForLocal(LocalVariableBinding local, ASTNode loc
location.sourceStart,
location.sourceEnd);
}
+public void nonGenericTypeCannotBeParameterized(ASTNode location, TypeBinding type, TypeBinding[] argumentTypes) {
+ if (location == null) { // binary case
+ this.handle(
+ IProblem.NonGenericType,
+ new String[] {new String(type.readableName()), parametersAsString(argumentTypes, false)},
+ new String[] {new String(type.shortReadableName()), parametersAsString(argumentTypes, true)},
+ AbortCompilation | Error,
+ 0,
+ 1);
+ return;
+ }
+ this.handle(
+ IProblem.NonGenericType,
+ new String[] {new String(type.readableName()), parametersAsString(argumentTypes, false)},
+ new String[] {new String(type.shortReadableName()), parametersAsString(argumentTypes, true)},
+ location.sourceStart,
+ location.sourceEnd);
+}
public void nonStaticAccessToStaticMethod(ASTNode location, MethodBinding method) {
this.handle(
IProblem.NonStaticAccessToStaticMethod,
- new String[] {new String(method.declaringClass.readableName()), new String(method.selector), parametersAsString(method)},
- new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsShortString(method)},
+ new String[] {new String(method.declaringClass.readableName()), new String(method.selector), parametersAsString(method.parameters, false)},
+ new String[] {new String(method.declaringClass.shortReadableName()), new String(method.selector), parametersAsString(method.parameters, true)},
location.sourceStart,
location.sourceEnd);
}
@@ -2817,6 +3034,30 @@ public void notCompatibleTypesError(InstanceOfExpression expression, TypeBinding
expression.sourceStart,
expression.sourceEnd);
}
+public void notCompatibleTypesErrorInForeach(Expression expression, TypeBinding leftType, TypeBinding rightType) {
+ String leftName = new String(leftType.readableName());
+ String rightName = new String(rightType.readableName());
+ String leftShortName = new String(leftType.shortReadableName());
+ String rightShortName = new String(rightType.shortReadableName());
+ if (leftShortName.equals(rightShortName)){
+ leftShortName = leftName;
+ rightShortName = rightName;
+ }
+ this.handle(
+ IProblem.IncompatibleTypesInForeach,
+ new String[] {leftName, rightName },
+ new String[] {leftShortName, rightShortName },
+ expression.sourceStart,
+ expression.sourceEnd);
+}
+public void objectCannotBeGeneric(TypeDeclaration typeDecl) {
+ this.handle(
+ IProblem.ObjectCannotBeGeneric,
+ NoArgument,
+ NoArgument,
+ typeDecl.typeParameters[0].sourceStart,
+ typeDecl.typeParameters[0].sourceEnd);
+}
public void objectCannotHaveSuperTypes(SourceTypeBinding type) {
this.handle(
IProblem.ObjectCannotHaveSuperTypes,
@@ -2899,23 +3140,26 @@ public void packageIsNotExpectedPackage(CompilationUnitDeclaration compUnitDecl)
compUnitDecl.currentPackage == null ? 0 : compUnitDecl.currentPackage.sourceStart,
compUnitDecl.currentPackage == null ? 0 : compUnitDecl.currentPackage.sourceEnd);
}
-private String parametersAsString(MethodBinding method) {
- TypeBinding[] params = method.parameters;
- StringBuffer buffer = new StringBuffer();
- for (int i = 0, length = params.length; i < length; i++) {
- if (i != 0)
- buffer.append(", "); //$NON-NLS-1$
- buffer.append(new String(params[i].readableName()));
+private String parameterBoundAsString(TypeVariableBinding typeVariable, boolean makeShort) {
+ StringBuffer nameBuffer = new StringBuffer(10);
+ if (typeVariable.firstBound == typeVariable.superclass) {
+ nameBuffer.append(makeShort ? typeVariable.superclass.shortReadableName() : typeVariable.superclass.readableName());
+ }
+ int length;
+ if ((length = typeVariable.superInterfaces.length) > 0) {
+ for (int i = 0; i < length; i++) {
+ if (i > 0 || typeVariable.firstBound == typeVariable.superclass) nameBuffer.append(" & "); //$NON-NLS-1$
+ nameBuffer.append(makeShort ? typeVariable.superInterfaces[i].shortReadableName() : typeVariable.superInterfaces[i].readableName());
+ }
}
- return buffer.toString();
+ return nameBuffer.toString();
}
-private String parametersAsShortString(MethodBinding method) {
- TypeBinding[] params = method.parameters;
- StringBuffer buffer = new StringBuffer();
+private String parametersAsString(TypeBinding[] params, boolean makeShort) {
+ StringBuffer buffer = new StringBuffer(10);
for (int i = 0, length = params.length; i < length; i++) {
if (i != 0)
buffer.append(", "); //$NON-NLS-1$
- buffer.append(new String(params[i].shortReadableName()));
+ buffer.append(new String(makeShort ? params[i].shortReadableName() : params[i].readableName()));
}
return buffer.toString();
}
@@ -2988,11 +3232,10 @@ public void parseError(
endPosition);
}
public void possibleAccidentalBooleanAssignment(Assignment assignment) {
- String[] arguments = new String[] {};
this.handle(
IProblem.PossibleAccidentalBooleanAssignment,
- arguments,
- arguments,
+ NoArgument,
+ NoArgument,
assignment.sourceStart,
assignment.sourceEnd);
}
@@ -3013,11 +3256,11 @@ public void recursiveConstructorInvocation(ExplicitConstructorCall constructorCa
IProblem.RecursiveConstructorInvocation,
new String[] {
new String(constructorCall.binding.declaringClass.readableName()),
- parametersAsString(constructorCall.binding)
+ parametersAsString(constructorCall.binding.parameters, false)
},
new String[] {
new String(constructorCall.binding.declaringClass.shortReadableName()),
- parametersAsShortString(constructorCall.binding)
+ parametersAsString(constructorCall.binding.parameters, true)
},
constructorCall.sourceStart,
constructorCall.sourceEnd);
@@ -3058,37 +3301,6 @@ public void returnTypeCannotBeVoidArray(SourceTypeBinding type, MethodDeclaratio
methodDecl.sourceStart,
methodDecl.sourceEnd);
}
-public void returnTypeProblem(SourceTypeBinding type, MethodDeclaration methodDecl, TypeBinding expectedType) {
- int problemId = expectedType.problemId();
- int id;
- switch (problemId) {
- case NotFound : // 1
- id = IProblem.ReturnTypeNotFound;
- break;
- case NotVisible : // 2
- id = IProblem.ReturnTypeNotVisible;
- break;
- case Ambiguous : // 3
- id = IProblem.ReturnTypeAmbiguous;
- break;
- case InternalNameProvided : // 4
- id = IProblem.ReturnTypeInternalNameProvided;
- break;
- case InheritedNameHidesEnclosingName : // 5
- id = IProblem.ReturnTypeInheritedNameHidesEnclosingName;
- break;
- case NoError : // 0
- default :
- needImplementation(); // want to fail to see why we were here...
- return;
- }
- this.handle(
- id,
- new String[] {new String(methodDecl.selector), new String(expectedType.readableName())},
- new String[] {new String(methodDecl.selector), new String(expectedType.shortReadableName())},
- methodDecl.returnType.sourceStart,
- methodDecl.returnType.sourceEnd);
-}
public void scannerError(Parser parser, String errorTokenName) {
Scanner scanner = parser.scanner;
@@ -3230,6 +3442,14 @@ public void superfluousSemicolon(int sourceStart, int sourceEnd) {
sourceStart,
sourceEnd);
}
+public void superinterfacesCollide(ReferenceBinding type, TypeDeclaration typeDecl, ReferenceBinding superType, ReferenceBinding inheritedSuperType) {
+ this.handle(
+ IProblem.SuperInterfacesCollide,
+ new String[] {new String(superType.readableName()), new String(inheritedSuperType.readableName()), new String(type.sourceName())},
+ new String[] {new String(superType.shortReadableName()), new String(inheritedSuperType.shortReadableName()), new String(type.sourceName())},
+ typeDecl.sourceStart,
+ typeDecl.sourceEnd);
+}
public void superinterfaceMustBeAnInterface(SourceTypeBinding type, TypeDeclaration typeDecl, ReferenceBinding superType) {
this.handle(
IProblem.SuperInterfaceMustBeAnInterface,
@@ -3254,6 +3474,15 @@ public void tooManyDimensions(ASTNode expression) {
expression.sourceStart,
expression.sourceEnd);
}
+public void illegalArrayOfParameterizedType(TypeBinding leadtComponentType, ASTNode location) {
+ this.handle(
+ IProblem.IllegalArrayOfParameterizedType,
+ new String[]{ new String(leadtComponentType.readableName())},
+ new String[]{ new String(leadtComponentType.shortReadableName())},
+ location.sourceStart,
+ location.sourceEnd);
+}
+
public void tooManyFields(TypeDeclaration typeDeclaration) {
this.handle(
IProblem.TooManyFields,
@@ -3299,37 +3528,31 @@ public void typeCollidesWithPackage(CompilationUnitDeclaration compUnitDecl, Typ
typeDecl.sourceEnd,
compUnitDecl.compilationResult);
}
-public void typeMismatchError(TypeBinding resultType, TypeBinding expectedType, ASTNode location) {
- String resultTypeName = new String(resultType.readableName());
- String expectedTypeName = new String(expectedType.readableName());
- String resultTypeShortName = new String(resultType.shortReadableName());
- String expectedTypeShortName = new String(expectedType.shortReadableName());
- if (resultTypeShortName.equals(expectedTypeShortName)){
- resultTypeShortName = resultTypeName;
- expectedTypeShortName = expectedTypeName;
- }
- this.handle(
- IProblem.TypeMismatch,
- new String[] {resultTypeName, expectedTypeName},
- new String[] {resultTypeShortName, expectedTypeShortName},
+public void typeMismatchError(TypeBinding typeArgument, TypeVariableBinding typeParameter, ReferenceBinding genericType, ASTNode location) {
+ if (location == null) { // binary case
+ this.handle(
+ IProblem.TypeArgumentMismatch,
+ new String[] { new String(typeArgument.readableName()), new String(genericType.readableName()), new String(typeParameter.sourceName), parameterBoundAsString(typeParameter, false) },
+ new String[] { new String(typeArgument.shortReadableName()), new String(genericType.shortReadableName()), new String(typeParameter.sourceName), parameterBoundAsString(typeParameter, true) },
+ AbortCompilation | Error,
+ 0,
+ 1);
+ return;
+ }
+ this.handle(
+ IProblem.TypeArgumentMismatch,
+ new String[] { new String(typeArgument.readableName()), new String(genericType.readableName()), new String(typeParameter.sourceName), parameterBoundAsString(typeParameter, false) },
+ new String[] { new String(typeArgument.shortReadableName()), new String(genericType.shortReadableName()), new String(typeParameter.sourceName), parameterBoundAsString(typeParameter, true) },
location.sourceStart,
location.sourceEnd);
}
-public void typeMismatchErrorActualTypeExpectedType(Expression expression, TypeBinding constantType, TypeBinding expectedType) {
- String constantTypeName = new String(constantType.readableName());
- String expectedTypeName = new String(expectedType.readableName());
- String constantTypeShortName = new String(constantType.shortReadableName());
- String expectedTypeShortName = new String(expectedType.shortReadableName());
- if (constantTypeShortName.equals(expectedTypeShortName)){
- constantTypeShortName = constantTypeName;
- expectedTypeShortName = expectedTypeName;
- }
+public void typeMismatchError(TypeBinding actualType, TypeBinding expectedType, ASTNode location) {
this.handle(
IProblem.TypeMismatch,
- new String[] {constantTypeName, expectedTypeName},
- new String[] {constantTypeShortName, expectedTypeShortName},
- expression.sourceStart,
- expression.sourceEnd);
+ new String[] {new String(actualType.readableName()), new String(expectedType.readableName())},
+ new String[] {new String(actualType.shortReadableName()), new String(expectedType.shortReadableName())},
+ location.sourceStart,
+ location.sourceEnd);
}
public void undefinedLabel(BranchStatement statement) {
String[] arguments = new String[] {new String(statement.label)};
@@ -3340,12 +3563,21 @@ public void undefinedLabel(BranchStatement statement) {
statement.sourceStart,
statement.sourceEnd);
}
+// can only occur inside binaries
+public void undefinedTypeVariableSignature(char[] variableName, ReferenceBinding binaryType) {
+ this.handle(
+ IProblem.UndefinedTypeVariable,
+ new String[] {new String(variableName), new String(binaryType.readableName()) },
+ new String[] {new String(variableName), new String(binaryType.shortReadableName())},
+ AbortCompilation | Error,
+ 0,
+ 1);
+}
public void undocumentedEmptyBlock(int blockStart, int blockEnd) {
- String[] arguments = new String[] {};
this.handle(
IProblem.UndocumentedEmptyBlock,
- arguments,
- arguments,
+ NoArgument,
+ NoArgument,
blockStart,
blockEnd);
}
@@ -3515,6 +3747,156 @@ public void unresolvableReference(NameReference nameRef, Binding binding) {
nameRef.sourceStart,
end);
}
+public void unsafeCast(CastExpression castExpression) {
+ TypeBinding castedExpressionType = castExpression.expression.resolvedType;
+ this.handle(
+ IProblem.UnsafeGenericCast,
+ new String[]{ new String(castedExpressionType.readableName()), new String(castExpression.resolvedType.readableName())},
+ new String[]{ new String(castedExpressionType.shortReadableName()), new String(castExpression.resolvedType.shortReadableName())},
+ castExpression.sourceStart,
+ castExpression.sourceEnd);
+}
+public void unsafeRawAssignment(Expression expression, TypeBinding expressionType, TypeBinding expectedType) {
+ this.handle(
+ IProblem.UnsafeRawExpressionAssignment,
+ new String[] { new String(expressionType.readableName()), new String(expectedType.readableName()), new String(expectedType.erasure().readableName()) },
+ new String[] { new String(expressionType.shortReadableName()), new String(expectedType.shortReadableName()), new String(expectedType.erasure().shortReadableName()) },
+ expression.sourceStart,
+ expression.sourceEnd);
+}
+public void unsafeRawFieldAssignment(FieldBinding rawField, TypeBinding expressionType, ASTNode location) {
+ this.handle(
+ IProblem.UnsafeRawFieldAssignment,
+ new String[] {
+ new String(expressionType.readableName()), new String(rawField.name), new String(rawField.declaringClass.readableName()), new String(rawField.declaringClass.erasure().readableName()) },
+ new String[] {
+ new String(expressionType.shortReadableName()), new String(rawField.name), new String(rawField.declaringClass.shortReadableName()), new String(rawField.declaringClass.erasure().shortReadableName()) },
+ location.sourceStart,
+ location.sourceEnd);
+}
+public void unsafeRawInvocation(ASTNode location, TypeBinding receiverType, MethodBinding method) {
+ if (method.isConstructor()) {
+ this.handle(
+ IProblem.UnsafeRawConstructorInvocation,
+ new String[] {
+ new String(receiverType.readableName()),
+ parametersAsString(method.original().parameters, false),
+ new String(receiverType.erasure().readableName()),
+ },
+ new String[] {
+ new String(receiverType.shortReadableName()),
+ parametersAsString(method.original().parameters, true),
+ new String(receiverType.erasure().shortReadableName()),
+ },
+ location.sourceStart,
+ location.sourceEnd);
+ } else {
+ this.handle(
+ IProblem.UnsafeRawMethodInvocation,
+ new String[] {
+ new String(method.selector),
+ parametersAsString(method.original().parameters, false),
+ new String(receiverType.readableName()),
+ new String(receiverType.erasure().readableName()),
+ },
+ new String[] {
+ new String(method.selector),
+ parametersAsString(method.original().parameters, true),
+ new String(receiverType.shortReadableName()),
+ new String(receiverType.erasure().shortReadableName()),
+ },
+ location.sourceStart,
+ location.sourceEnd);
+ }
+}
+public void unsafeInvocationWithRawArguments(ASTNode location, TypeBinding receiverType, MethodBinding method, TypeBinding[] argumentTypes) {
+ if (method.isConstructor()) {
+ this.handle(
+ IProblem.UnsafeConstructorWithRawArguments,
+ new String[] {
+ new String(receiverType.readableName()),
+ parametersAsString(method.original().parameters, false),
+ parametersAsString(argumentTypes, false),
+ },
+ new String[] {
+ new String(receiverType.shortReadableName()),
+ parametersAsString(method.original().parameters, true),
+ parametersAsString(argumentTypes, true),
+ },
+ location.sourceStart,
+ location.sourceEnd);
+ } else {
+ this.handle(
+ IProblem.UnsafeMethodWithRawArguments,
+ new String[] {
+ new String(method.selector),
+ parametersAsString(method.original().parameters, false),
+ new String(receiverType.readableName()),
+ parametersAsString(argumentTypes, false),
+ },
+ new String[] {
+ new String(method.selector),
+ parametersAsString(method.original().parameters, true),
+ new String(receiverType.shortReadableName()),
+ parametersAsString(argumentTypes, true),
+ },
+ location.sourceStart,
+ location.sourceEnd);
+ }
+}
+public void unsafeRawReturnValue(Expression expression, TypeBinding expressionType, TypeBinding expectedType) {
+ this.handle(
+ IProblem.UnsafeRawReturnValue,
+ new String[] { new String(expressionType.readableName()), new String(expectedType.readableName()), new String(expectedType.erasure().readableName()) },
+ new String[] { new String(expressionType.shortReadableName()), new String(expectedType.shortReadableName()), new String(expectedType.erasure().shortReadableName()) },
+ expression.sourceStart,
+ expression.sourceEnd);
+}
+public void unsafeWildcardInvocation(ASTNode location, TypeBinding receiverType, MethodBinding method, TypeBinding[] arguments) {
+ if (method.isConstructor()) {
+ this.handle(
+ IProblem.UnsafeWildcardConstructorInvocation,
+ new String[] {
+ new String(receiverType.readableName()),
+ parametersAsString(method.parameters, false),
+ parametersAsString(arguments, false),
+ },
+ new String[] {
+ new String(receiverType.shortReadableName()),
+ parametersAsString(method.parameters, true),
+ parametersAsString(arguments, true),
+ },
+ location.sourceStart,
+ location.sourceEnd);
+ } else {
+ this.handle(
+ IProblem.UnsafeWildcardMethodInvocation,
+ new String[] {
+ new String(method.selector),
+ parametersAsString(method.parameters, false),
+ new String(receiverType.readableName()),
+ parametersAsString(arguments, false),
+ },
+ new String[] {
+ new String(method.selector),
+ parametersAsString(method.parameters, true),
+ new String(receiverType.shortReadableName()),
+ parametersAsString(arguments, true),
+ },
+ location.sourceStart,
+ location.sourceEnd);
+ }
+}
+public void unsafeWildcardAssignment(TypeBinding variableType, TypeBinding expressionType, ASTNode location) {
+ this.handle(
+ IProblem.UnsafeWildcardFieldAssignment,
+ new String[] {
+ new String(expressionType.readableName()), new String(variableType.readableName()) },
+ new String[] {
+ new String(expressionType.shortReadableName()), new String(variableType.shortReadableName()) },
+ location.sourceStart,
+ location.sourceEnd);
+}
public void unusedArgument(LocalDeclaration localDecl) {
String[] arguments = new String[] {new String(localDecl.name)};
@@ -3531,12 +3913,12 @@ public void unusedDeclaredThrownException(ReferenceBinding exceptionType, Abstra
IProblem.UnusedConstructorDeclaredThrownException,
new String[] {
new String(method.binding.declaringClass.readableName()),
- parametersAsString(method.binding),
+ parametersAsString(method.binding.parameters, false),
new String(exceptionType.readableName()),
},
new String[] {
new String(method.binding.declaringClass.shortReadableName()),
- parametersAsShortString(method.binding),
+ parametersAsString(method.binding.parameters, true),
new String(exceptionType.shortReadableName()),
},
location.sourceStart,
@@ -3547,13 +3929,13 @@ public void unusedDeclaredThrownException(ReferenceBinding exceptionType, Abstra
new String[] {
new String(method.binding.declaringClass.readableName()),
new String(method.selector),
- parametersAsString(method.binding),
+ parametersAsString(method.binding.parameters, false),
new String(exceptionType.readableName()),
},
new String[] {
new String(method.binding.declaringClass.shortReadableName()),
new String(method.selector),
- parametersAsShortString(method.binding),
+ parametersAsString(method.binding.parameters, true),
new String(exceptionType.shortReadableName()),
},
location.sourceStart,
@@ -3590,11 +3972,11 @@ public void unusedPrivateConstructor(ConstructorDeclaration constructorDecl) {
IProblem.UnusedPrivateConstructor,
new String[] {
new String(constructor.declaringClass.readableName()),
- parametersAsString(constructor)
+ parametersAsString(constructor.parameters, false)
},
new String[] {
new String(constructor.declaringClass.shortReadableName()),
- parametersAsShortString(constructor)
+ parametersAsString(constructor.parameters, true)
},
constructorDecl.sourceStart,
constructorDecl.sourceEnd);
@@ -3674,12 +4056,12 @@ public void unusedPrivateMethod(AbstractMethodDeclaration methodDecl) {
new String[] {
new String(method.declaringClass.readableName()),
new String(method.selector),
- parametersAsString(method)
+ parametersAsString(method.parameters, false)
},
new String[] {
new String(method.declaringClass.shortReadableName()),
new String(method.selector),
- parametersAsShortString(method)
+ parametersAsString(method.parameters, true)
},
methodDecl.sourceStart,
methodDecl.sourceEnd);
@@ -4099,5 +4481,52 @@ public void wrongSequenceOfExceptionTypesError(TryStatement statement, TypeBindi
typeRef.sourceStart,
typeRef.sourceEnd);
}
-
+public void invalidUsageOfTypeParameters(TypeParameter firstTypeParameter, TypeParameter lastTypeParameter) {
+ this.handle(
+ IProblem.InvalidUsageOfTypeParameters,
+ NoArgument,
+ NoArgument,
+ firstTypeParameter.declarationSourceStart,
+ lastTypeParameter.declarationSourceEnd);
+}
+public void invalidUsageOfStaticImports(ImportReference staticImport) {
+ this.handle(
+ IProblem.InvalidUsageOfStaticImports,
+ NoArgument,
+ NoArgument,
+ staticImport.declarationSourceStart,
+ staticImport.declarationSourceEnd);
+}
+public void invalidUsageOfForeachStatements(LocalDeclaration elementVariable, Expression collection) {
+ this.handle(
+ IProblem.InvalidUsageOfForeachStatements,
+ NoArgument,
+ NoArgument,
+ elementVariable.declarationSourceStart,
+ collection.sourceEnd);
+}
+public void invalidUsageOfTypeArguments(TypeReference firstTypeReference, TypeReference lastTypeReference) {
+ this.handle(
+ IProblem.InvalidUsageOfTypeArguments,
+ NoArgument,
+ NoArgument,
+ firstTypeReference.sourceStart,
+ lastTypeReference.sourceEnd);
+}
+public void invalidUsageOfEnumsDeclarations(EnumDeclaration enumDeclaration) {
+ this.handle(
+ IProblem.InvalidUsageOfEnumDeclarations,
+ NoArgument,
+ NoArgument,
+ enumDeclaration.modifiersSourceStart,
+ enumDeclaration.sourceEnd);
+}
+public void invalidUsageOfVarargs(Argument argument) {
+ this.handle(
+ IProblem.InvalidUsageOfVarargs,
+ NoArgument,
+ NoArgument,
+ argument.type.sourceStart,
+ argument.sourceEnd);
+}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
index 84aa385142..7f537dd1d0 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
@@ -10,7 +10,7 @@
###############################################################################
0 = {0}
1 = super cannot be used in java.lang.Object
-2 = {0} cannot be resolved or is not a type
+2 = {0} cannot be resolved to a type
3 = The type {0} is not visible
4 = The type {0} is ambiguous
5 = The type {0} is deprecated
@@ -153,6 +153,7 @@
187 = Unreachable catch block for {0}. It is already handled by the catch block for {1}
188 = Empty control-flow statement
189 = Statement unnecessarily nested within else clause. The corresponding then clause does not complete normally
+
190 = Read access to enclosing field {0}.{1} is emulated by a synthetic accessor method. Increasing its visibility will improve your performance
191 = Write access to enclosing field {0}.{1} is emulated by a synthetic accessor method. Increasing its visibility will improve your performance
192 = Access to enclosing method {1}({2}) from the type {0} is emulated by a synthetic accessor method. Increasing its visibility will improve your performance
@@ -160,9 +161,10 @@
195 = The method {1} is defined in an inherited type and an enclosing scope
196 = The field {0} is defined in an inherited type and an enclosing scope
197 = The type {0} is defined in an inherited type and an enclosing scope
+198 = Cannot allocate the member type {0} using its compound name when qualified by an enclosing instance. The member type name is resolved relatively to the qualifying instance type
200 = Cannot use {0} in a static context
-201 = The method {1}({2}) from the type {0} is not static
+201 = Cannot make a static reference to the non-static method {1}({2}) from the type {0}
202 = Cannot specify an array dimension after an empty dimension
203 = Invalid cast type expression
204 = Syntax error on token "{0}", {1} expected
@@ -222,7 +224,7 @@
313 = The type {1} cannot subclass the final class {0}
314 = Duplicate interface {0} for the type {1}
315 = The class {0} cannot be a superinterface of {1}; a superinterface must be an interface
-316 = {1} causes a cycle - the type {0} cannot extend/implement itself or one of its own member types
+316 = Cycle detected: the type {0} cannot extend/implement itself or one of its own member types
317 = A cycle exists in the type hierarchy between {0} and {1}
318 = Nested type {0} hides an enclosing type
319 = Duplicate nested type {0}
@@ -237,16 +239,17 @@
328 = The declared package does not match the expected package {0}
329 = The type java.lang.Object cannot have a superclass or superinterfaces
-330 = {0} cannot be resolved or is not a valid superclass
-331 = Superclass {0} is not visible
-332 = Superclass {0} is ambiguous
-333 = Superclass {0} cannot be referenced using its binary name
-334 = Superclass {0} is defined in an inherited type and an enclosing scope
-335 = {0} cannot be resolved or is not a valid superinterface
-336 = Superinterface {0} is not visible
-337 = Superinterface {0} is ambiguous
-338 = Superinterface {0} cannot be referenced using its binary name
-339 = Superinterface {0} is defined in an inherited type and an enclosing scope
+###[obsolete] 330 = {0} cannot be resolved or is not a valid superclass
+###[obsolete] 331 = Superclass {0} is not visible
+###[obsolete] 332 = Superclass {0} is ambiguous
+###[obsolete] 333 = Superclass {0} cannot be referenced using its binary name
+###[obsolete] 334 = Superclass {0} is defined in an inherited type and an enclosing scope
+###[obsolete] 335 = {0} cannot be resolved or is not a valid superinterface
+###[obsolete] 336 = Superinterface {0} is not visible
+###[obsolete] 337 = Superinterface {0} is ambiguous
+###[obsolete] 338 = Superinterface {0} cannot be referenced using its binary name
+###[obsolete] 339 = Superinterface {0} is defined in an inherited type and an enclosing scope
+
340 = Duplicate field {0}.{1}
341 = Duplicate modifier for the field {0}
342 = Illegal modifier for the field {0}; only public, protected, private, static, final, transient & volatile are permitted
@@ -255,12 +258,13 @@
345 = The field {0} can be either final or volatile, not both
346 = The field {0} cannot be declared static; static fields can only be declared in static or top level types
-350 = {2} cannot be resolved (or is not a valid type) for the field {1}.{0}
-351 = The type {2} is not visible for the field {1}.{0}
-352 = The type {2} is ambiguous for the field {1}.{0}
-353 = The field type {2} cannot be referenced using its binary name
-354 = The field type {2} is defined in an inherited type and an enclosing scope
-355 = Duplicate method {0} in type {1}
+###[obsolete] 350 = {2} cannot be resolved (or is not a valid type) for the field {1}.{0}
+###[obsolete] 351 = The type {2} is not visible for the field {1}.{0}
+###[obsolete] 352 = The type {2} is ambiguous for the field {1}.{0}
+###[obsolete] 353 = The field type {2} cannot be referenced using its binary name
+###[obsolete] 354 = The field type {2} is defined in an inherited type and an enclosing scope
+
+355 = Duplicate method {0}({2}) in type {1}
356 = Illegal modifier for parameter {0}; only final is permitted
357 = Duplicate modifier for the method {1} in type {0}
358 = Illegal modifier for the method {1} in type {0}
@@ -275,30 +279,33 @@
367 = The native method {1} cannot also be declared strictfp
368 = Duplicate modifier for parameter {0}
-370 = {2} cannot be resolved (or is not a valid type) for the parameter {1} of the method {0}
-371 = The type {2} is not visible for the parameter {1} of the method {0}
-372 = The type {2} is ambiguous for the parameter {1} of the method {0}
-373 = The parameter type {2} cannot be referenced using its binary name
-374 = The parameter type {2} is defined in an inherited type and an enclosing scope
-375 = {1} cannot be resolved (or is not an exception type) for the method {0}
-376 = The exception type {1} is not visible for the method {0}
-377 = The exception type {1} is ambiguous for the method {0}
-378 = The exception type {1} cannot be referenced using its binary name
-379 = The exception type {1} is defined in an inherited type and an enclosing scope
-380 = {1} cannot be resolved (or is not a valid return type) for the method {0}
-381 = The return type {1} is not visible for the method {0}
-382 = The return type {1} is ambiguous for the method {0}
-383 = The return type {1} cannot be referenced using its binary name
-384 = The return type {1} is defined in an inherited type and an enclosing scope
+###[obsolete] 370 = {2} cannot be resolved (or is not a valid type) for the parameter {1} of the method {0}
+###[obsolete] 371 = The type {2} is not visible for the parameter {1} of the method {0}
+###[obsolete] 372 = The type {2} is ambiguous for the parameter {1} of the method {0}
+###[obsolete] 373 = The parameter type {2} cannot be referenced using its binary name
+###[obsolete] 374 = The parameter type {2} is defined in an inherited type and an enclosing scope
+###[obsolete] 375 = {1} cannot be resolved (or is not an exception type) for the method {0}
+###[obsolete] 376 = The exception type {1} is not visible for the method {0}
+###[obsolete] 377 = The exception type {1} is ambiguous for the method {0}
+###[obsolete] 378 = The exception type {1} cannot be referenced using its binary name
+###[obsolete] 379 = The exception type {1} is defined in an inherited type and an enclosing scope
+###[obsolete] 380 = {1} cannot be resolved (or is not a valid return type) for the method {0}
+###[obsolete] 381 = The return type {1} is not visible for the method {0}
+###[obsolete] 382 = The return type {1} is ambiguous for the method {0}
+###[obsolete] 383 = The return type {1} cannot be referenced using its binary name
+###[obsolete] 384 = The return type {1} is defined in an inherited type and an enclosing scope
+
385 = The import {0} conflicts with a type defined in the same file
386 = The import {0} collides with another imported type
387 = Only a type can be imported. {0} resolves to a package
388 = The import {0} is never used
390 = The import {0} cannot be resolved
-391 = The imported type {0} is not visible
-392 = The imported type {0} is ambiguous
-393 = The imported type {0} cannot be referenced using its binary name
-394 = The imported type {0} is defined in an inherited type and an enclosing scope
+
+###[obsolete] 391 = The imported type {0} is not visible
+###[obsolete] 392 = The imported type {0} is ambiguous
+###[obsolete] 393 = The imported type {0} cannot be referenced using its binary name
+###[obsolete] 394 = The imported type {0} is defined in an inherited type and an enclosing scope
+
395 = Duplicate modifier for the variable {0}
396 = Illegal modifier for the variable {0}; only final is permitted
@@ -334,6 +341,7 @@
460 = Empty block should be documented
+### DOC
470 = Unexpected tag
471 = Missing tag for parameter {0}
472 = Missing parameter name
@@ -367,7 +375,7 @@
500 = Cannot invoke {1}({2}) on the primitive type {0}
501 = The method {1}({2}) in the type {0} is not applicable for the arguments ({3})
502 = Cannot invoke {1}({2}) on the array type {0}
-503 = {0} cannot be resolved or is not a type
+503 = {0} cannot be resolved to a type
504 = The type {0} is not visible
505 = The type {0} is ambiguous
506 = The type {0} is deprecated
@@ -379,3 +387,63 @@
512 = Missing closing brace for inline tag
513 = Malformed reference (missing separator after method reference closing brace)
515 = Javadoc:
+
+### GENERICS
+520 = Duplicate type parameter {0}
+521 = Cannot refer to the type parameter {0} as a supertype
+522 = Cannot make a static reference to the type parameter {0}
+523 = The type java.lang.Object cannot be declared as a generic
+524 = The type {0} is not generic; it cannot be parameterized with arguments <{1}>
+525 = Incorrect number of arguments for type {0}; it cannot be parameterized with arguments <{1}>
+526 = Bound mismatch: The type {0} is not a valid substitute for the bounded parameter <{2} extends {3}> of the type {1}
+527 = Method {0}({2}) has the same erasure {0}({3}) as another method in type {1}
+528 = Illegal forward reference to type parameter {0}
+529 = The type {0} is not an interface; it cannot be specified as a bounded parameter
+530 = Unsafe type operation: Should not invoke the constructor {0}({1}) of raw type {0}. References to generic type {2} should be parameterized
+531 = Unsafe type operation: Should not invoke the method {0}({1}) of raw type {2}. References to generic type {3} should be parameterized
+532 = Unsafe type operation: Should not assign expression of raw type {0} to type {1}. References to generic type {2} should be parameterized
+533 = Unsafe type operation: The constructor {0}({1}) should not be applied for the arguments ({2}). References to generic types should be parameterized
+534 = Unsafe type operation: The method {0}({1}) in the type {2} should not be applied for the arguments ({3}). References to generic types should be parameterized
+535 = An array of parameterized type {0} is an invalid type
+536 = Unsafe type operation: Should not assign expression of type {0} to the field {1} of raw type {2}. References to generic type {3} should be parameterized
+537 = Cannot instantiate the generic type {0} using wildcard arguments ({1})
+538 = The type parameter {0} should not be bounded by the final type {1}. Final types cannot be further extended
+539 = Inconsistent classfile encountered: The undefined type parameter {0} is referenced from within {1}
+540 = The interface {2} cannot be implemented simultaneously with different arguments: {0} and {1}
+541 = Unsafe wildcard operation: The constructor {0}({1}) of type {0} is not applicable for the arguments ({2})
+542 = Unsafe wildcard operation: The method {0}({1}) of type {2} is not applicable for the arguments ({3})
+543 = Unsafe wildcard operation: Cannot assign expression of type {0} to wildcard type {1}
+544 = Bound mismatch: The generic method {0}({1}) of type {2} is not applicable for the arguments ({3}) since the type {4} is not a valid substitute for the bounded parameter <{5} extends {6}>
+545 = Bound mismatch: The generic constructor {0}({1}) of type {2} is not applicable for the arguments ({3}) since the type {4} is not a valid substitute for the bounded parameter <{5} extends {6}>
+546 = Unsafe type operation: The cast from {0} to parameterized type {1} will not check conformance of type arguments at runtime
+547 = Unsafe type operation: Should not return value of raw type {0} instead of type {1}. References to generic type {2} should be parameterized
+548 = Cannot perform instanceof check against parameterized type {0}. Use instead its raw form {1} since generic type information will be erased at runtime
+549 = Cannot perform instanceof check against type parameter {0}. Use instead its erasure {1} since generic type information will be erased at runtime
+550 = The method {0}({1}) of type {2} is not generic; it cannot be parameterized with arguments <{3}>
+551 = Incorrect number of type arguments for generic method <{3}>{0}({1}) of type {2}; it cannot be parameterized with arguments <{4}>
+552 = The parameterized method <{3}>{0}({1}) of type {2} is not applicable for the arguments ({4})
+553 = The constructor {0}({1}) of type {2} is not generic; it cannot be parameterized with arguments <{3}>
+554 = Incorrect number of type arguments for generic constructor <{3}>{0}({1}) of type {2}; it cannot be parameterized with arguments <{4}>
+555 = The parameterized constructor <{3}>{0}({1}) of type {2} is not applicable for the arguments ({4})
+556 = Cannot use the parameterized type {0} either in catch block or throws clause
+
+### FOREACH
+580 = Type mismatch: cannot convert from element type {0} to {1}
+581 = Can only iterate over an array or an instance of java.lang.Iterable
+
+### SOURCE LEVEL
+590 = Syntax error, type parameters are only available if source level is 1.5
+591 = Syntax error, static imports are only available if source level is 1.5
+592 = Syntax error, ''for each'' statements are only available if source level is 1.5
+593 = Syntax error, parameterized types are only available if source level is 1.5
+594 = Syntax error, enum declarations are only available if source level is 1.5
+595 = Syntax error, varargs are only available if source level is 1.5
+596 = Syntax error, annotations are only available if source level is 1.5
+
+### ANNOTATIONS
+600 = This annotation type member declaration has a constructor name
+601 = Extended dimensions are illegal in an annotation type member declaration
+602 = Package annotations must be in file package-info.java
+
+### CORRUPTED BINARIES
+700 = The class file {0} contains a signature ''{1}'' ill-formed at position {2}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/messages.properties b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/messages.properties
index 8a1f05c1b6..7a53316066 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/messages.properties
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/messages.properties
@@ -54,10 +54,6 @@ parser.endOfConstructor = end of constructor
parser.endOfMethod = end of method
parser.endOfInitializer = end of initializer
-### binding
-binding.subclass = anonymous subclass of {0}
-binding.implementation = anonymous implementation of {0}
-
### ast
ast.missingCode = Missing code gen implementation
@@ -66,4 +62,5 @@ constant.cannotCastedInto = {0} constant cannot be casted into {1}
constant.cannotConvertedTo = {0} constant cannot be converted to {1}
### miscellaneous
-error.undefinedBaseType = Undefined base type: {0}
+error.undefinedTypeVariable = Undefined type variable: {0}
+error.missingBound = The class files for {0} and {1} are out of sync \ No newline at end of file
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
index 34d301a006..ac5ba52b9f 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
@@ -252,7 +252,6 @@ public final class AST {
CompilationUnit cu = converter.convert(compilationUnitDeclaration, source);
cu.setLineEndTable(compilationUnitDeclaration.compilationResult.lineSeparatorPositions);
- resolver.storeModificationCount(ast.modificationCount());
ast.setDefaultNodeFlag(savedDefaultNodeFlag);
return cu;
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
index a2f330253a..63e9b5d191 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
@@ -22,12 +22,21 @@ import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.compiler.IProblem;
import org.eclipse.jdt.core.compiler.InvalidInputException;
+import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.Argument;
+import org.eclipse.jdt.internal.compiler.ast.EnumConstant;
+import org.eclipse.jdt.internal.compiler.ast.ForeachStatement;
import org.eclipse.jdt.internal.compiler.ast.JavadocArgumentExpression;
import org.eclipse.jdt.internal.compiler.ast.JavadocFieldReference;
import org.eclipse.jdt.internal.compiler.ast.JavadocMessageSend;
+import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
+import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference;
import org.eclipse.jdt.internal.compiler.ast.StringLiteralConcatenation;
+import org.eclipse.jdt.internal.compiler.ast.TypeReference;
+import org.eclipse.jdt.internal.compiler.ast.Wildcard;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.env.IConstants;
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
@@ -40,17 +49,17 @@ import org.eclipse.jdt.internal.compiler.parser.TerminalTokens;
*/
class ASTConverter {
- private AST ast;
+ protected AST ast;
+ protected Comment[] commentsTable;
char[] compilationUnitSource;
- Scanner scanner;
- private boolean resolveBindings;
- private Set pendingThisExpressionScopeResolution;
- private Set pendingNameScopeResolution;
- private IProgressMonitor monitor;
+ protected DocCommentParser docParser;
// comments
- private boolean insideComments;
- private DocCommentParser docParser;
- private Comment[] commentsTable;
+ protected boolean insideComments;
+ protected IProgressMonitor monitor;
+ protected Set pendingNameScopeResolution;
+ protected Set pendingThisExpressionScopeResolution;
+ protected boolean resolveBindings;
+ Scanner scanner;
private DefaultCommentMapper commentMapper;
public ASTConverter(Map options, boolean resolveBindings, IProgressMonitor monitor) {
@@ -67,222 +76,311 @@ class ASTConverter {
this.insideComments = JavaCore.ENABLED.equals(options.get(JavaCore.COMPILER_DOC_COMMENT_SUPPORT));
}
- public void setAST(AST ast) {
- this.ast = ast;
- this.docParser = new DocCommentParser(this.ast, this.scanner, this.insideComments);
+ protected void adjustSourcePositionsForParent(org.eclipse.jdt.internal.compiler.ast.Expression expression) {
+ int start = expression.sourceStart;
+ int end = expression.sourceEnd;
+ int leftParentCount = 1;
+ int rightParentCount = 0;
+ this.scanner.resetTo(start, end);
+ try {
+ int token = this.scanner.getNextToken();
+ expression.sourceStart = this.scanner.currentPosition;
+ boolean stop = false;
+ while (!stop && ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF)) {
+ switch(token) {
+ case TerminalTokens.TokenNameLPAREN:
+ leftParentCount++;
+ break;
+ case TerminalTokens.TokenNameRPAREN:
+ rightParentCount++;
+ if (rightParentCount == leftParentCount) {
+ // we found the matching parenthesis
+ stop = true;
+ }
+ }
+ }
+ expression.sourceEnd = this.scanner.startPosition - 1;
+ } catch(InvalidInputException e) {
+ // ignore
+ }
}
- /*
- * Internal use only
- * Used to convert class body declarations
- */
- public TypeDeclaration convert(org.eclipse.jdt.internal.compiler.ast.ASTNode[] nodes) {
- TypeDeclaration typeDecl = this.ast.newTypeDeclaration();
- int nodesLength = nodes.length;
- for (int i = 0; i < nodesLength; i++) {
- org.eclipse.jdt.internal.compiler.ast.ASTNode node = nodes[i];
- if (node instanceof org.eclipse.jdt.internal.compiler.ast.Initializer) {
- org.eclipse.jdt.internal.compiler.ast.Initializer oldInitializer = (org.eclipse.jdt.internal.compiler.ast.Initializer) node;
- Initializer initializer = this.ast.newInitializer();
- initializer.setBody(convert(oldInitializer.block));
- initializer.setModifiers(oldInitializer.modifiers);
- initializer.setSourceRange(oldInitializer.declarationSourceStart, oldInitializer.sourceEnd - oldInitializer.declarationSourceStart + 1);
-// setJavaDocComment(initializer);
-// initializer.setJavadoc(convert(oldInitializer.javadoc));
- convert(oldInitializer.javadoc, initializer);
- typeDecl.bodyDeclarations().add(initializer);
- } else if (node instanceof org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) {
- org.eclipse.jdt.internal.compiler.ast.FieldDeclaration fieldDeclaration = (org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) node;
- if (i > 0
- && (nodes[i - 1] instanceof org.eclipse.jdt.internal.compiler.ast.FieldDeclaration)
- && ((org.eclipse.jdt.internal.compiler.ast.FieldDeclaration)nodes[i - 1]).declarationSourceStart == fieldDeclaration.declarationSourceStart) {
- // we have a multiple field declaration
- // We retrieve the existing fieldDeclaration to add the new VariableDeclarationFragment
- FieldDeclaration currentFieldDeclaration = (FieldDeclaration) typeDecl.bodyDeclarations().get(typeDecl.bodyDeclarations().size() - 1);
- currentFieldDeclaration.fragments().add(convertToVariableDeclarationFragment(fieldDeclaration));
- } else {
- // we can create a new FieldDeclaration
- typeDecl.bodyDeclarations().add(convertToFieldDeclaration(fieldDeclaration));
+ protected void buildBodyDeclarations(EnumConstant enumConstant, EnumConstantDeclaration enumConstantDeclaration) {
+ // add body declaration in the lexical order
+ org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] members = enumConstant.memberTypes;
+ org.eclipse.jdt.internal.compiler.ast.FieldDeclaration[] fields = enumConstant.fields;
+ org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration[] methods = enumConstant.methods;
+
+ int fieldsLength = fields == null? 0 : fields.length;
+ int methodsLength = methods == null? 0 : methods.length;
+ int membersLength = members == null ? 0 : members.length;
+ int fieldsIndex = 0;
+ int methodsIndex = 0;
+ int membersIndex = 0;
+
+ while ((fieldsIndex < fieldsLength)
+ || (membersIndex < membersLength)
+ || (methodsIndex < methodsLength)) {
+ org.eclipse.jdt.internal.compiler.ast.FieldDeclaration nextFieldDeclaration = null;
+ org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration nextMethodDeclaration = null;
+ org.eclipse.jdt.internal.compiler.ast.TypeDeclaration nextMemberDeclaration = null;
+
+ int position = Integer.MAX_VALUE;
+ int nextDeclarationType = -1;
+ if (fieldsIndex < fieldsLength) {
+ nextFieldDeclaration = fields[fieldsIndex];
+ if (nextFieldDeclaration.declarationSourceStart < position) {
+ position = nextFieldDeclaration.declarationSourceStart;
+ nextDeclarationType = 0; // FIELD
}
- } else if(node instanceof org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration) {
- AbstractMethodDeclaration nextMethodDeclaration = (AbstractMethodDeclaration) node;
- if (!nextMethodDeclaration.isDefaultConstructor() && !nextMethodDeclaration.isClinit()) {
- typeDecl.bodyDeclarations().add(convert(nextMethodDeclaration));
+ }
+ if (methodsIndex < methodsLength) {
+ nextMethodDeclaration = methods[methodsIndex];
+ if (nextMethodDeclaration.declarationSourceStart < position) {
+ position = nextMethodDeclaration.declarationSourceStart;
+ nextDeclarationType = 1; // METHOD
}
- } else if(node instanceof org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) {
- org.eclipse.jdt.internal.compiler.ast.TypeDeclaration nextMemberDeclaration = (org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) node;
- typeDecl.bodyDeclarations().add(convert(nextMemberDeclaration));
}
- }
- return typeDecl;
- }
-
- public CompilationUnit convert(org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration unit, char[] source) {
- this.compilationUnitSource = source;
- this.scanner.setSource(source);
- this.scanner.lineEnds = unit.compilationResult().lineSeparatorPositions;
- CompilationUnit compilationUnit = this.ast.newCompilationUnit();
- // handle the package declaration immediately
- // There is no node corresponding to the package declaration
- if (this.resolveBindings) {
- recordNodes(compilationUnit, unit);
- }
- if (unit.currentPackage != null) {
- PackageDeclaration packageDeclaration = convertPackage(unit);
- compilationUnit.setPackage(packageDeclaration);
- }
- org.eclipse.jdt.internal.compiler.ast.ImportReference[] imports = unit.imports;
- if (imports != null) {
- int importLength = imports.length;
- for (int i = 0; i < importLength; i++) {
- compilationUnit.imports().add(convertImport(imports[i]));
+ if (membersIndex < membersLength) {
+ nextMemberDeclaration = members[membersIndex];
+ if (nextMemberDeclaration.declarationSourceStart < position) {
+ position = nextMemberDeclaration.declarationSourceStart;
+ nextDeclarationType = 2; // MEMBER
+ }
}
- }
-
- // 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;
- for (int i = 0; i < typesLength; i++) {
- compilationUnit.types().add(convert(types[i]));
+ switch (nextDeclarationType) {
+ case 0 :
+ checkAndAddMultipleFieldDeclaration(fields, fieldsIndex, enumConstantDeclaration.bodyDeclarations());
+ fieldsIndex++;
+ break;
+ case 1 :
+ methodsIndex++;
+ if (!nextMethodDeclaration.isDefaultConstructor() && !nextMethodDeclaration.isClinit()) {
+ enumConstantDeclaration.bodyDeclarations().add(convert(nextMethodDeclaration));
+ }
+ break;
+ case 2 :
+ membersIndex++;
+ enumConstantDeclaration.bodyDeclarations().add(convert(nextMemberDeclaration));
+ break;
}
}
- compilationUnit.setSourceRange(unit.sourceStart, unit.sourceEnd - unit.sourceStart + 1);
+ convert(enumConstant.javadoc, enumConstantDeclaration);
+ }
+
+ protected void buildBodyDeclarations(org.eclipse.jdt.internal.compiler.ast.AnnotationTypeDeclaration typeDeclaration, AnnotationTypeDeclaration typeDecl) {
+ // add body declaration in the lexical order
+ org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] members = typeDeclaration.memberTypes;
+ org.eclipse.jdt.internal.compiler.ast.FieldDeclaration[] fields = typeDeclaration.fields;
+ org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration[] methods = typeDeclaration.methods;
- int problemLength = unit.compilationResult.problemCount;
- if (problemLength != 0) {
- IProblem[] resizedProblems = null;
- final IProblem[] problems = unit.compilationResult.problems;
- if (problems.length == problemLength) {
- resizedProblems = problems;
- } else {
- System.arraycopy(problems, 0, (resizedProblems = new IProblem[problemLength]), 0, problemLength);
+ int fieldsLength = fields == null? 0 : fields.length;
+ int methodsLength = methods == null? 0 : methods.length;
+ int membersLength = members == null ? 0 : members.length;
+ int fieldsIndex = 0;
+ int methodsIndex = 0;
+ int membersIndex = 0;
+
+ while ((fieldsIndex < fieldsLength)
+ || (membersIndex < membersLength)
+ || (methodsIndex < methodsLength)) {
+ org.eclipse.jdt.internal.compiler.ast.FieldDeclaration nextFieldDeclaration = null;
+ org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration nextMethodDeclaration = null;
+ org.eclipse.jdt.internal.compiler.ast.TypeDeclaration nextMemberDeclaration = null;
+
+ int position = Integer.MAX_VALUE;
+ int nextDeclarationType = -1;
+ if (fieldsIndex < fieldsLength) {
+ nextFieldDeclaration = fields[fieldsIndex];
+ if (nextFieldDeclaration.declarationSourceStart < position) {
+ position = nextFieldDeclaration.declarationSourceStart;
+ nextDeclarationType = 0; // FIELD
+ }
+ }
+ if (methodsIndex < methodsLength) {
+ nextMethodDeclaration = methods[methodsIndex];
+ if (nextMethodDeclaration.declarationSourceStart < position) {
+ position = nextMethodDeclaration.declarationSourceStart;
+ nextDeclarationType = 1; // METHOD
+ }
+ }
+ if (membersIndex < membersLength) {
+ nextMemberDeclaration = members[membersIndex];
+ if (nextMemberDeclaration.declarationSourceStart < position) {
+ position = nextMemberDeclaration.declarationSourceStart;
+ nextDeclarationType = 2; // MEMBER
+ }
+ }
+ switch (nextDeclarationType) {
+ case 0 :
+ checkAndAddMultipleFieldDeclaration(fields, fieldsIndex, typeDecl.bodyDeclarations());
+ fieldsIndex++;
+ break;
+ case 1 :
+ methodsIndex++;
+ if (!nextMethodDeclaration.isDefaultConstructor() && !nextMethodDeclaration.isClinit()) {
+ typeDecl.bodyDeclarations().add(convert(nextMethodDeclaration));
+ }
+ break;
+ case 2 :
+ membersIndex++;
+ ASTNode node = convert(nextMemberDeclaration);
+ if (node == null) {
+ typeDecl.setFlags(typeDecl.getFlags() | ASTNode.MALFORMED);
+ } else {
+ typeDecl.bodyDeclarations().add(node);
+ }
}
- propagateErrors(compilationUnit, resizedProblems);
- compilationUnit.setProblems(resizedProblems);
- }
- if (this.resolveBindings) {
- lookupForScopes();
}
- compilationUnit.initCommentMapper(this.scanner);
- return compilationUnit;
+ // Convert javadoc
+ convert(typeDeclaration.javadoc, typeDecl);
}
- /**
- * @param compilationUnit
- * @param comments
- */
- void buildCommentsTable(CompilationUnit compilationUnit, int[][] comments) {
- // Build comment table
- this.commentsTable = new Comment[comments.length];
- int nbr = 0;
- for (int i = 0; i < comments.length; i++) {
- Comment comment = createComment(comments[i]);
- if (comment != null) {
- comment.setAlternateRoot(compilationUnit);
- this.commentsTable[nbr++] = comment;
+ protected void buildBodyDeclarations(org.eclipse.jdt.internal.compiler.ast.EnumDeclaration enumDeclaration2, EnumDeclaration enumDeclaration) {
+ // add body declaration in the lexical order
+ org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] members = enumDeclaration2.memberTypes;
+ org.eclipse.jdt.internal.compiler.ast.FieldDeclaration[] fields = enumDeclaration2.fields;
+ org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration[] methods = enumDeclaration2.methods;
+ org.eclipse.jdt.internal.compiler.ast.EnumConstant[] enumConstants = enumDeclaration2.enumConstants;
+
+ int fieldsLength = fields == null? 0 : fields.length;
+ int methodsLength = methods == null? 0 : methods.length;
+ int membersLength = members == null ? 0 : members.length;
+ int enumConstantsLength = enumConstants == null ? 0 : enumConstants.length;
+ int fieldsIndex = 0;
+ int methodsIndex = 0;
+ int membersIndex = 0;
+ int enumConstantsIndex = 0;
+
+ while ((fieldsIndex < fieldsLength)
+ || (membersIndex < membersLength)
+ || (methodsIndex < methodsLength)
+ || (enumConstantsIndex < enumConstantsLength)) {
+ org.eclipse.jdt.internal.compiler.ast.FieldDeclaration nextFieldDeclaration = null;
+ org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration nextMethodDeclaration = null;
+ org.eclipse.jdt.internal.compiler.ast.TypeDeclaration nextMemberDeclaration = null;
+ org.eclipse.jdt.internal.compiler.ast.EnumConstant nextEnumConstant = null;
+
+ int position = Integer.MAX_VALUE;
+ int nextDeclarationType = -1;
+ if (fieldsIndex < fieldsLength) {
+ nextFieldDeclaration = fields[fieldsIndex];
+ if (nextFieldDeclaration.declarationSourceStart < position) {
+ position = nextFieldDeclaration.declarationSourceStart;
+ nextDeclarationType = 0; // FIELD
+ }
+ }
+ if (methodsIndex < methodsLength) {
+ nextMethodDeclaration = methods[methodsIndex];
+ if (nextMethodDeclaration.declarationSourceStart < position) {
+ position = nextMethodDeclaration.declarationSourceStart;
+ nextDeclarationType = 1; // METHOD
+ }
+ }
+ if (membersIndex < membersLength) {
+ nextMemberDeclaration = members[membersIndex];
+ if (nextMemberDeclaration.declarationSourceStart < position) {
+ position = nextMemberDeclaration.declarationSourceStart;
+ nextDeclarationType = 2; // MEMBER
+ }
+ }
+ if (enumConstantsIndex < enumConstantsLength) {
+ nextEnumConstant = enumConstants[enumConstantsIndex];
+ if (nextEnumConstant.declarationSourceStart < position) {
+ position = nextEnumConstant.declarationSourceStart;
+ nextDeclarationType = 3; // ENUM CONSTANT
+ }
+ }
+ switch (nextDeclarationType) {
+ case 0 :
+ checkAndAddMultipleFieldDeclaration(fields, fieldsIndex, enumDeclaration.bodyDeclarations());
+ fieldsIndex++;
+ break;
+ case 1 :
+ methodsIndex++;
+ if (!nextMethodDeclaration.isDefaultConstructor() && !nextMethodDeclaration.isClinit()) {
+ enumDeclaration.bodyDeclarations().add(convert(nextMethodDeclaration));
+ }
+ break;
+ case 2 :
+ membersIndex++;
+ enumDeclaration.bodyDeclarations().add(convert(nextMemberDeclaration));
+ break;
+ case 3 :
+ enumConstantsIndex++;
+ enumDeclaration.bodyDeclarations().add(convert(nextEnumConstant));
}
}
- // Resize table if necessary
- if (nbr<comments.length) {
- Comment[] newCommentsTable = new Comment[nbr];
- System.arraycopy(this.commentsTable, 0, newCommentsTable, 0, nbr);
- this.commentsTable = newCommentsTable;
- }
- compilationUnit.setCommentTable(this.commentsTable);
- }
-
- public PackageDeclaration convertPackage(org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration compilationUnitDeclaration) {
- org.eclipse.jdt.internal.compiler.ast.ImportReference importReference = compilationUnitDeclaration.currentPackage;
- PackageDeclaration packageDeclaration = this.ast.newPackageDeclaration();
- char[][] tokens = importReference.tokens;
- int length = importReference.tokens.length;
- long[] positions = importReference.sourcePositions;
- int start = (int)(positions[0]>>>32);
- int end = (int)(positions[length - 1] & 0xFFFFFFFF);
- Name name = null;
- if (length > 1) {
- name = setQualifiedNameNameAndSourceRanges(tokens, positions, importReference);
- } else {
- name = this.ast.newSimpleName(new String(tokens[0]));
- name.setSourceRange(start, end - start + 1);
- }
- packageDeclaration.setSourceRange(importReference.declarationSourceStart, importReference.declarationEnd - importReference.declarationSourceStart + 1);
- packageDeclaration.setName(name);
- if (this.resolveBindings) {
- recordNodes(packageDeclaration, importReference);
- recordNodes(name, compilationUnitDeclaration);
- }
- return packageDeclaration;
+ convert(enumDeclaration2.javadoc, enumDeclaration);
}
- public ImportDeclaration convertImport(org.eclipse.jdt.internal.compiler.ast.ImportReference importReference) {
- ImportDeclaration importDeclaration = this.ast.newImportDeclaration();
- boolean onDemand = importReference.onDemand;
- char[][] tokens = importReference.tokens;
- int length = importReference.tokens.length;
- long[] positions = importReference.sourcePositions;
- Name name = null;
- if (length > 1) {
- name = setQualifiedNameNameAndSourceRanges(tokens, positions, importReference);
- } else {
- name = this.ast.newSimpleName(new String(tokens[0]));
- int start = (int)(positions[0]>>>32);
- int end = (int)(positions[0] & 0xFFFFFFFF);
- name.setSourceRange(start, end - start + 1);
- }
- importDeclaration.setSourceRange(importReference.declarationSourceStart, importReference.declarationEnd - importReference.declarationSourceStart + 1);
- importDeclaration.setName(name);
- importDeclaration.setOnDemand(onDemand);
- if (this.resolveBindings) {
- recordNodes(importDeclaration, importReference);
- }
- return importDeclaration;
- }
-
- public TypeDeclaration convert(org.eclipse.jdt.internal.compiler.ast.TypeDeclaration typeDeclaration) {
- checkCanceled();
- TypeDeclaration typeDecl = this.ast.newTypeDeclaration();
- int modifiers = typeDeclaration.modifiers;
- modifiers &= ~IConstants.AccInterface; // remove AccInterface flags
- modifiers &= CompilerModifiers.AccJustFlag;
- typeDecl.setModifiers(modifiers);
- typeDecl.setInterface(typeDeclaration.isInterface());
- SimpleName typeName = this.ast.newSimpleName(new String(typeDeclaration.name));
- typeName.setSourceRange(typeDeclaration.sourceStart, typeDeclaration.sourceEnd - typeDeclaration.sourceStart + 1);
- typeDecl.setName(typeName);
- typeDecl.setSourceRange(typeDeclaration.declarationSourceStart, typeDeclaration.bodyEnd - typeDeclaration.declarationSourceStart + 1);
+ protected void buildBodyDeclarations(org.eclipse.jdt.internal.compiler.ast.TypeDeclaration expression, AnonymousClassDeclaration anonymousClassDeclaration) {
+ // add body declaration in the lexical order
+ org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] members = expression.memberTypes;
+ org.eclipse.jdt.internal.compiler.ast.FieldDeclaration[] fields = expression.fields;
+ org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration[] methods = expression.methods;
- // need to set the superclass and super interfaces here since we cannot distinguish them at
- // the type references level.
- if (typeDeclaration.superclass != null) {
- typeDecl.setSuperclass(convert(typeDeclaration.superclass));
- }
+ int fieldsLength = fields == null? 0 : fields.length;
+ int methodsLength = methods == null? 0 : methods.length;
+ int membersLength = members == null ? 0 : members.length;
+ int fieldsIndex = 0;
+ int methodsIndex = 0;
+ int membersIndex = 0;
- org.eclipse.jdt.internal.compiler.ast.TypeReference[] superInterfaces = typeDeclaration.superInterfaces;
- if (superInterfaces != null) {
- for (int index = 0, length = superInterfaces.length; index < length; index++) {
- typeDecl.superInterfaces().add(convert(superInterfaces[index]));
- }
- }
+ while ((fieldsIndex < fieldsLength)
+ || (membersIndex < membersLength)
+ || (methodsIndex < methodsLength)) {
+ org.eclipse.jdt.internal.compiler.ast.FieldDeclaration nextFieldDeclaration = null;
+ org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration nextMethodDeclaration = null;
+ org.eclipse.jdt.internal.compiler.ast.TypeDeclaration nextMemberDeclaration = null;
- buildBodyDeclarations(typeDeclaration, typeDecl);
- // The javadoc comment is now got from list store in compilation unit declaration
-// setJavaDocComment(typeDecl);
- if (this.resolveBindings) {
- recordNodes(typeDecl, typeDeclaration);
- recordNodes(typeName, typeDeclaration);
- typeDecl.resolveBinding();
+ int position = Integer.MAX_VALUE;
+ int nextDeclarationType = -1;
+ if (fieldsIndex < fieldsLength) {
+ nextFieldDeclaration = fields[fieldsIndex];
+ if (nextFieldDeclaration.declarationSourceStart < position) {
+ position = nextFieldDeclaration.declarationSourceStart;
+ nextDeclarationType = 0; // FIELD
+ }
+ }
+ if (methodsIndex < methodsLength) {
+ nextMethodDeclaration = methods[methodsIndex];
+ if (nextMethodDeclaration.declarationSourceStart < position) {
+ position = nextMethodDeclaration.declarationSourceStart;
+ nextDeclarationType = 1; // METHOD
+ }
+ }
+ if (membersIndex < membersLength) {
+ nextMemberDeclaration = members[membersIndex];
+ if (nextMemberDeclaration.declarationSourceStart < position) {
+ position = nextMemberDeclaration.declarationSourceStart;
+ nextDeclarationType = 2; // MEMBER
+ }
+ }
+ switch (nextDeclarationType) {
+ case 0 :
+ checkAndAddMultipleFieldDeclaration(fields, fieldsIndex, anonymousClassDeclaration.bodyDeclarations());
+ fieldsIndex++;
+ break;
+ case 1 :
+ methodsIndex++;
+ if (!nextMethodDeclaration.isDefaultConstructor() && !nextMethodDeclaration.isClinit()) {
+ anonymousClassDeclaration.bodyDeclarations().add(convert(nextMethodDeclaration));
+ }
+ break;
+ case 2 :
+ membersIndex++;
+ ASTNode node = convert(nextMemberDeclaration);
+ if (node == null) {
+ anonymousClassDeclaration.setFlags(anonymousClassDeclaration.getFlags() | ASTNode.MALFORMED);
+ } else {
+ anonymousClassDeclaration.bodyDeclarations().add(node);
+ }
+ }
}
- return typeDecl;
}
- private void buildBodyDeclarations(org.eclipse.jdt.internal.compiler.ast.TypeDeclaration typeDeclaration, TypeDeclaration typeDecl) {
+ protected void buildBodyDeclarations(org.eclipse.jdt.internal.compiler.ast.TypeDeclaration typeDeclaration, TypeDeclaration typeDecl) {
// add body declaration in the lexical order
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] members = typeDeclaration.memberTypes;
org.eclipse.jdt.internal.compiler.ast.FieldDeclaration[] fields = typeDeclaration.fields;
@@ -338,20 +436,49 @@ class ASTConverter {
break;
case 2 :
membersIndex++;
- typeDecl.bodyDeclarations().add(convert(nextMemberDeclaration));
+ ASTNode node = convert(nextMemberDeclaration);
+ if (node == null) {
+ typeDecl.setFlags(typeDecl.getFlags() | ASTNode.MALFORMED);
+ } else {
+ typeDecl.bodyDeclarations().add(node);
+ }
}
}
- // Convert javadoc
-// typeDecl.setJavadoc(convert(typeDeclaration.javadoc));
convert(typeDeclaration.javadoc, typeDecl);
}
- private void checkAndAddMultipleFieldDeclaration(org.eclipse.jdt.internal.compiler.ast.FieldDeclaration[] fields, int index, List bodyDeclarations) {
+ /**
+ * @param compilationUnit
+ * @param comments
+ */
+ void buildCommentsTable(CompilationUnit compilationUnit, int[][] comments) {
+ // Build comment table
+ this.commentsTable = new Comment[comments.length];
+ int nbr = 0;
+ for (int i = 0; i < comments.length; i++) {
+ Comment comment = createComment(comments[i]);
+ if (comment != null) {
+ comment.setAlternateRoot(compilationUnit);
+ this.commentsTable[nbr++] = comment;
+ }
+ }
+ // Resize table if necessary
+ if (nbr<comments.length) {
+ Comment[] newCommentsTable = new Comment[nbr];
+ System.arraycopy(this.commentsTable, 0, newCommentsTable, 0, nbr);
+ this.commentsTable = newCommentsTable;
+ }
+ compilationUnit.setCommentTable(this.commentsTable);
+ }
+
+ protected void checkAndAddMultipleFieldDeclaration(org.eclipse.jdt.internal.compiler.ast.FieldDeclaration[] fields, int index, List bodyDeclarations) {
if (fields[index] instanceof org.eclipse.jdt.internal.compiler.ast.Initializer) {
org.eclipse.jdt.internal.compiler.ast.Initializer oldInitializer = (org.eclipse.jdt.internal.compiler.ast.Initializer) fields[index];
Initializer initializer = this.ast.newInitializer();
initializer.setBody(convert(oldInitializer.block));
- initializer.setModifiers(oldInitializer.modifiers);
+ if ((oldInitializer.modifiers & CompilerModifiers.AccJustFlag) != 0) {
+ setModifiers(initializer, oldInitializer);
+ }
initializer.setSourceRange(oldInitializer.declarationSourceStart, oldInitializer.sourceEnd - oldInitializer.declarationSourceStart + 1);
// The javadoc comment is now got from list store in compilation unit declaration
// setJavaDocComment(initializer);
@@ -370,8 +497,8 @@ class ASTConverter {
bodyDeclarations.add(convertToFieldDeclaration(fields[index]));
}
}
-
- private void checkAndAddMultipleLocalDeclaration(org.eclipse.jdt.internal.compiler.ast.Statement[] stmts, int index, List blockStatements) {
+
+ protected void checkAndAddMultipleLocalDeclaration(org.eclipse.jdt.internal.compiler.ast.Statement[] stmts, int index, List blockStatements) {
if (index > 0
&& stmts[index - 1] instanceof org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) {
org.eclipse.jdt.internal.compiler.ast.LocalDeclaration local1 = (org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) stmts[index - 1];
@@ -391,207 +518,12 @@ class ASTConverter {
}
}
- private void checkCanceled() {
+ protected void checkCanceled() {
if (this.monitor != null && this.monitor.isCanceled())
throw new OperationCanceledException();
}
- public Name convert(org.eclipse.jdt.internal.compiler.ast.TypeReference typeReference) {
- char[][] typeName = typeReference.getTypeName();
- int length = typeName.length;
- Name name = null;
- if (length > 1) {
- // QualifiedName
- org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference qualifiedTypeReference = (org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference) typeReference;
- long[] positions = qualifiedTypeReference.sourcePositions;
- name = setQualifiedNameNameAndSourceRanges(typeName, positions, typeReference);
- } else {
- name = this.ast.newSimpleName(new String(typeName[0]));
- name.setSourceRange(typeReference.sourceStart, typeReference.sourceEnd - typeReference.sourceStart + 1);
- }
- if (this.resolveBindings) {
- recordNodes(name, typeReference);
- }
- return name;
- }
-
- public SimpleName convert(org.eclipse.jdt.internal.compiler.ast.SingleNameReference nameReference) {
- SimpleName name = this.ast.newSimpleName(new String(nameReference.token));
- if (this.resolveBindings) {
- recordNodes(name, nameReference);
- }
- name.setSourceRange(nameReference.sourceStart, nameReference.sourceEnd - nameReference.sourceStart + 1);
- return name;
- }
-
- public Name convert(org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference nameReference) {
- return setQualifiedNameNameAndSourceRanges(nameReference.tokens, nameReference.sourcePositions, nameReference);
- }
-
- private QualifiedName setQualifiedNameNameAndSourceRanges(char[][] typeName, long[] positions, org.eclipse.jdt.internal.compiler.ast.ASTNode node) {
- int length = typeName.length;
- SimpleName firstToken = this.ast.newSimpleName(new String(typeName[0]));
- firstToken.index = length - 1;
- int start0 = (int)(positions[0]>>>32);
- int start = start0;
- int end = (int)(positions[0] & 0xFFFFFFFF);
- firstToken.setSourceRange(start, end - start + 1);
- SimpleName secondToken = this.ast.newSimpleName(new String(typeName[1]));
- secondToken.index = length - 2;
- start = (int)(positions[1]>>>32);
- end = (int)(positions[1] & 0xFFFFFFFF);
- secondToken.setSourceRange(start, end - start + 1);
- QualifiedName qualifiedName = this.ast.newQualifiedName(firstToken, secondToken);
- if (this.resolveBindings) {
- recordNodes(qualifiedName, node);
- recordPendingNameScopeResolution(qualifiedName);
- recordNodes(firstToken, node);
- recordNodes(secondToken, node);
- recordPendingNameScopeResolution(firstToken);
- recordPendingNameScopeResolution(secondToken);
- }
- qualifiedName.index = length - 2;
- qualifiedName.setSourceRange(start0, end - start0 + 1);
- SimpleName newPart = null;
- for (int i = 2; i < length; i++) {
- newPart = this.ast.newSimpleName(new String(typeName[i]));
- newPart.index = length - i - 1;
- start = (int)(positions[i]>>>32);
- end = (int)(positions[i] & 0xFFFFFFFF);
- newPart.setSourceRange(start, end - start + 1);
- qualifiedName = this.ast.newQualifiedName(qualifiedName, newPart);
- qualifiedName.index = newPart.index;
- qualifiedName.setSourceRange(start0, end - start0 + 1);
- if (this.resolveBindings) {
- recordNodes(qualifiedName, node);
- recordNodes(newPart, node);
- recordPendingNameScopeResolution(qualifiedName);
- recordPendingNameScopeResolution(newPart);
- }
- }
- QualifiedName name = qualifiedName;
- if (this.resolveBindings) {
- recordNodes(name, node);
- recordPendingNameScopeResolution(name);
- }
- return name;
- }
-
- public Expression convert(org.eclipse.jdt.internal.compiler.ast.ThisReference reference) {
- if (reference.isImplicitThis()) {
- // There is no source associated with an implicit this
- return null;
- } else if (reference instanceof org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference) {
- return convert((org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference) reference);
- } else if (reference instanceof org.eclipse.jdt.internal.compiler.ast.QualifiedThisReference) {
- return convert((org.eclipse.jdt.internal.compiler.ast.QualifiedThisReference) reference);
- } else {
- ThisExpression thisExpression = this.ast.newThisExpression();
- thisExpression.setSourceRange(reference.sourceStart, reference.sourceEnd - reference.sourceStart + 1);
- if (this.resolveBindings) {
- recordNodes(thisExpression, reference);
- recordPendingThisExpressionScopeResolution(thisExpression);
- }
- return thisExpression;
- }
- }
-
- public ThisExpression convert(org.eclipse.jdt.internal.compiler.ast.QualifiedThisReference reference) {
- ThisExpression thisExpression = this.ast.newThisExpression();
- thisExpression.setSourceRange(reference.sourceStart, reference.sourceEnd - reference.sourceStart + 1);
- thisExpression.setQualifier(convert(reference.qualification));
- if (this.resolveBindings) {
- recordNodes(thisExpression, reference);
- recordPendingThisExpressionScopeResolution(thisExpression);
- }
- return thisExpression;
- }
-
- public Name convert(org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference reference) {
- return convert(reference.qualification);
- }
-
- public ArrayAccess convert(org.eclipse.jdt.internal.compiler.ast.ArrayReference reference) {
- ArrayAccess arrayAccess = this.ast.newArrayAccess();
- if (this.resolveBindings) {
- recordNodes(arrayAccess, reference);
- }
- arrayAccess.setSourceRange(reference.sourceStart, reference.sourceEnd - reference.sourceStart + 1);
- arrayAccess.setArray(convert(reference.receiver));
- arrayAccess.setIndex(convert(reference.position));
- return arrayAccess;
- }
-
- public Expression convert(org.eclipse.jdt.internal.compiler.ast.FieldReference reference) {
- if (reference.receiver.isSuper()) {
- SuperFieldAccess superFieldAccess = this.ast.newSuperFieldAccess();
- if (this.resolveBindings) {
- recordNodes(superFieldAccess, reference);
- }
- if (reference.receiver instanceof org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference) {
- Name qualifier = convert((org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference) reference.receiver);
- superFieldAccess.setQualifier(qualifier);
- if (this.resolveBindings) {
- recordNodes(qualifier, reference.receiver);
- }
- }
- SimpleName simpleName = this.ast.newSimpleName(new String(reference.token));
- int sourceStart = (int)(reference.nameSourcePosition>>>32);
- int length = (int)(reference.nameSourcePosition & 0xFFFFFFFF) - sourceStart + 1;
- simpleName.setSourceRange(sourceStart, length);
- superFieldAccess.setName(simpleName);
- if (this.resolveBindings) {
- recordNodes(simpleName, reference);
- }
- superFieldAccess.setSourceRange(reference.receiver.sourceStart, reference.sourceEnd - reference.receiver.sourceStart + 1);
- return superFieldAccess;
- } else {
- FieldAccess fieldAccess = this.ast.newFieldAccess();
- if (this.resolveBindings) {
- recordNodes(fieldAccess, reference);
- }
- Expression receiver = convert(reference.receiver);
- fieldAccess.setExpression(receiver);
- SimpleName simpleName = this.ast.newSimpleName(new String(reference.token));
- int sourceStart = (int)(reference.nameSourcePosition>>>32);
- int length = (int)(reference.nameSourcePosition & 0xFFFFFFFF) - sourceStart + 1;
- simpleName.setSourceRange(sourceStart, length);
- fieldAccess.setName(simpleName);
- if (this.resolveBindings) {
- recordNodes(simpleName, reference);
- }
- fieldAccess.setSourceRange(receiver.getStartPosition(), reference.sourceEnd - receiver.getStartPosition() + 1);
- return fieldAccess;
- }
- }
-
- public Expression convert(org.eclipse.jdt.internal.compiler.ast.Reference reference) {
- if (reference instanceof org.eclipse.jdt.internal.compiler.ast.NameReference) {
- return convert((org.eclipse.jdt.internal.compiler.ast.NameReference) reference);
- }
- if (reference instanceof org.eclipse.jdt.internal.compiler.ast.ThisReference) {
- return convert((org.eclipse.jdt.internal.compiler.ast.ThisReference) reference);
- }
- if (reference instanceof org.eclipse.jdt.internal.compiler.ast.ArrayReference) {
- return convert((org.eclipse.jdt.internal.compiler.ast.ArrayReference) reference);
- }
- if (reference instanceof org.eclipse.jdt.internal.compiler.ast.FieldReference) {
- return convert((org.eclipse.jdt.internal.compiler.ast.FieldReference) reference);
- }
- throw new IllegalArgumentException("Not yet implemented: convert(" + reference.getClass() + ")");//$NON-NLS-1$//$NON-NLS-2$
- }
-
- public Name convert(org.eclipse.jdt.internal.compiler.ast.NameReference reference) {
- if (reference instanceof org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference) {
- return convert((org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference) reference);
- }
- if (reference instanceof org.eclipse.jdt.internal.compiler.ast.SingleNameReference) {
- return convert((org.eclipse.jdt.internal.compiler.ast.SingleNameReference) reference);
- }
- throw new IllegalArgumentException("Not yet implemented: convert(" + reference.getClass() + ")");//$NON-NLS-1$//$NON-NLS-2$
- }
-
- private void completeRecord(ArrayType arrayType, org.eclipse.jdt.internal.compiler.ast.ASTNode astNode) {
+ protected void completeRecord(ArrayType arrayType, org.eclipse.jdt.internal.compiler.ast.ASTNode astNode) {
ArrayType array = arrayType;
int dimensions = array.getDimensions();
for (int i = 0; i < dimensions; i++) {
@@ -602,100 +534,16 @@ class ASTConverter {
}
}
}
-
- public Type convertType(org.eclipse.jdt.internal.compiler.ast.TypeReference typeReference) {
- Type type = null;
- int sourceStart = -1;
- int length = 0;
- int dimensions = typeReference.dimensions();
- if (typeReference instanceof org.eclipse.jdt.internal.compiler.ast.SingleTypeReference) {
- // this is either an ArrayTypeReference or a SingleTypeReference
- char[] name = ((org.eclipse.jdt.internal.compiler.ast.SingleTypeReference) typeReference).getTypeName()[0];
- sourceStart = typeReference.sourceStart;
- length = typeReference.sourceEnd - typeReference.sourceStart + 1;
- if (dimensions != 0) {
- // need to find out if this is an array type of primitive types or not
- if (isPrimitiveType(name)) {
- int end = retrieveEndOfElementTypeNamePosition(sourceStart, sourceStart + length);
- if (end == -1) {
- end = sourceStart + length - 1;
- }
- PrimitiveType primitiveType = this.ast.newPrimitiveType(getPrimitiveTypeCode(name));
- primitiveType.setSourceRange(sourceStart, end - sourceStart + 1);
- type = this.ast.newArrayType(primitiveType, dimensions);
- if (this.resolveBindings) {
- // store keys for inner types
- completeRecord((ArrayType) type, typeReference);
- }
- type.setSourceRange(sourceStart, length);
- } else {
- SimpleName simpleName = this.ast.newSimpleName(new String(name));
- // we need to search for the starting position of the first brace in order to set the proper length
- // PR http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
- int end = retrieveEndOfElementTypeNamePosition(sourceStart, sourceStart + length);
- if (end == -1) {
- end = sourceStart + length - 1;
- }
- simpleName.setSourceRange(sourceStart, end - sourceStart + 1);
- SimpleType simpleType = this.ast.newSimpleType(simpleName);
- simpleType.setSourceRange(sourceStart, end - sourceStart + 1);
- type = this.ast.newArrayType(simpleType, dimensions);
- type.setSourceRange(sourceStart, length);
- if (this.resolveBindings) {
- completeRecord((ArrayType) type, typeReference);
- this.recordNodes(simpleName, typeReference);
- }
- }
- } else {
- if (isPrimitiveType(name)) {
- type = this.ast.newPrimitiveType(getPrimitiveTypeCode(name));
- type.setSourceRange(sourceStart, length);
- } else {
- SimpleName simpleName = this.ast.newSimpleName(new String(name));
- simpleName.setSourceRange(sourceStart, length);
- type = this.ast.newSimpleType(simpleName);
- type.setSourceRange(sourceStart, length);
- if (this.resolveBindings) {
- this.recordNodes(simpleName, typeReference);
- }
- }
- }
- } else {
- char[][] name = ((org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference) typeReference).getTypeName();
- int nameLength = name.length;
- long[] positions = ((org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference) typeReference).sourcePositions;
- sourceStart = (int)(positions[0]>>>32);
- length = (int)(positions[nameLength - 1] & 0xFFFFFFFF) - sourceStart + 1;
- Name qualifiedName = this.setQualifiedNameNameAndSourceRanges(name, positions, typeReference);
- if (dimensions != 0) {
- // need to find out if this is an array type of primitive types or not
- SimpleType simpleType = this.ast.newSimpleType(qualifiedName);
- simpleType.setSourceRange(sourceStart, length);
- type = this.ast.newArrayType(simpleType, dimensions);
- if (this.resolveBindings) {
- completeRecord((ArrayType) type, typeReference);
- }
- int end = retrieveEndOfDimensionsPosition(sourceStart+length, this.compilationUnitSource.length);
- if (end != -1) {
- type.setSourceRange(sourceStart, end - sourceStart + 1);
- } else {
- type.setSourceRange(sourceStart, length);
- }
- } else {
- type = this.ast.newSimpleType(qualifiedName);
- type.setSourceRange(sourceStart, length);
- }
- }
- if (this.resolveBindings) {
- this.recordNodes(type, typeReference);
- }
- return type;
- }
- public MethodDeclaration convert(org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration methodDeclaration) {
+ public ASTNode convert(org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration methodDeclaration) {
checkCanceled();
+ if (methodDeclaration instanceof org.eclipse.jdt.internal.compiler.ast.AnnotationTypeMemberDeclaration) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.AnnotationTypeMemberDeclaration) methodDeclaration);
+ }
MethodDeclaration methodDecl = this.ast.newMethodDeclaration();
- methodDecl.setModifiers(methodDeclaration.modifiers & org.eclipse.jdt.internal.compiler.lookup.CompilerModifiers.AccJustFlag);
+ if ((methodDeclaration.modifiers & CompilerModifiers.AccJustFlag) != 0) {
+ setModifiers(methodDecl, methodDeclaration);
+ }
boolean isConstructor = methodDeclaration.isConstructor();
methodDecl.setConstructor(isConstructor);
SimpleName methodName = this.ast.newSimpleName(new String(methodDeclaration.selector));
@@ -719,13 +567,19 @@ class ASTConverter {
}
org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall explicitConstructorCall = null;
if (isConstructor) {
- // set the return type to VOID
- PrimitiveType returnType = this.ast.newPrimitiveType(PrimitiveType.VOID);
- returnType.setSourceRange(methodDeclaration.sourceStart, 0);
- methodDecl.setReturnType(returnType);
org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration constructorDeclaration = (org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration) methodDeclaration;
explicitConstructorCall = constructorDeclaration.constructorCall;
- } else {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ // set the return type to VOID
+ PrimitiveType returnType = this.ast.newPrimitiveType(PrimitiveType.VOID);
+ returnType.setSourceRange(methodDeclaration.sourceStart, 0);
+ methodDecl.setReturnType(returnType);
+ break;
+ case AST.JLS3 :
+ methodDecl.setReturnType2(null);
+ }
+ } else if (methodDeclaration instanceof org.eclipse.jdt.internal.compiler.ast.MethodDeclaration) {
org.eclipse.jdt.internal.compiler.ast.MethodDeclaration method = (org.eclipse.jdt.internal.compiler.ast.MethodDeclaration) methodDeclaration;
org.eclipse.jdt.internal.compiler.ast.TypeReference typeReference = method.returnType;
if (typeReference != null) {
@@ -740,10 +594,10 @@ class ASTConverter {
int declarationSourceStart = methodDeclaration.declarationSourceStart;
int declarationSourceEnd = methodDeclaration.bodyEnd;
methodDecl.setSourceRange(declarationSourceStart, declarationSourceEnd - declarationSourceStart + 1);
- int closingPosition = retrieveRightBraceOrSemiColonPosition(methodDecl, methodDeclaration);
+ int closingPosition = retrieveRightBraceOrSemiColonPosition(methodDeclaration.bodyEnd, methodDeclaration.declarationSourceEnd);
if (closingPosition != -1) {
int startPosition = methodDecl.getStartPosition();
- methodDecl.setSourceRange(startPosition, closingPosition - startPosition);
+ methodDecl.setSourceRange(startPosition, closingPosition - startPosition + 1);
org.eclipse.jdt.internal.compiler.ast.Statement[] statements = methodDeclaration.statements;
@@ -802,10 +656,21 @@ class ASTConverter {
}
}
}
+
+ org.eclipse.jdt.internal.compiler.ast.TypeParameter[] typeParameters = methodDeclaration.typeParameters();
+ if (typeParameters != null) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ methodDecl.setFlags(methodDecl.getFlags() | ASTNode.MALFORMED);
+ break;
+ case AST.JLS3 :
+ for (int i = 0, max = typeParameters.length; i < max; i++) {
+ methodDecl.typeParameters().add(convert(typeParameters[i]));
+ }
+ }
+ }
// The javadoc comment is now got from list store in compilation unit declaration
-// setJavaDocComment(methodDecl);
-// methodDecl.setJavadoc(convert(methodDeclaration.javadoc));
convert(methodDeclaration.javadoc, methodDecl);
if (this.resolveBindings) {
recordNodes(methodDecl, methodDeclaration);
@@ -814,136 +679,30 @@ class ASTConverter {
}
return methodDecl;
}
-
- public Expression convert(org.eclipse.jdt.internal.compiler.ast.Expression expression) {
- if ((expression.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.ParenthesizedMASK) != 0) {
- return convertToParenthesizedExpression(expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.CastExpression) {
- return convert((org.eclipse.jdt.internal.compiler.ast.CastExpression) expression);
- }
- // switch between all types of expression
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.ArrayAllocationExpression) {
- return convert((org.eclipse.jdt.internal.compiler.ast.ArrayAllocationExpression) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression) {
- return convert((org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.AllocationExpression) {
- return convert((org.eclipse.jdt.internal.compiler.ast.AllocationExpression) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.ArrayInitializer) {
- return convert((org.eclipse.jdt.internal.compiler.ast.ArrayInitializer) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.PrefixExpression) {
- return convert((org.eclipse.jdt.internal.compiler.ast.PrefixExpression) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.PostfixExpression) {
- return convert((org.eclipse.jdt.internal.compiler.ast.PostfixExpression) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.CompoundAssignment) {
- return convert((org.eclipse.jdt.internal.compiler.ast.CompoundAssignment) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.Assignment) {
- return convert((org.eclipse.jdt.internal.compiler.ast.Assignment) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess) {
- return convert((org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.FalseLiteral) {
- return convert((org.eclipse.jdt.internal.compiler.ast.FalseLiteral) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.TrueLiteral) {
- return convert((org.eclipse.jdt.internal.compiler.ast.TrueLiteral) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.NullLiteral) {
- return convert((org.eclipse.jdt.internal.compiler.ast.NullLiteral) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.CharLiteral) {
- return convert((org.eclipse.jdt.internal.compiler.ast.CharLiteral) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.DoubleLiteral) {
- return convert((org.eclipse.jdt.internal.compiler.ast.DoubleLiteral) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.FloatLiteral) {
- return convert((org.eclipse.jdt.internal.compiler.ast.FloatLiteral) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.IntLiteralMinValue) {
- return convert((org.eclipse.jdt.internal.compiler.ast.IntLiteralMinValue) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.IntLiteral) {
- return convert((org.eclipse.jdt.internal.compiler.ast.IntLiteral) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.LongLiteralMinValue) {
- return convert((org.eclipse.jdt.internal.compiler.ast.LongLiteralMinValue) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.LongLiteral) {
- return convert((org.eclipse.jdt.internal.compiler.ast.LongLiteral) expression);
- }
- if (expression instanceof StringLiteralConcatenation) {
- return convert((StringLiteralConcatenation) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.ExtendedStringLiteral) {
- return convert((org.eclipse.jdt.internal.compiler.ast.ExtendedStringLiteral) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.StringLiteral) {
- return convert((org.eclipse.jdt.internal.compiler.ast.StringLiteral) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.AND_AND_Expression) {
- return convert((org.eclipse.jdt.internal.compiler.ast.AND_AND_Expression) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.OR_OR_Expression) {
- return convert((org.eclipse.jdt.internal.compiler.ast.OR_OR_Expression) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.EqualExpression) {
- return convert((org.eclipse.jdt.internal.compiler.ast.EqualExpression) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.BinaryExpression) {
- return convert((org.eclipse.jdt.internal.compiler.ast.BinaryExpression) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression) {
- return convert((org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.UnaryExpression) {
- return convert((org.eclipse.jdt.internal.compiler.ast.UnaryExpression) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.ConditionalExpression) {
- return convert((org.eclipse.jdt.internal.compiler.ast.ConditionalExpression) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.MessageSend) {
- return convert((org.eclipse.jdt.internal.compiler.ast.MessageSend) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.Reference) {
- return convert((org.eclipse.jdt.internal.compiler.ast.Reference) expression);
- }
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.TypeReference) {
- return convert((org.eclipse.jdt.internal.compiler.ast.TypeReference) expression);
- }
- throw new IllegalArgumentException("Not yet implemented: convert(" + expression.getClass() + ")");//$NON-NLS-1$//$NON-NLS-2$
- }
-
- public ParenthesizedExpression convertToParenthesizedExpression(org.eclipse.jdt.internal.compiler.ast.Expression expression) {
- ParenthesizedExpression parenthesizedExpression = this.ast.newParenthesizedExpression();
- if (this.resolveBindings) {
- recordNodes(parenthesizedExpression, expression);
- }
- parenthesizedExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
- adjustSourcePositionsForParent(expression);
- trimWhiteSpacesAndComments(expression);
- // decrement the number of parenthesis
- int numberOfParenthesis = (expression.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.ParenthesizedMASK) >> org.eclipse.jdt.internal.compiler.ast.ASTNode.ParenthesizedSHIFT;
- expression.bits &= ~org.eclipse.jdt.internal.compiler.ast.ASTNode.ParenthesizedMASK;
- expression.bits |= (numberOfParenthesis - 1) << org.eclipse.jdt.internal.compiler.ast.ASTNode.ParenthesizedSHIFT;
- parenthesizedExpression.setExpression(convert(expression));
- return parenthesizedExpression;
- }
public ClassInstanceCreation convert(org.eclipse.jdt.internal.compiler.ast.AllocationExpression expression) {
ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
if (this.resolveBindings) {
recordNodes(classInstanceCreation, expression);
}
- classInstanceCreation.setName(convert(expression.type));
+ if (expression.typeArguments != null) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ classInstanceCreation.setFlags(classInstanceCreation.getFlags() | ASTNode.MALFORMED);
+ break;
+ case AST.JLS3 :
+ for (int i = 0, max = expression.typeArguments.length; i < max; i++) {
+ classInstanceCreation.typeArguments().add(convertType(expression.typeArguments[i]));
+ }
+ }
+ }
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ classInstanceCreation.setName(convert(expression.type));
+ break;
+ case AST.JLS3 :
+ classInstanceCreation.setType(convertType(expression.type));
+ }
classInstanceCreation.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = expression.arguments;
if (arguments != null) {
@@ -955,66 +714,130 @@ class ASTConverter {
removeTrailingCommentFromExpressionEndingWithAParen(classInstanceCreation);
return classInstanceCreation;
}
+
+ public Expression convert(org.eclipse.jdt.internal.compiler.ast.AND_AND_Expression expression) {
+ InfixExpression infixExpression = this.ast.newInfixExpression();
+ if (this.resolveBindings) {
+ recordNodes(infixExpression, expression);
+ }
+ Expression leftExpression = convert(expression.left);
+ infixExpression.setLeftOperand(leftExpression);
+ infixExpression.setRightOperand(convert(expression.right));
+ infixExpression.setOperator(InfixExpression.Operator.CONDITIONAL_AND);
+ int startPosition = leftExpression.getStartPosition();
+ infixExpression.setSourceRange(startPosition, expression.sourceEnd - startPosition + 1);
+ return infixExpression;
- private void buildBodyDeclarations(org.eclipse.jdt.internal.compiler.ast.TypeDeclaration expression, AnonymousClassDeclaration anonymousClassDeclaration) {
- // add body declaration in the lexical order
- org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] members = expression.memberTypes;
- org.eclipse.jdt.internal.compiler.ast.FieldDeclaration[] fields = expression.fields;
- org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration[] methods = expression.methods;
-
- int fieldsLength = fields == null? 0 : fields.length;
- int methodsLength = methods == null? 0 : methods.length;
- int membersLength = members == null ? 0 : members.length;
- int fieldsIndex = 0;
- int methodsIndex = 0;
- int membersIndex = 0;
+ }
+
+ public AnnotationTypeDeclaration convert(org.eclipse.jdt.internal.compiler.ast.AnnotationTypeDeclaration typeDeclaration) {
+ checkCanceled();
+ AnnotationTypeDeclaration typeDecl = this.ast.newAnnotationTypeDeclaration();
+ int modifiers = typeDeclaration.modifiers;
+ modifiers &= ~IConstants.AccInterface; // remove AccInterface flags
+ modifiers &= CompilerModifiers.AccJustFlag;
+ if (modifiers != 0) {
+ setModifiers(typeDecl, typeDeclaration);
+ }
+ SimpleName typeName = this.ast.newSimpleName(new String(typeDeclaration.name));
+ typeName.setSourceRange(typeDeclaration.sourceStart, typeDeclaration.sourceEnd - typeDeclaration.sourceStart + 1);
+ typeDecl.setName(typeName);
+ typeDecl.setSourceRange(typeDeclaration.declarationSourceStart, typeDeclaration.bodyEnd - typeDeclaration.declarationSourceStart + 1);
- while ((fieldsIndex < fieldsLength)
- || (membersIndex < membersLength)
- || (methodsIndex < methodsLength)) {
- org.eclipse.jdt.internal.compiler.ast.FieldDeclaration nextFieldDeclaration = null;
- org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration nextMethodDeclaration = null;
- org.eclipse.jdt.internal.compiler.ast.TypeDeclaration nextMemberDeclaration = null;
+ buildBodyDeclarations(typeDeclaration, typeDecl);
+ // The javadoc comment is now got from list store in compilation unit declaration
+ if (this.resolveBindings) {
+ recordNodes(typeDecl, typeDeclaration);
+ recordNodes(typeName, typeDeclaration);
+ typeDecl.resolveBinding();
+ }
+ return typeDecl;
+ }
+
+ public ASTNode convert(org.eclipse.jdt.internal.compiler.ast.AnnotationTypeMemberDeclaration annotationTypeMemberDeclaration) {
+ checkCanceled();
+ if (this.ast.apiLevel == AST.JLS2) {
+ return null;
+ }
+ AnnotationTypeMemberDeclaration annotationTypeMemberDeclaration2 = this.ast.newAnnotationTypeMemberDeclaration();
+ if ((annotationTypeMemberDeclaration.modifiers & CompilerModifiers.AccJustFlag) != 0) {
+ setModifiers(annotationTypeMemberDeclaration2, annotationTypeMemberDeclaration);
+ }
+ SimpleName methodName = this.ast.newSimpleName(new String(annotationTypeMemberDeclaration.selector));
+ int start = annotationTypeMemberDeclaration.sourceStart;
+ int end = retrieveIdentifierEndPosition(start, annotationTypeMemberDeclaration.sourceEnd);
+ methodName.setSourceRange(start, end - start + 1);
+ annotationTypeMemberDeclaration2.setName(methodName);
+ org.eclipse.jdt.internal.compiler.ast.TypeReference typeReference = annotationTypeMemberDeclaration.returnType;
+ if (typeReference != null) {
+ Type returnType = convertType(typeReference);
+ setTypeForMethodDeclaration(annotationTypeMemberDeclaration2, returnType, 0);
+ }
+ int declarationSourceStart = annotationTypeMemberDeclaration.declarationSourceStart;
+ int declarationSourceEnd = annotationTypeMemberDeclaration.bodyEnd;
+ annotationTypeMemberDeclaration2.setSourceRange(declarationSourceStart, declarationSourceEnd - declarationSourceStart + 1);
+ // The javadoc comment is now got from list store in compilation unit declaration
+ convert(annotationTypeMemberDeclaration.javadoc, annotationTypeMemberDeclaration2);
+ org.eclipse.jdt.internal.compiler.ast.Expression memberValue = annotationTypeMemberDeclaration.memberValue;
+ if (memberValue != null) {
+ annotationTypeMemberDeclaration2.setDefault(convert(memberValue));
+ }
+ if (this.resolveBindings) {
+ recordNodes(annotationTypeMemberDeclaration2, annotationTypeMemberDeclaration);
+ recordNodes(methodName, annotationTypeMemberDeclaration);
+ annotationTypeMemberDeclaration2.resolveBinding();
+ }
+ return annotationTypeMemberDeclaration2;
+ }
+
+ public SingleVariableDeclaration convert(org.eclipse.jdt.internal.compiler.ast.Argument argument) {
+ SingleVariableDeclaration variableDecl = this.ast.newSingleVariableDeclaration();
+ if ((argument.modifiers & CompilerModifiers.AccJustFlag) != 0) {
+ setModifiers(variableDecl, argument);
+ }
+ SimpleName name = this.ast.newSimpleName(new String(argument.name));
+ int start = argument.sourceStart;
+ int nameEnd = argument.sourceEnd;
+ name.setSourceRange(start, nameEnd - start + 1);
+ variableDecl.setName(name);
+ final int extraDimensions = retrieveExtraDimension(nameEnd + 1, argument.type.sourceEnd);
+ variableDecl.setExtraDimensions(extraDimensions);
+ Type type = convertType(argument.type);
+ int typeEnd = type.getStartPosition() + type.getLength() - 1;
+ int rightEnd = Math.max(typeEnd, argument.declarationSourceEnd);
+ /*
+ * There is extra work to do to set the proper type positions
+ * See PR http://bugs.eclipse.org/bugs/show_bug.cgi?id=23284
+ */
+ setTypeForSingleVariableDeclaration(variableDecl, type, extraDimensions);
+ variableDecl.setSourceRange(argument.declarationSourceStart, rightEnd - argument.declarationSourceStart + 1);
- int position = Integer.MAX_VALUE;
- int nextDeclarationType = -1;
- if (fieldsIndex < fieldsLength) {
- nextFieldDeclaration = fields[fieldsIndex];
- if (nextFieldDeclaration.declarationSourceStart < position) {
- position = nextFieldDeclaration.declarationSourceStart;
- nextDeclarationType = 0; // FIELD
- }
- }
- if (methodsIndex < methodsLength) {
- nextMethodDeclaration = methods[methodsIndex];
- if (nextMethodDeclaration.declarationSourceStart < position) {
- position = nextMethodDeclaration.declarationSourceStart;
- nextDeclarationType = 1; // METHOD
- }
- }
- if (membersIndex < membersLength) {
- nextMemberDeclaration = members[membersIndex];
- if (nextMemberDeclaration.declarationSourceStart < position) {
- position = nextMemberDeclaration.declarationSourceStart;
- nextDeclarationType = 2; // MEMBER
- }
- }
- switch (nextDeclarationType) {
- case 0 :
- checkAndAddMultipleFieldDeclaration(fields, fieldsIndex, anonymousClassDeclaration.bodyDeclarations());
- fieldsIndex++;
+ if (argument.isVarArgs) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ variableDecl.setFlags(variableDecl.getFlags() | ASTNode.MALFORMED);
break;
- case 1 :
- methodsIndex++;
- if (!nextMethodDeclaration.isDefaultConstructor() && !nextMethodDeclaration.isClinit()) {
- anonymousClassDeclaration.bodyDeclarations().add(convert(nextMethodDeclaration));
- }
- break;
- case 2 :
- membersIndex++;
- anonymousClassDeclaration.bodyDeclarations().add(convert(nextMemberDeclaration));
+ case AST.JLS3 :
+ variableDecl.setVarargs(true);
}
}
+ if (this.resolveBindings) {
+ recordNodes(name, argument);
+ recordNodes(variableDecl, argument);
+ variableDecl.resolveBinding();
+ }
+ return variableDecl;
+ }
+
+
+ public Annotation convert(org.eclipse.jdt.internal.compiler.ast.Annotation annotation) {
+ if (annotation instanceof org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation) annotation);
+ } else if (annotation instanceof org.eclipse.jdt.internal.compiler.ast.MarkerAnnotation) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.MarkerAnnotation) annotation);
+ } else {
+ return convert((org.eclipse.jdt.internal.compiler.ast.NormalAnnotation) annotation);
+ }
}
public ArrayCreation convert(org.eclipse.jdt.internal.compiler.ast.ArrayAllocationExpression expression) {
@@ -1067,33 +890,6 @@ class ASTConverter {
return arrayCreation;
}
- public SingleVariableDeclaration convert(org.eclipse.jdt.internal.compiler.ast.Argument argument) {
- SingleVariableDeclaration variableDecl = this.ast.newSingleVariableDeclaration();
- variableDecl.setModifiers(argument.modifiers);
- SimpleName name = this.ast.newSimpleName(new String(argument.name));
- int start = argument.sourceStart;
- int nameEnd = argument.sourceEnd;
- name.setSourceRange(start, nameEnd - start + 1);
- variableDecl.setName(name);
- final int extraDimensions = retrieveExtraDimension(nameEnd + 1, argument.type.sourceEnd);
- variableDecl.setExtraDimensions(extraDimensions);
- Type type = convertType(argument.type);
- int typeEnd = type.getStartPosition() + type.getLength() - 1;
- int rightEnd = Math.max(typeEnd, argument.declarationSourceEnd);
- /*
- * There is extra work to do to set the proper type positions
- * See PR http://bugs.eclipse.org/bugs/show_bug.cgi?id=23284
- */
- setTypeForSingleVariableDeclaration(variableDecl, type, extraDimensions);
- variableDecl.setSourceRange(argument.declarationSourceStart, rightEnd - argument.declarationSourceStart + 1);
- if (this.resolveBindings) {
- recordNodes(name, argument);
- recordNodes(variableDecl, argument);
- variableDecl.resolveBinding();
- }
- return variableDecl;
- }
-
public ArrayInitializer convert(org.eclipse.jdt.internal.compiler.ast.ArrayInitializer expression) {
ArrayInitializer arrayInitializer = this.ast.newArrayInitializer();
if (this.resolveBindings) {
@@ -1114,55 +910,30 @@ class ASTConverter {
return arrayInitializer;
}
- public Expression convert(org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression allocation) {
- if (allocation.anonymousType != null) {
- ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
- classInstanceCreation.setName(convert(allocation.type));
- if (allocation.enclosingInstance != null) {
- classInstanceCreation.setExpression(convert(allocation.enclosingInstance));
- }
- int declarationSourceStart = allocation.sourceStart;
- classInstanceCreation.setSourceRange(declarationSourceStart, allocation.anonymousType.bodyEnd - declarationSourceStart + 1);
- org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = allocation.arguments;
- if (arguments != null) {
- int length = arguments.length;
- for (int i = 0; i < length; i++) {
- classInstanceCreation.arguments().add(convert(arguments[i]));
- }
- }
- AnonymousClassDeclaration anonymousClassDeclaration = this.ast.newAnonymousClassDeclaration();
- int start = retrieveStartBlockPosition(allocation.anonymousType.sourceEnd, allocation.anonymousType.bodyEnd);
- anonymousClassDeclaration.setSourceRange(start, allocation.anonymousType.bodyEnd - start + 1);
- classInstanceCreation.setAnonymousClassDeclaration(anonymousClassDeclaration);
- buildBodyDeclarations(allocation.anonymousType, anonymousClassDeclaration);
- if (this.resolveBindings) {
- recordNodes(classInstanceCreation, allocation.anonymousType);
- recordNodes(anonymousClassDeclaration, allocation.anonymousType);
- anonymousClassDeclaration.resolveBinding();
- }
- return classInstanceCreation;
- } else {
- ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
- classInstanceCreation.setExpression(convert(allocation.enclosingInstance));
- classInstanceCreation.setName(convert(allocation.type));
- classInstanceCreation.setSourceRange(allocation.sourceStart, allocation.sourceEnd - allocation.sourceStart + 1);
- org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = allocation.arguments;
- if (arguments != null) {
- int length = arguments.length;
- for (int i = 0; i < length; i++) {
- Expression argument = convert(arguments[i]);
- if (this.resolveBindings) {
- recordNodes(argument, arguments[i]);
- }
- classInstanceCreation.arguments().add(argument);
- }
- }
- if (this.resolveBindings) {
- recordNodes(classInstanceCreation, allocation);
- }
- removeTrailingCommentFromExpressionEndingWithAParen(classInstanceCreation);
- return classInstanceCreation;
+ public ArrayAccess convert(org.eclipse.jdt.internal.compiler.ast.ArrayReference reference) {
+ ArrayAccess arrayAccess = this.ast.newArrayAccess();
+ if (this.resolveBindings) {
+ recordNodes(arrayAccess, reference);
+ }
+ arrayAccess.setSourceRange(reference.sourceStart, reference.sourceEnd - reference.sourceStart + 1);
+ arrayAccess.setArray(convert(reference.receiver));
+ arrayAccess.setIndex(convert(reference.position));
+ return arrayAccess;
+ }
+
+ public AssertStatement convert(org.eclipse.jdt.internal.compiler.ast.AssertStatement statement) {
+ AssertStatement assertStatement = this.ast.newAssertStatement();
+ int end = statement.assertExpression.sourceEnd + 1;
+ assertStatement.setExpression(convert(statement.assertExpression));
+ org.eclipse.jdt.internal.compiler.ast.Expression exceptionArgument = statement.exceptionArgument;
+ if (exceptionArgument != null) {
+ assertStatement.setMessage(convert(exceptionArgument));
+ end = exceptionArgument.sourceEnd + 1;
}
+ int start = statement.sourceStart;
+ int sourceEnd = retrieveEndingSemiColonPosition(end, this.compilationUnitSource.length);
+ assertStatement.setSourceRange(start, sourceEnd - start + 1);
+ return assertStatement;
}
public Assignment convert(org.eclipse.jdt.internal.compiler.ast.Assignment expression) {
@@ -1179,289 +950,56 @@ class ASTConverter {
return assignment;
}
- public Assignment convert(org.eclipse.jdt.internal.compiler.ast.CompoundAssignment expression) {
- Assignment assignment = this.ast.newAssignment();
- Expression lhs = convert(expression.lhs);
- assignment.setLeftHandSide(lhs);
- int start = lhs.getStartPosition();
- assignment.setSourceRange(start, expression.sourceEnd - start + 1);
- switch (expression.operator) {
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.PLUS :
- assignment.setOperator(Assignment.Operator.PLUS_ASSIGN);
- break;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.MINUS :
- assignment.setOperator(Assignment.Operator.MINUS_ASSIGN);
- break;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.MULTIPLY :
- assignment.setOperator(Assignment.Operator.TIMES_ASSIGN);
- break;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.DIVIDE :
- assignment.setOperator(Assignment.Operator.DIVIDE_ASSIGN);
- break;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.AND :
- assignment.setOperator(Assignment.Operator.BIT_AND_ASSIGN);
- break;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.OR :
- assignment.setOperator(Assignment.Operator.BIT_OR_ASSIGN);
- break;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.XOR :
- assignment.setOperator(Assignment.Operator.BIT_XOR_ASSIGN);
- break;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.REMAINDER :
- assignment.setOperator(Assignment.Operator.REMAINDER_ASSIGN);
- break;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.LEFT_SHIFT :
- assignment.setOperator(Assignment.Operator.LEFT_SHIFT_ASSIGN);
- break;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.RIGHT_SHIFT :
- assignment.setOperator(Assignment.Operator.RIGHT_SHIFT_SIGNED_ASSIGN);
- break;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.UNSIGNED_RIGHT_SHIFT :
- assignment.setOperator(Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN);
- break;
- }
- assignment.setRightHandSide(convert(expression.expression));
- return assignment;
- }
-
- public PrefixExpression convert(org.eclipse.jdt.internal.compiler.ast.PrefixExpression expression) {
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- if (this.resolveBindings) {
- recordNodes(prefixExpression, expression);
- }
- prefixExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
- prefixExpression.setOperand(convert(expression.lhs));
- switch (expression.operator) {
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.PLUS :
- prefixExpression.setOperator(PrefixExpression.Operator.INCREMENT);
- break;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.MINUS :
- prefixExpression.setOperator(PrefixExpression.Operator.DECREMENT);
- break;
- }
- return prefixExpression;
- }
-
- public PostfixExpression convert(org.eclipse.jdt.internal.compiler.ast.PostfixExpression expression) {
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- if (this.resolveBindings) {
- recordNodes(postfixExpression, expression);
- }
- postfixExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
- postfixExpression.setOperand(convert(expression.lhs));
- switch (expression.operator) {
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.PLUS :
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- break;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.MINUS :
- postfixExpression.setOperator(PostfixExpression.Operator.DECREMENT);
- break;
- }
- return postfixExpression;
- }
-
- public CastExpression convert(org.eclipse.jdt.internal.compiler.ast.CastExpression expression) {
- CastExpression castExpression = this.ast.newCastExpression();
- castExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
- org.eclipse.jdt.internal.compiler.ast.Expression type = expression.type;
- trimWhiteSpacesAndComments(type);
- if (type instanceof org.eclipse.jdt.internal.compiler.ast.TypeReference ) {
- castExpression.setType(convertType((org.eclipse.jdt.internal.compiler.ast.TypeReference)type));
- } else if (type instanceof org.eclipse.jdt.internal.compiler.ast.NameReference) {
- castExpression.setType(convertToType((org.eclipse.jdt.internal.compiler.ast.NameReference)type));
- }
- castExpression.setExpression(convert(expression.expression));
- if (this.resolveBindings) {
- recordNodes(castExpression, expression);
- }
- return castExpression;
- }
-
- public Type convertToType(org.eclipse.jdt.internal.compiler.ast.NameReference reference) {
- Name name = convert(reference);
- SimpleType type = this.ast.newSimpleType(name);
- type.setSourceRange(name.getStartPosition(), name.getLength());
- if (this.resolveBindings) {
- this.recordNodes(type, reference);
- }
- return type;
- }
- public Expression convert(org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess expression) {
- TypeLiteral typeLiteral = this.ast.newTypeLiteral();
- if (this.resolveBindings) {
- this.recordNodes(typeLiteral, expression);
- }
- typeLiteral.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
- typeLiteral.setType(convertType(expression.type));
- return typeLiteral;
- }
-
- public BooleanLiteral convert(org.eclipse.jdt.internal.compiler.ast.FalseLiteral expression) {
- BooleanLiteral literal = this.ast.newBooleanLiteral(false);
- if (this.resolveBindings) {
- this.recordNodes(literal, expression);
- }
- literal.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
- return literal;
- }
-
- public BooleanLiteral convert(org.eclipse.jdt.internal.compiler.ast.TrueLiteral expression) {
- BooleanLiteral literal = this.ast.newBooleanLiteral(true);
- if (this.resolveBindings) {
- this.recordNodes(literal, expression);
- }
- literal.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
- return literal;
- }
-
- public InfixExpression convert(StringLiteralConcatenation expression) {
- expression.computeConstant();
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- org.eclipse.jdt.internal.compiler.ast.StringLiteral[] stringLiterals = expression.literals;
- infixExpression.setLeftOperand(convert(stringLiterals[0]));
- infixExpression.setRightOperand(convert(stringLiterals[1]));
- for (int i = 2; i < expression.counter; i++) {
- infixExpression.extendedOperands().add(convert(stringLiterals[i]));
- }
- if (this.resolveBindings) {
- this.recordNodes(infixExpression, expression);
- }
- infixExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
- return infixExpression;
- }
-
- public org.eclipse.jdt.core.dom.NullLiteral convert(org.eclipse.jdt.internal.compiler.ast.NullLiteral expression) {
- org.eclipse.jdt.core.dom.NullLiteral literal = this.ast.newNullLiteral();
- if (this.resolveBindings) {
- this.recordNodes(literal, expression);
- }
- literal.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
- return literal;
- }
-
- public CharacterLiteral convert(org.eclipse.jdt.internal.compiler.ast.CharLiteral expression) {
- int length = expression.sourceEnd - expression.sourceStart + 1;
- int sourceStart = expression.sourceStart;
- char[] tokens = new char[length];
- System.arraycopy(this.compilationUnitSource, sourceStart, tokens, 0, length);
- CharacterLiteral literal = this.ast.newCharacterLiteral();
- if (this.resolveBindings) {
- this.recordNodes(literal, expression);
- }
- literal.setEscapedValue(new String(tokens));
- literal.setSourceRange(sourceStart, length);
- removeLeadingAndTrailingCommentsFromLiteral(literal);
- return literal;
- }
-
- public NumberLiteral convert(org.eclipse.jdt.internal.compiler.ast.DoubleLiteral expression) {
- int length = expression.sourceEnd - expression.sourceStart + 1;
- int sourceStart = expression.sourceStart;
- char[] tokens = new char[length];
- System.arraycopy(this.compilationUnitSource, sourceStart, tokens, 0, length);
- NumberLiteral literal = this.ast.newNumberLiteral(new String(tokens));
- if (this.resolveBindings) {
- this.recordNodes(literal, expression);
- }
- literal.setSourceRange(sourceStart, length);
- removeLeadingAndTrailingCommentsFromLiteral(literal);
- return literal;
- }
-
- public NumberLiteral convert(org.eclipse.jdt.internal.compiler.ast.FloatLiteral expression) {
- int length = expression.sourceEnd - expression.sourceStart + 1;
- int sourceStart = expression.sourceStart;
- char[] tokens = new char[length];
- System.arraycopy(this.compilationUnitSource, sourceStart, tokens, 0, length);
- NumberLiteral literal = this.ast.newNumberLiteral(new String(tokens));
- if (this.resolveBindings) {
- this.recordNodes(literal, expression);
- }
- literal.setSourceRange(sourceStart, length);
- removeLeadingAndTrailingCommentsFromLiteral(literal);
- return literal;
- }
-
- public NumberLiteral convert(org.eclipse.jdt.internal.compiler.ast.IntLiteral expression) {
- int length = expression.sourceEnd - expression.sourceStart + 1;
- int sourceStart = expression.sourceStart;
- char[] tokens = new char[length];
- System.arraycopy(this.compilationUnitSource, sourceStart, tokens, 0, length);
- NumberLiteral literal = this.ast.newNumberLiteral(new String(tokens));
- if (this.resolveBindings) {
- this.recordNodes(literal, expression);
- }
- literal.setSourceRange(sourceStart, length);
- removeLeadingAndTrailingCommentsFromLiteral(literal);
- return literal;
- }
-
- public NumberLiteral convert(org.eclipse.jdt.internal.compiler.ast.IntLiteralMinValue expression) {
- int length = expression.sourceEnd - expression.sourceStart + 1;
- int sourceStart = expression.sourceStart;
- char[] tokens = new char[length];
- System.arraycopy(this.compilationUnitSource, sourceStart, tokens, 0, length);
- NumberLiteral literal = this.ast.newNumberLiteral(new String(tokens));
- if (this.resolveBindings) {
- this.recordNodes(literal, expression);
- }
- literal.setSourceRange(sourceStart, length);
- removeLeadingAndTrailingCommentsFromLiteral(literal);
- return literal;
- }
-
- public NumberLiteral convert(org.eclipse.jdt.internal.compiler.ast.LongLiteral expression) {
- int length = expression.sourceEnd - expression.sourceStart + 1;
- int sourceStart = expression.sourceStart;
- char[] tokens = new char[length];
- System.arraycopy(this.compilationUnitSource, sourceStart, tokens, 0, length);
- NumberLiteral literal = this.ast.newNumberLiteral(new String(tokens));
- if (this.resolveBindings) {
- this.recordNodes(literal, expression);
- }
- literal.setSourceRange(sourceStart, length);
- removeLeadingAndTrailingCommentsFromLiteral(literal);
- return literal;
- }
-
- public NumberLiteral convert(org.eclipse.jdt.internal.compiler.ast.LongLiteralMinValue expression) {
- int length = expression.sourceEnd - expression.sourceStart + 1;
- int sourceStart = expression.sourceStart;
- char[] tokens = new char[length];
- System.arraycopy(this.compilationUnitSource, sourceStart, tokens, 0, length);
- NumberLiteral literal = this.ast.newNumberLiteral(new String(tokens));
- if (this.resolveBindings) {
- this.recordNodes(literal, expression);
- }
- literal.setSourceRange(sourceStart, length);
- removeLeadingAndTrailingCommentsFromLiteral(literal);
- return literal;
- }
-
- public StringLiteral convert(org.eclipse.jdt.internal.compiler.ast.StringLiteral expression) {
- int length = expression.sourceEnd - expression.sourceStart + 1;
- int sourceStart = expression.sourceStart;
- char[] tokens = new char[length];
- System.arraycopy(this.compilationUnitSource, sourceStart, tokens, 0, length);
- StringLiteral literal = this.ast.newStringLiteral();
- if (this.resolveBindings) {
- this.recordNodes(literal, expression);
- }
- literal.setEscapedValue(new String(tokens));
- literal.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
- return literal;
- }
-
- public StringLiteral convert(org.eclipse.jdt.internal.compiler.ast.ExtendedStringLiteral expression) {
- expression.computeConstant();
- StringLiteral literal = this.ast.newStringLiteral();
- if (this.resolveBindings) {
- this.recordNodes(literal, expression);
+ /*
+ * Internal use only
+ * Used to convert class body declarations
+ */
+ public TypeDeclaration convert(org.eclipse.jdt.internal.compiler.ast.ASTNode[] nodes) {
+ TypeDeclaration typeDecl = this.ast.newTypeDeclaration();
+ int nodesLength = nodes.length;
+ for (int i = 0; i < nodesLength; i++) {
+ org.eclipse.jdt.internal.compiler.ast.ASTNode node = nodes[i];
+ if (node instanceof org.eclipse.jdt.internal.compiler.ast.Initializer) {
+ org.eclipse.jdt.internal.compiler.ast.Initializer oldInitializer = (org.eclipse.jdt.internal.compiler.ast.Initializer) node;
+ Initializer initializer = this.ast.newInitializer();
+ initializer.setBody(convert(oldInitializer.block));
+ if ((oldInitializer.modifiers & CompilerModifiers.AccJustFlag) != 0) {
+ setModifiers(initializer, oldInitializer);
+ }
+ initializer.setSourceRange(oldInitializer.declarationSourceStart, oldInitializer.sourceEnd - oldInitializer.declarationSourceStart + 1);
+// setJavaDocComment(initializer);
+// initializer.setJavadoc(convert(oldInitializer.javadoc));
+ convert(oldInitializer.javadoc, initializer);
+ typeDecl.bodyDeclarations().add(initializer);
+ } else if (node instanceof org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) {
+ org.eclipse.jdt.internal.compiler.ast.FieldDeclaration fieldDeclaration = (org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) node;
+ if (i > 0
+ && (nodes[i - 1] instanceof org.eclipse.jdt.internal.compiler.ast.FieldDeclaration)
+ && ((org.eclipse.jdt.internal.compiler.ast.FieldDeclaration)nodes[i - 1]).declarationSourceStart == fieldDeclaration.declarationSourceStart) {
+ // we have a multiple field declaration
+ // We retrieve the existing fieldDeclaration to add the new VariableDeclarationFragment
+ FieldDeclaration currentFieldDeclaration = (FieldDeclaration) typeDecl.bodyDeclarations().get(typeDecl.bodyDeclarations().size() - 1);
+ currentFieldDeclaration.fragments().add(convertToVariableDeclarationFragment(fieldDeclaration));
+ } else {
+ // we can create a new FieldDeclaration
+ typeDecl.bodyDeclarations().add(convertToFieldDeclaration(fieldDeclaration));
+ }
+ } else if(node instanceof org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration) {
+ AbstractMethodDeclaration nextMethodDeclaration = (AbstractMethodDeclaration) node;
+ if (!nextMethodDeclaration.isDefaultConstructor() && !nextMethodDeclaration.isClinit()) {
+ typeDecl.bodyDeclarations().add(convert(nextMethodDeclaration));
+ }
+ } else if(node instanceof org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) {
+ org.eclipse.jdt.internal.compiler.ast.TypeDeclaration nextMemberDeclaration = (org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) node;
+ ASTNode nextMemberDeclarationNode = convert(nextMemberDeclaration);
+ if (nextMemberDeclarationNode == null) {
+ typeDecl.setFlags(typeDecl.getFlags() | ASTNode.MALFORMED);
+ } else {
+ typeDecl.bodyDeclarations().add(nextMemberDeclarationNode);
+ }
+ }
}
- literal.setLiteralValue(expression.constant.stringValue());
- literal.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
- return literal;
+ return typeDecl;
}
public Expression convert(org.eclipse.jdt.internal.compiler.ast.BinaryExpression expression) {
@@ -1611,28 +1149,646 @@ class ASTConverter {
infixExpression.setSourceRange(startPosition, expression.sourceEnd - startPosition + 1);
return infixExpression;
}
-
- public PrefixExpression convert(org.eclipse.jdt.internal.compiler.ast.UnaryExpression expression) {
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
+
+ public Block convert(org.eclipse.jdt.internal.compiler.ast.Block statement) {
+ Block block = this.ast.newBlock();
+ if (statement.sourceEnd > 0) {
+ block.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
+ }
+ org.eclipse.jdt.internal.compiler.ast.Statement[] statements = statement.statements;
+ if (statements != null) {
+ int statementsLength = statements.length;
+ for (int i = 0; i < statementsLength; i++) {
+ if (statements[i] instanceof org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) {
+ checkAndAddMultipleLocalDeclaration(statements, i, block.statements());
+ } else {
+ block.statements().add(convert(statements[i]));
+ }
+ }
+ }
+ return block;
+ }
+
+ public BreakStatement convert(org.eclipse.jdt.internal.compiler.ast.BreakStatement statement) {
+ BreakStatement breakStatement = this.ast.newBreakStatement();
+ breakStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
+ if (statement.label != null) {
+ SimpleName name = this.ast.newSimpleName(new String(statement.label));
+ retrieveIdentifierAndSetPositions(statement.sourceStart, statement.sourceEnd, name);
+ breakStatement.setLabel(name);
+ }
+ retrieveSemiColonPosition(breakStatement);
+ return breakStatement;
+ }
+
+
+ public SwitchCase convert(org.eclipse.jdt.internal.compiler.ast.CaseStatement statement) {
+ SwitchCase switchCase = this.ast.newSwitchCase();
+ org.eclipse.jdt.internal.compiler.ast.Expression constantExpression = statement.constantExpression;
+ if (constantExpression == null) {
+ switchCase.setExpression(null);
+ } else {
+ switchCase.setExpression(convert(constantExpression));
+ }
+ switchCase.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
+ retrieveColonPosition(switchCase);
+ return switchCase;
+ }
+
+ public CastExpression convert(org.eclipse.jdt.internal.compiler.ast.CastExpression expression) {
+ CastExpression castExpression = this.ast.newCastExpression();
+ castExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
+ org.eclipse.jdt.internal.compiler.ast.Expression type = expression.type;
+ trimWhiteSpacesAndComments(type);
+ if (type instanceof org.eclipse.jdt.internal.compiler.ast.TypeReference ) {
+ castExpression.setType(convertType((org.eclipse.jdt.internal.compiler.ast.TypeReference)type));
+ } else if (type instanceof org.eclipse.jdt.internal.compiler.ast.NameReference) {
+ castExpression.setType(convertToType((org.eclipse.jdt.internal.compiler.ast.NameReference)type));
+ }
+ castExpression.setExpression(convert(expression.expression));
if (this.resolveBindings) {
- this.recordNodes(prefixExpression, expression);
+ recordNodes(castExpression, expression);
}
- prefixExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
- prefixExpression.setOperand(convert(expression.expression));
- switch ((expression.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.OperatorMASK) >> org.eclipse.jdt.internal.compiler.ast.ASTNode.OperatorSHIFT) {
+ return castExpression;
+ }
+
+ public CharacterLiteral convert(org.eclipse.jdt.internal.compiler.ast.CharLiteral expression) {
+ int length = expression.sourceEnd - expression.sourceStart + 1;
+ int sourceStart = expression.sourceStart;
+ char[] tokens = new char[length];
+ System.arraycopy(this.compilationUnitSource, sourceStart, tokens, 0, length);
+ CharacterLiteral literal = this.ast.newCharacterLiteral();
+ if (this.resolveBindings) {
+ this.recordNodes(literal, expression);
+ }
+ literal.setEscapedValue(new String(tokens));
+ literal.setSourceRange(sourceStart, length);
+ removeLeadingAndTrailingCommentsFromLiteral(literal);
+ return literal;
+ }
+ public Expression convert(org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess expression) {
+ TypeLiteral typeLiteral = this.ast.newTypeLiteral();
+ if (this.resolveBindings) {
+ this.recordNodes(typeLiteral, expression);
+ }
+ typeLiteral.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
+ typeLiteral.setType(convertType(expression.type));
+ return typeLiteral;
+ }
+
+ public CompilationUnit convert(org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration unit, char[] source) {
+ this.compilationUnitSource = source;
+ this.scanner.setSource(source);
+ this.scanner.lineEnds = unit.compilationResult().lineSeparatorPositions;
+ CompilationUnit compilationUnit = this.ast.newCompilationUnit();
+ // handle the package declaration immediately
+ // There is no node corresponding to the package declaration
+ if (this.resolveBindings) {
+ recordNodes(compilationUnit, unit);
+ }
+ if (unit.currentPackage != null) {
+ PackageDeclaration packageDeclaration = convertPackage(unit);
+ compilationUnit.setPackage(packageDeclaration);
+ }
+ org.eclipse.jdt.internal.compiler.ast.ImportReference[] imports = unit.imports;
+ if (imports != null) {
+ int importLength = imports.length;
+ for (int i = 0; i < importLength; i++) {
+ compilationUnit.imports().add(convertImport(imports[i]));
+ }
+ }
+
+ // 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;
+ for (int i = 0; i < typesLength; i++) {
+ ASTNode type = convert(types[i]);
+ if (type == null) {
+ compilationUnit.setFlags(compilationUnit.getFlags() | ASTNode.MALFORMED);
+ } else {
+ compilationUnit.types().add(type);
+ }
+ }
+ }
+ compilationUnit.setSourceRange(unit.sourceStart, unit.sourceEnd - unit.sourceStart + 1);
+
+ int problemLength = unit.compilationResult.problemCount;
+ if (problemLength != 0) {
+ IProblem[] resizedProblems = null;
+ final IProblem[] problems = unit.compilationResult.problems;
+ if (problems.length == problemLength) {
+ resizedProblems = problems;
+ } else {
+ System.arraycopy(problems, 0, (resizedProblems = new IProblem[problemLength]), 0, problemLength);
+ }
+ ASTSyntaxErrorPropagator syntaxErrorPropagator = new ASTSyntaxErrorPropagator(resizedProblems);
+ compilationUnit.accept(syntaxErrorPropagator);
+ compilationUnit.setProblems(resizedProblems);
+ }
+ if (this.resolveBindings) {
+ lookupForScopes();
+ }
+ compilationUnit.initCommentMapper(this.scanner);
+ return compilationUnit;
+ }
+
+ public Assignment convert(org.eclipse.jdt.internal.compiler.ast.CompoundAssignment expression) {
+ Assignment assignment = this.ast.newAssignment();
+ Expression lhs = convert(expression.lhs);
+ assignment.setLeftHandSide(lhs);
+ int start = lhs.getStartPosition();
+ assignment.setSourceRange(start, expression.sourceEnd - start + 1);
+ switch (expression.operator) {
case org.eclipse.jdt.internal.compiler.ast.OperatorIds.PLUS :
- prefixExpression.setOperator(PrefixExpression.Operator.PLUS);
+ assignment.setOperator(Assignment.Operator.PLUS_ASSIGN);
break;
case org.eclipse.jdt.internal.compiler.ast.OperatorIds.MINUS :
- prefixExpression.setOperator(PrefixExpression.Operator.MINUS);
+ assignment.setOperator(Assignment.Operator.MINUS_ASSIGN);
break;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.NOT :
- prefixExpression.setOperator(PrefixExpression.Operator.NOT);
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.MULTIPLY :
+ assignment.setOperator(Assignment.Operator.TIMES_ASSIGN);
+ break;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.DIVIDE :
+ assignment.setOperator(Assignment.Operator.DIVIDE_ASSIGN);
+ break;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.AND :
+ assignment.setOperator(Assignment.Operator.BIT_AND_ASSIGN);
+ break;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.OR :
+ assignment.setOperator(Assignment.Operator.BIT_OR_ASSIGN);
+ break;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.XOR :
+ assignment.setOperator(Assignment.Operator.BIT_XOR_ASSIGN);
+ break;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.REMAINDER :
+ assignment.setOperator(Assignment.Operator.REMAINDER_ASSIGN);
+ break;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.LEFT_SHIFT :
+ assignment.setOperator(Assignment.Operator.LEFT_SHIFT_ASSIGN);
+ break;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.RIGHT_SHIFT :
+ assignment.setOperator(Assignment.Operator.RIGHT_SHIFT_SIGNED_ASSIGN);
+ break;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.UNSIGNED_RIGHT_SHIFT :
+ assignment.setOperator(Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN);
break;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.TWIDDLE :
- prefixExpression.setOperator(PrefixExpression.Operator.COMPLEMENT);
}
- return prefixExpression;
+ assignment.setRightHandSide(convert(expression.expression));
+ return assignment;
+ }
+
+ public ConditionalExpression convert(org.eclipse.jdt.internal.compiler.ast.ConditionalExpression expression) {
+ ConditionalExpression conditionalExpression = this.ast.newConditionalExpression();
+ if (this.resolveBindings) {
+ recordNodes(conditionalExpression, expression);
+ }
+ conditionalExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
+ conditionalExpression.setExpression(convert(expression.condition));
+ conditionalExpression.setThenExpression(convert(expression.valueIfTrue));
+ conditionalExpression.setElseExpression(convert(expression.valueIfFalse));
+ return conditionalExpression;
+ }
+
+ public ContinueStatement convert(org.eclipse.jdt.internal.compiler.ast.ContinueStatement statement) {
+ ContinueStatement continueStatement = this.ast.newContinueStatement();
+ continueStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
+ if (statement.label != null) {
+ SimpleName name = this.ast.newSimpleName(new String(statement.label));
+ retrieveIdentifierAndSetPositions(statement.sourceStart, statement.sourceEnd, name);
+ continueStatement.setLabel(name);
+ }
+ retrieveSemiColonPosition(continueStatement);
+ return continueStatement;
+ }
+
+ public DoStatement convert(org.eclipse.jdt.internal.compiler.ast.DoStatement statement) {
+ DoStatement doStatement = this.ast.newDoStatement();
+ doStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
+ doStatement.setExpression(convert(statement.condition));
+ doStatement.setBody(convert(statement.action));
+ retrieveSemiColonPosition(doStatement);
+ return doStatement;
+ }
+
+ public NumberLiteral convert(org.eclipse.jdt.internal.compiler.ast.DoubleLiteral expression) {
+ int length = expression.sourceEnd - expression.sourceStart + 1;
+ int sourceStart = expression.sourceStart;
+ char[] tokens = new char[length];
+ System.arraycopy(this.compilationUnitSource, sourceStart, tokens, 0, length);
+ NumberLiteral literal = this.ast.newNumberLiteral(new String(tokens));
+ if (this.resolveBindings) {
+ this.recordNodes(literal, expression);
+ }
+ literal.setSourceRange(sourceStart, length);
+ removeLeadingAndTrailingCommentsFromLiteral(literal);
+ return literal;
+ }
+
+ public EmptyStatement convert(org.eclipse.jdt.internal.compiler.ast.EmptyStatement statement) {
+ EmptyStatement emptyStatement = this.ast.newEmptyStatement();
+ emptyStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
+ return emptyStatement;
+ }
+
+ public EnumConstantDeclaration convert(EnumConstant enumConstant) {
+ checkCanceled();
+ EnumConstantDeclaration enumConstantDeclaration = this.ast.newEnumConstantDeclaration();
+ SimpleName typeName = this.ast.newSimpleName(new String(enumConstant.name));
+ typeName.setSourceRange(enumConstant.sourceStart, enumConstant.sourceEnd - enumConstant.sourceStart + 1);
+ enumConstantDeclaration.setName(typeName);
+ int declarationSourceStart = enumConstant.declarationSourceStart;
+ int declarationSourceEnd = enumConstant.bodyEnd;
+ if ((enumConstant.modifiers & CompilerModifiers.AccSemicolonBody) == 0) {
+ int closingPosition = retrieveRightBrace(declarationSourceEnd, enumConstant.declarationSourceEnd);
+ enumConstantDeclaration.setSourceRange(declarationSourceStart, closingPosition - declarationSourceStart + 1);
+ } else {
+ enumConstantDeclaration.setSourceRange(declarationSourceStart, declarationSourceEnd - declarationSourceStart + 1);
+ }
+ buildBodyDeclarations(enumConstant, enumConstantDeclaration);
+ final org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = enumConstant.arguments;
+ if (arguments != null) {
+ for (int i = 0, max = arguments.length; i < max; i++) {
+ enumConstantDeclaration.arguments().add(convert(arguments[i]));
+ }
+ }
+ if (this.resolveBindings) {
+ recordNodes(enumConstantDeclaration, enumConstant);
+ recordNodes(typeName, enumConstant);
+ enumConstantDeclaration.resolveVariable();
+ }
+ return enumConstantDeclaration;
+ }
+
+ public EnumDeclaration convert(org.eclipse.jdt.internal.compiler.ast.EnumDeclaration enumDeclaration) {
+ checkCanceled();
+ EnumDeclaration enumDeclaration2 = this.ast.newEnumDeclaration();
+ int modifiers = enumDeclaration.modifiers;
+ modifiers &= ~IConstants.AccInterface; // remove AccInterface flags
+ modifiers &= CompilerModifiers.AccJustFlag;
+ if (modifiers != 0) {
+ setModifiers(enumDeclaration2, enumDeclaration);
+ }
+ SimpleName typeName = this.ast.newSimpleName(new String(enumDeclaration.name));
+ typeName.setSourceRange(enumDeclaration.sourceStart, enumDeclaration.sourceEnd - enumDeclaration.sourceStart + 1);
+ enumDeclaration2.setName(typeName);
+ enumDeclaration2.setSourceRange(enumDeclaration.declarationSourceStart, enumDeclaration.bodyEnd - enumDeclaration.declarationSourceStart + 1);
+
+ org.eclipse.jdt.internal.compiler.ast.TypeReference[] superInterfaces = enumDeclaration.superInterfaces;
+ if (superInterfaces != null) {
+ for (int index = 0, length = superInterfaces.length; index < length; index++) {
+ enumDeclaration2.superInterfaceTypes().add(convertType(superInterfaces[index]));
+ }
+ }
+ buildBodyDeclarations(enumDeclaration, enumDeclaration2);
+ if (this.resolveBindings) {
+ recordNodes(enumDeclaration2, enumDeclaration);
+ recordNodes(typeName, enumDeclaration);
+ enumDeclaration2.resolveBinding();
+ }
+ return enumDeclaration2;
+ }
+
+ public Expression convert(org.eclipse.jdt.internal.compiler.ast.EqualExpression expression) {
+ InfixExpression infixExpression = this.ast.newInfixExpression();
+ if (this.resolveBindings) {
+ recordNodes(infixExpression, expression);
+ }
+ Expression leftExpression = convert(expression.left);
+ infixExpression.setLeftOperand(leftExpression);
+ infixExpression.setRightOperand(convert(expression.right));
+ int startPosition = leftExpression.getStartPosition();
+ infixExpression.setSourceRange(startPosition, expression.sourceEnd - startPosition + 1);
+ switch ((expression.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.OperatorMASK) >> org.eclipse.jdt.internal.compiler.ast.ASTNode.OperatorSHIFT) {
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.EQUAL_EQUAL :
+ infixExpression.setOperator(InfixExpression.Operator.EQUALS);
+ break;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.NOT_EQUAL :
+ infixExpression.setOperator(InfixExpression.Operator.NOT_EQUALS);
+ }
+ return infixExpression;
+
+ }
+
+ public Statement convert(org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall statement) {
+ Statement newStatement;
+ if (statement.isSuperAccess() || statement.isSuper()) {
+ SuperConstructorInvocation superConstructorInvocation = this.ast.newSuperConstructorInvocation();
+ if (statement.qualification != null) {
+ superConstructorInvocation.setExpression(convert(statement.qualification));
+ }
+ org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = statement.arguments;
+ if (arguments != null) {
+ int length = arguments.length;
+ for (int i = 0; i < length; i++) {
+ superConstructorInvocation.arguments().add(convert(arguments[i]));
+ }
+ }
+ if (statement.typeArguments != null) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ superConstructorInvocation.setFlags(superConstructorInvocation.getFlags() | ASTNode.MALFORMED);
+ break;
+ case AST.JLS3 :
+ for (int i = 0, max = statement.typeArguments.length; i < max; i++) {
+ superConstructorInvocation.typeArguments().add(convertType(statement.typeArguments[i]));
+ }
+ }
+ }
+ newStatement = superConstructorInvocation;
+ } else {
+ ConstructorInvocation constructorInvocation = this.ast.newConstructorInvocation();
+ org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = statement.arguments;
+ if (arguments != null) {
+ int length = arguments.length;
+ for (int i = 0; i < length; i++) {
+ constructorInvocation.arguments().add(convert(arguments[i]));
+ }
+ }
+ if (statement.typeArguments != null) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ constructorInvocation.setFlags(constructorInvocation.getFlags() | ASTNode.MALFORMED);
+ break;
+ case AST.JLS3 :
+ for (int i = 0, max = statement.typeArguments.length; i < max; i++) {
+ constructorInvocation.typeArguments().add(convertType(statement.typeArguments[i]));
+ }
+ }
+ }
+ newStatement = constructorInvocation;
+ }
+ newStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
+ retrieveSemiColonPosition(newStatement);
+ if (this.resolveBindings) {
+ recordNodes(newStatement, statement);
+ }
+ return newStatement;
+ }
+
+ public Expression convert(org.eclipse.jdt.internal.compiler.ast.Expression expression) {
+ if ((expression.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.ParenthesizedMASK) != 0) {
+ return convertToParenthesizedExpression(expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.Annotation) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.Annotation) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.CastExpression) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.CastExpression) expression);
+ }
+ // switch between all types of expression
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.ArrayAllocationExpression) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.ArrayAllocationExpression) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.AllocationExpression) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.AllocationExpression) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.ArrayInitializer) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.ArrayInitializer) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.PrefixExpression) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.PrefixExpression) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.PostfixExpression) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.PostfixExpression) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.CompoundAssignment) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.CompoundAssignment) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.Assignment) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.Assignment) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.FalseLiteral) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.FalseLiteral) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.TrueLiteral) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.TrueLiteral) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.NullLiteral) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.NullLiteral) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.CharLiteral) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.CharLiteral) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.DoubleLiteral) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.DoubleLiteral) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.FloatLiteral) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.FloatLiteral) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.IntLiteralMinValue) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.IntLiteralMinValue) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.IntLiteral) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.IntLiteral) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.LongLiteralMinValue) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.LongLiteralMinValue) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.LongLiteral) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.LongLiteral) expression);
+ }
+ if (expression instanceof StringLiteralConcatenation) {
+ return convert((StringLiteralConcatenation) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.ExtendedStringLiteral) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.ExtendedStringLiteral) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.StringLiteral) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.StringLiteral) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.AND_AND_Expression) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.AND_AND_Expression) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.OR_OR_Expression) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.OR_OR_Expression) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.EqualExpression) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.EqualExpression) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.BinaryExpression) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.BinaryExpression) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.UnaryExpression) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.UnaryExpression) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.ConditionalExpression) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.ConditionalExpression) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.MessageSend) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.MessageSend) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.Reference) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.Reference) expression);
+ }
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.TypeReference) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.TypeReference) expression);
+ }
+ return null;
+ }
+
+ public StringLiteral convert(org.eclipse.jdt.internal.compiler.ast.ExtendedStringLiteral expression) {
+ expression.computeConstant();
+ StringLiteral literal = this.ast.newStringLiteral();
+ if (this.resolveBindings) {
+ this.recordNodes(literal, expression);
+ }
+ literal.setLiteralValue(expression.constant.stringValue());
+ literal.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
+ return literal;
+ }
+
+ public BooleanLiteral convert(org.eclipse.jdt.internal.compiler.ast.FalseLiteral expression) {
+ BooleanLiteral literal = this.ast.newBooleanLiteral(false);
+ if (this.resolveBindings) {
+ this.recordNodes(literal, expression);
+ }
+ literal.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
+ return literal;
+ }
+
+ public Expression convert(org.eclipse.jdt.internal.compiler.ast.FieldReference reference) {
+ if (reference.receiver.isSuper()) {
+ SuperFieldAccess superFieldAccess = this.ast.newSuperFieldAccess();
+ if (this.resolveBindings) {
+ recordNodes(superFieldAccess, reference);
+ }
+ if (reference.receiver instanceof org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference) {
+ Name qualifier = convert((org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference) reference.receiver);
+ superFieldAccess.setQualifier(qualifier);
+ if (this.resolveBindings) {
+ recordNodes(qualifier, reference.receiver);
+ }
+ }
+ SimpleName simpleName = this.ast.newSimpleName(new String(reference.token));
+ int sourceStart = (int)(reference.nameSourcePosition>>>32);
+ int length = (int)(reference.nameSourcePosition & 0xFFFFFFFF) - sourceStart + 1;
+ simpleName.setSourceRange(sourceStart, length);
+ superFieldAccess.setName(simpleName);
+ if (this.resolveBindings) {
+ recordNodes(simpleName, reference);
+ }
+ superFieldAccess.setSourceRange(reference.receiver.sourceStart, reference.sourceEnd - reference.receiver.sourceStart + 1);
+ return superFieldAccess;
+ } else {
+ FieldAccess fieldAccess = this.ast.newFieldAccess();
+ if (this.resolveBindings) {
+ recordNodes(fieldAccess, reference);
+ }
+ Expression receiver = convert(reference.receiver);
+ fieldAccess.setExpression(receiver);
+ SimpleName simpleName = this.ast.newSimpleName(new String(reference.token));
+ int sourceStart = (int)(reference.nameSourcePosition>>>32);
+ int length = (int)(reference.nameSourcePosition & 0xFFFFFFFF) - sourceStart + 1;
+ simpleName.setSourceRange(sourceStart, length);
+ fieldAccess.setName(simpleName);
+ if (this.resolveBindings) {
+ recordNodes(simpleName, reference);
+ }
+ fieldAccess.setSourceRange(receiver.getStartPosition(), reference.sourceEnd - receiver.getStartPosition() + 1);
+ return fieldAccess;
+ }
+ }
+
+ public NumberLiteral convert(org.eclipse.jdt.internal.compiler.ast.FloatLiteral expression) {
+ int length = expression.sourceEnd - expression.sourceStart + 1;
+ int sourceStart = expression.sourceStart;
+ char[] tokens = new char[length];
+ System.arraycopy(this.compilationUnitSource, sourceStart, tokens, 0, length);
+ NumberLiteral literal = this.ast.newNumberLiteral(new String(tokens));
+ if (this.resolveBindings) {
+ this.recordNodes(literal, expression);
+ }
+ literal.setSourceRange(sourceStart, length);
+ removeLeadingAndTrailingCommentsFromLiteral(literal);
+ return literal;
+ }
+
+ public Statement convert(ForeachStatement statement) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ return createFakeEmptyStatement(statement);
+ case AST.JLS3 :
+ EnhancedForStatement enhancedForStatement = this.ast.newEnhancedForStatement();
+ enhancedForStatement.setParameter(convertToSingleVariableDeclaration(statement.elementVariable));
+ enhancedForStatement.setExpression(convert(statement.collection));
+ enhancedForStatement.setBody(convert(statement.action));
+ int start = statement.sourceStart;
+ int end = statement.sourceEnd;
+ enhancedForStatement.setSourceRange(start, end - start + 1);
+ return enhancedForStatement;
+ default:
+ return createFakeEmptyStatement(statement);
+ }
+ }
+
+ public ForStatement convert(org.eclipse.jdt.internal.compiler.ast.ForStatement statement) {
+ ForStatement forStatement = this.ast.newForStatement();
+ forStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
+ org.eclipse.jdt.internal.compiler.ast.Statement[] initializations = statement.initializations;
+ if (initializations != null) {
+ // we know that we have at least one initialization
+ if (initializations[0] instanceof org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) {
+ VariableDeclarationExpression variableDeclarationExpression = convertToVariableDeclarationExpression((org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) initializations[0]);
+ int initializationsLength = initializations.length;
+ for (int i = 1; i < initializationsLength; i++) {
+ variableDeclarationExpression.fragments().add(convertToVariableDeclarationFragment((org.eclipse.jdt.internal.compiler.ast.LocalDeclaration)initializations[i]));
+ }
+ if (initializationsLength != 1) {
+ int start = variableDeclarationExpression.getStartPosition();
+ int end = ((org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) initializations[initializationsLength - 1]).declarationSourceEnd;
+ variableDeclarationExpression.setSourceRange(start, end - start + 1);
+ }
+ forStatement.initializers().add(variableDeclarationExpression);
+ } else {
+ int initializationsLength = initializations.length;
+ for (int i = 0; i < initializationsLength; i++) {
+ Expression initializer = convertToExpression(initializations[i]);
+ if (initializer != null) {
+ forStatement.initializers().add(initializer);
+ } else {
+ forStatement.setFlags(forStatement.getFlags() | ASTNode.MALFORMED);
+ }
+ }
+ }
+ }
+ if (statement.condition != null) {
+ forStatement.setExpression(convert(statement.condition));
+ }
+ org.eclipse.jdt.internal.compiler.ast.Statement[] increments = statement.increments;
+ if (increments != null) {
+ int incrementsLength = increments.length;
+ for (int i = 0; i < incrementsLength; i++) {
+ forStatement.updaters().add(convertToExpression(increments[i]));
+ }
+ }
+ forStatement.setBody(convert(statement.action));
+ return forStatement;
+ }
+
+ public IfStatement convert(org.eclipse.jdt.internal.compiler.ast.IfStatement statement) {
+ IfStatement ifStatement = this.ast.newIfStatement();
+ ifStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
+ ifStatement.setExpression(convert(statement.condition));
+ ifStatement.setThenStatement(convert(statement.thenStatement));
+ if (statement.elseStatement != null) {
+ ifStatement.setElseStatement(convert(statement.elseStatement));
+ }
+ return ifStatement;
}
public InstanceofExpression convert(org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression expression) {
@@ -1648,16 +1804,94 @@ class ASTConverter {
return instanceOfExpression;
}
- public ConditionalExpression convert(org.eclipse.jdt.internal.compiler.ast.ConditionalExpression expression) {
- ConditionalExpression conditionalExpression = this.ast.newConditionalExpression();
+ public NumberLiteral convert(org.eclipse.jdt.internal.compiler.ast.IntLiteral expression) {
+ int length = expression.sourceEnd - expression.sourceStart + 1;
+ int sourceStart = expression.sourceStart;
+ char[] tokens = new char[length];
+ System.arraycopy(this.compilationUnitSource, sourceStart, tokens, 0, length);
+ NumberLiteral literal = this.ast.newNumberLiteral(new String(tokens));
if (this.resolveBindings) {
- recordNodes(conditionalExpression, expression);
+ this.recordNodes(literal, expression);
}
- conditionalExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
- conditionalExpression.setExpression(convert(expression.condition));
- conditionalExpression.setThenExpression(convert(expression.valueIfTrue));
- conditionalExpression.setElseExpression(convert(expression.valueIfFalse));
- return conditionalExpression;
+ literal.setSourceRange(sourceStart, length);
+ removeLeadingAndTrailingCommentsFromLiteral(literal);
+ return literal;
+ }
+
+ public NumberLiteral convert(org.eclipse.jdt.internal.compiler.ast.IntLiteralMinValue expression) {
+ int length = expression.sourceEnd - expression.sourceStart + 1;
+ int sourceStart = expression.sourceStart;
+ char[] tokens = new char[length];
+ System.arraycopy(this.compilationUnitSource, sourceStart, tokens, 0, length);
+ NumberLiteral literal = this.ast.newNumberLiteral(new String(tokens));
+ if (this.resolveBindings) {
+ this.recordNodes(literal, expression);
+ }
+ literal.setSourceRange(sourceStart, length);
+ removeLeadingAndTrailingCommentsFromLiteral(literal);
+ return literal;
+ }
+
+ public void convert(org.eclipse.jdt.internal.compiler.ast.Javadoc javadoc, BodyDeclaration bodyDeclaration) {
+ if (bodyDeclaration.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());
+ }
+ }
+ bodyDeclaration.setJavadoc(docComment);
+ }
+ }
+ }
+ }
+
+ public LabeledStatement convert(org.eclipse.jdt.internal.compiler.ast.LabeledStatement statement) {
+ LabeledStatement labeledStatement = this.ast.newLabeledStatement();
+ labeledStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
+ org.eclipse.jdt.internal.compiler.ast.Statement body = statement.statement;
+ labeledStatement.setBody(convert(body));
+ SimpleName name = this.ast.newSimpleName(new String(statement.label));
+ retrieveIdentifierAndSetPositions(statement.sourceStart, statement.sourceEnd, name);
+ labeledStatement.setLabel(name);
+ return labeledStatement;
+ }
+
+ public NumberLiteral convert(org.eclipse.jdt.internal.compiler.ast.LongLiteral expression) {
+ int length = expression.sourceEnd - expression.sourceStart + 1;
+ int sourceStart = expression.sourceStart;
+ char[] tokens = new char[length];
+ System.arraycopy(this.compilationUnitSource, sourceStart, tokens, 0, length);
+ NumberLiteral literal = this.ast.newNumberLiteral(new String(tokens));
+ if (this.resolveBindings) {
+ this.recordNodes(literal, expression);
+ }
+ literal.setSourceRange(sourceStart, length);
+ removeLeadingAndTrailingCommentsFromLiteral(literal);
+ return literal;
+ }
+
+ public NumberLiteral convert(org.eclipse.jdt.internal.compiler.ast.LongLiteralMinValue expression) {
+ int length = expression.sourceEnd - expression.sourceStart + 1;
+ int sourceStart = expression.sourceStart;
+ char[] tokens = new char[length];
+ System.arraycopy(this.compilationUnitSource, sourceStart, tokens, 0, length);
+ NumberLiteral literal = this.ast.newNumberLiteral(new String(tokens));
+ if (this.resolveBindings) {
+ this.recordNodes(literal, expression);
+ }
+ literal.setSourceRange(sourceStart, length);
+ removeLeadingAndTrailingCommentsFromLiteral(literal);
+ return literal;
}
public Expression convert(MessageSend expression) {
@@ -1752,40 +1986,76 @@ class ASTConverter {
return expr;
}
- public Expression convert(org.eclipse.jdt.internal.compiler.ast.AND_AND_Expression expression) {
+ public MarkerAnnotation convert(org.eclipse.jdt.internal.compiler.ast.MarkerAnnotation annotation) {
+ MarkerAnnotation markerAnnotation = this.ast.newMarkerAnnotation();
+ setTypeNameForAnnotation(annotation, markerAnnotation);
+ int start = annotation.sourceStart;
+ int end = annotation.declarationSourceEnd;
+ markerAnnotation.setSourceRange(start, end - start + 1);
+ return markerAnnotation;
+ }
+
+ public MemberValuePair convert(org.eclipse.jdt.internal.compiler.ast.MemberValuePair memberValuePair) {
+ MemberValuePair pair = this.ast.newMemberValuePair();
+ SimpleName simpleName = this.ast.newSimpleName(new String(memberValuePair.token));
+ int start = memberValuePair.sourceStart;
+ int end = memberValuePair.sourceEnd;
+ simpleName.setSourceRange(start, end - start + 1);
+ pair.setName(simpleName);
+ pair.setValue(convert(memberValuePair.value));
+ start = memberValuePair.sourceStart;
+ end = memberValuePair.value.sourceEnd;
+ pair.setSourceRange(start, end - start + 1);
+ return pair;
+ }
+
+ public Name convert(org.eclipse.jdt.internal.compiler.ast.NameReference reference) {
+ if (reference instanceof org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference) reference);
+ } else {
+ return convert((org.eclipse.jdt.internal.compiler.ast.SingleNameReference) reference);
+ }
+ }
+
+ public InfixExpression convert(StringLiteralConcatenation expression) {
+ expression.computeConstant();
InfixExpression infixExpression = this.ast.newInfixExpression();
+ infixExpression.setOperator(InfixExpression.Operator.PLUS);
+ org.eclipse.jdt.internal.compiler.ast.StringLiteral[] stringLiterals = expression.literals;
+ infixExpression.setLeftOperand(convert(stringLiterals[0]));
+ infixExpression.setRightOperand(convert(stringLiterals[1]));
+ for (int i = 2; i < expression.counter; i++) {
+ infixExpression.extendedOperands().add(convert(stringLiterals[i]));
+ }
if (this.resolveBindings) {
- recordNodes(infixExpression, expression);
+ this.recordNodes(infixExpression, expression);
}
- Expression leftExpression = convert(expression.left);
- infixExpression.setLeftOperand(leftExpression);
- infixExpression.setRightOperand(convert(expression.right));
- infixExpression.setOperator(InfixExpression.Operator.CONDITIONAL_AND);
- int startPosition = leftExpression.getStartPosition();
- infixExpression.setSourceRange(startPosition, expression.sourceEnd - startPosition + 1);
+ infixExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
return infixExpression;
-
}
- public Expression convert(org.eclipse.jdt.internal.compiler.ast.EqualExpression expression) {
- InfixExpression infixExpression = this.ast.newInfixExpression();
- if (this.resolveBindings) {
- recordNodes(infixExpression, expression);
+ public NormalAnnotation convert(org.eclipse.jdt.internal.compiler.ast.NormalAnnotation annotation) {
+ NormalAnnotation normalAnnotation = this.ast.newNormalAnnotation();
+ setTypeNameForAnnotation(annotation, normalAnnotation);
+ org.eclipse.jdt.internal.compiler.ast.MemberValuePair[] memberValuePairs = annotation.memberValuePairs;
+ if (memberValuePairs != null) {
+ for (int i = 0, max = memberValuePairs.length; i < max; i++) {
+ normalAnnotation.values().add(convert(memberValuePairs[i]));
+ }
}
- Expression leftExpression = convert(expression.left);
- infixExpression.setLeftOperand(leftExpression);
- infixExpression.setRightOperand(convert(expression.right));
- int startPosition = leftExpression.getStartPosition();
- infixExpression.setSourceRange(startPosition, expression.sourceEnd - startPosition + 1);
- switch ((expression.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.OperatorMASK) >> org.eclipse.jdt.internal.compiler.ast.ASTNode.OperatorSHIFT) {
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.EQUAL_EQUAL :
- infixExpression.setOperator(InfixExpression.Operator.EQUALS);
- break;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.NOT_EQUAL :
- infixExpression.setOperator(InfixExpression.Operator.NOT_EQUALS);
+ int start = annotation.sourceStart;
+ int end = annotation.declarationSourceEnd;
+ normalAnnotation.setSourceRange(start, end - start + 1);
+ return normalAnnotation;
+ }
+
+ public org.eclipse.jdt.core.dom.NullLiteral convert(org.eclipse.jdt.internal.compiler.ast.NullLiteral expression) {
+ org.eclipse.jdt.core.dom.NullLiteral literal = this.ast.newNullLiteral();
+ if (this.resolveBindings) {
+ this.recordNodes(literal, expression);
}
- return infixExpression;
-
+ literal.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
+ return literal;
}
public Expression convert(org.eclipse.jdt.internal.compiler.ast.OR_OR_Expression expression) {
@@ -1802,7 +2072,169 @@ class ASTConverter {
return infixExpression;
}
+ public PostfixExpression convert(org.eclipse.jdt.internal.compiler.ast.PostfixExpression expression) {
+ PostfixExpression postfixExpression = this.ast.newPostfixExpression();
+ if (this.resolveBindings) {
+ recordNodes(postfixExpression, expression);
+ }
+ postfixExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
+ postfixExpression.setOperand(convert(expression.lhs));
+ switch (expression.operator) {
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.PLUS :
+ postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
+ break;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.MINUS :
+ postfixExpression.setOperator(PostfixExpression.Operator.DECREMENT);
+ break;
+ }
+ return postfixExpression;
+ }
+
+ public PrefixExpression convert(org.eclipse.jdt.internal.compiler.ast.PrefixExpression expression) {
+ PrefixExpression prefixExpression = this.ast.newPrefixExpression();
+ if (this.resolveBindings) {
+ recordNodes(prefixExpression, expression);
+ }
+ prefixExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
+ prefixExpression.setOperand(convert(expression.lhs));
+ switch (expression.operator) {
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.PLUS :
+ prefixExpression.setOperator(PrefixExpression.Operator.INCREMENT);
+ break;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.MINUS :
+ prefixExpression.setOperator(PrefixExpression.Operator.DECREMENT);
+ break;
+ }
+ return prefixExpression;
+ }
+
+ public Expression convert(org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression allocation) {
+ ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
+ if (allocation.enclosingInstance != null) {
+ classInstanceCreation.setExpression(convert(allocation.enclosingInstance));
+ }
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ classInstanceCreation.setName(convert(allocation.type));
+ break;
+ case AST.JLS3 :
+ classInstanceCreation.setType(convertType(allocation.type));
+ }
+ org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = allocation.arguments;
+ if (arguments != null) {
+ int length = arguments.length;
+ for (int i = 0; i < length; i++) {
+ Expression argument = convert(arguments[i]);
+ if (this.resolveBindings) {
+ recordNodes(argument, arguments[i]);
+ }
+ classInstanceCreation.arguments().add(argument);
+ }
+ }
+ if (allocation.typeArguments != null) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ classInstanceCreation.setFlags(classInstanceCreation.getFlags() | ASTNode.MALFORMED);
+ break;
+ case AST.JLS3 :
+ for (int i = 0, max = allocation.typeArguments.length; i < max; i++) {
+ classInstanceCreation.typeArguments().add(convert(allocation.typeArguments[i]));
+ }
+ }
+ }
+ if (allocation.anonymousType != null) {
+ int declarationSourceStart = allocation.sourceStart;
+ classInstanceCreation.setSourceRange(declarationSourceStart, allocation.anonymousType.bodyEnd - declarationSourceStart + 1);
+ AnonymousClassDeclaration anonymousClassDeclaration = this.ast.newAnonymousClassDeclaration();
+ int start = retrieveStartBlockPosition(allocation.anonymousType.sourceEnd, allocation.anonymousType.bodyEnd);
+ anonymousClassDeclaration.setSourceRange(start, allocation.anonymousType.bodyEnd - start + 1);
+ classInstanceCreation.setAnonymousClassDeclaration(anonymousClassDeclaration);
+ buildBodyDeclarations(allocation.anonymousType, anonymousClassDeclaration);
+ if (this.resolveBindings) {
+ recordNodes(classInstanceCreation, allocation.anonymousType);
+ recordNodes(anonymousClassDeclaration, allocation.anonymousType);
+ anonymousClassDeclaration.resolveBinding();
+ }
+ return classInstanceCreation;
+ } else {
+ final int start = allocation.sourceStart;
+ classInstanceCreation.setSourceRange(start, allocation.sourceEnd - start + 1);
+ if (this.resolveBindings) {
+ recordNodes(classInstanceCreation, allocation);
+ }
+ removeTrailingCommentFromExpressionEndingWithAParen(classInstanceCreation);
+ return classInstanceCreation;
+ }
+ }
+
+ public Name convert(org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference nameReference) {
+ return setQualifiedNameNameAndSourceRanges(nameReference.tokens, nameReference.sourcePositions, nameReference);
+ }
+
+ public Name convert(org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference reference) {
+ return convert(reference.qualification);
+ }
+
+ public ThisExpression convert(org.eclipse.jdt.internal.compiler.ast.QualifiedThisReference reference) {
+ ThisExpression thisExpression = this.ast.newThisExpression();
+ thisExpression.setSourceRange(reference.sourceStart, reference.sourceEnd - reference.sourceStart + 1);
+ thisExpression.setQualifier(convert(reference.qualification));
+ if (this.resolveBindings) {
+ recordNodes(thisExpression, reference);
+ recordPendingThisExpressionScopeResolution(thisExpression);
+ }
+ return thisExpression;
+ }
+
+ public Expression convert(org.eclipse.jdt.internal.compiler.ast.Reference reference) {
+ if (reference instanceof org.eclipse.jdt.internal.compiler.ast.NameReference) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.NameReference) reference);
+ }
+ if (reference instanceof org.eclipse.jdt.internal.compiler.ast.ThisReference) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.ThisReference) reference);
+ }
+ if (reference instanceof org.eclipse.jdt.internal.compiler.ast.ArrayReference) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.ArrayReference) reference);
+ }
+ if (reference instanceof org.eclipse.jdt.internal.compiler.ast.FieldReference) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.FieldReference) reference);
+ }
+ return null; // cannot be reached
+ }
+
+ public ReturnStatement convert(org.eclipse.jdt.internal.compiler.ast.ReturnStatement statement) {
+ ReturnStatement returnStatement = this.ast.newReturnStatement();
+ returnStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
+ if (statement.expression != null) {
+ returnStatement.setExpression(convert(statement.expression));
+ }
+ retrieveSemiColonPosition(returnStatement);
+ return returnStatement;
+ }
+
+ public SingleMemberAnnotation convert(org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation annotation) {
+ SingleMemberAnnotation singleMemberAnnotation = this.ast.newSingleMemberAnnotation();
+ setTypeNameForAnnotation(annotation, singleMemberAnnotation);
+ singleMemberAnnotation.setValue(convert(annotation.memberValue));
+ int start = annotation.sourceStart;
+ int end = annotation.declarationSourceEnd;
+ singleMemberAnnotation.setSourceRange(start, end - start + 1);
+ return singleMemberAnnotation;
+ }
+
+ public SimpleName convert(org.eclipse.jdt.internal.compiler.ast.SingleNameReference nameReference) {
+ SimpleName name = this.ast.newSimpleName(new String(nameReference.token));
+ if (this.resolveBindings) {
+ recordNodes(name, nameReference);
+ }
+ name.setSourceRange(nameReference.sourceStart, nameReference.sourceEnd - nameReference.sourceStart + 1);
+ return name;
+ }
+
public Statement convert(org.eclipse.jdt.internal.compiler.ast.Statement statement) {
+ if (statement instanceof ForeachStatement) {
+ return convert((ForeachStatement) statement);
+ }
if (statement instanceof org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) {
return convertToVariableDeclarationStatement((org.eclipse.jdt.internal.compiler.ast.LocalDeclaration)statement);
}
@@ -1854,18 +2286,48 @@ class ASTConverter {
if (statement instanceof org.eclipse.jdt.internal.compiler.ast.TryStatement) {
return convert((org.eclipse.jdt.internal.compiler.ast.TryStatement) statement);
}
- if (statement instanceof org.eclipse.jdt.internal.compiler.ast.TypeDeclaration
+ if (statement instanceof org.eclipse.jdt.internal.compiler.ast.AnnotationTypeDeclaration
&& (statement.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.IsLocalTypeMASK) != 0) {
- TypeDeclarationStatement typeDeclarationStatement = this.ast.newTypeDeclarationStatement(convert((org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) statement));
- TypeDeclaration typeDecl = typeDeclarationStatement.getTypeDeclaration();
- typeDeclarationStatement.setSourceRange(typeDecl.getStartPosition(), typeDecl.getLength());
- return typeDeclarationStatement;
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ return createFakeEmptyStatement(statement);
+ case AST.JLS3 :
+ TypeDeclarationStatement typeDeclarationStatement = this.ast.newTypeDeclarationStatement(convert((org.eclipse.jdt.internal.compiler.ast.AnnotationTypeDeclaration) statement));
+ TypeDeclaration typeDecl = typeDeclarationStatement.getTypeDeclaration();
+ typeDeclarationStatement.setSourceRange(typeDecl.getStartPosition(), typeDecl.getLength());
+ return typeDeclarationStatement;
+ }
}
+ if (statement instanceof org.eclipse.jdt.internal.compiler.ast.EnumDeclaration
+ && (statement.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.IsLocalTypeMASK) != 0) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ return createFakeEmptyStatement(statement);
+ case AST.JLS3 :
+ TypeDeclarationStatement typeDeclarationStatement = this.ast.newTypeDeclarationStatement(convert((org.eclipse.jdt.internal.compiler.ast.EnumDeclaration) statement));
+ TypeDeclaration typeDecl = typeDeclarationStatement.getTypeDeclaration();
+ typeDeclarationStatement.setSourceRange(typeDecl.getStartPosition(), typeDecl.getLength());
+ return typeDeclarationStatement;
+ }
+ }
if (statement instanceof org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) {
- TypeDeclarationStatement typeDeclarationStatement = this.ast.newTypeDeclarationStatement(convert((org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) statement));
- TypeDeclaration typeDecl = typeDeclarationStatement.getTypeDeclaration();
- typeDeclarationStatement.setSourceRange(typeDecl.getStartPosition(), typeDecl.getLength());
- return typeDeclarationStatement;
+ TypeDeclaration typeDeclaration = (TypeDeclaration) convert((org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) statement);
+ if (typeDeclaration == null) {
+ return createFakeEmptyStatement(statement);
+ } else {
+ TypeDeclarationStatement typeDeclarationStatement = this.ast.newTypeDeclarationStatement(typeDeclaration);
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ TypeDeclaration typeDecl = typeDeclarationStatement.getTypeDeclaration();
+ typeDeclarationStatement.setSourceRange(typeDecl.getStartPosition(), typeDecl.getLength());
+ break;
+ case AST.JLS3 :
+ AbstractTypeDeclaration typeDeclAST3 = typeDeclarationStatement.getDeclaration();
+ typeDeclarationStatement.setSourceRange(typeDeclAST3.getStartPosition(), typeDeclAST3.getLength());
+ break;
+ }
+ return typeDeclarationStatement;
+ }
}
if (statement instanceof org.eclipse.jdt.internal.compiler.ast.WhileStatement) {
return convert((org.eclipse.jdt.internal.compiler.ast.WhileStatement) statement);
@@ -1877,207 +2339,21 @@ class ASTConverter {
retrieveSemiColonPosition(stmt);
return stmt;
}
- throw new IllegalArgumentException("Not yet implemented: convert(" + statement.getClass() + ")");//$NON-NLS-1$//$NON-NLS-2$
- }
-
- public AssertStatement convert(org.eclipse.jdt.internal.compiler.ast.AssertStatement statement) {
- AssertStatement assertStatement = this.ast.newAssertStatement();
- int end = statement.assertExpression.sourceEnd + 1;
- assertStatement.setExpression(convert(statement.assertExpression));
- org.eclipse.jdt.internal.compiler.ast.Expression exceptionArgument = statement.exceptionArgument;
- if (exceptionArgument != null) {
- assertStatement.setMessage(convert(exceptionArgument));
- end = exceptionArgument.sourceEnd + 1;
- }
- int start = statement.sourceStart;
- int sourceEnd = retrieveEndingSemiColonPosition(end, this.compilationUnitSource.length);
- assertStatement.setSourceRange(start, sourceEnd - start + 1);
- return assertStatement;
- }
-
- public Block convert(org.eclipse.jdt.internal.compiler.ast.Block statement) {
- Block block = this.ast.newBlock();
- if (statement.sourceEnd > 0) {
- block.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
- }
- org.eclipse.jdt.internal.compiler.ast.Statement[] statements = statement.statements;
- if (statements != null) {
- int statementsLength = statements.length;
- for (int i = 0; i < statementsLength; i++) {
- if (statements[i] instanceof org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) {
- checkAndAddMultipleLocalDeclaration(statements, i, block.statements());
- } else {
- block.statements().add(convert(statements[i]));
- }
- }
- }
- return block;
- }
-
- public BreakStatement convert(org.eclipse.jdt.internal.compiler.ast.BreakStatement statement) {
- BreakStatement breakStatement = this.ast.newBreakStatement();
- breakStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
- if (statement.label != null) {
- SimpleName name = this.ast.newSimpleName(new String(statement.label));
- retrieveIdentifierAndSetPositions(statement.sourceStart, statement.sourceEnd, name);
- breakStatement.setLabel(name);
- }
- retrieveSemiColonPosition(breakStatement);
- return breakStatement;
+ return createFakeEmptyStatement(statement);
}
- public ContinueStatement convert(org.eclipse.jdt.internal.compiler.ast.ContinueStatement statement) {
- ContinueStatement continueStatement = this.ast.newContinueStatement();
- continueStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
- if (statement.label != null) {
- SimpleName name = this.ast.newSimpleName(new String(statement.label));
- retrieveIdentifierAndSetPositions(statement.sourceStart, statement.sourceEnd, name);
- continueStatement.setLabel(name);
- }
- retrieveSemiColonPosition(continueStatement);
- return continueStatement;
- }
-
-
- public SwitchCase convert(org.eclipse.jdt.internal.compiler.ast.CaseStatement statement) {
- SwitchCase switchCase = this.ast.newSwitchCase();
- org.eclipse.jdt.internal.compiler.ast.Expression constantExpression = statement.constantExpression;
- if (constantExpression == null) {
- switchCase.setExpression(null);
- } else {
- switchCase.setExpression(convert(constantExpression));
- }
- switchCase.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
- retrieveColonPosition(switchCase);
- return switchCase;
- }
-
- public DoStatement convert(org.eclipse.jdt.internal.compiler.ast.DoStatement statement) {
- DoStatement doStatement = this.ast.newDoStatement();
- doStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
- doStatement.setExpression(convert(statement.condition));
- doStatement.setBody(convert(statement.action));
- retrieveSemiColonPosition(doStatement);
- return doStatement;
- }
-
- public EmptyStatement convert(org.eclipse.jdt.internal.compiler.ast.EmptyStatement statement) {
- EmptyStatement emptyStatement = this.ast.newEmptyStatement();
- emptyStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
- return emptyStatement;
- }
-
- public Statement convert(org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall statement) {
- Statement newStatement;
- if (statement.isSuperAccess() || statement.isSuper()) {
- SuperConstructorInvocation superConstructorInvocation = this.ast.newSuperConstructorInvocation();
- if (statement.qualification != null) {
- superConstructorInvocation.setExpression(convert(statement.qualification));
- }
- org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = statement.arguments;
- if (arguments != null) {
- int length = arguments.length;
- for (int i = 0; i < length; i++) {
- superConstructorInvocation.arguments().add(convert(arguments[i]));
- }
- }
- newStatement = superConstructorInvocation;
- } else {
- ConstructorInvocation constructorInvocation = this.ast.newConstructorInvocation();
- org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = statement.arguments;
- if (arguments != null) {
- int length = arguments.length;
- for (int i = 0; i < length; i++) {
- constructorInvocation.arguments().add(convert(arguments[i]));
- }
- }
- newStatement = constructorInvocation;
- }
- newStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
- retrieveSemiColonPosition(newStatement);
+ public StringLiteral convert(org.eclipse.jdt.internal.compiler.ast.StringLiteral expression) {
+ int length = expression.sourceEnd - expression.sourceStart + 1;
+ int sourceStart = expression.sourceStart;
+ char[] tokens = new char[length];
+ System.arraycopy(this.compilationUnitSource, sourceStart, tokens, 0, length);
+ StringLiteral literal = this.ast.newStringLiteral();
if (this.resolveBindings) {
- recordNodes(newStatement, statement);
- }
- return newStatement;
- }
-
- public ForStatement convert(org.eclipse.jdt.internal.compiler.ast.ForStatement statement) {
- ForStatement forStatement = this.ast.newForStatement();
- forStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
- org.eclipse.jdt.internal.compiler.ast.Statement[] initializations = statement.initializations;
- if (initializations != null) {
- // we know that we have at least one initialization
- if (initializations[0] instanceof org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) {
- VariableDeclarationExpression variableDeclarationExpression = convertToVariableDeclarationExpression((org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) initializations[0]);
- int initializationsLength = initializations.length;
- for (int i = 1; i < initializationsLength; i++) {
- variableDeclarationExpression.fragments().add(convertToVariableDeclarationFragment((org.eclipse.jdt.internal.compiler.ast.LocalDeclaration)initializations[i]));
- }
- if (initializationsLength != 1) {
- int start = variableDeclarationExpression.getStartPosition();
- int end = ((org.eclipse.jdt.internal.compiler.ast.LocalDeclaration) initializations[initializationsLength - 1]).declarationSourceEnd;
- variableDeclarationExpression.setSourceRange(start, end - start + 1);
- }
- forStatement.initializers().add(variableDeclarationExpression);
- } else {
- int initializationsLength = initializations.length;
- for (int i = 0; i < initializationsLength; i++) {
- forStatement.initializers().add(convertToExpression(initializations[i]));
- }
- }
- }
- if (statement.condition != null) {
- forStatement.setExpression(convert(statement.condition));
- }
- org.eclipse.jdt.internal.compiler.ast.Statement[] increments = statement.increments;
- if (increments != null) {
- int incrementsLength = increments.length;
- for (int i = 0; i < incrementsLength; i++) {
- forStatement.updaters().add(convertToExpression(increments[i]));
- }
- }
- forStatement.setBody(convert(statement.action));
- return forStatement;
- }
-
- public Expression convertToExpression(org.eclipse.jdt.internal.compiler.ast.Statement statement) {
- if (statement instanceof org.eclipse.jdt.internal.compiler.ast.Expression) {
- return convert((org.eclipse.jdt.internal.compiler.ast.Expression) statement);
- }
- // unsupported
- throw new IllegalArgumentException("Not yet implemented: convert(" + statement.getClass() + ")");//$NON-NLS-1$//$NON-NLS-2$
- }
-
- public IfStatement convert(org.eclipse.jdt.internal.compiler.ast.IfStatement statement) {
- IfStatement ifStatement = this.ast.newIfStatement();
- ifStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
- ifStatement.setExpression(convert(statement.condition));
- ifStatement.setThenStatement(convert(statement.thenStatement));
- if (statement.elseStatement != null) {
- ifStatement.setElseStatement(convert(statement.elseStatement));
- }
- return ifStatement;
- }
-
- public LabeledStatement convert(org.eclipse.jdt.internal.compiler.ast.LabeledStatement statement) {
- LabeledStatement labeledStatement = this.ast.newLabeledStatement();
- labeledStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
- org.eclipse.jdt.internal.compiler.ast.Statement body = statement.statement;
- labeledStatement.setBody(convert(body));
- SimpleName name = this.ast.newSimpleName(new String(statement.label));
- retrieveIdentifierAndSetPositions(statement.sourceStart, statement.sourceEnd, name);
- labeledStatement.setLabel(name);
- return labeledStatement;
- }
-
- public ReturnStatement convert(org.eclipse.jdt.internal.compiler.ast.ReturnStatement statement) {
- ReturnStatement returnStatement = this.ast.newReturnStatement();
- returnStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
- if (statement.expression != null) {
- returnStatement.setExpression(convert(statement.expression));
+ this.recordNodes(literal, expression);
}
- retrieveSemiColonPosition(returnStatement);
- return returnStatement;
+ literal.setEscapedValue(new String(tokens));
+ literal.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
+ return literal;
}
public SwitchStatement convert(org.eclipse.jdt.internal.compiler.ast.SwitchStatement statement) {
@@ -2102,6 +2378,25 @@ class ASTConverter {
return synchronizedStatement;
}
+ public Expression convert(org.eclipse.jdt.internal.compiler.ast.ThisReference reference) {
+ if (reference.isImplicitThis()) {
+ // There is no source associated with an implicit this
+ return null;
+ } else if (reference instanceof org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference) reference);
+ } else if (reference instanceof org.eclipse.jdt.internal.compiler.ast.QualifiedThisReference) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.QualifiedThisReference) reference);
+ } else {
+ ThisExpression thisExpression = this.ast.newThisExpression();
+ thisExpression.setSourceRange(reference.sourceStart, reference.sourceEnd - reference.sourceStart + 1);
+ if (this.resolveBindings) {
+ recordNodes(thisExpression, reference);
+ recordPendingThisExpressionScopeResolution(thisExpression);
+ }
+ return thisExpression;
+ }
+ }
+
public ThrowStatement convert(org.eclipse.jdt.internal.compiler.ast.ThrowStatement statement) {
ThrowStatement throwStatement = this.ast.newThrowStatement();
throwStatement.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
@@ -2109,6 +2404,15 @@ class ASTConverter {
retrieveSemiColonPosition(throwStatement);
return throwStatement;
}
+
+ public BooleanLiteral convert(org.eclipse.jdt.internal.compiler.ast.TrueLiteral expression) {
+ BooleanLiteral literal = this.ast.newBooleanLiteral(true);
+ if (this.resolveBindings) {
+ this.recordNodes(literal, expression);
+ }
+ literal.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
+ return literal;
+ }
public TryStatement convert(org.eclipse.jdt.internal.compiler.ast.TryStatement statement) {
TryStatement tryStatement = this.ast.newTryStatement();
@@ -2135,6 +2439,161 @@ class ASTConverter {
}
return tryStatement;
}
+
+ public ASTNode convert(org.eclipse.jdt.internal.compiler.ast.TypeDeclaration typeDeclaration) {
+ if (typeDeclaration instanceof org.eclipse.jdt.internal.compiler.ast.AnnotationTypeDeclaration) {
+ if (this.ast.apiLevel == AST.JLS2) {
+ return null;
+ } else {
+ return convert((org.eclipse.jdt.internal.compiler.ast.AnnotationTypeDeclaration) typeDeclaration);
+ }
+ }
+ if (typeDeclaration instanceof EnumConstant) {
+ if (this.ast.apiLevel == AST.JLS2) {
+ return null;
+ } else {
+ return convert((EnumConstant) typeDeclaration);
+ }
+ }
+ if (typeDeclaration instanceof org.eclipse.jdt.internal.compiler.ast.EnumDeclaration) {
+ if (this.ast.apiLevel == AST.JLS2) {
+ return null;
+ } else {
+ return convert((org.eclipse.jdt.internal.compiler.ast.EnumDeclaration) typeDeclaration);
+ }
+ }
+ checkCanceled();
+ TypeDeclaration typeDecl = this.ast.newTypeDeclaration();
+ int modifiers = typeDeclaration.modifiers;
+ modifiers &= ~IConstants.AccInterface; // remove AccInterface flags
+ modifiers &= CompilerModifiers.AccJustFlag;
+ if (modifiers != 0) {
+ setModifiers(typeDecl, typeDeclaration);
+ }
+ typeDecl.setInterface(typeDeclaration.isInterface());
+ SimpleName typeName = this.ast.newSimpleName(new String(typeDeclaration.name));
+ typeName.setSourceRange(typeDeclaration.sourceStart, typeDeclaration.sourceEnd - typeDeclaration.sourceStart + 1);
+ typeDecl.setName(typeName);
+ typeDecl.setSourceRange(typeDeclaration.declarationSourceStart, typeDeclaration.bodyEnd - typeDeclaration.declarationSourceStart + 1);
+
+ // need to set the superclass and super interfaces here since we cannot distinguish them at
+ // the type references level.
+ if (typeDeclaration.superclass != null) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ typeDecl.setSuperclass(convert(typeDeclaration.superclass));
+ break;
+ case AST.JLS3 :
+ typeDecl.setSuperclassType(convertType(typeDeclaration.superclass));
+ break;
+ }
+ }
+
+ org.eclipse.jdt.internal.compiler.ast.TypeReference[] superInterfaces = typeDeclaration.superInterfaces;
+ if (superInterfaces != null) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ for (int index = 0, length = superInterfaces.length; index < length; index++) {
+ typeDecl.superInterfaces().add(convert(superInterfaces[index]));
+ }
+ break;
+ case AST.JLS3 :
+ for (int index = 0, length = superInterfaces.length; index < length; index++) {
+ typeDecl.superInterfaceTypes().add(convertType(superInterfaces[index]));
+ }
+ }
+ }
+ org.eclipse.jdt.internal.compiler.ast.TypeParameter[] typeParameters = typeDeclaration.typeParameters;
+ if (typeParameters != null) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ typeDecl.setFlags(typeDecl.getFlags() | ASTNode.MALFORMED);
+ break;
+ case AST.JLS3 :
+ for (int index = 0, length = typeParameters.length; index < length; index++) {
+ typeDecl.typeParameters().add(convert(typeParameters[index]));
+ }
+ }
+ }
+ buildBodyDeclarations(typeDeclaration, typeDecl);
+ if (this.resolveBindings) {
+ recordNodes(typeDecl, typeDeclaration);
+ recordNodes(typeName, typeDeclaration);
+ typeDecl.resolveBinding();
+ }
+ return typeDecl;
+ }
+
+ public TypeParameter convert(org.eclipse.jdt.internal.compiler.ast.TypeParameter typeParameter) {
+ TypeParameter typeParameter2 = this.ast.newTypeParameter();
+ SimpleName simpleName = this.ast.newSimpleName(new String(typeParameter.name));
+ int start = typeParameter.sourceStart;
+ int end = typeParameter.sourceEnd;
+ simpleName.setSourceRange(start, end - start + 1);
+ typeParameter2.setName(simpleName);
+ final TypeReference superType = typeParameter.type;
+ end = typeParameter.declarationSourceEnd;
+ if (superType != null) {
+ Type type = convertType(superType);
+ typeParameter2.typeBounds().add(type);
+ end = type.getStartPosition() + type.getLength() - 1;
+ }
+ TypeReference[] bounds = typeParameter.bounds;
+ if (bounds != null) {
+ Type type = null;
+ for (int index = 0, length = bounds.length; index < length; index++) {
+ type = convertType(bounds[index]);
+ typeParameter2.typeBounds().add(type);
+ end = type.getStartPosition() + type.getLength() - 1;
+ }
+ }
+ start = typeParameter.declarationSourceStart;
+ end = retrieveClosingAngleBracketPosition(end);
+ typeParameter2.setSourceRange(start, end - start + 1);
+ return typeParameter2;
+ }
+
+ public Name convert(org.eclipse.jdt.internal.compiler.ast.TypeReference typeReference) {
+ char[][] typeName = typeReference.getTypeName();
+ int length = typeName.length;
+ Name name = null;
+ if (length > 1) {
+ // QualifiedName
+ org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference qualifiedTypeReference = (org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference) typeReference;
+ long[] positions = qualifiedTypeReference.sourcePositions;
+ name = setQualifiedNameNameAndSourceRanges(typeName, positions, typeReference);
+ } else {
+ name = this.ast.newSimpleName(new String(typeName[0]));
+ name.setSourceRange(typeReference.sourceStart, typeReference.sourceEnd - typeReference.sourceStart + 1);
+ }
+ if (this.resolveBindings) {
+ recordNodes(name, typeReference);
+ }
+ return name;
+ }
+
+ public PrefixExpression convert(org.eclipse.jdt.internal.compiler.ast.UnaryExpression expression) {
+ PrefixExpression prefixExpression = this.ast.newPrefixExpression();
+ if (this.resolveBindings) {
+ this.recordNodes(prefixExpression, expression);
+ }
+ prefixExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
+ prefixExpression.setOperand(convert(expression.expression));
+ switch ((expression.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.OperatorMASK) >> org.eclipse.jdt.internal.compiler.ast.ASTNode.OperatorSHIFT) {
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.PLUS :
+ prefixExpression.setOperator(PrefixExpression.Operator.PLUS);
+ break;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.MINUS :
+ prefixExpression.setOperator(PrefixExpression.Operator.MINUS);
+ break;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.NOT :
+ prefixExpression.setOperator(PrefixExpression.Operator.NOT);
+ break;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.TWIDDLE :
+ prefixExpression.setOperator(PrefixExpression.Operator.COMPLEMENT);
+ }
+ return prefixExpression;
+ }
public WhileStatement convert(org.eclipse.jdt.internal.compiler.ast.WhileStatement statement) {
WhileStatement whileStatement = this.ast.newWhileStatement();
@@ -2145,18 +2604,536 @@ class ASTConverter {
return whileStatement;
}
- private boolean isPrimitiveType(char[] name) {
+ public ImportDeclaration convertImport(org.eclipse.jdt.internal.compiler.ast.ImportReference importReference) {
+ ImportDeclaration importDeclaration = this.ast.newImportDeclaration();
+ boolean onDemand = importReference.onDemand;
+ char[][] tokens = importReference.tokens;
+ int length = importReference.tokens.length;
+ long[] positions = importReference.sourcePositions;
+ Name name = null;
+ if (length > 1) {
+ name = setQualifiedNameNameAndSourceRanges(tokens, positions, importReference);
+ } else {
+ name = this.ast.newSimpleName(new String(tokens[0]));
+ int start = (int)(positions[0]>>>32);
+ int end = (int)(positions[0] & 0xFFFFFFFF);
+ name.setSourceRange(start, end - start + 1);
+ }
+ importDeclaration.setSourceRange(importReference.declarationSourceStart, importReference.declarationEnd - importReference.declarationSourceStart + 1);
+ importDeclaration.setName(name);
+ importDeclaration.setOnDemand(onDemand);
+ int modifiers = importReference.modifiers;
+ if (modifiers != IConstants.AccDefault) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ importDeclaration.setFlags(importDeclaration.getFlags() | ASTNode.MALFORMED);
+ break;
+ case AST.JLS3 :
+ if (modifiers == IConstants.AccStatic) {
+ importDeclaration.setStatic(true);
+ } else {
+ importDeclaration.setFlags(importDeclaration.getFlags() | ASTNode.MALFORMED);
+ }
+ }
+ }
+ if (this.resolveBindings) {
+ recordNodes(importDeclaration, importReference);
+ }
+ return importDeclaration;
+ }
+
+ public PackageDeclaration convertPackage(org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration compilationUnitDeclaration) {
+ org.eclipse.jdt.internal.compiler.ast.ImportReference importReference = compilationUnitDeclaration.currentPackage;
+ PackageDeclaration packageDeclaration = this.ast.newPackageDeclaration();
+ char[][] tokens = importReference.tokens;
+ int length = importReference.tokens.length;
+ long[] positions = importReference.sourcePositions;
+ int start = (int)(positions[0]>>>32);
+ int end = (int)(positions[length - 1] & 0xFFFFFFFF);
+ Name name = null;
+ if (length > 1) {
+ name = setQualifiedNameNameAndSourceRanges(tokens, positions, importReference);
+ } else {
+ name = this.ast.newSimpleName(new String(tokens[0]));
+ name.setSourceRange(start, end - start + 1);
+ }
+ packageDeclaration.setSourceRange(importReference.declarationSourceStart, importReference.declarationEnd - importReference.declarationSourceStart + 1);
+ packageDeclaration.setName(name);
+ org.eclipse.jdt.internal.compiler.ast.Annotation[] annotations = importReference.annotations;
+ if (annotations != null) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ packageDeclaration.setFlags(packageDeclaration.getFlags() & ASTNode.MALFORMED);
+ break;
+ case AST.JLS3 :
+ for (int i = 0, max = annotations.length; i < max; i++) {
+ packageDeclaration.annotations().add(convert(annotations[i]));
+ }
+ }
+ }
+ if (this.resolveBindings) {
+ recordNodes(packageDeclaration, importReference);
+ recordNodes(name, compilationUnitDeclaration);
+ }
+ return packageDeclaration;
+ }
+
+ public Expression convertToExpression(org.eclipse.jdt.internal.compiler.ast.Statement statement) {
+ if (statement instanceof org.eclipse.jdt.internal.compiler.ast.Expression) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.Expression) statement);
+ } else {
+ return null;
+ }
+ }
+
+ protected FieldDeclaration convertToFieldDeclaration(org.eclipse.jdt.internal.compiler.ast.FieldDeclaration fieldDecl) {
+ VariableDeclarationFragment variableDeclarationFragment = convertToVariableDeclarationFragment(fieldDecl);
+ FieldDeclaration fieldDeclaration = this.ast.newFieldDeclaration(variableDeclarationFragment);
+ if (this.resolveBindings) {
+ recordNodes(variableDeclarationFragment, fieldDecl);
+ variableDeclarationFragment.resolveBinding();
+ }
+ fieldDeclaration.setSourceRange(fieldDecl.declarationSourceStart, fieldDecl.declarationEnd - fieldDecl.declarationSourceStart + 1);
+ Type type = convertType(fieldDecl.type);
+ setTypeForField(fieldDeclaration, type, variableDeclarationFragment.getExtraDimensions());
+ if ((fieldDecl.modifiers & org.eclipse.jdt.internal.compiler.lookup.CompilerModifiers.AccJustFlag) != 0) {
+ setModifiers(fieldDeclaration, fieldDecl);
+ }
+ convert(fieldDecl.javadoc, fieldDeclaration);
+ return fieldDeclaration;
+ }
+
+ public ParenthesizedExpression convertToParenthesizedExpression(org.eclipse.jdt.internal.compiler.ast.Expression expression) {
+ ParenthesizedExpression parenthesizedExpression = this.ast.newParenthesizedExpression();
+ if (this.resolveBindings) {
+ recordNodes(parenthesizedExpression, expression);
+ }
+ parenthesizedExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
+ adjustSourcePositionsForParent(expression);
+ trimWhiteSpacesAndComments(expression);
+ // decrement the number of parenthesis
+ int numberOfParenthesis = (expression.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.ParenthesizedMASK) >> org.eclipse.jdt.internal.compiler.ast.ASTNode.ParenthesizedSHIFT;
+ expression.bits &= ~org.eclipse.jdt.internal.compiler.ast.ASTNode.ParenthesizedMASK;
+ expression.bits |= (numberOfParenthesis - 1) << org.eclipse.jdt.internal.compiler.ast.ASTNode.ParenthesizedSHIFT;
+ parenthesizedExpression.setExpression(convert(expression));
+ return parenthesizedExpression;
+ }
+
+ public Type convertToType(org.eclipse.jdt.internal.compiler.ast.NameReference reference) {
+ Name name = convert(reference);
+ SimpleType type = this.ast.newSimpleType(name);
+ type.setSourceRange(name.getStartPosition(), name.getLength());
+ if (this.resolveBindings) {
+ this.recordNodes(type, reference);
+ }
+ return type;
+ }
+
+ protected VariableDeclarationExpression convertToVariableDeclarationExpression(org.eclipse.jdt.internal.compiler.ast.LocalDeclaration localDeclaration) {
+ VariableDeclarationFragment variableDeclarationFragment = convertToVariableDeclarationFragment(localDeclaration);
+ VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
+ if (this.resolveBindings) {
+ recordNodes(variableDeclarationFragment, localDeclaration);
+ }
+ variableDeclarationExpression.setSourceRange(localDeclaration.declarationSourceStart, localDeclaration.declarationSourceEnd - localDeclaration.declarationSourceStart + 1);
+ Type type = convertType(localDeclaration.type);
+ setTypeForVariableDeclarationExpression(variableDeclarationExpression, type, variableDeclarationFragment.getExtraDimensions());
+ if ((localDeclaration.modifiers & ~CompilerModifiers.AccBlankFinal) != 0) {
+ setModifiers(variableDeclarationExpression, localDeclaration);
+ }
+ return variableDeclarationExpression;
+ }
+
+ protected SingleVariableDeclaration convertToSingleVariableDeclaration(LocalDeclaration localDeclaration) {
+ SingleVariableDeclaration variableDecl = this.ast.newSingleVariableDeclaration();
+ if ((localDeclaration.modifiers & CompilerModifiers.AccJustFlag) != 0) {
+ setModifiers(variableDecl, localDeclaration);
+ }
+ SimpleName name = this.ast.newSimpleName(new String(localDeclaration.name));
+ int start = localDeclaration.sourceStart;
+ int nameEnd = localDeclaration.sourceEnd;
+ name.setSourceRange(start, nameEnd - start + 1);
+ variableDecl.setName(name);
+ final int extraDimensions = retrieveExtraDimension(nameEnd + 1, localDeclaration.type.sourceEnd);
+ variableDecl.setExtraDimensions(extraDimensions);
+ Type type = convertType(localDeclaration.type);
+ int typeEnd = type.getStartPosition() + type.getLength() - 1;
+ int rightEnd = Math.max(typeEnd, localDeclaration.declarationSourceEnd);
+ /*
+ * There is extra work to do to set the proper type positions
+ * See PR http://bugs.eclipse.org/bugs/show_bug.cgi?id=23284
+ */
+ setTypeForSingleVariableDeclaration(variableDecl, type, extraDimensions);
+ variableDecl.setSourceRange(localDeclaration.declarationSourceStart, rightEnd - localDeclaration.declarationSourceStart + 1);
+ if (this.resolveBindings) {
+ recordNodes(name, localDeclaration);
+ recordNodes(variableDecl, localDeclaration);
+ variableDecl.resolveBinding();
+ }
+ return variableDecl;
+ }
+
+ protected VariableDeclarationFragment convertToVariableDeclarationFragment(org.eclipse.jdt.internal.compiler.ast.FieldDeclaration fieldDeclaration) {
+ VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
+ SimpleName name = this.ast.newSimpleName(new String(fieldDeclaration.name));
+ name.setSourceRange(fieldDeclaration.sourceStart, fieldDeclaration.sourceEnd - fieldDeclaration.sourceStart + 1);
+ variableDeclarationFragment.setName(name);
+ int end = retrievePositionBeforeNextCommaOrSemiColon(fieldDeclaration.sourceEnd, fieldDeclaration.declarationSourceEnd);
+ if (end == -1) {
+ variableDeclarationFragment.setSourceRange(fieldDeclaration.sourceStart, fieldDeclaration.declarationSourceEnd - fieldDeclaration.sourceStart + 1);
+ variableDeclarationFragment.setFlags(variableDeclarationFragment.getFlags() | ASTNode.MALFORMED);
+ } else {
+ variableDeclarationFragment.setSourceRange(fieldDeclaration.sourceStart, end - fieldDeclaration.sourceStart + 1);
+ }
+ if (fieldDeclaration.initialization != null) {
+ variableDeclarationFragment.setInitializer(convert(fieldDeclaration.initialization));
+ }
+ variableDeclarationFragment.setExtraDimensions(retrieveExtraDimension(fieldDeclaration.sourceEnd + 1, fieldDeclaration.declarationSourceEnd ));
+ if (this.resolveBindings) {
+ recordNodes(name, fieldDeclaration);
+ recordNodes(variableDeclarationFragment, fieldDeclaration);
+ variableDeclarationFragment.resolveBinding();
+ }
+ return variableDeclarationFragment;
+ }
+
+ protected VariableDeclarationFragment convertToVariableDeclarationFragment(org.eclipse.jdt.internal.compiler.ast.LocalDeclaration localDeclaration) {
+ VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
+ SimpleName name = this.ast.newSimpleName(new String(localDeclaration.name));
+ name.setSourceRange(localDeclaration.sourceStart, localDeclaration.sourceEnd - localDeclaration.sourceStart + 1);
+ variableDeclarationFragment.setName(name);
+ int end = retrievePositionBeforeNextCommaOrSemiColon(localDeclaration.sourceEnd, this.compilationUnitSource.length);
+ if (end == -1) {
+ if (localDeclaration.initialization != null) {
+ variableDeclarationFragment.setSourceRange(localDeclaration.sourceStart, localDeclaration.initialization.sourceEnd - localDeclaration.sourceStart + 1);
+ } else {
+ variableDeclarationFragment.setSourceRange(localDeclaration.sourceStart, localDeclaration.sourceEnd - localDeclaration.sourceStart + 1);
+ }
+ } else {
+ variableDeclarationFragment.setSourceRange(localDeclaration.sourceStart, end - localDeclaration.sourceStart + 1);
+ }
+ if (localDeclaration.initialization != null) {
+ variableDeclarationFragment.setInitializer(convert(localDeclaration.initialization));
+ }
+ variableDeclarationFragment.setExtraDimensions(retrieveExtraDimension(localDeclaration.sourceEnd + 1, this.compilationUnitSource.length));
+ if (this.resolveBindings) {
+ recordNodes(variableDeclarationFragment, localDeclaration);
+ recordNodes(name, localDeclaration);
+ variableDeclarationFragment.resolveBinding();
+ }
+ return variableDeclarationFragment;
+ }
+
+ protected VariableDeclarationStatement convertToVariableDeclarationStatement(org.eclipse.jdt.internal.compiler.ast.LocalDeclaration localDeclaration) {
+ VariableDeclarationFragment variableDeclarationFragment = convertToVariableDeclarationFragment(localDeclaration);
+ VariableDeclarationStatement variableDeclarationStatement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
+ if (this.resolveBindings) {
+ recordNodes(variableDeclarationFragment, localDeclaration);
+ }
+ variableDeclarationStatement.setSourceRange(localDeclaration.declarationSourceStart, localDeclaration.declarationSourceEnd - localDeclaration.declarationSourceStart + 1);
+ Type type = convertType(localDeclaration.type);
+ setTypeForVariableDeclarationStatement(variableDeclarationStatement, type, variableDeclarationFragment.getExtraDimensions());
+ if ((localDeclaration.modifiers & ~CompilerModifiers.AccBlankFinal) != 0) {
+ setModifiers(variableDeclarationStatement, localDeclaration);
+ }
+ return variableDeclarationStatement;
+ }
+
+ public Type convertType(TypeReference typeReference) {
+ if (typeReference instanceof Wildcard) {
+ Wildcard wildcard = (Wildcard) typeReference;
+ WildcardType wildcardType = this.ast.newWildcardType();
+ if (wildcard.bound != null) {
+ wildcardType.setBound(convertType(wildcard.bound), wildcard.kind == Wildcard.EXTENDS);
+ }
+ int start = wildcard.sourceStart;
+ int end = wildcard.sourceEnd;
+ wildcardType.setSourceRange(start, end - start + 1);
+ return wildcardType;
+ }
+ Type type = null;
+ int sourceStart = -1;
+ int length = 0;
+ int dimensions = typeReference.dimensions();
+ if (typeReference instanceof org.eclipse.jdt.internal.compiler.ast.SingleTypeReference) {
+ // this is either an ArrayTypeReference or a SingleTypeReference
+ char[] name = ((org.eclipse.jdt.internal.compiler.ast.SingleTypeReference) typeReference).getTypeName()[0];
+ sourceStart = typeReference.sourceStart;
+ length = typeReference.sourceEnd - typeReference.sourceStart + 1;
+ // need to find out if this is an array type of primitive types or not
+ if (isPrimitiveType(name)) {
+ int end = retrieveEndOfElementTypeNamePosition(sourceStart, sourceStart + length);
+ if (end == -1) {
+ end = sourceStart + length - 1;
+ }
+ type = this.ast.newPrimitiveType(getPrimitiveTypeCode(name));
+ type.setSourceRange(sourceStart, end - sourceStart + 1);
+ } else if (typeReference instanceof ParameterizedSingleTypeReference) {
+ ParameterizedSingleTypeReference parameterizedSingleTypeReference = (ParameterizedSingleTypeReference) typeReference;
+ SimpleName simpleName = this.ast.newSimpleName(new String(name));
+ int end = retrieveEndOfElementTypeNamePosition(sourceStart, sourceStart + length);
+ if (end == -1) {
+ end = sourceStart + length - 1;
+ }
+ simpleName.setSourceRange(sourceStart, end - sourceStart + 1);
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ type = this.ast.newSimpleType(simpleName);
+ type.setFlags(type.getFlags() | ASTNode.MALFORMED);
+ type.setSourceRange(sourceStart, end - sourceStart + 1);
+ if (this.resolveBindings) {
+ this.recordNodes(simpleName, typeReference);
+ }
+ break;
+ case AST.JLS3 :
+ SimpleType simpleType = this.ast.newSimpleType(simpleName);
+ simpleType.setSourceRange(simpleName.getStartPosition(), simpleName.getLength());
+ type = this.ast.newParameterizedType(simpleType);
+ TypeReference[] typeArguments = parameterizedSingleTypeReference.typeArguments;
+ if (typeArguments != null) {
+ Type type2 = null;
+ for (int i = 0, max = typeArguments.length; i < max; i++) {
+ type2 = convertType(typeArguments[i]);
+ ((ParameterizedType) type).typeArguments().add(type2);
+ end = type2.getStartPosition() + type2.getLength() - 1;
+ }
+ end = retrieveClosingAngleBracketPosition(end + 1);
+ type.setSourceRange(sourceStart, end - sourceStart + 1);
+ } else {
+ type.setSourceRange(sourceStart, end - sourceStart + 1);
+ }
+ if (this.resolveBindings) {
+ this.recordNodes(simpleName, typeReference);
+ }
+ }
+ } else {
+ SimpleName simpleName = this.ast.newSimpleName(new String(name));
+ // we need to search for the starting position of the first brace in order to set the proper length
+ // PR http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
+ int end = retrieveEndOfElementTypeNamePosition(sourceStart, sourceStart + length);
+ if (end == -1) {
+ end = sourceStart + length - 1;
+ }
+ simpleName.setSourceRange(sourceStart, end - sourceStart + 1);
+ type = this.ast.newSimpleType(simpleName);
+ type.setSourceRange(sourceStart, end - sourceStart + 1);
+ if (this.resolveBindings) {
+ this.recordNodes(simpleName, typeReference);
+ }
+ }
+ if (dimensions != 0) {
+ type = this.ast.newArrayType(type, dimensions);
+ type.setSourceRange(sourceStart, length);
+ if (this.resolveBindings) {
+ // store keys for inner types
+ completeRecord((ArrayType) type, typeReference);
+ }
+ }
+ } else {
+ if (typeReference instanceof ParameterizedQualifiedTypeReference) {
+ ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference = (ParameterizedQualifiedTypeReference) typeReference;
+ char[][] tokens = parameterizedQualifiedTypeReference.tokens;
+ TypeReference[][] typeArguments = parameterizedQualifiedTypeReference.typeArguments;
+ long[] positions = parameterizedQualifiedTypeReference.sourcePositions;
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 : {
+ char[][] name = ((org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference) typeReference).getTypeName();
+ int nameLength = name.length;
+ sourceStart = (int)(positions[0]>>>32);
+ length = (int)(positions[nameLength - 1] & 0xFFFFFFFF) - sourceStart + 1;
+ Name qualifiedName = this.setQualifiedNameNameAndSourceRanges(name, positions, typeReference);
+ type = this.ast.newSimpleType(qualifiedName);
+ type.setSourceRange(sourceStart, length);
+ }
+ break;
+ case AST.JLS3 :
+ if (typeArguments != null) {
+ int startingIndex = 0;
+ int endingIndex = 0;
+ while (typeArguments[endingIndex] == null) {
+ endingIndex++;
+ }
+ Name name = null;
+ if (endingIndex - startingIndex == 0) {
+ name = this.ast.newSimpleName(new String(tokens[startingIndex]));
+ int start = (int)(positions[startingIndex]>>>32);
+ int end = (int) positions[startingIndex];
+ name.setSourceRange(start, end - start + 1);
+ } else {
+ name = this.setQualifiedNameNameAndSourceRanges(tokens, positions, startingIndex, endingIndex, typeReference);
+ }
+ SimpleType simpleType = this.ast.newSimpleType(name);
+ int start = (int)(positions[startingIndex]>>>32);
+ int end = (int) positions[endingIndex];
+ simpleType.setSourceRange(start, end - start + 1);
+ ParameterizedType parameterizedType = this.ast.newParameterizedType(simpleType);
+ start = simpleType.getStartPosition();
+ end = start + simpleType.getLength() - 1;
+ for (int i = 0, max = typeArguments[endingIndex].length; i < max; i++) {
+ final Type type2 = convertType(typeArguments[endingIndex][i]);
+ parameterizedType.typeArguments().add(type2);
+ end = type2.getStartPosition() + type2.getLength() - 1;
+ }
+ end = retrieveClosingAngleBracketPosition(end + 1);
+ parameterizedType.setSourceRange(start, end - start + 1);
+ startingIndex = endingIndex + 1;
+ Type currentType = parameterizedType;
+ while(startingIndex < typeArguments.length) {
+ SimpleName simpleName = this.ast.newSimpleName(new String(tokens[startingIndex]));
+ start = (int)(positions[startingIndex]>>>32);
+ end = (int) positions[startingIndex];
+ simpleName.setSourceRange(start, end - start + 1);
+ QualifiedType qualifiedType = this.ast.newQualifiedType(currentType, simpleName);
+ start = currentType.getStartPosition();
+ end = simpleName.getStartPosition() + simpleName.getLength() - 1;
+ qualifiedType.setSourceRange(start, end - start + 1);
+ if (typeArguments[startingIndex] != null) {
+ ParameterizedType parameterizedType2 = this.ast.newParameterizedType(qualifiedType);
+ for (int i = 0, max = typeArguments[startingIndex].length; i < max; i++) {
+ final Type type2 = convertType(typeArguments[startingIndex][i]);
+ parameterizedType2.typeArguments().add(type2);
+ end = type2.getStartPosition() + type2.getLength() - 1;
+ }
+ end = retrieveClosingAngleBracketPosition(end + 1);
+ parameterizedType2.setSourceRange(start, end - start + 1);
+ currentType = parameterizedType2;
+ } else {
+ currentType = qualifiedType;
+ }
+ startingIndex++;
+ }
+ return currentType;
+ }
+ }
+ } else {
+ char[][] name = ((org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference) typeReference).getTypeName();
+ int nameLength = name.length;
+ long[] positions = ((org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference) typeReference).sourcePositions;
+ sourceStart = (int)(positions[0]>>>32);
+ length = (int)(positions[nameLength - 1] & 0xFFFFFFFF) - sourceStart + 1;
+ Name qualifiedName = this.setQualifiedNameNameAndSourceRanges(name, positions, typeReference);
+ type = this.ast.newSimpleType(qualifiedName);
+ type.setSourceRange(sourceStart, length);
+ }
+
+ if (dimensions != 0) {
+ type = this.ast.newArrayType(type, dimensions);
+ if (this.resolveBindings) {
+ completeRecord((ArrayType) type, typeReference);
+ }
+ int end = retrieveEndOfDimensionsPosition(sourceStart+length, this.compilationUnitSource.length);
+ if (end != -1) {
+ type.setSourceRange(sourceStart, end - sourceStart + 1);
+ } else {
+ type.setSourceRange(sourceStart, length);
+ }
+ }
+ }
+ if (this.resolveBindings) {
+ this.recordNodes(type, typeReference);
+ }
+ return type;
+ }
+
+ protected Comment createComment(int[] positions) {
+ // Create comment node
+ Comment comment = null;
+ int start = positions[0];
+ int end = positions[1];
+ if (positions[1]>0) { // Javadoc comments have positive end position
+ this.ast.newJavadoc();
+ Javadoc docComment = this.docParser.parse(positions);
+ if (docComment == null) return null;
+ comment = docComment;
+ } else {
+ end = -end;
+ if (positions[0]>0) { // Block comment have positive start position
+ comment = this.ast.newBlockComment();
+ } else { // Line comment have negative start and end position
+ start = -start;
+ comment = this.ast.newLineComment();
+ }
+ comment.setSourceRange(start, end - start);
+ }
+ return comment;
+ }
+
+ protected Statement createFakeEmptyStatement(org.eclipse.jdt.internal.compiler.ast.Statement statement) {
+ EmptyStatement emptyStatement = this.ast.newEmptyStatement();
+ emptyStatement.setFlags(emptyStatement.getFlags() | ASTNode.MALFORMED);
+ int start = statement.sourceStart;
+ int end = statement.sourceEnd;
+ emptyStatement.setSourceRange(start, end - start + 1);
+ return emptyStatement;
+ }
+ /**
+ * @return a new modifier
+ */
+ private Modifier createModifier(ModifierKeyword keyword) {
+ Modifier modifier;
+ modifier = this.ast.newModifier(keyword);
+ int start = this.scanner.getCurrentTokenStartPosition();
+ int end = this.scanner.getCurrentTokenEndPosition();
+ modifier.setSourceRange(start, end - start + 1);
+ return modifier;
+ }
+
+ protected InfixExpression.Operator getOperatorFor(int operatorID) {
+ switch (operatorID) {
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.EQUAL_EQUAL :
+ return InfixExpression.Operator.EQUALS;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.LESS_EQUAL :
+ return InfixExpression.Operator.LESS_EQUALS;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.GREATER_EQUAL :
+ return InfixExpression.Operator.GREATER_EQUALS;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.NOT_EQUAL :
+ return InfixExpression.Operator.NOT_EQUALS;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.LEFT_SHIFT :
+ return InfixExpression.Operator.LEFT_SHIFT;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.RIGHT_SHIFT :
+ return InfixExpression.Operator.RIGHT_SHIFT_SIGNED;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.UNSIGNED_RIGHT_SHIFT :
+ return InfixExpression.Operator.RIGHT_SHIFT_UNSIGNED;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.OR_OR :
+ return InfixExpression.Operator.CONDITIONAL_OR;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.AND_AND :
+ return InfixExpression.Operator.CONDITIONAL_AND;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.PLUS :
+ return InfixExpression.Operator.PLUS;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.MINUS :
+ return InfixExpression.Operator.MINUS;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.REMAINDER :
+ return InfixExpression.Operator.REMAINDER;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.XOR :
+ return InfixExpression.Operator.XOR;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.AND :
+ return InfixExpression.Operator.AND;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.MULTIPLY :
+ return InfixExpression.Operator.TIMES;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.OR :
+ return InfixExpression.Operator.OR;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.DIVIDE :
+ return InfixExpression.Operator.DIVIDE;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.GREATER :
+ return InfixExpression.Operator.GREATER;
+ case org.eclipse.jdt.internal.compiler.ast.OperatorIds.LESS :
+ return InfixExpression.Operator.LESS;
+ }
+ return null;
+ }
+
+ protected PrimitiveType.Code getPrimitiveTypeCode(char[] name) {
switch(name[0]) {
case 'i' :
if (name.length == 3 && name[1] == 'n' && name[2] == 't') {
- return true;
+ return PrimitiveType.INT;
}
- return false;
+ break;
case 'l' :
if (name.length == 4 && name[1] == 'o' && name[2] == 'n' && name[3] == 'g') {
- return true;
+ return PrimitiveType.LONG;
}
- return false;
+ break;
case 'd' :
if (name.length == 6
&& name[1] == 'o'
@@ -2164,24 +3141,24 @@ class ASTConverter {
&& name[3] == 'b'
&& name[4] == 'l'
&& name[5] == 'e') {
- return true;
+ return PrimitiveType.DOUBLE;
}
- return false;
+ break;
case 'f' :
if (name.length == 5
&& name[1] == 'l'
&& name[2] == 'o'
&& name[3] == 'a'
&& name[4] == 't') {
- return true;
+ return PrimitiveType.FLOAT;
}
- return false;
+ break;
case 'b' :
if (name.length == 4
&& name[1] == 'y'
&& name[2] == 't'
&& name[3] == 'e') {
- return true;
+ return PrimitiveType.BYTE;
} else
if (name.length == 7
&& name[1] == 'o'
@@ -2190,50 +3167,49 @@ class ASTConverter {
&& name[4] == 'e'
&& name[5] == 'a'
&& name[6] == 'n') {
- return true;
+ return PrimitiveType.BOOLEAN;
}
- return false;
+ break;
case 'c' :
if (name.length == 4
&& name[1] == 'h'
&& name[2] == 'a'
&& name[3] == 'r') {
- return true;
+ return PrimitiveType.CHAR;
}
- return false;
+ break;
case 's' :
if (name.length == 5
&& name[1] == 'h'
&& name[2] == 'o'
&& name[3] == 'r'
&& name[4] == 't') {
- return true;
+ return PrimitiveType.SHORT;
}
- return false;
+ break;
case 'v' :
if (name.length == 4
&& name[1] == 'o'
&& name[2] == 'i'
&& name[3] == 'd') {
- return true;
+ return PrimitiveType.VOID;
}
- return false;
}
- return false;
+ return null; // cannot be reached
}
- private PrimitiveType.Code getPrimitiveTypeCode(char[] name) {
+ protected boolean isPrimitiveType(char[] name) {
switch(name[0]) {
case 'i' :
if (name.length == 3 && name[1] == 'n' && name[2] == 't') {
- return PrimitiveType.INT;
+ return true;
}
- break;
+ return false;
case 'l' :
if (name.length == 4 && name[1] == 'o' && name[2] == 'n' && name[3] == 'g') {
- return PrimitiveType.LONG;
+ return true;
}
- break;
+ return false;
case 'd' :
if (name.length == 6
&& name[1] == 'o'
@@ -2241,24 +3217,24 @@ class ASTConverter {
&& name[3] == 'b'
&& name[4] == 'l'
&& name[5] == 'e') {
- return PrimitiveType.DOUBLE;
+ return true;
}
- break;
+ return false;
case 'f' :
if (name.length == 5
&& name[1] == 'l'
&& name[2] == 'o'
&& name[3] == 'a'
&& name[4] == 't') {
- return PrimitiveType.FLOAT;
+ return true;
}
- break;
+ return false;
case 'b' :
if (name.length == 4
&& name[1] == 'y'
&& name[2] == 't'
&& name[3] == 'e') {
- return PrimitiveType.BYTE;
+ return true;
} else
if (name.length == 7
&& name[1] == 'o'
@@ -2267,80 +3243,375 @@ class ASTConverter {
&& name[4] == 'e'
&& name[5] == 'a'
&& name[6] == 'n') {
- return PrimitiveType.BOOLEAN;
+ return true;
}
- break;
+ return false;
case 'c' :
if (name.length == 4
&& name[1] == 'h'
&& name[2] == 'a'
&& name[3] == 'r') {
- return PrimitiveType.CHAR;
+ return true;
}
- break;
+ return false;
case 's' :
if (name.length == 5
&& name[1] == 'h'
&& name[2] == 'o'
&& name[3] == 'r'
&& name[4] == 't') {
- return PrimitiveType.SHORT;
+ return true;
}
- break;
+ return false;
case 'v' :
if (name.length == 4
&& name[1] == 'o'
&& name[2] == 'i'
&& name[3] == 'd') {
- return PrimitiveType.VOID;
+ return true;
}
+ return false;
}
- throw new IllegalArgumentException("Not a primitive type");//$NON-NLS-1$
+ return false;
}
- /*
- * This method is used to set the right end position for expression
- * statement. The actual AST nodes don't include the trailing semicolon.
- * This method fixes the length of the corresponding node.
+ private void lookupForScopes() {
+ if (this.pendingNameScopeResolution != null) {
+ for (Iterator iterator = this.pendingNameScopeResolution.iterator(); iterator.hasNext(); ) {
+ Name name = (Name) iterator.next();
+ this.ast.getBindingResolver().recordScope(name, lookupScope(name));
+ }
+ }
+ if (this.pendingThisExpressionScopeResolution != null) {
+ for (Iterator iterator = this.pendingThisExpressionScopeResolution.iterator(); iterator.hasNext(); ) {
+ ThisExpression thisExpression = (ThisExpression) iterator.next();
+ this.ast.getBindingResolver().recordScope(thisExpression, lookupScope(thisExpression));
+ }
+ }
+
+ }
+
+ private BlockScope lookupScope(ASTNode node) {
+ ASTNode currentNode = node;
+ while(currentNode != null
+ &&!(currentNode instanceof MethodDeclaration)
+ && !(currentNode instanceof Initializer)
+ && !(currentNode instanceof FieldDeclaration)) {
+ currentNode = currentNode.getParent();
+ }
+ if (currentNode == null) {
+ return null;
+ }
+ if (currentNode instanceof Initializer) {
+ Initializer initializer = (Initializer) currentNode;
+ while(!(currentNode instanceof TypeDeclaration)) {
+ currentNode = currentNode.getParent();
+ }
+ org.eclipse.jdt.internal.compiler.ast.TypeDeclaration typeDecl = (org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) this.ast.getBindingResolver().getCorrespondingNode(currentNode);
+ if ((initializer.getModifiers() & Modifier.STATIC) != 0) {
+ return typeDecl.staticInitializerScope;
+ } else {
+ return typeDecl.initializerScope;
+ }
+ } else if (currentNode instanceof FieldDeclaration) {
+ FieldDeclaration fieldDeclaration = (FieldDeclaration) currentNode;
+ while(!(currentNode instanceof TypeDeclaration)) {
+ currentNode = currentNode.getParent();
+ }
+ org.eclipse.jdt.internal.compiler.ast.TypeDeclaration typeDecl = (org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) this.ast.getBindingResolver().getCorrespondingNode(currentNode);
+ if ((fieldDeclaration.getModifiers() & Modifier.STATIC) != 0) {
+ return typeDecl.staticInitializerScope;
+ } else {
+ return typeDecl.initializerScope;
+ }
+ }
+ AbstractMethodDeclaration abstractMethodDeclaration = (AbstractMethodDeclaration) this.ast.getBindingResolver().getCorrespondingNode(currentNode);
+ return abstractMethodDeclaration.scope;
+ }
+
+ protected void recordName(Name name, org.eclipse.jdt.internal.compiler.ast.ASTNode compilerNode) {
+ if (compilerNode != null) {
+ recordNodes(name, compilerNode);
+ if (compilerNode instanceof org.eclipse.jdt.internal.compiler.ast.TypeReference) {
+ org.eclipse.jdt.internal.compiler.ast.TypeReference typeRef = (org.eclipse.jdt.internal.compiler.ast.TypeReference) compilerNode;
+ if (name.isQualifiedName()) {
+ int count = 0;
+ SimpleName simpleName = null;
+ while (name.isQualifiedName()) {
+ simpleName = ((QualifiedName) name).getName();
+ recordNodes(simpleName, typeRef);
+ simpleName.index = count++;
+ name = ((QualifiedName) name).getQualifier();
+ name.index = count;
+ recordNodes(name, typeRef);
+ }
+ }
+ }
+ }
+ }
+
+ protected void recordNodes(ASTNode node, org.eclipse.jdt.internal.compiler.ast.ASTNode oldASTNode) {
+ this.ast.getBindingResolver().store(node, oldASTNode);
+ }
+
+ protected void recordNodes(org.eclipse.jdt.internal.compiler.ast.Javadoc javadoc, TagElement tagElement) {
+ Iterator fragments = tagElement.fragments().listIterator();
+ int size = tagElement.fragments().size();
+ int[] replaceIndex = new int[size];
+ int idx = 0;
+ while (fragments.hasNext()) {
+ ASTNode node = (ASTNode) fragments.next();
+ replaceIndex[idx] = 0;
+ if (node.getNodeType() == ASTNode.MEMBER_REF) {
+ MemberRef memberRef = (MemberRef) node;
+ Name name = memberRef.getName();
+ // get compiler node and record nodes
+ int start = name.getStartPosition();
+ org.eclipse.jdt.internal.compiler.ast.ASTNode compilerNode = javadoc.getNodeStartingAt(start);
+ if (compilerNode instanceof JavadocMessageSend) {
+ replaceIndex[idx] = 1;
+ }
+ if (compilerNode!= null) {
+ recordNodes(name, compilerNode);
+ recordNodes(node, compilerNode);
+ }
+ // Replace qualifier to have all nodes recorded
+ if (memberRef.getQualifier() != null) {
+ org.eclipse.jdt.internal.compiler.ast.TypeReference typeRef = null;
+ if (compilerNode instanceof JavadocFieldReference) {
+ org.eclipse.jdt.internal.compiler.ast.Expression expression = ((JavadocFieldReference)compilerNode).receiver;
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.TypeReference) {
+ typeRef = (org.eclipse.jdt.internal.compiler.ast.TypeReference) expression;
+ }
+ }
+ else if (compilerNode instanceof JavadocMessageSend) {
+ org.eclipse.jdt.internal.compiler.ast.Expression expression = ((JavadocMessageSend)compilerNode).receiver;
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.TypeReference) {
+ typeRef = (org.eclipse.jdt.internal.compiler.ast.TypeReference) expression;
+ }
+ }
+ if (typeRef != null) {
+ recordName(memberRef.getQualifier(), typeRef);
+ }
+ }
+ } else if (node.getNodeType() == ASTNode.METHOD_REF) {
+ MethodRef methodRef = (MethodRef) node;
+ Name name = methodRef.getName();
+ // get compiler node and record nodes
+ int start = name.getStartPosition();
+ // get compiler node and record nodes
+ org.eclipse.jdt.internal.compiler.ast.ASTNode compilerNode = javadoc.getNodeStartingAt(start);
+ // record nodes
+ if (compilerNode != null) {
+ recordNodes(methodRef, compilerNode);
+ // get type ref
+ org.eclipse.jdt.internal.compiler.ast.TypeReference typeRef = null;
+ if (compilerNode instanceof org.eclipse.jdt.internal.compiler.ast.JavadocAllocationExpression) {
+ typeRef = ((org.eclipse.jdt.internal.compiler.ast.JavadocAllocationExpression)compilerNode).type;
+ if (typeRef != null) recordNodes(name, typeRef);
+ }
+ else if (compilerNode instanceof org.eclipse.jdt.internal.compiler.ast.JavadocMessageSend) {
+ org.eclipse.jdt.internal.compiler.ast.Expression expression = ((org.eclipse.jdt.internal.compiler.ast.JavadocMessageSend)compilerNode).receiver;
+ if (expression instanceof org.eclipse.jdt.internal.compiler.ast.TypeReference) {
+ typeRef = (org.eclipse.jdt.internal.compiler.ast.TypeReference) expression;
+ }
+ // TODO (frederic) remove following line to fix bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=62650
+ recordNodes(name, compilerNode);
+ }
+ // record name and qualifier
+ if (typeRef != null && methodRef.getQualifier() != null) {
+ recordName(methodRef.getQualifier(), typeRef);
+ }
+ }
+ // Resolve parameters
+ Iterator parameters = methodRef.parameters().listIterator();
+ while (parameters.hasNext()) {
+ MethodRefParameter param = (MethodRefParameter) parameters.next();
+ org.eclipse.jdt.internal.compiler.ast.Expression expression = (org.eclipse.jdt.internal.compiler.ast.Expression) javadoc.getNodeStartingAt(param.getStartPosition());
+ if (expression != null) {
+ recordNodes(param, expression);
+ if (expression instanceof JavadocArgumentExpression) {
+ JavadocArgumentExpression argExpr = (JavadocArgumentExpression) expression;
+ org.eclipse.jdt.internal.compiler.ast.TypeReference typeRef = argExpr.argument.type;
+ recordNodes(param.getType(), typeRef);
+ if (param.getType().isSimpleType()) {
+ SimpleType type = (SimpleType)param.getType();
+ recordName(type.getName(), typeRef);
+ } else if (param.getType().isArrayType()) {
+ Type type = ((ArrayType) param.getType()).getElementType();
+ if (type.isSimpleType()) {
+ recordName(((SimpleType)type).getName(), typeRef);
+ }
+ }
+ }
+ }
+ }
+ } else if (node.getNodeType() == ASTNode.SIMPLE_NAME ||
+ node.getNodeType() == ASTNode.QUALIFIED_NAME) {
+ org.eclipse.jdt.internal.compiler.ast.ASTNode compilerNode = javadoc.getNodeStartingAt(node.getStartPosition());
+ recordName((Name) node, compilerNode);
+ } else if (node.getNodeType() == ASTNode.TAG_ELEMENT) {
+ // resolve member and method references binding
+ recordNodes(javadoc, (TagElement) node);
+ }
+ }
+ for (int i=0; i<size; i++) {
+ if (replaceIndex[i] == 1) {
+ MemberRef memberRef = (MemberRef) tagElement.fragments().remove(i);
+ MethodRef methodRef = this.ast.newMethodRef();
+ methodRef.setName((SimpleName)memberRef.getName().clone(this.ast));
+ if (memberRef.getQualifier() != null) {
+ methodRef.setQualifier((Name)memberRef.getQualifier().clone(this.ast));
+ }
+ methodRef.setSourceRange(memberRef.getStartPosition(), memberRef.getLength());
+ tagElement.fragments().add(i, methodRef);
+ }
+ }
+ }
+
+ protected void recordPendingNameScopeResolution(Name name) {
+ if (this.pendingNameScopeResolution == null) {
+ this.pendingNameScopeResolution = new HashSet();
+ }
+ this.pendingNameScopeResolution.add(name);
+ }
+
+ protected void recordPendingThisExpressionScopeResolution(ThisExpression thisExpression) {
+ if (this.pendingThisExpressionScopeResolution == null) {
+ this.pendingThisExpressionScopeResolution = new HashSet();
+ }
+ this.pendingThisExpressionScopeResolution.add(thisExpression);
+ }
+
+ /**
+ * Remove whitespaces and comments before and after the expression.
+ */
+ private void trimWhiteSpacesAndComments(org.eclipse.jdt.internal.compiler.ast.Expression expression) {
+ int start = expression.sourceStart;
+ int end = expression.sourceEnd;
+ int token;
+ int trimLeftPosition = expression.sourceStart;
+ int trimRightPosition = expression.sourceEnd;
+ boolean first = true;
+ Scanner removeBlankScanner = this.ast.scanner;
+ try {
+ removeBlankScanner.setSource(this.compilationUnitSource);
+ removeBlankScanner.resetTo(start, end);
+ while (true) {
+ token = removeBlankScanner.getNextToken();
+ switch (token) {
+ case TerminalTokens.TokenNameCOMMENT_JAVADOC :
+ case TerminalTokens.TokenNameCOMMENT_LINE :
+ case TerminalTokens.TokenNameCOMMENT_BLOCK :
+ if (first) {
+ trimLeftPosition = removeBlankScanner.currentPosition;
+ }
+ break;
+ case TerminalTokens.TokenNameWHITESPACE :
+ if (first) {
+ trimLeftPosition = removeBlankScanner.currentPosition;
+ }
+ break;
+ case TerminalTokens.TokenNameEOF :
+ expression.sourceStart = trimLeftPosition;
+ expression.sourceEnd = trimRightPosition;
+ return;
+ default :
+ /*
+ * if we find something else than a whitespace or a comment,
+ * then we reset the trimRigthPosition to the expression
+ * source end.
+ */
+ trimRightPosition = removeBlankScanner.currentPosition - 1;
+ first = false;
+ }
+ }
+ } catch (InvalidInputException e){
+ // ignore
+ }
+ }
+
+ /**
+ * Remove potential trailing comment by settings the source end on the closing parenthesis
*/
- private void retrieveSemiColonPosition(ASTNode node) {
+ protected void removeLeadingAndTrailingCommentsFromLiteral(ASTNode node) {
int start = node.getStartPosition();
- int length = node.getLength();
- int end = start + length;
- int count = 0;
- this.scanner.resetTo(end, this.compilationUnitSource.length);
+ this.scanner.resetTo(start, start + node.getLength());
+ int token;
+ int startPosition = -1;
try {
- int token;
- while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
+ while((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
switch(token) {
- case TerminalTokens.TokenNameSEMICOLON:
- if (count == 0) {
- node.setSourceRange(start, this.scanner.currentPosition - start);
- return;
+ case TerminalTokens.TokenNameIntegerLiteral :
+ case TerminalTokens.TokenNameFloatingPointLiteral :
+ case TerminalTokens.TokenNameLongLiteral :
+ case TerminalTokens.TokenNameDoubleLiteral :
+ case TerminalTokens.TokenNameCharacterLiteral :
+ if (startPosition == -1) {
+ startPosition = this.scanner.startPosition;
}
+ int end = this.scanner.currentPosition;
+ node.setSourceRange(startPosition, end - startPosition);
+ return;
+ case TerminalTokens.TokenNameMINUS :
+ startPosition = this.scanner.startPosition;
break;
- case TerminalTokens.TokenNameLBRACE :
- count++;
- break;
- case TerminalTokens.TokenNameRBRACE :
- count--;
- break;
+ }
+ }
+ } catch(InvalidInputException e) {
+ // ignore
+ }
+ }
+
+ /**
+ * Remove potential trailing comment by settings the source end on the closing parenthesis
+ */
+ protected void removeTrailingCommentFromExpressionEndingWithAParen(ASTNode node) {
+ int start = node.getStartPosition();
+ this.scanner.resetTo(start, start + node.getLength());
+ int token;
+ int parenCounter = 0;
+ try {
+ while((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
+ switch(token) {
case TerminalTokens.TokenNameLPAREN :
- count++;
+ parenCounter++;
break;
case TerminalTokens.TokenNameRPAREN :
- count--;
- break;
- case TerminalTokens.TokenNameLBRACKET :
- count++;
- break;
- case TerminalTokens.TokenNameRBRACKET :
- count--;
+ parenCounter--;
+ if (parenCounter == 0) {
+ int end = this.scanner.currentPosition - 1;
+ node.setSourceRange(start, end - start + 1);
+ }
+ }
+ }
+ } catch(InvalidInputException e) {
+ // ignore
+ }
+ }
+
+ /**
+ * This method is used to retrieve the end position of the block.
+ * @return int the dimension found, -1 if none
+ */
+ protected int retrieveClosingAngleBracketPosition(int start) {
+ this.scanner.resetTo(start, this.scanner.eofPosition);
+ this.scanner.returnOnlyGreater = true;
+ try {
+ int token;
+ while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
+ switch(token) {
+ case TerminalTokens.TokenNameGREATER://110
+ return this.scanner.currentPosition - 1;
+ default:
+ return start;
}
}
} catch(InvalidInputException e) {
// ignore
}
+ this.scanner.returnOnlyGreater = false;
+ return start;
}
/**
@@ -2348,7 +3619,7 @@ class ASTConverter {
* statement. The actual AST nodes don't include the trailing semicolon.
* This method fixes the length of the corresponding node.
*/
- private void retrieveColonPosition(ASTNode node) {
+ protected void retrieveColonPosition(ASTNode node) {
int start = node.getStartPosition();
int length = node.getLength();
int end = start + length;
@@ -2366,8 +3637,35 @@ class ASTConverter {
// ignore
}
}
+
+ /**
+ * This method is used to retrieve the end position of the block.
+ * @return int the dimension found, -1 if none
+ */
+ protected int retrieveEndBlockPosition(int start, int end) {
+ this.scanner.resetTo(start, end);
+ int count = 0;
+ try {
+ int token;
+ while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
+ switch(token) {
+ case TerminalTokens.TokenNameLBRACE://110
+ count++;
+ break;
+ case TerminalTokens.TokenNameRBRACE://95
+ count--;
+ if (count == 0) {
+ return this.scanner.currentPosition - 1;
+ }
+ }
+ }
+ } catch(InvalidInputException e) {
+ // ignore
+ }
+ return -1;
+ }
- private int retrieveEndingSemiColonPosition(int start, int end) {
+ protected int retrieveEndingSemiColonPosition(int start, int end) {
int count = 0;
this.scanner.resetTo(start, end);
try {
@@ -2405,45 +3703,13 @@ class ASTConverter {
}
/**
- * This method is used to retrieve the array dimension declared after the
- * name of a local or a field declaration.
- * For example:
- * int i, j[] = null, k[][] = {{}};
- * It should return 0 for i, 1 for j and 2 for k.
- * @return int the dimension found
- */
- private int retrieveExtraDimension(int start, int end) {
- this.scanner.resetTo(start, end);
- int dimensions = 0;
- try {
- int token;
- while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
- switch(token) {
- case TerminalTokens.TokenNameRBRACKET://166
- dimensions++;
- break;
- case TerminalTokens.TokenNameLBRACE ://90
- case TerminalTokens.TokenNameCOMMA ://90
- case TerminalTokens.TokenNameEQUAL ://167
- case TerminalTokens.TokenNameSEMICOLON ://64
- case TerminalTokens.TokenNameRPAREN : //86
- return dimensions;
- }
- }
- } catch(InvalidInputException e) {
- // ignore
- }
- return dimensions;
- }
-
- /**
* This method is used to retrieve the ending position for a type declaration when the dimension is right after the type
* name.
* For example:
* int[] i; => return 5, but int i[] => return -1;
* @return int the dimension found
*/
- private int retrieveEndOfDimensionsPosition(int start, int end) {
+ protected int retrieveEndOfDimensionsPosition(int start, int end) {
this.scanner.resetTo(start, end);
int foundPosition = -1;
try {
@@ -2469,17 +3735,24 @@ class ASTConverter {
}
/**
- * This method is used to retrieve the starting position of the catch keyword.
+ * This method is used to retrieve the position just before the left bracket.
* @return int the dimension found, -1 if none
*/
- private int retrieveStartingCatchPosition(int start, int end) {
+ protected int retrieveEndOfElementTypeNamePosition(int start, int end) {
this.scanner.resetTo(start, end);
try {
int token;
while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
switch(token) {
- case TerminalTokens.TokenNamecatch://225
- return this.scanner.startPosition;
+ case TerminalTokens.TokenNameIdentifier:
+ case TerminalTokens.TokenNamebyte:
+ case TerminalTokens.TokenNamechar:
+ case TerminalTokens.TokenNamedouble:
+ case TerminalTokens.TokenNamefloat:
+ case TerminalTokens.TokenNameint:
+ case TerminalTokens.TokenNamelong:
+ case TerminalTokens.TokenNameshort:
+ return this.scanner.currentPosition - 1;
}
}
} catch(InvalidInputException e) {
@@ -2489,24 +3762,17 @@ class ASTConverter {
}
/**
- * This method is used to retrieve the position just before the left bracket.
- * @return int the dimension found, -1 if none
+ * This method is used to retrieve the position after the right parenthesis.
+ * @return int the position found
*/
- private int retrieveEndOfElementTypeNamePosition(int start, int end) {
+ protected int retrieveEndOfRightParenthesisPosition(int start, int end) {
this.scanner.resetTo(start, end);
try {
int token;
while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
switch(token) {
- case TerminalTokens.TokenNameIdentifier:
- case TerminalTokens.TokenNamebyte:
- case TerminalTokens.TokenNamechar:
- case TerminalTokens.TokenNamedouble:
- case TerminalTokens.TokenNamefloat:
- case TerminalTokens.TokenNameint:
- case TerminalTokens.TokenNamelong:
- case TerminalTokens.TokenNameshort:
- return this.scanner.currentPosition - 1;
+ case TerminalTokens.TokenNameRPAREN:
+ return this.scanner.currentPosition;
}
}
} catch(InvalidInputException e) {
@@ -2516,37 +3782,108 @@ class ASTConverter {
}
/**
- * This method is used to retrieve the position of the right bracket.
+ * This method is used to retrieve the array dimension declared after the
+ * name of a local or a field declaration.
+ * For example:
+ * int i, j[] = null, k[][] = {{}};
+ * It should return 0 for i, 1 for j and 2 for k.
+ * @return int the dimension found
+ */
+ protected int retrieveExtraDimension(int start, int end) {
+ this.scanner.resetTo(start, end);
+ int dimensions = 0;
+ try {
+ int token;
+ while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
+ switch(token) {
+ case TerminalTokens.TokenNameRBRACKET://166
+ dimensions++;
+ break;
+ case TerminalTokens.TokenNameLBRACE ://90
+ case TerminalTokens.TokenNameCOMMA ://90
+ case TerminalTokens.TokenNameEQUAL ://167
+ case TerminalTokens.TokenNameSEMICOLON ://64
+ case TerminalTokens.TokenNameRPAREN : //86
+ return dimensions;
+ }
+ }
+ } catch(InvalidInputException e) {
+ // ignore
+ }
+ return dimensions;
+ }
+
+ protected void retrieveIdentifierAndSetPositions(int start, int end, Name name) {
+ this.scanner.resetTo(start, end);
+ int token;
+ try {
+ while((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
+ if (token == TerminalTokens.TokenNameIdentifier) {
+ int startName = this.scanner.startPosition;
+ int endName = this.scanner.currentPosition - 1;
+ name.setSourceRange(startName, endName - startName + 1);
+ return;
+ }
+ }
+ } catch(InvalidInputException e) {
+ // ignore
+ }
+ }
+
+ /**
+ * This method is used to retrieve the start position of the block.
* @return int the dimension found, -1 if none
*/
- private int retrieveRightBracketPosition(int start, int end) {
+ protected int retrieveIdentifierEndPosition(int start, int end) {
this.scanner.resetTo(start, end);
try {
int token;
while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
switch(token) {
- case TerminalTokens.TokenNameRBRACKET:
- return this.scanner.currentPosition - 1;
+ case TerminalTokens.TokenNameIdentifier://110
+ return this.scanner.getCurrentTokenEndPosition();
}
}
} catch(InvalidInputException e) {
// ignore
}
return -1;
- }
+ }
/**
- * This method is used to retrieve the position after the right parenthesis.
- * @return int the position found
+ * This method is used to retrieve position before the next comma or semi-colon.
+ * @return int the position found.
*/
- private int retrieveEndOfRightParenthesisPosition(int start, int end) {
+ protected int retrievePositionBeforeNextCommaOrSemiColon(int start, int end) {
this.scanner.resetTo(start, end);
+ int braceCounter = 0;
try {
int token;
while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
switch(token) {
- case TerminalTokens.TokenNameRPAREN:
- return this.scanner.currentPosition;
+ case TerminalTokens.TokenNameLBRACE :
+ braceCounter++;
+ break;
+ case TerminalTokens.TokenNameRBRACE :
+ braceCounter--;
+ break;
+ case TerminalTokens.TokenNameLPAREN :
+ braceCounter++;
+ break;
+ case TerminalTokens.TokenNameRPAREN :
+ braceCounter--;
+ break;
+ case TerminalTokens.TokenNameLBRACKET :
+ braceCounter++;
+ break;
+ case TerminalTokens.TokenNameRBRACKET :
+ braceCounter--;
+ break;
+ case TerminalTokens.TokenNameCOMMA :
+ case TerminalTokens.TokenNameSEMICOLON :
+ if (braceCounter == 0) {
+ return this.scanner.startPosition - 1;
+ }
}
}
} catch(InvalidInputException e) {
@@ -2555,7 +3892,7 @@ class ASTConverter {
return -1;
}
- private int retrieveProperRightBracketPosition(int bracketNumber, int start, int end) {
+ protected int retrieveProperRightBracketPosition(int bracketNumber, int start, int end) {
this.scanner.resetTo(start, end);
try {
int token, count = 0;
@@ -2573,19 +3910,21 @@ class ASTConverter {
}
return -1;
}
-
+
/**
- * This method is used to retrieve the start position of the block.
- * @return int the dimension found, -1 if none
+ * This method is used to retrieve position before the next right brace or semi-colon.
+ * @return int the position found.
*/
- private int retrieveStartBlockPosition(int start, int end) {
+ protected int retrieveRightBraceOrSemiColonPosition(int start, int end) {
this.scanner.resetTo(start, end);
try {
int token;
while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
switch(token) {
- case TerminalTokens.TokenNameLBRACE://110
- return this.scanner.startPosition;
+ case TerminalTokens.TokenNameRBRACE :
+ return this.scanner.currentPosition - 1;
+ case TerminalTokens.TokenNameSEMICOLON :
+ return this.scanner.currentPosition - 1;
}
}
} catch(InvalidInputException e) {
@@ -2593,46 +3932,39 @@ class ASTConverter {
}
return -1;
}
-
+
/**
- * This method is used to retrieve the start position of the block.
- * @return int the dimension found, -1 if none
+ * This method is used to retrieve position before the next right brace or semi-colon.
+ * @return int the position found.
*/
- private int retrieveIdentifierEndPosition(int start, int end) {
+ protected int retrieveRightBrace(int start, int end) {
this.scanner.resetTo(start, end);
try {
int token;
while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
switch(token) {
- case TerminalTokens.TokenNameIdentifier://110
- return this.scanner.getCurrentTokenEndPosition();
+ case TerminalTokens.TokenNameRBRACE :
+ return this.scanner.currentPosition - 1;
}
}
} catch(InvalidInputException e) {
// ignore
}
return -1;
- }
+ }
/**
- * This method is used to retrieve the end position of the block.
+ * This method is used to retrieve the position of the right bracket.
* @return int the dimension found, -1 if none
*/
- private int retrieveEndBlockPosition(int start, int end) {
+ protected int retrieveRightBracketPosition(int start, int end) {
this.scanner.resetTo(start, end);
- int count = 0;
try {
int token;
while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
switch(token) {
- case TerminalTokens.TokenNameLBRACE://110
- count++;
- break;
- case TerminalTokens.TokenNameRBRACE://95
- count--;
- if (count == 0) {
- return this.scanner.currentPosition - 1;
- }
+ case TerminalTokens.TokenNameRBRACKET:
+ return this.scanner.currentPosition - 1;
}
}
} catch(InvalidInputException e) {
@@ -2640,32 +3972,64 @@ class ASTConverter {
}
return -1;
}
-
- /**
- * This method is used to retrieve position before the next right brace or semi-colon.
- * @return int the position found.
+
+ /*
+ * This method is used to set the right end position for expression
+ * statement. The actual AST nodes don't include the trailing semicolon.
+ * This method fixes the length of the corresponding node.
*/
- private int retrieveRightBraceOrSemiColonPosition(MethodDeclaration node, org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration methodDeclaration) {
+ protected void retrieveSemiColonPosition(ASTNode node) {
int start = node.getStartPosition();
- this.scanner.resetTo(start, methodDeclaration.declarationSourceEnd);
+ int length = node.getLength();
+ int end = start + length;
+ int count = 0;
+ this.scanner.resetTo(end, this.compilationUnitSource.length);
try {
int token;
- int braceCounter = 0;
while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
switch(token) {
+ case TerminalTokens.TokenNameSEMICOLON:
+ if (count == 0) {
+ node.setSourceRange(start, this.scanner.currentPosition - start);
+ return;
+ }
+ break;
case TerminalTokens.TokenNameLBRACE :
- braceCounter++;
+ count++;
break;
case TerminalTokens.TokenNameRBRACE :
- braceCounter--;
- if (braceCounter == 0) {
- return this.scanner.currentPosition;
- }
+ count--;
break;
- case TerminalTokens.TokenNameSEMICOLON :
- if (braceCounter == 0) {
- return this.scanner.currentPosition;
- }
+ case TerminalTokens.TokenNameLPAREN :
+ count++;
+ break;
+ case TerminalTokens.TokenNameRPAREN :
+ count--;
+ break;
+ case TerminalTokens.TokenNameLBRACKET :
+ count++;
+ break;
+ case TerminalTokens.TokenNameRBRACKET :
+ count--;
+ }
+ }
+ } catch(InvalidInputException e) {
+ // ignore
+ }
+ }
+
+ /**
+ * This method is used to retrieve the start position of the block.
+ * @return int the dimension found, -1 if none
+ */
+ protected int retrieveStartBlockPosition(int start, int end) {
+ this.scanner.resetTo(start, end);
+ try {
+ int token;
+ while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
+ switch(token) {
+ case TerminalTokens.TokenNameLBRACE://110
+ return this.scanner.startPosition;
}
}
} catch(InvalidInputException e) {
@@ -2675,140 +4039,579 @@ class ASTConverter {
}
/**
- * This method is used to retrieve position before the next comma or semi-colon.
- * @return int the position found.
+ * This method is used to retrieve the starting position of the catch keyword.
+ * @return int the dimension found, -1 if none
*/
- private int retrievePositionBeforeNextCommaOrSemiColon(int start, int end) {
+ protected int retrieveStartingCatchPosition(int start, int end) {
this.scanner.resetTo(start, end);
- int braceCounter = 0;
try {
int token;
while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
switch(token) {
- case TerminalTokens.TokenNameLBRACE :
- braceCounter++;
+ case TerminalTokens.TokenNamecatch://225
+ return this.scanner.startPosition;
+ }
+ }
+ } catch(InvalidInputException e) {
+ // ignore
+ }
+ return -1;
+ }
+
+ public void setAST(AST ast) {
+ this.ast = ast;
+ this.docParser = new DocCommentParser(this.ast, this.scanner, this.insideComments);
+ }
+
+ protected void setModifiers(AnnotationTypeDeclaration typeDecl, org.eclipse.jdt.internal.compiler.ast.AnnotationTypeDeclaration typeDeclaration) {
+ this.scanner.resetTo(typeDeclaration.declarationSourceStart, typeDeclaration.sourceStart);
+ this.setModifiers(typeDecl, typeDeclaration.annotations);
+ }
+
+ protected void setModifiers(AnnotationTypeMemberDeclaration annotationTypeMemberDecl, org.eclipse.jdt.internal.compiler.ast.AnnotationTypeMemberDeclaration annotationTypeMemberDeclaration) {
+ this.scanner.resetTo(annotationTypeMemberDeclaration.declarationSourceStart, annotationTypeMemberDeclaration.sourceStart);
+ this.setModifiers(annotationTypeMemberDecl, annotationTypeMemberDeclaration.annotations);
+ }
+
+ /**
+ * @param bodyDeclaration
+ */
+ protected void setModifiers(BodyDeclaration bodyDeclaration, org.eclipse.jdt.internal.compiler.ast.Annotation[] annotations) {
+ try {
+ int token;
+ int indexInAnnotations = 0;
+ while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
+ IExtendedModifier modifier = null;
+ switch(token) {
+ case TerminalTokens.TokenNameabstract:
+ modifier = createModifier(Modifier.ModifierKeyword.ABSTRACT_KEYWORD);
break;
- case TerminalTokens.TokenNameRBRACE :
- braceCounter--;
+ case TerminalTokens.TokenNamepublic:
+ modifier = createModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD);
break;
- case TerminalTokens.TokenNameLPAREN :
- braceCounter++;
+ case TerminalTokens.TokenNamestatic:
+ modifier = createModifier(Modifier.ModifierKeyword.STATIC_KEYWORD);
break;
- case TerminalTokens.TokenNameRPAREN :
- braceCounter--;
+ case TerminalTokens.TokenNameprotected:
+ modifier = createModifier(Modifier.ModifierKeyword.PROTECTED_KEYWORD);
break;
- case TerminalTokens.TokenNameLBRACKET :
- braceCounter++;
+ case TerminalTokens.TokenNameprivate:
+ modifier = createModifier(Modifier.ModifierKeyword.PRIVATE_KEYWORD);
break;
- case TerminalTokens.TokenNameRBRACKET :
- braceCounter--;
+ case TerminalTokens.TokenNamefinal:
+ modifier = createModifier(Modifier.ModifierKeyword.FINAL_KEYWORD);
break;
- case TerminalTokens.TokenNameCOMMA :
- case TerminalTokens.TokenNameSEMICOLON :
- if (braceCounter == 0) {
- return this.scanner.startPosition - 1;
+ case TerminalTokens.TokenNamenative:
+ modifier = createModifier(Modifier.ModifierKeyword.NATIVE_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamesynchronized:
+ modifier = createModifier(Modifier.ModifierKeyword.SYNCHRONIZED_KEYWORD);
+ break;
+ case TerminalTokens.TokenNametransient:
+ modifier = createModifier(Modifier.ModifierKeyword.TRANSIENT_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamevolatile:
+ modifier = createModifier(Modifier.ModifierKeyword.VOLATILE_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamestrictfp:
+ modifier = createModifier(Modifier.ModifierKeyword.STRICTFP_KEYWORD);
+ break;
+ case TerminalTokens.TokenNameAT :
+ // we have an annotation
+ if (annotations != null && indexInAnnotations < annotations.length) {
+ org.eclipse.jdt.internal.compiler.ast.Annotation annotation = annotations[indexInAnnotations++];
+ modifier = convert(annotation);
+ this.scanner.resetTo(annotation.declarationSourceEnd + 1, this.scanner.eofPosition);
}
}
+ if (modifier != null) {
+ bodyDeclaration.modifiers().add(modifier);
+ }
}
} catch(InvalidInputException e) {
// ignore
}
- return -1;
}
- private VariableDeclarationFragment convertToVariableDeclarationFragment(org.eclipse.jdt.internal.compiler.ast.FieldDeclaration fieldDeclaration) {
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- SimpleName name = this.ast.newSimpleName(new String(fieldDeclaration.name));
- name.setSourceRange(fieldDeclaration.sourceStart, fieldDeclaration.sourceEnd - fieldDeclaration.sourceStart + 1);
- variableDeclarationFragment.setName(name);
- int end = retrievePositionBeforeNextCommaOrSemiColon(fieldDeclaration.sourceEnd, fieldDeclaration.declarationSourceEnd);
- if (end == -1) {
- variableDeclarationFragment.setSourceRange(fieldDeclaration.sourceStart, fieldDeclaration.declarationSourceEnd - fieldDeclaration.sourceStart + 1);
- variableDeclarationFragment.setFlags(variableDeclarationFragment.getFlags() | ASTNode.MALFORMED);
- } else {
- variableDeclarationFragment.setSourceRange(fieldDeclaration.sourceStart, end - fieldDeclaration.sourceStart + 1);
+
+ protected void setModifiers(EnumDeclaration enumDeclaration, org.eclipse.jdt.internal.compiler.ast.EnumDeclaration enumDeclaration2) {
+ this.scanner.resetTo(enumDeclaration2.declarationSourceStart, enumDeclaration2.sourceStart);
+ this.setModifiers(enumDeclaration, enumDeclaration2.annotations);
+ }
+
+ /**
+ * @param fieldDeclaration
+ * @param fieldDecl
+ */
+ protected void setModifiers(FieldDeclaration fieldDeclaration, org.eclipse.jdt.internal.compiler.ast.FieldDeclaration fieldDecl) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ fieldDeclaration.setModifiers(fieldDecl.modifiers & CompilerModifiers.AccJustFlag);
+ if (fieldDecl.annotations != null) {
+ fieldDeclaration.setFlags(fieldDeclaration.getFlags() | ASTNode.MALFORMED);
+ }
+ break;
+ case AST.JLS3 :
+ this.scanner.resetTo(fieldDecl.declarationSourceStart, fieldDecl.sourceStart);
+ this.setModifiers(fieldDeclaration, fieldDecl.annotations);
}
- if (fieldDeclaration.initialization != null) {
- variableDeclarationFragment.setInitializer(convert(fieldDeclaration.initialization));
+ }
+
+ /**
+ * @param initializer
+ * @param oldInitializer
+ */
+ protected void setModifiers(Initializer initializer, org.eclipse.jdt.internal.compiler.ast.Initializer oldInitializer) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2:
+ initializer.setModifiers(oldInitializer.modifiers & CompilerModifiers.AccJustFlag);
+ if (oldInitializer.annotations != null) {
+ initializer.setFlags(initializer.getFlags() | ASTNode.MALFORMED);
+ }
+ break;
+ case AST.JLS3 :
+ this.scanner.resetTo(oldInitializer.declarationSourceStart, oldInitializer.bodyStart);
+ this.setModifiers(initializer, oldInitializer.annotations);
}
- variableDeclarationFragment.setExtraDimensions(retrieveExtraDimension(fieldDeclaration.sourceEnd + 1, fieldDeclaration.declarationSourceEnd ));
- if (this.resolveBindings) {
- recordNodes(name, fieldDeclaration);
- recordNodes(variableDeclarationFragment, fieldDeclaration);
- variableDeclarationFragment.resolveBinding();
+ }
+ /**
+ * @param methodDecl
+ * @param methodDeclaration
+ */
+ protected void setModifiers(MethodDeclaration methodDecl, AbstractMethodDeclaration methodDeclaration) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ methodDecl.setModifiers(methodDeclaration.modifiers & CompilerModifiers.AccJustFlag);
+ if (methodDeclaration.annotations != null) {
+ methodDecl.setFlags(methodDecl.getFlags() | ASTNode.MALFORMED);
+ }
+ break;
+ case AST.JLS3 :
+ this.scanner.resetTo(methodDeclaration.declarationSourceStart, methodDeclaration.sourceStart);
+ this.setModifiers(methodDecl, methodDeclaration.annotations);
}
- return variableDeclarationFragment;
}
- private VariableDeclarationFragment convertToVariableDeclarationFragment(org.eclipse.jdt.internal.compiler.ast.LocalDeclaration localDeclaration) {
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- SimpleName name = this.ast.newSimpleName(new String(localDeclaration.name));
- name.setSourceRange(localDeclaration.sourceStart, localDeclaration.sourceEnd - localDeclaration.sourceStart + 1);
- variableDeclarationFragment.setName(name);
- int end = retrievePositionBeforeNextCommaOrSemiColon(localDeclaration.sourceEnd, this.compilationUnitSource.length);
- if (end == -1) {
- if (localDeclaration.initialization != null) {
- variableDeclarationFragment.setSourceRange(localDeclaration.sourceStart, localDeclaration.initialization.sourceEnd - localDeclaration.sourceStart + 1);
- } else {
- variableDeclarationFragment.setSourceRange(localDeclaration.sourceStart, localDeclaration.sourceEnd - localDeclaration.sourceStart + 1);
- }
- } else {
- variableDeclarationFragment.setSourceRange(localDeclaration.sourceStart, end - localDeclaration.sourceStart + 1);
+ /**
+ * @param variableDecl
+ * @param argument
+ */
+ protected void setModifiers(SingleVariableDeclaration variableDecl, Argument argument) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ variableDecl.setModifiers(argument.modifiers);
+ if (argument.annotations != null) {
+ variableDecl.setFlags(variableDecl.getFlags() | ASTNode.MALFORMED);
+ }
+ break;
+ case AST.JLS3 :
+ this.scanner.resetTo(argument.declarationSourceStart, argument.sourceStart);
+ org.eclipse.jdt.internal.compiler.ast.Annotation[] annotations = argument.annotations;
+ int indexInAnnotations = 0;
+ try {
+ int token;
+ while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
+ IExtendedModifier modifier = null;
+ switch(token) {
+ case TerminalTokens.TokenNameabstract:
+ modifier = createModifier(Modifier.ModifierKeyword.ABSTRACT_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamepublic:
+ modifier = createModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamestatic:
+ modifier = createModifier(Modifier.ModifierKeyword.STATIC_KEYWORD);
+ break;
+ case TerminalTokens.TokenNameprotected:
+ modifier = createModifier(Modifier.ModifierKeyword.PROTECTED_KEYWORD);
+ break;
+ case TerminalTokens.TokenNameprivate:
+ modifier = createModifier(Modifier.ModifierKeyword.PRIVATE_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamefinal:
+ modifier = createModifier(Modifier.ModifierKeyword.FINAL_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamenative:
+ modifier = createModifier(Modifier.ModifierKeyword.NATIVE_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamesynchronized:
+ modifier = createModifier(Modifier.ModifierKeyword.SYNCHRONIZED_KEYWORD);
+ break;
+ case TerminalTokens.TokenNametransient:
+ modifier = createModifier(Modifier.ModifierKeyword.TRANSIENT_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamevolatile:
+ modifier = createModifier(Modifier.ModifierKeyword.VOLATILE_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamestrictfp:
+ modifier = createModifier(Modifier.ModifierKeyword.STRICTFP_KEYWORD);
+ break;
+ case TerminalTokens.TokenNameAT :
+ // we have an annotation
+ if (annotations != null && indexInAnnotations < annotations.length) {
+ org.eclipse.jdt.internal.compiler.ast.Annotation annotation = annotations[indexInAnnotations++];
+ modifier = convert(annotation);
+ this.scanner.resetTo(annotation.declarationSourceEnd + 1, this.scanner.eofPosition);
+ }
+ }
+ if (modifier != null) {
+ variableDecl.modifiers().add(modifier);
+ }
+ }
+ } catch(InvalidInputException e) {
+ // ignore
+ }
}
- if (localDeclaration.initialization != null) {
- variableDeclarationFragment.setInitializer(convert(localDeclaration.initialization));
+ }
+
+ /**
+ * @param variableDecl
+ * @param argument
+ */
+ protected void setModifiers(SingleVariableDeclaration variableDecl, LocalDeclaration localDeclaration) {
+ this.scanner.resetTo(localDeclaration.declarationSourceStart, localDeclaration.sourceStart);
+ org.eclipse.jdt.internal.compiler.ast.Annotation[] annotations = localDeclaration.annotations;
+ int indexInAnnotations = 0;
+ try {
+ int token;
+ while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
+ IExtendedModifier modifier = null;
+ switch(token) {
+ case TerminalTokens.TokenNameabstract:
+ modifier = createModifier(Modifier.ModifierKeyword.ABSTRACT_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamepublic:
+ modifier = createModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamestatic:
+ modifier = createModifier(Modifier.ModifierKeyword.STATIC_KEYWORD);
+ break;
+ case TerminalTokens.TokenNameprotected:
+ modifier = createModifier(Modifier.ModifierKeyword.PROTECTED_KEYWORD);
+ break;
+ case TerminalTokens.TokenNameprivate:
+ modifier = createModifier(Modifier.ModifierKeyword.PRIVATE_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamefinal:
+ modifier = createModifier(Modifier.ModifierKeyword.FINAL_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamenative:
+ modifier = createModifier(Modifier.ModifierKeyword.NATIVE_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamesynchronized:
+ modifier = createModifier(Modifier.ModifierKeyword.SYNCHRONIZED_KEYWORD);
+ break;
+ case TerminalTokens.TokenNametransient:
+ modifier = createModifier(Modifier.ModifierKeyword.TRANSIENT_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamevolatile:
+ modifier = createModifier(Modifier.ModifierKeyword.VOLATILE_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamestrictfp:
+ modifier = createModifier(Modifier.ModifierKeyword.STRICTFP_KEYWORD);
+ break;
+ case TerminalTokens.TokenNameAT :
+ // we have an annotation
+ if (annotations != null && indexInAnnotations < annotations.length) {
+ org.eclipse.jdt.internal.compiler.ast.Annotation annotation = annotations[indexInAnnotations++];
+ modifier = convert(annotation);
+ this.scanner.resetTo(annotation.declarationSourceEnd + 1, this.scanner.eofPosition);
+ }
+ }
+ if (modifier != null) {
+ variableDecl.modifiers().add(modifier);
+ }
+ }
+ } catch(InvalidInputException e) {
+ // ignore
}
- variableDeclarationFragment.setExtraDimensions(retrieveExtraDimension(localDeclaration.sourceEnd + 1, this.compilationUnitSource.length));
- if (this.resolveBindings) {
- recordNodes(variableDeclarationFragment, localDeclaration);
- recordNodes(name, localDeclaration);
- variableDeclarationFragment.resolveBinding();
+ }
+
+ /**
+ * @param typeDecl
+ * @param typeDeclaration
+ */
+ protected void setModifiers(TypeDeclaration typeDecl, org.eclipse.jdt.internal.compiler.ast.TypeDeclaration typeDeclaration) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ typeDecl.setModifiers(typeDeclaration.modifiers & CompilerModifiers.AccJustFlag);
+ if (typeDeclaration.annotations != null) {
+ typeDecl.setFlags(typeDecl.getFlags() | ASTNode.MALFORMED);
+ }
+ break;
+ case AST.JLS3 :
+ this.scanner.resetTo(typeDeclaration.declarationSourceStart, typeDeclaration.sourceStart);
+ this.setModifiers(typeDecl, typeDeclaration.annotations);
}
- return variableDeclarationFragment;
+ }
+
+ /**
+ * @param variableDeclarationExpression
+ * @param localDeclaration
+ */
+ protected void setModifiers(VariableDeclarationExpression variableDeclarationExpression, LocalDeclaration localDeclaration) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ variableDeclarationExpression.setModifiers(localDeclaration.modifiers & ~CompilerModifiers.AccBlankFinal);
+ if (localDeclaration.annotations != null) {
+ variableDeclarationExpression.setFlags(variableDeclarationExpression.getFlags() | ASTNode.MALFORMED);
+ }
+ break;
+ case AST.JLS3 :
+ this.scanner.resetTo(localDeclaration.declarationSourceStart, localDeclaration.sourceStart);
+ org.eclipse.jdt.internal.compiler.ast.Annotation[] annotations = localDeclaration.annotations;
+ int indexInAnnotations = 0;
+ try {
+ int token;
+ while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
+ IExtendedModifier modifier = null;
+ switch(token) {
+ case TerminalTokens.TokenNameabstract:
+ modifier = createModifier(Modifier.ModifierKeyword.ABSTRACT_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamepublic:
+ modifier = createModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamestatic:
+ modifier = createModifier(Modifier.ModifierKeyword.STATIC_KEYWORD);
+ break;
+ case TerminalTokens.TokenNameprotected:
+ modifier = createModifier(Modifier.ModifierKeyword.PROTECTED_KEYWORD);
+ break;
+ case TerminalTokens.TokenNameprivate:
+ modifier = createModifier(Modifier.ModifierKeyword.PRIVATE_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamefinal:
+ modifier = createModifier(Modifier.ModifierKeyword.FINAL_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamenative:
+ modifier = createModifier(Modifier.ModifierKeyword.NATIVE_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamesynchronized:
+ modifier = createModifier(Modifier.ModifierKeyword.SYNCHRONIZED_KEYWORD);
+ break;
+ case TerminalTokens.TokenNametransient:
+ modifier = createModifier(Modifier.ModifierKeyword.TRANSIENT_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamevolatile:
+ modifier = createModifier(Modifier.ModifierKeyword.VOLATILE_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamestrictfp:
+ modifier = createModifier(Modifier.ModifierKeyword.STRICTFP_KEYWORD);
+ break;
+ case TerminalTokens.TokenNameAT :
+ // we have an annotation
+ if (annotations != null && indexInAnnotations < annotations.length) {
+ org.eclipse.jdt.internal.compiler.ast.Annotation annotation = annotations[indexInAnnotations++];
+ modifier = convert(annotation);
+ this.scanner.resetTo(annotation.declarationSourceEnd + 1, this.scanner.eofPosition);
+ }
+ }
+ if (modifier != null) {
+ variableDeclarationExpression.modifiers().add(modifier);
+ }
+ }
+ } catch(InvalidInputException e) {
+ // ignore
+ }
+ }
}
- private FieldDeclaration convertToFieldDeclaration(org.eclipse.jdt.internal.compiler.ast.FieldDeclaration fieldDecl) {
- VariableDeclarationFragment variableDeclarationFragment = convertToVariableDeclarationFragment(fieldDecl);
- FieldDeclaration fieldDeclaration = this.ast.newFieldDeclaration(variableDeclarationFragment);
+ /**
+ * @param variableDeclarationStatement
+ * @param localDeclaration
+ */
+ protected void setModifiers(VariableDeclarationStatement variableDeclarationStatement, LocalDeclaration localDeclaration) {
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ variableDeclarationStatement.setModifiers(localDeclaration.modifiers & ~CompilerModifiers.AccBlankFinal);
+ if (localDeclaration.annotations != null) {
+ variableDeclarationStatement.setFlags(variableDeclarationStatement.getFlags() | ASTNode.MALFORMED);
+ }
+ break;
+ case AST.JLS3 :
+ this.scanner.resetTo(localDeclaration.declarationSourceStart, localDeclaration.sourceStart);
+ org.eclipse.jdt.internal.compiler.ast.Annotation[] annotations = localDeclaration.annotations;
+ int indexInAnnotations = 0;
+ try {
+ int token;
+ while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
+ IExtendedModifier modifier = null;
+ switch(token) {
+ case TerminalTokens.TokenNameabstract:
+ modifier = createModifier(Modifier.ModifierKeyword.ABSTRACT_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamepublic:
+ modifier = createModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamestatic:
+ modifier = createModifier(Modifier.ModifierKeyword.STATIC_KEYWORD);
+ break;
+ case TerminalTokens.TokenNameprotected:
+ modifier = createModifier(Modifier.ModifierKeyword.PROTECTED_KEYWORD);
+ break;
+ case TerminalTokens.TokenNameprivate:
+ modifier = createModifier(Modifier.ModifierKeyword.PRIVATE_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamefinal:
+ modifier = createModifier(Modifier.ModifierKeyword.FINAL_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamenative:
+ modifier = createModifier(Modifier.ModifierKeyword.NATIVE_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamesynchronized:
+ modifier = createModifier(Modifier.ModifierKeyword.SYNCHRONIZED_KEYWORD);
+ break;
+ case TerminalTokens.TokenNametransient:
+ modifier = createModifier(Modifier.ModifierKeyword.TRANSIENT_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamevolatile:
+ modifier = createModifier(Modifier.ModifierKeyword.VOLATILE_KEYWORD);
+ break;
+ case TerminalTokens.TokenNamestrictfp:
+ modifier = createModifier(Modifier.ModifierKeyword.STRICTFP_KEYWORD);
+ break;
+ case TerminalTokens.TokenNameAT :
+ // we have an annotation
+ if (annotations != null && indexInAnnotations < annotations.length) {
+ org.eclipse.jdt.internal.compiler.ast.Annotation annotation = annotations[indexInAnnotations++];
+ modifier = convert(annotation);
+ this.scanner.resetTo(annotation.declarationSourceEnd + 1, this.scanner.eofPosition);
+ }
+ }
+ if (modifier != null) {
+ variableDeclarationStatement.modifiers().add(modifier);
+ }
+ }
+ } catch(InvalidInputException e) {
+ // ignore
+ }
+ }
+ }
+
+ protected QualifiedName setQualifiedNameNameAndSourceRanges(char[][] typeName, long[] positions, org.eclipse.jdt.internal.compiler.ast.ASTNode node) {
+ int length = typeName.length;
+ SimpleName firstToken = this.ast.newSimpleName(new String(typeName[0]));
+ firstToken.index = length - 1;
+ int start0 = (int)(positions[0]>>>32);
+ int start = start0;
+ int end = (int)(positions[0] & 0xFFFFFFFF);
+ firstToken.setSourceRange(start, end - start + 1);
+ SimpleName secondToken = this.ast.newSimpleName(new String(typeName[1]));
+ secondToken.index = length - 2;
+ start = (int)(positions[1]>>>32);
+ end = (int)(positions[1] & 0xFFFFFFFF);
+ secondToken.setSourceRange(start, end - start + 1);
+ QualifiedName qualifiedName = this.ast.newQualifiedName(firstToken, secondToken);
if (this.resolveBindings) {
- recordNodes(variableDeclarationFragment, fieldDecl);
- variableDeclarationFragment.resolveBinding();
+ recordNodes(qualifiedName, node);
+ recordPendingNameScopeResolution(qualifiedName);
+ recordNodes(firstToken, node);
+ recordNodes(secondToken, node);
+ recordPendingNameScopeResolution(firstToken);
+ recordPendingNameScopeResolution(secondToken);
}
- fieldDeclaration.setSourceRange(fieldDecl.declarationSourceStart, fieldDecl.declarationEnd - fieldDecl.declarationSourceStart + 1);
- Type type = convertType(fieldDecl.type);
- setTypeForField(fieldDeclaration, type, variableDeclarationFragment.getExtraDimensions());
- fieldDeclaration.setModifiers(fieldDecl.modifiers & org.eclipse.jdt.internal.compiler.lookup.CompilerModifiers.AccJustFlag);
- convert(fieldDecl.javadoc, fieldDeclaration);
- return fieldDeclaration;
+ qualifiedName.index = length - 2;
+ qualifiedName.setSourceRange(start0, end - start0 + 1);
+ SimpleName newPart = null;
+ for (int i = 2; i < length; i++) {
+ newPart = this.ast.newSimpleName(new String(typeName[i]));
+ newPart.index = length - i - 1;
+ start = (int)(positions[i]>>>32);
+ end = (int)(positions[i] & 0xFFFFFFFF);
+ newPart.setSourceRange(start, end - start + 1);
+ qualifiedName = this.ast.newQualifiedName(qualifiedName, newPart);
+ qualifiedName.index = newPart.index;
+ qualifiedName.setSourceRange(start0, end - start0 + 1);
+ if (this.resolveBindings) {
+ recordNodes(qualifiedName, node);
+ recordNodes(newPart, node);
+ recordPendingNameScopeResolution(qualifiedName);
+ recordPendingNameScopeResolution(newPart);
+ }
+ }
+ QualifiedName name = qualifiedName;
+ if (this.resolveBindings) {
+ recordNodes(name, node);
+ recordPendingNameScopeResolution(name);
+ }
+ return name;
}
-
- private VariableDeclarationStatement convertToVariableDeclarationStatement(org.eclipse.jdt.internal.compiler.ast.LocalDeclaration localDeclaration) {
- VariableDeclarationFragment variableDeclarationFragment = convertToVariableDeclarationFragment(localDeclaration);
- VariableDeclarationStatement variableDeclarationStatement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
+
+ protected QualifiedName setQualifiedNameNameAndSourceRanges(char[][] typeName, long[] positions, int startingIndex, int endingIndex, org.eclipse.jdt.internal.compiler.ast.ASTNode node) {
+ int length = endingIndex - startingIndex + 1;
+ SimpleName firstToken = this.ast.newSimpleName(new String(typeName[startingIndex]));
+ firstToken.index = startingIndex;
+ int start0 = (int)(positions[startingIndex]>>>32);
+ int start = start0;
+ int end = (int) positions[startingIndex];
+ firstToken.setSourceRange(start, end - start + 1);
+ SimpleName secondToken = this.ast.newSimpleName(new String(typeName[startingIndex + 1]));
+ secondToken.index = startingIndex + 1;
+ start = (int)(positions[startingIndex + 1]>>>32);
+ end = (int) positions[startingIndex + 1];
+ secondToken.setSourceRange(start, end - start + 1);
+ QualifiedName qualifiedName = this.ast.newQualifiedName(firstToken, secondToken);
if (this.resolveBindings) {
- recordNodes(variableDeclarationFragment, localDeclaration);
+ recordNodes(qualifiedName, node);
+ recordPendingNameScopeResolution(qualifiedName);
+ recordNodes(firstToken, node);
+ recordNodes(secondToken, node);
+ recordPendingNameScopeResolution(firstToken);
+ recordPendingNameScopeResolution(secondToken);
}
- variableDeclarationStatement.setSourceRange(localDeclaration.declarationSourceStart, localDeclaration.declarationSourceEnd - localDeclaration.declarationSourceStart + 1);
- Type type = convertType(localDeclaration.type);
- setTypeForVariableDeclarationStatement(variableDeclarationStatement, type, variableDeclarationFragment.getExtraDimensions());
- variableDeclarationStatement.setModifiers(localDeclaration.modifiers & ~CompilerModifiers.AccBlankFinal);
- return variableDeclarationStatement;
+ qualifiedName.index = startingIndex + 1;
+ qualifiedName.setSourceRange(start0, end - start0 + 1);
+ SimpleName newPart = null;
+ for (int i = 2; i < length; i++) {
+ newPart = this.ast.newSimpleName(new String(typeName[i]));
+ newPart.index = startingIndex + i;
+ start = (int)(positions[i]>>>32);
+ end = (int) positions[i];
+ newPart.setSourceRange(start, end - start + 1);
+ qualifiedName = this.ast.newQualifiedName(qualifiedName, newPart);
+ qualifiedName.index = newPart.index;
+ qualifiedName.setSourceRange(start0, end - start0 + 1);
+ if (this.resolveBindings) {
+ recordNodes(qualifiedName, node);
+ recordNodes(newPart, node);
+ recordPendingNameScopeResolution(qualifiedName);
+ recordPendingNameScopeResolution(newPart);
+ }
+ }
+ QualifiedName name = qualifiedName;
+ if (this.resolveBindings) {
+ recordNodes(name, node);
+ recordPendingNameScopeResolution(name);
+ }
+ return name;
}
- private VariableDeclarationExpression convertToVariableDeclarationExpression(org.eclipse.jdt.internal.compiler.ast.LocalDeclaration localDeclaration) {
- VariableDeclarationFragment variableDeclarationFragment = convertToVariableDeclarationFragment(localDeclaration);
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
+ /**
+ * @param annotation
+ * @param singleMemberAnnotation
+ */
+ protected void setTypeNameForAnnotation(org.eclipse.jdt.internal.compiler.ast.Annotation compilerAnnotation, Annotation annotation) {
+ char[][] typeName = compilerAnnotation.tokens;
+ int length = typeName.length;
+ Name name = null;
+ if (length > 1) {
+ // QualifiedName
+ name = setQualifiedNameNameAndSourceRanges(typeName, compilerAnnotation.sourcePositions, compilerAnnotation);
+ } else {
+ name = this.ast.newSimpleName(new String(typeName[0]));
+ long position = compilerAnnotation.sourcePositions[0];
+ int start = (int) (position >>> 32);
+ int end = (int) position;
+ name.setSourceRange(start, end - start + 1);
+ }
if (this.resolveBindings) {
- recordNodes(variableDeclarationFragment, localDeclaration);
+ recordNodes(name, compilerAnnotation);
}
- variableDeclarationExpression.setSourceRange(localDeclaration.declarationSourceStart, localDeclaration.declarationSourceEnd - localDeclaration.declarationSourceStart + 1);
- Type type = convertType(localDeclaration.type);
- setTypeForVariableDeclarationExpression(variableDeclarationExpression, type, variableDeclarationFragment.getExtraDimensions());
- variableDeclarationExpression.setModifiers(localDeclaration.modifiers & ~CompilerModifiers.AccBlankFinal);
- return variableDeclarationExpression;
+ annotation.setTypeName(name);
}
- private void setTypeForField(FieldDeclaration fieldDeclaration, Type type, int extraDimension) {
+ protected void setTypeForField(FieldDeclaration fieldDeclaration, Type type, int extraDimension) {
if (extraDimension != 0) {
if (type.isArrayType()) {
ArrayType arrayType = (ArrayType) type;
@@ -2849,25 +4652,8 @@ class ASTConverter {
fieldDeclaration.setType(type);
}
}
-
- private void updateInnerPositions(Type type, int dimensions) {
- if (dimensions > 1) {
- // need to set positions for intermediate array type see 42839
- int start = type.getStartPosition();
- int length = type.getLength();
- Type currentComponentType = ((ArrayType) type).getComponentType();
- int searchedDimension = dimensions - 1;
- int rightBracketEndPosition = start;
- while (currentComponentType.isArrayType()) {
- rightBracketEndPosition = retrieveProperRightBracketPosition(searchedDimension, start, start + length);
- currentComponentType.setSourceRange(start, rightBracketEndPosition - start + 1);
- currentComponentType = ((ArrayType) currentComponentType).getComponentType();
- searchedDimension--;
- }
- }
- }
-
- private void setTypeForSingleVariableDeclaration(SingleVariableDeclaration singleVariableDeclaration, Type type, int extraDimension) {
+
+ protected void setTypeForMethodDeclaration(MethodDeclaration methodDeclaration, Type type, int extraDimension) {
if (extraDimension != 0) {
if (type.isArrayType()) {
ArrayType arrayType = (ArrayType) type;
@@ -2878,7 +4664,14 @@ class ASTConverter {
// cut the child loose from its parent (without creating garbage)
elementType.setParent(null, null);
this.ast.getBindingResolver().updateKey(type, elementType);
- singleVariableDeclaration.setType(elementType);
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ methodDeclaration.setReturnType(elementType);
+ break;
+ case AST.JLS3 :
+ methodDeclaration.setReturnType2(elementType);
+ break;
+ }
} else {
int start = type.getStartPosition();
int length = type.getLength();
@@ -2893,18 +4686,43 @@ class ASTConverter {
// cut the child loose from its parent (without creating garbage)
subarrayType.setParent(null, null);
updateInnerPositions(subarrayType, remainingDimensions);
- singleVariableDeclaration.setType(subarrayType);
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ methodDeclaration.setReturnType(subarrayType);
+ break;
+ case AST.JLS3 :
+ methodDeclaration.setReturnType2(subarrayType);
+ break;
+ }
this.ast.getBindingResolver().updateKey(type, subarrayType);
}
} else {
- singleVariableDeclaration.setType(type);
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ methodDeclaration.setReturnType(type);
+ break;
+ case AST.JLS3 :
+ methodDeclaration.setReturnType2(type);
+ break;
+ }
}
} else {
- singleVariableDeclaration.setType(type);
+ switch(this.ast.apiLevel) {
+ case AST.JLS2 :
+ methodDeclaration.setReturnType(type);
+ break;
+ case AST.JLS3 :
+ methodDeclaration.setReturnType2(type);
+ break;
+ }
}
}
+
+ protected void setTypeForMethodDeclaration(AnnotationTypeMemberDeclaration annotationTypeMemberDeclaration, Type type, int extraDimension) {
+ annotationTypeMemberDeclaration.setType(type);
+ }
- private void setTypeForMethodDeclaration(MethodDeclaration methodDeclaration, Type type, int extraDimension) {
+ protected void setTypeForSingleVariableDeclaration(SingleVariableDeclaration singleVariableDeclaration, Type type, int extraDimension) {
if (extraDimension != 0) {
if (type.isArrayType()) {
ArrayType arrayType = (ArrayType) type;
@@ -2915,7 +4733,7 @@ class ASTConverter {
// cut the child loose from its parent (without creating garbage)
elementType.setParent(null, null);
this.ast.getBindingResolver().updateKey(type, elementType);
- methodDeclaration.setReturnType(elementType);
+ singleVariableDeclaration.setType(elementType);
} else {
int start = type.getStartPosition();
int length = type.getLength();
@@ -2930,18 +4748,18 @@ class ASTConverter {
// cut the child loose from its parent (without creating garbage)
subarrayType.setParent(null, null);
updateInnerPositions(subarrayType, remainingDimensions);
- methodDeclaration.setReturnType(subarrayType);
+ singleVariableDeclaration.setType(subarrayType);
this.ast.getBindingResolver().updateKey(type, subarrayType);
}
} else {
- methodDeclaration.setReturnType(type);
+ singleVariableDeclaration.setType(type);
}
} else {
- methodDeclaration.setReturnType(type);
+ singleVariableDeclaration.setType(type);
}
}
- private void setTypeForVariableDeclarationStatement(VariableDeclarationStatement variableDeclarationStatement, Type type, int extraDimension) {
+ protected void setTypeForVariableDeclarationExpression(VariableDeclarationExpression variableDeclarationExpression, Type type, int extraDimension) {
if (extraDimension != 0) {
if (type.isArrayType()) {
ArrayType arrayType = (ArrayType) type;
@@ -2952,7 +4770,7 @@ class ASTConverter {
// cut the child loose from its parent (without creating garbage)
elementType.setParent(null, null);
this.ast.getBindingResolver().updateKey(type, elementType);
- variableDeclarationStatement.setType(elementType);
+ variableDeclarationExpression.setType(elementType);
} else {
int start = type.getStartPosition();
int length = type.getLength();
@@ -2967,18 +4785,18 @@ class ASTConverter {
// cut the child loose from its parent (without creating garbage)
subarrayType.setParent(null, null);
updateInnerPositions(subarrayType, remainingDimensions);
- variableDeclarationStatement.setType(subarrayType);
+ variableDeclarationExpression.setType(subarrayType);
this.ast.getBindingResolver().updateKey(type, subarrayType);
}
} else {
- variableDeclarationStatement.setType(type);
+ variableDeclarationExpression.setType(type);
}
} else {
- variableDeclarationStatement.setType(type);
+ variableDeclarationExpression.setType(type);
}
}
- private void setTypeForVariableDeclarationExpression(VariableDeclarationExpression variableDeclarationExpression, Type type, int extraDimension) {
+ protected void setTypeForVariableDeclarationStatement(VariableDeclarationStatement variableDeclarationStatement, Type type, int extraDimension) {
if (extraDimension != 0) {
if (type.isArrayType()) {
ArrayType arrayType = (ArrayType) type;
@@ -2989,7 +4807,7 @@ class ASTConverter {
// cut the child loose from its parent (without creating garbage)
elementType.setParent(null, null);
this.ast.getBindingResolver().updateKey(type, elementType);
- variableDeclarationExpression.setType(elementType);
+ variableDeclarationStatement.setType(elementType);
} else {
int start = type.getStartPosition();
int length = type.getLength();
@@ -3004,472 +4822,32 @@ class ASTConverter {
// cut the child loose from its parent (without creating garbage)
subarrayType.setParent(null, null);
updateInnerPositions(subarrayType, remainingDimensions);
- variableDeclarationExpression.setType(subarrayType);
+ variableDeclarationStatement.setType(subarrayType);
this.ast.getBindingResolver().updateKey(type, subarrayType);
}
} else {
- variableDeclarationExpression.setType(type);
- }
- } else {
- variableDeclarationExpression.setType(type);
- }
- }
-
- public void convert(org.eclipse.jdt.internal.compiler.ast.Javadoc javadoc, BodyDeclaration bodyDeclaration) {
- if (bodyDeclaration.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());
- }
- }
- bodyDeclaration.setJavadoc(docComment);
- }
- }
- }
- }
-
- private void recordNodes(org.eclipse.jdt.internal.compiler.ast.Javadoc javadoc, TagElement tagElement) {
- Iterator fragments = tagElement.fragments().listIterator();
- int size = tagElement.fragments().size();
- int[] replaceIndex = new int[size];
- int idx = 0;
- while (fragments.hasNext()) {
- ASTNode node = (ASTNode) fragments.next();
- replaceIndex[idx] = 0;
- if (node.getNodeType() == ASTNode.MEMBER_REF) {
- MemberRef memberRef = (MemberRef) node;
- Name name = memberRef.getName();
- // get compiler node and record nodes
- int start = name.getStartPosition();
- org.eclipse.jdt.internal.compiler.ast.ASTNode compilerNode = javadoc.getNodeStartingAt(start);
- if (compilerNode instanceof JavadocMessageSend) {
- replaceIndex[idx] = 1;
- }
- if (compilerNode!= null) {
- recordNodes(name, compilerNode);
- recordNodes(node, compilerNode);
- }
- // Replace qualifier to have all nodes recorded
- if (memberRef.getQualifier() != null) {
- org.eclipse.jdt.internal.compiler.ast.TypeReference typeRef = null;
- if (compilerNode instanceof JavadocFieldReference) {
- org.eclipse.jdt.internal.compiler.ast.Expression expression = ((JavadocFieldReference)compilerNode).receiver;
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.TypeReference) {
- typeRef = (org.eclipse.jdt.internal.compiler.ast.TypeReference) expression;
- }
- }
- else if (compilerNode instanceof JavadocMessageSend) {
- org.eclipse.jdt.internal.compiler.ast.Expression expression = ((JavadocMessageSend)compilerNode).receiver;
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.TypeReference) {
- typeRef = (org.eclipse.jdt.internal.compiler.ast.TypeReference) expression;
- }
- }
- if (typeRef != null) {
- recordName(memberRef.getQualifier(), typeRef);
- }
- }
- } else if (node.getNodeType() == ASTNode.METHOD_REF) {
- MethodRef methodRef = (MethodRef) node;
- Name name = methodRef.getName();
- // get compiler node and record nodes
- int start = name.getStartPosition();
- // get compiler node and record nodes
- org.eclipse.jdt.internal.compiler.ast.ASTNode compilerNode = javadoc.getNodeStartingAt(start);
- // record nodes
- if (compilerNode != null) {
- recordNodes(methodRef, compilerNode);
- // get type ref
- org.eclipse.jdt.internal.compiler.ast.TypeReference typeRef = null;
- if (compilerNode instanceof org.eclipse.jdt.internal.compiler.ast.JavadocAllocationExpression) {
- typeRef = ((org.eclipse.jdt.internal.compiler.ast.JavadocAllocationExpression)compilerNode).type;
- if (typeRef != null) recordNodes(name, typeRef);
- }
- else if (compilerNode instanceof org.eclipse.jdt.internal.compiler.ast.JavadocMessageSend) {
- org.eclipse.jdt.internal.compiler.ast.Expression expression = ((org.eclipse.jdt.internal.compiler.ast.JavadocMessageSend)compilerNode).receiver;
- if (expression instanceof org.eclipse.jdt.internal.compiler.ast.TypeReference) {
- typeRef = (org.eclipse.jdt.internal.compiler.ast.TypeReference) expression;
- }
- // TODO (frederic) remove following line to fix bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=62650
- recordNodes(name, compilerNode);
- }
- // record name and qualifier
- if (typeRef != null && methodRef.getQualifier() != null) {
- recordName(methodRef.getQualifier(), typeRef);
- }
- }
- // Resolve parameters
- Iterator parameters = methodRef.parameters().listIterator();
- while (parameters.hasNext()) {
- MethodRefParameter param = (MethodRefParameter) parameters.next();
- org.eclipse.jdt.internal.compiler.ast.Expression expression = (org.eclipse.jdt.internal.compiler.ast.Expression) javadoc.getNodeStartingAt(param.getStartPosition());
- if (expression != null) {
- recordNodes(param, expression);
- if (expression instanceof JavadocArgumentExpression) {
- JavadocArgumentExpression argExpr = (JavadocArgumentExpression) expression;
- org.eclipse.jdt.internal.compiler.ast.TypeReference typeRef = argExpr.argument.type;
- recordNodes(param.getType(), typeRef);
- if (param.getType().isSimpleType()) {
- SimpleType type = (SimpleType)param.getType();
- recordName(type.getName(), typeRef);
- } else if (param.getType().isArrayType()) {
- Type type = ((ArrayType) param.getType()).getElementType();
- if (type.isSimpleType()) {
- recordName(((SimpleType)type).getName(), typeRef);
- }
- }
- }
- }
- }
- } else if (node.getNodeType() == ASTNode.SIMPLE_NAME ||
- node.getNodeType() == ASTNode.QUALIFIED_NAME) {
- org.eclipse.jdt.internal.compiler.ast.ASTNode compilerNode = javadoc.getNodeStartingAt(node.getStartPosition());
- recordName((Name) node, compilerNode);
- } else if (node.getNodeType() == ASTNode.TAG_ELEMENT) {
- // resolve member and method references binding
- recordNodes(javadoc, (TagElement) node);
- }
- }
- for (int i=0; i<size; i++) {
- if (replaceIndex[i] == 1) {
- MemberRef memberRef = (MemberRef) tagElement.fragments().remove(i);
- MethodRef methodRef = this.ast.newMethodRef();
- methodRef.setName((SimpleName)memberRef.getName().clone(this.ast));
- if (memberRef.getQualifier() != null) {
- methodRef.setQualifier((Name)memberRef.getQualifier().clone(this.ast));
- }
- methodRef.setSourceRange(memberRef.getStartPosition(), memberRef.getLength());
- tagElement.fragments().add(i, methodRef);
- }
- }
- }
-
- private void recordName(Name name, org.eclipse.jdt.internal.compiler.ast.ASTNode compilerNode) {
- if (compilerNode != null) {
- recordNodes(name, compilerNode);
- if (compilerNode instanceof org.eclipse.jdt.internal.compiler.ast.TypeReference) {
- org.eclipse.jdt.internal.compiler.ast.TypeReference typeRef = (org.eclipse.jdt.internal.compiler.ast.TypeReference) compilerNode;
- if (name.isQualifiedName()) {
- int count = 0;
- SimpleName simpleName = null;
- while (name.isQualifiedName()) {
- simpleName = ((QualifiedName) name).getName();
- recordNodes(simpleName, typeRef);
- simpleName.index = count++;
- name = ((QualifiedName) name).getQualifier();
- name.index = count;
- recordNodes(name, typeRef);
- }
- }
+ variableDeclarationStatement.setType(type);
}
- }
- }
-
-
- private Comment createComment(int[] positions) {
- // Create comment node
- Comment comment = null;
- int start = positions[0];
- int end = positions[1];
- if (positions[1]>0) { // Javadoc comments have positive end position
- this.ast.newJavadoc();
- Javadoc docComment = this.docParser.parse(positions);
- if (docComment == null) return null;
- comment = docComment;
} else {
- end = -end;
- if (positions[0]>0) { // Block comment have positive start position
- comment = this.ast.newBlockComment();
- } else { // Line comment have negative start and end position
- start = -start;
- comment = this.ast.newLineComment();
- }
- comment.setSourceRange(start, end - start);
- }
- return comment;
- }
-
- void propagateErrors(ASTNode astNode, IProblem[] problems) {
- ASTSyntaxErrorPropagator syntaxErrorPropagator = new ASTSyntaxErrorPropagator(problems);
- astNode.accept(syntaxErrorPropagator);
- }
-
- private void recordNodes(ASTNode node, org.eclipse.jdt.internal.compiler.ast.ASTNode oldASTNode) {
- this.ast.getBindingResolver().store(node, oldASTNode);
- }
-
- /**
- * Remove whitespaces and comments before and after the expression.
- */
- private void trimWhiteSpacesAndComments(org.eclipse.jdt.internal.compiler.ast.Expression expression) {
- int start = expression.sourceStart;
- int end = expression.sourceEnd;
- int token;
- int trimLeftPosition = expression.sourceStart;
- int trimRightPosition = expression.sourceEnd;
- boolean first = true;
- Scanner removeBlankScanner = this.ast.scanner;
- try {
- removeBlankScanner.setSource(this.compilationUnitSource);
- removeBlankScanner.resetTo(start, end);
- while (true) {
- token = removeBlankScanner.getNextToken();
- switch (token) {
- case TerminalTokens.TokenNameCOMMENT_JAVADOC :
- case TerminalTokens.TokenNameCOMMENT_LINE :
- case TerminalTokens.TokenNameCOMMENT_BLOCK :
- if (first) {
- trimLeftPosition = removeBlankScanner.currentPosition;
- }
- break;
- case TerminalTokens.TokenNameWHITESPACE :
- if (first) {
- trimLeftPosition = removeBlankScanner.currentPosition;
- }
- break;
- case TerminalTokens.TokenNameEOF :
- expression.sourceStart = trimLeftPosition;
- expression.sourceEnd = trimRightPosition;
- return;
- default :
- /*
- * if we find something else than a whitespace or a comment,
- * then we reset the trimRigthPosition to the expression
- * source end.
- */
- trimRightPosition = removeBlankScanner.currentPosition - 1;
- first = false;
- }
- }
- } catch (InvalidInputException e){
- // ignore
- }
- }
-
- private void adjustSourcePositionsForParent(org.eclipse.jdt.internal.compiler.ast.Expression expression) {
- int start = expression.sourceStart;
- int end = expression.sourceEnd;
- int leftParentCount = 1;
- int rightParentCount = 0;
- this.scanner.resetTo(start, end);
- try {
- int token = this.scanner.getNextToken();
- expression.sourceStart = this.scanner.currentPosition;
- boolean stop = false;
- while (!stop && ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF)) {
- switch(token) {
- case TerminalTokens.TokenNameLPAREN:
- leftParentCount++;
- break;
- case TerminalTokens.TokenNameRPAREN:
- rightParentCount++;
- if (rightParentCount == leftParentCount) {
- // we found the matching parenthesis
- stop = true;
- }
- }
- }
- expression.sourceEnd = this.scanner.startPosition - 1;
- } catch(InvalidInputException e) {
- // ignore
- }
- }
-
- private void retrieveIdentifierAndSetPositions(int start, int end, Name name) {
- this.scanner.resetTo(start, end);
- int token;
- try {
- while((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
- if (token == TerminalTokens.TokenNameIdentifier) {
- int startName = this.scanner.startPosition;
- int endName = this.scanner.currentPosition - 1;
- name.setSourceRange(startName, endName - startName + 1);
- return;
- }
- }
- } catch(InvalidInputException e) {
- // ignore
- }
- }
-
- /**
- * Remove potential trailing comment by settings the source end on the closing parenthesis
- */
- private void removeTrailingCommentFromExpressionEndingWithAParen(ASTNode node) {
- int start = node.getStartPosition();
- this.scanner.resetTo(start, start + node.getLength());
- int token;
- int parenCounter = 0;
- try {
- while((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
- switch(token) {
- case TerminalTokens.TokenNameLPAREN :
- parenCounter++;
- break;
- case TerminalTokens.TokenNameRPAREN :
- parenCounter--;
- if (parenCounter == 0) {
- int end = this.scanner.currentPosition - 1;
- node.setSourceRange(start, end - start + 1);
- }
- }
- }
- } catch(InvalidInputException e) {
- // ignore
- }
- }
-
- /**
- * Remove potential trailing comment by settings the source end on the closing parenthesis
- */
- private void removeLeadingAndTrailingCommentsFromLiteral(ASTNode node) {
- int start = node.getStartPosition();
- this.scanner.resetTo(start, start + node.getLength());
- int token;
- int startPosition = -1;
- try {
- while((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
- switch(token) {
- case TerminalTokens.TokenNameIntegerLiteral :
- case TerminalTokens.TokenNameFloatingPointLiteral :
- case TerminalTokens.TokenNameLongLiteral :
- case TerminalTokens.TokenNameDoubleLiteral :
- case TerminalTokens.TokenNameCharacterLiteral :
- if (startPosition == -1) {
- startPosition = this.scanner.startPosition;
- }
- int end = this.scanner.currentPosition;
- node.setSourceRange(startPosition, end - startPosition);
- return;
- case TerminalTokens.TokenNameMINUS :
- startPosition = this.scanner.startPosition;
- break;
- }
- }
- } catch(InvalidInputException e) {
- // ignore
- }
- }
-
- private void recordPendingThisExpressionScopeResolution(ThisExpression thisExpression) {
- if (this.pendingThisExpressionScopeResolution == null) {
- this.pendingThisExpressionScopeResolution = new HashSet();
- }
- this.pendingThisExpressionScopeResolution.add(thisExpression);
- }
-
- private void recordPendingNameScopeResolution(Name name) {
- if (this.pendingNameScopeResolution == null) {
- this.pendingNameScopeResolution = new HashSet();
- }
- this.pendingNameScopeResolution.add(name);
- }
-
- private void lookupForScopes() {
- if (this.pendingNameScopeResolution != null) {
- for (Iterator iterator = this.pendingNameScopeResolution.iterator(); iterator.hasNext(); ) {
- Name name = (Name) iterator.next();
- this.ast.getBindingResolver().recordScope(name, lookupScope(name));
- }
- }
- if (this.pendingThisExpressionScopeResolution != null) {
- for (Iterator iterator = this.pendingThisExpressionScopeResolution.iterator(); iterator.hasNext(); ) {
- ThisExpression thisExpression = (ThisExpression) iterator.next();
- this.ast.getBindingResolver().recordScope(thisExpression, lookupScope(thisExpression));
- }
- }
-
- }
-
- private BlockScope lookupScope(ASTNode node) {
- ASTNode currentNode = node;
- while(currentNode != null
- &&!(currentNode instanceof MethodDeclaration)
- && !(currentNode instanceof Initializer)
- && !(currentNode instanceof FieldDeclaration)) {
- currentNode = currentNode.getParent();
- }
- if (currentNode == null) {
- return null;
- }
- if (currentNode instanceof Initializer) {
- Initializer initializer = (Initializer) currentNode;
- while(!(currentNode instanceof TypeDeclaration)) {
- currentNode = currentNode.getParent();
- }
- org.eclipse.jdt.internal.compiler.ast.TypeDeclaration typeDecl = (org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) this.ast.getBindingResolver().getCorrespondingNode(currentNode);
- if ((initializer.getModifiers() & Modifier.STATIC) != 0) {
- return typeDecl.staticInitializerScope;
- } else {
- return typeDecl.initializerScope;
- }
- } else if (currentNode instanceof FieldDeclaration) {
- FieldDeclaration fieldDeclaration = (FieldDeclaration) currentNode;
- while(!(currentNode instanceof TypeDeclaration)) {
- currentNode = currentNode.getParent();
- }
- org.eclipse.jdt.internal.compiler.ast.TypeDeclaration typeDecl = (org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) this.ast.getBindingResolver().getCorrespondingNode(currentNode);
- if ((fieldDeclaration.getModifiers() & Modifier.STATIC) != 0) {
- return typeDecl.staticInitializerScope;
- } else {
- return typeDecl.initializerScope;
- }
+ variableDeclarationStatement.setType(type);
}
- AbstractMethodDeclaration abstractMethodDeclaration = (AbstractMethodDeclaration) this.ast.getBindingResolver().getCorrespondingNode(currentNode);
- return abstractMethodDeclaration.scope;
}
- private InfixExpression.Operator getOperatorFor(int operatorID) {
- switch (operatorID) {
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.EQUAL_EQUAL :
- return InfixExpression.Operator.EQUALS;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.LESS_EQUAL :
- return InfixExpression.Operator.LESS_EQUALS;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.GREATER_EQUAL :
- return InfixExpression.Operator.GREATER_EQUALS;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.NOT_EQUAL :
- return InfixExpression.Operator.NOT_EQUALS;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.LEFT_SHIFT :
- return InfixExpression.Operator.LEFT_SHIFT;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.RIGHT_SHIFT :
- return InfixExpression.Operator.RIGHT_SHIFT_SIGNED;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.UNSIGNED_RIGHT_SHIFT :
- return InfixExpression.Operator.RIGHT_SHIFT_UNSIGNED;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.OR_OR :
- return InfixExpression.Operator.CONDITIONAL_OR;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.AND_AND :
- return InfixExpression.Operator.CONDITIONAL_AND;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.PLUS :
- return InfixExpression.Operator.PLUS;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.MINUS :
- return InfixExpression.Operator.MINUS;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.REMAINDER :
- return InfixExpression.Operator.REMAINDER;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.XOR :
- return InfixExpression.Operator.XOR;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.AND :
- return InfixExpression.Operator.AND;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.MULTIPLY :
- return InfixExpression.Operator.TIMES;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.OR :
- return InfixExpression.Operator.OR;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.DIVIDE :
- return InfixExpression.Operator.DIVIDE;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.GREATER :
- return InfixExpression.Operator.GREATER;
- case org.eclipse.jdt.internal.compiler.ast.OperatorIds.LESS :
- return InfixExpression.Operator.LESS;
+ protected void updateInnerPositions(Type type, int dimensions) {
+ if (dimensions > 1) {
+ // need to set positions for intermediate array type see 42839
+ int start = type.getStartPosition();
+ int length = type.getLength();
+ Type currentComponentType = ((ArrayType) type).getComponentType();
+ int searchedDimension = dimensions - 1;
+ int rightBracketEndPosition = start;
+ while (currentComponentType.isArrayType()) {
+ rightBracketEndPosition = retrieveProperRightBracketPosition(searchedDimension, start, start + length);
+ currentComponentType.setSourceRange(start, rightBracketEndPosition - start + 1);
+ currentComponentType = ((ArrayType) currentComponentType).getComponentType();
+ searchedDimension--;
+ }
}
- return null;
}
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java
index c642c18f20..f01d5a9de3 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java
@@ -699,20 +699,16 @@ public class ASTParser {
AST ast = AST.newAST(this.apiLevel);
ast.setDefaultNodeFlag(ASTNode.ORIGINAL);
CompilationUnit compilationUnit = null;
- if (AST.JLS2 == this.apiLevel) {
- ASTConverter converter = new ASTConverter(this.compilerOptions, needToResolveBindings, monitor);
- if (needToResolveBindings) {
- resolver = new DefaultBindingResolver(compilationUnitDeclaration.scope);
- } else {
- resolver = new BindingResolver();
- }
- ast.setBindingResolver(resolver);
- converter.setAST(ast);
- compilationUnit = converter.convert(compilationUnitDeclaration, source);
- compilationUnit.setLineEndTable(compilationUnitDeclaration.compilationResult.lineSeparatorPositions);
+ ASTConverter converter = new ASTConverter(this.compilerOptions, needToResolveBindings, monitor);
+ if (needToResolveBindings) {
+ resolver = new DefaultBindingResolver(compilationUnitDeclaration.scope);
} else {
- throw new RuntimeException("J2SE 1.5 parser not implemented yet"); //$NON-NLS-1$
+ resolver = new BindingResolver();
}
+ ast.setBindingResolver(resolver);
+ converter.setAST(ast);
+ compilationUnit = converter.convert(compilationUnitDeclaration, source);
+ compilationUnit.setLineEndTable(compilationUnitDeclaration.compilationResult.lineSeparatorPositions);
ast.setDefaultNodeFlag(0);
ast.setOriginalModificationCount(ast.modificationCount());
return compilationUnit;
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AbstractTypeDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AbstractTypeDeclaration.java
index 37fe9be952..5bdb513265 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AbstractTypeDeclaration.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AbstractTypeDeclaration.java
@@ -200,6 +200,31 @@ public abstract class AbstractTypeDeclaration extends BodyDeclaration {
return (parent instanceof TypeDeclarationStatement);
}
+ /**
+ * Resolves and returns the binding for the type declared in this type
+ * declaration.
+ * <p>
+ * Note that bindings are generally unavailable unless requested when the
+ * AST is being built.
+ * </p>
+ *
+ * @return the binding, or <code>null</code> if the binding cannot be
+ * resolved
+ * @since 3.1 Declared in 3.0 on the individual subclasses.
+ */
+ public final ITypeBinding resolveBinding() {
+ return internalResolveBinding();
+ }
+
+ /**
+ * Resolves and returns the binding for the type declared in this type
+ * declaration. This method must be implemented by subclasses.
+ *
+ * @return the binding, or <code>null</code> if the binding cannot be
+ * resolved
+ */
+ abstract ITypeBinding internalResolveBinding();
+
/* (omit javadoc for this method)
* Method declared on ASTNode.
*/
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationTypeDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationTypeDeclaration.java
index 26b465aa0a..30a9d6577b 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationTypeDeclaration.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationTypeDeclaration.java
@@ -246,18 +246,10 @@ public class AnnotationTypeDeclaration extends AbstractTypeDeclaration {
visitor.endVisit(this);
}
- /**
- * Resolves and returns the binding for the annotation type declared in
- * this annotation type declaration.
- * <p>
- * Note that bindings are generally unavailable unless requested when the
- * AST is being built.
- * </p>
- *
- * @return the binding, or <code>null</code> if the binding cannot be
- * resolved
- */
- public ITypeBinding resolveBinding() {
+ /* (omit javadoc for this method)
+ * Method declared on AsbtractTypeDeclaration.
+ */
+ ITypeBinding internalResolveBinding() {
return this.ast.getBindingResolver().resolveType(this);
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingResolver.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingResolver.java
index fb6b3d4925..6c0b60da1d 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingResolver.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingResolver.java
@@ -25,7 +25,6 @@ import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
*/
class BindingResolver {
- protected long modificationCount;
/**
* Creates a binding resolver.
*/
@@ -34,15 +33,6 @@ class BindingResolver {
}
/**
- * Store the number of modifications done using the ast. This is used to validate
- * resolveBinding methods. If the number changed, all resolve bindings methods
- * simply return null.
- */
- protected void storeModificationCount(long modificationCounter) {
- this.modificationCount = modificationCounter;
- }
-
- /**
* Allows the user to store information about the given old/new pair of
* AST nodes.
* <p>
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
index d1fe48e296..f2b69bd7ef 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
@@ -385,9 +385,9 @@ class DefaultBindingResolver extends BindingResolver {
ArrayType arrayType = (ArrayType) type;
if (binding.isArrayType()) {
ArrayBinding arrayBinding = (ArrayBinding) binding;
- return getTypeBinding(this.scope.createArray(arrayBinding.leafComponentType, arrayType.getDimensions()));
+ return getTypeBinding(this.scope.createArrayType(arrayBinding.leafComponentType, arrayType.getDimensions()));
} else {
- return getTypeBinding(this.scope.createArray(binding, arrayType.getDimensions()));
+ return getTypeBinding(this.scope.createArrayType(binding, arrayType.getDimensions()));
}
} else {
if (binding.isArrayType()) {
@@ -428,11 +428,11 @@ class DefaultBindingResolver extends BindingResolver {
} else if ("java.lang.String".equals(name)) {//$NON-NLS-1$
return this.getTypeBinding(this.scope.getJavaLangString());
} else if ("java.lang.StringBuffer".equals(name)) {//$NON-NLS-1$
- return this.getTypeBinding(this.scope.getType(JAVA_LANG_STRINGBUFFER));
+ return this.getTypeBinding(this.scope.getType(JAVA_LANG_STRINGBUFFER, 3));
} else if ("java.lang.Throwable".equals(name)) {//$NON-NLS-1$
return this.getTypeBinding(this.scope.getJavaLangThrowable());
} else if ("java.lang.Exception".equals(name)) {//$NON-NLS-1$
- return this.getTypeBinding(this.scope.getType(JAVA_LANG_EXCEPTION));
+ return this.getTypeBinding(this.scope.getType(JAVA_LANG_EXCEPTION, 3));
} else if ("java.lang.RuntimeException".equals(name)) {//$NON-NLS-1$
return this.getTypeBinding(this.scope.getJavaLangRuntimeException());
} else if ("java.lang.Error".equals(name)) {//$NON-NLS-1$
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DocCommentParser.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DocCommentParser.java
index 9b812da2a7..bb62eb84c8 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DocCommentParser.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DocCommentParser.java
@@ -60,7 +60,9 @@ class DocCommentParser extends AbstractCommentParser {
parseComment(start, start+length-1);
}
this.docComment.setSourceRange(start, length);
- setComment(start, length); // backward compatibility
+ if (this.ast.apiLevel == AST.JLS2) {
+ setComment(start, length); // backward compatibility
+ }
return this.docComment;
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumDeclaration.java
index 4afa0c189b..9cb02973d6 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumDeclaration.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumDeclaration.java
@@ -305,18 +305,10 @@ public class EnumDeclaration extends AbstractTypeDeclaration {
return enumConstants;
}
- /**
- * Resolves and returns the binding for the enum declared in
- * this enum declaration.
- * <p>
- * Note that bindings are generally unavailable unless requested when the
- * AST is being built.
- * </p>
- *
- * @return the binding, or <code>null</code> if the binding cannot be
- * resolved
- */
- public ITypeBinding resolveBinding() {
+ /* (omit javadoc for this method)
+ * Method declared on AsbtractTypeDeclaration.
+ */
+ ITypeBinding internalResolveBinding() {
return this.ast.getBindingResolver().resolveType(this);
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java
index 0bd60a9fd3..ffa7d9dcc0 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java
@@ -107,14 +107,13 @@ class TypeBinding implements ITypeBinding {
ReferenceBinding referenceBinding = (ReferenceBinding) this.binding;
if (referenceBinding.isAnonymousType()) {
return NO_NAME;
- } else if (referenceBinding.isMemberType()) {
- char[] name = referenceBinding.compoundName[referenceBinding.compoundName.length - 1];
- return new String(CharOperation.subarray(name, CharOperation.lastIndexOf('$', name) + 1, name.length));
- } else if (referenceBinding.isLocalType()) {
- char[] name = referenceBinding.compoundName[referenceBinding.compoundName.length - 1];
- return new String(CharOperation.subarray(name, CharOperation.lastIndexOf('$', name) + 1, name.length));
} else {
- return new String(referenceBinding.compoundName[referenceBinding.compoundName.length - 1]);
+ char[] shortName = referenceBinding.shortReadableName();
+ if (referenceBinding.isMemberType() || referenceBinding.isLocalType()) {
+ return new String(CharOperation.subarray(shortName, CharOperation.lastIndexOf('.', shortName) + 1, shortName.length));
+ } else {
+ return new String(shortName);
+ }
}
} else if (this.binding.isArrayType()) {
ArrayBinding arrayBinding = (ArrayBinding) this.binding;
@@ -128,14 +127,11 @@ class TypeBinding implements ITypeBinding {
org.eclipse.jdt.internal.compiler.lookup.TypeBinding leafComponentTypeBinding = arrayBinding.leafComponentType;
if (leafComponentTypeBinding.isClass() || leafComponentTypeBinding.isInterface()) {
ReferenceBinding referenceBinding2 = (ReferenceBinding) leafComponentTypeBinding;
- if (referenceBinding2.isMemberType()) {
- char[] name = referenceBinding2.compoundName[referenceBinding2.compoundName.length - 1];
- buffer.append(CharOperation.subarray(name, CharOperation.lastIndexOf('$', name) + 1, name.length));
- } else if (referenceBinding2.isLocalType()) {
- char[] name = referenceBinding2.compoundName[referenceBinding2.compoundName.length - 1];
- buffer.append(CharOperation.subarray(name, CharOperation.lastIndexOf('$', name) + 1, name.length));
+ char[] shortName = referenceBinding2.shortReadableName();
+ if (referenceBinding2.isMemberType() || referenceBinding2.isLocalType()) {
+ buffer.append(CharOperation.subarray(shortName, CharOperation.lastIndexOf('.', shortName) + 1, shortName.length));
} else {
- buffer.append(referenceBinding2.compoundName[referenceBinding2.compoundName.length - 1]);
+ buffer.append(shortName);
}
} else {
buffer.append(leafComponentTypeBinding.readableName());
@@ -352,10 +348,7 @@ class TypeBinding implements ITypeBinding {
public String getBinaryName() {
char[] constantPoolName = this.binding.constantPoolName();
if (constantPoolName == null) return null;
- int length = constantPoolName.length;
- char[] dotSeparated = new char[length];
- System.arraycopy(constantPoolName, 0, dotSeparated, 0, length);
- CharOperation.replace(dotSeparated, '/', '.');
+ char[] dotSeparated = CharOperation.replaceOnCopy(constantPoolName, '/', '.');
return new String(dotSeparated);
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclaration.java
index 12b3fcd9ec..5988951ef6 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclaration.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclaration.java
@@ -764,18 +764,10 @@ public class TypeDeclaration extends AbstractTypeDeclaration {
return memberTypes;
}
- /**
- * Resolves and returns the binding for the class or interface declared in
- * this type declaration.
- * <p>
- * Note that bindings are generally unavailable unless requested when the
- * AST is being built.
- * </p>
- *
- * @return the binding, or <code>null</code> if the binding cannot be
- * resolved
- */
- public ITypeBinding resolveBinding() {
+ /* (omit javadoc for this method)
+ * Method declared on AsbtractTypeDeclaration.
+ */
+ ITypeBinding internalResolveBinding() {
return this.ast.getBindingResolver().resolveType(this);
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
index a6936aa030..f8033d627e 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
@@ -9,7 +9,6 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.core.dom.rewrite;
-
import java.util.ArrayList;
import java.util.IdentityHashMap;
import java.util.Iterator;
@@ -837,6 +836,50 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
return listRewriter.rewriteList(parent, property, insertPos, leadString.toString());
}
+ private int rewriteOptionalTypeParameters(ASTNode parent, StructuralPropertyDescriptor property, int offset, String keyword) {
+ int pos= offset;
+ RewriteEvent event= getEvent(parent, property);
+ if (event != null && event.getChangeKind() != RewriteEvent.UNCHANGED) {
+ RewriteEvent[] children= event.getChildren();
+ try {
+ boolean isAllRemoved= isAllOfKind(children, RewriteEvent.REMOVED);
+ if (isAllRemoved) { // all removed: set start to left bracket
+ pos= getScanner().getTokenStartOffset(ITerminalSymbols.TokenNameLESS, pos);
+ }
+ pos= new ListRewriter().rewriteList(parent, property, pos, keyword + String.valueOf('<'), ", "); //$NON-NLS-1$ //$NON-NLS-2$
+ if (isAllRemoved) { // all removed: remove right bracked
+ int endPos= getScanner().getTokenEndOffset(ITerminalSymbols.TokenNameGREATER, pos); // set pos to '>'
+ doTextRemove(pos, endPos - pos, getEditGroup(children[children.length - 1]));
+ return endPos;
+ } else if (isAllOfKind(children, RewriteEvent.INSERTED)) {
+ doTextInsert(pos, String.valueOf('>'), getEditGroup(children[children.length - 1]));
+ return pos;
+ }
+ } catch (CoreException e) {
+ handleException(e);
+ }
+ } else {
+ pos= doVisit(parent, property, pos);
+ }
+ if (pos != offset) { // list contained some type -> parse after closing bracket
+ try {
+ return getScanner().getTokenEndOffset(ITerminalSymbols.TokenNameGREATER, pos);
+ } catch (CoreException e) {
+ handleException(e);
+ }
+ }
+ return pos;
+ }
+
+ private boolean isAllOfKind(RewriteEvent[] children, int kind) {
+ for (int i= 0; i < children.length; i++) {
+ if (children[i].getChangeKind() != kind) {
+ return false;
+ }
+ }
+ return true;
+ }
+
private int rewriteNodeList(ASTNode parent, StructuralPropertyDescriptor property, int pos, String keyword, String separator) {
RewriteEvent event= getEvent(parent, property);
if (event != null && event.getChangeKind() != RewriteEvent.UNCHANGED) {
@@ -1069,6 +1112,28 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
}
}
+ private void rewriteModifiers2(ASTNode node, ChildListPropertyDescriptor property, int pos) {
+ RewriteEvent event= getEvent(node, property);
+ if (event == null || event.getChangeKind() == RewriteEvent.UNCHANGED) {
+ doVisit(node, property, pos);
+ return;
+ }
+
+ int endPos= rewriteNodeList(node, property, pos, "", " "); //$NON-NLS-1$ //$NON-NLS-2$
+ RewriteEvent[] children= event.getChildren();
+ if (isAllOfKind(children, RewriteEvent.INSERTED)) {
+ doTextInsert(endPos, " ", getEditGroup(children[children.length - 1])); //$NON-NLS-1$
+ } else if (isAllOfKind(children, RewriteEvent.REMOVED)) {
+ try {
+ int nextPos= getScanner().getNextStartOffset(endPos, false);
+ doTextRemove(endPos, nextPos - endPos, getEditGroup(children[children.length - 1]));
+ } catch (CoreException e) {
+ handleException(e);
+ }
+ }
+ }
+
+
private void replaceOperation(int posBeforeOperation, String newOperation, TextEditGroup editGroup) {
try {
getScanner().readNext(posBeforeOperation, true);
@@ -1170,8 +1235,15 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
if (!hasChildrenChanges(node)) {
return doVisitUnchangedChildren(node);
}
+ int apiLevel= node.getAST().apiLevel();
+
int pos= rewriteJavadoc(node, TypeDeclaration.JAVADOC_PROPERTY);
- rewriteModifiers(node, TypeDeclaration.MODIFIERS_PROPERTY, pos);
+
+ if (apiLevel == AST.JLS2) {
+ rewriteModifiers(node, TypeDeclaration.MODIFIERS_PROPERTY, pos);
+ } else {
+ rewriteModifiers2(node, TypeDeclaration.MODIFIERS2_PROPERTY, pos);
+ }
boolean isInterface= ((Boolean) getOriginalValue(node, TypeDeclaration.INTERFACE_PROPERTY)).booleanValue();
// modifiers & class/interface
@@ -1194,9 +1266,15 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
// name
pos= rewriteRequiredNode(node, TypeDeclaration.NAME_PROPERTY);
+ if (apiLevel >= AST.JLS3) {
+ pos= rewriteOptionalTypeParameters(node, TypeDeclaration.TYPE_PARAMETERS_PROPERTY, pos, " "); //$NON-NLS-1$
+ }
+
// superclass
if (!isInterface || invertType) {
- RewriteEvent superClassEvent= getEvent(node, TypeDeclaration.SUPERCLASS_PROPERTY);
+ ChildPropertyDescriptor superClassProperty= (apiLevel == AST.JLS2) ? TypeDeclaration.SUPERCLASS_PROPERTY : TypeDeclaration.SUPERCLASS_TYPE_PROPERTY;
+
+ RewriteEvent superClassEvent= getEvent(node, superClassProperty);
int changeKind= superClassEvent != null ? superClassEvent.getChangeKind() : RewriteEvent.UNCHANGED;
switch (changeKind) {
@@ -1222,28 +1300,30 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
break;
}
case RewriteEvent.UNCHANGED: {
- pos= doVisit(node, TypeDeclaration.SUPERCLASS_PROPERTY, pos);
+ pos= doVisit(node, superClassProperty, pos);
}
}
}
// extended interfaces
- RewriteEvent interfaceEvent= getEvent(node, TypeDeclaration.SUPER_INTERFACES_PROPERTY);
+ ChildListPropertyDescriptor superInterfaceProperty= (apiLevel == AST.JLS2) ? TypeDeclaration.SUPER_INTERFACES_PROPERTY : TypeDeclaration.SUPER_INTERFACE_TYPES_PROPERTY;
+
+ RewriteEvent interfaceEvent= getEvent(node, superInterfaceProperty);
if (interfaceEvent == null || interfaceEvent.getChangeKind() == RewriteEvent.UNCHANGED) {
if (invertType) {
- List originalNodes= (List) getOriginalValue(node, TypeDeclaration.SUPER_INTERFACES_PROPERTY);
+ List originalNodes= (List) getOriginalValue(node, superInterfaceProperty);
if (!originalNodes.isEmpty()) {
String keyword= isInterface ? " implements " : " extends "; //$NON-NLS-1$ //$NON-NLS-2$
ASTNode firstNode= (ASTNode) originalNodes.get(0);
doTextReplace(pos, firstNode.getStartPosition() - pos, keyword, getEditGroup(node, TypeDeclaration.INTERFACE_PROPERTY));
}
}
- pos= doVisit(node, TypeDeclaration.SUPER_INTERFACES_PROPERTY, pos);
+ pos= doVisit(node, superInterfaceProperty, pos);
} else {
String keyword= (isInterface == invertType) ? " implements " : " extends "; //$NON-NLS-1$ //$NON-NLS-2$
if (invertType) {
- List newNodes= (List) getNewValue(node, TypeDeclaration.SUPER_INTERFACES_PROPERTY);
+ List newNodes= (List) interfaceEvent.getNewValue();
if (!newNodes.isEmpty()) {
- List origNodes= (List) getOriginalValue(node, TypeDeclaration.SUPER_INTERFACES_PROPERTY);
+ List origNodes= (List) interfaceEvent.getOriginalValue();
int firstStart= pos;
if (!origNodes.isEmpty()) {
firstStart= ((ASTNode) origNodes.get(0)).getStartPosition();
@@ -1253,7 +1333,7 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
pos= firstStart;
}
}
- pos= rewriteNodeList(node, TypeDeclaration.SUPER_INTERFACES_PROPERTY, pos, keyword, ", "); //$NON-NLS-1$
+ pos= rewriteNodeList(node, superInterfaceProperty, pos, keyword, ", "); //$NON-NLS-1$
}
// type members
@@ -1264,16 +1344,17 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
return false;
}
-
private void rewriteReturnType(MethodDeclaration node, boolean isConstructor, boolean isConstructorChange) {
- // weakness in the AST: return type always exists, even if missing in source
- ASTNode originalReturnType= (ASTNode) getOriginalValue(node, MethodDeclaration.RETURN_TYPE_PROPERTY);
+ ChildPropertyDescriptor property= (node.getAST().apiLevel() == AST.JLS2) ? MethodDeclaration.RETURN_TYPE_PROPERTY : MethodDeclaration.RETURN_TYPE2_PROPERTY;
+
+ // weakness in the AST: return type can exist, even if missing in source
+ ASTNode originalReturnType= (ASTNode) getOriginalValue(node, property);
boolean returnTypeExists= originalReturnType != null && originalReturnType.getStartPosition() != -1;
if (!isConstructorChange && returnTypeExists) {
- rewriteRequiredNode(node, MethodDeclaration.RETURN_TYPE_PROPERTY);
+ rewriteRequiredNode(node, property);
return;
}
- ASTNode newReturnType= (ASTNode) getNewValue(node, MethodDeclaration.RETURN_TYPE_PROPERTY);
+ ASTNode newReturnType= (ASTNode) getNewValue(node, property);
if (isConstructorChange || !returnTypeExists && newReturnType != originalReturnType) {
try {
int startPos= node.getStartPosition();
@@ -1285,7 +1366,7 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
token= getScanner().readNext(true);
}
- TextEditGroup editGroup= getEditGroup(node, MethodDeclaration.RETURN_TYPE_PROPERTY);
+ TextEditGroup editGroup= getEditGroup(node, property);
if (isConstructor || !returnTypeExists) { // insert
doTextInsert(startPos, " ", editGroup); //$NON-NLS-1$
doTextInsert(startPos, newReturnType, getIndent(startPos), true, editGroup);
@@ -1308,7 +1389,11 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
return doVisitUnchangedChildren(node);
}
int pos= rewriteJavadoc(node, MethodDeclaration.JAVADOC_PROPERTY);
- rewriteModifiers(node, MethodDeclaration.MODIFIERS_PROPERTY, pos);
+ if (node.getAST().apiLevel() == AST.JLS2) {
+ rewriteModifiers(node, MethodDeclaration.MODIFIERS_PROPERTY, pos);
+ } else {
+ rewriteModifiers2(node, MethodDeclaration.MODIFIERS2_PROPERTY, pos);
+ }
boolean isConstructorChange= isChanged(node, MethodDeclaration.CONSTRUCTOR_PROPERTY);
boolean isConstructor= ((Boolean) getOriginalValue(node, MethodDeclaration.CONSTRUCTOR_PROPERTY)).booleanValue();
@@ -1658,9 +1743,22 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
return doVisitUnchangedChildren(node);
}
- rewriteOptionalQualifier(node, ClassInstanceCreation.EXPRESSION_PROPERTY, node.getStartPosition());
-
- int pos= rewriteRequiredNode(node, ClassInstanceCreation.NAME_PROPERTY);
+ int pos= rewriteOptionalQualifier(node, ClassInstanceCreation.EXPRESSION_PROPERTY, node.getStartPosition());
+ if (node.getAST().apiLevel() == AST.JLS2) {
+ pos= rewriteRequiredNode(node, ClassInstanceCreation.NAME_PROPERTY);
+ } else {
+ if (isChanged(node, ClassInstanceCreation.TYPE_ARGUMENTS_PROPERTY)) {
+ try {
+ pos= getScanner().getTokenEndOffset(ITerminalSymbols.TokenNamenew, pos); //after 'new'
+ rewriteOptionalTypeParameters(node, ClassInstanceCreation.TYPE_ARGUMENTS_PROPERTY, pos, " "); //$NON-NLS-1$
+ } catch (CoreException e) {
+ handleException(e);
+ }
+ } else {
+ doVisit(node, ClassInstanceCreation.TYPE_ARGUMENTS_PROPERTY, 0);
+ }
+ pos= rewriteRequiredNode(node, ClassInstanceCreation.TYPE_PROPERTY);
+ }
if (isChanged(node, ClassInstanceCreation.ARGUMENTS_PROPERTY)) {
try {
@@ -1708,10 +1806,13 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
if (!hasChildrenChanges(node)) {
return doVisitUnchangedChildren(node);
}
-
+ int pos= node.getStartPosition();
+ if (node.getAST().apiLevel() >= AST.JLS3) {
+ pos= rewriteOptionalTypeParameters(node, ConstructorInvocation.TYPE_ARGUMENTS_PROPERTY, pos, " "); //$NON-NLS-1$
+ }
try {
- int startpos= getScanner().getTokenEndOffset(ITerminalSymbols.TokenNameLPAREN, node.getStartPosition());
- rewriteNodeList(node, ConstructorInvocation.ARGUMENTS_PROPERTY, startpos, "", ", "); //$NON-NLS-1$ //$NON-NLS-2$
+ pos= getScanner().getTokenEndOffset(ITerminalSymbols.TokenNameLPAREN, pos);
+ rewriteNodeList(node, ConstructorInvocation.ARGUMENTS_PROPERTY, pos, "", ", "); //$NON-NLS-1$ //$NON-NLS-2$
} catch (CoreException e) {
handleException(e);
}
@@ -1809,7 +1910,12 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
}
int pos= rewriteJavadoc(node, FieldDeclaration.JAVADOC_PROPERTY);
- rewriteModifiers(node, FieldDeclaration.MODIFIERS_PROPERTY, pos);
+ if (node.getAST().apiLevel() == AST.JLS2) {
+ rewriteModifiers(node, FieldDeclaration.MODIFIERS_PROPERTY, pos);
+ } else {
+ rewriteModifiers2(node, FieldDeclaration.MODIFIERS2_PROPERTY, pos);
+ }
+
pos= rewriteRequiredNode(node, FieldDeclaration.TYPE_PROPERTY);
rewriteNodeList(node, FieldDeclaration.FRAGMENTS_PROPERTY, pos, "", ", "); //$NON-NLS-1$ //$NON-NLS-2$
return false;
@@ -1919,6 +2025,23 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
if (!hasChildrenChanges(node)) {
return doVisitUnchangedChildren(node);
}
+ if (node.getAST().apiLevel() >= AST.JLS3) {
+ RewriteEvent event= getEvent(node, ImportDeclaration.STATIC_PROPERTY);
+ if (event != null && event.getChangeKind() != RewriteEvent.UNCHANGED) {
+ boolean wasStatic= ((Boolean) event.getOriginalValue()).booleanValue();
+ int pos= node.getStartPosition();
+ if (wasStatic) {
+ try {
+ int endPos= getScanner().getTokenStartOffset(ITerminalSymbols.TokenNameimport, pos);
+ doTextRemove(pos, endPos - pos, getEditGroup(event));
+ } catch (CoreException e) {
+ handleException(e);
+ }
+ } else {
+ doTextInsert(pos, "static ", getEditGroup(event)); //$NON-NLS-1$
+ }
+ }
+ }
int pos= rewriteRequiredNode(node, ImportDeclaration.NAME_PROPERTY);
@@ -2000,7 +2123,11 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
return doVisitUnchangedChildren(node);
}
int pos= rewriteJavadoc(node, Initializer.JAVADOC_PROPERTY);
- rewriteModifiers(node, Initializer.MODIFIERS_PROPERTY, pos);
+ if (node.getAST().apiLevel() == AST.JLS2) {
+ rewriteModifiers(node, Initializer.MODIFIERS_PROPERTY, pos);
+ } else {
+ rewriteModifiers2(node, Initializer.MODIFIERS2_PROPERTY, pos);
+ }
rewriteRequiredNode(node, Initializer.BODY_PROPERTY);
return false;
}
@@ -2053,10 +2180,12 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
return doVisitUnchangedChildren(node);
}
- rewriteOptionalQualifier(node, MethodInvocation.EXPRESSION_PROPERTY, node.getStartPosition());
+ int pos= rewriteOptionalQualifier(node, MethodInvocation.EXPRESSION_PROPERTY, node.getStartPosition());
+ if (node.getAST().apiLevel() >= AST.JLS3) {
+ pos= rewriteOptionalTypeParameters(node, MethodInvocation.TYPE_ARGUMENTS_PROPERTY, pos, " "); //$NON-NLS-1$
+ }
- int pos= rewriteRequiredNode(node, MethodInvocation.NAME_PROPERTY);
-
+ pos= rewriteRequiredNode(node, MethodInvocation.NAME_PROPERTY);
if (isChanged(node, MethodInvocation.ARGUMENTS_PROPERTY)) {
// eval position after opening parent
@@ -2103,7 +2232,11 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
public boolean visit(PackageDeclaration node) {
if (!hasChildrenChanges(node)) {
return doVisitUnchangedChildren(node);
- }
+ }
+ if (node.getAST().apiLevel() >= AST.JLS3) {
+ int pos= rewriteJavadoc(node, PackageDeclaration.JAVADOC_PROPERTY);
+ rewriteNodeList(node, PackageDeclaration.ANNOTATIONS_PROPERTY, pos, "", " "); //$NON-NLS-1$ //$NON-NLS-2$
+ }
rewriteRequiredNode(node, PackageDeclaration.NAME_PROPERTY);
return false;
@@ -2205,10 +2338,20 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
if (!hasChildrenChanges(node)) {
return doVisitUnchangedChildren(node);
}
-
- rewriteModifiers(node, SingleVariableDeclaration.MODIFIERS_PROPERTY, node.getStartPosition());
+ int pos= node.getStartPosition();
+ if (node.getAST().apiLevel() == AST.JLS2) {
+ rewriteModifiers(node, SingleVariableDeclaration.MODIFIERS_PROPERTY, pos);
+ } else {
+ rewriteModifiers2(node, SingleVariableDeclaration.MODIFIERS2_PROPERTY, pos);
+ }
rewriteRequiredNode(node, SingleVariableDeclaration.TYPE_PROPERTY);
- int pos= rewriteRequiredNode(node, SingleVariableDeclaration.NAME_PROPERTY);
+ if (node.getAST().apiLevel() >= AST.JLS3) {
+ if (isChanged(node, SingleVariableDeclaration.VARARGS_PROPERTY)) {
+ Assert.isTrue(false, "Modifications of property " + SingleVariableDeclaration.VARARGS_PROPERTY + " not supported yet"); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ }
+
+ pos= rewriteRequiredNode(node, SingleVariableDeclaration.NAME_PROPERTY);
int extraDims= rewriteExtraDimensions(node, SingleVariableDeclaration.EXTRA_DIMENSIONS_PROPERTY, pos);
if (extraDims > 0) {
@@ -2252,6 +2395,10 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
int pos= rewriteOptionalQualifier(node, SuperConstructorInvocation.EXPRESSION_PROPERTY, node.getStartPosition());
+ if (node.getAST().apiLevel() >= AST.JLS3) {
+ pos= rewriteOptionalTypeParameters(node, SuperConstructorInvocation.TYPE_ARGUMENTS_PROPERTY, pos, " "); //$NON-NLS-1$
+ }
+
if (isChanged(node, SuperConstructorInvocation.ARGUMENTS_PROPERTY)) {
// eval position after opening parent
try {
@@ -2287,9 +2434,20 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
return doVisitUnchangedChildren(node);
}
- rewriteOptionalQualifier(node, SuperMethodInvocation.QUALIFIER_PROPERTY, node.getStartPosition());
+ int pos= rewriteOptionalQualifier(node, SuperMethodInvocation.QUALIFIER_PROPERTY, node.getStartPosition());
- int pos= rewriteRequiredNode(node, SuperMethodInvocation.NAME_PROPERTY);
+ if (node.getAST().apiLevel() >= AST.JLS3) {
+ if (isChanged(node, SuperMethodInvocation.TYPE_ARGUMENTS_PROPERTY)) {
+ try {
+ pos= getScanner().getTokenEndOffset(ITerminalSymbols.TokenNameDOT, pos);
+ rewriteOptionalTypeParameters(node, SuperMethodInvocation.TYPE_ARGUMENTS_PROPERTY, pos, " "); //$NON-NLS-1$
+ } catch (CoreException e) {
+ handleException(e);
+ }
+ }
+ }
+
+ pos= rewriteRequiredNode(node, SuperMethodInvocation.NAME_PROPERTY);
if (isChanged(node, SuperMethodInvocation.ARGUMENTS_PROPERTY)) {
// eval position after opening parent
@@ -2434,8 +2592,11 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
if (!hasChildrenChanges(node)) {
return doVisitUnchangedChildren(node);
}
-
- rewriteRequiredNode(node, TypeDeclarationStatement.TYPE_DECLARATION_PROPERTY);
+ if (node.getAST().apiLevel() == AST.JLS2) {
+ rewriteRequiredNode(node, TypeDeclarationStatement.TYPE_DECLARATION_PROPERTY);
+ } else {
+ rewriteRequiredNode(node, TypeDeclarationStatement.DECLARATION_PROPERTY);
+ }
return false;
}
@@ -2460,8 +2621,13 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
}
// same code as FieldDeclaration
- rewriteModifiers(node, VariableDeclarationExpression.MODIFIERS_PROPERTY, node.getStartPosition());
- int pos= rewriteRequiredNode(node, VariableDeclarationExpression.TYPE_PROPERTY);
+ int pos= node.getStartPosition();
+ if (node.getAST().apiLevel() == AST.JLS2) {
+ rewriteModifiers(node, VariableDeclarationExpression.MODIFIERS_PROPERTY, pos);
+ } else {
+ rewriteModifiers2(node, VariableDeclarationExpression.MODIFIERS2_PROPERTY, pos);
+ }
+ pos= rewriteRequiredNode(node, VariableDeclarationExpression.TYPE_PROPERTY);
rewriteNodeList(node, VariableDeclarationExpression.FRAGMENTS_PROPERTY, pos, "", ", "); //$NON-NLS-1$ //$NON-NLS-2$
return false;
}
@@ -2502,9 +2668,14 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
return doVisitUnchangedChildren(node);
}
- // same code as FieldDeclaration
- rewriteModifiers(node, VariableDeclarationStatement.MODIFIERS_PROPERTY, node.getStartPosition());
- int pos= rewriteRequiredNode(node, VariableDeclarationStatement.TYPE_PROPERTY);
+ // same code as FieldDeclaration
+ int pos= node.getStartPosition();
+ if (node.getAST().apiLevel() == AST.JLS2) {
+ rewriteModifiers(node, VariableDeclarationStatement.MODIFIERS_PROPERTY, pos);
+ } else {
+ rewriteModifiers2(node, VariableDeclarationStatement.MODIFIERS2_PROPERTY, pos);
+ }
+ pos= rewriteRequiredNode(node, VariableDeclarationStatement.TYPE_PROPERTY);
rewriteNodeList(node, VariableDeclarationStatement.FRAGMENTS_PROPERTY, pos, "", ", "); //$NON-NLS-1$ //$NON-NLS-2$
return false;
@@ -2657,6 +2828,196 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
return false;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.AnnotationTypeDeclaration)
+ */
+ public boolean visit(AnnotationTypeDeclaration node) {
+ if (!hasChildrenChanges(node)) {
+ return doVisitUnchangedChildren(node);
+ }
+ Assert.isTrue(false, "Modifications in nodes of type " + node.getClass().getName() + " not supported yet"); //$NON-NLS-1$//$NON-NLS-2$
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration)
+ */
+ public boolean visit(AnnotationTypeMemberDeclaration node) {
+ if (!hasChildrenChanges(node)) {
+ return doVisitUnchangedChildren(node);
+ }
+ Assert.isTrue(false, "Modifications in nodes of type " + node.getClass().getName() + " not supported yet"); //$NON-NLS-1$//$NON-NLS-2$
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.EnhancedForStatement)
+ */
+ public boolean visit(EnhancedForStatement node) {
+ if (!hasChildrenChanges(node)) {
+ return doVisitUnchangedChildren(node);
+ }
+ rewriteRequiredNode(node, EnhancedForStatement.PARAMETER_PROPERTY);
+ int pos= rewriteRequiredNode(node, EnhancedForStatement.EXPRESSION_PROPERTY);
+
+ RewriteEvent bodyEvent= getEvent(node, EnhancedForStatement.BODY_PROPERTY);
+ if (bodyEvent != null && bodyEvent.getChangeKind() == RewriteEvent.REPLACED) {
+ int startOffset;
+ try {
+ startOffset= getScanner().getTokenEndOffset(ITerminalSymbols.TokenNameRPAREN, pos);
+ rewriteBodyNode(node, EnhancedForStatement.BODY_PROPERTY, startOffset, -1, getIndent(node.getStartPosition()), this.formatter.FOR_BLOCK); // body
+ } catch (CoreException e) {
+ handleException(e);
+ }
+ } else {
+ doVisit(node, EnhancedForStatement.BODY_PROPERTY, 0);
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.EnumConstantDeclaration)
+ */
+ public boolean visit(EnumConstantDeclaration node) {
+ if (!hasChildrenChanges(node)) {
+ return doVisitUnchangedChildren(node);
+ }
+ Assert.isTrue(false, "Modifications in nodes of type " + node.getClass().getName() + " not supported yet"); //$NON-NLS-1$//$NON-NLS-2$
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.EnumDeclaration)
+ */
+ public boolean visit(EnumDeclaration node) {
+ if (!hasChildrenChanges(node)) {
+ return doVisitUnchangedChildren(node);
+ }
+ Assert.isTrue(false, "Modifications in nodes of type " + node.getClass().getName() + " not supported yet"); //$NON-NLS-1$//$NON-NLS-2$
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.MarkerAnnotation)
+ */
+ public boolean visit(MarkerAnnotation node) {
+ if (!hasChildrenChanges(node)) {
+ return doVisitUnchangedChildren(node);
+ }
+ rewriteRequiredNode(node, MarkerAnnotation.TYPE_NAME_PROPERTY);
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.MemberValuePair)
+ */
+ public boolean visit(MemberValuePair node) {
+ if (!hasChildrenChanges(node)) {
+ return doVisitUnchangedChildren(node);
+ }
+ rewriteRequiredNode(node, MemberValuePair.NAME_PROPERTY);
+ rewriteRequiredNode(node, MemberValuePair.VALUE_PROPERTY);
+
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.Modifier)
+ */
+ public boolean visit(Modifier node) {
+ if (!hasChildrenChanges(node)) {
+ return doVisitUnchangedChildren(node);
+ }
+ String newText= getNewValue(node, Modifier.KEYWORD_PROPERTY).toString(); // type Modifier.ModifierKeyword
+ TextEditGroup group = getEditGroup(node, Modifier.KEYWORD_PROPERTY);
+ doTextReplace(node.getStartPosition(), node.getLength(), newText, group);
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.NormalAnnotation)
+ */
+ public boolean visit(NormalAnnotation node) {
+ if (!hasChildrenChanges(node)) {
+ return doVisitUnchangedChildren(node);
+ }
+ int pos= rewriteRequiredNode(node, NormalAnnotation.TYPE_NAME_PROPERTY);
+ if (isChanged(node, NormalAnnotation.VALUES_PROPERTY)) {
+ // eval position after opening parent
+ try {
+ int startOffset= getScanner().getTokenEndOffset(ITerminalSymbols.TokenNameLESS, pos);
+ rewriteNodeList(node, NormalAnnotation.VALUES_PROPERTY, startOffset, "", ", "); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (CoreException e) {
+ handleException(e);
+ }
+ } else {
+ doVisit(node, NormalAnnotation.VALUES_PROPERTY, 0);
+ }
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ParameterizedType)
+ */
+ public boolean visit(ParameterizedType node) {
+ if (!hasChildrenChanges(node)) {
+ return doVisitUnchangedChildren(node);
+ }
+ int pos= rewriteRequiredNode(node, ParameterizedType.TYPE_PROPERTY);
+ if (isChanged(node, ParameterizedType.TYPE_ARGUMENTS_PROPERTY)) {
+ // eval position after opening parent
+ try {
+ int startOffset= getScanner().getTokenEndOffset(ITerminalSymbols.TokenNameLESS, pos);
+ rewriteNodeList(node, ParameterizedType.TYPE_ARGUMENTS_PROPERTY, startOffset, "", ", "); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (CoreException e) {
+ handleException(e);
+ }
+ } else {
+ doVisit(node, ParameterizedType.TYPE_ARGUMENTS_PROPERTY, 0);
+ }
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.QualifiedType)
+ */
+ public boolean visit(QualifiedType node) {
+ if (!hasChildrenChanges(node)) {
+ return doVisitUnchangedChildren(node);
+ }
+ rewriteRequiredNode(node, QualifiedType.QUALIFIER_PROPERTY);
+ rewriteRequiredNode(node, QualifiedType.NAME_PROPERTY);
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.SingleMemberAnnotation)
+ */
+ public boolean visit(SingleMemberAnnotation node) {
+ if (!hasChildrenChanges(node)) {
+ return doVisitUnchangedChildren(node);
+ }
+ rewriteRequiredNode(node, SingleMemberAnnotation.TYPE_NAME_PROPERTY);
+ rewriteRequiredNode(node, SingleMemberAnnotation.VALUE_PROPERTY);
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TypeParameter)
+ */
+ public boolean visit(TypeParameter node) {
+ if (!hasChildrenChanges(node)) {
+ return doVisitUnchangedChildren(node);
+ }
+ int pos= rewriteRequiredNode(node, TypeParameter.NAME_PROPERTY);
+ if (isChanged(node, TypeParameter.TYPE_BOUNDS_PROPERTY)) {
+ rewriteNodeList(node, TypeParameter.TYPE_BOUNDS_PROPERTY, pos, " extends ", " & "); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ doVisit(node, TypeParameter.TYPE_BOUNDS_PROPERTY, 0);
+ }
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.WildcardType)
+ */
+ public boolean visit(WildcardType node) {
+ if (!hasChildrenChanges(node)) {
+ return doVisitUnchangedChildren(node);
+ }
+ Assert.isTrue(false, "Modifications in nodes of type " + node.getClass().getName() + " not supported yet"); //$NON-NLS-1$//$NON-NLS-2$
+ return false;
+ }
+
final void handleException(Throwable e) {
IllegalArgumentException runtimeException= new IllegalArgumentException("Document does not match the AST"); //$NON-NLS-1$
runtimeException.initCause(e);
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java
index 7544090ce8..df13455785 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java
@@ -9,14 +9,14 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.core.dom.rewrite;
-
+import java.util.Iterator;
import java.util.List;
-import org.eclipse.jface.text.Assert;
-
import org.eclipse.jdt.core.dom.*;
-public class ASTRewriteFlattener extends GenericVisitor {
+public class ASTRewriteFlattener extends ASTVisitor {
+
+
public static String asString(ASTNode node, RewriteEventStore store) {
ASTRewriteFlattener flattener= new ASTRewriteFlattener(store);
@@ -24,6 +24,7 @@ public class ASTRewriteFlattener extends GenericVisitor {
return flattener.getResult();
}
+ private final String EMPTY= ""; //$NON-NLS-1$
protected StringBuffer result;
private RewriteEventStore store;
@@ -48,11 +49,6 @@ public class ASTRewriteFlattener extends GenericVisitor {
public void reset() {
this.result.setLength(0);
}
-
- protected boolean visitNode(ASTNode node) {
- Assert.isTrue(false, "No implementation to flatten node: " + node.toString()); //$NON-NLS-1$
- return false;
- }
/**
* Appends the text representation of the given modifier flags, followed by a single space.
@@ -95,7 +91,7 @@ public class ASTRewriteFlattener extends GenericVisitor {
buf.append("transient "); //$NON-NLS-1$
}
}
-
+
protected List getChildList(ASTNode parent, StructuralPropertyDescriptor childProperty) {
return (List) getAttribute(parent, childProperty);
}
@@ -126,7 +122,7 @@ public class ASTRewriteFlattener extends GenericVisitor {
}
}
- protected void visitList(ASTNode parent, StructuralPropertyDescriptor childProperty, String separator, String lead) {
+ protected void visitList(ASTNode parent, StructuralPropertyDescriptor childProperty, String separator, String lead, String post) {
List list= getChildList(parent, childProperty);
if (!list.isEmpty()) {
this.result.append(lead);
@@ -136,6 +132,7 @@ public class ASTRewriteFlattener extends GenericVisitor {
}
((ASTNode) list.get(i)).accept(this);
}
+ this.result.append(post);
}
}
@@ -319,8 +316,14 @@ public class ASTRewriteFlattener extends GenericVisitor {
expression.accept(this);
this.result.append('.');
}
- this.result.append("new "); //$NON-NLS-1$
- getChildNode(node, ClassInstanceCreation.NAME_PROPERTY).accept(this);
+ this.result.append("new ");//$NON-NLS-1$
+ if (node.getAST().apiLevel() == AST.JLS2) {
+ getChildNode(node, ClassInstanceCreation.NAME_PROPERTY).accept(this);
+ } else {
+ visitList(node, ClassInstanceCreation.TYPE_ARGUMENTS_PROPERTY, String.valueOf(','), String.valueOf('<'), String.valueOf('>'));
+ getChildNode(node, ClassInstanceCreation.TYPE_PROPERTY).accept(this);
+ }
+
this.result.append('(');
visitList(node, ClassInstanceCreation.ARGUMENTS_PROPERTY, String.valueOf(','));
this.result.append(')');
@@ -360,6 +363,9 @@ public class ASTRewriteFlattener extends GenericVisitor {
* @see ASTVisitor#visit(ConstructorInvocation)
*/
public boolean visit(ConstructorInvocation node) {
+ if (node.getAST().apiLevel() >= AST.JLS3) {
+ visitList(node, ConstructorInvocation.TYPE_ARGUMENTS_PROPERTY, String.valueOf(','), String.valueOf('<'), String.valueOf('>'));
+ }
this.result.append("this("); //$NON-NLS-1$
visitList(node, ConstructorInvocation.ARGUMENTS_PROPERTY, String.valueOf(','));
this.result.append(");"); //$NON-NLS-1$
@@ -427,7 +433,11 @@ public class ASTRewriteFlattener extends GenericVisitor {
if (javadoc != null) {
javadoc.accept(this);
}
- printModifiers(getIntAttribute(node, FieldDeclaration.MODIFIERS_PROPERTY), this.result);
+ if (node.getAST().apiLevel() == AST.JLS2) {
+ printModifiers(getIntAttribute(node, FieldDeclaration.MODIFIERS_PROPERTY), this.result);
+ } else {
+ visitList(node, FieldDeclaration.MODIFIERS2_PROPERTY, String.valueOf(' '), EMPTY, String.valueOf(' '));
+ }
getChildNode(node, FieldDeclaration.TYPE_PROPERTY).accept(this);
this.result.append(' ');
visitList(node, FieldDeclaration.FRAGMENTS_PROPERTY, String.valueOf(','));
@@ -474,6 +484,11 @@ public class ASTRewriteFlattener extends GenericVisitor {
*/
public boolean visit(ImportDeclaration node) {
this.result.append("import "); //$NON-NLS-1$
+ if (node.getAST().apiLevel() >= AST.JLS3) {
+ if (getBooleanAttribute(node, ImportDeclaration.STATIC_PROPERTY)) {
+ this.result.append("static ");//$NON-NLS-1$
+ }
+ }
getChildNode(node, ImportDeclaration.NAME_PROPERTY).accept(this);
if (getBooleanAttribute(node, ImportDeclaration.ON_DEMAND_PROPERTY)) {
this.result.append(".*"); //$NON-NLS-1$
@@ -522,7 +537,11 @@ public class ASTRewriteFlattener extends GenericVisitor {
if (javadoc != null) {
javadoc.accept(this);
}
- printModifiers(getIntAttribute(node, Initializer.MODIFIERS_PROPERTY), this.result);
+ if (node.getAST().apiLevel() == AST.JLS2) {
+ printModifiers(getIntAttribute(node, Initializer.MODIFIERS_PROPERTY), this.result);
+ } else {
+ visitList(node, Initializer.MODIFIERS2_PROPERTY, String.valueOf(' '), EMPTY, String.valueOf(' '));
+ }
getChildNode(node, Initializer.BODY_PROPERTY).accept(this);
return false;
}
@@ -559,9 +578,24 @@ public class ASTRewriteFlattener extends GenericVisitor {
if (javadoc != null) {
javadoc.accept(this);
}
- printModifiers(getIntAttribute(node, MethodDeclaration.MODIFIERS_PROPERTY), this.result);
+ if (node.getAST().apiLevel() == AST.JLS2) {
+ printModifiers(getIntAttribute(node, MethodDeclaration.MODIFIERS_PROPERTY), this.result);
+ } else {
+ visitList(node, MethodDeclaration.MODIFIERS2_PROPERTY, String.valueOf(' '), EMPTY, String.valueOf(' '));
+ }
+
if (!getBooleanAttribute(node, MethodDeclaration.CONSTRUCTOR_PROPERTY)) {
- getChildNode(node, MethodDeclaration.RETURN_TYPE_PROPERTY).accept(this);
+ if (node.getAST().apiLevel() == AST.JLS2) {
+ getChildNode(node, MethodDeclaration.RETURN_TYPE_PROPERTY).accept(this);
+ } else {
+ ASTNode returnType = getChildNode(node, MethodDeclaration.RETURN_TYPE2_PROPERTY);
+ if (returnType != null) {
+ returnType.accept(this);
+ } else {
+ // methods really ought to have a return type
+ this.result.append("void");//$NON-NLS-1$
+ }
+ }
this.result.append(' ');
}
getChildNode(node, MethodDeclaration.NAME_PROPERTY).accept(this);
@@ -572,7 +606,7 @@ public class ASTRewriteFlattener extends GenericVisitor {
for (int i = 0; i < extraDims; i++) {
this.result.append("[]"); //$NON-NLS-1$
}
- visitList(node, MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY, String.valueOf(','), " throws "); //$NON-NLS-1$
+ visitList(node, MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY, String.valueOf(','), " throws ", EMPTY); //$NON-NLS-1$
ASTNode body= getChildNode(node, MethodDeclaration.BODY_PROPERTY);
if (body == null) {
this.result.append(';');
@@ -591,6 +625,10 @@ public class ASTRewriteFlattener extends GenericVisitor {
expression.accept(this);
this.result.append('.');
}
+ if (node.getAST().apiLevel() >= AST.JLS3) {
+ visitList(node, MethodInvocation.TYPE_ARGUMENTS_PROPERTY, String.valueOf(','), String.valueOf('<'), String.valueOf('>'));
+ }
+
getChildNode(node, MethodInvocation.NAME_PROPERTY).accept(this);
this.result.append('(');
visitList(node, MethodInvocation.ARGUMENTS_PROPERTY, String.valueOf(','));
@@ -618,6 +656,13 @@ public class ASTRewriteFlattener extends GenericVisitor {
* @see ASTVisitor#visit(PackageDeclaration)
*/
public boolean visit(PackageDeclaration node) {
+ if (node.getAST().apiLevel() >= AST.JLS3) {
+ ASTNode javadoc = getChildNode(node, PackageDeclaration.JAVADOC_PROPERTY);
+ if (javadoc != null) {
+ javadoc.accept(this);
+ }
+ visitList(node, PackageDeclaration.ANNOTATIONS_PROPERTY, String.valueOf(' '));
+ }
this.result.append("package "); //$NON-NLS-1$
getChildNode(node, PackageDeclaration.NAME_PROPERTY).accept(this);
this.result.append(';');
@@ -703,8 +748,17 @@ public class ASTRewriteFlattener extends GenericVisitor {
* @see ASTVisitor#visit(SingleVariableDeclaration)
*/
public boolean visit(SingleVariableDeclaration node) {
- printModifiers(getIntAttribute(node, SingleVariableDeclaration.MODIFIERS_PROPERTY), this.result);
+ if (node.getAST().apiLevel() == AST.JLS2) {
+ printModifiers(getIntAttribute(node, SingleVariableDeclaration.MODIFIERS_PROPERTY), this.result);
+ } else {
+ visitList(node, SingleVariableDeclaration.MODIFIERS2_PROPERTY, String.valueOf(' '), EMPTY, String.valueOf(' '));
+ }
getChildNode(node, SingleVariableDeclaration.TYPE_PROPERTY).accept(this);
+ if (node.getAST().apiLevel() >= AST.JLS3) {
+ if (getBooleanAttribute(node, SingleVariableDeclaration.VARARGS_PROPERTY)) {
+ this.result.append("...");//$NON-NLS-1$
+ }
+ }
this.result.append(' ');
getChildNode(node, SingleVariableDeclaration.NAME_PROPERTY).accept(this);
int extraDimensions= getIntAttribute(node, SingleVariableDeclaration.EXTRA_DIMENSIONS_PROPERTY);
@@ -736,6 +790,9 @@ public class ASTRewriteFlattener extends GenericVisitor {
expression.accept(this);
this.result.append('.');
}
+ if (node.getAST().apiLevel() >= AST.JLS3) {
+ visitList(node, SuperConstructorInvocation.TYPE_ARGUMENTS_PROPERTY, String.valueOf(','), String.valueOf('<'), String.valueOf('>'));
+ }
this.result.append("super("); //$NON-NLS-1$
visitList(node, SuperConstructorInvocation.ARGUMENTS_PROPERTY, String.valueOf(','));
this.result.append(");"); //$NON-NLS-1$
@@ -766,6 +823,9 @@ public class ASTRewriteFlattener extends GenericVisitor {
this.result.append('.');
}
this.result.append("super."); //$NON-NLS-1$
+ if (node.getAST().apiLevel() >= AST.JLS3) {
+ visitList(node, SuperMethodInvocation.TYPE_ARGUMENTS_PROPERTY, String.valueOf(','), String.valueOf('<'), String.valueOf('>'));
+ }
getChildNode(node, SuperMethodInvocation.NAME_PROPERTY).accept(this);
this.result.append('(');
visitList(node, SuperMethodInvocation.ARGUMENTS_PROPERTY, String.valueOf(','));
@@ -855,25 +915,39 @@ public class ASTRewriteFlattener extends GenericVisitor {
* @see ASTVisitor#visit(TypeDeclaration)
*/
public boolean visit(TypeDeclaration node) {
+ int apiLevel= node.getAST().apiLevel();
+
ASTNode javadoc= getChildNode(node, TypeDeclaration.JAVADOC_PROPERTY);
if (javadoc != null) {
javadoc.accept(this);
}
- printModifiers(getIntAttribute(node, TypeDeclaration.MODIFIERS_PROPERTY), this.result);
-
+
+ if (apiLevel == AST.JLS2) {
+ printModifiers(getIntAttribute(node, TypeDeclaration.MODIFIERS_PROPERTY), this.result);
+ } else {
+ visitList(node, TypeDeclaration.MODIFIERS2_PROPERTY, String.valueOf(' '), EMPTY, String.valueOf(' '));
+ }
+
boolean isInterface= getBooleanAttribute(node, TypeDeclaration.INTERFACE_PROPERTY);
this.result.append(isInterface ? "interface " : "class "); //$NON-NLS-1$ //$NON-NLS-2$
getChildNode(node, TypeDeclaration.NAME_PROPERTY).accept(this);
+ if (apiLevel >= AST.JLS3) {
+ visitList(node, TypeDeclaration.TYPE_PARAMETERS_PROPERTY, String.valueOf(','), String.valueOf('<'), String.valueOf('>'));
+ }
+
this.result.append(' ');
- ASTNode superclass= getChildNode(node, TypeDeclaration.SUPERCLASS_PROPERTY);
+
+ ChildPropertyDescriptor superClassProperty= (apiLevel == AST.JLS2) ? TypeDeclaration.SUPERCLASS_PROPERTY : TypeDeclaration.SUPERCLASS_TYPE_PROPERTY;
+ ASTNode superclass= getChildNode(node, superClassProperty);
if (superclass != null) {
this.result.append("extends "); //$NON-NLS-1$
superclass.accept(this);
this.result.append(' ');
}
+ ChildListPropertyDescriptor superInterfaceProperty= (apiLevel == AST.JLS2) ? TypeDeclaration.SUPER_INTERFACES_PROPERTY : TypeDeclaration.SUPER_INTERFACE_TYPES_PROPERTY;
String lead= isInterface ? "extends " : "implements "; //$NON-NLS-1$//$NON-NLS-2$
- visitList(node, TypeDeclaration.SUPER_INTERFACES_PROPERTY, String.valueOf(','), lead);
+ visitList(node, superInterfaceProperty, String.valueOf(','), lead, EMPTY);
this.result.append('{');
visitList(node, TypeDeclaration.BODY_DECLARATIONS_PROPERTY, null);
this.result.append('}');
@@ -884,7 +958,11 @@ public class ASTRewriteFlattener extends GenericVisitor {
* @see ASTVisitor#visit(TypeDeclarationStatement)
*/
public boolean visit(TypeDeclarationStatement node) {
- getChildNode(node, TypeDeclarationStatement.TYPE_DECLARATION_PROPERTY).accept(this);
+ if (node.getAST().apiLevel() == AST.JLS2) {
+ getChildNode(node, TypeDeclarationStatement.TYPE_DECLARATION_PROPERTY).accept(this);
+ } else {
+ getChildNode(node, TypeDeclarationStatement.DECLARATION_PROPERTY).accept(this);
+ }
return false;
}
@@ -901,7 +979,11 @@ public class ASTRewriteFlattener extends GenericVisitor {
* @see ASTVisitor#visit(VariableDeclarationExpression)
*/
public boolean visit(VariableDeclarationExpression node) {
- printModifiers(getIntAttribute(node, VariableDeclarationExpression.MODIFIERS_PROPERTY), this.result);
+ if (node.getAST().apiLevel() == AST.JLS2) {
+ printModifiers(getIntAttribute(node, VariableDeclarationExpression.MODIFIERS_PROPERTY), this.result);
+ } else {
+ visitList(node, VariableDeclarationExpression.MODIFIERS2_PROPERTY, String.valueOf(' '), EMPTY, String.valueOf(' '));
+ }
getChildNode(node, VariableDeclarationExpression.TYPE_PROPERTY).accept(this);
this.result.append(' ');
visitList(node, VariableDeclarationExpression.FRAGMENTS_PROPERTY, String.valueOf(','));
@@ -929,7 +1011,11 @@ public class ASTRewriteFlattener extends GenericVisitor {
* @see ASTVisitor#visit(VariableDeclarationStatement)
*/
public boolean visit(VariableDeclarationStatement node) {
- printModifiers(getIntAttribute(node, VariableDeclarationStatement.MODIFIERS_PROPERTY), this.result);
+ if (node.getAST().apiLevel() == AST.JLS2) {
+ printModifiers(getIntAttribute(node, VariableDeclarationStatement.MODIFIERS_PROPERTY), this.result);
+ } else {
+ visitList(node, VariableDeclarationStatement.MODIFIERS2_PROPERTY, String.valueOf(' '), EMPTY, String.valueOf(' '));
+ }
getChildNode(node, VariableDeclarationStatement.TYPE_PROPERTY).accept(this);
this.result.append(' ');
visitList(node, VariableDeclarationStatement.FRAGMENTS_PROPERTY, String.valueOf(','));
@@ -1031,4 +1117,208 @@ public class ASTRewriteFlattener extends GenericVisitor {
this.result.append(getAttribute(node, TextElement.TEXT_PROPERTY));
return false;
}
+ /*
+ * @see ASTVisitor#visit(AnnotationTypeDeclaration)
+ * @since 3.0
+ */
+ public boolean visit(AnnotationTypeDeclaration node) {
+ ASTNode javadoc= getChildNode(node, AnnotationTypeDeclaration.JAVADOC_PROPERTY);
+ if (javadoc != null) {
+ javadoc.accept(this);
+ }
+ visitList(node, AnnotationTypeDeclaration.MODIFIERS2_PROPERTY, String.valueOf(' '), EMPTY, String.valueOf(' '));
+ this.result.append("@interface ");//$NON-NLS-1$
+ getChildNode(node, AnnotationTypeDeclaration.NAME_PROPERTY).accept(this);
+ this.result.append('{');
+ visitList(node, AnnotationTypeDeclaration.BODY_DECLARATIONS_PROPERTY, EMPTY);
+ this.result.append('}');
+ return false;
+ }
+
+ /*
+ * @see ASTVisitor#visit(AnnotationTypeMemberDeclaration)
+ * @since 3.0
+ */
+ public boolean visit(AnnotationTypeMemberDeclaration node) {
+ ASTNode javadoc= getChildNode(node, AnnotationTypeMemberDeclaration.JAVADOC_PROPERTY);
+ if (javadoc != null) {
+ javadoc.accept(this);
+ }
+ visitList(node, AnnotationTypeMemberDeclaration.MODIFIERS2_PROPERTY, String.valueOf(' '), EMPTY, String.valueOf(' '));
+ getChildNode(node, AnnotationTypeMemberDeclaration.TYPE_PROPERTY).accept(this);
+ this.result.append(' ');
+ getChildNode(node, AnnotationTypeMemberDeclaration.NAME_PROPERTY).accept(this);
+ this.result.append("()");//$NON-NLS-1$
+ ASTNode def= getChildNode(node, AnnotationTypeMemberDeclaration.DEFAULT_PROPERTY);
+ if (def != null) {
+ this.result.append(" default ");//$NON-NLS-1$
+ def.accept(this);
+ }
+ this.result.append(';');
+ return false;
+ }
+
+ /*
+ * @see ASTVisitor#visit(EnhancedForStatement)
+ * @since 3.0
+ */
+ public boolean visit(EnhancedForStatement node) {
+ this.result.append("for (");//$NON-NLS-1$
+ getChildNode(node, EnhancedForStatement.PARAMETER_PROPERTY).accept(this);
+ this.result.append(':');
+ getChildNode(node, EnhancedForStatement.EXPRESSION_PROPERTY).accept(this);
+ this.result.append(')');
+ getChildNode(node, EnhancedForStatement.BODY_PROPERTY).accept(this);
+ return false;
+ }
+
+ /*
+ * @see ASTVisitor#visit(EnumConstantDeclaration)
+ * @since 3.0
+ */
+ public boolean visit(EnumConstantDeclaration node) {
+ if (getChildNode(node, EnumConstantDeclaration.JAVADOC_PROPERTY) != null) {
+ getChildNode(node, EnumConstantDeclaration.JAVADOC_PROPERTY).accept(this);
+ }
+ visitList(node, EnumConstantDeclaration.MODIFIERS2_PROPERTY, String.valueOf(' '), EMPTY, String.valueOf(' '));
+ getChildNode(node, EnumConstantDeclaration.NAME_PROPERTY).accept(this);
+ visitList(node, EnumConstantDeclaration.ARGUMENTS_PROPERTY, String.valueOf(','), String.valueOf('('), String.valueOf(')'));
+ visitList(node, EnumConstantDeclaration.BODY_DECLARATIONS_PROPERTY, String.valueOf(' '), String.valueOf('{'), String.valueOf('}'));
+ return false;
+ }
+
+ /*
+ * @see ASTVisitor#visit(EnumDeclaration)
+ * @since 3.0
+ */
+ public boolean visit(EnumDeclaration node) {
+ if (getChildNode(node, EnumDeclaration.JAVADOC_PROPERTY) != null) {
+ getChildNode(node, EnumDeclaration.JAVADOC_PROPERTY).accept(this);
+ }
+ visitList(node, EnumDeclaration.MODIFIERS2_PROPERTY, String.valueOf(' '), EMPTY, String.valueOf(' '));
+ this.result.append("enum ");//$NON-NLS-1$
+ getChildNode(node, EnumDeclaration.NAME_PROPERTY).accept(this);
+ this.result.append(' ');
+ visitList(node, EnumDeclaration.SUPER_INTERFACE_TYPES_PROPERTY, String.valueOf(','), "implements ", EMPTY); //$NON-NLS-1$
+
+ this.result.append('{');
+ BodyDeclaration prev = null;
+ for (Iterator it = getChildList(node, EnumDeclaration.BODY_DECLARATIONS_PROPERTY).iterator(); it.hasNext(); ) {
+ BodyDeclaration d = (BodyDeclaration) it.next();
+ if (prev instanceof EnumConstantDeclaration) {
+ // enum constant declarations do not include punctuation
+ if (d instanceof EnumConstantDeclaration) {
+ // enum constant declarations are separated by commas
+ this.result.append(',');
+ } else {
+ // semicolon separates last enum constant declaration from
+ // first class body declarations
+ this.result.append(' ');
+ }
+ }
+ d.accept(this);
+ }
+ this.result.append('}');
+ return false;
+ }
+ /*
+ * @see ASTVisitor#visit(MarkerAnnotation)
+ * @since 3.0
+ */
+ public boolean visit(MarkerAnnotation node) {
+ this.result.append('@');
+ getChildNode(node, MarkerAnnotation.TYPE_NAME_PROPERTY).accept(this);
+ return false;
+ }
+
+ /*
+ * @see ASTVisitor#visit(MemberValuePair)
+ * @since 3.0
+ */
+ public boolean visit(MemberValuePair node) {
+ getChildNode(node, MemberValuePair.NAME_PROPERTY).accept(this);
+ this.result.append('=');
+ getChildNode(node, MemberValuePair.VALUE_PROPERTY).accept(this);
+ return false;
+ }
+ /*
+ * @see ASTVisitor#visit(Modifier)
+ * @since 3.0
+ */
+ public boolean visit(Modifier node) {
+ this.result.append(getAttribute(node, Modifier.KEYWORD_PROPERTY).toString());
+ return false;
+ }
+
+ /*
+ * @see ASTVisitor#visit(NormalAnnotation)
+ * @since 3.0
+ */
+ public boolean visit(NormalAnnotation node) {
+ this.result.append('@');
+ getChildNode(node, NormalAnnotation.TYPE_NAME_PROPERTY).accept(this);
+ this.result.append('(');
+ visitList(node, NormalAnnotation.VALUES_PROPERTY, ", "); //$NON-NLS-1$
+ this.result.append(')');
+ return false;
+ }
+ /*
+ * @see ASTVisitor#visit(ParameterizedType)
+ * @since 3.0
+ */
+ public boolean visit(ParameterizedType node) {
+ getChildNode(node, ParameterizedType.TYPE_PROPERTY).accept(this);
+ this.result.append('<');
+ visitList(node, ParameterizedType.TYPE_ARGUMENTS_PROPERTY, ", "); //$NON-NLS-1$
+ this.result.append('>');
+ return false;
+ }
+
+ /*
+ * @see ASTVisitor#visit(QualifiedType)
+ * @since 3.0
+ */
+ public boolean visit(QualifiedType node) {
+ getChildNode(node, QualifiedType.QUALIFIER_PROPERTY).accept(this);
+ this.result.append('.');
+ getChildNode(node, QualifiedType.NAME_PROPERTY).accept(this);
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.SingleMemberAnnotation)
+ */
+ public boolean visit(SingleMemberAnnotation node) {
+ this.result.append('@');
+ getChildNode(node, SingleMemberAnnotation.TYPE_NAME_PROPERTY).accept(this);
+ this.result.append('(');
+ getChildNode(node, SingleMemberAnnotation.VALUE_PROPERTY).accept(this);
+ this.result.append(')');
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TypeParameter)
+ */
+ public boolean visit(TypeParameter node) {
+ getChildNode(node, TypeParameter.NAME_PROPERTY).accept(this);
+ visitList(node, TypeParameter.TYPE_BOUNDS_PROPERTY, " & ", " extends ", EMPTY); //$NON-NLS-1$ //$NON-NLS-2$
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.WildcardType)
+ */
+ public boolean visit(WildcardType node) {
+ this.result.append('?');
+ ASTNode bound = getChildNode(node, WildcardType.BOUND_PROPERTY);
+ if (bound != null) {
+ if (getBooleanAttribute(node, WildcardType.BOUND_PROPERTY)) {
+ this.result.append(" extends ");//$NON-NLS-1$
+ } else {
+ this.result.append(" super ");//$NON-NLS-1$
+ }
+ bound.accept(this);
+ }
+ return false;
+ }
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java
index b1476ee7d8..544f370787 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java
@@ -14,6 +14,12 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.InsertEdit;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.text.edits.TextEdit;
+
import org.eclipse.jface.text.Assert;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPositionCategoryException;
@@ -21,20 +27,15 @@ import org.eclipse.jface.text.DefaultPositionUpdater;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.Position;
-import org.eclipse.text.edits.DeleteEdit;
-import org.eclipse.text.edits.InsertEdit;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.text.edits.TextEdit;
-
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.ToolFactory;
+import org.eclipse.jdt.core.formatter.CodeFormatter;
+import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
+
import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.Block;
import org.eclipse.jdt.core.dom.Expression;
import org.eclipse.jdt.core.dom.Statement;
-import org.eclipse.jdt.core.formatter.CodeFormatter;
-import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
/* package */ class ASTRewriteFormatter {
@@ -327,7 +328,8 @@ import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
// not supported:
return null;
default:
- Assert.isTrue(false, "Node type not covered: " + node.getClass().getName()); //$NON-NLS-1$
+ //Assert.isTrue(false, "Node type not covered: " + node.getClass().getName()); //$NON-NLS-1$
+ // TODO: fill in the 1.5 nodes
return null;
}
}
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java
index 0b05b4159a..a0cf76cf0b 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java
@@ -11,15 +11,18 @@
package org.eclipse.jdt.internal.eval;
import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
+import org.eclipse.jdt.internal.compiler.ast.CastExpression;
+import org.eclipse.jdt.internal.compiler.ast.Expression;
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
-import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
+import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding;
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
+import org.eclipse.jdt.internal.compiler.lookup.TagBits;
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
@@ -38,9 +41,9 @@ public void generateCode(
boolean valueRequired) {
int pc = codeStream.position;
- ReferenceBinding allocatedType = this.binding.declaringClass;
+ ReferenceBinding allocatedType = this.codegenBinding.declaringClass;
- if (this.binding.canBeSeenBy(allocatedType, this, currentScope)) {
+ if (this.codegenBinding.canBeSeenBy(allocatedType, this, currentScope)) {
codeStream.new_(allocatedType);
if (valueRequired) {
codeStream.dup();
@@ -70,22 +73,22 @@ public void generateCode(
this);
}
// invoke constructor
- codeStream.invokespecial(this.binding);
+ codeStream.invokespecial(this.codegenBinding);
} else {
// private emulation using reflect
- ((CodeSnippetCodeStream) codeStream).generateEmulationForConstructor(currentScope, this.binding);
+ ((CodeSnippetCodeStream) codeStream).generateEmulationForConstructor(currentScope, this.codegenBinding);
// generate arguments
if (this.arguments != null) {
int argsLength = this.arguments.length;
codeStream.generateInlinedValue(argsLength);
- codeStream.newArray(currentScope, new ArrayBinding(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT), 1));
+ codeStream.newArray(currentScope, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
codeStream.dup();
for (int i = 0; i < argsLength; i++) {
codeStream.generateInlinedValue(i);
this.arguments[i].generateCode(currentScope, codeStream, true);
- TypeBinding parameterBinding = this.binding.parameters[i];
+ TypeBinding parameterBinding = this.codegenBinding.parameters[i];
if (parameterBinding.isBaseType() && parameterBinding != NullBinding) {
- ((CodeSnippetCodeStream)codeStream).generateObjectWrapperForType(this.binding.parameters[i]);
+ ((CodeSnippetCodeStream)codeStream).generateObjectWrapperForType(this.codegenBinding.parameters[i]);
}
codeStream.aastore();
if (i < argsLength - 1) {
@@ -94,7 +97,7 @@ public void generateCode(
}
} else {
codeStream.generateInlinedValue(0);
- codeStream.newArray(currentScope, new ArrayBinding(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT), 1));
+ codeStream.newArray(currentScope, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
}
((CodeSnippetCodeStream) codeStream).invokeJavaLangReflectConstructorNewInstance();
codeStream.checkcast(allocatedType);
@@ -112,7 +115,10 @@ public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, Fl
// not supported yet
}
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
- // do nothing
+ if (!flowInfo.isReachable()) return;
+
+ // if constructor from parameterized type got found, use the original constructor at codegen time
+ this.codegenBinding = this.binding.original();
}
public TypeBinding resolveType(BlockScope scope) {
// Propagate the type checking to the arguments, and check if the constructor is defined.
@@ -120,13 +126,19 @@ public TypeBinding resolveType(BlockScope scope) {
this.resolvedType = this.type.resolveType(scope); // will check for null after args are resolved
// buffering the arguments' types
+ boolean argsContainCast = false;
TypeBinding[] argumentTypes = NoParameters;
if (this.arguments != null) {
boolean argHasError = false;
int length = this.arguments.length;
argumentTypes = new TypeBinding[length];
for (int i = 0; i < length; i++) {
- if ((argumentTypes[i] = this.arguments[i].resolveType(scope)) == null) {
+ Expression argument = this.arguments[i];
+ if (argument instanceof CastExpression) {
+ argument.bits |= IgnoreNeedForCastCheckMASK; // will check later on
+ argsContainCast = true;
+ }
+ if ((argumentTypes[i] = argument.resolveType(scope)) == null) {
argHasError = true;
}
}
@@ -141,6 +153,10 @@ public TypeBinding resolveType(BlockScope scope) {
scope.problemReporter().cannotInstantiate(this.type, this.resolvedType);
return this.resolvedType;
}
+ if ((this.resolvedType.tagBits & TagBits.HasWildcard) != 0) {
+ scope.problemReporter().cannotInstantiateWithWildcards(type, (ParameterizedTypeBinding)this.resolvedType);
+ return this.resolvedType;
+ }
ReferenceBinding allocatedType = (ReferenceBinding) this.resolvedType;
if (!(this.binding = scope.getConstructor(allocatedType, argumentTypes, this)).isValidBinding()) {
if (this.binding instanceof ProblemMethodBinding
@@ -183,11 +199,25 @@ public TypeBinding resolveType(BlockScope scope) {
if (isMethodUseDeprecated(this.binding, scope)) {
scope.problemReporter().deprecatedMethod(this.binding, this);
}
- if (this.arguments != null) {
- for (int i = 0; i < this.arguments.length; i++) {
- this.arguments[i].implicitWidening(this.binding.parameters[i], argumentTypes[i]);
+ boolean warnRawArgs = false;
+ if (arguments != null) {
+ for (int i = 0; i < arguments.length; i++) {
+ TypeBinding parameterType = binding.parameters[i];
+ TypeBinding argumentType = argumentTypes[i];
+ arguments[i].computeConversion(scope, parameterType, argumentType);
+ if (argumentType != parameterType && argumentType.isRawType() && parameterType.isParameterizedType()) {
+ warnRawArgs = true;
+ }
+ }
+ if (argsContainCast) {
+ CastExpression.checkNeedForArgumentCasts(scope, null, allocatedType, binding, this.arguments, argumentTypes, this);
}
}
+ if (allocatedType.isRawType() && this.binding.hasSubstitutedParameters()) {
+ scope.problemReporter().unsafeRawInvocation(this, allocatedType, this.binding);
+ } else if (warnRawArgs) {
+ scope.problemReporter().unsafeInvocationWithRawArguments(this, allocatedType, this.binding, argumentTypes);
+ }
return allocatedType;
}
}
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetCodeStream.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetCodeStream.java
index 45653e5157..478a4f6681 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetCodeStream.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetCodeStream.java
@@ -24,6 +24,7 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
public class CodeSnippetCodeStream extends CodeStream {
static InvocationSite NO_INVOCATION_SITE =
new InvocationSite(){
+ public TypeBinding[] genericTypeArguments() { return null; }
public boolean isSuperAccess(){ return false; }
public boolean isTypeAccess() { return false; }
public void setActualReceiverType(ReferenceBinding receiverType) {}
@@ -37,7 +38,7 @@ public class CodeSnippetCodeStream extends CodeStream {
* @param classFile org.eclipse.jdt.internal.compiler.ClassFile
*/
public CodeSnippetCodeStream(org.eclipse.jdt.internal.compiler.ClassFile classFile) {
- super(classFile);
+ super(classFile, JDK1_4);
}
protected void checkcast(int baseId) {
this.countLabels = 0;
@@ -98,7 +99,7 @@ public void generateEmulationForConstructor(Scope scope, MethodBinding methodBin
this.invokeClassForName();
int paramLength = methodBinding.parameters.length;
this.generateInlinedValue(paramLength);
- this.newArray(scope, new ArrayBinding(scope.getType(TypeConstants.JAVA_LANG_CLASS), 1));
+ this.newArray(scope, scope.createArrayType(scope.getType(TypeConstants.JAVA_LANG_CLASS, 3), 1));
if (paramLength > 0) {
this.dup();
for (int i = 0; i < paramLength; i++) {
@@ -154,7 +155,7 @@ public void generateEmulationForMethod(Scope scope, MethodBinding methodBinding)
this.ldc(String.valueOf(methodBinding.selector));
int paramLength = methodBinding.parameters.length;
this.generateInlinedValue(paramLength);
- this.newArray(scope, new ArrayBinding(scope.getType(TypeConstants.JAVA_LANG_CLASS), 1));
+ this.newArray(scope, scope.createArrayType(scope.getType(TypeConstants.JAVA_LANG_CLASS, 3), 1));
if (paramLength > 0) {
this.dup();
for (int i = 0; i < paramLength; i++) {
@@ -223,7 +224,7 @@ public void generateObjectWrapperForType(TypeBinding valueType) {
wrapperTypeCompoundName = new char[][] {"java".toCharArray(), "lang".toCharArray(), "Long".toCharArray()}; //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-3$
break;
}
- TypeBinding wrapperType = this.methodDeclaration.scope.getType(wrapperTypeCompoundName);
+ TypeBinding wrapperType = this.methodDeclaration.scope.getType(wrapperTypeCompoundName, wrapperTypeCompoundName.length);
new_(wrapperType);
if (valueType.id == T_long || valueType.id == T_double) {
dup_x2();
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetFieldReference.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetFieldReference.java
index c95c97573c..37e98ca868 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetFieldReference.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetFieldReference.java
@@ -20,10 +20,12 @@ import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
+import org.eclipse.jdt.internal.compiler.lookup.ParameterizedFieldBinding;
import org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding;
import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
+import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
public class CodeSnippetFieldReference extends FieldReference implements ProblemReasons, EvaluationConstants {
@@ -131,7 +133,7 @@ public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeS
}
int operationTypeID;
if ((operationTypeID = this.implicitConversion >> 4) == T_String) {
- codeStream.generateStringAppend(currentScope, null, expression);
+ codeStream.generateStringConcatenationAppend(currentScope, null, expression);
} else {
// promote the array reference to the suitable operation type
codeStream.generateImplicitConversion(this.implicitConversion);
@@ -169,7 +171,7 @@ public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeS
}
int operationTypeID;
if ((operationTypeID = this.implicitConversion >> 4) == T_String) {
- codeStream.generateStringAppend(currentScope, null, expression);
+ codeStream.generateStringConcatenationAppend(currentScope, null, expression);
} else {
// promote the array reference to the suitable operation type
codeStream.generateImplicitConversion(this.implicitConversion);
@@ -280,42 +282,25 @@ public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream
/*
* No need to emulate access to protected fields since not implicitly accessed
*/
-public void manageSyntheticReadAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo){
+public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo, boolean isReadAccess){
// The private access will be managed through the code generation
if (!flowInfo.isReachable()) return;
-
- // if the binding declaring class is not visible, need special action
- // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
- // NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
- if (this.delegateThis != null) {
- if (this.binding.declaringClass != this.delegateThis.type
- && this.binding.declaringClass != null
- && this.binding.constant == NotAConstant
- && ((currentScope.environment().options.targetJDK >= ClassFileConstants.JDK1_2
- && !this.binding.isStatic()
- && this.binding.declaringClass.id != T_Object) // no change for Object fields (if there was any)
- || !this.binding.declaringClass.canBeSeenBy(currentScope))){
- this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(this.binding, (ReferenceBinding)this.delegateThis.type);
- }
- } else if (this.binding.declaringClass != this.receiverType
- && !this.receiverType.isArrayType()
- && this.binding.declaringClass != null // array.length
- && this.binding.constant == NotAConstant
- && ((currentScope.environment().options.targetJDK >= ClassFileConstants.JDK1_2
- && this.binding.declaringClass.id != T_Object) //no change for Object fields (in case there was)
- || !this.binding.declaringClass.canBeSeenBy(currentScope))){
- this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(this.binding, (ReferenceBinding) this.receiverType);
+ // if field from parameterized type got found, use the original field at codegen time
+ if (this.binding instanceof ParameterizedFieldBinding) {
+ ParameterizedFieldBinding parameterizedField = (ParameterizedFieldBinding) this.binding;
+ this.codegenBinding = parameterizedField.originalField;
+ // extra cast needed if field type was type variable
+ if (this.codegenBinding.type.isTypeVariable()) {
+ TypeVariableBinding variableReturnType = (TypeVariableBinding) this.codegenBinding.type;
+ if (variableReturnType.firstBound != parameterizedField.type) { // no need for extra cast if same as first bound anyway
+ this.genericCast = parameterizedField.type.erasure();
+ }
+ }
+ } else {
+ this.codegenBinding = this.binding;
}
-}
-/*
- * No need to emulate access to protected fields since not implicitly accessed
- */
-public void manageSyntheticWriteAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo){
- // The private access will be managed through the code generation
-
- if (!flowInfo.isReachable()) return;
-
+
// if the binding declaring class is not visible, need special action
// for runtime compatibility on 1.2 VMs : change the declaring class of the binding
// NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
@@ -327,7 +312,7 @@ public void manageSyntheticWriteAccessIfNecessary(BlockScope currentScope, FlowI
&& !this.binding.isStatic()
&& this.binding.declaringClass.id != T_Object) // no change for Object fields (if there was any)
|| !this.binding.declaringClass.canBeSeenBy(currentScope))){
- this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(this.binding, (ReferenceBinding)this.delegateThis.type);
+ this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(this.codegenBinding, (ReferenceBinding)this.delegateThis.type.erasure());
}
} else if (this.binding.declaringClass != this.receiverType
&& !this.receiverType.isArrayType()
@@ -336,7 +321,7 @@ public void manageSyntheticWriteAccessIfNecessary(BlockScope currentScope, FlowI
&& ((currentScope.environment().options.targetJDK >= ClassFileConstants.JDK1_2
&& this.binding.declaringClass.id != T_Object) //no change for Object fields (in case there was)
|| !this.binding.declaringClass.canBeSeenBy(currentScope))){
- this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(this.binding, (ReferenceBinding) this.receiverType);
+ this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(this.codegenBinding, (ReferenceBinding) this.receiverType.erasure());
}
}
public TypeBinding resolveType(BlockScope scope) {
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java
index 3ee1b92e29..540ea77536 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java
@@ -15,7 +15,6 @@ import org.eclipse.jdt.internal.compiler.ast.NameReference;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
-import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
import org.eclipse.jdt.internal.compiler.lookup.BindingIds;
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
@@ -25,6 +24,7 @@ import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
+import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
public class CodeSnippetMessageSend extends MessageSend implements ProblemReasons, EvaluationConstants {
EvaluationContext evaluationContext;
@@ -49,9 +49,9 @@ public void generateCode(
int pc = codeStream.position;
- if (this.binding.canBeSeenBy(this.receiverType, this, currentScope)) {
+ if (this.codegenBinding.canBeSeenBy(this.receiverType, this, currentScope)) {
// generate receiver/enclosing instance access
- boolean isStatic = this.binding.isStatic();
+ boolean isStatic = this.codegenBinding.isStatic();
// outer access ?
if (!isStatic && ((this.bits & DepthMASK) != 0)) {
// outer method can be reached through emulation
@@ -74,22 +74,22 @@ public void generateCode(
}
// actual message invocation
if (isStatic) {
- codeStream.invokestatic(this.binding);
+ codeStream.invokestatic(this.codegenBinding);
} else {
if (this.receiver.isSuper()) {
- codeStream.invokespecial(this.binding);
+ codeStream.invokespecial(this.codegenBinding);
} else {
- if (this.binding.declaringClass.isInterface()) {
- codeStream.invokeinterface(this.binding);
+ if (this.codegenBinding.declaringClass.isInterface()) {
+ codeStream.invokeinterface(this.codegenBinding);
} else {
- codeStream.invokevirtual(this.binding);
+ codeStream.invokevirtual(this.codegenBinding);
}
}
}
} else {
- ((CodeSnippetCodeStream) codeStream).generateEmulationForMethod(currentScope, this.binding);
+ ((CodeSnippetCodeStream) codeStream).generateEmulationForMethod(currentScope, this.codegenBinding);
// generate receiver/enclosing instance access
- boolean isStatic = this.binding.isStatic();
+ boolean isStatic = this.codegenBinding.isStatic();
// outer access ?
if (!isStatic && ((this.bits & DepthMASK) != 0)) {
// not supported yet
@@ -105,14 +105,14 @@ public void generateCode(
if (this.arguments != null) {
int argsLength = this.arguments.length;
codeStream.generateInlinedValue(argsLength);
- codeStream.newArray(currentScope, new ArrayBinding(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT), 1));
+ codeStream.newArray(currentScope, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
codeStream.dup();
for (int i = 0; i < argsLength; i++) {
codeStream.generateInlinedValue(i);
this.arguments[i].generateCode(currentScope, codeStream, true);
- TypeBinding parameterBinding = this.binding.parameters[i];
+ TypeBinding parameterBinding = this.codegenBinding.parameters[i];
if (parameterBinding.isBaseType() && parameterBinding != NullBinding) {
- ((CodeSnippetCodeStream)codeStream).generateObjectWrapperForType(this.binding.parameters[i]);
+ ((CodeSnippetCodeStream)codeStream).generateObjectWrapperForType(this.codegenBinding.parameters[i]);
}
codeStream.aastore();
if (i < argsLength - 1) {
@@ -121,13 +121,13 @@ public void generateCode(
}
} else {
codeStream.generateInlinedValue(0);
- codeStream.newArray(currentScope, new ArrayBinding(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT), 1));
+ codeStream.newArray(currentScope, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
}
((CodeSnippetCodeStream) codeStream).invokeJavaLangReflectMethodInvoke();
// convert the return value to the appropriate type for primitive types
- if (this.binding.returnType.isBaseType()) {
- int typeID = this.binding.returnType.id;
+ if (this.codegenBinding.returnType.isBaseType()) {
+ int typeID = this.codegenBinding.returnType.id;
if (typeID == T_void) {
// remove the null from the stack
codeStream.pop();
@@ -135,7 +135,7 @@ public void generateCode(
((CodeSnippetCodeStream) codeStream).checkcast(typeID);
((CodeSnippetCodeStream) codeStream).getBaseTypeValue(typeID);
} else {
- codeStream.checkcast(this.binding.returnType);
+ codeStream.checkcast(this.codegenBinding.returnType);
}
}
// operation on the returned value
@@ -144,7 +144,7 @@ public void generateCode(
codeStream.generateImplicitConversion(this.implicitConversion);
} else {
// pop return value if any
- switch (this.binding.returnType.id) {
+ switch (this.codegenBinding.returnType.id) {
case T_long :
case T_double :
codeStream.pop2();
@@ -155,11 +155,24 @@ public void generateCode(
codeStream.pop();
}
}
+ // TODO (philippe) need to revise codegen to include genericCast
codeStream.recordPositionsFrom(pc, this.sourceStart);
}
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
if (!flowInfo.isReachable()) return;
+
+ // if method from parameterized type got found, use the original method at codegen time
+ this.codegenBinding = this.binding.original();
+ if (this.codegenBinding != this.binding) {
+ // extra cast needed if method return type was type variable
+ if (this.codegenBinding.returnType.isTypeVariable()) {
+ TypeVariableBinding variableReturnType = (TypeVariableBinding) this.codegenBinding.returnType;
+ if (variableReturnType.firstBound != this.binding.returnType) { // no need for extra cast if same as first bound anyway
+ this.genericCast = this.binding.returnType;
+ }
+ }
+ }
// if the binding declaring class is not visible, need special action
// for runtime compatibility on 1.2 VMs : change the declaring class of the binding
@@ -168,10 +181,10 @@ public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo f
if (this.binding.declaringClass != this.qualifyingType
&& !this.qualifyingType.isArrayType()
&& ((currentScope.environment().options.targetJDK >= ClassFileConstants.JDK1_2
- && (!this.receiver.isImplicitThis() || !this.binding.isStatic())
+ && (!this.receiver.isImplicitThis() || !this.codegenBinding.isStatic())
&& this.binding.declaringClass.id != T_Object) // no change for Object methods
|| !this.binding.declaringClass.canBeSeenBy(currentScope))) {
- this.codegenBinding = currentScope.enclosingSourceType().getUpdatedMethodBinding(this.binding, (ReferenceBinding) this.qualifyingType);
+ this.codegenBinding = currentScope.enclosingSourceType().getUpdatedMethodBinding(this.codegenBinding, (ReferenceBinding) this.qualifyingType.erasure());
}
}
public TypeBinding resolveType(BlockScope scope) {
@@ -263,7 +276,7 @@ public TypeBinding resolveType(BlockScope scope) {
}
if (this.arguments != null)
for (int i = 0; i < this.arguments.length; i++)
- this.arguments[i].implicitWidening(this.binding.parameters[i], argumentTypes[i]);
+ this.arguments[i].computeConversion(scope, this.binding.parameters[i], argumentTypes[i]);
//-------message send that are known to fail at compile time-----------
if (this.binding.isAbstract()) {
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java
index d0dbf1ef23..03f3cdb81a 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java
@@ -91,7 +91,7 @@ protected void consumeClassDeclaration() {
/* recovery */
recordLastStatementIfNeeded();
}
-protected void consumeClassHeaderName() {
+protected void consumeClassHeaderName1() {
// ClassHeaderName ::= Modifiersopt 'class' 'Identifier'
TypeDeclaration typeDecl;
if (this.nestedMethod[this.nestedType] == 0) {
@@ -174,7 +174,7 @@ protected void consumeFieldAccess(boolean isSuperAccess) {
this.expressionStack[this.expressionPtr] = fr;
}
}
-protected void consumeInterfaceHeaderName() {
+protected void consumeInterfaceHeaderName1() {
// InterfaceHeaderName ::= Modifiersopt 'interface' 'Identifier'
TypeDeclaration typeDecl;
if (this.nestedMethod[this.nestedType] == 0) {
@@ -500,7 +500,7 @@ protected CompilationUnitDeclaration endParse(int act) {
}
consumeClassBodyDeclarationsopt();
consumeClassDeclaration();
- consumeTypeDeclarationsopt();
+ consumeInternalCompilationUnitWithTypes();
consumeCompilationUnit();
}
this.lastAct = ACCEPT_ACTION;
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetQualifiedNameReference.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetQualifiedNameReference.java
index f6895ec196..42fe22b611 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetQualifiedNameReference.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetQualifiedNameReference.java
@@ -58,23 +58,23 @@ public TypeBinding checkFieldAccess(BlockScope scope) {
}
public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) {
- generateReadSequence(currentScope, codeStream);
- if (this.lastFieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
+ FieldBinding lastFieldBinding = generateReadSequence(currentScope, codeStream);
+ if (lastFieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
// the last field access is a write access
assignment.expression.generateCode(currentScope, codeStream, true);
- fieldStore(codeStream, this.lastFieldBinding, null, valueRequired);
+ fieldStore(codeStream, lastFieldBinding, null, valueRequired);
} else {
- ((CodeSnippetCodeStream) codeStream).generateEmulationForField(this.lastFieldBinding);
+ ((CodeSnippetCodeStream) codeStream).generateEmulationForField(lastFieldBinding);
codeStream.swap();
assignment.expression.generateCode(currentScope, codeStream, true);
if (valueRequired) {
- if ((this.lastFieldBinding.type == LongBinding) || (this.lastFieldBinding.type == DoubleBinding)) {
+ if ((lastFieldBinding.type == LongBinding) || (lastFieldBinding.type == DoubleBinding)) {
codeStream.dup2_x2();
} else {
codeStream.dup_x2();
}
}
- ((CodeSnippetCodeStream) codeStream).generateEmulatedWriteAccessForField(this.lastFieldBinding);
+ ((CodeSnippetCodeStream) codeStream).generateEmulatedWriteAccessForField(lastFieldBinding);
}
if (valueRequired) {
codeStream.generateImplicitConversion(assignment.implicitConversion);
@@ -87,34 +87,34 @@ public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean
codeStream.generateConstant(this.constant, this.implicitConversion);
}
} else {
- generateReadSequence(currentScope, codeStream);
+ FieldBinding lastFieldBinding = generateReadSequence(currentScope, codeStream);
if (valueRequired) {
- if (this.lastFieldBinding.declaringClass == null) { // array length
+ if (lastFieldBinding.declaringClass == null) { // array length
codeStream.arraylength();
codeStream.generateImplicitConversion(this.implicitConversion);
} else {
- if (this.lastFieldBinding.constant != NotAConstant) {
- if (!this.lastFieldBinding.isStatic()){
+ if (lastFieldBinding.constant != NotAConstant) {
+ if (!lastFieldBinding.isStatic()){
codeStream.invokeObjectGetClass();
codeStream.pop();
}
// inline the last field constant
- codeStream.generateConstant(this.lastFieldBinding.constant, this.implicitConversion);
+ codeStream.generateConstant(lastFieldBinding.constant, this.implicitConversion);
} else {
- if (this.lastFieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
- if (this.lastFieldBinding.isStatic()) {
- codeStream.getstatic(this.lastFieldBinding);
+ if (lastFieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
+ if (lastFieldBinding.isStatic()) {
+ codeStream.getstatic(lastFieldBinding);
} else {
- codeStream.getfield(this.lastFieldBinding);
+ codeStream.getfield(lastFieldBinding);
}
} else {
- ((CodeSnippetCodeStream) codeStream).generateEmulatedReadAccessForField(this.lastFieldBinding);
+ ((CodeSnippetCodeStream) codeStream).generateEmulatedReadAccessForField(lastFieldBinding);
}
codeStream.generateImplicitConversion(this.implicitConversion);
}
}
} else {
- if (this.lastFieldBinding != null && !this.lastFieldBinding.isStatic()){
+ if (lastFieldBinding != null && !lastFieldBinding.isStatic()){
codeStream.invokeObjectGetClass(); // perform null check
codeStream.pop();
}
@@ -124,19 +124,19 @@ public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean
}
public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) {
- generateReadSequence(currentScope, codeStream);
- if (this.lastFieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
- if (this.lastFieldBinding.isStatic()){
- codeStream.getstatic(this.lastFieldBinding);
+ FieldBinding lastFieldBinding = generateReadSequence(currentScope, codeStream);
+ if (lastFieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
+ if (lastFieldBinding.isStatic()){
+ codeStream.getstatic(lastFieldBinding);
} else {
codeStream.dup();
- codeStream.getfield(this.lastFieldBinding);
+ codeStream.getfield(lastFieldBinding);
}
// the last field access is a write access
// perform the actual compound operation
int operationTypeID;
if ((operationTypeID = this.implicitConversion >> 4) == T_String) {
- codeStream.generateStringAppend(currentScope, null, expression);
+ codeStream.generateStringConcatenationAppend(currentScope, null, expression);
} else {
// promote the array reference to the suitable operation type
codeStream.generateImplicitConversion(this.implicitConversion);
@@ -152,27 +152,27 @@ public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeS
codeStream.generateImplicitConversion(assignmentImplicitConversion);
}
// actual assignment
- fieldStore(codeStream, this.lastFieldBinding, null, valueRequired);
+ fieldStore(codeStream, lastFieldBinding, null, valueRequired);
} else {
- if (this.lastFieldBinding.isStatic()){
- ((CodeSnippetCodeStream) codeStream).generateEmulationForField(this.lastFieldBinding);
+ if (lastFieldBinding.isStatic()){
+ ((CodeSnippetCodeStream) codeStream).generateEmulationForField(lastFieldBinding);
codeStream.swap();
codeStream.aconst_null();
codeStream.swap();
- ((CodeSnippetCodeStream) codeStream).generateEmulatedReadAccessForField(this.lastFieldBinding);
+ ((CodeSnippetCodeStream) codeStream).generateEmulatedReadAccessForField(lastFieldBinding);
} else {
- ((CodeSnippetCodeStream) codeStream).generateEmulationForField(this.lastFieldBinding);
+ ((CodeSnippetCodeStream) codeStream).generateEmulationForField(lastFieldBinding);
codeStream.swap();
codeStream.dup();
- ((CodeSnippetCodeStream) codeStream).generateEmulatedReadAccessForField(this.lastFieldBinding);
+ ((CodeSnippetCodeStream) codeStream).generateEmulatedReadAccessForField(lastFieldBinding);
}
// the last field access is a write access
// perform the actual compound operation
int operationTypeID;
if ((operationTypeID = this.implicitConversion >> 4) == T_String) {
- codeStream.generateStringAppend(currentScope, null, expression);
+ codeStream.generateStringConcatenationAppend(currentScope, null, expression);
} else {
// promote the array reference to the suitable operation type
codeStream.generateImplicitConversion(this.implicitConversion);
@@ -192,7 +192,7 @@ public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeS
// current stack is:
// field receiver value
if (valueRequired) {
- if ((this.lastFieldBinding.type == LongBinding) || (this.lastFieldBinding.type == DoubleBinding)) {
+ if ((lastFieldBinding.type == LongBinding) || (lastFieldBinding.type == DoubleBinding)) {
codeStream.dup2_x2();
} else {
codeStream.dup_x2();
@@ -200,29 +200,29 @@ public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeS
}
// current stack is:
// value field receiver value
- ((CodeSnippetCodeStream) codeStream).generateEmulatedWriteAccessForField(this.lastFieldBinding);
+ ((CodeSnippetCodeStream) codeStream).generateEmulatedWriteAccessForField(lastFieldBinding);
}
}
public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired) {
- generateReadSequence(currentScope, codeStream);
- if (this.lastFieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
- if (this.lastFieldBinding.isStatic()){
- codeStream.getstatic(this.lastFieldBinding);
+ FieldBinding lastFieldBinding = generateReadSequence(currentScope, codeStream);
+ if (lastFieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
+ if (lastFieldBinding.isStatic()){
+ codeStream.getstatic(lastFieldBinding);
} else {
codeStream.dup();
- codeStream.getfield(this.lastFieldBinding);
+ codeStream.getfield(lastFieldBinding);
}
// duplicate the old field value
if (valueRequired) {
- if (this.lastFieldBinding.isStatic()) {
- if ((this.lastFieldBinding.type == LongBinding) || (this.lastFieldBinding.type == DoubleBinding)) {
+ if (lastFieldBinding.isStatic()) {
+ if ((lastFieldBinding.type == LongBinding) || (lastFieldBinding.type == DoubleBinding)) {
codeStream.dup2();
} else {
codeStream.dup();
}
} else { // Stack: [owner][old field value] ---> [old field value][owner][old field value]
- if ((this.lastFieldBinding.type == LongBinding) || (this.lastFieldBinding.type == DoubleBinding)) {
+ if ((lastFieldBinding.type == LongBinding) || (lastFieldBinding.type == DoubleBinding)) {
codeStream.dup2_x1();
} else {
codeStream.dup_x1();
@@ -230,24 +230,24 @@ public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream
}
}
codeStream.generateConstant(postIncrement.expression.constant, this.implicitConversion);
- codeStream.sendOperator(postIncrement.operator, this.lastFieldBinding.type.id);
+ codeStream.sendOperator(postIncrement.operator, lastFieldBinding.type.id);
codeStream.generateImplicitConversion(postIncrement.assignmentImplicitConversion);
- fieldStore(codeStream, this.lastFieldBinding, null, false);
+ fieldStore(codeStream, lastFieldBinding, null, false);
} else {
- ((CodeSnippetCodeStream) codeStream).generateEmulatedReadAccessForField(this.lastFieldBinding);
+ ((CodeSnippetCodeStream) codeStream).generateEmulatedReadAccessForField(lastFieldBinding);
if (valueRequired) {
- if ((this.lastFieldBinding.type == LongBinding) || (this.lastFieldBinding.type == DoubleBinding)) {
+ if ((lastFieldBinding.type == LongBinding) || (lastFieldBinding.type == DoubleBinding)) {
codeStream.dup2();
} else {
codeStream.dup();
}
}
- ((CodeSnippetCodeStream) codeStream).generateEmulationForField(this.lastFieldBinding);
- if ((this.lastFieldBinding.type == LongBinding) || (this.lastFieldBinding.type == DoubleBinding)) {
+ ((CodeSnippetCodeStream) codeStream).generateEmulationForField(lastFieldBinding);
+ if ((lastFieldBinding.type == LongBinding) || (lastFieldBinding.type == DoubleBinding)) {
codeStream.dup_x2();
codeStream.pop();
- if (this.lastFieldBinding.isStatic()) {
+ if (lastFieldBinding.isStatic()) {
codeStream.aconst_null();
} else {
generateReadSequence(currentScope, codeStream);
@@ -257,7 +257,7 @@ public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream
} else {
codeStream.dup_x1();
codeStream.pop();
- if (this.lastFieldBinding.isStatic()) {
+ if (lastFieldBinding.isStatic()) {
codeStream.aconst_null();
} else {
generateReadSequence(currentScope, codeStream);
@@ -266,45 +266,44 @@ public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream
codeStream.pop();
}
codeStream.generateConstant(postIncrement.expression.constant, this.implicitConversion);
- codeStream.sendOperator(postIncrement.operator, this.lastFieldBinding.type.id);
+ codeStream.sendOperator(postIncrement.operator, lastFieldBinding.type.id);
codeStream.generateImplicitConversion(postIncrement.assignmentImplicitConversion);
- ((CodeSnippetCodeStream) codeStream).generateEmulatedWriteAccessForField(this.lastFieldBinding);
+ ((CodeSnippetCodeStream) codeStream).generateEmulatedWriteAccessForField(lastFieldBinding);
}
}
/*
* Generate code for all bindings (local and fields) excluding the last one, which may then be generated code
* for a read or write access.
*/
-public void generateReadSequence(BlockScope currentScope, CodeStream codeStream) {
+public FieldBinding generateReadSequence(BlockScope currentScope, CodeStream codeStream) {
+
// determine the rank until which we now we do not need any actual value for the field access
int otherBindingsCount = this.otherCodegenBindings == null ? 0 : this.otherCodegenBindings.length;
-
boolean needValue = otherBindingsCount == 0 || !this.otherBindings[0].isStatic();
+ FieldBinding lastFieldBinding = null;
+ TypeBinding lastGenericCast = null;
+
switch (this.bits & RestrictiveFlagMASK) {
case FIELD :
- this.lastFieldBinding = (FieldBinding) this.codegenBinding;
+ lastFieldBinding = (FieldBinding) this.codegenBinding;
+ lastGenericCast = this.genericCast;
// if first field is actually constant, we can inline it
- if (this.lastFieldBinding.constant != NotAConstant) {
+ if (lastFieldBinding.constant != NotAConstant) {
break;
}
if (needValue) {
- if (this.lastFieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
- if (!this.lastFieldBinding.isStatic()) {
+ if (lastFieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
+ if (!lastFieldBinding.isStatic()) {
if ((this.bits & DepthMASK) != 0) {
ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((this.bits & DepthMASK) >> DepthSHIFT);
Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
- if (emulationPath == null) {
- // internal error, per construction we should have found it
- currentScope.problemReporter().needImplementation();
- } else {
- codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
- }
+ codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
} else {
generateReceiver(codeStream);
}
}
} else {
- if (!this.lastFieldBinding.isStatic()) {
+ if (!lastFieldBinding.isStatic()) {
if ((this.bits & DepthMASK) != 0) {
// internal error, per construction we should have found it
// not yet supported
@@ -320,7 +319,6 @@ public void generateReadSequence(BlockScope currentScope, CodeStream codeStream)
break;
case LOCAL : // reading the first local variable
if (!needValue) break; // no value needed
- this.lastFieldBinding = null;
LocalVariableBinding localBinding = (LocalVariableBinding) this.codegenBinding;
// regular local variable read
if (localBinding.constant != NotAConstant) {
@@ -328,15 +326,10 @@ public void generateReadSequence(BlockScope currentScope, CodeStream codeStream)
// no implicit conversion
} else {
// outer local?
- if ((this.bits & DepthMASK) != 0) {
+ if ((bits & DepthMASK) != 0) {
// outer local can be reached either through a synthetic arg or a synthetic field
VariableBinding[] path = currentScope.getEmulationPath(localBinding);
- if (path == null) {
- // emulation was not possible (should not happen per construction)
- currentScope.problemReporter().needImplementation();
- } else {
- codeStream.generateOuterAccess(path, this, localBinding, currentScope);
- }
+ codeStream.generateOuterAccess(path, this, localBinding, currentScope);
} else {
codeStream.load(localBinding);
}
@@ -348,39 +341,43 @@ public void generateReadSequence(BlockScope currentScope, CodeStream codeStream)
if (this.otherCodegenBindings != null) {
for (int i = 0; i < otherBindingsCount; i++) {
FieldBinding nextField = this.otherCodegenBindings[i];
- if (this.lastFieldBinding != null) {
+ TypeBinding nextGenericCast = this.otherGenericCasts == null ? null : this.otherGenericCasts[i];
+ if (lastFieldBinding != null) {
needValue = !nextField.isStatic();
if (needValue) {
- if (this.lastFieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
- if (this.lastFieldBinding.constant != NotAConstant) {
- if (this.lastFieldBinding != this.codegenBinding && !this.lastFieldBinding.isStatic()) {
+ if (lastFieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
+ if (lastFieldBinding.constant != NotAConstant) {
+ if (lastFieldBinding != this.codegenBinding && !lastFieldBinding.isStatic()) {
codeStream.invokeObjectGetClass(); // perform null check
codeStream.pop();
}
- codeStream.generateConstant(this.lastFieldBinding.constant, 0);
- } else if (this.lastFieldBinding.isStatic()) {
- codeStream.getstatic(this.lastFieldBinding);
+ codeStream.generateConstant(lastFieldBinding.constant, 0);
+ } else if (lastFieldBinding.isStatic()) {
+ codeStream.getstatic(lastFieldBinding);
} else {
- codeStream.getfield(this.lastFieldBinding);
+ codeStream.getfield(lastFieldBinding);
}
} else {
- ((CodeSnippetCodeStream) codeStream).generateEmulatedReadAccessForField(this.lastFieldBinding);
+ ((CodeSnippetCodeStream) codeStream).generateEmulatedReadAccessForField(lastFieldBinding);
}
+ if (lastGenericCast != null) codeStream.checkcast(lastGenericCast);
} else {
- if (this.codegenBinding != this.lastFieldBinding && !this.lastFieldBinding.isStatic()){
+ if (this.codegenBinding != lastFieldBinding && !lastFieldBinding.isStatic()){
codeStream.invokeObjectGetClass(); // perform null check
codeStream.pop();
}
}
}
- this.lastFieldBinding = nextField;
- if (this.lastFieldBinding != null && !this.lastFieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
- if (this.lastFieldBinding.isStatic()) {
+ lastFieldBinding = nextField;
+ lastGenericCast = nextGenericCast;
+ if (lastFieldBinding != null && !lastFieldBinding.canBeSeenBy(getReceiverType(currentScope), this, currentScope)) {
+ if (lastFieldBinding.isStatic()) {
codeStream.aconst_null();
}
}
}
}
+ return lastFieldBinding;
}
public void generateReceiver(CodeStream codeStream) {
@@ -474,67 +471,29 @@ public TypeBinding getOtherFieldBindings(BlockScope scope) {
}
return (this.otherBindings[otherBindingsLength - 1]).type;
}
-/**
- * Check and/or redirect the field access to the delegate receiver if any
- */
-public TypeBinding getReceiverType(BlockScope currentScope) {
- if (this.receiverType != null) return this.receiverType;
- Scope scope = currentScope.parent;
- while (true) {
- switch (scope.kind) {
- case Scope.CLASS_SCOPE :
- return this.receiverType = ((ClassScope) scope).referenceContext.binding;
- default:
- scope = scope.parent;
- }
- }
-}
-
- public void manageSyntheticReadAccessIfNecessary(
- BlockScope currentScope,
- FieldBinding fieldBinding,
- TypeBinding lastReceiverType,
- int index,
- FlowInfo flowInfo) {
-
- if (!flowInfo.isReachable()) return;
-
-
- // if the binding declaring class is not visible, need special action
- // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
- // NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
- boolean useDelegate = index == 0 && this.delegateThis != null;
- if (useDelegate) {
- lastReceiverType = this.delegateThis.type;
- }
- if (fieldBinding.declaringClass != lastReceiverType
- && !lastReceiverType.isArrayType()
- && fieldBinding.declaringClass != null
- && fieldBinding.constant == NotAConstant
- && ((currentScope.environment().options.targetJDK >= ClassFileConstants.JDK1_2
- && (index > 0 || this.indexOfFirstFieldBinding > 1 || !fieldBinding.isStatic())
- && fieldBinding.declaringClass.id != T_Object)
- || !(useDelegate
- ? new CodeSnippetScope(currentScope).canBeSeenByForCodeSnippet(fieldBinding.declaringClass, (ReferenceBinding) this.delegateThis.type)
- : fieldBinding.declaringClass.canBeSeenBy(currentScope)))){
- if (index == 0){
- this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType);
- } else {
- if (this.otherCodegenBindings == this.otherBindings){
- int l = this.otherBindings.length;
- System.arraycopy(this.otherBindings, 0, this.otherCodegenBindings = new FieldBinding[l], 0, l);
+ /**
+ * Check and/or redirect the field access to the delegate receiver if any
+ */
+ public TypeBinding getReceiverType(BlockScope currentScope) {
+ if (this.receiverType != null) return this.receiverType;
+ Scope scope = currentScope.parent;
+ while (true) {
+ switch (scope.kind) {
+ case Scope.CLASS_SCOPE :
+ return this.receiverType = ((ClassScope) scope).referenceContext.binding;
+ default:
+ scope = scope.parent;
}
- this.otherCodegenBindings[index-1] = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType);
- }
}
}
- /*
- * No need to emulate access to protected fields since not implicitly accessed
- */
- public void manageSyntheticWriteAccessIfNecessary(
+ /**
+ * index is <0 to denote write access emulation
+ */
+ public void manageSyntheticAccessIfNecessary(
BlockScope currentScope,
FieldBinding fieldBinding,
TypeBinding lastReceiverType,
+ int index,
FlowInfo flowInfo) {
if (!flowInfo.isReachable()) return;
@@ -542,7 +501,13 @@ public TypeBinding getReceiverType(BlockScope currentScope) {
// if the binding declaring class is not visible, need special action
// for runtime compatibility on 1.2 VMs : change the declaring class of the binding
// NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
- boolean useDelegate = fieldBinding == this.binding && this.delegateThis != null;
+ boolean useDelegate;
+ if (index < 0) { // write-access?
+ useDelegate = fieldBinding == this.binding && this.delegateThis != null;
+ } else {
+ useDelegate = index == 0 && this.delegateThis != null;
+ }
+
if (useDelegate) {
lastReceiverType = this.delegateThis.type;
}
@@ -551,19 +516,29 @@ public TypeBinding getReceiverType(BlockScope currentScope) {
&& fieldBinding.declaringClass != null
&& fieldBinding.constant == NotAConstant
&& ((currentScope.environment().options.targetJDK >= ClassFileConstants.JDK1_2
- && (fieldBinding != this.binding || this.indexOfFirstFieldBinding > 1 || !fieldBinding.isStatic())
+ && ((index < 0 ? fieldBinding != binding : index > 0) || this.indexOfFirstFieldBinding > 1 || !fieldBinding.isStatic())
&& fieldBinding.declaringClass.id != T_Object)
|| !(useDelegate
? new CodeSnippetScope(currentScope).canBeSeenByForCodeSnippet(fieldBinding.declaringClass, (ReferenceBinding) this.delegateThis.type)
: fieldBinding.declaringClass.canBeSeenBy(currentScope)))){
- if (fieldBinding == this.binding){
- this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType);
+ if (index < 0) { // write-access?
+ if (fieldBinding == this.binding){
+ this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType.erasure());
+ } else {
+ if (this.otherCodegenBindings == this.otherBindings){
+ int l = this.otherBindings.length;
+ System.arraycopy(this.otherBindings, 0, this.otherCodegenBindings = new FieldBinding[l], 0, l);
+ }
+ this.otherCodegenBindings[this.otherCodegenBindings.length-1] = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType.erasure());
+ }
+ } if (index == 0){
+ this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType.erasure());
} else {
if (this.otherCodegenBindings == this.otherBindings){
int l = this.otherBindings.length;
System.arraycopy(this.otherBindings, 0, this.otherCodegenBindings = new FieldBinding[l], 0, l);
}
- this.otherCodegenBindings[this.otherCodegenBindings.length-1] = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType);
+ this.otherCodegenBindings[index-1] = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)lastReceiverType.erasure());
}
}
}
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java
index c3cc5d09c5..7658691538 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java
@@ -56,7 +56,7 @@ public void generateStoreSaveValueIfNecessary(CodeStream codeStream){
codeStream.aload_0();
// push the 2 parameters of "setResult(Object, Class)"
- if (this.expression == null || this.expressionType == VoidBinding) { // expressionType == VoidBinding if code snippet is the expression "System.out.println()"
+ if (this.expression == null || this.expression.resolvedType == VoidBinding) { // expressionType == VoidBinding if code snippet is the expression "System.out.println()"
// push null
codeStream.aconst_null();
@@ -64,7 +64,7 @@ public void generateStoreSaveValueIfNecessary(CodeStream codeStream){
codeStream.generateClassLiteralAccessForType(VoidBinding, null);
} else {
// swap with expression
- int valueTypeID = this.expressionType.id;
+ int valueTypeID = this.expression.resolvedType.id;
if (valueTypeID == T_long || valueTypeID == T_double) {
codeStream.dup_x2();
codeStream.pop();
@@ -73,17 +73,23 @@ public void generateStoreSaveValueIfNecessary(CodeStream codeStream){
}
// generate wrapper if needed
- if (this.expressionType.isBaseType() && this.expressionType != NullBinding) {
- ((CodeSnippetCodeStream)codeStream).generateObjectWrapperForType(this.expressionType);
+ if (this.expression.resolvedType.isBaseType() && this.expression.resolvedType != NullBinding) {
+ ((CodeSnippetCodeStream)codeStream).generateObjectWrapperForType(this.expression.resolvedType);
}
// generate the expression type
- codeStream.generateClassLiteralAccessForType(this.expressionType, null);
+ codeStream.generateClassLiteralAccessForType(this.expression.resolvedType, null);
}
// generate the invoke virtual to "setResult(Object,Class)"
codeStream.invokevirtual(this.setResultMethod);
}
+/**
+ * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#genericTypeArguments()
+ */
+public TypeBinding[] genericTypeArguments() {
+ return null;
+}
public boolean isSuperAccess() {
return false;
}
@@ -99,7 +105,7 @@ public void prepareSaveValueLocation(TryStatement targetTryStatement){
}
public void resolve(BlockScope scope) {
if (this.expression != null) {
- if ((this.expressionType = this.expression.resolveType(scope)) != null) {
+ if (this.expression.resolveType(scope) != null) {
TypeBinding javaLangClass = scope.getJavaLangClass();
if (!javaLangClass.isValidBinding()) {
scope.problemReporter().codeSnippetMissingClass("java.lang.Class", this.sourceStart, this.sourceEnd); //$NON-NLS-1$
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java
index 10c42cb805..bb124c3a0c 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java
@@ -420,8 +420,9 @@ public MethodBinding findMethod(
// argument type compatibility check
for (int i = 0; i < foundSize; i++) {
MethodBinding methodBinding = (MethodBinding) found.elementAt(i);
- if (areParametersAssignable(methodBinding.parameters, argumentTypes))
- candidates[candidatesCount++] = methodBinding;
+ MethodBinding compatibleMethod = computeCompatibleMethod(methodBinding, argumentTypes, invocationSite);
+ if (compatibleMethod != null)
+ candidates[candidatesCount++] = compatibleMethod;
}
if (candidatesCount == 1) {
//compilationUnitScope().recordTypeReferences(candidates[0].thrownExceptions);
@@ -475,9 +476,9 @@ public MethodBinding findMethod(
NotVisible);
}
if (candidates[0].declaringClass.isClass()) {
- return mostSpecificClassMethodBinding(candidates, visiblesCount);
+ return mostSpecificClassMethodBinding(candidates, visiblesCount, invocationSite);
} else {
- return mostSpecificInterfaceMethodBinding(candidates, visiblesCount);
+ return mostSpecificInterfaceMethodBinding(candidates, visiblesCount, invocationSite);
}
}
@@ -498,10 +499,12 @@ public MethodBinding findMethodForArray(ArrayBinding receiverType, char[] select
if (methodBinding == null)
return new ProblemMethodBinding(selector, argumentTypes, NotFound);
if (methodBinding.isValidBinding()) {
- if (!areParametersAssignable(methodBinding.parameters, argumentTypes))
+ MethodBinding compatibleMethod = computeCompatibleMethod(methodBinding, argumentTypes, invocationSite);
+ if (compatibleMethod == null)
return new ProblemMethodBinding(methodBinding, selector, argumentTypes, NotFound);
+ methodBinding = compatibleMethod;
if (!canBeSeenByForCodeSnippet(methodBinding, receiverType, invocationSite, this))
- return new ProblemMethodBinding(selector, methodBinding.parameters, methodBinding.declaringClass, NotVisible);
+ return new ProblemMethodBinding(methodBinding, selector, methodBinding.parameters, NotVisible);
}
return methodBinding;
}
@@ -623,9 +626,11 @@ public MethodBinding getConstructor(ReferenceBinding receiverType, TypeBinding[]
}
MethodBinding[] compatible = new MethodBinding[methods.length];
int compatibleIndex = 0;
- for (int i = 0, length = methods.length; i < length; i++)
- if (areParametersAssignable(methods[i].parameters, argumentTypes))
- compatible[compatibleIndex++] = methods[i];
+ for (int i = 0, length = methods.length; i < length; i++) {
+ MethodBinding compatibleMethod = computeCompatibleMethod(methods[i], argumentTypes, invocationSite);
+ if (compatibleMethod != null)
+ compatible[compatibleIndex++] = compatibleMethod;
+ }
if (compatibleIndex == 0)
return new ProblemMethodBinding(ConstructorDeclaration.ConstantPoolName, argumentTypes, NotFound); // need a more descriptive error... cannot convert from X to Y
@@ -641,9 +646,9 @@ public MethodBinding getConstructor(ReferenceBinding receiverType, TypeBinding[]
return visible[0];
}
if (visibleIndex == 0) {
- return new ProblemMethodBinding(ConstructorDeclaration.ConstantPoolName, compatible[0].parameters, NotVisible);
+ return new ProblemMethodBinding(compatible[0], ConstructorDeclaration.ConstantPoolName, compatible[0].parameters, NotVisible);
}
- return mostSpecificClassMethodBinding(visible, visibleIndex);
+ return mostSpecificClassMethodBinding(visible, visibleIndex, invocationSite);
}
/* API
@@ -713,18 +718,22 @@ public MethodBinding getImplicitMethod(ReferenceBinding receiverType, char[] sel
ProblemMethodBinding insideProblem = null;
if (methodBinding.isValidBinding()) {
if (!isExactMatch) {
- if (!areParametersAssignable(methodBinding.parameters, argumentTypes)) {
+ MethodBinding compatibleMethod = computeCompatibleMethod(methodBinding, argumentTypes, invocationSite);
+ if (compatibleMethod == null) {
fuzzyProblem = new ProblemMethodBinding(methodBinding, selector, argumentTypes, NotFound);
- } else if (!canBeSeenByForCodeSnippet(methodBinding, receiverType, invocationSite, this)) {
- // using <classScope> instead of <this> for visibility check does grant all access to innerclass
- fuzzyProblem = new ProblemMethodBinding(selector, argumentTypes, methodBinding.declaringClass, NotVisible);
+ } else {
+ methodBinding = compatibleMethod;
+ if (!canBeSeenByForCodeSnippet(methodBinding, receiverType, invocationSite, this)) {
+ // using <classScope> instead of <this> for visibility check does grant all access to innerclass
+ fuzzyProblem = new ProblemMethodBinding(methodBinding, selector, argumentTypes, NotVisible);
+ }
}
}
if (fuzzyProblem == null && !methodBinding.isStatic()) {
if (insideConstructorCall) {
- insideProblem = new ProblemMethodBinding(methodBinding.selector, methodBinding.parameters, NonStaticReferenceInConstructorInvocation);
+ insideProblem = new ProblemMethodBinding(methodBinding, methodBinding.selector, methodBinding.parameters, NonStaticReferenceInConstructorInvocation);
} else if (insideStaticContext) {
- insideProblem = new ProblemMethodBinding(methodBinding.selector, methodBinding.parameters, NonStaticReferenceInStaticContext);
+ insideProblem = new ProblemMethodBinding(methodBinding, methodBinding.selector, methodBinding.parameters, NonStaticReferenceInStaticContext);
}
}
if (receiverType == methodBinding.declaringClass || (receiverType.getMethods(selector)) != NoMethods) {
@@ -741,7 +750,7 @@ public MethodBinding getImplicitMethod(ReferenceBinding receiverType, char[] sel
// if a method was found, complain when another is found in an 'immediate' enclosing type (ie. not inherited)
// NOTE: Unlike fields, a non visible method hides a visible method
if (foundMethod.declaringClass != methodBinding.declaringClass) // ie. have we found the same method - do not trust field identity yet
- return new ProblemMethodBinding(methodBinding.selector, methodBinding.parameters, InheritedNameHidesEnclosingName);
+ return new ProblemMethodBinding(methodBinding, methodBinding.selector, methodBinding.parameters, InheritedNameHidesEnclosingName);
}
}
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java
index 25d95c2b2c..35e1922f4b 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java
@@ -255,6 +255,7 @@ public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean
((CodeSnippetCodeStream)codeStream).generateEmulatedReadAccessForField(fieldBinding);
}
codeStream.generateImplicitConversion(this.implicitConversion);
+ if (this.genericCast != null) codeStream.checkcast(this.genericCast);
} else { // directly use the inlined value
codeStream.generateConstant(fieldBinding.constant, this.implicitConversion);
}
@@ -332,7 +333,7 @@ public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeS
// using incr bytecode if possible
switch (localBinding.type.id) {
case T_String :
- codeStream.generateStringAppend(currentScope, this, expression);
+ codeStream.generateStringConcatenationAppend(currentScope, this, expression);
if (valueRequired) {
codeStream.dup();
}
@@ -365,7 +366,7 @@ public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeS
// perform the actual compound operation
int operationTypeID;
if ((operationTypeID = this.implicitConversion >> 4) == T_String || operationTypeID == T_Object) {
- codeStream.generateStringAppend(currentScope, null, expression);
+ codeStream.generateStringConcatenationAppend(currentScope, null, expression);
} else {
// promote the array reference to the suitable operation type
codeStream.generateImplicitConversion(this.implicitConversion);
@@ -550,72 +551,29 @@ public TypeBinding getReceiverType(BlockScope currentScope) {
}
}
}
-public void manageSyntheticReadAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
+public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo, boolean isReadAccess) {
if (this.delegateThis == null) {
- super.manageSyntheticReadAccessIfNecessary(currentScope, flowInfo);
+ super.manageSyntheticAccessIfNecessary(currentScope, flowInfo, isReadAccess);
return;
}
-
+
if (!flowInfo.isReachable()) return;
//If inlinable field, forget the access emulation, the code gen will directly target it
if (this.constant != NotAConstant)
- return;
- if ((this.bits & FIELD) != 0) {
- FieldBinding fieldBinding = (FieldBinding) this.binding;
-// if (((this.bits & DepthMASK) != 0)
-// && (fieldBinding.isPrivate() // private access
-// || (fieldBinding.isProtected() // implicit protected access
-// && fieldBinding.declaringClass.getPackage()
-// != this.delegateThis.type.getPackage()))) {
-// if (this.syntheticAccessors == null)
-// this.syntheticAccessors = new MethodBinding[2];
-// this.syntheticAccessors[READ] =
-// ((SourceTypeBinding)currentScope.enclosingSourceType().
-// enclosingTypeAt((this.bits & DepthMASK) >> DepthSHIFT)).
-// addSyntheticMethod(fieldBinding, true);
-// currentScope.problemReporter().needToEmulateFieldReadAccess(fieldBinding, this);
-// return;
-// }
- // if the binding declaring class is not visible, need special action
- // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
- // NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
- // and not from Object or implicit static field access.
- if (fieldBinding.declaringClass != this.delegateThis.type
- && fieldBinding.declaringClass != null
- && fieldBinding.constant == NotAConstant
- && ((currentScope.environment().options.targetJDK >= ClassFileConstants.JDK1_2
- && !fieldBinding.isStatic()
- && fieldBinding.declaringClass.id != T_Object) // no change for Object fields (if there was any)
- || !fieldBinding.declaringClass.canBeSeenBy(currentScope))){
- this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)this.delegateThis.type);
- }
- }
-}
-public void manageSyntheticWriteAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
-
- if (this.delegateThis == null) {
- super.manageSyntheticWriteAccessIfNecessary(currentScope, flowInfo);
- return;
- }
-
- if (!flowInfo.isReachable()) return;
+ return;
+ // if field from parameterized type got found, use the original field at codegen time
+ if (this.binding instanceof ParameterizedFieldBinding) {
+ ParameterizedFieldBinding parameterizedField = (ParameterizedFieldBinding) this.binding;
+ this.codegenBinding = parameterizedField.originalField;
+ FieldBinding fieldCodegenBinding = (FieldBinding)this.codegenBinding;
+ // extra cast needed if field type was type variable
+ if ((fieldCodegenBinding.type.tagBits & TagBits.HasTypeVariable) != 0) {
+ this.genericCast = fieldCodegenBinding.type.genericCast(parameterizedField.type);
+ }
+ }
if ((this.bits & FIELD) != 0) {
FieldBinding fieldBinding = (FieldBinding) this.binding;
-// if (((this.bits & DepthMASK) != 0)
-// && (fieldBinding.isPrivate() // private access
-// || (fieldBinding.isProtected() // implicit protected access
-// && fieldBinding.declaringClass.getPackage()
-// != currentScope.enclosingSourceType().getPackage()))) {
-// if (this.syntheticAccessors == null)
-// this.syntheticAccessors = new MethodBinding[2];
-// this.syntheticAccessors[WRITE] =
-// ((SourceTypeBinding)currentScope.enclosingSourceType().
-// enclosingTypeAt((this.bits & DepthMASK) >> DepthSHIFT)).
-// addSyntheticMethod(fieldBinding, false);
-// currentScope.problemReporter().needToEmulateFieldWriteAccess(fieldBinding, this);
-// return;
-// }
// if the binding declaring class is not visible, need special action
// for runtime compatibility on 1.2 VMs : change the declaring class of the binding
// NOTE: from target 1.2 on, field's declaring class is touched if any different from receiver type
@@ -627,7 +585,7 @@ public void manageSyntheticWriteAccessIfNecessary(BlockScope currentScope, FlowI
&& !fieldBinding.isStatic()
&& fieldBinding.declaringClass.id != T_Object) // no change for Object fields (if there was any)
|| !fieldBinding.declaringClass.canBeSeenBy(currentScope))){
- this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding(fieldBinding, (ReferenceBinding)this.delegateThis.type);
+ this.codegenBinding = currentScope.enclosingSourceType().getUpdatedFieldBinding((FieldBinding)this.codegenBinding, (ReferenceBinding)this.delegateThis.type.erasure());
}
}
}
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSkeleton.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSkeleton.java
index d529ef8d93..a69186a79e 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSkeleton.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSkeleton.java
@@ -58,37 +58,30 @@ public class CodeSnippetSkeleton implements IBinaryType, EvaluationConstants {
this.exceptionTypeNames = exceptionTypeNames;
this.isConstructor = isConstructor;
}
-
public char[][] getExceptionTypeNames() {
return this.exceptionTypeNames;
}
-
public char[] getMethodDescriptor() {
return this.methodDescriptor;
}
-
public int getModifiers() {
return IConstants.AccPublic;
}
-
public char[] getSelector() {
return this.selector;
}
-
public boolean isClinit() {
return false;
}
-
public boolean isConstructor() {
return this.isConstructor;
}
- /**
- * @see org.eclipse.jdt.internal.compiler.env.IGenericMethod#getArgumentNames()
- */
public char[][] getArgumentNames() {
return null;
}
-
+ public char[] getGenericSignature() {
+ return null;
+ }
}
/**
@@ -106,6 +99,9 @@ public IBinaryField[] getFields() {
public char[] getFileName() {
return CharOperation.concat(CODE_SNIPPET_NAME, SuffixConstants.SUFFIX_java); //$NON-NLS-1$
}
+public char[] getGenericSignature() {
+ return null;
+}
public char[][] getInterfaceNames() {
return null;
}
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSuperReference.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSuperReference.java
index a7a0434846..46be4a4cf7 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSuperReference.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSuperReference.java
@@ -30,6 +30,13 @@ public CodeSnippetSuperReference(int pos, int sourceEnd, EvaluationContext eval
this.evaluationContext = evaluationContext;
}
+/**
+ * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#genericTypeArguments()
+ */
+public TypeBinding[] genericTypeArguments() {
+ return null;
+}
+
public TypeBinding resolveType(BlockScope scope) {
scope.problemReporter().cannotUseSuperInCodeSnippet(this.sourceStart, this.sourceEnd); //$NON-NLS-1$
return null;
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetThisReference.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetThisReference.java
index c1288e1b0e..6498553ead 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetThisReference.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetThisReference.java
@@ -61,6 +61,12 @@ public class CodeSnippetThisReference extends ThisReference implements Evaluatio
}
codeStream.recordPositionsFrom(pc, this.sourceStart);
}
+ /**
+ * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#genericTypeArguments()
+ */
+ public TypeBinding[] genericTypeArguments() {
+ return null;
+ }
public boolean isSuperAccess(){
return false;
}
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java
index f1134477f2..0b38eefcc4 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java
@@ -292,6 +292,13 @@ public ISelectionRequestor getSelectionRequestor(final ISelectionRequestor origi
public void acceptPackage(char[] packageName) {
originalRequestor.acceptPackage(packageName);
}
+
+ public void acceptTypeParameter(char[] declaringTypePackageName, char[] declaringTypeName, char[] typeParameterName, boolean isDeclaration, int start, int end) {
+ originalRequestor.acceptTypeParameter(declaringTypePackageName, declaringTypeName, typeParameterName, isDeclaration, start, end);
+ }
+ public void acceptMethodTypeParameter(char[] declaringTypePackageName, char[] declaringTypeName, char[] selector, char[][] parameterPackageNames, char[][] parameterTypeNames, boolean isConstructor, char[] typeParameterName, boolean isDeclaration, int start, int end) {
+ originalRequestor.acceptMethodTypeParameter(declaringTypePackageName, declaringTypeName, selector, parameterPackageNames, parameterTypeNames, isConstructor, typeParameterName, isDeclaration, start, end);
+ }
};
}
}
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java
index abd4b26a7d..4fcf6dc25c 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java
@@ -858,7 +858,7 @@ public class CodeFormatterVisitor extends ASTVisitor {
this.lastLocalDeclarationSourceStart = -1;
try {
- expression.traverse(this, null);
+ expression.traverse(this, (BlockScope) null);
this.scribe.printComment();
} catch(AbortFormatting e){
return failedToFormat();
diff --git a/org.eclipse.jdt.core/grammar/java_1_5.g b/org.eclipse.jdt.core/grammar/java_1_5.g
index 27f21d530d..b31d4932c9 100644
--- a/org.eclipse.jdt.core/grammar/java_1_5.g
+++ b/org.eclipse.jdt.core/grammar/java_1_5.g
@@ -28,8 +28,11 @@ $break
$readableName
-/.$rule_number=./
-
+/.1#$rule_number=./
+$compliance
+/.2#$rule_number=./
+$recovery
+/.2#$rule_number= recovery./
-- here it starts really ------------------------------------------
$Terminals
@@ -281,10 +284,32 @@ QualifiedName ::= Name '.' SimpleName
/.$putCase consumeQualifiedName(); $break ./
/:$readableName QualifiedName:/
-CompilationUnit ::= EnterCompilationUnit PackageDeclarationopt ImportDeclarationsopt TypeDeclarationsopt
+CompilationUnit ::= EnterCompilationUnit InternalCompilationUnit
/.$putCase consumeCompilationUnit(); $break ./
/:$readableName CompilationUnit:/
+InternalCompilationUnit ::= PackageDeclaration
+/.$putCase consumeInternalCompilationUnit(); $break ./
+InternalCompilationUnit ::= PackageDeclaration ImportDeclarations ReduceImports
+/.$putCase consumeInternalCompilationUnit(); $break ./
+InternalCompilationUnit ::= PackageDeclaration ImportDeclarations ReduceImports TypeDeclarations
+/.$putCase consumeInternalCompilationUnitWithTypes(); $break ./
+InternalCompilationUnit ::= PackageDeclaration TypeDeclarations
+/.$putCase consumeInternalCompilationUnitWithTypes(); $break ./
+InternalCompilationUnit ::= ImportDeclarations ReduceImports
+/.$putCase consumeInternalCompilationUnit(); $break ./
+InternalCompilationUnit ::= TypeDeclarations
+/.$putCase consumeInternalCompilationUnitWithTypes(); $break ./
+InternalCompilationUnit ::= ImportDeclarations ReduceImports TypeDeclarations
+/.$putCase consumeInternalCompilationUnitWithTypes(); $break ./
+InternalCompilationUnit ::= $empty
+/.$putCase consumeEmptyInternalCompilationUnit(); $break ./
+/:$readableName CompilationUnit:/
+
+ReduceImports ::= $empty
+/.$putCase consumeReduceImports(); $break ./
+/:$readableName ReduceImports:/
+
EnterCompilationUnit ::= $empty
/.$putCase consumeEnterCompilationUnit(); $break ./
/:$readableName EnterCompilationUnit:/
@@ -319,6 +344,11 @@ PackageDeclaration ::= PackageDeclarationName ';'
/.$putCase consumePackageDeclaration(); $break ./
/:$readableName PackageDeclaration:/
+PackageDeclarationName ::= Modifiers 'package' PushRealModifiers Name
+/.$putCase consumePackageDeclarationNameWithModifiers(); $break ./
+/:$readableName PackageDeclarationName:/
+/:$compliance 1.5:/
+
PackageDeclarationName ::= 'package' Name
/.$putCase consumePackageDeclarationName(); $break ./
/:$readableName PackageDeclarationName:/
@@ -364,8 +394,9 @@ TypeDeclaration -> AnnotationTypeDeclaration
--18.7 Only in the LALR(1) Grammar
-Modifiers ::= Modifier
+Modifiers -> Modifier
Modifiers ::= Modifiers Modifier
+/.$putCase consumeModifiers2(); $break ./
/:$readableName Modifiers:/
Modifier -> 'public'
@@ -400,10 +431,14 @@ ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt ClassHeaderImplementsopt
-----------------------------------------------
-- 1.5 features : generics
-----------------------------------------------
-ClassHeaderName ::= Modifiersopt 'class' 'Identifier' TypeParameters
-/.$putCase consumeClassHeaderNameWithTypeParameters(); $break ./
-ClassHeaderName ::= Modifiersopt 'class' 'Identifier'
-/.$putCase consumeClassHeaderName(); $break ./
+ClassHeaderName ::= ClassHeaderName1 TypeParameters
+/.$putCase consumeTypeHeaderNameWithTypeParameters(); $break ./
+
+ClassHeaderName -> ClassHeaderName1
+/:$readableName ClassHeaderName:/
+
+ClassHeaderName1 ::= Modifiersopt 'class' 'Identifier'
+/.$putCase consumeClassHeaderName1(); $break ./
/:$readableName ClassHeaderName:/
ClassHeaderExtends ::= 'extends' ClassType
@@ -461,13 +496,13 @@ ClassMemberDeclaration -> EnumDeclaration
-- However, since the current (2/14/97) Java compiler accepts them
-- (in fact, some of the official tests contain this erroneous
-- syntax)
+ClassMemberDeclaration ::= ';'
+/.$putCase consumeEmptyClassMemberDeclaration(); $break./
+
GenericMethodDeclaration -> MethodDeclaration
GenericMethodDeclaration -> ConstructorDeclaration
/:$readableName GenericMethodDeclaration:/
-ClassMemberDeclaration ::= ';'
-/.$putCase consumeEmptyClassMemberDeclaration(); $break./
-
--18.8.2 Productions from 8.3: Field Declarations
--VariableModifier ::=
-- 'public'
@@ -583,6 +618,7 @@ FormalParameter ::= Modifiersopt Type VariableDeclaratorId
FormalParameter ::= Modifiersopt Type '...' VariableDeclaratorId
/.$putCase consumeFormalParameter(true); $break ./
/:$readableName FormalParameter:/
+/:$compliance 1.5:/
ClassTypeList -> ClassTypeElt
ClassTypeList ::= ClassTypeList ',' ClassTypeElt
@@ -669,8 +705,6 @@ ExplicitConstructorInvocation ::= Name '.' OnlyTypeArguments 'this' '(' Argument
/.$putCase consumeExplicitConstructorInvocationWithTypeArguments(2, ExplicitConstructorCall.This); $break ./
/:$readableName ExplicitConstructorInvocation:/
-/:$readableName ExplicitConstructorInvocation:/
-
--18.9 Productions from 9: Interface Declarations
--18.9.1 Productions from 9.1: Interface Declarations
@@ -689,10 +723,14 @@ InterfaceHeader ::= InterfaceHeaderName InterfaceHeaderExtendsopt
-----------------------------------------------
-- 1.5 features : generics
-----------------------------------------------
-InterfaceHeaderName ::= Modifiersopt interface Identifier TypeParameters
-/.$putCase consumeInterfaceHeaderNameWithTypeParameters(); $break ./
-InterfaceHeaderName ::= Modifiersopt interface Identifier
-/.$putCase consumeInterfaceHeaderName(); $break ./
+InterfaceHeaderName ::= InterfaceHeaderName1 TypeParameters
+/.$putCase consumeTypeHeaderNameWithTypeParameters(); $break ./
+
+InterfaceHeaderName -> InterfaceHeaderName1
+/:$readableName InterfaceHeaderName:/
+
+InterfaceHeaderName1 ::= Modifiersopt interface Identifier
+/.$putCase consumeInterfaceHeaderName1(); $break ./
/:$readableName InterfaceHeaderName:/
-- This rule will be used to accept inner local interface and then report a relevant error message
@@ -787,7 +825,7 @@ LocalVariableDeclaration ::= Type PushModifiers VariableDeclarators
-- The modifiers part of this rule makes the grammar more permissive.
-- The only modifier here is final. We put Modifiers to allow multiple modifiers
-- This will require to check the validity of the modifier
-LocalVariableDeclaration ::= Modifiers Type PushModifiers VariableDeclarators
+LocalVariableDeclaration ::= Modifiers Type PushRealModifiers VariableDeclarators
/.$putCase consumeLocalVariableDeclaration(); $break ./
/:$readableName LocalVariableDeclaration:/
@@ -795,6 +833,10 @@ PushModifiers ::= $empty
/.$putCase consumePushModifiers(); $break ./
/:$readableName PushModifiers:/
+PushRealModifiers ::= $empty
+/.$putCase consumePushRealModifiers(); $break ./
+/:$readableName PushModifiers:/
+
Statement -> StatementWithoutTrailingSubstatement
Statement -> LabeledStatement
Statement -> IfThenStatement
@@ -941,10 +983,12 @@ StatementExpressionList ::= StatementExpressionList ',' StatementExpression
-- 1.4 feature
AssertStatement ::= 'assert' Expression ';'
/.$putCase consumeSimpleAssertStatement() ; $break ./
+/:$compliance 1.4:/
AssertStatement ::= 'assert' Expression ':' Expression ';'
/.$putCase consumeAssertStatement() ; $break ./
/:$readableName AssertStatement:/
+/:$compliance 1.4:/
BreakStatement ::= 'break' ';'
/.$putCase consumeStatementBreak() ; $break ./
@@ -1071,18 +1115,18 @@ ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' Clas
/.$putCase consumeClassInstanceCreationExpression(); $break ./
--1.1 feature
-ClassInstanceCreationExpression ::= Primary '.' 'new' OnlyTypeArguments SimpleName '(' ArgumentListopt ')' ClassBodySimpleNameopt
+ClassInstanceCreationExpression ::= Primary '.' 'new' OnlyTypeArguments ClassType '(' ArgumentListopt ')' ClassBodySimpleNameopt
/.$putCase consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ; $break ./
-ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodySimpleNameopt
+ClassInstanceCreationExpression ::= Primary '.' 'new' ClassType '(' ArgumentListopt ')' ClassBodySimpleNameopt
/.$putCase consumeClassInstanceCreationExpressionQualified() ; $break ./
--1.1 feature
-ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodySimpleNameopt
+ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' ClassType '(' ArgumentListopt ')' ClassBodySimpleNameopt
/.$putCase consumeClassInstanceCreationExpressionQualified() ; $break ./
/:$readableName ClassInstanceCreationExpression:/
-ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' OnlyTypeArguments SimpleName '(' ArgumentListopt ')' ClassBodySimpleNameopt
+ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' OnlyTypeArguments ClassType '(' ArgumentListopt ')' ClassBodySimpleNameopt
/.$putCase consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ; $break ./
/:$readableName ClassInstanceCreationExpression:/
@@ -1236,13 +1280,9 @@ UnaryExpressionNotPlusMinus -> CastExpression
CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN InsideCastExpression UnaryExpression
/.$putCase consumeCastExpressionWithPrimitiveType(); $break ./
-CastExpression ::= PushLPAREN Name OnlyTypeArguments Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
+CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression Dimsopt PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
/.$putCase consumeCastExpressionWithGenericsArray(); $break ./
-CastExpression ::= PushLPAREN Name OnlyTypeArguments PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
-/.$putCase consumeCastExpressionWithGenerics(); $break ./
-CastExpression ::= PushLPAREN Name OnlyTypeArguments '.' ClassOrInterfaceType PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
-/.$putCase consumeCastExpressionWithQualifiedGenerics(); $break ./
-CastExpression ::= PushLPAREN Name OnlyTypeArguments '.' ClassOrInterfaceType Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
+CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression '.' ClassOrInterfaceType Dimsopt PushRPAREN InsideCastExpressionWithQualifiedGenerics UnaryExpressionNotPlusMinus
/.$putCase consumeCastExpressionWithQualifiedGenericsArray(); $break ./
CastExpression ::= PushLPAREN Name PushRPAREN InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
/.$putCase consumeCastExpressionLL1(); $break ./
@@ -1250,12 +1290,19 @@ CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExp
/.$putCase consumeCastExpressionWithNameArray(); $break ./
/:$readableName CastExpression:/
+OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments
+/.$putCase consumeOnlyTypeArgumentsForCastExpression(); $break ./
+/:$readableName TypeArguments:/
+
InsideCastExpression ::= $empty
/.$putCase consumeInsideCastExpression(); $break ./
/:$readableName InsideCastExpression:/
InsideCastExpressionLL1 ::= $empty
/.$putCase consumeInsideCastExpressionLL1(); $break ./
/:$readableName InsideCastExpression:/
+InsideCastExpressionWithQualifiedGenerics ::= $empty
+/.$putCase consumeInsideCastExpressionWithQualifiedGenerics(); $break ./
+/:$readableName InsideCastExpression:/
MultiplicativeExpression -> UnaryExpression
MultiplicativeExpression ::= MultiplicativeExpression '*' UnaryExpression
@@ -1380,11 +1427,6 @@ Expression -> AssignmentExpression
-- The following rules are for optional nonterminals.
--
-
-PackageDeclarationopt -> $empty
-PackageDeclarationopt -> PackageDeclaration
-/:$readableName PackageDeclaration:/
-
ClassHeaderExtendsopt ::= $empty
ClassHeaderExtendsopt -> ClassHeaderExtends
/:$readableName ClassHeaderExtends:/
@@ -1413,18 +1455,6 @@ ConstantExpression -> Expression
,opt -> ,
/:$readableName ,:/
-ImportDeclarationsopt ::= $empty
-/.$putCase consumeEmptyImportDeclarationsopt(); $break ./
-ImportDeclarationsopt ::= ImportDeclarations
-/.$putCase consumeImportDeclarationsopt(); $break ./
-/:$readableName ImportDeclarations:/
-
-TypeDeclarationsopt ::= $empty
-/.$putCase consumeEmptyTypeDeclarationsopt(); $break ./
-TypeDeclarationsopt ::= TypeDeclarations
-/.$putCase consumeTypeDeclarationsopt(); $break ./
-/:$readableName TypeDeclarations:/
-
ClassBodyDeclarationsopt ::= $empty
/.$putCase consumeEmptyClassBodyDeclarationsopt(); $break ./
ClassBodyDeclarationsopt ::= NestedType ClassBodyDeclarations
@@ -1433,7 +1463,7 @@ ClassBodyDeclarationsopt ::= NestedType ClassBodyDeclarations
Modifiersopt ::= $empty
/. $putCase consumeDefaultModifiers(); $break ./
-Modifiersopt ::= Modifiers
+Modifiersopt ::= Modifiers
/.$putCase consumeModifiers(); $break ./
/:$readableName Modifiers:/
@@ -1504,6 +1534,7 @@ EnumDeclaration ::= EnumHeader ClassHeaderImplementsopt EnumBody
EnumHeader ::= Modifiersopt 'enum' Identifier
/. $putCase consumeEnumHeader(); $break ./
/:$readableName EnumHeader:/
+/:$compliance 1.5:/
EnumBody ::= '{' EnumBodyDeclarationsopt '}'
/. $putCase consumeEnumBodyNoConstants(); $break ./
@@ -1520,9 +1551,13 @@ EnumConstants ::= EnumConstants ',' EnumConstant
/.$putCase consumeEnumConstants(); $break ./
/:$readableName EnumConstants:/
-EnumConstant ::= Identifier Argumentsopt ClassBody
+EnumConstantHeader ::= Identifier Argumentsopt
+/.$putCase consumeEnumConstantHeader(); $break ./
+/:$readableName EnumConstantHeader:/
+
+EnumConstant ::= EnumConstantHeader ClassBody
/.$putCase consumeEnumConstantWithClassBody(); $break ./
-EnumConstant ::= Identifier Argumentsopt
+EnumConstant ::= EnumConstantHeader
/.$putCase consumeEnumConstantNoClassBody(); $break ./
/:$readableName EnumConstant:/
@@ -1546,18 +1581,23 @@ EnumBodyDeclarationsopt -> EnumDeclarations
-----------------------------------------------
-- 1.5 features : enhanced for statement
-----------------------------------------------
-EnhancedForStatement ::= 'for' '(' Type PushModifiers Identifier ':' Expression ')' Statement
-/.$putCase consumeEnhancedForStatement(false); $break ./
-EnhancedForStatement ::= 'for' '(' Modifiers Type PushModifiers Identifier ':' Expression ')' Statement
-/.$putCase consumeEnhancedForStatement(true); $break ./
+EnhancedForStatement ::= EnhancedForStatementHeader Statement
+/.$putCase consumeEnhancedForStatement(); $break ./
/:$readableName EnhancedForStatement:/
-EnhancedForStatementNoShortIf ::= 'for' '(' Type PushModifiers Identifier ':' Expression ')' StatementNoShortIf
-/.$putCase consumeEnhancedForStatement(false); $break ./
-EnhancedForStatementNoShortIf ::= 'for' '(' Modifiers Type PushModifiers Identifier ':' Expression ')' StatementNoShortIf
-/.$putCase consumeEnhancedForStatement(true); $break ./
+EnhancedForStatementNoShortIf ::= EnhancedForStatementHeader StatementNoShortIf
+/.$putCase consumeEnhancedForStatement(); $break ./
/:$readableName EnhancedForStatementNoShortIf:/
+EnhancedForStatementHeader ::= 'for' '(' Type PushModifiers Identifier Dimsopt ':' Expression ')'
+/.$putCase consumeEnhancedForStatementHeader(false); $break ./
+/:$readableName EnhancedForStatementHeader:/
+/:$compliance 1.5:/
+EnhancedForStatementHeader ::= 'for' '(' Modifiers Type PushRealModifiers Identifier Dimsopt ':' Expression ')'
+/.$putCase consumeEnhancedForStatementHeader(true); $break ./
+/:$readableName EnhancedForStatementHeader:/
+/:$compliance 1.5:/
+
-----------------------------------------------
-- 1.5 features : static imports
-----------------------------------------------
@@ -1568,6 +1608,7 @@ SingleStaticImportDeclaration ::= SingleStaticImportDeclarationName ';'
SingleStaticImportDeclarationName ::= 'import' 'static' Name
/.$putCase consumeSingleStaticImportDeclarationName(); $break ./
/:$readableName SingleStaticImportDeclarationName:/
+/:$compliance 1.5:/
StaticImportOnDemandDeclaration ::= StaticImportOnDemandDeclarationName ';'
/.$putCase consumeImportDeclaration(); $break ./
@@ -1576,6 +1617,7 @@ StaticImportOnDemandDeclaration ::= StaticImportOnDemandDeclarationName ';'
StaticImportOnDemandDeclarationName ::= 'import' 'static' Name '.' '*'
/.$putCase consumeStaticImportOnDemandDeclarationName(); $break ./
/:$readableName StaticImportOnDemandDeclarationName:/
+/:$compliance 1.5:/
-----------------------------------------------
-- 1.5 features : generics
@@ -1583,130 +1625,178 @@ StaticImportOnDemandDeclarationName ::= 'import' 'static' Name '.' '*'
TypeArguments ::= '<' TypeArgumentList1
/.$putCase consumeTypeArguments(); $break ./
/:$readableName TypeArguments:/
+/:$compliance 1.5:/
OnlyTypeArguments ::= '<' TypeArgumentList1
/.$putCase consumeOnlyTypeArguments(); $break ./
/:$readableName TypeArguments:/
+/:$compliance 1.5:/
TypeArgumentList1 -> TypeArgument1
+/:$compliance 1.5:/
TypeArgumentList1 ::= TypeArgumentList ',' TypeArgument1
/.$putCase consumeTypeArgumentList1(); $break ./
/:$readableName TypeArgumentList1:/
+/:$compliance 1.5:/
TypeArgumentList -> TypeArgument
+/:$compliance 1.5:/
TypeArgumentList ::= TypeArgumentList ',' TypeArgument
/.$putCase consumeTypeArgumentList(); $break ./
/:$readableName TypeArgumentList:/
+/:$compliance 1.5:/
TypeArgument ::= ReferenceType
/.$putCase consumeTypeArgument(); $break ./
+/:$compliance 1.5:/
TypeArgument -> Wildcard
/:$readableName TypeArgument:/
+/:$compliance 1.5:/
TypeArgument1 -> ReferenceType1
+/:$compliance 1.5:/
TypeArgument1 -> Wildcard1
/:$readableName TypeArgument1:/
+/:$compliance 1.5:/
ReferenceType1 ::= ReferenceType '>'
/.$putCase consumeReferenceType1(); $break ./
+/:$compliance 1.5:/
ReferenceType1 ::= ClassOrInterface '<' TypeArgumentList2
/.$putCase consumeTypeArgumentReferenceType1(); $break ./
/:$readableName ReferenceType1:/
+/:$compliance 1.5:/
TypeArgumentList2 -> TypeArgument2
+/:$compliance 1.5:/
TypeArgumentList2 ::= TypeArgumentList ',' TypeArgument2
/.$putCase consumeTypeArgumentList2(); $break ./
/:$readableName TypeArgumentList2:/
+/:$compliance 1.5:/
TypeArgument2 -> ReferenceType2
+/:$compliance 1.5:/
TypeArgument2 -> Wildcard2
/:$readableName TypeArgument2:/
+/:$compliance 1.5:/
ReferenceType2 ::= ReferenceType '>>'
/.$putCase consumeReferenceType2(); $break ./
+/:$compliance 1.5:/
ReferenceType2 ::= ClassOrInterface '<' TypeArgumentList3
/.$putCase consumeTypeArgumentReferenceType2(); $break ./
/:$readableName ReferenceType2:/
+/:$compliance 1.5:/
TypeArgumentList3 -> TypeArgument3
TypeArgumentList3 ::= TypeArgumentList ',' TypeArgument3
/.$putCase consumeTypeArgumentList3(); $break ./
/:$readableName TypeArgumentList3:/
+/:$compliance 1.5:/
TypeArgument3 -> ReferenceType3
TypeArgument3 -> Wildcard3
/:$readableName TypeArgument3:/
+/:$compliance 1.5:/
ReferenceType3 ::= ReferenceType '>>>'
/.$putCase consumeReferenceType3(); $break ./
/:$readableName ReferenceType3:/
+/:$compliance 1.5:/
Wildcard ::= '?'
/.$putCase consumeWildcard(); $break ./
+/:$compliance 1.5:/
Wildcard ::= '?' WildcardBounds
/.$putCase consumeWildcardWithBounds(); $break ./
/:$readableName Wildcard:/
+/:$compliance 1.5:/
WildcardBounds ::= 'extends' ReferenceType
/.$putCase consumeWildcardBoundsExtends(); $break ./
+/:$compliance 1.5:/
WildcardBounds ::= 'super' ReferenceType
/.$putCase consumeWildcardBoundsSuper(); $break ./
/:$readableName WildcardBounds:/
+/:$compliance 1.5:/
Wildcard1 ::= '?' '>'
/.$putCase consumeWildcard1(); $break ./
+/:$compliance 1.5:/
Wildcard1 ::= '?' WildcardBounds1
/.$putCase consumeWildcard1WithBounds(); $break ./
/:$readableName Wildcard1:/
+/:$compliance 1.5:/
WildcardBounds1 ::= 'extends' ReferenceType1
/.$putCase consumeWildcardBounds1Extends(); $break ./
+/:$compliance 1.5:/
WildcardBounds1 ::= 'super' ReferenceType1
/.$putCase consumeWildcardBounds1Super(); $break ./
/:$readableName WildcardBounds1:/
+/:$compliance 1.5:/
Wildcard2 ::= '?' '>>'
/.$putCase consumeWildcard2(); $break ./
+/:$compliance 1.5:/
Wildcard2 ::= '?' WildcardBounds2
/.$putCase consumeWildcard2WithBounds(); $break ./
/:$readableName Wildcard2:/
+/:$compliance 1.5:/
WildcardBounds2 ::= 'extends' ReferenceType2
/.$putCase consumeWildcardBounds2Extends(); $break ./
+/:$compliance 1.5:/
WildcardBounds2 ::= 'super' ReferenceType2
/.$putCase consumeWildcardBounds2Super(); $break ./
/:$readableName WildcardBounds2:/
+/:$compliance 1.5:/
Wildcard3 ::= '?' '>>>'
/.$putCase consumeWildcard3(); $break ./
+/:$compliance 1.5:/
Wildcard3 ::= '?' WildcardBounds3
/.$putCase consumeWildcard3WithBounds(); $break ./
/:$readableName Wildcard3:/
+/:$compliance 1.5:/
WildcardBounds3 ::= 'extends' ReferenceType3
/.$putCase consumeWildcardBounds3Extends(); $break ./
+/:$compliance 1.5:/
WildcardBounds3 ::= 'super' ReferenceType3
/.$putCase consumeWildcardBounds3Super(); $break ./
/:$readableName WildcardBound3:/
+/:$compliance 1.5:/
+
+TypeParameterHeader ::= Identifier
+/.$putCase consumeTypeParameterHeader(); $break ./
+/:$readableName TypeParameter:/
+/:$compliance 1.5:/
TypeParameters ::= '<' TypeParameterList1
/.$putCase consumeTypeParameters(); $break ./
/:$readableName TypeParameters:/
+/:$compliance 1.5:/
TypeParameterList -> TypeParameter
+/:$compliance 1.5:/
TypeParameterList ::= TypeParameterList ',' TypeParameter
/.$putCase consumeTypeParameterList(); $break ./
/:$readableName TypeParameterList:/
+/:$compliance 1.5:/
-TypeParameter ::= Identifier
-/.$putCase consumeTypeParameter(); $break ./
-TypeParameter ::= Identifier 'extends' ReferenceType
+TypeParameter -> TypeParameterHeader
+/:$compliance 1.5:/
+TypeParameter ::= TypeParameterHeader 'extends' ReferenceType
/.$putCase consumeTypeParameterWithExtends(); $break ./
-TypeParameter ::= Identifier 'extends' ReferenceType AdditionalBoundList
+/:$compliance 1.5:/
+TypeParameter ::= TypeParameterHeader 'extends' ReferenceType AdditionalBoundList
/.$putCase consumeTypeParameterWithExtendsAndBounds(); $break ./
/:$readableName TypeParameter:/
+/:$compliance 1.5:/
AdditionalBoundList -> AdditionalBound
+/:$compliance 1.5:/
AdditionalBoundList ::= AdditionalBoundList AdditionalBound
/.$putCase consumeAdditionalBoundList(); $break ./
/:$readableName AdditionalBoundList:/
@@ -1714,28 +1804,37 @@ AdditionalBoundList ::= AdditionalBoundList AdditionalBound
AdditionalBound ::= '&' ReferenceType
/.$putCase consumeAdditionalBound(); $break ./
/:$readableName AdditionalBound:/
+/:$compliance 1.5:/
TypeParameterList1 -> TypeParameter1
+/:$compliance 1.5:/
TypeParameterList1 ::= TypeParameterList ',' TypeParameter1
/.$putCase consumeTypeParameterList1(); $break ./
/:$readableName TypeParameterList1:/
+/:$compliance 1.5:/
-TypeParameter1 ::= Identifier '>'
+TypeParameter1 ::= TypeParameterHeader '>'
/.$putCase consumeTypeParameter1(); $break ./
-TypeParameter1 ::= Identifier 'extends' ReferenceType1
+/:$compliance 1.5:/
+TypeParameter1 ::= TypeParameterHeader 'extends' ReferenceType1
/.$putCase consumeTypeParameter1WithExtends(); $break ./
-TypeParameter1 ::= Identifier 'extends' ReferenceType AdditionalBoundList1
+/:$compliance 1.5:/
+TypeParameter1 ::= TypeParameterHeader 'extends' ReferenceType AdditionalBoundList1
/.$putCase consumeTypeParameter1WithExtendsAndBounds(); $break ./
/:$readableName TypeParameter1:/
+/:$compliance 1.5:/
AdditionalBoundList1 -> AdditionalBound1
+/:$compliance 1.5:/
AdditionalBoundList1 ::= AdditionalBoundList AdditionalBound1
/.$putCase consumeAdditionalBoundList1(); $break ./
/:$readableName AdditionalBoundList1:/
+/:$compliance 1.5:/
AdditionalBound1 ::= '&' ReferenceType1
/.$putCase consumeAdditionalBound1(); $break ./
/:$readableName AdditionalBound1:/
+/:$compliance 1.5:/
-------------------------------------------------
-- Duplicate rules to remove ambiguity for (x) --
@@ -1894,96 +1993,137 @@ Expression_NotName -> AssignmentExpression_NotName
-----------------------------------------------
-- 1.5 features : annotation - Metadata feature jsr175
-----------------------------------------------
-AnnotationTypeDeclaration ::= Modifiers '@' interface Identifier AnnotationTypeBody
-/.$putCase consumeAnnotationTypeDeclaration() ; $break ./
-AnnotationTypeDeclaration ::= '@' interface Identifier AnnotationTypeBody
+AnnotationTypeDeclarationHeader ::= Modifiers '@' PushRealModifiers interface Identifier
+/.$putCase consumeAnnotationTypeDeclarationHeader() ; $break ./
+/:$compliance 1.5:/
+AnnotationTypeDeclarationHeader ::= '@' PushModifiers interface Identifier
+/.$putCase consumeAnnotationTypeDeclarationHeader() ; $break ./
+/:$readableName AnnotationTypeDeclarationHeader:/
+/:$compliance 1.5:/
+
+AnnotationTypeDeclaration ::= AnnotationTypeDeclarationHeader AnnotationTypeBody
/.$putCase consumeAnnotationTypeDeclaration() ; $break ./
/:$readableName AnnotationTypeDeclaration:/
+/:$compliance 1.5:/
AnnotationTypeBody ::= '{' AnnotationTypeMemberDeclarationsopt '}'
-/.$putCase consumeAnnotationTypeBody() ; $break ./
/:$readableName AnnotationTypeBody:/
+/:$compliance 1.5:/
AnnotationTypeMemberDeclarationsopt ::= $empty
-/.$putCase consumeEmptyAnnotationTypeMemberDeclarations() ; $break ./
+/.$putCase consumeEmptyAnnotationTypeMemberDeclarationsopt() ; $break ./
+/:$compliance 1.5:/
AnnotationTypeMemberDeclarationsopt -> AnnotationTypeMemberDeclarations
/:$readableName AnnotationTypeMemberDeclarationsopt:/
+/:$compliance 1.5:/
AnnotationTypeMemberDeclarations -> AnnotationTypeMemberDeclaration
+/:$compliance 1.5:/
AnnotationTypeMemberDeclarations ::= AnnotationTypeMemberDeclarations AnnotationTypeMemberDeclaration
/.$putCase consumeAnnotationTypeMemberDeclarations() ; $break ./
/:$readableName AnnotationTypeMemberDeclarations:/
+/:$compliance 1.5:/
+
+AnnotationTypeMemberDeclarationHeader ::= Modifiersopt Type Identifier '(' ')'
+/.$putCase consumeAnnotationTypeMemberDeclarationHeader() ; $break ./
+/:$readableName AnnotationTypeMemberDeclarationHeader:/
+/:$compliance 1.5:/
+
+AnnotationTypeMemberHeaderExtendedDims ::= Dimsopt
+/.$putCase consumeAnnotationTypeMemberHeaderExtendedDims() ; $break ./
+/:$readableName AnnotationTypeMemberHeaderExtendedDims:/
+/:$compliance 1.5:/
-AnnotationTypeMemberDeclaration ::= Modifiersopt Type Identifier '(' ')' DefaultValueopt ';'
+AnnotationTypeMemberDeclaration ::= AnnotationTypeMemberDeclarationHeader AnnotationTypeMemberHeaderExtendedDims DefaultValueopt ';'
/.$putCase consumeAnnotationTypeMemberDeclaration() ; $break ./
-AnnotationTypeMemberDeclaration ::= ';'
-/.$putCase consumeEmptyAnnotationTypeMemberDeclaration() ; $break ./
+/:$compliance 1.5:/
AnnotationTypeMemberDeclaration -> ConstantDeclaration
-AnnotationTypeMemberDeclaration -> ClassDeclaration
-AnnotationTypeMemberDeclaration -> InterfaceDeclaration
-AnnotationTypeMemberDeclaration -> EnumDeclaration
-AnnotationTypeMemberDeclaration -> AnnotationTypeDeclaration
+/:$compliance 1.5:/
+AnnotationTypeMemberDeclaration -> TypeDeclaration
/:$readableName AnnotationTypeMemberDeclaration:/
+/:$compliance 1.5:/
DefaultValueopt ::= $empty
/.$putCase consumeEmptyDefaultValue() ; $break ./
+/:$compliance 1.5:/
DefaultValueopt -> DefaultValue
/:$readableName DefaultValueopt:/
+/:$compliance 1.5:/
DefaultValue ::= 'default' MemberValue
-/.$putCase consumeDefaultValue() ; $break ./
/:$readableName DefaultValue:/
+/:$compliance 1.5:/
Annotation -> NormalAnnotation
+/:$compliance 1.5:/
Annotation -> MarkerAnnotation
+/:$compliance 1.5:/
Annotation -> SingleMemberAnnotation
/:$readableName Annotation:/
+/:$compliance 1.5:/
NormalAnnotation ::= '@' Name '(' MemberValuePairsopt ')'
/.$putCase consumeNormalAnnotation() ; $break ./
/:$readableName NormalAnnotation:/
+/:$compliance 1.5:/
MemberValuePairsopt ::= $empty
-/.$putCase consumeEmptyMemberValuePairs() ; $break ./
+/.$putCase consumeEmptyMemberValuePairsopt() ; $break ./
+/:$compliance 1.5:/
MemberValuePairsopt -> MemberValuePairs
/:$readableName MemberValuePairsopt:/
+/:$compliance 1.5:/
MemberValuePairs -> MemberValuePair
+/:$compliance 1.5:/
MemberValuePairs ::= MemberValuePairs ',' MemberValuePair
/.$putCase consumeMemberValuePairs() ; $break ./
/:$readableName MemberValuePairs:/
+/:$compliance 1.5:/
MemberValuePair ::= SimpleName '=' MemberValue
/.$putCase consumeMemberValuePair() ; $break ./
/:$readableName MemberValuePair:/
+/:$compliance 1.5:/
MemberValue -> ConditionalExpression_NotName
+/:$compliance 1.5:/
MemberValue -> Annotation
+/:$compliance 1.5:/
MemberValue -> MemberValueArrayInitializer
/:$readableName MemberValue:/
+/:$compliance 1.5:/
MemberValueArrayInitializer ::= '{' MemberValues ',' '}'
/.$putCase consumeMemberValueArrayInitializer() ; $break ./
+/:$compliance 1.5:/
MemberValueArrayInitializer ::= '{' MemberValues '}'
/.$putCase consumeMemberValueArrayInitializer() ; $break ./
+/:$compliance 1.5:/
MemberValueArrayInitializer ::= '{' ',' '}'
-/.$putCase consumeMemberValueArrayInitializer() ; $break ./
+/.$putCase consumeEmptyMemberValueArrayInitializer() ; $break ./
+/:$compliance 1.5:/
MemberValueArrayInitializer ::= '{' '}'
-/.$putCase consumeMemberValueArrayInitializer() ; $break ./
+/.$putCase consumeEmptyMemberValueArrayInitializer() ; $break ./
/:$readableName MemberValueArrayInitializer:/
+/:$compliance 1.5:/
MemberValues -> MemberValue
+/:$compliance 1.5:/
MemberValues ::= MemberValues ',' MemberValue
/.$putCase consumeMemberValues() ; $break ./
/:$readableName MemberValues:/
+/:$compliance 1.5:/
MarkerAnnotation ::= '@' Name
/.$putCase consumeMarkerAnnotation() ; $break ./
/:$readableName MarkerAnnotation:/
+/:$compliance 1.5:/
SingleMemberAnnotation ::= '@' Name '(' MemberValue ')'
/.$putCase consumeSingleMemberAnnotation() ; $break ./
/:$readableName SingleMemberAnnotation:/
+/:$compliance 1.5:/
-----------------------------------------------
-- 1.5 features : end of annotation
-----------------------------------------------
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CompletionRequestorAdapter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CompletionRequestorAdapter.java
index f5a686c2ba..0a946be047 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CompletionRequestorAdapter.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CompletionRequestorAdapter.java
@@ -20,6 +20,7 @@ import org.eclipse.jdt.core.compiler.IProblem;
*
* @see ICompletionRequestor
* @since 2.0
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Subclass {@link CompletionRequestor} instead.
*/
// TODO (jerome - once CompletionRequestor is working) @ deprecated Subclass {@link CompletionRequestor} instead.
public class CompletionRequestorAdapter implements ICompletionRequestor {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CorrectionEngine.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CorrectionEngine.java
index c11b812917..b9e7e16673 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CorrectionEngine.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CorrectionEngine.java
@@ -196,27 +196,6 @@ public class CorrectionEngine implements ProblemReasons {
try {
switch (id) {
// Type correction
- case IProblem.FieldTypeNotFound :
- case IProblem.ArgumentTypeNotFound :
- this.filter = CLASSES | INTERFACES;
- argument = arguments[2];
- break;
- case IProblem.SuperclassNotFound :
- this.filter = CLASSES;
- argument = arguments[0];
- break;
- case IProblem.InterfaceNotFound :
- this.filter = INTERFACES;
- argument = arguments[0];
- break;
- case IProblem.ExceptionTypeNotFound :
- this.filter = CLASSES;
- argument = arguments[1];
- break;
- case IProblem.ReturnTypeNotFound :
- this.filter = CLASSES | INTERFACES;
- argument = arguments[1];
- break;
case IProblem.ImportNotFound :
this.filter = IMPORT;
argument = arguments[0];
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICodeAssist.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICodeAssist.java
index 460939e386..d73f876974 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICodeAssist.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICodeAssist.java
@@ -57,6 +57,7 @@ public interface ICodeAssist {
*
* @exception IllegalArgumentException if <code>requestor</code> is <code>null</code>
* @since 2.0
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link #codeComplete(int, CompletionRequestor)} instead.
*/
// TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link #codeComplete(int, CompletionRequestor)} instead.
void codeComplete(int offset, ICompletionRequestor requestor)
@@ -114,6 +115,7 @@ public interface ICodeAssist {
*
* @exception IllegalArgumentException if <code>requestor</code> is <code>null</code>
* @since 3.0
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link #codeComplete(int, CompletionRequestor, WorkingCopyOwner)} instead.
*/
// TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link #codeComplete(int, CompletionRequestor, WorkingCopyOwner)} instead.
void codeComplete(int offset, ICompletionRequestor requestor, WorkingCopyOwner owner)
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICompletionRequestor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICompletionRequestor.java
index 489e0e1887..28528ea973 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICompletionRequestor.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICompletionRequestor.java
@@ -21,6 +21,8 @@ import org.eclipse.jdt.core.compiler.IProblem;
*
* @see ICodeAssist
* @since 2.0
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor}, an abstract class
+ * with all the same methods (and more).
*/
// TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor}, an abstract class with all the same methods (and more).
public interface ICompletionRequestor {
@@ -54,6 +56,7 @@ public interface ICompletionRequestor {
* The default package is represented by an empty array.
*
* NOTE: parameter names can be retrieved from the source model after the user selects a specific method.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptAnonymousType(char[], char[], char[][], char[][], char[][], char[], int, int, int, int)} instead.
*/
// TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptAnonymousType(char[], char[], char[][], char[][], char[][], char[], int, int, int, int)} instead.
void acceptAnonymousType(
@@ -85,6 +88,7 @@ void acceptAnonymousType(
* Package names are in the form "a.b.c".
* Nested type names are in the qualified form "A.M".
* The default package is represented by an empty array.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptClass(char[], char[], char[], int, int, int, int)} instead.
*/
// TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptClass(char[], char[], char[], int, int, int, int)} instead.
void acceptClass(
@@ -105,6 +109,7 @@ void acceptClass(
* detected (might be in another compilation unit, if it was indirectly requested
* during the code assist process).
* Note: the problem knows its originating file name.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptError(IProblem)} instead.
*/
// TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptError(IProblem)} instead.
void acceptError(IProblem error);
@@ -131,6 +136,7 @@ void acceptError(IProblem error);
* Array types are in the qualified form "M[]" or "int[]".
* Nested type names are in the qualified form "A.M".
* The default package is represented by an empty array.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptField(char[], char[], char[], char[], char[], char[], int, int, int, int)} instead.
*/
// TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptField(char[], char[], char[], char[], char[], char[], int, int, int, int)} instead.
void acceptField(
@@ -162,6 +168,7 @@ void acceptField(
* Package names are in the form "a.b.c".
* Nested type names are in the qualified form "A.M".
* The default package is represented by an empty array.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptInterface(char[], char[], char[], int, int, int, int)} instead.
*/
// TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptInterface(char[], char[], char[], int, int, int, int)} instead.
void acceptInterface(
@@ -181,6 +188,7 @@ void acceptInterface(
* It is a positive integer which are used for determine if this proposal is more relevant than another proposal.
* This value can only be used for compare relevance. A proposal is more relevant than another if his relevance
* value is higher.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptKeyword(char[], int, int, int)} instead.
*/
// TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptKeyword(char[], int, int, int)} instead.
void acceptKeyword(char[] keywordName, int completionStart, int completionEnd, int relevance);
@@ -194,6 +202,7 @@ void acceptKeyword(char[] keywordName, int completionStart, int completionEnd, i
* It is a positive integer which are used for determine if this proposal is more relevant than another proposal.
* This value can only be used for compare relevance. A proposal is more relevant than another if his relevance
* value is higher.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptLabel(char[], int, int, int)} instead.
*/
// TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptLabel(char[], int, int, int)} instead.
void acceptLabel(char[] labelName, int completionStart, int completionEnd, int relevance);
@@ -217,6 +226,7 @@ void acceptLabel(char[] labelName, int completionStart, int completionEnd, int r
* Array types are in the qualified form "M[]" or "int[]".
* Nested type names are in the qualified form "A.M".
* The default package is represented by an empty array.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptLocalVariable(char[], char[], char[], int, int, int, int)} instead.
*/
// TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptLocalVariable(char[], char[], char[], int, int, int, int)} instead.
void acceptLocalVariable(
@@ -258,6 +268,7 @@ void acceptLocalVariable(
* The default package is represented by an empty array.
*
* NOTE: parameter names can be retrieved from the source model after the user selects a specific method.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptMethod(char[], char[], char[], char[][], char[][], char[][], char[], char[], char[], int, int, int, int)} instead.
*/
// TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptMethod(char[], char[], char[], char[][], char[][], char[][], char[], char[], char[], int, int, int, int)} instead.
void acceptMethod(
@@ -306,6 +317,7 @@ void acceptMethod(
* The default package is represented by an empty array.
*
* NOTE: parameter names can be retrieved from the source model after the user selects a specific method.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptMethodDeclaration(char[], char[], char[], char[][], char[][], char[][], char[], char[], char[], int, int, int, int)} instead.
*/
// TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptMethodDeclaration(char[], char[], char[], char[][], char[][], char[][], char[], char[], char[], int, int, int, int)} instead.
void acceptMethodDeclaration(
@@ -332,6 +344,7 @@ void acceptMethodDeclaration(
* It is a positive integer which are used for determine if this proposal is more relevant than another proposal.
* This value can only be used for compare relevance. A proposal is more relevant than another if his relevance
* value is higher.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptModifier(char[], int, int, int)} instead.
*/
// TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptModifier(char[], int, int, int)} instead.
void acceptModifier(char[] modifierName, int completionStart, int completionEnd, int relevance);
@@ -350,6 +363,7 @@ void acceptModifier(char[] modifierName, int completionStart, int completionEnd,
* NOTE - All package names are presented in their readable form:
* Package names are in the form "a.b.c".
* The default package is represented by an empty array.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptPackage(char[], char[], int, int, int)} instead.
*/
// TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptPackage(char[], char[], int, int, int)} instead.
void acceptPackage(
@@ -375,6 +389,7 @@ void acceptPackage(
* Package names are in the form "a.b.c".
* Nested type names are in the qualified form "A.M".
* The default package is represented by an empty array.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptType(char[], char[], char[], int, int, int)} instead.
*/
// TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptType(char[], char[], char[], int, int, int)} instead.
void acceptType(
@@ -405,6 +420,7 @@ void acceptType(
* Array types are in the qualified form "M[]" or "int[]".
* Nested type names are in the qualified form "A.M".
* The default package is represented by an empty array.
+ * TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptTypeVariable(char[], int, int, int)} instead.
*/
// TODO (jerome - once CompletionRequestor is working) @ deprecated Use {@link CompletionRequestor#acceptTypeVariable(char[], int, int, int)} instead.
void acceptVariableName(
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
index b586249919..7af34d9e57 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
@@ -64,6 +64,10 @@ import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IPreferencesService;
+import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
@@ -71,6 +75,7 @@ import org.eclipse.jdt.internal.core.*;
import org.eclipse.jdt.internal.core.util.MementoTokenizer;
import org.eclipse.jdt.internal.core.util.Util;
import org.osgi.framework.BundleContext;
+import org.osgi.service.prefs.BackingStoreException;
/**
* The plug-in runtime class for the Java model plug-in containing the core
@@ -370,6 +375,18 @@ public final class JavaCore extends Plugin {
/**
* Possible configurable option ID.
* @see #getDefaultOptions()
+ * @since 3.1
+ */
+ public static final String COMPILER_PB_UNSAFE_TYPE_OPERATION = PLUGIN_ID + ".compiler.problem.unsafeTypeOperation"; //$NON-NLS-1$
+ /**
+ * Possible configurable option ID.
+ * @see #getDefaultOptions()
+ * @since 3.1
+ */
+ public static final String COMPILER_PB_FINAL_PARAMETER_BOUND = PLUGIN_ID + ".compiler.problem.finalParameterBound"; //$NON-NLS-1$
+ /**
+ * Possible configurable option ID.
+ * @see #getDefaultOptions()
* @since 3.0
*/
public static final String COMPILER_PB_INVALID_JAVADOC = PLUGIN_ID + ".compiler.problem.invalidJavadoc"; //$NON-NLS-1$
@@ -872,6 +889,14 @@ public final class JavaCore extends Plugin {
public static final String PRIVATE = "private"; //$NON-NLS-1$
/**
+ * New Preferences API
+ * @since 3.1
+ */
+ public static final IEclipsePreferences[] preferencesLookup = new IEclipsePreferences[2];
+ static final int PREF_INSTANCE = 0;
+ static final int PREF_DEFAULT = 1;
+
+ /**
* Creates the Java core plug-in.
* <p>
* The plug-in instance is created automatically by the
@@ -1399,6 +1424,33 @@ public final class JavaCore extends Plugin {
* Note: more options might be added in further releases.
* <pre>
* RECOGNIZED OPTIONS:
+ *
+ * COMPILER / Setting Compliance Level
+ * Select the compliance level for the compiler. In "1.3" mode, source and target settings
+ * should not go beyond "1.3" level.
+ * - option id: "org.eclipse.jdt.core.compiler.compliance"
+ * - possible values: { "1.3", "1.4", "1.5" }
+ * - default: "1.4"
+ *
+ * COMPILER / Setting Source Compatibility Mode
+ * Specify whether which source level compatibility is used. From 1.4 on, 'assert' is a keyword
+ * reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
+ * level should be set to "1.4" and the compliance mode should be "1.4".
+ * Source level 1.5 is necessary to enable generics, autoboxing, covariance, annotations, enumerations
+ * enhanced for loop, static imports and varargs. Once toggled, the target VM level should be set to "1.5"
+ * and the compliance mode should be "1.5".
+ * - option id: "org.eclipse.jdt.core.compiler.source"
+ * - possible values: { "1.3", "1.4", "1.5" }
+ * - default: "1.3"
+ *
+ * COMPILER / Defining Target Java Platform
+ * For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
+ * Note that "1.4" target require to toggle compliance mode to "1.4" too. Similarily, "1.5" target require
+ * to toggle compliance mode to "1.5".
+ * - option id: "org.eclipse.jdt.core.compiler.codegen.targetPlatform"
+ * - possible values: { "1.1", "1.2", "1.3", "1.4", "1.5" }
+ * - default: "1.2"
+ *
* COMPILER / Generating Local Variable Debug Attribute
* When generated, this attribute will enable local variable names
* to be displayed in debugger, only in place where variables are
@@ -1428,18 +1480,13 @@ public final class JavaCore extends Plugin {
* - possible values: { "preserve", "optimize out" }
* - default: "preserve"
*
- * COMPILER / Defining Target Java Platform
- * For binary compatibility reason, .class files can be tagged to with certain VM versions and later.
- * Note that "1.4" target require to toggle compliance mode to "1.4" too.
- * - option id: "org.eclipse.jdt.core.compiler.codegen.targetPlatform"
- * - possible values: { "1.1", "1.2", "1.3", "1.4" }
- * - default: "1.2"
- *
* COMPILER / Inline JSR Bytecode Instruction
* When enabled, the compiler will no longer generate JSR instructions, but rather inline corresponding
* subroutine code sequences (mostly corresponding to try finally blocks). The generated code will thus
* get bigger, but will load faster on virtual machines since the verification process is then much simpler.
* This mode is anticipating support for the Java Specification Request 202.
+ * Note that JSR inlining is optional only for target platform lesser than 1.5. From 1.5 on, the JSR
+ * inlining is mandatory (also see related setting "org.eclipse.jdt.core.compiler.codegen.targetPlatform").
* - option id: "org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode"
* - possible values: { "enabled", "disabled" }
* - default: "disabled"
@@ -1691,6 +1738,20 @@ public final class JavaCore extends Plugin {
* - possible values: { "error", "warning", "ignore" }
* - default: "ignore"
*
+ * COMPILER / Reporting Unsafe Type Operation
+ * When enabled, the compiler will issue an error or a warning whenever an operation involves generic types, and potentially
+ * invalidates type safety since involving raw types (e.g. invoking #foo(X<String>) with arguments (X)).
+ * - option id: "org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "warning"
+ *
+ * COMPILER / Reporting final Bound for Type Parameter
+ * When enabled, the compiler will issue an error or a warning whenever a generic type parameter is associated with a
+ * bound corresponding to a final type; since final types cannot be further extended, the parameter is pretty useless.
+ * - option id: "org.eclipse.jdt.core.compiler.problem.finalParameterBound"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "ignore"
+ *
* COMPILER / Reporting Invalid Javadoc Comment
* This is the generic control for the severity of Javadoc problems.
* When enabled, the compiler will issue an error or a warning for a problem in Javadoc.
@@ -1759,21 +1820,6 @@ public final class JavaCore extends Plugin {
* - possible values: { "enabled", "disabled" }
* - default: "enabled"
*
- * COMPILER / Setting Source Compatibility Mode
- * Specify whether which source level compatibility is used. From 1.4 on, 'assert' is a keyword
- * reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
- * level should be set to "1.4" and the compliance mode should be "1.4".
- * - option id: "org.eclipse.jdt.core.compiler.source"
- * - possible values: { "1.3", "1.4" }
- * - default: "1.3"
- *
- * COMPILER / Setting Compliance Level
- * Select the compliance level for the compiler. In "1.3" mode, source and target settings
- * should not go beyond "1.3" level.
- * - option id: "org.eclipse.jdt.core.compiler.compliance"
- * - possible values: { "1.3", "1.4" }
- * - default: "1.4"
- *
* COMPILER / Maximum number of problems reported per compilation unit
* Specify the maximum number of problems reported on each compilation unit.
* - option id: "org.eclipse.jdt.core.compiler.maxProblemPerUnit"
@@ -2031,14 +2077,15 @@ public final class JavaCore extends Plugin {
Hashtable defaultOptions = new Hashtable(10);
// see #initializeDefaultPluginPreferences() for changing default settings
- Preferences preferences = getPlugin().getPluginPreferences();
+ IEclipsePreferences defaultPreferences = getDefaultPreferences();
HashSet optionNames = JavaModelManager.getJavaModelManager().optionNames;
// initialize preferences to their default
Iterator iterator = optionNames.iterator();
while (iterator.hasNext()) {
String propertyName = (String) iterator.next();
- defaultOptions.put(propertyName, preferences.getDefaultString(propertyName));
+ String value = defaultPreferences.get(propertyName, null);
+ if (value != null) defaultOptions.put(propertyName, value);
}
// get encoding through resource plugin
defaultOptions.put(CORE_ENCODING, getEncoding());
@@ -2048,6 +2095,26 @@ public final class JavaCore extends Plugin {
return defaultOptions;
}
+
+ /**
+ * @since 3.1
+ */
+ public static IEclipsePreferences getInstancePreferences() {
+ if (preferencesLookup[PREF_INSTANCE] == null) {
+ preferencesLookup[PREF_INSTANCE] = new InstanceScope().getNode(PLUGIN_ID);
+ }
+ return preferencesLookup[PREF_INSTANCE];
+ }
+
+ /**
+ * @since 3.1
+ */
+ public static IEclipsePreferences getDefaultPreferences() {
+ if (preferencesLookup[PREF_DEFAULT] == null) {
+ preferencesLookup[PREF_DEFAULT] = new DefaultScope().getNode(PLUGIN_ID);
+ }
+ return preferencesLookup[PREF_DEFAULT];
+ }
/**
* Returns the workspace root default charset encoding.
@@ -2090,6 +2157,7 @@ public final class JavaCore extends Plugin {
* @param optionName the name of an option
* @return the String value of a given option
* @see JavaCore#getDefaultOptions()
+ * @see #initializeDefaultPreferences() for changing default settings
* @since 2.0
*/
public static String getOption(String optionName) {
@@ -2104,8 +2172,9 @@ public final class JavaCore extends Plugin {
}
String propertyName = optionName;
if (JavaModelManager.getJavaModelManager().optionNames.contains(propertyName)){
- Preferences preferences = getPlugin().getPluginPreferences();
- return preferences.getString(propertyName).trim();
+ IPreferencesService service = Platform.getPreferencesService();
+ String value = service.get(optionName, null, preferencesLookup);
+ return value==null ? null : value.trim();
}
return null;
}
@@ -2119,39 +2188,34 @@ public final class JavaCore extends Plugin {
*
* @return table of current settings of all options
* (key type: <code>String</code>; value type: <code>String</code>)
- * @see JavaCore#getDefaultOptions()
+ * @see #getDefaultOptions()
+ * @see #initializeDefaultPreferences() for changing default settings
*/
public static Hashtable getOptions() {
-
+
+ // init
Hashtable options = new Hashtable(10);
+ HashSet optionNames = JavaModelManager.getJavaModelManager().optionNames;
+ IPreferencesService service = Platform.getPreferencesService();
- // see #initializeDefaultPluginPreferences() for changing default settings
- Plugin plugin = getPlugin();
- if (plugin != null) {
- Preferences preferences = getPlugin().getPluginPreferences();
- HashSet optionNames = JavaModelManager.getJavaModelManager().optionNames;
-
- // initialize preferences to their default
- Iterator iterator = optionNames.iterator();
- while (iterator.hasNext()) {
- String propertyName = (String) iterator.next();
- options.put(propertyName, preferences.getDefaultString(propertyName));
- }
- // get preferences not set to their default
- String[] propertyNames = preferences.propertyNames();
- for (int i = 0; i < propertyNames.length; i++){
- String propertyName = propertyNames[i];
- String value = preferences.getString(propertyName).trim();
- if (optionNames.contains(propertyName)){
- options.put(propertyName, value);
- }
- }
- // get encoding through resource plugin
- options.put(CORE_ENCODING, getEncoding());
- // backward compatibility
- options.put(COMPILER_PB_INVALID_IMPORT, ERROR);
- options.put(COMPILER_PB_UNREACHABLE_CODE, ERROR);
+ // set options using preferences service lookup
+ Iterator iterator = optionNames.iterator();
+ while (iterator.hasNext()) {
+ String propertyName = (String) iterator.next();
+ String propertyValue = service.get(propertyName, null, preferencesLookup);
+ if (propertyValue != null) {
+ options.put(propertyName, propertyValue);
+ }
}
+
+ // get encoding through resource plugin
+ options.put(CORE_ENCODING, getEncoding());
+
+ // backward compatibility
+ options.put(COMPILER_PB_INVALID_IMPORT, ERROR);
+ options.put(COMPILER_PB_UNREACHABLE_CODE, ERROR);
+
+ // return built map
return options;
}
@@ -2332,13 +2396,15 @@ public final class JavaCore extends Plugin {
if (result == null) return JavaModelManager.NO_WORKING_COPY;
return result;
}
-
- /**
+
+ /*
* Initializes the default preferences settings for this plug-in.
*/
- protected void initializeDefaultPluginPreferences() {
+ protected void initializeDefaultPreferences() {
+
+ // Init and store default and instance preferences
+ IEclipsePreferences defaultPreferences = getDefaultPreferences();
- Preferences preferences = getPluginPreferences();
HashSet optionNames = JavaModelManager.getJavaModelManager().optionNames;
// Compiler settings
@@ -2346,47 +2412,47 @@ public final class JavaCore extends Plugin {
for (Iterator iter = compilerOptionsMap.entrySet().iterator(); iter.hasNext();) {
Map.Entry entry = (Map.Entry) iter.next();
String optionName = (String) entry.getKey();
- preferences.setDefault(optionName, (String)entry.getValue());
+ defaultPreferences.put(optionName, (String)entry.getValue());
optionNames.add(optionName);
}
// override some compiler defaults
- preferences.setDefault(COMPILER_LOCAL_VARIABLE_ATTR, GENERATE);
- preferences.setDefault(COMPILER_CODEGEN_UNUSED_LOCAL, PRESERVE);
- preferences.setDefault(COMPILER_TASK_TAGS, DEFAULT_TASK_TAGS);
- preferences.setDefault(COMPILER_TASK_PRIORITIES, DEFAULT_TASK_PRIORITIES);
- preferences.setDefault(COMPILER_TASK_CASE_SENSITIVE, ENABLED);
- preferences.setDefault(COMPILER_DOC_COMMENT_SUPPORT, ENABLED);
+ defaultPreferences.put(COMPILER_LOCAL_VARIABLE_ATTR, GENERATE);
+ defaultPreferences.put(COMPILER_CODEGEN_UNUSED_LOCAL, PRESERVE);
+ defaultPreferences.put(COMPILER_TASK_TAGS, DEFAULT_TASK_TAGS);
+ defaultPreferences.put(COMPILER_TASK_PRIORITIES, DEFAULT_TASK_PRIORITIES);
+ defaultPreferences.put(COMPILER_TASK_CASE_SENSITIVE, ENABLED);
+ defaultPreferences.put(COMPILER_DOC_COMMENT_SUPPORT, ENABLED);
// Builder settings
- preferences.setDefault(CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, ""); //$NON-NLS-1$
+ defaultPreferences.put(CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, ""); //$NON-NLS-1$
optionNames.add(CORE_JAVA_BUILD_RESOURCE_COPY_FILTER);
- preferences.setDefault(CORE_JAVA_BUILD_INVALID_CLASSPATH, ABORT);
+ defaultPreferences.put(CORE_JAVA_BUILD_INVALID_CLASSPATH, ABORT);
optionNames.add(CORE_JAVA_BUILD_INVALID_CLASSPATH);
- preferences.setDefault(CORE_JAVA_BUILD_DUPLICATE_RESOURCE, WARNING);
+ defaultPreferences.put(CORE_JAVA_BUILD_DUPLICATE_RESOURCE, WARNING);
optionNames.add(CORE_JAVA_BUILD_DUPLICATE_RESOURCE);
- preferences.setDefault(CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER, CLEAN);
+ defaultPreferences.put(CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER, CLEAN);
optionNames.add(CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER);
// JavaCore settings
- preferences.setDefault(CORE_JAVA_BUILD_ORDER, IGNORE);
+ defaultPreferences.put(CORE_JAVA_BUILD_ORDER, IGNORE);
optionNames.add(CORE_JAVA_BUILD_ORDER);
- preferences.setDefault(CORE_INCOMPLETE_CLASSPATH, ERROR);
+ defaultPreferences.put(CORE_INCOMPLETE_CLASSPATH, ERROR);
optionNames.add(CORE_INCOMPLETE_CLASSPATH);
- preferences.setDefault(CORE_CIRCULAR_CLASSPATH, ERROR);
+ defaultPreferences.put(CORE_CIRCULAR_CLASSPATH, ERROR);
optionNames.add(CORE_CIRCULAR_CLASSPATH);
- preferences.setDefault(CORE_INCOMPATIBLE_JDK_LEVEL, IGNORE);
+ defaultPreferences.put(CORE_INCOMPATIBLE_JDK_LEVEL, IGNORE);
optionNames.add(CORE_INCOMPATIBLE_JDK_LEVEL);
- preferences.setDefault(CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, ENABLED);
+ defaultPreferences.put(CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, ENABLED);
optionNames.add(CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS);
- preferences.setDefault(CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS, ENABLED);
+ defaultPreferences.put(CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS, ENABLED);
optionNames.add(CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS);
// encoding setting comes from resource plug-in
@@ -2397,68 +2463,68 @@ public final class JavaCore extends Plugin {
for (Iterator iter = codeFormatterOptionsMap.entrySet().iterator(); iter.hasNext();) {
Map.Entry entry = (Map.Entry) iter.next();
String optionName = (String) entry.getKey();
- preferences.setDefault(optionName, (String)entry.getValue());
+ defaultPreferences.put(optionName, (String)entry.getValue());
optionNames.add(optionName);
}
- preferences.setDefault(FORMATTER_NEWLINE_OPENING_BRACE, DO_NOT_INSERT);
+ defaultPreferences.put(FORMATTER_NEWLINE_OPENING_BRACE, DO_NOT_INSERT);
optionNames.add(FORMATTER_NEWLINE_OPENING_BRACE);
- preferences.setDefault(FORMATTER_NEWLINE_CONTROL, DO_NOT_INSERT);
+ defaultPreferences.put(FORMATTER_NEWLINE_CONTROL, DO_NOT_INSERT);
optionNames.add(FORMATTER_NEWLINE_CONTROL);
- preferences.setDefault(FORMATTER_CLEAR_BLANK_LINES, PRESERVE_ONE);
+ defaultPreferences.put(FORMATTER_CLEAR_BLANK_LINES, PRESERVE_ONE);
optionNames.add(FORMATTER_CLEAR_BLANK_LINES);
- preferences.setDefault(FORMATTER_NEWLINE_ELSE_IF, DO_NOT_INSERT);
+ defaultPreferences.put(FORMATTER_NEWLINE_ELSE_IF, DO_NOT_INSERT);
optionNames.add(FORMATTER_NEWLINE_ELSE_IF);
- preferences.setDefault(FORMATTER_NEWLINE_EMPTY_BLOCK, INSERT);
+ defaultPreferences.put(FORMATTER_NEWLINE_EMPTY_BLOCK, INSERT);
optionNames.add(FORMATTER_NEWLINE_EMPTY_BLOCK);
- preferences.setDefault(FORMATTER_LINE_SPLIT, "80"); //$NON-NLS-1$
+ defaultPreferences.put(FORMATTER_LINE_SPLIT, "80"); //$NON-NLS-1$
optionNames.add(FORMATTER_LINE_SPLIT);
- preferences.setDefault(FORMATTER_COMPACT_ASSIGNMENT, NORMAL);
+ defaultPreferences.put(FORMATTER_COMPACT_ASSIGNMENT, NORMAL);
optionNames.add(FORMATTER_COMPACT_ASSIGNMENT);
- preferences.setDefault(FORMATTER_TAB_CHAR, TAB);
+ defaultPreferences.put(FORMATTER_TAB_CHAR, TAB);
optionNames.add(FORMATTER_TAB_CHAR);
- preferences.setDefault(FORMATTER_TAB_SIZE, "4"); //$NON-NLS-1$
+ defaultPreferences.put(FORMATTER_TAB_SIZE, "4"); //$NON-NLS-1$
optionNames.add(FORMATTER_TAB_SIZE);
- preferences.setDefault(FORMATTER_SPACE_CASTEXPRESSION, INSERT); //$NON-NLS-1$
+ defaultPreferences.put(FORMATTER_SPACE_CASTEXPRESSION, INSERT); //$NON-NLS-1$
optionNames.add(FORMATTER_SPACE_CASTEXPRESSION);
// CodeAssist settings
- preferences.setDefault(CODEASSIST_VISIBILITY_CHECK, DISABLED); //$NON-NLS-1$
+ defaultPreferences.put(CODEASSIST_VISIBILITY_CHECK, DISABLED); //$NON-NLS-1$
optionNames.add(CODEASSIST_VISIBILITY_CHECK);
- preferences.setDefault(CODEASSIST_IMPLICIT_QUALIFICATION, DISABLED); //$NON-NLS-1$
+ defaultPreferences.put(CODEASSIST_IMPLICIT_QUALIFICATION, DISABLED); //$NON-NLS-1$
optionNames.add(CODEASSIST_IMPLICIT_QUALIFICATION);
- preferences.setDefault(CODEASSIST_FIELD_PREFIXES, ""); //$NON-NLS-1$
+ defaultPreferences.put(CODEASSIST_FIELD_PREFIXES, ""); //$NON-NLS-1$
optionNames.add(CODEASSIST_FIELD_PREFIXES);
- preferences.setDefault(CODEASSIST_STATIC_FIELD_PREFIXES, ""); //$NON-NLS-1$
+ defaultPreferences.put(CODEASSIST_STATIC_FIELD_PREFIXES, ""); //$NON-NLS-1$
optionNames.add(CODEASSIST_STATIC_FIELD_PREFIXES);
- preferences.setDefault(CODEASSIST_LOCAL_PREFIXES, ""); //$NON-NLS-1$
+ defaultPreferences.put(CODEASSIST_LOCAL_PREFIXES, ""); //$NON-NLS-1$
optionNames.add(CODEASSIST_LOCAL_PREFIXES);
- preferences.setDefault(CODEASSIST_ARGUMENT_PREFIXES, ""); //$NON-NLS-1$
+ defaultPreferences.put(CODEASSIST_ARGUMENT_PREFIXES, ""); //$NON-NLS-1$
optionNames.add(CODEASSIST_ARGUMENT_PREFIXES);
- preferences.setDefault(CODEASSIST_FIELD_SUFFIXES, ""); //$NON-NLS-1$
+ defaultPreferences.put(CODEASSIST_FIELD_SUFFIXES, ""); //$NON-NLS-1$
optionNames.add(CODEASSIST_FIELD_SUFFIXES);
- preferences.setDefault(CODEASSIST_STATIC_FIELD_SUFFIXES, ""); //$NON-NLS-1$
+ defaultPreferences.put(CODEASSIST_STATIC_FIELD_SUFFIXES, ""); //$NON-NLS-1$
optionNames.add(CODEASSIST_STATIC_FIELD_SUFFIXES);
- preferences.setDefault(CODEASSIST_LOCAL_SUFFIXES, ""); //$NON-NLS-1$
+ defaultPreferences.put(CODEASSIST_LOCAL_SUFFIXES, ""); //$NON-NLS-1$
optionNames.add(CODEASSIST_LOCAL_SUFFIXES);
- preferences.setDefault(CODEASSIST_ARGUMENT_SUFFIXES, ""); //$NON-NLS-1$
+ defaultPreferences.put(CODEASSIST_ARGUMENT_SUFFIXES, ""); //$NON-NLS-1$
optionNames.add(CODEASSIST_ARGUMENT_SUFFIXES);
}
@@ -3562,26 +3628,37 @@ public final class JavaCore extends Plugin {
* @param newOptions the new options (key type: <code>String</code>; value type: <code>String</code>),
* or <code>null</code> to reset all options to their default values
* @see JavaCore#getDefaultOptions()
+ * @see #initializeDefaultPreferences() for changing default settings
*/
public static void setOptions(Hashtable newOptions) {
- // see #initializeDefaultPluginPreferences() for changing default settings
- Preferences preferences = getPlugin().getPluginPreferences();
+ try {
+ IEclipsePreferences defaultPreferences = getDefaultPreferences();
+ IEclipsePreferences instancePreferences = getInstancePreferences();
- if (newOptions == null){
- newOptions = JavaCore.getDefaultOptions();
- }
- Enumeration keys = newOptions.keys();
- while (keys.hasMoreElements()){
- String key = (String)keys.nextElement();
- if (!JavaModelManager.getJavaModelManager().optionNames.contains(key)) continue; // unrecognized option
- if (key.equals(CORE_ENCODING)) continue; // skipped, contributed by resource prefs
- String value = (String)newOptions.get(key);
- preferences.setValue(key, value);
- }
+ if (newOptions == null){
+ instancePreferences.clear();
+ } else {
+ Enumeration keys = newOptions.keys();
+ while (keys.hasMoreElements()){
+ String key = (String)keys.nextElement();
+ if (!JavaModelManager.getJavaModelManager().optionNames.contains(key)) continue; // unrecognized option
+ if (key.equals(CORE_ENCODING)) continue; // skipped, contributed by resource prefs
+ String value = (String)newOptions.get(key);
+ String defaultValue = defaultPreferences.get(key, null);
+ if (defaultValue != null && defaultValue.equals(value)) {
+ instancePreferences.remove(key);
+ } else {
+ instancePreferences.put(key, value);
+ }
+ }
+ }
- // persist options
- getPlugin().savePluginPreferences();
+ // persist options
+ instancePreferences.flush();
+ } catch (BackingStoreException e) {
+ // fails silently
+ }
}
/* (non-Javadoc)
@@ -3626,6 +3703,9 @@ public final class JavaCore extends Plugin {
public void start(BundleContext context) throws Exception {
super.start(context);
+ // init preferences
+ initializeDefaultPreferences();
+
final JavaModelManager manager = JavaModelManager.getJavaModelManager();
try {
manager.configurePluginDebugOptions();
@@ -3634,7 +3714,7 @@ public final class JavaCore extends Plugin {
JavaCore.getPlugin().getStateLocation();
// retrieve variable values
- JavaCore.getPlugin().getPluginPreferences().addPropertyChangeListener(new JavaModelManager.PluginPreferencesListener());
+ getInstancePreferences().addPreferenceChangeListener(new JavaModelManager.EclipsePreferencesListener());
manager.loadVariablesAndContainers();
final IWorkspace workspace = ResourcesPlugin.getWorkspace();
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java
index 408ba5919a..42bdfc9698 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java
@@ -11,6 +11,8 @@
*******************************************************************************/
package org.eclipse.jdt.core;
+import java.util.ArrayList;
+
import org.eclipse.jdt.core.compiler.CharOperation;
/**
@@ -197,13 +199,29 @@ public final class Signature {
public static final char C_TYPE_VARIABLE = 'T';
/**
- * Character constant indicating a wildcard type argument
+ * Character constant indicating an unbound wildcard type argument
* in a signature.
* Value is <code>'&ast;'</code>.
* @since 3.0
*/
public static final char C_STAR = '*';
+ /**
+ * Character constant indicating a bound wildcard type argument
+ * in a signature with extends clause.
+ * Value is <code>'+'</code>.
+ * @since 3.1
+ */
+ public static final char C_EXTENDS = '+';
+
+ /**
+ * Character constant indicating a bound wildcard type argument
+ * in a signature with super clause.
+ * Value is <code>'-'</code>.
+ * @since 3.1
+ */
+ public static final char C_SUPER = '-';
+
/**
* Character constant indicating the dot in a signature.
* Value is <code>'.'</code>.
@@ -348,15 +366,17 @@ public final class Signature {
*/
public static int ARRAY_TYPE_SIGNATURE = 4;
- private static final char[] BOOLEAN = {'b', 'o', 'o', 'l', 'e', 'a', 'n'};
- private static final char[] BYTE = {'b', 'y', 't', 'e'};
- private static final char[] CHAR = {'c', 'h', 'a', 'r'};
- private static final char[] DOUBLE = {'d', 'o', 'u', 'b', 'l', 'e'};
- private static final char[] FLOAT = {'f', 'l', 'o', 'a', 't'};
- private static final char[] INT = {'i', 'n', 't'};
- private static final char[] LONG = {'l', 'o', 'n', 'g'};
- private static final char[] SHORT = {'s', 'h', 'o', 'r', 't'};
- private static final char[] VOID = {'v', 'o', 'i', 'd'};
+ private static final char[] BOOLEAN = "boolean".toCharArray(); //$NON-NLS-1$
+ private static final char[] BYTE = "byte".toCharArray(); //$NON-NLS-1$
+ private static final char[] CHAR = "char".toCharArray(); //$NON-NLS-1$
+ private static final char[] DOUBLE = "double".toCharArray(); //$NON-NLS-1$
+ private static final char[] FLOAT = "float".toCharArray(); //$NON-NLS-1$
+ private static final char[] INT = "int".toCharArray(); //$NON-NLS-1$
+ private static final char[] LONG = "long".toCharArray(); //$NON-NLS-1$
+ private static final char[] SHORT = "short".toCharArray(); //$NON-NLS-1$
+ private static final char[] VOID = "void".toCharArray(); //$NON-NLS-1$
+ private static final char[] EXTENDS = "extends".toCharArray(); //$NON-NLS-1$
+ private static final char[] SUPER = "super".toCharArray(); //$NON-NLS-1$
private static final String EMPTY = new String(CharOperation.NO_CHAR);
@@ -364,12 +384,26 @@ private Signature() {
// Not instantiable
}
-private static boolean checkPrimitiveType(char[] primitiveTypeName, char[] typeName) {
- return CharOperation.fragmentEquals(primitiveTypeName, typeName, 0, true) &&
- (typeName.length == primitiveTypeName.length
- || Character.isWhitespace(typeName[primitiveTypeName.length])
- || typeName[primitiveTypeName.length] == C_ARRAY
- || typeName[primitiveTypeName.length] == C_DOT);
+private static int checkName(char[] name, char[] typeName, int pos, int length) {
+ if (CharOperation.fragmentEquals(name, typeName, pos, true)) {
+ pos += name.length;
+ if (pos == length) return pos;
+ char currentChar = typeName[pos];
+ switch (currentChar) {
+ case ' ' :
+ case '.' :
+ case '<' :
+ case '>' :
+ case '[' :
+ case ',' :
+ return pos;
+ default:
+ if (Character.isWhitespace(currentChar))
+ return pos;
+
+ }
+ }
+ return -1;
}
/**
@@ -457,6 +491,55 @@ public static String createMethodSignature(String[] parameterTypes, String retur
}
/**
+ * Creates a new type parameter signature with the given name and bounds.
+ *
+ * @param typeParameterName the type parameter name
+ * @param boundSignatures the signatures of associated bounds or empty array if none
+ * @return the encoded type parameter signature
+ *
+ * @since 3.1
+ */
+public static char[] createTypeParameterSignature(char[] typeParameterName, char[][] boundSignatures) {
+ int length = boundSignatures.length;
+ if (length == 0) {
+ return CharOperation.append(typeParameterName, C_COLON); // param signature with no bounds still gets trailing colon
+ }
+ int boundsSize = 0;
+ for (int i = 0; i < length; i++) {
+ boundsSize += boundSignatures[i].length + 1;
+ }
+ int nameLength = typeParameterName.length;
+ char[] result = new char[nameLength + boundsSize];
+ System.arraycopy(typeParameterName, 0, result, 0, nameLength);
+ int index = nameLength;
+ for (int i = 0; i < length; i++) {
+ result[index++] = C_COLON;
+ int boundLength = boundSignatures[i].length;
+ System.arraycopy(boundSignatures[i], 0, result, index, boundLength);
+ index += boundLength;
+ }
+ return result;
+}
+
+/**
+ * Creates a new type parameter signature with the given name and bounds.
+ *
+ * @param typeParameterName the type parameter name
+ * @param boundSignatures the signatures of associated bounds or empty array if none
+ * @return the encoded type parameter signature
+ *
+ * @since 3.1
+ */
+public static String createTypeParameterSignature(String typeParameterName, String[] boundSignatures) {
+ int length = boundSignatures.length;
+ char[][] boundSignatureChars = new char[length][];
+ for (int i = 0; i < length; i++) {
+ boundSignatureChars[i] = boundSignatures[i].toCharArray();
+ }
+ return new String(createTypeParameterSignature(typeParameterName.toCharArray(), boundSignatureChars));
+}
+
+/**
* Creates a new type signature from the given type name encoded as a character
* array. The type name may contain primitive types or array types. However,
* parameterized types are not supported.
@@ -476,10 +559,10 @@ public static String createMethodSignature(String[] parameterTypes, String retur
public static String createTypeSignature(char[] typeName, boolean isResolved) {
return new String(createCharArrayTypeSignature(typeName, isResolved));
}
+
/**
* Creates a new type signature from the given type name encoded as a character
- * array. The type name may contain primitive types or array types. However,
- * parameterized types are not supported.
+ * array. The type name may contain primitive types or array types.
* This method is equivalent to
* <code>createTypeSignature(new String(typeName),isResolved).toCharArray()</code>,
* although more efficient for callers with character arrays rather than strings.
@@ -499,129 +582,237 @@ public static char[] createCharArrayTypeSignature(char[] typeName, boolean isRes
if (typeName == null) throw new IllegalArgumentException("null"); //$NON-NLS-1$
int length = typeName.length;
if (length == 0) throw new IllegalArgumentException(new String(typeName));
+ StringBuffer buffer = new StringBuffer(5);
+ int pos = encodeTypeSignature(typeName, 0, isResolved, length, buffer);
+ pos = consumeWhitespace(typeName, pos, length);
+ if (pos < length) throw new IllegalArgumentException(new String(typeName));
+ char[] result = new char[length = buffer.length()];
+ buffer.getChars(0, length, result, 0);
+ return result;
+}
+private static int consumeWhitespace(char[] typeName, int pos, int length) {
+ while (pos < length) {
+ char currentChar = typeName[pos];
+ if (currentChar != ' ' && !CharOperation.isWhitespace(currentChar)) {
+ break;
+ }
+ pos++;
+ }
+ return pos;
+}
+private static int encodeQualifiedName(char[] typeName, int pos, int length, StringBuffer buffer) {
+ int count = 0;
+ char lastAppendedChar = 0;
+ nameLoop: while (pos < length) {
+ char currentChar = typeName[pos];
+ switch (currentChar) {
+ case '<' :
+ case '>' :
+ case '[' :
+ case ',' :
+ break nameLoop;
+ case '.' :
+ buffer.append(C_DOT);
+ lastAppendedChar = C_DOT;
+ count++;
+ break;
+ default:
+ if (currentChar == ' ' || Character.isWhitespace(currentChar)) {
+ if (lastAppendedChar == C_DOT) { // allow spaces after a dot
+ pos = consumeWhitespace(typeName, pos, length) - 1; // will be incremented
+ break;
+ }
+ // allow spaces before a dot
+ int checkPos = checkNextChar(typeName, '.', pos, length, true);
+ if (checkPos > 0) {
+ buffer.append(C_DOT); // process dot immediately to avoid one iteration
+ lastAppendedChar = C_DOT;
+ count++;
+ pos = checkPos;
+ break;
+ }
+ break nameLoop;
+ }
+ buffer.append(currentChar);
+ lastAppendedChar = currentChar;
+ count++;
+ break;
+ }
+ pos++;
+ }
+ if (count == 0) throw new IllegalArgumentException(new String(typeName));
+ return pos;
+}
- int arrayCount = CharOperation.occurencesOf('[', typeName);
- char[] sig;
-
- switch (typeName[0]) {
+private static int encodeArrayDimension(char[] typeName, int pos, int length, StringBuffer buffer) {
+ int checkPos;
+ while (pos < length && (checkPos = checkNextChar(typeName, '[', pos, length, true)) > 0) {
+ pos = checkNextChar(typeName, ']', checkPos, length, false);
+ buffer.append(C_ARRAY);
+ }
+ return pos;
+}
+private static int checkArrayDimension(char[] typeName, int pos, int length) {
+ int genericBalance = 0;
+ while (pos < length) {
+ switch(typeName[pos]) {
+ case '<' :
+ genericBalance++;
+ break;
+ case ',' :
+ if (genericBalance == 0) return -1;
+ break;
+ case '>':
+ if (genericBalance == 0) return -1;
+ genericBalance--;
+ break;
+ case '[':
+ if (genericBalance == 0) {
+ return pos;
+ }
+ }
+ pos++;
+ }
+ return -1;
+}
+private static int checkNextChar(char[] typeName, char expectedChar, int pos, int length, boolean isOptional) {
+ pos = consumeWhitespace(typeName, pos, length);
+ if (pos < length && typeName[pos] == expectedChar)
+ return pos + 1;
+ if (!isOptional) throw new IllegalArgumentException(new String(typeName));
+ return -1;
+}
+
+private static int encodeTypeSignature(char[] typeName, int start, boolean isResolved, int length, StringBuffer buffer) {
+ int pos = start;
+ pos = consumeWhitespace(typeName, pos, length);
+ if (pos >= length) throw new IllegalArgumentException(new String(typeName));
+ int checkPos;
+ char currentChar = typeName[pos];
+ switch (currentChar) {
// primitive type?
case 'b' :
- if (checkPrimitiveType(BOOLEAN, typeName)) {
- sig = new char[arrayCount+1];
- sig[arrayCount] = C_BOOLEAN;
- break;
- } else if (checkPrimitiveType(BYTE, typeName)) {
- sig = new char[arrayCount+1];
- sig[arrayCount] = C_BYTE;
- break;
+ checkPos = checkName(BOOLEAN, typeName, pos, length);
+ if (checkPos > 0) {
+ pos = encodeArrayDimension(typeName, checkPos, length, buffer);
+ buffer.append(C_BOOLEAN);
+ return pos;
+ }
+ checkPos = checkName(BYTE, typeName, pos, length);
+ if (checkPos > 0) {
+ pos = encodeArrayDimension(typeName, checkPos, length, buffer);
+ buffer.append(C_BYTE);
+ return pos;
}
+ break;
case 'c':
- if (checkPrimitiveType(CHAR, typeName)) {
- sig = new char[arrayCount+1];
- sig[arrayCount] = C_CHAR;
- break;
- }
+ checkPos = checkName(CHAR, typeName, pos, length);
+ if (checkPos > 0) {
+ pos = encodeArrayDimension(typeName, checkPos, length, buffer);
+ buffer.append(C_CHAR);
+ return pos;
+ }
+ break;
case 'd':
- if (checkPrimitiveType(DOUBLE, typeName)) {
- sig = new char[arrayCount+1];
- sig[arrayCount] = C_DOUBLE;
- break;
- }
+ checkPos = checkName(DOUBLE, typeName, pos, length);
+ if (checkPos > 0) {
+ pos = encodeArrayDimension(typeName, checkPos, length, buffer);
+ buffer.append(C_DOUBLE);
+ return pos;
+ }
+ break;
case 'f':
- if (checkPrimitiveType(FLOAT, typeName)) {
- sig = new char[arrayCount+1];
- sig[arrayCount] = C_FLOAT;
- break;
- }
+ checkPos = checkName(FLOAT, typeName, pos, length);
+ if (checkPos > 0) {
+ pos = encodeArrayDimension(typeName, checkPos, length, buffer);
+ buffer.append(C_FLOAT);
+ return pos;
+ }
+ break;
case 'i':
- if (checkPrimitiveType(INT, typeName)) {
- sig = new char[arrayCount+1];
- sig[arrayCount] = C_INT;
- break;
- }
+ checkPos = checkName(INT, typeName, pos, length);
+ if (checkPos > 0) {
+ pos = encodeArrayDimension(typeName, checkPos, length, buffer);
+ buffer.append(C_INT);
+ return pos;
+ }
+ break;
case 'l':
- if (checkPrimitiveType(LONG, typeName)) {
- sig = new char[arrayCount+1];
- sig[arrayCount] = C_LONG;
- break;
- }
+ checkPos = checkName(LONG, typeName, pos, length);
+ if (checkPos > 0) {
+ pos = encodeArrayDimension(typeName, checkPos, length, buffer);
+ buffer.append(C_LONG);
+ return pos;
+ }
+ break;
case 's':
- if (checkPrimitiveType(SHORT, typeName)) {
- sig = new char[arrayCount+1];
- sig[arrayCount] = C_SHORT;
- break;
- }
+ checkPos = checkName(SHORT, typeName, pos, length);
+ if (checkPos > 0) {
+ pos = encodeArrayDimension(typeName, checkPos, length, buffer);
+ buffer.append(C_SHORT);
+ return pos;
+ }
+ break;
case 'v':
- if (checkPrimitiveType(VOID, typeName)) {
- sig = new char[arrayCount+1];
- sig[arrayCount] = C_VOID;
- break;
+ checkPos = checkName(VOID, typeName, pos, length);
+ if (checkPos > 0) {
+ pos = encodeArrayDimension(typeName, checkPos, length, buffer);
+ buffer.append(C_VOID);
+ return pos;
}
- default:
- // non primitive type
- int sigLength = arrayCount + 1 + length + 1; // for example '[[[Ljava.lang.String;'
- sig = new char[sigLength];
- int sigIndex = arrayCount+1; // index in sig
- int startID = 0; // start of current ID in typeName
- int index = 0; // index in typeName
- while (index < length) {
- char currentChar = typeName[index];
- switch (currentChar) {
- case '.':
- if (startID == -1) throw new IllegalArgumentException(new String(typeName));
- if (startID < index) {
- sig = CharOperation.append(sig, sigIndex, typeName, startID, index);
- sigIndex += index-startID;
- }
- sig[sigIndex++] = C_DOT;
- index++;
- startID = index;
- break;
- case '[':
- if (startID != -1) {
- if (startID < index) {
- sig = CharOperation.append(sig, sigIndex, typeName, startID, index);
- sigIndex += index-startID;
- }
- startID = -1; // no more id after []
- }
- index++;
- break;
- default :
- if (startID != -1 && CharOperation.isWhitespace(currentChar)) {
- if (startID < index) {
- sig = CharOperation.append(sig, sigIndex, typeName, startID, index);
- sigIndex += index-startID;
- }
- startID = index+1;
- }
- index++;
- break;
- }
+ break;
+ case '?':
+ // wildcard
+ pos = consumeWhitespace(typeName, pos+1, length);
+ checkPos = checkName(EXTENDS, typeName, pos, length);
+ if (checkPos > 0) {
+ buffer.append(C_EXTENDS);
+ pos = encodeTypeSignature(typeName, checkPos, isResolved, length, buffer);
+ return pos;
}
- // last id
- if (startID != -1 && startID < index) {
- sig = CharOperation.append(sig, sigIndex, typeName, startID, index);
- sigIndex += index-startID;
+ checkPos = checkName(SUPER, typeName, pos, length);
+ if (checkPos > 0) {
+ buffer.append(C_SUPER);
+ pos = encodeTypeSignature(typeName, checkPos, isResolved, length, buffer);
+ return pos;
}
-
- // add L (or Q) at the beigininig and ; at the end
- sig[arrayCount] = isResolved ? C_RESOLVED : C_UNRESOLVED;
- sig[sigIndex++] = C_NAME_END;
-
- // resize if needed
- if (sigLength > sigIndex) {
- System.arraycopy(sig, 0, sig = new char[sigIndex], 0, sigIndex);
- }
- }
-
- // add array info
- for (int i = 0; i < arrayCount; i++) {
- sig[i] = C_ARRAY;
+ buffer.append(C_STAR);
+ return pos;
+ }
+ // non primitive type
+ checkPos = checkArrayDimension(typeName, pos, length);
+ int end;
+ if (checkPos > 0) {
+ end = encodeArrayDimension(typeName, checkPos, length, buffer);
+ } else {
+ end = -1;
+ }
+ buffer.append(isResolved ? C_RESOLVED : C_UNRESOLVED);
+ while (true) { // loop on qualifiedName[<args>][.qualifiedName[<args>]*
+ pos = encodeQualifiedName(typeName, pos, length, buffer);
+ checkPos = checkNextChar(typeName, '<', pos, length, true);
+ if (checkPos > 0) {
+ buffer.append(C_GENERIC_START);
+ pos = encodeTypeSignature(typeName, checkPos, isResolved, length, buffer);
+ while ((checkPos = checkNextChar(typeName, ',', pos, length, true)) > 0) {
+ pos = encodeTypeSignature(typeName, checkPos, isResolved, length, buffer);
+ }
+ pos = checkNextChar(typeName, '>', pos, length, false);
+ buffer.append(C_GENERIC_END);
+ }
+ checkPos = checkNextChar(typeName, '.', pos, length, true);
+ if (checkPos > 0) {
+ buffer.append(C_DOT);
+ pos = checkPos;
+ } else {
+ break;
+ }
}
-
- return sig;
+ buffer.append(C_NAME_END);
+ if (end > 0) pos = end; // skip array dimension which were preprocessed
+ return pos;
}
+
/**
* Creates a new type signature from the given type name. If the type name is qualified,
* then it is expected to be dot-based. The type name may contain primitive
@@ -1138,6 +1329,7 @@ private static int scanTypeArgumentSignature(char[] string, int start) {
public static int getParameterCount(String methodSignature) throws IllegalArgumentException {
return getParameterCount(methodSignature.toCharArray());
}
+
/**
* Extracts the parameter type signatures from the given method signature.
* The method signature is expected to be dot-based.
@@ -1179,6 +1371,7 @@ public static char[][] getParameterTypes(char[] methodSignature) throws IllegalA
throw new IllegalArgumentException();
}
}
+
/**
* Extracts the parameter type signatures from the given method signature.
* The method signature is expected to be dot-based.
@@ -1199,6 +1392,124 @@ public static String[] getParameterTypes(String methodSignature) throws IllegalA
}
/**
+ * Extracts the thrown exception type signatures from the given method signature if any
+ * The method signature is expected to be dot-based.
+ *
+ * @param methodSignature the method signature
+ * @return the list of thrown exception type signatures
+ * @exception IllegalArgumentException if the signature is syntactically
+ * incorrect
+ */
+public static String[] getThrownExceptionTypes(String methodSignature) throws IllegalArgumentException {
+ char[][] parameterTypes = getThrownExceptionTypes(methodSignature.toCharArray());
+ int length = parameterTypes.length;
+ String[] result = new String[length];
+ for (int i = 0; i < length; i++) {
+ result[i] = new String(parameterTypes[i]);
+ }
+ return result;
+}
+
+/**
+ * Extracts the thrown exception type signatures from the given method signature if any
+ * The method signature is expected to be dot-based.
+ *
+ * @param methodSignature the method signature
+ * @return the list of thrown exception type signatures
+ * @exception IllegalArgumentException if the signature is syntactically
+ * incorrect
+ */
+public static char[][] getThrownExceptionTypes(char[] methodSignature) throws IllegalArgumentException {
+ // skip type parameters
+ int paren = CharOperation.lastIndexOf(C_PARAM_END, methodSignature);
+ if (paren == -1) {
+ throw new IllegalArgumentException();
+ }
+ // ignore return type
+ int exceptionStart = scanTypeSignature(methodSignature, paren+1) + 1;
+ int length = methodSignature.length;
+ if (exceptionStart == length) return CharOperation.NO_CHAR_CHAR;
+
+ ArrayList exceptionList = new ArrayList(1);
+ int i = exceptionStart;
+ while (i < length) {
+ i = scanTypeSignature(methodSignature, i) + 1;
+ exceptionList.add(CharOperation.subarray(methodSignature, exceptionStart,i));
+ exceptionStart = i;
+ }
+ char[][] result;
+ exceptionList.toArray(result = new char[exceptionList.size()][]);
+ return result;
+}
+
+/**
+ * Extracts the type parameter signatures from the given method or type signature.
+ * The method or type signature is expected to be dot-based.
+ *
+ * @param methodOrTypeSignature the method or type signature
+ * @return the list of type parameter signatures
+ * @exception IllegalArgumentException if the signature is syntactically
+ * incorrect
+ *
+ * @since 3.1
+ */
+public static char[][] getTypeParameters(char[] methodOrTypeSignature) throws IllegalArgumentException {
+ try {
+ int length = methodOrTypeSignature.length;
+ if (length == 0) return CharOperation.NO_CHAR_CHAR;
+ if (methodOrTypeSignature[0] != C_GENERIC_START) return CharOperation.NO_CHAR_CHAR;
+
+ ArrayList paramList = new ArrayList(1);
+ int paramStart = 1, i = 1; // start after leading '<'
+ while (i < length) {
+ if (methodOrTypeSignature[i] == C_GENERIC_END) {
+ int size = paramList.size();
+ if (size == 0) throw new IllegalArgumentException();
+ char[][] result;
+ paramList.toArray(result = new char[size][]);
+ return result;
+ }
+ i = CharOperation.indexOf(C_COLON, methodOrTypeSignature, i);
+ if (i < 0 || i >= length) throw new IllegalArgumentException();
+ // iterate over bounds
+ nextBound: while (methodOrTypeSignature[i] == ':') {
+ i++; // skip colon
+ if (methodOrTypeSignature[i] == ':') {
+ continue nextBound; // empty bound
+ }
+ i = scanTypeSignature(methodOrTypeSignature, i);
+ i++; // position at start of next param if any
+ }
+ paramList.add(CharOperation.subarray(methodOrTypeSignature, paramStart, i));
+ paramStart = i; // next param start from here
+ }
+ } catch (ArrayIndexOutOfBoundsException e) {
+ // invalid signature, fall through
+ }
+ throw new IllegalArgumentException();
+}
+/**
+ * Extracts the type parameter signatures from the given method or type signature.
+ * The method or type signature is expected to be dot-based.
+ *
+ * @param methodOrTypeSignature the method or type signature
+ * @return the list of type parameter signatures
+ * @exception IllegalArgumentException if the signature is syntactically
+ * incorrect
+ *
+ * @since 3.1
+ */
+public static String[] getTypeParameters(String methodOrTypeSignature) throws IllegalArgumentException {
+ char[][] params = getTypeParameters(methodOrTypeSignature.toCharArray());
+ int length = params.length;
+ String[] result = new String[length];
+ for (int i = 0; i < length; i++) {
+ result[i] = new String(params[i]);
+ }
+ return result;
+}
+
+/**
* Extracts the type variable name from the given formal type parameter
* signature. The signature is expected to be dot-based.
*
@@ -1361,14 +1672,13 @@ public static String getQualifier(String name) {
*/
public static char[] getReturnType(char[] methodSignature) throws IllegalArgumentException {
// skip type parameters
- int i = CharOperation.lastIndexOf(C_PARAM_END, methodSignature);
- if (i == -1) {
+ int paren = CharOperation.lastIndexOf(C_PARAM_END, methodSignature);
+ if (paren == -1) {
throw new IllegalArgumentException();
}
- // ignore any thrown exceptions
- int j = CharOperation.indexOf('^', methodSignature);
- int last = (j == -1 ? methodSignature.length : j);
- return CharOperation.subarray(methodSignature, i + 1, last);
+ // there could be thrown exceptions behind, thus scan one type exactly
+ int last = scanTypeSignature(methodSignature, paren+1);
+ return CharOperation.subarray(methodSignature, paren + 1, last+1);
}
/**
* Extracts the return type from the given method signature. The method signature is
@@ -1400,11 +1710,42 @@ public static String getReturnType(String methodSignature) throws IllegalArgumen
* @since 2.0
*/
public static char[] getSimpleName(char[] name) {
- int lastDot = CharOperation.lastIndexOf(C_DOT, name);
- if (lastDot == -1) {
- return name;
+
+ int lastDot = -1, lastGenericStart = -1, lastGenericEnd = -1;
+ int depth = 0;
+ int length = name.length;
+ lastDotLookup: for (int i = length -1; i >= 0; i--) {
+ switch (name[i]) {
+ case '.':
+ if (depth == 0) {
+ lastDot = i;
+ break lastDotLookup;
+ }
+ break;
+ case '<':
+ depth--;
+ if (depth == 0) lastGenericStart = i;
+ break;
+ case '>':
+ if (depth == 0) lastGenericEnd = i;
+ depth++;
+ break;
+ }
}
- return CharOperation.subarray(name, lastDot + 1, name.length);
+ if (lastGenericStart < 0) {
+ if (lastDot < 0) {
+ return name;
+ }
+ return CharOperation.subarray(name, lastDot + 1, length);
+ }
+ StringBuffer buffer = new StringBuffer(10);
+ int nameStart = lastDot < 0 ? 0 : lastDot+1;
+ buffer.append(name, nameStart, lastGenericStart - nameStart);
+ appendArgumentSimpleNames(name, lastGenericStart, lastGenericEnd, buffer);
+ buffer.append(name, lastGenericEnd+1, length-lastGenericEnd-1); // copy trailing portion, may contain dimensions
+ char[] result = new char[length = buffer.length()];
+ buffer.getChars(0, length, result, 0);
+ return result;
}
/**
* Returns the last segment of the given dot-separated qualified name.
@@ -1415,6 +1756,9 @@ public static char[] getSimpleName(char[] name) {
* <code>
* getSimpleName("java.lang.Object") -> "Object"
* </code>
+ * <code>
+ * getSimpleName("java.util.Map<java.lang.String, java.lang.Object>") -> "Map<String,Object>"
+ * </code>
* </pre>
* </p>
*
@@ -1423,11 +1767,125 @@ public static char[] getSimpleName(char[] name) {
* @exception NullPointerException if name is null
*/
public static String getSimpleName(String name) {
- int lastDot = name.lastIndexOf(C_DOT);
- if (lastDot == -1) {
- return name;
+ int lastDot = -1, lastGenericStart = -1, lastGenericEnd = -1;
+ int depth = 0;
+ int length = name.length();
+ lastDotLookup: for (int i = length -1; i >= 0; i--) {
+ switch (name.charAt(i)) {
+ case '.':
+ if (depth == 0) {
+ lastDot = i;
+ break lastDotLookup;
+ }
+ break;
+ case '<':
+ depth--;
+ if (depth == 0) lastGenericStart = i;
+ break;
+ case '>':
+ if (depth == 0) lastGenericEnd = i;
+ depth++;
+ break;
+ }
+ }
+ if (lastGenericStart < 0) {
+ if (lastDot < 0) {
+ return name;
+ }
+ return name.substring(lastDot + 1, length);
+ }
+ StringBuffer buffer = new StringBuffer(10);
+ char[] nameChars = name.toCharArray();
+ int nameStart = lastDot < 0 ? 0 : lastDot+1;
+ buffer.append(nameChars, nameStart, lastGenericStart - nameStart);
+ appendArgumentSimpleNames(nameChars, lastGenericStart, lastGenericEnd, buffer);
+ buffer.append(nameChars, lastGenericEnd+1, length-lastGenericEnd-1); // copy trailing portion, may contain dimensions
+ return buffer.toString();
+}
+
+private static void appendSimpleName(char[] name, int start, int end, StringBuffer buffer) {
+ int lastDot = -1, lastGenericStart = -1, lastGenericEnd = -1;
+ int depth = 0;
+ if (name[start] == '?') { // wildcard
+ buffer.append("? "); //$NON-NLS-1$
+ int index = consumeWhitespace(name, start+1, end+1);
+ switch (name[index]) {
+ case 'e' :
+ int checkPos = checkName(EXTENDS, name, index, end);
+ if (checkPos > 0) {
+ buffer.append(EXTENDS).append(' ');
+ index = consumeWhitespace(name, checkPos, end+1);
+ }
+ break;
+ case 's' :
+ checkPos = checkName(SUPER, name, index, end+1);
+ if (checkPos > 0) {
+ buffer.append(SUPER).append(' ');
+ index = consumeWhitespace(name, checkPos, end+1);
+ }
+ break;
+ }
+ start = index; // leading segment got processed
+ }
+ lastDotLookup: for (int i = end; i >= start; i--) {
+ switch (name[i]) {
+ case '.':
+ if (depth == 0) {
+ lastDot = i;
+ break lastDotLookup;
+ }
+ break;
+ case '<':
+ depth--;
+ if (depth == 0) lastGenericStart = i;
+ break;
+ case '>':
+ if (depth == 0) lastGenericEnd = i;
+ depth++;
+ break;
+ }
+ }
+ int nameStart = lastDot < 0 ? start : lastDot+1;
+ int nameEnd = lastGenericStart < 0 ? end+1 : lastGenericStart;
+ buffer.append(name, nameStart, nameEnd - nameStart);
+ if (lastGenericStart >= 0) {
+ appendArgumentSimpleNames(name, lastGenericStart, lastGenericEnd, buffer);
+ buffer.append(name, lastGenericEnd+1, end - lastGenericEnd); // copy trailing portion, may contain dimensions
+ }
+}
+// <x.y.z, a.b<c>.d<e.f>> --> <z,d<f>>
+private static void appendArgumentSimpleNames(char[] name, int start, int end, StringBuffer buffer) {
+ buffer.append('<');
+ int depth = 0;
+ int argumentStart = -1;
+ int argumentCount = 0;
+ for (int i = start; i <= end; i++) {
+ switch(name[i]) {
+ case '<' :
+ depth++;
+ if (depth == 1) {
+ argumentStart = i+1;
+ }
+ break;
+ case '>' :
+ if (depth == 1) {
+ if (argumentCount > 0) buffer.append(',');
+ appendSimpleName(name, argumentStart, i-1, buffer);
+ argumentCount++;
+ }
+ depth--;
+ break;
+ case ',' :
+ if (depth == 1) {
+ if (argumentCount > 0) buffer.append(',');
+ appendSimpleName(name, argumentStart, i-1, buffer);
+ argumentCount++;
+ argumentStart = i+1;
+ }
+ break;
+ }
}
- return name.substring(lastDot + 1, name.length());
+ buffer.append('>');
}
/**
* Returns all segments of the given dot-separated qualified name.
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ClassFormatException.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ClassFormatException.java
index c6376320e3..5d2b0d4669 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ClassFormatException.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ClassFormatException.java
@@ -39,7 +39,7 @@ public class ClassFormatException extends Exception {
* @param errorID the given error ID
*/
public ClassFormatException(int errorID) {
- // TODO what is the errorID?
+ // TODO (olivier) what is the errorID?
}
/**
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotation.java
index 6b93d3001e..be700af7f1 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotation.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotation.java
@@ -16,7 +16,7 @@ package org.eclipse.jdt.core.util;
*
* This interface may be implemented by clients.
*
- * @since 3.0
+ * @since 3.1
*/
public interface IAnnotation {
/**
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotationComponent.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotationComponent.java
index d09d1098b0..f1734bd1f8 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotationComponent.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotationComponent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
+ * 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
@@ -11,12 +11,12 @@
package org.eclipse.jdt.core.util;
/**
- * Description of an annotation component as described in the JVM specifications
+ * Description of an annotation component as described in the JVM specifications.
* (added in J2SE 1.5).
*
* This interface may be implemented by clients.
*
- * @since 3.0
+ * @since 3.1
*/
public interface IAnnotationComponent {
/**
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotationComponentValue.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotationComponentValue.java
index 942d8958cd..3402463e55 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotationComponentValue.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotationComponentValue.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
+ * 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
@@ -11,12 +11,12 @@
package org.eclipse.jdt.core.util;
/**
- * Description of an annotation component value as described in the JVM specifications
+ * Description of an annotation component value as described in the JVM specifications.
* (added in J2SE 1.5).
*
* This interface may be implemented by clients.
*
- * @since 3.0
+ * @since 3.1
*/
public interface IAnnotationComponentValue {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotationDefaultAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotationDefaultAttribute.java
index a25452db3e..4cfd923090 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotationDefaultAttribute.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotationDefaultAttribute.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
+ * 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
@@ -13,11 +13,10 @@ package org.eclipse.jdt.core.util;
/**
* Description of a annotation default attribute as described in the JVM
* specifications (added in J2SE 1.5).
-
*
* This interface may be implemented by clients.
*
- * @since 3.0
+ * @since 3.1
*/
public interface IAnnotationDefaultAttribute extends IClassFileAttribute {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IFieldInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IFieldInfo.java
index 43616b7a23..df0e4efb76 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IFieldInfo.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IFieldInfo.java
@@ -28,7 +28,7 @@ public interface IFieldInfo {
* null otherwise
*/
IConstantValueAttribute getConstantValueAttribute();
-
+
/**
* Answer back the access flag of this field info.
*
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IMethodInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IMethodInfo.java
index 3b6cf05849..9676c43c68 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IMethodInfo.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IMethodInfo.java
@@ -14,7 +14,7 @@ package org.eclipse.jdt.core.util;
* Description of a method info as described in the JVM
* specifications.
*
- * This interface may be implemented by clients.
+ * This interface may be implemented by clients.
*
* @since 2.0
*/
@@ -114,7 +114,7 @@ public interface IMethodInfo {
* @return the exception attribute of this method info, null is none
*/
IExceptionAttribute getExceptionAttribute();
-
+
/**
* Answer back the attribute number of the method info. It includes the CodeAttribute
* if any even if the decoding flags doesn't include METHOD_BODIES.
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java
index a4e34eeb15..1e14e8561a 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java
@@ -220,7 +220,7 @@ protected void consumeClassHeader() {
}
}
-protected void consumeClassHeaderName() {
+protected void consumeClassHeaderName1() {
// ClassHeaderName ::= Modifiersopt 'class' 'Identifier'
TypeDeclaration typeDecl = new TypeDeclaration(this.compilationUnit.compilationResult);
if (nestedMethod[nestedType] == 0) {
@@ -251,6 +251,16 @@ protected void consumeClassHeaderName() {
if (typeDecl.declarationSourceStart > declSourceStart) {
typeDecl.declarationSourceStart = declSourceStart;
}
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ typeDecl.annotations = new Annotation[length],
+ 0,
+ length);
+ }
typeDecl.bodyStart = typeDecl.sourceEnd + 1;
pushOnAstStack(typeDecl);
// javadoc
@@ -370,6 +380,16 @@ protected void consumeConstructorHeaderName() {
cd.declarationSourceStart = intStack[intPtr--];
cd.modifiersSourceStart = intStack[intPtr--];
cd.modifiers = intStack[intPtr--];
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ cd.annotations = new Annotation[length],
+ 0,
+ length);
+ }
// javadoc
cd.javadoc = this.javadoc;
this.javadoc = null;
@@ -388,6 +408,7 @@ protected void consumeDefaultModifiers() {
pushOnIntStack(
declarationSourceStart >= 0 ? declarationSourceStart : scanner.startPosition);
resetModifiers();
+ pushOnExpressionStackLengthStack(0);
}
protected void consumeDiet() {
// Diet ::= $empty
@@ -450,6 +471,16 @@ protected void consumeEnterVariable() {
declaration.modifiersSourceStart = intStack[intPtr--];
declaration.modifiers = intStack[intPtr--];
}
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ declaration.annotations = new Annotation[length],
+ 0,
+ length);
+ }
} else {
type = (TypeReference) astStack[astPtr - variableIndex];
typeDim = type.dimensions();
@@ -538,7 +569,7 @@ protected void consumeFieldDeclaration() {
requestor.exitField(lastFieldBodyEndPosition, lastFieldEndPosition);
}
}
-protected void consumeFormalParameter() {
+protected void consumeFormalParameter(boolean isVarArgs) {
// FormalParameter ::= Type VariableDeclaratorId ==> false
// FormalParameter ::= Modifiers Type VariableDeclaratorId ==> true
/*
@@ -561,7 +592,18 @@ protected void consumeFormalParameter() {
parameterName,
namePositions,
type,
- intStack[intPtr + 1]); // modifiers
+ intStack[intPtr + 1], // modifiers
+ isVarArgs);
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ arg.annotations = new Annotation[length],
+ 0,
+ length);
+ }
pushOnAstStack(arg);
intArrayPtr--;
}
@@ -627,7 +669,7 @@ protected void consumeInterfaceHeader() {
interfacenameEnds,
scanner.currentPosition - 1);
}
-protected void consumeInterfaceHeaderName() {
+protected void consumeInterfaceHeaderName1() {
// InterfaceHeaderName ::= Modifiersopt 'interface' 'Identifier'
TypeDeclaration typeDecl = new TypeDeclaration(this.compilationUnit.compilationResult);
if (nestedMethod[nestedType] == 0) {
@@ -658,6 +700,16 @@ protected void consumeInterfaceHeaderName() {
if (typeDecl.declarationSourceStart > declSourceStart) {
typeDecl.declarationSourceStart = declSourceStart;
}
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ typeDecl.annotations = new Annotation[length],
+ 0,
+ length);
+ }
typeDecl.bodyStart = typeDecl.sourceEnd + 1;
pushOnAstStack(typeDecl);
// javadoc
@@ -816,6 +868,16 @@ protected void consumeMethodHeaderName() {
md.declarationSourceStart = intStack[intPtr--];
md.modifiersSourceStart = intStack[intPtr--];
md.modifiers = intStack[intPtr--];
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ md.annotations = new Annotation[length],
+ 0,
+ length);
+ }
// javadoc
md.javadoc = this.javadoc;
this.javadoc = null;
@@ -851,6 +913,24 @@ protected void consumePackageDeclarationName() {
CharOperation.concatWith(importReference.getImportName(), '.'),
importReference.sourceStart);
}
+/*
+*
+* INTERNAL USE-ONLY
+*/
+protected void consumePackageDeclarationNameWithModifiers() {
+ /* persisting javadoc positions */
+ pushOnIntArrayStack(this.getJavaDocPositions());
+
+ super.consumePackageDeclarationNameWithModifiers();
+ ImportReference importReference = compilationUnit.currentPackage;
+
+ requestor.acceptPackage(
+ importReference.declarationSourceStart,
+ importReference.declarationSourceEnd,
+ intArrayStack[intArrayPtr--],
+ CharOperation.concatWith(importReference.getImportName(), '.'),
+ importReference.sourceStart);
+}
protected void consumePushModifiers() {
checkComment(); // might update modifiers with AccDeprecated
pushOnIntStack(modifiers); // modifiers
@@ -864,6 +944,38 @@ protected void consumePushModifiers() {
declarationSourceStart >= 0 ? declarationSourceStart : modifiersSourceStart);
}
resetModifiers();
+ pushOnExpressionStackLengthStack(0);
+}
+protected void consumePushRealModifiers() {
+ checkComment(); // might update modifiers with AccDeprecated
+ pushOnIntStack(modifiers); // modifiers
+ if (modifiersSourceStart < 0) {
+ pushOnIntStack(-1);
+ pushOnIntStack(
+ declarationSourceStart >= 0 ? declarationSourceStart : scanner.startPosition);
+ } else {
+ pushOnIntStack(modifiersSourceStart);
+ pushOnIntStack(
+ declarationSourceStart >= 0 ? declarationSourceStart : modifiersSourceStart);
+ }
+ resetModifiers();
+}
+protected void consumeSingleStaticImportDeclarationName() {
+ // SingleTypeImportDeclarationName ::= 'import' 'static' Name
+
+ /* persisting javadoc positions */
+ pushOnIntArrayStack(this.getJavaDocPositions());
+
+ super.consumeSingleStaticImportDeclarationName();
+ ImportReference importReference = (ImportReference) astStack[astPtr];
+ requestor.acceptImport(
+ importReference.declarationSourceStart,
+ importReference.declarationSourceEnd,
+ intArrayStack[intArrayPtr--],
+ CharOperation.concatWith(importReference.getImportName(), '.'),
+ importReference.sourceStart,
+ false,
+ AccStatic);
}
/*
*
@@ -883,7 +995,25 @@ protected void consumeSingleTypeImportDeclarationName() {
intArrayStack[intArrayPtr--],
CharOperation.concatWith(importReference.getImportName(), '.'),
importReference.sourceStart,
- false);
+ false,
+ AccDefault);
+}
+protected void consumeStaticImportOnDemandDeclarationName() {
+ // SingleTypeImportDeclarationName ::= 'import' 'static' Name '.' '*'
+
+ /* persisting javadoc positions */
+ pushOnIntArrayStack(this.getJavaDocPositions());
+
+ super.consumeStaticImportOnDemandDeclarationName();
+ ImportReference importReference = (ImportReference) astStack[astPtr];
+ requestor.acceptImport(
+ importReference.declarationSourceStart,
+ importReference.declarationSourceEnd,
+ intArrayStack[intArrayPtr--],
+ CharOperation.concatWith(importReference.getImportName(), '.'),
+ importReference.sourceStart,
+ true,
+ AccStatic);
}
/*
*
@@ -933,13 +1063,8 @@ protected void consumeTypeImportOnDemandDeclarationName() {
intArrayStack[intArrayPtr--],
CharOperation.concatWith(importReference.getImportName(), '.'),
importReference.sourceStart,
- true);
-}
-public CompilationUnitDeclaration endParse(int act) {
- if (scanner.recordLineSeparator) {
- requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
- }
- return super.endParse(act);
+ true,
+ AccDefault);
}
/*
* Flush javadocs defined prior to a given positions.
@@ -958,57 +1083,13 @@ public int flushCommentsDefinedPriorTo(int position) {
return lastFieldEndPosition = super.flushCommentsDefinedPriorTo(position);
}
-protected TypeReference getTypeReference(int dim) { /* build a Reference on a variable that may be qualified or not
-This variable is a type reference and dim will be its dimensions*/
-
- int length;
- TypeReference ref;
- if ((length = identifierLengthStack[identifierLengthPtr--]) == 1) {
- // single variable reference
- if (dim == 0) {
- ref =
- new SingleTypeReference(
- identifierStack[identifierPtr],
- identifierPositionStack[identifierPtr--]);
- } else {
- ref =
- new ArrayTypeReference(
- identifierStack[identifierPtr],
- dim,
- identifierPositionStack[identifierPtr--]);
- ref.sourceEnd = endPosition;
- }
- } else {
- if (length < 0) { //flag for precompiled type reference on base types
- ref = TypeReference.baseTypeReference(-length, dim);
- ref.sourceStart = intStack[intPtr--];
- if (dim == 0) {
- ref.sourceEnd = intStack[intPtr--];
- } else {
- intPtr--;
- ref.sourceEnd = endPosition;
- }
- } else { //Qualified variable reference
- char[][] tokens = new char[length][];
- identifierPtr -= length;
- long[] positions = new long[length];
- System.arraycopy(identifierStack, identifierPtr + 1, tokens, 0, length);
- System.arraycopy(
- identifierPositionStack,
- identifierPtr + 1,
- positions,
- 0,
- length);
- if (dim == 0) {
- ref = new QualifiedTypeReference(tokens, positions);
- } else {
- ref = new ArrayQualifiedTypeReference(tokens, dim, positions);
- ref.sourceEnd = endPosition;
- }
- }
+public CompilationUnitDeclaration endParse(int act) {
+ if (scanner.recordLineSeparator) {
+ requestor.acceptLineSeparatorPositions(scanner.getLineEnds());
}
- return ref;
+ return super.endParse(act);
}
+
public void initialize() {
//positionning the parser for a new compilation unit
//avoiding stack reallocation and all that....
@@ -1267,8 +1348,7 @@ public String toString() {
buffer.append(super.toString());
return buffer.toString();
}
-/*
- *
+/**
* INTERNAL USE ONLY
*/
protected TypeReference typeReference(
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/IDocumentElementRequestor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/IDocumentElementRequestor.java
index e1c2d8d9d8..1c0092688d 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/IDocumentElementRequestor.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/IDocumentElementRequestor.java
@@ -62,7 +62,8 @@ void acceptImport(
int[] javaDocPositions,
char[] name,
int nameStartPosition,
- boolean onDemand);
+ boolean onDemand,
+ int modifiers);
/**
* @param declarationStart - a source position corresponding to the start of the package
* declaration
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java
index 8373d2b679..a08bc3cbd7 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java
@@ -1,135 +1,118 @@
/*******************************************************************************
- * 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
+ * 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
- *******************************************************************************/
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jdt.internal.compiler;
import org.eclipse.jdt.core.compiler.IProblem;
/*
- * Part of the source element parser responsible for building the output.
- * It gets notified of structural information as they are detected, relying
- * on the requestor to assemble them together, based on the notifications it got.
- *
- * The structural investigation includes:
- * - package statement
- * - import statements
- * - top-level types: package member, member types (member types of member types...)
- * - fields
- * - methods
- *
+ * Part of the source element parser responsible for building the output. It
+ * gets notified of structural information as they are detected, relying on the
+ * requestor to assemble them together, based on the notifications it got.
+ *
+ * The structural investigation includes: - package statement - import
+ * statements - top-level types: package member, member types (member types of
+ * member types...) - fields - methods
+ *
* If reference information is requested, then all source constructs are
* investigated and type, field & method references are provided as well.
- *
+ *
* Any (parsing) problem encountered is also provided.
- *
+ *
* All positions are relative to the exact source fed to the parser.
- *
- * Elements which are complex are notified in two steps:
- * - enter<Element> : once the element header has been identified
- * - exit<Element> : once the element has been fully consumed
- *
- * other simpler elements (package, import) are read all at once:
- * - accept<Element>
- */
-
-public interface ISourceElementRequestor {
-void acceptConstructorReference(char[] typeName, int argCount, int sourcePosition);
-void acceptFieldReference(char[] fieldName, int sourcePosition);
-/**
- * @param declarationStart This is the position of the first character of the
- * import keyword.
- * @param declarationEnd This is the position of the ';' ending the import statement
- * or the end of the comment following the import.
- * @param name This is the name of the import like specified in the source including the dots. The '.*'
- * is never included in the name.
- * @param onDemand set to true if the import is an import on demand (e.g. import java.io.*). False otherwise.
- * @param modifiers can be set to static from 1.5 on.
- */
-void acceptImport(
- int declarationStart,
- int declarationEnd,
- char[] name,
- boolean onDemand,
- int modifiers);
-/*
- * Table of line separator position. This table is passed once at the end
- * of the parse action, so as to allow computation of normalized ranges.
- *
- * A line separator might corresponds to several characters in the source,
*
+ * Elements which are complex are notified in two steps: - enter <Element> :
+ * once the element header has been identified - exit <Element> : once the
+ * element has been fully consumed
+ *
+ * other simpler elements (package, import) are read all at once: - accept
+ * <Element>
*/
-void acceptLineSeparatorPositions(int[] positions);
-void acceptMethodReference(char[] methodName, int argCount, int sourcePosition);
-void acceptPackage(
- int declarationStart,
- int declarationEnd,
- char[] name);
-void acceptProblem(IProblem problem);
-void acceptTypeReference(char[][] typeName, int sourceStart, int sourceEnd);
-void acceptTypeReference(char[] typeName, int sourcePosition);
-void acceptUnknownReference(char[][] name, int sourceStart, int sourceEnd);
-void acceptUnknownReference(char[] name, int sourcePosition);
-void enterClass(
- int declarationStart,
- int modifiers,
- char[] name,
- int nameSourceStart,
- int nameSourceEnd,
- char[] superclass,
- char[][] superinterfaces);
-void enterCompilationUnit();
-void enterConstructor(
- int declarationStart,
- int modifiers,
- char[] name,
- int nameSourceStart,
- int nameSourceEnd,
- char[][] parameterTypes,
- char[][] parameterNames,
- char[][] exceptionTypes);
-void enterField(
- int declarationStart,
- int modifiers,
- char[] type,
- char[] name,
- int nameSourceStart,
- int nameSourceEnd);
-void enterInitializer(
- int declarationStart,
- int modifiers);
-void enterInterface(
- int declarationStart,
- int modifiers,
- char[] name,
- int nameSourceStart,
- int nameSourceEnd,
- char[][] superinterfaces);
-void enterMethod(
- int declarationStart,
- int modifiers,
- char[] returnType,
- char[] name,
- int nameSourceStart,
- int nameSourceEnd,
- char[][] parameterTypes,
- char[][] parameterNames,
- char[][] exceptionTypes);
-void exitClass(int declarationEnd);
-void exitCompilationUnit(int declarationEnd);
-void exitConstructor(int declarationEnd);
-/*
- * initializationStart denotes the source start of the expression used for initializing
- * the field if any (-1 if no initialization).
- */
-void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd);
-void exitInitializer(int declarationEnd);
-void exitInterface(int declarationEnd);
-void exitMethod(int declarationEnd);
-}
+
+public interface ISourceElementRequestor {
+
+ void acceptConstructorReference(char[] typeName, int argCount, int sourcePosition);
+
+ void acceptFieldReference(char[] fieldName, int sourcePosition);
+ /**
+ * @param declarationStart
+ * This is the position of the first character of the import
+ * keyword.
+ * @param declarationEnd
+ * This is the position of the ';' ending the import statement or
+ * the end of the comment following the import.
+ * @param name
+ * This is the name of the import like specified in the source
+ * including the dots. The '.*' is never included in the name.
+ * @param onDemand
+ * set to true if the import is an import on demand (e.g. import
+ * java.io.*). False otherwise.
+ * @param modifiers
+ * can be set to static from 1.5 on.
+ */
+ void acceptImport(int declarationStart, int declarationEnd, char[] name, boolean onDemand, int modifiers);
+
+ /*
+ * Table of line separator position. This table is passed once at the end of
+ * the parse action, so as to allow computation of normalized ranges.
+ *
+ * A line separator might corresponds to several characters in the source,
+ *
+ */
+ void acceptLineSeparatorPositions(int[] positions);
+
+ void acceptMethodReference(char[] methodName, int argCount, int sourcePosition);
+
+ void acceptPackage(int declarationStart, int declarationEnd, char[] name);
+
+ void acceptProblem(IProblem problem);
+
+ void acceptTypeReference(char[][] typeName, int sourceStart, int sourceEnd);
+
+ void acceptTypeReference(char[] typeName, int sourcePosition);
+
+ void acceptUnknownReference(char[][] name, int sourceStart, int sourceEnd);
+
+ void acceptUnknownReference(char[] name, int sourcePosition);
+
+ void enterClass(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[] superclass, char[][] superinterfaces,
+ char[][] typeParameterNames, char[][][] typeParameterBounds);
+
+ void enterCompilationUnit();
+
+ void enterConstructor(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[][] parameterTypes,
+ char[][] parameterNames, char[][] exceptionTypes, char[][] typeParameterNames, char[][][] typeParameterBounds);
+
+ void enterField(int declarationStart, int modifiers, char[] type, char[] name, int nameSourceStart, int nameSourceEnd);
+
+ void enterInitializer(int declarationStart, int modifiers);
+
+ void enterInterface(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[][] superinterfaces,
+ char[][] typeParameterNames, char[][][] typeParameterBounds);
+
+ void enterMethod(int declarationStart, int modifiers, char[] returnType, char[] name, int nameSourceStart, int nameSourceEnd, char[][] parameterTypes,
+ char[][] parameterNames, char[][] exceptionTypes, char[][] typeParameterNames, char[][][] typeParameterBounds);
+
+ void exitClass(int declarationEnd);
+
+ void exitCompilationUnit(int declarationEnd);
+
+ void exitConstructor(int declarationEnd);
+
+ /*
+ * initializationStart denotes the source start of the expression used for
+ * initializing the field if any (-1 if no initialization).
+ */
+ void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd);
+
+ void exitInitializer(int declarationEnd);
+
+ void exitInterface(int declarationEnd);
+
+ void exitMethod(int declarationEnd);
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java
index 24e9c98f1c..b7f3a61d82 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java
@@ -166,7 +166,7 @@ public void checkComment() {
JavadocAllocationExpression constructor = (JavadocAllocationExpression) reference;
int argCount = constructor.arguments == null ? 0 : constructor.arguments.length;
if (constructor.type != null) {
- char[][] compoundName = constructor.type.getTypeName();
+ char[][] compoundName = constructor.type.getParameterizedTypeName();
this.requestor.acceptConstructorReference(compoundName[compoundName.length-1], argCount, constructor.sourceStart);
if (!constructor.type.isThis()) {
acceptJavadocTypeReference(constructor.type);
@@ -197,7 +197,7 @@ protected void classInstanceCreation(boolean alwaysQualified) {
requestor.acceptConstructorReference(
typeRef instanceof SingleTypeReference
? ((SingleTypeReference) typeRef).token
- : CharOperation.concatWith(alloc.type.getTypeName(), '.'),
+ : CharOperation.concatWith(alloc.type.getParameterizedTypeName(), '.'),
alloc.arguments == null ? 0 : alloc.arguments.length,
alloc.sourceStart);
}
@@ -223,6 +223,16 @@ protected void consumeConstructorHeaderName() {
//modifiers
cd.declarationSourceStart = intStack[intPtr--];
cd.modifiers = intStack[intPtr--];
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ cd.annotations = new Annotation[length],
+ 0,
+ length);
+ }
// javadoc
cd.javadoc = this.javadoc;
this.javadoc = null;
@@ -246,6 +256,64 @@ protected void consumeConstructorHeaderName() {
}
}
}
+protected void consumeConstructorHeaderNameWithTypeParameters() {
+
+ /* recovering - might be an empty message send */
+ if (this.currentElement != null){
+ if (this.lastIgnoredToken == TokenNamenew){ // was an allocation expression
+ this.lastCheckPoint = this.scanner.startPosition; // force to restart at this exact position
+ this.restartRecovery = true;
+ return;
+ }
+ }
+
+ // ConstructorHeaderName ::= Modifiersopt TypeParameters 'Identifier' '('
+ SourceConstructorDeclaration cd = new SourceConstructorDeclaration(this.compilationUnit.compilationResult);
+
+ //name -- this is not really revelant but we do .....
+ cd.selector = this.identifierStack[this.identifierPtr];
+ long selectorSourcePositions = this.identifierPositionStack[this.identifierPtr--];
+ this.identifierLengthPtr--;
+
+ // consume type parameters
+ int length = this.genericsLengthStack[this.genericsLengthPtr--];
+ this.genericsPtr -= length;
+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, cd.typeParameters = new TypeParameter[length], 0, length);
+
+ //modifiers
+ cd.declarationSourceStart = this.intStack[this.intPtr--];
+ cd.modifiers = this.intStack[this.intPtr--];
+ // consume annotations
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ cd.annotations = new Annotation[length],
+ 0,
+ length);
+ }
+ // javadoc
+ cd.javadoc = this.javadoc;
+ this.javadoc = null;
+
+ //highlight starts at the selector starts
+ cd.sourceStart = (int) (selectorSourcePositions >>> 32);
+ cd.selectorSourceEnd = (int) selectorSourcePositions;
+ pushOnAstStack(cd);
+ cd.sourceEnd = this.lParenPos;
+ cd.bodyStart = this.lParenPos+1;
+ this.listLength = 0; // initialize listLength before reading parameters/throws
+
+ // recovery
+ if (this.currentElement != null){
+ this.lastCheckPoint = cd.bodyStart;
+ if ((this.currentElement instanceof RecoveredType && this.lastIgnoredToken != TokenNameDOT)
+ || cd.modifiers != 0){
+ this.currentElement = this.currentElement.add(cd, 0);
+ this.lastIgnoredToken = -1;
+ }
+ }
+}
/*
*
* INTERNAL USE-ONLY
@@ -287,14 +355,24 @@ protected void consumeMethodHeaderName() {
SourceMethodDeclaration md = new SourceMethodDeclaration(this.compilationUnit.compilationResult);
//name
- md.selector = identifierStack[identifierPtr];
- long selectorSourcePositions = identifierPositionStack[identifierPtr--];
- identifierLengthPtr--;
+ md.selector = this.identifierStack[identifierPtr];
+ long selectorSourcePositions = this.identifierPositionStack[this.identifierPtr--];
+ this.identifierLengthPtr--;
//type
- md.returnType = getTypeReference(intStack[intPtr--]);
+ md.returnType = getTypeReference(this.intStack[this.intPtr--]);
//modifiers
- md.declarationSourceStart = intStack[intPtr--];
- md.modifiers = intStack[intPtr--];
+ md.declarationSourceStart = this.intStack[this.intPtr--];
+ md.modifiers = this.intStack[this.intPtr--];
+ // consume annotations
+ int length;
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ md.annotations = new Annotation[length],
+ 0,
+ length);
+ }
// javadoc
md.javadoc = this.javadoc;
this.javadoc = null;
@@ -303,22 +381,77 @@ protected void consumeMethodHeaderName() {
md.sourceStart = (int) (selectorSourcePositions >>> 32);
md.selectorSourceEnd = (int) selectorSourcePositions;
pushOnAstStack(md);
- md.sourceEnd = lParenPos;
- md.bodyStart = lParenPos+1;
- listLength = 0; // initialize listLength before reading parameters/throws
+ md.sourceEnd = this.lParenPos;
+ md.bodyStart = this.lParenPos+1;
+ this.listLength = 0; // initialize listLength before reading parameters/throws
// recovery
- if (currentElement != null){
- if (currentElement instanceof RecoveredType
+ if (this.currentElement != null){
+ if (this.currentElement instanceof RecoveredType
//|| md.modifiers != 0
- || (scanner.getLineNumber(md.returnType.sourceStart)
- == scanner.getLineNumber(md.sourceStart))){
- lastCheckPoint = md.bodyStart;
- currentElement = currentElement.add(md, 0);
- lastIgnoredToken = -1;
+ || (this.scanner.getLineNumber(md.returnType.sourceStart)
+ == this.scanner.getLineNumber(md.sourceStart))){
+ this.lastCheckPoint = md.bodyStart;
+ this.currentElement = currentElement.add(md, 0);
+ this.lastIgnoredToken = -1;
} else {
- lastCheckPoint = md.sourceStart;
- restartRecovery = true;
+ this.lastCheckPoint = md.sourceStart;
+ this.restartRecovery = true;
+ }
+ }
+}
+protected void consumeMethodHeaderNameWithTypeParameters() {
+ // MethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
+ SourceMethodDeclaration md = new SourceMethodDeclaration(this.compilationUnit.compilationResult);
+
+ //name
+ md.selector = this.identifierStack[this.identifierPtr];
+ long selectorSourcePositions = this.identifierPositionStack[this.identifierPtr--];
+ this.identifierLengthPtr--;
+ //type
+ md.returnType = getTypeReference(this.intStack[this.intPtr--]);
+
+ // consume type parameters
+ int length = this.genericsLengthStack[this.genericsLengthPtr--];
+ this.genericsPtr -= length;
+ System.arraycopy(this.genericsStack, this.genericsPtr + 1, md.typeParameters = new TypeParameter[length], 0, length);
+
+ //modifiers
+ md.declarationSourceStart = this.intStack[this.intPtr--];
+ md.modifiers = this.intStack[this.intPtr--];
+ // consume annotations
+ if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
+ System.arraycopy(
+ this.expressionStack,
+ (this.expressionPtr -= length) + 1,
+ md.annotations = new Annotation[length],
+ 0,
+ length);
+ }
+ // javadoc
+ md.javadoc = this.javadoc;
+ this.javadoc = null;
+
+ //highlight starts at selector start
+ md.sourceStart = (int) (selectorSourcePositions >>> 32);
+ md.selectorSourceEnd = (int) selectorSourcePositions;
+ pushOnAstStack(md);
+ md.sourceEnd = this.lParenPos;
+ md.bodyStart = this.lParenPos+1;
+ this.listLength = 0; // initialize this.listLength before reading parameters/throws
+
+ // recovery
+ if (this.currentElement != null){
+ if (this.currentElement instanceof RecoveredType
+ //|| md.modifiers != 0
+ || (this.scanner.getLineNumber(md.returnType.sourceStart)
+ == this.scanner.getLineNumber(md.sourceStart))){
+ this.lastCheckPoint = md.bodyStart;
+ this.currentElement = this.currentElement.add(md, 0);
+ this.lastIgnoredToken = -1;
+ } else {
+ this.lastCheckPoint = md.sourceStart;
+ this.restartRecovery = true;
}
}
}
@@ -328,9 +461,23 @@ protected void consumeMethodHeaderName() {
*/
protected void consumeMethodInvocationName() {
// MethodInvocation ::= Name '(' ArgumentListopt ')'
+ super.consumeMethodInvocationName();
+
+ // when the name is only an identifier...we have a message send to "this" (implicit)
+ MessageSend messageSend = (MessageSend) expressionStack[expressionPtr];
+ Expression[] args = messageSend.arguments;
+ if (reportReferenceInfo) {
+ requestor.acceptMethodReference(
+ messageSend.selector,
+ args == null ? 0 : args.length,
+ (int)(messageSend.nameSourcePosition >>> 32));
+ }
+}
+protected void consumeMethodInvocationNameWithTypeArguments() {
+ // MethodInvocation ::= Name '.' TypeArguments 'Identifier' '(' ArgumentListopt ')'
+ super.consumeMethodInvocationNameWithTypeArguments();
// when the name is only an identifier...we have a message send to "this" (implicit)
- super.consumeMethodInvocationName();
MessageSend messageSend = (MessageSend) expressionStack[expressionPtr];
Expression[] args = messageSend.arguments;
if (reportReferenceInfo) {
@@ -359,6 +506,21 @@ protected void consumeMethodInvocationPrimary() {
*
* INTERNAL USE-ONLY
*/
+protected void consumeMethodInvocationPrimaryWithTypeArguments() {
+ super.consumeMethodInvocationPrimaryWithTypeArguments();
+ MessageSend messageSend = (MessageSend) expressionStack[expressionPtr];
+ Expression[] args = messageSend.arguments;
+ if (reportReferenceInfo) {
+ requestor.acceptMethodReference(
+ messageSend.selector,
+ args == null ? 0 : args.length,
+ (int)(messageSend.nameSourcePosition >>> 32));
+ }
+}
+/*
+ *
+ * INTERNAL USE-ONLY
+ */
protected void consumeMethodInvocationSuper() {
// MethodInvocation ::= 'super' '.' 'Identifier' '(' ArgumentListopt ')'
super.consumeMethodInvocationSuper();
@@ -371,6 +533,26 @@ protected void consumeMethodInvocationSuper() {
(int)(messageSend.nameSourcePosition >>> 32));
}
}
+protected void consumeMethodInvocationSuperWithTypeArguments() {
+ // MethodInvocation ::= 'super' '.' TypeArguments 'Identifier' '(' ArgumentListopt ')'
+ super.consumeMethodInvocationSuperWithTypeArguments();
+ MessageSend messageSend = (MessageSend) expressionStack[expressionPtr];
+ Expression[] args = messageSend.arguments;
+ if (reportReferenceInfo) {
+ requestor.acceptMethodReference(
+ messageSend.selector,
+ args == null ? 0 : args.length,
+ (int)(messageSend.nameSourcePosition >>> 32));
+ }
+}
+protected void consumeSingleStaticImportDeclarationName() {
+ // SingleTypeImportDeclarationName ::= 'import' 'static' Name
+ super.consumeSingleStaticImportDeclarationName();
+ ImportReference impt = (ImportReference)astStack[astPtr];
+ if (reportReferenceInfo) {
+ requestor.acceptTypeReference(impt.tokens, impt.sourceStart, impt.sourceEnd);
+ }
+}
protected void consumeSingleTypeImportDeclarationName() {
// SingleTypeImportDeclarationName ::= 'import' Name
/* push an ImportRef build from the last name
@@ -404,6 +586,7 @@ public MethodDeclaration convertToMethodDeclaration(ConstructorDeclaration c, Co
m.selector = c.selector;
m.statements = c.statements;
m.modifiers = c.modifiers;
+ m.annotations = c.annotations;
m.arguments = c.arguments;
m.thrownExceptions = c.thrownExceptions;
m.explicitDeclarations = c.explicitDeclarations;
@@ -435,45 +618,61 @@ public TypeReference getTypeReference(int dim) {
/* build a Reference on a variable that may be qualified or not
* This variable is a type reference and dim will be its dimensions
*/
- int length;
- if ((length = identifierLengthStack[identifierLengthPtr--]) == 1) {
- // single variable reference
+ int length = identifierLengthStack[identifierLengthPtr--];
+ if (length < 0) { //flag for precompiled type reference on base types
+ TypeReference ref = TypeReference.baseTypeReference(-length, dim);
+ ref.sourceStart = intStack[intPtr--];
if (dim == 0) {
- SingleTypeReference ref =
- new SingleTypeReference(
- identifierStack[identifierPtr],
- identifierPositionStack[identifierPtr--]);
- if (reportReferenceInfo) {
- requestor.acceptTypeReference(ref.token, ref.sourceStart);
- }
- return ref;
+ ref.sourceEnd = intStack[intPtr--];
} else {
- ArrayTypeReference ref =
- new ArrayTypeReference(
- identifierStack[identifierPtr],
- dim,
- identifierPositionStack[identifierPtr--]);
+ intPtr--; // no need to use this position as it is an array
ref.sourceEnd = endPosition;
+ }
+ if (reportReferenceInfo){
+ requestor.acceptTypeReference(ref.getParameterizedTypeName(), ref.sourceStart, ref.sourceEnd);
+ }
+ return ref;
+ } else {
+ int numberOfIdentifiers = this.genericsIdentifiersLengthStack[this.genericsIdentifiersLengthPtr--];
+ if (length != numberOfIdentifiers || this.genericsLengthStack[this.genericsLengthPtr] != 0) {
+ // generic type
+ TypeReference ref = getTypeReferenceForGenericType(dim, length, numberOfIdentifiers);
if (reportReferenceInfo) {
- requestor.acceptTypeReference(ref.token, ref.sourceStart);
+ if (length == 1 && numberOfIdentifiers == 1) {
+ ParameterizedSingleTypeReference parameterizedSingleTypeReference = (ParameterizedSingleTypeReference) ref;
+ requestor.acceptTypeReference(parameterizedSingleTypeReference.token, parameterizedSingleTypeReference.sourceStart);
+ } else {
+ ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference = (ParameterizedQualifiedTypeReference) ref;
+ requestor.acceptTypeReference(parameterizedQualifiedTypeReference.tokens, parameterizedQualifiedTypeReference.sourceStart, parameterizedQualifiedTypeReference.sourceEnd);
+ }
}
return ref;
- }
- } else {
- if (length < 0) { //flag for precompiled type reference on base types
- TypeReference ref = TypeReference.baseTypeReference(-length, dim);
- ref.sourceStart = intStack[intPtr--];
+ } else if (length == 1) {
+ // single variable reference
+ this.genericsLengthPtr--; // pop the 0
if (dim == 0) {
- ref.sourceEnd = intStack[intPtr--];
+ SingleTypeReference ref =
+ new SingleTypeReference(
+ identifierStack[identifierPtr],
+ identifierPositionStack[identifierPtr--]);
+ if (reportReferenceInfo) {
+ requestor.acceptTypeReference(ref.token, ref.sourceStart);
+ }
+ return ref;
} else {
- intPtr--; // no need to use this position as it is an array
+ ArrayTypeReference ref =
+ new ArrayTypeReference(
+ identifierStack[identifierPtr],
+ dim,
+ identifierPositionStack[identifierPtr--]);
ref.sourceEnd = endPosition;
+ if (reportReferenceInfo) {
+ requestor.acceptTypeReference(ref.token, ref.sourceStart);
+ }
+ return ref;
}
- if (reportReferenceInfo){
- requestor.acceptTypeReference(ref.getTypeName(), ref.sourceStart, ref.sourceEnd);
- }
- return ref;
- } else { //Qualified variable reference
+ } else {//Qualified variable reference
+ this.genericsLengthPtr--;
char[][] tokens = new char[length][];
identifierPtr -= length;
long[] positions = new long[length];
@@ -754,7 +953,7 @@ public void notifySourceElementRequestor(AbstractMethodDeclaration methodDeclara
argumentTypes = new char[argumentLength][];
argumentNames = new char[argumentLength][];
for (int i = 0; i < argumentLength; i++) {
- argumentTypes[i] = returnTypeName(arguments[i].type);
+ argumentTypes[i] = CharOperation.concatWith(arguments[i].type.getParameterizedTypeName(), '.');
argumentNames[i] = arguments[i].name;
}
}
@@ -765,7 +964,7 @@ public void notifySourceElementRequestor(AbstractMethodDeclaration methodDeclara
thrownExceptionTypes = new char[thrownExceptionLength][];
for (int i = 0; i < thrownExceptionLength; i++) {
thrownExceptionTypes[i] =
- CharOperation.concatWith(thrownExceptions[i].getTypeName(), '.');
+ CharOperation.concatWith(thrownExceptions[i].getParameterizedTypeName(), '.');
}
}
// by default no selector end position
@@ -776,6 +975,27 @@ public void notifySourceElementRequestor(AbstractMethodDeclaration methodDeclara
((SourceConstructorDeclaration) methodDeclaration).selectorSourceEnd;
}
if (isInRange){
+ TypeParameter[] typeParameters = methodDeclaration.typeParameters();
+ char[][] typeParameterNames = null;
+ char[][][] typeParameterBounds = null;
+ if (typeParameters != null) {
+ int typeParametersLength = typeParameters.length;
+ typeParameterNames = new char[typeParametersLength][];
+ typeParameterBounds = new char[typeParametersLength][][];
+ for (int i = 0; i < typeParametersLength; i++) {
+ typeParameterNames[i] = typeParameters[i].name;
+ TypeReference[] bounds = typeParameters[i].bounds;
+ if (bounds != null) {
+ int boundLength = bounds.length;
+ char[][] boundNames = new char[boundLength][];
+ for (int j = 0; j < boundLength; j++) {
+ boundNames[j] =
+ CharOperation.concatWith(bounds[i].getParameterizedTypeName(), '.');
+ }
+ typeParameterBounds[i] = boundNames;
+ }
+ }
+ }
requestor.enterConstructor(
methodDeclaration.declarationSourceStart,
methodDeclaration.modifiers,
@@ -784,7 +1004,9 @@ public void notifySourceElementRequestor(AbstractMethodDeclaration methodDeclara
selectorSourceEnd,
argumentTypes,
argumentNames,
- thrownExceptionTypes);
+ thrownExceptionTypes,
+ typeParameterNames,
+ typeParameterBounds);
}
if (reportReferenceInfo) {
ConstructorDeclaration constructorDeclaration = (ConstructorDeclaration) methodDeclaration;
@@ -818,19 +1040,60 @@ public void notifySourceElementRequestor(AbstractMethodDeclaration methodDeclara
((SourceMethodDeclaration) methodDeclaration).selectorSourceEnd;
}
if (isInRange) {
+ TypeParameter[] typeParameters = methodDeclaration.typeParameters();
+ char[][] typeParameterNames = null;
+ char[][][] typeParameterBounds = null;
+ if (typeParameters != null) {
+ int typeParametersLength = typeParameters.length;
+ typeParameterNames = new char[typeParametersLength][];
+ typeParameterBounds = new char[typeParametersLength][][];
+ for (int i = 0; i < typeParametersLength; i++) {
+ typeParameterNames[i] = typeParameters[i].name;
+ TypeReference[] bounds = typeParameters[i].bounds;
+ if (bounds != null) {
+ int boundLength = bounds.length;
+ char[][] boundNames = new char[boundLength][];
+ for (int j = 0; j < boundLength; j++) {
+ boundNames[j] =
+ CharOperation.concatWith(bounds[i].getParameterizedTypeName(), '.');
+ }
+ typeParameterBounds[i] = boundNames;
+ }
+ }
+ }
int currentModifiers = methodDeclaration.modifiers;
boolean deprecated = (currentModifiers & AccDeprecated) != 0; // remember deprecation so as to not lose it below
- requestor.enterMethod(
- methodDeclaration.declarationSourceStart,
- deprecated ? (currentModifiers & AccJustFlag) | AccDeprecated : currentModifiers & AccJustFlag,
- returnTypeName(((MethodDeclaration) methodDeclaration).returnType),
- methodDeclaration.selector,
- methodDeclaration.sourceStart,
- selectorSourceEnd,
- argumentTypes,
- argumentNames,
- thrownExceptionTypes);
+ if (methodDeclaration instanceof MethodDeclaration) {
+ TypeReference returnType = ((MethodDeclaration) methodDeclaration).returnType;
+ requestor.enterMethod(
+ methodDeclaration.declarationSourceStart,
+ deprecated ? (currentModifiers & AccJustFlag) | AccDeprecated : currentModifiers & AccJustFlag,
+ returnType == null ? null : CharOperation.concatWith(returnType.getParameterizedTypeName(), '.'),
+ methodDeclaration.selector,
+ methodDeclaration.sourceStart,
+ selectorSourceEnd,
+ argumentTypes,
+ argumentNames,
+ thrownExceptionTypes,
+ typeParameterNames,
+ typeParameterBounds);
+ } else {
+ TypeReference returnType = ((AnnotationTypeMemberDeclaration) methodDeclaration).returnType;
+ requestor.enterMethod(
+ methodDeclaration.declarationSourceStart,
+ deprecated ? (currentModifiers & AccJustFlag) | AccDeprecated : currentModifiers & AccJustFlag,
+ returnType == null ? null : CharOperation.concatWith(returnType.getParameterizedTypeName(), '.'),
+ methodDeclaration.selector,
+ methodDeclaration.sourceStart,
+ selectorSourceEnd,
+ argumentTypes,
+ argumentNames,
+ thrownExceptionTypes,
+ typeParameterNames,
+ typeParameterBounds);
+ }
}
+
this.visitIfNeeded(methodDeclaration);
if (isInRange){
@@ -862,7 +1125,7 @@ public void notifySourceElementRequestor(FieldDeclaration fieldDeclaration) {
requestor.enterField(
fieldDeclaration.declarationSourceStart,
deprecated ? (currentModifiers & AccJustFlag) | AccDeprecated : currentModifiers & AccJustFlag,
- returnTypeName(fieldDeclaration.type),
+ CharOperation.concatWith(fieldDeclaration.type.getParameterizedTypeName(), '.'),
fieldDeclaration.name,
fieldDeclaration.sourceStart,
fieldDeclaration.sourceEnd);
@@ -954,7 +1217,28 @@ public void notifySourceElementRequestor(TypeDeclaration typeDeclaration, boolea
if (superInterfaces != null) {
for (int i = 0; i < superInterfacesLength; i++) {
interfaceNames[i] =
- CharOperation.concatWith(superInterfaces[i].getTypeName(), '.');
+ CharOperation.concatWith(superInterfaces[i].getParameterizedTypeName(), '.');
+ }
+ }
+ TypeParameter[] typeParameters = typeDeclaration.typeParameters;
+ char[][] typeParameterNames = null;
+ char[][][] typeParameterBounds = null;
+ if (typeParameters != null) {
+ int typeParametersLength = typeParameters.length;
+ typeParameterNames = new char[typeParametersLength][];
+ typeParameterBounds = new char[typeParametersLength][][];
+ for (int i = 0; i < typeParametersLength; i++) {
+ typeParameterNames[i] = typeParameters[i].name;
+ TypeReference[] bounds = typeParameters[i].bounds;
+ if (bounds != null) {
+ int boundLength = bounds.length;
+ char[][] boundNames = new char[boundLength][];
+ for (int j = 0; j < boundLength; j++) {
+ boundNames[j] =
+ CharOperation.concatWith(bounds[i].getParameterizedTypeName(), '.');
+ }
+ typeParameterBounds[i] = boundNames;
+ }
}
}
if (isInterface) {
@@ -967,7 +1251,9 @@ public void notifySourceElementRequestor(TypeDeclaration typeDeclaration, boolea
typeDeclaration.name,
typeDeclaration.sourceStart,
sourceEnd(typeDeclaration),
- interfaceNames);
+ interfaceNames,
+ typeParameterNames,
+ typeParameterBounds);
}
if (nestedTypeIndex == typeNames.length) {
// need a resize
@@ -987,7 +1273,9 @@ public void notifySourceElementRequestor(TypeDeclaration typeDeclaration, boolea
typeDeclaration.sourceStart,
sourceEnd(typeDeclaration),
null,
- interfaceNames);
+ interfaceNames,
+ typeParameterNames,
+ typeParameterBounds);
}
} else {
if (isInRange){
@@ -997,8 +1285,10 @@ public void notifySourceElementRequestor(TypeDeclaration typeDeclaration, boolea
typeDeclaration.name,
typeDeclaration.sourceStart,
sourceEnd(typeDeclaration),
- CharOperation.concatWith(superclass.getTypeName(), '.'),
- interfaceNames);
+ CharOperation.concatWith(superclass.getParameterizedTypeName(), '.'),
+ interfaceNames,
+ typeParameterNames,
+ typeParameterBounds);
}
}
if (nestedTypeIndex == typeNames.length) {
@@ -1007,7 +1297,7 @@ public void notifySourceElementRequestor(TypeDeclaration typeDeclaration, boolea
System.arraycopy(superTypeNames, 0, (superTypeNames = new char[nestedTypeIndex * 2][]), 0, nestedTypeIndex);
}
typeNames[nestedTypeIndex] = typeDeclaration.name;
- superTypeNames[nestedTypeIndex++] = superclass == null ? JAVA_LANG_OBJECT : CharOperation.concatWith(superclass.getTypeName(), '.');
+ superTypeNames[nestedTypeIndex++] = superclass == null ? JAVA_LANG_OBJECT : CharOperation.concatWith(superclass.getParameterizedTypeName(), '.');
}
}
while ((fieldIndex < fieldCounter)
@@ -1259,30 +1549,6 @@ private static void quickSort(ASTNode[] sortedCollection, int left, int right) {
quickSort(sortedCollection, left, original_right);
}
}
-/*
- * Answer a char array representation of the type name formatted like:
- * - type name + dimensions
- * Example:
- * "A[][]".toCharArray()
- * "java.lang.String".toCharArray()
- */
-private char[] returnTypeName(TypeReference type) {
- if (type == null)
- return null;
- int dimension = type.dimensions();
- if (dimension != 0) {
- char[] dimensionsArray = new char[dimension * 2];
- for (int i = 0; i < dimension; i++) {
- dimensionsArray[i * 2] = '[';
- dimensionsArray[(i * 2) + 1] = ']';
- }
- return CharOperation.concat(
- CharOperation.concatWith(type.getTypeName(), '.'),
- dimensionsArray);
- }
- return CharOperation.concatWith(type.getTypeName(), '.');
-}
-
public void addUnknownRef(NameReference nameRef) {
if (this.unknownRefs.length == this.unknownRefsCounter) {
// resize
@@ -1311,7 +1577,7 @@ private void visitIfNeeded(FieldDeclaration field) {
if (this.localDeclarationVisitor != null
&& (field.bits & ASTNode.HasLocalTypeMASK) != 0) {
if (field.initialization != null) {
- field.initialization.traverse(this.localDeclarationVisitor, null);
+ field.initialization.traverse(this.localDeclarationVisitor, (MethodScope) null);
}
}
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java
index 90b43ef64d..0bd0713284 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java
@@ -121,7 +121,9 @@ public class SourceElementRequestorAdapter implements ISourceElementRequestor {
int nameSourceStart,
int nameSourceEnd,
char[] superclass,
- char[][] superinterfaces) {
+ char[][] superinterfaces,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
// default implementation: do nothing
}
@@ -143,7 +145,9 @@ public class SourceElementRequestorAdapter implements ISourceElementRequestor {
int nameSourceEnd,
char[][] parameterTypes,
char[][] parameterNames,
- char[][] exceptionTypes) {
+ char[][] exceptionTypes,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
// default implementation: do nothing
}
@@ -176,7 +180,9 @@ public class SourceElementRequestorAdapter implements ISourceElementRequestor {
char[] name,
int nameSourceStart,
int nameSourceEnd,
- char[][] superinterfaces) {
+ char[][] superinterfaces,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
// default implementation: do nothing
}
@@ -192,7 +198,9 @@ public class SourceElementRequestorAdapter implements ISourceElementRequestor {
int nameSourceEnd,
char[][] parameterTypes,
char[][] parameterNames,
- char[][] exceptionTypes) {
+ char[][] exceptionTypes,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
// default implementation: do nothing
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java
index c3ccb87db5..b030319c0b 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java
@@ -23,6 +23,8 @@ package org.eclipse.jdt.internal.compiler.parser;
*
*/
+import java.util.ArrayList;
+
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.CompilationResult;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
@@ -35,16 +37,21 @@ import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration;
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference;
import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference;
import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
+import org.eclipse.jdt.internal.compiler.ast.Wildcard;
import org.eclipse.jdt.internal.compiler.env.ISourceField;
import org.eclipse.jdt.internal.compiler.env.ISourceImport;
import org.eclipse.jdt.internal.compiler.env.ISourceMethod;
import org.eclipse.jdt.internal.compiler.env.ISourceType;
import org.eclipse.jdt.internal.compiler.lookup.CompilerModifiers;
+import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
public class SourceTypeConverter implements CompilerModifiers {
@@ -62,6 +69,8 @@ public class SourceTypeConverter implements CompilerModifiers {
private Parser parser;
private ProblemReporter problemReporter;
+ int namePos;
+
private SourceTypeConverter(int flags, ProblemReporter problemReporter) {
this.flags = flags;
this.problemReporter = problemReporter;
@@ -173,16 +182,30 @@ public class SourceTypeConverter implements CompilerModifiers {
int start = sourceMethod.getNameSourceStart();
int end = sourceMethod.getNameSourceEnd();
+ /* convert type parameters */
+ char[][] typeParameterNames = sourceMethod.getTypeParameterNames();
+ TypeParameter[] typeParams = null;
+ if (typeParameterNames != null) {
+ int parameterCount = typeParameterNames.length;
+ char[][][] typeParameterBounds = sourceMethod.getTypeParameterBounds();
+ typeParams = new TypeParameter[parameterCount];
+ for (int i = 0; i < parameterCount; i++) {
+ typeParams[i] = createTypeParameter(typeParameterNames[i], typeParameterBounds[i], start, end);
+ }
+ }
+
if (sourceMethod.isConstructor()) {
ConstructorDeclaration decl = new ConstructorDeclaration(compilationResult);
decl.isDefaultConstructor = false;
method = decl;
+ decl.typeParameters = typeParams;
} else {
MethodDeclaration decl = new MethodDeclaration(compilationResult);
/* convert return type */
decl.returnType =
createTypeReference(sourceMethod.getReturnTypeName(), start, end);
method = decl;
+ decl.typeParameters = typeParams;
}
method.selector = sourceMethod.getSelector();
method.modifiers = sourceMethod.getModifiers();
@@ -203,7 +226,8 @@ public class SourceTypeConverter implements CompilerModifiers {
argumentNames[i],
position,
createTypeReference(argumentTypeNames[i], start, end),
- AccDefault);
+ AccDefault,
+ false);
// do not care whether was final or not
}
@@ -236,6 +260,16 @@ public class SourceTypeConverter implements CompilerModifiers {
type.declarationSourceEnd = sourceType.getDeclarationSourceEnd();
type.bodyEnd = type.declarationSourceEnd;
+ /* convert type parameters */
+ char[][] typeParameterNames = sourceType.getTypeParameterNames();
+ if (typeParameterNames != null) {
+ int parameterCount = typeParameterNames.length;
+ char[][][] typeParameterBounds = sourceType.getTypeParameterBounds();
+ type.typeParameters = new TypeParameter[parameterCount];
+ for (int i = 0; i < parameterCount; i++) {
+ type.typeParameters[i] = createTypeParameter(typeParameterNames[i], typeParameterBounds[i], start, end);
+ }
+ }
/* set superclass and superinterfaces */
if (sourceType.getSuperclassName() != null)
type.superclass =
@@ -339,53 +373,205 @@ public class SourceTypeConverter implements CompilerModifiers {
modifiers);
}
+ private TypeParameter createTypeParameter(char[] typeParameterName, char[][] typeParameterBounds, int start, int end) {
+
+ TypeParameter parameter = new TypeParameter();
+ parameter.name = typeParameterName;
+ parameter.sourceStart = start;
+ parameter.sourceEnd = end;
+ if (typeParameterBounds != null) {
+ int length = typeParameterBounds.length;
+ parameter.bounds = new TypeReference[length];
+ for (int i = 0; i < length; i++) {
+ parameter.bounds[i] = createTypeReference(typeParameterBounds[i], start, end);
+ }
+ }
+ return parameter;
+ }
+
/*
* Build a type reference from a readable name, e.g. java.lang.Object[][]
*/
private TypeReference createTypeReference(
- char[] typeSignature,
+ char[] typeName,
int start,
int end) {
- /* count identifiers and dimensions */
- int max = typeSignature.length;
- int dimStart = max;
- int dim = 0;
+ int length = typeName.length;
+ this.namePos = 0;
+ TypeReference type = decodeType(typeName, length, start, end);
+ return type;
+ }
+ private TypeReference decodeType(char[] typeName, int length, int start, int end) {
int identCount = 1;
- for (int i = 0; i < max; i++) {
- switch (typeSignature[i]) {
+ int dim = 0;
+ int nameFragmentStart = this.namePos, nameFragmentEnd = -1;
+ ArrayList fragments = null;
+ typeLoop: while (this.namePos < length) {
+ char currentChar = typeName[this.namePos];
+ switch (currentChar) {
+ case '?' :
+ this.namePos++; // skip '?'
+ while (typeName[this.namePos] == ' ') this.namePos++;
+ switch(typeName[this.namePos]) {
+ case 's' :
+ checkSuper: {
+ int max = TypeConstants.WILDCARD_SUPER.length-1;
+ for (int ahead = 1; ahead < max; ahead++) {
+ if (typeName[this.namePos+ahead] != TypeConstants.WILDCARD_SUPER[ahead+1]) {
+ break checkSuper;
+ }
+ }
+ this.namePos += max;
+ Wildcard result = new Wildcard(Wildcard.SUPER);
+ result.bound = decodeType(typeName, length, start, end);
+ result.sourceStart = start;
+ result.sourceEnd = end;
+ return result;
+ }
+ break;
+ case 'e' :
+ checkExtends: {
+ int max = TypeConstants.WILDCARD_EXTENDS.length-1;
+ for (int ahead = 1; ahead < max; ahead++) {
+ if (typeName[this.namePos+ahead] != TypeConstants.WILDCARD_EXTENDS[ahead+1]) {
+ break checkExtends;
+ }
+ }
+ this.namePos += max;
+ Wildcard result = new Wildcard(Wildcard.EXTENDS);
+ result.bound = decodeType(typeName, length, start, end);
+ result.sourceStart = start;
+ result.sourceEnd = end;
+ return result;
+ }
+ break;
+ }
+ Wildcard result = new Wildcard(Wildcard.UNBOUND);
+ result.sourceStart = start;
+ result.sourceEnd = end;
+ return result;
case '[' :
- if (dim == 0)
- dimStart = i;
+ if (dim == 0) nameFragmentEnd = this.namePos-1;
dim++;
break;
+ case ']' :
+ break;
+ case '>' :
+ case ',' :
+ break typeLoop;
case '.' :
- identCount++;
+ if (nameFragmentStart < 0) nameFragmentStart = this.namePos+1; // member type name
+ identCount ++;
break;
+ case '<' :
+ if (fragments == null) fragments = new ArrayList(2);
+ nameFragmentEnd = this.namePos-1;
+ char[][] identifiers = CharOperation.splitOn('.', typeName, nameFragmentStart, this.namePos);
+ fragments.add(identifiers);
+ this.namePos++; // skip '<'
+ TypeReference[] arguments = decodeTypeArguments(typeName, length, start, end); // positionned on '>' at end
+ fragments.add(arguments);
+ identCount = 0;
+ nameFragmentStart = -1;
+ nameFragmentEnd = -1;
+ // next increment will skip '>'
}
+ this.namePos++;
}
- /* rebuild identifiers and dimensions */
- if (identCount == 1) { // simple type reference
- if (dim == 0) {
- return new SingleTypeReference(typeSignature, (((long) start )<< 32) + end);
- } else {
- char[] identifier = new char[dimStart];
- System.arraycopy(typeSignature, 0, identifier, 0, dimStart);
- return new ArrayTypeReference(identifier, dim, (((long) start) << 32) + end);
+ if (nameFragmentEnd < 0) nameFragmentEnd = this.namePos-1;
+ if (fragments == null) { // non parameterized
+ /* rebuild identifiers and dimensions */
+ if (identCount == 1) { // simple type reference
+ if (dim == 0) {
+ char[] nameFragment;
+ if (nameFragmentStart != 0 || nameFragmentEnd >= 0) {
+ int nameFragmentLength = nameFragmentEnd - nameFragmentStart + 1;
+ System.arraycopy(typeName, nameFragmentStart, nameFragment = new char[nameFragmentLength], 0, nameFragmentLength);
+ } else {
+ nameFragment = typeName;
+ }
+ return new SingleTypeReference(nameFragment, (((long) start )<< 32) + end);
+ } else {
+ int nameFragmentLength = nameFragmentEnd - nameFragmentStart + 1;
+ char[] nameFragment = new char[nameFragmentLength];
+ System.arraycopy(typeName, nameFragmentStart, nameFragment, 0, nameFragmentLength);
+ return new ArrayTypeReference(nameFragment, dim, (((long) start) << 32) + end);
+ }
+ } else { // qualified type reference
+ long[] positions = new long[identCount];
+ long pos = (((long) start) << 32) + end;
+ for (int i = 0; i < identCount; i++) {
+ positions[i] = pos;
+ }
+ char[][] identifiers = CharOperation.splitOn('.', typeName, nameFragmentStart, nameFragmentEnd+1);
+ if (dim == 0) {
+ return new QualifiedTypeReference(identifiers, positions);
+ } else {
+ return new ArrayQualifiedTypeReference(identifiers, dim, positions);
+ }
+ }
+ } else { // parameterized
+ // rebuild type reference from available fragments: char[][], arguments, char[][], arguments...
+ // check trailing qualified name
+ if (nameFragmentStart > 0 && nameFragmentStart < length) {
+ char[][] identifiers = CharOperation.splitOn('.', typeName, nameFragmentStart, nameFragmentEnd+1);
+ fragments.add(identifiers);
+ }
+ int fragmentLength = fragments.size();
+ if (fragmentLength == 2) {
+ char[][] firstFragment = (char[][]) fragments.get(0);
+ if (firstFragment.length == 1) {
+ // parameterized single type
+ return new ParameterizedSingleTypeReference(firstFragment[0], (TypeReference[]) fragments.get(1), dim, (((long) start) << 32) + end);
+ }
+ }
+ // parameterized qualified type
+ identCount = 0;
+ for (int i = 0; i < fragmentLength; i ++) {
+ Object element = fragments.get(i);
+ if (element instanceof char[][]) {
+ identCount += ((char[][])element).length;
+ }
+ }
+ char[][] tokens = new char[identCount][];
+ TypeReference[][] arguments = new TypeReference[identCount][];
+ int index = 0;
+ for (int i = 0; i < fragmentLength; i ++) {
+ Object element = fragments.get(i);
+ if (element instanceof char[][]) {
+ char[][] fragmentTokens = (char[][]) element;
+ int fragmentTokenLength = fragmentTokens.length;
+ System.arraycopy(fragmentTokens, 0, tokens, index, fragmentTokenLength);
+ index += fragmentTokenLength;
+ } else {
+ arguments[index-1] = (TypeReference[]) element;
+ }
}
- } else { // qualified type reference
long[] positions = new long[identCount];
long pos = (((long) start) << 32) + end;
for (int i = 0; i < identCount; i++) {
positions[i] = pos;
}
- char[][] identifiers =
- CharOperation.splitOn('.', typeSignature, 0, dimStart);
- if (dim == 0) {
- return new QualifiedTypeReference(identifiers, positions);
- } else {
- return new ArrayQualifiedTypeReference(identifiers, dim, positions);
+ return new ParameterizedQualifiedTypeReference(tokens, arguments, dim, positions);
+ }
+ }
+
+ private TypeReference[] decodeTypeArguments(char[] typeName, int length, int start, int end) {
+ ArrayList argumentList = new ArrayList(1);
+ int count = 0;
+ argumentsLoop: while (this.namePos < length) {
+ TypeReference argument = decodeType(typeName, length, start, end);
+ count++;
+ argumentList.add(argument);
+ if (this.namePos >= length) break argumentsLoop;
+ if (typeName[this.namePos] == '>') {
+ break argumentsLoop;
}
+ this.namePos++; // skip ','
}
+ TypeReference[] typeArguments = new TypeReference[count];
+ argumentList.toArray(typeArguments);
+ return typeArguments;
}
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java
index 1c16666e9f..7ff39d39c9 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java
@@ -15,6 +15,7 @@ import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.SourceElementRequestorAdapter;
import org.eclipse.jdt.internal.compiler.env.IBinaryMethod;
import org.eclipse.jdt.internal.core.util.Util;
@@ -37,7 +38,9 @@ import org.eclipse.jdt.internal.core.util.Util;
int nameSourceEnd,
char[][] paramTypes,
char[][] paramNames,
- char[][] exceptions) {
+ char[][] exceptions,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
if (paramNames != null) {
int length = paramNames.length;
this.parametersNames = new String[length];
@@ -55,7 +58,9 @@ import org.eclipse.jdt.internal.core.util.Util;
int nameSourceEnd,
char[][] paramTypes,
char[][] paramNames,
- char[][] exceptions) {
+ char[][] exceptions,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
if (paramNames != null) {
int length = paramNames.length;
this.parametersNames = new String[length];
@@ -106,20 +111,27 @@ public boolean equals(Object o) {
public String[] getExceptionTypes() throws JavaModelException {
if (this.exceptionTypes == null) {
IBinaryMethod info = (IBinaryMethod) getElementInfo();
- char[][] eTypeNames = info.getExceptionTypeNames();
- if (eTypeNames == null || eTypeNames.length == 0) {
- this.exceptionTypes = NO_TYPES;
- } else {
- eTypeNames = ClassFile.translatedNames(eTypeNames);
- this.exceptionTypes = new String[eTypeNames.length];
- for (int j = 0, length = eTypeNames.length; j < length; j++) {
- // 1G01HRY: ITPJCORE:WINNT - method.getExceptionType not in correct format
- int nameLength = eTypeNames[j].length;
- char[] convertedName = new char[nameLength + 2];
- System.arraycopy(eTypeNames[j], 0, convertedName, 1, nameLength);
- convertedName[0] = 'L';
- convertedName[nameLength + 1] = ';';
- this.exceptionTypes[j] = new String(convertedName);
+ char[] genericSignature = info.getGenericSignature();
+ if (genericSignature != null) {
+ char[] dotBasedSignature = CharOperation.replaceOnCopy(genericSignature, '/', '.');
+ this.exceptionTypes = Signature.getThrownExceptionTypes(new String(dotBasedSignature));
+ }
+ if (this.exceptionTypes == null || this.exceptionTypes.length == 0) {
+ char[][] eTypeNames = info.getExceptionTypeNames();
+ if (eTypeNames == null || eTypeNames.length == 0) {
+ this.exceptionTypes = NO_TYPES;
+ } else {
+ eTypeNames = ClassFile.translatedNames(eTypeNames);
+ this.exceptionTypes = new String[eTypeNames.length];
+ for (int j = 0, length = eTypeNames.length; j < length; j++) {
+ // 1G01HRY: ITPJCORE:WINNT - method.getExceptionType not in correct format
+ int nameLength = eTypeNames[j].length;
+ char[] convertedName = new char[nameLength + 2];
+ System.arraycopy(eTypeNames[j], 0, convertedName, 1, nameLength);
+ convertedName[0] = 'L';
+ convertedName[nameLength + 1] = ';';
+ this.exceptionTypes[j] = new String(convertedName);
+ }
}
}
}
@@ -222,8 +234,20 @@ public String[] getParameterTypes() {
* @since 3.0
*/
public String[] getTypeParameterSignatures() throws JavaModelException {
- // TODO (jerome) - missing implementation
- return new String[0];
+ IBinaryMethod info = (IBinaryMethod) getElementInfo();
+ char[] genericSignature = info.getGenericSignature();
+ if (genericSignature == null)
+ return EmptyStringList;
+ char[] dotBasedSignature = CharOperation.replaceOnCopy(genericSignature, '/', '.');
+ char[][] typeParams = Signature.getTypeParameters(dotBasedSignature);
+ int length = typeParams.length;
+ if (length == 0)
+ return EmptyStringList;
+ String[] stringSignatures = new String[length];
+ for (int i = 0; i < length; i++) {
+ stringSignatures[i] = new String(typeParams[i]);
+ }
+ return stringSignatures;
}
/*
@@ -232,7 +256,10 @@ public String[] getTypeParameterSignatures() throws JavaModelException {
public String getReturnType() throws JavaModelException {
IBinaryMethod info = (IBinaryMethod) getElementInfo();
if (this.returnType == null) {
- String returnTypeName= Signature.getReturnType(new String(info.getMethodDescriptor()));
+ char[] genericSignature = info.getGenericSignature();
+ char[] signature = genericSignature == null ? info.getMethodDescriptor() : genericSignature;
+ char[] dotBasedSignature = CharOperation.replaceOnCopy(signature, '/', '.');
+ String returnTypeName= Signature.getReturnType(new String(dotBasedSignature));
this.returnType= new String(ClassFile.translatedName(returnTypeName.toCharArray()));
}
return this.returnType;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryType.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryType.java
index 6ec52aad40..aa945d50be 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryType.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryType.java
@@ -448,13 +448,27 @@ public String[] getSuperInterfaceTypeSignatures() throws JavaModelException {
return strings;
}
+
/**
* @see IType#getTypeParameterSignatures()
* @since 3.0
*/
public String[] getTypeParameterSignatures() throws JavaModelException {
- // TODO (jerome) - missing implementation
- return new String[0];
+ IBinaryType info = (IBinaryType) getElementInfo();
+ char[] genericSignature = info.getGenericSignature();
+ if (genericSignature == null)
+ return EmptyStringList;
+
+ char[] dotBaseSignature = CharOperation.replaceOnCopy(genericSignature, '/', '.');
+ char[][] typeParams = Signature.getTypeParameters(dotBaseSignature);
+ int length = typeParams.length;
+ if (length == 0)
+ return EmptyStringList;
+ String[] stringSignatures = new String[length];
+ for (int i = 0; i < length; i++) {
+ stringSignatures[i] = new String(typeParams[i]);
+ }
+ return stringSignatures;
}
/*
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java
index 33458c5736..ddb7a8b5e3 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java
@@ -103,7 +103,16 @@ private void generateMethodInfos(IType type, IBinaryType typeInfo, HashMap newEl
// TODO (jerome) filter out synthetic members
// indexer should not index them as well
// if ((methodInfo.getModifiers() & IConstants.AccSynthetic) != 0) continue; // skip synthetic
- String[] pNames= Signature.getParameterTypes(new String(methodInfo.getMethodDescriptor()));
+ char[] signature = methodInfo.getGenericSignature();
+ if (signature == null) signature = methodInfo.getMethodDescriptor();
+ String[] pNames = null;
+ try {
+ pNames = Signature.getParameterTypes(new String(signature));
+ } catch (IllegalArgumentException e) {
+ // protect against malformed .class file (e.g. com/sun/crypto/provider/SunJCE_b.class has a 'a' generic signature)
+ signature = methodInfo.getMethodDescriptor();
+ pNames = Signature.getParameterTypes(new String(signature));
+ }
char[][] paramNames= new char[pNames.length][];
for (int j= 0; j < pNames.length; j++) {
paramNames[j]= pNames[j].toCharArray();
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
index 41ef429613..686dfedacd 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
@@ -345,8 +345,14 @@ public class ClasspathEntry implements IClasspathEntry {
String projSegment = path.segment(0);
if (projSegment != null && projSegment.equals(project.getElementName())) { // this project
return JavaCore.newSourceEntry(path, inclusionPatterns, exclusionPatterns, outputLocation);
- } else { // another project
- return JavaCore.newProjectEntry(path, isExported);
+ } else {
+ if (path.segmentCount() == 1) {
+ // another project
+ return JavaCore.newProjectEntry(path, isExported);
+ } else {
+ // an invalid source folder
+ return JavaCore.newSourceEntry(path, inclusionPatterns, exclusionPatterns, outputLocation);
+ }
}
case IClasspathEntry.CPE_VARIABLE :
@@ -997,7 +1003,7 @@ public class ClasspathEntry implements IClasspathEntry {
// Build some common strings for status message
String projectName = project.getElementName();
boolean pathStartsWithProject = path.segment(0).toString().equals(projectName);
- String entryPathMsg = pathStartsWithProject ? path.removeFirstSegments(1).toString() : path.makeRelative().toString();
+ String entryPathMsg = pathStartsWithProject ? path.removeFirstSegments(1).makeRelative().toString() : path.toString();
switch(entry.getEntryKind()){
@@ -1057,7 +1063,7 @@ public class ClasspathEntry implements IClasspathEntry {
}
return validateClasspathEntry(project, entry, checkSourceAttachment, recurseInContainers);
} else {
- return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.illegalVariablePath", path.makeRelative().toString(), projectName)); //$NON-NLS-1$
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.illegalVariablePath", entryPathMsg, projectName)); //$NON-NLS-1$
}
// library entry check
@@ -1081,7 +1087,7 @@ public class ClasspathEntry implements IClasspathEntry {
&& sourceAttachment != null
&& !sourceAttachment.isEmpty()
&& JavaModel.getTarget(workspaceRoot, sourceAttachment, true) == null){
- return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundSourceAttachment", new String [] {sourceAttachment.makeRelative().toString(), path.makeRelative().toString(), projectName})); //$NON-NLS-1$
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundSourceAttachment", new String [] {sourceAttachment.toString(), path.toString(), projectName})); //$NON-NLS-1$
}
} else {
return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.illegalLibraryArchive", entryPathMsg, projectName)); //$NON-NLS-1$
@@ -1092,7 +1098,7 @@ public class ClasspathEntry implements IClasspathEntry {
&& sourceAttachment != null
&& !sourceAttachment.isEmpty()
&& JavaModel.getTarget(workspaceRoot, sourceAttachment, true) == null){
- return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundSourceAttachment", new String [] {sourceAttachment.makeRelative().toString(), path.makeRelative().toString(), projectName})); //$NON-NLS-1$
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundSourceAttachment", new String [] {sourceAttachment.toString(), path.toString(), projectName})); //$NON-NLS-1$
}
}
} else if (target instanceof File){
@@ -1105,13 +1111,18 @@ public class ClasspathEntry implements IClasspathEntry {
&& sourceAttachment != null
&& !sourceAttachment.isEmpty()
&& JavaModel.getTarget(workspaceRoot, sourceAttachment, true) == null){
- return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundSourceAttachment", new String [] {sourceAttachment.toString(), path.makeRelative().toString(), projectName})); //$NON-NLS-1$
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundSourceAttachment", new String [] {sourceAttachment.toString(), path.toOSString(), projectName})); //$NON-NLS-1$
}
} else {
- return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundLibrary", path.makeRelative().toString(), projectName)); //$NON-NLS-1$
+ boolean isExternal = path.getDevice() != null || !workspaceRoot.getProject(path.segment(0)).exists();
+ if (isExternal) {
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundLibrary", path.toOSString(), projectName)); //$NON-NLS-1$
+ } else {
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundLibrary", entryPathMsg, projectName)); //$NON-NLS-1$
+ }
}
} else {
- return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.illegalLibraryPath", path.makeRelative().toString(), projectName)); //$NON-NLS-1$
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.illegalLibraryPath", entryPathMsg, projectName)); //$NON-NLS-1$
}
break;
@@ -1122,10 +1133,10 @@ public class ClasspathEntry implements IClasspathEntry {
IJavaProject prereqProject = JavaCore.create(prereqProjectRsc);
try {
if (!prereqProjectRsc.exists() || !prereqProjectRsc.hasNature(JavaCore.NATURE_ID)){
- return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundProject", path.makeRelative().segment(0).toString(), projectName)); //$NON-NLS-1$
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundProject", path.segment(0), projectName)); //$NON-NLS-1$
}
if (!prereqProjectRsc.isOpen()){
- return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.closedProject", path.segment(0).toString())); //$NON-NLS-1$
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.closedProject", path.segment(0))); //$NON-NLS-1$
}
if (project.getOption(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, true) != JavaCore.IGNORE) {
long projectTargetJDK = CompilerOptions.versionToJdkLevel(project.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true));
@@ -1135,10 +1146,10 @@ public class ClasspathEntry implements IClasspathEntry {
}
}
} catch (CoreException e){
- return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundProject", path.segment(0).toString(), projectName)); //$NON-NLS-1$
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.unboundProject", path.segment(0), projectName)); //$NON-NLS-1$
}
} else {
- return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.illegalProjectPath", path.segment(0).toString(), projectName)); //$NON-NLS-1$
+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Util.bind("classpath.illegalProjectPath", path.segment(0), projectName)); //$NON-NLS-1$
}
break;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java
index 1e13c5e10d..7978e29eb4 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java
@@ -1086,9 +1086,8 @@ public org.eclipse.jdt.core.dom.CompilationUnit reconcile(
// client asking for level 2 AST; these are supported
createAST = true;
} else if (astLevel == AST.JLS3) {
- // client asking for level 3 ASTs; these are not supported
- // TODO (jerome) - these should also be supported in 1.5 stream
- createAST = false;
+ // client asking for level 3 ASTs; these are supported
+ createAST = true;
} else {
// client asking for no AST (0) or unknown ast level
// either way, request denied
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java
index a61d3873ee..8d25a89218 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java
@@ -226,9 +226,11 @@ public void enterClass(
int nameSourceStart,
int nameSourceEnd,
char[] superclass,
- char[][] superinterfaces) {
+ char[][] superinterfaces,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
- enterType(declarationStart, modifiers, name, nameSourceStart, nameSourceEnd, superclass, superinterfaces);
+ enterType(declarationStart, modifiers, name, nameSourceStart, nameSourceEnd, superclass, superinterfaces, typeParameterNames, typeParameterBounds);
}
/**
@@ -251,10 +253,12 @@ public void enterConstructor(
int nameSourceEnd,
char[][] parameterTypes,
char[][] parameterNames,
- char[][] exceptionTypes) {
+ char[][] exceptionTypes,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
enterMethod(declarationStart, modifiers, null, name, nameSourceStart,
- nameSourceEnd, parameterTypes, parameterNames, exceptionTypes, true);
+ nameSourceEnd, parameterTypes, parameterNames, exceptionTypes, true, typeParameterNames, typeParameterBounds);
}
/**
* @see ISourceElementRequestor
@@ -330,9 +334,11 @@ public void enterInterface(
char[] name,
int nameSourceStart,
int nameSourceEnd,
- char[][] superinterfaces) {
+ char[][] superinterfaces,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
- enterType(declarationStart, modifiers, name, nameSourceStart, nameSourceEnd, null, superinterfaces);
+ enterType(declarationStart, modifiers, name, nameSourceStart, nameSourceEnd, null, superinterfaces, typeParameterNames, typeParameterBounds);
}
/**
@@ -347,10 +353,12 @@ public void enterMethod(
int nameSourceEnd,
char[][] parameterTypes,
char[][] parameterNames,
- char[][] exceptionTypes) {
+ char[][] exceptionTypes,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
enterMethod(declarationStart, modifiers, returnType, name, nameSourceStart,
- nameSourceEnd, parameterTypes, parameterNames, exceptionTypes, false);
+ nameSourceEnd, parameterTypes, parameterNames, exceptionTypes, false, typeParameterNames, typeParameterBounds);
}
/**
* @see ISourceElementRequestor
@@ -365,7 +373,9 @@ protected void enterMethod(
char[][] parameterTypes,
char[][] parameterNames,
char[][] exceptionTypes,
- boolean isConstructor) {
+ boolean isConstructor,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
SourceTypeElementInfo parentInfo = (SourceTypeElementInfo) this.infoStack.peek();
JavaElement parentHandle= (JavaElement) this.handleStack.peek();
@@ -403,7 +413,9 @@ protected void enterMethod(
info.setArgumentTypeNames(parameterTypes);
info.setReturnType(returnType == null ? new char[]{'v', 'o','i', 'd'} : returnType);
info.setExceptionTypeNames(exceptionTypes);
-
+ info.setTypeParameterNames(typeParameterNames);
+ info.setTypeParameterBounds(typeParameterBounds);
+
parentInfo.addChild(handle);
this.newElements.put(handle, info);
this.infoStack.push(info);
@@ -419,7 +431,9 @@ protected void enterType(
int nameSourceStart,
int nameSourceEnd,
char[] superclass,
- char[][] superinterfaces) {
+ char[][] superinterfaces,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
JavaElementInfo parentInfo = (JavaElementInfo) this.infoStack.peek();
JavaElement parentHandle= (JavaElement) this.handleStack.peek();
@@ -454,6 +468,8 @@ protected void enterType(
info.setSuperInterfaceNames(superinterfaces);
info.setSourceFileName(this.sourceFileName);
info.setPackageName(this.packageName);
+ info.setTypeParameterNames(typeParameterNames);
+ info.setTypeParameterBounds(typeParameterBounds);
parentInfo.addChild(handle);
this.newElements.put(handle, info);
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompletionRequestorWrapper.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompletionRequestorWrapper.java
index c58726ec4c..496ee7fca9 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompletionRequestorWrapper.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompletionRequestorWrapper.java
@@ -230,8 +230,9 @@ public void acceptMethodDeclaration(char[] declaringTypePackageName, char[] decl
completion.append(CharOperation.subarray(completionName, start, completionName.length));
}
}
-
- completionName = completion.toString().toCharArray();
+ int nameLength = completion.length();
+ completionName = new char[nameLength];
+ completion.getChars(0, nameLength, completionName, 0);
}
if(CompletionEngine.DEBUG) {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java
index 6d228584c8..fd2c0b2375 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java
@@ -31,7 +31,6 @@ import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Preferences;
import org.eclipse.jdt.core.*;
import org.eclipse.jdt.core.ElementChangedEvent;
import org.eclipse.jdt.core.IClasspathEntry;
@@ -921,6 +920,8 @@ public class DeltaProcessor {
}
this.removeFromParentInfo(javaProject);
+ // remove preferences from per project info
+ this.manager.resetProjectPreferences(javaProject);
} catch (JavaModelException e) {
// java project doesn't exist: ignore
}
@@ -1731,65 +1732,7 @@ public class DeltaProcessor {
}
}
}
- /*
- * Update the JavaModel according to a .jprefs file change. The file can have changed as a result of a previous
- * call to JavaProject#setOptions or as a result of some user update (through repository)
- * Unused until preference file get shared (.jpref)
- */
- void reconcilePreferenceFileUpdate(IResourceDelta delta, IFile file, JavaProject project) {
-
- switch (delta.getKind()) {
- case IResourceDelta.REMOVED : // flush project custom settings
- project.setOptions(null);
- return;
- case IResourceDelta.CHANGED :
- if ((delta.getFlags() & IResourceDelta.CONTENT) == 0 // only consider content change
- && (delta.getFlags() & IResourceDelta.MOVED_FROM) == 0) // and also move and overide scenario
- break;
- identityCheck : { // check if any actual difference
- // force to (re)read the property file
- Preferences filePreferences = project.loadPreferences();
- if (filePreferences == null){
- project.setOptions(null); // should have got removed delta.
- return;
- }
- Preferences projectPreferences = project.getPreferences();
- if (projectPreferences == null) return; // not a Java project
-
- // compare preferences set to their default
- String[] defaultProjectPropertyNames = projectPreferences.defaultPropertyNames();
- String[] defaultFilePropertyNames = filePreferences.defaultPropertyNames();
- if (defaultProjectPropertyNames.length == defaultFilePropertyNames.length) {
- for (int i = 0; i < defaultProjectPropertyNames.length; i++){
- String propertyName = defaultProjectPropertyNames[i];
- if (!projectPreferences.getString(propertyName).trim().equals(filePreferences.getString(propertyName).trim())){
- break identityCheck;
- }
- }
- } else break identityCheck;
- // compare custom preferences not set to their default
- String[] projectPropertyNames = projectPreferences.propertyNames();
- String[] filePropertyNames = filePreferences.propertyNames();
- if (projectPropertyNames.length == filePropertyNames.length) {
- for (int i = 0; i < projectPropertyNames.length; i++){
- String propertyName = projectPropertyNames[i];
- if (!projectPreferences.getString(propertyName).trim().equals(filePreferences.getString(propertyName).trim())){
- break identityCheck;
- }
- }
- } else break identityCheck;
-
- // identical - do nothing
- return;
- }
- case IResourceDelta.ADDED :
- // not identical, create delta and reset cached preferences
- project.setPreferences(null);
- // create delta
- //fCurrentDelta.changed(project, IJavaElementDelta.F_OPTIONS_CHANGED);
- }
- }
/*
* Traverse the set of projects which have changed namespace, and reset their
* caches and their dependents
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementDeltaBuilder.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementDeltaBuilder.java
index f2a9e325e9..0f9d68c22d 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementDeltaBuilder.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementDeltaBuilder.java
@@ -216,9 +216,10 @@ private void findContentChange(JavaElementInfo oldInfo, JavaElementInfo newInfo,
if (((MemberElementInfo)oldInfo).getModifiers() != ((MemberElementInfo)newInfo).getModifiers()) {
this.delta.changed(newElement, IJavaElementDelta.F_MODIFIERS);
} else if (oldInfo instanceof SourceMethodElementInfo && newInfo instanceof SourceMethodElementInfo) {
- if (!CharOperation.equals(
- ((SourceMethodElementInfo)oldInfo).getReturnTypeName(),
- ((SourceMethodElementInfo)newInfo).getReturnTypeName())) {
+ SourceMethodElementInfo oldSourceMethodInfo = (SourceMethodElementInfo)oldInfo;
+ SourceMethodElementInfo newSourceMethodInfo = (SourceMethodElementInfo)newInfo;
+ if (!CharOperation.equals(oldSourceMethodInfo.getReturnTypeName(), newSourceMethodInfo.getReturnTypeName())
+ || !CharOperation.equals(oldSourceMethodInfo.getTypeParameterSignatures(), newSourceMethodInfo.getTypeParameterSignatures())) {
this.delta.changed(newElement, IJavaElementDelta.F_CONTENT);
}
} else if (oldInfo instanceof SourceFieldElementInfo && newInfo instanceof SourceFieldElementInfo) {
@@ -233,9 +234,12 @@ private void findContentChange(JavaElementInfo oldInfo, JavaElementInfo newInfo,
SourceTypeElementInfo oldSourceTypeInfo = (SourceTypeElementInfo)oldInfo;
SourceTypeElementInfo newSourceTypeInfo = (SourceTypeElementInfo)newInfo;
if (!CharOperation.equals(oldSourceTypeInfo.getSuperclassName(), newSourceTypeInfo.getSuperclassName())
- || !CharOperation.equals(oldSourceTypeInfo.getInterfaceNames(), newSourceTypeInfo.getInterfaceNames())) {
+ || !CharOperation.equals(oldSourceTypeInfo.getInterfaceNames(), newSourceTypeInfo.getInterfaceNames())) {
this.delta.changed(newElement, IJavaElementDelta.F_SUPER_TYPES);
}
+ if (!CharOperation.equals(oldSourceTypeInfo.getTypeParameterSignatures(), newSourceTypeInfo.getTypeParameterSignatures())) {
+ this.delta.changed(newElement, IJavaElementDelta.F_CONTENT);
+ }
}
}
/**
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
index 5b7f53f2e9..f933f986f7 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
@@ -21,6 +21,7 @@ import javax.xml.parsers.ParserConfigurationException;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jdt.core.*;
import org.eclipse.jdt.core.compiler.IProblem;
import org.eclipse.jdt.core.search.SearchEngine;
@@ -33,6 +34,7 @@ import org.eclipse.jdt.internal.core.search.AbstractSearchScope;
import org.eclipse.jdt.internal.core.search.indexing.IndexManager;
import org.eclipse.jdt.internal.core.search.processing.JobManager;
import org.eclipse.jdt.internal.core.util.Util;
+import org.osgi.service.prefs.BackingStoreException;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -536,7 +538,7 @@ public class JavaModelManager implements ISaveParticipant {
public IClasspathEntry[] resolvedClasspath;
public Map resolvedPathToRawEntries; // reverse map from resolved path to raw entries
public IPath outputLocation;
- public Preferences preferences;
+ public IEclipsePreferences preferences;
public PerProjectInfo(IProject project) {
@@ -616,7 +618,7 @@ public class JavaModelManager implements ISaveParticipant {
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append("Info for "); //$NON-NLS-1$
- buffer.append(((JavaElement)workingCopy).toStringWithAncestors());
+ buffer.append(((JavaElement)this.workingCopy).toStringWithAncestors());
buffer.append("\nUse count = "); //$NON-NLS-1$
buffer.append(this.useCount);
buffer.append("\nProblem requestor:\n "); //$NON-NLS-1$
@@ -639,13 +641,12 @@ public class JavaModelManager implements ISaveParticipant {
/**
* Update the classpath variable cache
*/
- public static class PluginPreferencesListener implements Preferences.IPropertyChangeListener {
+ public static class EclipsePreferencesListener implements IEclipsePreferences.IPreferenceChangeListener {
/**
- * @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(Preferences.PropertyChangeEvent)
+ * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent)
*/
- public void propertyChange(Preferences.PropertyChangeEvent event) {
-
- String propertyName = event.getProperty();
+ public void preferenceChange(IEclipsePreferences.PreferenceChangeEvent event) {
+ String propertyName = event.getKey();
if (propertyName.startsWith(CP_VARIABLE_PREFERENCES_PREFIX)) {
String varName = propertyName.substring(CP_VARIABLE_PREFERENCES_PREFIX.length());
String newValue = (String)event.getNewValue();
@@ -759,7 +760,7 @@ public class JavaModelManager implements ISaveParticipant {
deltaBuilder = new JavaElementDeltaBuilder(workingCopy);
}
PerWorkingCopyInfo info = null;
- synchronized(perWorkingCopyInfos) {
+ synchronized(this.perWorkingCopyInfos) {
WorkingCopyOwner owner = workingCopy.owner;
Map workingCopyToInfos = (Map)this.perWorkingCopyInfos.get(owner);
if (workingCopyToInfos == null) return -1;
@@ -870,7 +871,7 @@ public class JavaModelManager implements ISaveParticipant {
* Returns the handle to the active Java Model.
*/
public final JavaModel getJavaModel() {
- return javaModel;
+ return this.javaModel;
}
/**
@@ -906,11 +907,11 @@ public class JavaModelManager implements ISaveParticipant {
* Returns the per-project info for the given project. If specified, create the info if the info doesn't exist.
*/
public PerProjectInfo getPerProjectInfo(IProject project, boolean create) {
- synchronized(perProjectInfos) { // use the perProjectInfo collection as its own lock
- PerProjectInfo info= (PerProjectInfo) perProjectInfos.get(project);
+ synchronized(this.perProjectInfos) { // use the perProjectInfo collection as its own lock
+ PerProjectInfo info= (PerProjectInfo) this.perProjectInfos.get(project);
if (info == null && create) {
info= new PerProjectInfo(project);
- perProjectInfos.put(project, info);
+ this.perProjectInfos.put(project, info);
}
return info;
}
@@ -939,7 +940,7 @@ public class JavaModelManager implements ISaveParticipant {
* Returns null if it doesn't exist and not create.
*/
public PerWorkingCopyInfo getPerWorkingCopyInfo(CompilationUnit workingCopy,boolean create, boolean recordUsage, IProblemRequestor problemRequestor) {
- synchronized(perWorkingCopyInfos) { // use the perWorkingCopyInfo collection as its own lock
+ synchronized(this.perWorkingCopyInfos) { // use the perWorkingCopyInfo collection as its own lock
WorkingCopyOwner owner = workingCopy.owner;
Map workingCopyToInfos = (Map)this.perWorkingCopyInfos.get(owner);
if (workingCopyToInfos == null && create) {
@@ -1089,11 +1090,11 @@ public class JavaModelManager implements ISaveParticipant {
* Returns null if it has none.
*/
public ICompilationUnit[] getWorkingCopies(WorkingCopyOwner owner, boolean addPrimary) {
- synchronized(perWorkingCopyInfos) {
+ synchronized(this.perWorkingCopyInfos) {
ICompilationUnit[] primaryWCs = addPrimary && owner != DefaultWorkingCopyOwner.PRIMARY
? getWorkingCopies(DefaultWorkingCopyOwner.PRIMARY, false)
: null;
- Map workingCopyToInfos = (Map)perWorkingCopyInfos.get(owner);
+ Map workingCopyToInfos = (Map)this.perWorkingCopyInfos.get(owner);
if (workingCopyToInfos == null) return primaryWCs;
int primaryLength = primaryWCs == null ? 0 : primaryWCs.length;
int size = workingCopyToInfos.size(); // note size is > 0 otherwise pathToPerWorkingCopyInfos would be null
@@ -1402,23 +1403,31 @@ public class JavaModelManager implements ISaveParticipant {
}
// load variables and containers from preferences into cache
- Preferences preferences = JavaCore.getPlugin().getPluginPreferences();
+ IEclipsePreferences preferences = JavaCore.getInstancePreferences();
// only get variable from preferences not set to their default
- String[] propertyNames = preferences.propertyNames();
- int variablePrefixLength = CP_VARIABLE_PREFERENCES_PREFIX.length();
- for (int i = 0; i < propertyNames.length; i++){
- String propertyName = propertyNames[i];
- if (propertyName.startsWith(CP_VARIABLE_PREFERENCES_PREFIX)){
- String varName = propertyName.substring(variablePrefixLength);
- IPath varPath = new Path(preferences.getString(propertyName).trim());
-
- this.variables.put(varName, varPath);
- this.previousSessionVariables.put(varName, varPath);
- }
- if (propertyName.startsWith(CP_CONTAINER_PREFERENCES_PREFIX)){
- recreatePersistedContainer(propertyName, preferences.getString(propertyName), true/*add to container values*/);
+ try {
+ String[] propertyNames = preferences.keys();
+ int variablePrefixLength = CP_VARIABLE_PREFERENCES_PREFIX.length();
+ for (int i = 0; i < propertyNames.length; i++){
+ String propertyName = propertyNames[i];
+ if (propertyName.startsWith(CP_VARIABLE_PREFERENCES_PREFIX)){
+ String varName = propertyName.substring(variablePrefixLength);
+ String propertyValue = preferences.get(propertyName, null);
+ if (propertyValue != null) {
+ IPath varPath = new Path(propertyValue.trim());
+ this.variables.put(varName, varPath);
+ this.previousSessionVariables.put(varName, varPath);
+ }
+ }
+ if (propertyName.startsWith(CP_CONTAINER_PREFERENCES_PREFIX)){
+ String propertyValue = preferences.get(propertyName, null);
+ if (propertyValue != null)
+ recreatePersistedContainer(propertyName, propertyValue, true/*add to container values*/);
+ }
}
+ } catch (BackingStoreException e1) {
+ // TODO (frederic) see if it's necessary to report this failure...
}
// override persisted values for variables which have a registered initializer
String[] registeredVariables = getRegisteredVariableNames();
@@ -1603,11 +1612,24 @@ public class JavaModelManager implements ISaveParticipant {
}
public void removePerProjectInfo(JavaProject javaProject) {
- synchronized(perProjectInfos) { // use the perProjectInfo collection as its own lock
+ synchronized(this.perProjectInfos) { // use the perProjectInfo collection as its own lock
+ IProject project = javaProject.getProject();
+ PerProjectInfo info= (PerProjectInfo) this.perProjectInfos.get(project);
+ if (info != null) {
+ this.perProjectInfos.remove(project);
+ }
+ }
+ }
+
+ /*
+ * Reset project preferences stored in info cache.
+ */
+ public void resetProjectPreferences(JavaProject javaProject) {
+ synchronized(this.perProjectInfos) { // use the perProjectInfo collection as its own lock
IProject project = javaProject.getProject();
- PerProjectInfo info= (PerProjectInfo) perProjectInfos.get(project);
+ PerProjectInfo info= (PerProjectInfo) this.perProjectInfos.get(project);
if (info != null) {
- perProjectInfos.remove(project);
+ info.preferences = null;
}
}
}
@@ -1689,7 +1711,6 @@ public class JavaModelManager implements ISaveParticipant {
public void saving(ISaveContext context) throws CoreException {
// save container values on snapshot/full save
- Preferences preferences = JavaCore.getPlugin().getPluginPreferences();
IJavaProject[] projects = getJavaModel().getJavaProjects();
for (int i = 0, length = projects.length; i < length; i++) {
IJavaProject project = projects[i];
@@ -1708,11 +1729,17 @@ public class JavaModelManager implements ISaveParticipant {
} catch(JavaModelException e){
// could not encode entry: leave it as CP_ENTRY_IGNORE
}
- preferences.setDefault(containerKey, CP_ENTRY_IGNORE); // use this default to get rid of removed ones
- preferences.setValue(containerKey, containerString);
+ JavaCore.getDefaultPreferences().put(containerKey, CP_ENTRY_IGNORE); // TODO (frederic) verify if this is really necessary...
+ JavaCore.getInstancePreferences().put(containerKey, containerString);
}
}
- JavaCore.getPlugin().savePluginPreferences();
+ try {
+ JavaCore.getInstancePreferences().flush();
+ } catch (BackingStoreException e) {
+ // TODO (frederic) see if it's necessary to report this exception
+ // IStatus status = new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, IStatus.ERROR, "Problems while saving context", e); //$NON-NLS-1$
+ // throw new CoreException(status);
+ }
if (context.getKind() == ISaveContext.FULL_SAVE) {
// will need delta since this save (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=38658)
@@ -1735,7 +1762,7 @@ public class JavaModelManager implements ISaveParticipant {
}
ArrayList vStats= null; // lazy initialized
- for (Iterator iter = perProjectInfos.values().iterator(); iter.hasNext();) {
+ for (Iterator iter = this.perProjectInfos.values().iterator(); iter.hasNext();) {
try {
PerProjectInfo info = (PerProjectInfo) iter.next();
saveState(info, context);
@@ -2044,11 +2071,16 @@ public class JavaModelManager implements ISaveParticipant {
this.previousSessionVariables.remove(variableName);
}
- Preferences preferences = JavaCore.getPlugin().getPluginPreferences();
String variableKey = CP_VARIABLE_PREFERENCES_PREFIX+variableName;
String variableString = variablePath == null ? CP_ENTRY_IGNORE : variablePath.toString();
- preferences.setDefault(variableKey, CP_ENTRY_IGNORE); // use this default to get rid of removed ones
- preferences.setValue(variableKey, variableString);
- JavaCore.getPlugin().savePluginPreferences();
+ JavaCore.getDefaultPreferences().put(variableKey, CP_ENTRY_IGNORE); // TODO (frederic) verify if this is really necessary...
+ JavaCore.getInstancePreferences().put(variableKey, variableString);
+ try {
+ JavaCore.getInstancePreferences().flush();
+ } catch (BackingStoreException e) {
+ // TODO (frederic) see if it's necessary to report this exception
+// IStatus status = new Status(IStatus.ERROR, Platform.PI_RUNTIME, IStatus.ERROR, "Problems while saving context", e); //$NON-NLS-1$
+// throw new CoreException(status);
+ }
}
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
index 8cd77f4e66..5d8fa0ca40 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
@@ -11,15 +11,12 @@
package org.eclipse.jdt.internal.core;
import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.StringReader;
import java.util.ArrayList;
@@ -28,11 +25,9 @@ import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
-
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -43,13 +38,18 @@ import org.eclipse.core.resources.IProjectNature;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IPreferencesService;
+import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -74,6 +74,7 @@ import org.eclipse.jdt.internal.core.eval.EvaluationContextWrapper;
import org.eclipse.jdt.internal.core.util.MementoTokenizer;
import org.eclipse.jdt.internal.core.util.Util;
import org.eclipse.jdt.internal.eval.EvaluationContext;
+import org.osgi.service.prefs.BackingStoreException;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -124,6 +125,10 @@ public class JavaProject
/**
* Name of file containing custom project preferences
+ * @deprecated WARNING Visibility will be reduce to private before M9
+ * If you use this variable, change your implementation to avoid future comilation error...
+ * @see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=59258">bug 59258</a>
+ * TODO (frederic) set visibility from public to private
*/
public static final String PREF_FILENAME = ".jprefs"; //$NON-NLS-1$
@@ -131,8 +136,6 @@ public class JavaProject
* Value of the project's raw classpath if the .classpath file contains invalid entries.
*/
public static final IClasspathEntry[] INVALID_CLASSPATH = new IClasspathEntry[0];
-
- private static final String CUSTOM_DEFAULT_OPTION_VALUE = "#\r\n\r#custom-non-empty-default-value#\r\n\r#"; //$NON-NLS-1$
/*
* Value of project's resolved classpath while it is being resolved
@@ -1407,11 +1410,11 @@ public class JavaProject
String propertyName = optionName;
if (JavaModelManager.getJavaModelManager().optionNames.contains(propertyName)){
- Preferences preferences = getPreferences();
- if (preferences == null || preferences.isDefault(propertyName)) {
- return inheritJavaCoreOptions ? JavaCore.getOption(propertyName) : null;
- }
- return preferences.getString(propertyName).trim();
+ IEclipsePreferences preferences = getEclipsePreferences();
+ String javaCoreDefault = inheritJavaCoreOptions ? JavaCore.getOption(propertyName) : null;
+ if (preferences == null) return javaCoreDefault;
+ String value = preferences.get(propertyName, javaCoreDefault);
+ return value == null ? null : value.trim();
}
return null;
}
@@ -1424,21 +1427,25 @@ public class JavaProject
// initialize to the defaults from JavaCore options pool
Map options = inheritJavaCoreOptions ? JavaCore.getOptions() : new Hashtable(5);
- Preferences preferences = getPreferences();
+ IEclipsePreferences preferences = getEclipsePreferences();
if (preferences == null) return options; // cannot do better (non-Java project)
HashSet optionNames = JavaModelManager.getJavaModelManager().optionNames;
// project cannot hold custom preferences set to their default, as it uses CUSTOM_DEFAULT_OPTION_VALUE
// get custom preferences not set to their default
- String[] propertyNames = preferences.propertyNames();
- for (int i = 0; i < propertyNames.length; i++){
- String propertyName = propertyNames[i];
- String value = preferences.getString(propertyName).trim();
- if (optionNames.contains(propertyName)){
- options.put(propertyName, value);
- }
- }
+ try {
+ String[] propertyNames = preferences.keys();
+ for (int i = 0; i < propertyNames.length; i++){
+ String propertyName = propertyNames[i];
+ String value = preferences.get(propertyName, null);
+ if (value != null && optionNames.contains(propertyName)){
+ options.put(propertyName, value.trim());
+ }
+ }
+ } catch (BackingStoreException e) {
+ // nothing to do
+ }
return options;
}
@@ -1647,7 +1654,7 @@ public class JavaProject
public JavaModelManager.PerProjectInfo getPerProjectInfo() throws JavaModelException {
return JavaModelManager.getJavaModelManager().getPerProjectInfoCheckExistence(this.project);
}
-
+
/**
* @see IJavaProject#getProject()
*/
@@ -1658,9 +1665,32 @@ public class JavaProject
/**
* Returns the project custom preference pool.
* Project preferences may include custom encoding.
- * @return Preferences
+ * @return IEclipsePreferences
*/
+ public IEclipsePreferences getEclipsePreferences(){
+ if (!JavaProject.hasJavaNature(this.project)) return null;
+ JavaModelManager.PerProjectInfo perProjectInfo = JavaModelManager.getJavaModelManager().getPerProjectInfo(this.project, true);
+ IEclipsePreferences eclipsePreferences = perProjectInfo.preferences;
+ if (eclipsePreferences != null) return eclipsePreferences;
+ IScopeContext context = new ProjectScope(getProject());
+ eclipsePreferences = context.getNode(JavaCore.PLUGIN_ID);
+ updatePreferences(eclipsePreferences);
+ perProjectInfo.preferences = eclipsePreferences;
+ return eclipsePreferences;
+ }
+
+ /**
+ * Returns the project custom preference pool.
+ * Project preferences may include custom encoding.
+ * @return Preferences
+ * @deprecated WARNING: this method do nothing from now and will be removed soon!
+ * If you use it, switch as soon as possible to new preferences API by using
+ * {@link #getEclipsePreferences()} to avoid future compilation error...
+ * @see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=59258">bug 59258</a>
+ * TODO (frederic) remove for 3.1...
+ */
public Preferences getPreferences(){
+ /*
if (!JavaProject.hasJavaNature(this.project)) return null;
JavaModelManager.PerProjectInfo perProjectInfo = JavaModelManager.getJavaModelManager().getPerProjectInfo(this.project, true);
Preferences preferences = perProjectInfo.preferences;
@@ -1669,6 +1699,8 @@ public class JavaProject
if (preferences == null) preferences = new Preferences();
perProjectInfo.preferences = preferences;
return preferences;
+ */
+ return new Preferences();
}
/**
@@ -2150,14 +2182,42 @@ public class JavaProject
}
/*
+ * Update eclipse preferences from old preferences.
+ */
+ private void updatePreferences(IEclipsePreferences preferences) {
+
+ Preferences oldPreferences = loadPreferences();
+ IPreferencesService service = Platform.getPreferencesService();
+ if (oldPreferences != null) {
+ String[] propertyNames = oldPreferences.propertyNames();
+ for (int i = 0; i < propertyNames.length; i++){
+ String propertyName = propertyNames[i];
+ String propertyValue = oldPreferences.getString(propertyName);
+ String defaultValue = service.get(propertyName, null, JavaCore.preferencesLookup);
+ if (!"".equals(propertyValue) && (defaultValue == null || !propertyValue.equals(defaultValue))) { //$NON-NLS-1$
+ preferences.put(propertyName, propertyValue);
+ }
+ }
+ try {
+ // save immediately old preferences
+ preferences.flush();
+ } catch (BackingStoreException e) {
+ // fails silently
+ }
+ }
+ }
+
+ /**
* load preferences from a shareable format (VCM-wise)
+ * @deprecated WARNING, visibility of this method will be decreased soon
+ * to private and won't be usable in the future.
+ * @see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=59258">bug 59258</a>
+ * TODO (frederic) set visibility from public to private
*/
public Preferences loadPreferences() {
Preferences preferences = new Preferences();
-
-// File prefFile = this.project.getLocation().append(PREF_FILENAME).toFile();
- IPath projectMetaLocation = getPluginWorkingLocation();
+ IPath projectMetaLocation = getPluginWorkingLocation();
if (projectMetaLocation != null) {
File prefFile = projectMetaLocation.append(PREF_FILENAME).toFile();
if (prefFile.exists()) { // load preferences from file
@@ -2165,7 +2225,6 @@ public class JavaProject
try {
in = new BufferedInputStream(new FileInputStream(prefFile));
preferences.load(in);
- return preferences;
} catch (IOException e) { // problems loading preference store - quietly ignore
} finally {
if (in != null) {
@@ -2175,11 +2234,14 @@ public class JavaProject
}
}
}
+ // one shot read, delete old preferences
+ prefFile.delete();
+ return preferences;
}
}
return null;
}
-
+
/**
* @see IJavaProject#newEvaluationContext()
*/
@@ -2448,49 +2510,6 @@ public class JavaProject
throw new JavaModelException(e);
}
}
- /**
- * Save project custom preferences to shareable file (.jprefs)
- */
- private void savePreferences(Preferences preferences) {
-
- if (!JavaProject.hasJavaNature(this.project)) return; // ignore
-
- if (preferences == null || (!preferences.needsSaving() && preferences.propertyNames().length != 0)) {
- // nothing to save
- return;
- }
-
- // preferences need to be saved
- // the preferences file is located in the plug-in's state area
- // at a well-known name (.jprefs)
-// File prefFile = this.project.getLocation().append(PREF_FILENAME).toFile();
- File prefFile = getPluginWorkingLocation().append(PREF_FILENAME).toFile();
- if (preferences.propertyNames().length == 0) {
- // there are no preference settings
- // rather than write an empty file, just delete any existing file
- if (prefFile.exists()) {
- prefFile.delete(); // don't worry if delete unsuccessful
- }
- return;
- }
-
- // write file, overwriting an existing one
- OutputStream out = null;
- try {
- // do it as carefully as we know how so that we don't lose/mangle
- // the setting in times of stress
- out = new BufferedOutputStream(new FileOutputStream(prefFile));
- preferences.store(out, null);
- } catch (IOException e) { // problems saving preference store - quietly ignore
- } finally {
- if (out != null) {
- try {
- out.close();
- } catch (IOException e) { // ignore problems with close
- }
- }
- }
- }
/**
* Update the Java command in the build spec (replace existing one if present,
@@ -2525,10 +2544,16 @@ public class JavaProject
*/
public void setOption(String optionName, String optionValue) {
if (!JavaModelManager.getJavaModelManager().optionNames.contains(optionName)) return; // unrecognized option
- Preferences preferences = getPreferences();
- preferences.setDefault(optionName, CUSTOM_DEFAULT_OPTION_VALUE); // empty string isn't the default (26251)
- preferences.setValue(optionName, optionValue);
- savePreferences(preferences);
+ IEclipsePreferences projectPreferences = getEclipsePreferences();
+ String defaultValue = JavaCore.getOption(optionName);
+ if (defaultValue == null || !defaultValue.equals(optionValue)) {
+ projectPreferences.put(optionName, optionValue);
+ try {
+ projectPreferences.flush();
+ } catch (BackingStoreException e) {
+ // problem with pref store - quietly ignore
+ }
+ }
}
/**
@@ -2536,33 +2561,42 @@ public class JavaProject
*/
public void setOptions(Map newOptions) {
- Preferences preferences = getPreferences();
- if (newOptions != null){
- Iterator keys = newOptions.keySet().iterator();
- while (keys.hasNext()){
- String key = (String)keys.next();
- if (!JavaModelManager.getJavaModelManager().optionNames.contains(key)) continue; // unrecognized option
- // no filtering for encoding (custom encoding for project is allowed)
- String value = (String)newOptions.get(key);
- preferences.setDefault(key, CUSTOM_DEFAULT_OPTION_VALUE); // empty string isn't the default (26251)
- preferences.setValue(key, value);
+ IEclipsePreferences projectPreferences = getEclipsePreferences();
+ try {
+ if (newOptions == null){
+ projectPreferences.clear();
+ } else {
+ Iterator keys = newOptions.keySet().iterator();
+ while (keys.hasNext()){
+ String key = (String)keys.next();
+ if (!JavaModelManager.getJavaModelManager().optionNames.contains(key)) continue; // unrecognized option
+ // no filtering for encoding (custom encoding for project is allowed)
+ String value = (String)newOptions.get(key);
+ projectPreferences.put(key, value);
+ }
+
+ // reset to default all options not in new map
+ // @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=26255
+ // @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=49691
+ String[] pNames = projectPreferences.keys();
+ int ln = pNames.length;
+ for (int i=0; i<ln; i++) {
+ String key = pNames[i];
+ if (!newOptions.containsKey(key)) {
+ projectPreferences.remove(key); // old preferences => remove from preferences table
+ }
+ }
}
- }
-
- // reset to default all options not in new map
- // @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=26255
- // @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=49691
- String[] pNames = preferences.propertyNames();
- int ln = pNames.length;
- for (int i=0; i<ln; i++) {
- String key = pNames[i];
- if (newOptions == null || !newOptions.containsKey(key)) {
- preferences.setToDefault(key); // set default => remove from preferences table
+
+ // persist options
+ projectPreferences.flush();
+ if (newOptions == null) {
+ // Uncache preferences
+ JavaModelManager.getJavaModelManager().resetProjectPreferences(this);
}
+ } catch (BackingStoreException e) {
+ // problem with pref store - quietly ignore
}
-
- // persist options
- savePreferences(preferences);
}
/**
@@ -2580,15 +2614,6 @@ public class JavaProject
this.setRawClasspath(SetClasspathOperation.ReuseClasspath, path, monitor);
}
- /*
- * Set cached preferences, no preference file is saved, only info is updated
- */
- public void setPreferences(Preferences preferences) {
- if (!JavaProject.hasJavaNature(this.project)) return; // ignore
- JavaModelManager.PerProjectInfo perProjectInfo = JavaModelManager.getJavaModelManager().getPerProjectInfo(this.project, true);
- perProjectInfo.preferences = preferences;
- }
-
/**
* Sets the underlying kernel project of this Java project,
* and fills in its parent and name.
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/Member.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/Member.java
index 388336f28d..3e482eabce 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/Member.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/Member.java
@@ -32,6 +32,11 @@ import org.eclipse.jdt.internal.core.util.MementoTokenizer;
*/
public abstract class Member extends SourceRefElement implements IMember {
+ /**
+ * An empty list of Strings
+ */
+ protected static final String[] EmptyStringList = new String[0];
+
protected Member(JavaElement parent, String name) {
super(parent, name);
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java
index 93a3d5f810..70d045cd1b 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java
@@ -410,6 +410,35 @@ protected void acceptType(char[] packageName, char[] typeName, int acceptFlags,
}
}
}
+public void acceptTypeParameter(char[] declaringTypePackageName, char[] declaringTypeName, char[] typeParameterName, boolean isDeclaration, int start, int end) {
+ // TODO missing implementation
+
+ if(SelectionEngine.DEBUG){
+ System.out.print("SELECTION - acceptTypeParameter("); //$NON-NLS-1$
+ System.out.print(declaringTypePackageName);
+ System.out.print('.');
+ System.out.print(declaringTypeName);
+ System.out.print('<');
+ System.out.print(typeParameterName);
+ System.out.println(">)"); //$NON-NLS-1$
+ }
+}
+public void acceptMethodTypeParameter(char[] declaringTypePackageName, char[] declaringTypeName, char[] selector, char[][] parameterPackageNames, char[][] parameterTypeNames, boolean isConstructor, char[] typeParameterName, boolean isDeclaration, int start, int end) {
+ // TODO missing implementation
+
+ if(SelectionEngine.DEBUG){
+ System.out.print("SELECTION - acceptTypeParameter("); //$NON-NLS-1$
+ System.out.print(declaringTypePackageName);
+ System.out.print('.');
+ System.out.print(declaringTypeName);
+ System.out.print('.');
+ System.out.print('<');
+ System.out.print(typeParameterName);
+ System.out.print('>');
+ System.out.print(selector);
+ System.out.println("(...))"); //$NON-NLS-1$
+ }
+}
/*
* Adds the given element to the list of resolved elements.
*/
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SortElementBuilder.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SortElementBuilder.java
index ae7c5cc42e..132f7ffcf6 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SortElementBuilder.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SortElementBuilder.java
@@ -1008,7 +1008,9 @@ public class SortElementBuilder extends SourceElementRequestorAdapter {
int nameSourceStart,
int nameSourceEnd,
char[] superclass,
- char[][] superinterfaces) {
+ char[][] superinterfaces,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
SortType type = new SortClassDeclaration(declarationStart, modifiers, name, superclass, superinterfaces);
this.currentElement.addChild(type);
push(type);
@@ -1033,7 +1035,9 @@ public class SortElementBuilder extends SourceElementRequestorAdapter {
int nameSourceEnd,
char[][] parameterTypes,
char[][] parameterNames,
- char[][] exceptionTypes) {
+ char[][] exceptionTypes,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
if ((this.currentElement.id & SortJavaElement.TYPE) != 0) {
SortConstructorDeclaration constructorDeclaration = new SortConstructorDeclaration(declarationStart, modifiers, name, parameterNames, parameterTypes, exceptionTypes);
this.currentElement.addChild(constructorDeclaration);
@@ -1092,7 +1096,9 @@ public class SortElementBuilder extends SourceElementRequestorAdapter {
char[] name,
int nameSourceStart,
int nameSourceEnd,
- char[][] superinterfaces) {
+ char[][] superinterfaces,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
SortType type = new SortInterfaceDeclaration(declarationStart, modifiers, name, superinterfaces);
this.currentElement.addChild(type);
push(type);
@@ -1110,7 +1116,9 @@ public class SortElementBuilder extends SourceElementRequestorAdapter {
int nameSourceEnd,
char[][] parameterTypes,
char[][] parameterNames,
- char[][] exceptionTypes) {
+ char[][] exceptionTypes,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
if ((this.currentElement.id & SortJavaElement.TYPE) != 0) {
SortMethodDeclaration methodDeclaration = new SortMethodDeclaration(declarationStart, modifiers, name, parameterNames, parameterTypes, exceptionTypes, returnType);
this.currentElement.addChild(methodDeclaration);
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java
index d969ade44d..08c9c36ecc 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java
@@ -504,7 +504,9 @@ public class SourceMapper
int nameSourceStart,
int nameSourceEnd,
char[] superclass,
- char[][] superinterfaces) {
+ char[][] superinterfaces,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
this.typeDepth++;
if (this.typeDepth == this.types.length) { // need to grow
@@ -590,7 +592,9 @@ public class SourceMapper
int nameSourceEnd,
char[][] parameterTypes,
char[][] parameterNames,
- char[][] exceptionTypes) {
+ char[][] exceptionTypes,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
enterMethod(
declarationStart,
modifiers,
@@ -600,7 +604,9 @@ public class SourceMapper
nameSourceEnd,
parameterTypes,
parameterNames,
- exceptionTypes);
+ exceptionTypes,
+ typeParameterNames,
+ typeParameterBounds);
}
/**
@@ -639,7 +645,9 @@ public class SourceMapper
char[] name,
int nameSourceStart,
int nameSourceEnd,
- char[][] superinterfaces) {
+ char[][] superinterfaces,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
enterClass(
declarationStart,
modifiers,
@@ -647,7 +655,9 @@ public class SourceMapper
nameSourceStart,
nameSourceEnd,
null,
- superinterfaces);
+ superinterfaces,
+ typeParameterNames,
+ typeParameterBounds);
}
/**
@@ -662,7 +672,9 @@ public class SourceMapper
int nameSourceEnd,
char[][] parameterTypes,
char[][] parameterNames,
- char[][] exceptionTypes) {
+ char[][] exceptionTypes,
+ char[][] typeParameterNames,
+ char[][][] typeParameterBounds) {
if (typeDepth >= 0) {
fMemberName[typeDepth] = new String(name);
fMemberNameRange[typeDepth] =
@@ -1029,16 +1041,36 @@ public class SourceMapper
unqualifiedName.append(Signature.C_ARRAY);
++count;
}
- if (qualifiedName.charAt(count) == Signature.C_RESOLVED) {
+ char currentChar = qualifiedName.charAt(count);
+ if (currentChar == Signature.C_RESOLVED || currentChar == Signature.C_TYPE_VARIABLE) {
unqualifiedName.append(Signature.C_UNRESOLVED);
String simpleName = Signature.getSimpleName(qualifiedName.substring(count+1));
- if(!noDollar) {
- if(!hasDollar && simpleName.indexOf('$') != -1) {
- hasDollar = true;
+ int lastDollar = simpleName.lastIndexOf('$');
+ hasDollar |= lastDollar != -1;
+ int start = noDollar ? lastDollar + 1 : 0;
+ boolean sigStart = false;
+ for (int j = start, length = simpleName.length(); j < length; j++) {
+ char current = simpleName.charAt(j);
+ switch (current) {
+ case Signature.C_SUPER:
+ case Signature.C_EXTENDS:
+ case Signature.C_GENERIC_START:
+ case Signature.C_NAME_END:
+ unqualifiedName.append(current);
+ sigStart = true;
+ break;
+ default:
+ if (sigStart) {
+ if (current == Signature.C_TYPE_VARIABLE) {
+ unqualifiedName.append(Signature.C_UNRESOLVED);
+ } else {
+ unqualifiedName.append(current);
+ }
+ sigStart = false;
+ } else {
+ unqualifiedName.append(current);
+ }
}
- unqualifiedName.append(simpleName);
- } else {
- unqualifiedName.append(CharOperation.lastSegment(simpleName.toCharArray(), '$'));
}
} else {
unqualifiedName.append(qualifiedName.substring(count, qualifiedName.length()));
@@ -1235,4 +1267,5 @@ public class SourceMapper
}
return false;
}
+
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethod.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethod.java
index 811d3c406a..f9f7aa87ab 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethod.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethod.java
@@ -144,8 +144,16 @@ public String[] getParameterTypes() {
* @since 3.0
*/
public String[] getTypeParameterSignatures() throws JavaModelException {
- // TODO (jerome) - missing implementation
- return new String[0];
+ SourceMethodElementInfo info = (SourceMethodElementInfo) getElementInfo();
+ char[][] signatures = info.getTypeParameterSignatures();
+ if (signatures == null)
+ return EmptyStringList;
+ int length = signatures.length;
+ String[] stringSignatures = new String[length];
+ for (int i = 0; i < length; i++) {
+ stringSignatures[i] = new String(signatures[i]);
+ }
+ return stringSignatures;
}
/*
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethodElementInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethodElementInfo.java
index f2fdf3f758..96c1ab0c8e 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethodElementInfo.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethodElementInfo.java
@@ -11,6 +11,7 @@
package org.eclipse.jdt.internal.core;
import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.env.ISourceMethod;
/**
@@ -53,6 +54,14 @@ public class SourceMethodElementInfo extends MemberElementInfo implements ISourc
protected char[][] exceptionTypes;
/**
+ * Signatures of type parameters (for generic types)
+ *
+ */
+ protected char[][] typeParameterNames;
+ protected char[][][] typeParameterBounds;
+ protected char[][] typeParameterSignatures;
+
+ /**
* Constructor flag.
*/
protected boolean isConstructor= false;
@@ -79,6 +88,34 @@ protected String getSignature() {
}
return Signature.createMethodSignature(paramSignatures, Signature.createTypeSignature(this.returnType, false));
}
+public char[][] getTypeParameterNames() {
+ return this.typeParameterNames;
+}
+public char[][][] getTypeParameterBounds() {
+ return this.typeParameterBounds;
+}
+public char[][] getTypeParameterSignatures() {
+ if (this.typeParameterSignatures == null) {
+ if (this.typeParameterNames != null) {
+ int length = this.typeParameterNames.length;
+ this.typeParameterSignatures = new char[length][];
+ for (int i = 0; i < length; i++) {
+ char[][] bounds = this.typeParameterBounds[i];
+ if (bounds == null) {
+ this.typeParameterSignatures[i] = Signature.createTypeParameterSignature(this.typeParameterNames[i], CharOperation.NO_CHAR_CHAR);
+ } else {
+ int boundsLength = bounds.length;
+ char[][] boundSignatures = new char[boundsLength][];
+ for (int j = 0; j < boundsLength; j++) {
+ boundSignatures[i] = Signature.createCharArrayTypeSignature(bounds[j], false);
+ }
+ this.typeParameterSignatures[i] = Signature.createTypeParameterSignature(this.typeParameterNames[i], boundSignatures);
+ }
+ }
+ }
+ }
+ return this.typeParameterSignatures;
+}
public boolean isConstructor() {
return this.isConstructor;
}
@@ -97,4 +134,17 @@ protected void setExceptionTypeNames(char[][] types) {
protected void setReturnType(char[] type) {
this.returnType = type;
}
+/**
+ * Sets the names of the type parameters this method declares
+ */
+protected void setTypeParameterNames(char[][] typeParameterNames) {
+ this.typeParameterNames = typeParameterNames;
+}
+/**
+ * Sets the names of the type parameter bounds this method declares
+ */
+protected void setTypeParameterBounds(char[][][] typeParameterBounds) {
+ this.typeParameterBounds = typeParameterBounds;
+}
+
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceType.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceType.java
index b5d443f02f..367595dfa6 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceType.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceType.java
@@ -37,10 +37,7 @@ import org.eclipse.jdt.internal.core.util.Util;
*/
public class SourceType extends Member implements IType {
- /**
- * An empty list of Strings
- */
- protected static final String[] fgEmptyList= new String[] {};
+
protected SourceType(JavaElement parent, String name) {
super(parent, name);
Assert.isTrue(name.indexOf('.') == -1, Util.bind("sourcetype.invalidName", name)); //$NON-NLS-1$
@@ -378,7 +375,7 @@ public String[] getSuperInterfaceNames() throws JavaModelException {
SourceTypeElementInfo info = (SourceTypeElementInfo) getElementInfo();
char[][] names= info.getInterfaceNames();
if (names == null) {
- return fgEmptyList;
+ return EmptyStringList;
}
String[] strings= new String[names.length];
for (int i= 0; i < names.length; i++) {
@@ -395,7 +392,7 @@ public String[] getSuperInterfaceTypeSignatures() throws JavaModelException {
SourceTypeElementInfo info = (SourceTypeElementInfo) getElementInfo();
char[][] names= info.getInterfaceNames();
if (names == null) {
- return fgEmptyList;
+ return EmptyStringList;
}
String[] strings= new String[names.length];
for (int i= 0; i < names.length; i++) {
@@ -409,8 +406,16 @@ public String[] getSuperInterfaceTypeSignatures() throws JavaModelException {
* @since 3.0
*/
public String[] getTypeParameterSignatures() throws JavaModelException {
- // TODO (jerome) - missing implementation
- return new String[0];
+ SourceTypeElementInfo info = (SourceTypeElementInfo) getElementInfo();
+ char[][] signatures = info.getTypeParameterSignatures();
+ if (signatures == null)
+ return EmptyStringList;
+ int length = signatures.length;
+ String[] stringSignatures = new String[length];
+ for (int i = 0; i < length; i++) {
+ stringSignatures[i] = new String(signatures[i]);
+ }
+ return stringSignatures;
}
/**
@@ -738,6 +743,12 @@ public String[][] resolveType(String typeName, WorkingCopyOwner owner) throws Ja
public void acceptPackage(char[] packageName){
// ignore
}
+ public void acceptTypeParameter(char[] declaringTypePackageName, char[] declaringTypeName, char[] typeParameterName, boolean isDeclaration, int start, int end) {
+ // ignore
+ }
+ public void acceptMethodTypeParameter(char[] declaringTypePackageName, char[] declaringTypeName, char[] selector, char[][] parameterPackageNames, char[][] parameterTypeNames, boolean isConstructor, char[] typeParameterName, boolean isDeclaration, int start, int end) {
+ // ignore
+ }
}
TypeResolveRequestor requestor = new TypeResolveRequestor();
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceTypeElementInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceTypeElementInfo.java
index 428f07f41f..d0b17e5773 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceTypeElementInfo.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceTypeElementInfo.java
@@ -14,6 +14,8 @@ import org.eclipse.jdt.core.IImportDeclaration;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.env.IConstants;
import org.eclipse.jdt.internal.compiler.env.ISourceField;
import org.eclipse.jdt.internal.compiler.env.ISourceImport;
@@ -66,6 +68,14 @@ public class SourceTypeElementInfo extends MemberElementInfo implements ISourceT
*/
protected IType handle = null;
+ /**
+ * Signatures of type parameters (for generic types)
+ *
+ */
+ protected char[][] typeParameterNames;
+ protected char[][][] typeParameterBounds;
+ protected char[][] typeParameterSignatures;
+
/**
* Returns the ISourceType that is the enclosing type for this
* type, or <code>null</code> if this type is a top level type.
@@ -237,6 +247,35 @@ public char[] getSuperclassName() {
}
return this.superclassName;
}
+public char[][] getTypeParameterNames() {
+ return this.typeParameterNames;
+}
+public char[][][] getTypeParameterBounds() {
+ return this.typeParameterBounds;
+}
+public char[][] getTypeParameterSignatures() {
+ if (this.typeParameterSignatures == null) {
+ if (this.typeParameterNames != null) {
+ int length = this.typeParameterNames.length;
+ this.typeParameterSignatures = new char[length][];
+ for (int i = 0; i < length; i++) {
+ char[][] bounds = this.typeParameterBounds[i];
+ if (bounds == null) {
+ this.typeParameterSignatures[i] = Signature.createTypeParameterSignature(this.typeParameterNames[i], CharOperation.NO_CHAR_CHAR);
+ } else {
+ int boundsLength = bounds.length;
+ char[][] boundSignatures = new char[boundsLength][];
+ for (int j = 0; j < boundsLength; j++) {
+ boundSignatures[i] = Signature.createCharArrayTypeSignature(bounds[j], false);
+ }
+ this.typeParameterSignatures[i] = Signature.createTypeParameterSignature(this.typeParameterNames[i], boundSignatures);
+ }
+ }
+ }
+ }
+ return this.typeParameterSignatures;
+}
+
/**
* @see ISourceType
*/
@@ -285,6 +324,18 @@ protected void setSuperclassName(char[] superclassName) {
protected void setSuperInterfaceNames(char[][] superInterfaceNames) {
this.superInterfaceNames = superInterfaceNames;
}
+/**
+ * Sets the names of the type parameters this type declares
+ */
+protected void setTypeParameterNames(char[][] typeParameterNames) {
+ this.typeParameterNames = typeParameterNames;
+}
+/**
+ * Sets the names of the type parameter bounds this type declares
+ */
+protected void setTypeParameterBounds(char[][][] typeParameterBounds) {
+ this.typeParameterBounds = typeParameterBounds;
+}
public String toString() {
return "Info for " + this.handle.toString(); //$NON-NLS-1$
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/TypeConverter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/TypeConverter.java
index b6b2344cc0..3597ab7541 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/TypeConverter.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/TypeConverter.java
@@ -105,7 +105,8 @@ public class TypeConverter {
argumentNames[i].toCharArray(),
0,
createTypeReference(Signature.toString(argumentTypeNames[i]).toCharArray(), type),
- CompilerModifiers.AccDefault);
+ CompilerModifiers.AccDefault,
+ false);
// do not care whether was final or not
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/UserLibraryManager.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/UserLibraryManager.java
index 6c22a3a20e..abe2f2265e 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/UserLibraryManager.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/UserLibraryManager.java
@@ -22,16 +22,15 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
-import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.core.util.Util;
+import org.osgi.service.prefs.BackingStoreException;
/**
*
@@ -43,10 +42,10 @@ public class UserLibraryManager {
private static Map userLibraries;
private static final boolean logProblems= false;
- private static IPropertyChangeListener listener= new IPropertyChangeListener() {
+ private static IEclipsePreferences.IPreferenceChangeListener listener= new IEclipsePreferences.IPreferenceChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- String key= event.getProperty();
+ public void preferenceChange(IEclipsePreferences.PreferenceChangeEvent event) {
+ String key= event.getKey();
if (key.startsWith(CP_USERLIBRARY_PREFERENCES_PREFIX)) {
try {
recreatePersistedUserLibraryEntry(key, (String) event.getNewValue(), false, true);
@@ -58,7 +57,6 @@ public class UserLibraryManager {
}
}
}
-
};
private UserLibraryManager() {
@@ -126,20 +124,26 @@ public class UserLibraryManager {
if (userLibraries == null) {
userLibraries= new HashMap();
// load variables and containers from preferences into cache
- Preferences preferences = JavaCore.getPlugin().getPluginPreferences();
- preferences.addPropertyChangeListener(listener);
+ IEclipsePreferences instancePreferences = JavaCore.getInstancePreferences();
+ instancePreferences.addPreferenceChangeListener(listener);
// only get variable from preferences not set to their default
- String[] propertyNames = preferences.propertyNames();
- for (int i = 0; i < propertyNames.length; i++) {
- String propertyName = propertyNames[i];
- if (propertyName.startsWith(CP_USERLIBRARY_PREFERENCES_PREFIX)) {
- try {
- recreatePersistedUserLibraryEntry(propertyName, preferences.getString(propertyName), false, false);
- } catch (JavaModelException e) {
- // won't happen: no rebinding
+ try {
+ String[] propertyNames = instancePreferences.keys();
+ for (int i = 0; i < propertyNames.length; i++) {
+ String propertyName = propertyNames[i];
+ if (propertyName.startsWith(CP_USERLIBRARY_PREFERENCES_PREFIX)) {
+ try {
+ String propertyValue = instancePreferences.get(propertyName, null);
+ if (propertyValue != null)
+ recreatePersistedUserLibraryEntry(propertyName,propertyValue, false, false);
+ } catch (JavaModelException e) {
+ // won't happen: no rebinding
+ }
}
}
+ } catch (BackingStoreException e) {
+ // TODO (frederic) see if it's necessary to report this exception
}
}
return userLibraries;
@@ -178,7 +182,7 @@ public class UserLibraryManager {
}
}
- Preferences preferences = JavaCore.getPlugin().getPluginPreferences();
+ IEclipsePreferences instancePreferences = JavaCore.getInstancePreferences();
String containerKey = CP_USERLIBRARY_PREFERENCES_PREFIX+name;
String containerString = CP_ENTRY_IGNORE;
if (library != null) {
@@ -188,19 +192,23 @@ public class UserLibraryManager {
// could not encode entry: leave it as CP_ENTRY_IGNORE
}
}
- preferences.removePropertyChangeListener(listener);
+ instancePreferences.removePreferenceChangeListener(listener);
try {
- preferences.setDefault(containerKey, CP_ENTRY_IGNORE); // use this default to get rid of removed ones
- preferences.setValue(containerKey, containerString);
+ JavaCore.getDefaultPreferences().put(containerKey, CP_ENTRY_IGNORE); // TODO (frederic) verify if this is really necessary...
+ instancePreferences.put(containerKey, containerString);
if (save) {
- JavaCore.getPlugin().savePluginPreferences();
+ try {
+ instancePreferences.flush();
+ } catch (BackingStoreException e) {
+ // TODO (frederic) see if it's necessary to report this exception
+ }
}
if (rebind) {
rebindClasspathEntries(name, library==null, monitor);
}
} finally {
- preferences.addPropertyChangeListener(listener);
+ instancePreferences.addPreferenceChangeListener(listener);
}
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java
index 1f085537a0..570c7d605f 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java
@@ -84,6 +84,11 @@ public void acceptResult(CompilationResult result) {
throw internalException(e);
}
+ if (result.hasInconsistentToplevelHierarchies)
+ // ensure that this file is always retrieved from source for the rest of the build
+ if (!problemSourceFiles.contains(compilationUnit))
+ problemSourceFiles.add(compilationUnit);
+
String typeLocator = compilationUnit.typeLocator();
ClassFile[] classFiles = result.getClassFiles();
int length = classFiles.length;
@@ -91,6 +96,7 @@ public void acceptResult(CompilationResult result) {
ArrayList definedTypeNames = new ArrayList(length);
for (int i = 0; i < length; i++) {
ClassFile classFile = classFiles[i];
+
char[][] compoundName = classFile.getCompoundName();
char[] typeName = compoundName[compoundName.length - 1];
boolean isNestedType = classFile.enclosingClassFile != null;
@@ -317,31 +323,10 @@ protected void storeProblemsFor(SourceFile sourceFile, IProblem[] problems) thro
for (int i = 0, l = problems.length; i < l; i++) {
IProblem problem = problems[i];
int id = problem.getID();
- switch (id) {
- case IProblem.IsClassPathCorrect :
- JavaBuilder.removeProblemsAndTasksFor(javaBuilder.currentProject); // make this the only problem for this project
- String[] args = problem.getArguments();
- missingClassFile = args[0];
- break;
- case IProblem.SuperclassMustBeAClass :
- case IProblem.SuperInterfaceMustBeAnInterface :
- case IProblem.HierarchyCircularitySelfReference :
- case IProblem.HierarchyCircularity :
- case IProblem.HierarchyHasProblems :
- case IProblem.SuperclassNotFound :
- case IProblem.SuperclassNotVisible :
- case IProblem.SuperclassAmbiguous :
- case IProblem.SuperclassInternalNameProvided :
- case IProblem.SuperclassInheritedNameHidesEnclosingName :
- case IProblem.InterfaceNotFound :
- case IProblem.InterfaceNotVisible :
- case IProblem.InterfaceAmbiguous :
- case IProblem.InterfaceInternalNameProvided :
- case IProblem.InterfaceInheritedNameHidesEnclosingName :
- // ensure that this file is always retrieved from source for the rest of the build
- if (!problemSourceFiles.contains(sourceFile))
- problemSourceFiles.add(sourceFile);
- break;
+ if (id == IProblem.IsClassPathCorrect) {
+ JavaBuilder.removeProblemsAndTasksFor(javaBuilder.currentProject); // make this the only problem for this project
+ String[] args = problem.getArguments();
+ missingClassFile = args[0];
}
if (id != IProblem.Task) {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java
index faede6176e..c8e6abed3a 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java
@@ -68,8 +68,7 @@ public static IMarker[] getTasksFor(IResource resource) {
* This hook is invoked during PRE_AUTO_BUILD notification
*/
public static void buildStarting() {
- // do nothing
- // TODO (philippe) is it still needed?
+ // build is about to start
}
/**
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBinaryType.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBinaryType.java
index 34f1d6eeed..fafa0ee7a5 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBinaryType.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBinaryType.java
@@ -68,6 +68,9 @@ public IBinaryField[] getFields() {
public char[] getFileName() {
return null;
}
+public char[] getGenericSignature() {
+ return null;
+}
/**
* Answer the resolved names of the receiver's interfaces in the
* class file format as specified in section 4.2 of the Java 2 VM spec
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java
index 33e7a622aa..c29c0e8d27 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java
@@ -33,6 +33,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.CompilationResult;
import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies;
@@ -213,6 +214,7 @@ public void accept(ISourceType[] sourceTypes, PackageBinding packageBinding) {
private IGenericType findSuperClass(IGenericType type, ReferenceBinding typeBinding) {
ReferenceBinding superBinding = typeBinding.superclass();
if (superBinding != null) {
+ superBinding = (ReferenceBinding) superBinding.erasure();
if (superBinding.id == TypeIds.T_JavaLangObject && typeBinding.isHierarchyInconsistent()) {
char[] superclassName;
char separator;
@@ -292,17 +294,21 @@ private IGenericType[] findSuperInterfaces(IGenericType type, ReferenceBinding t
next : for (int i = 0; i < length; i++) {
char[] superInterfaceName = superInterfaceNames[i];
int lastSeparator = CharOperation.lastIndexOf(separator, superInterfaceName);
- char[] simpleName = lastSeparator == -1 ? superInterfaceName : CharOperation.subarray(superInterfaceName, lastSeparator+1, superInterfaceName.length);
+ int start = lastSeparator + 1;
+ int end = superInterfaceName.length;
// case of binary inner type -> take the last part
- int start = CharOperation.lastIndexOf('$', simpleName) + 1;
- if (start != 0) {
- int nameLength = simpleName.length - start;
- System.arraycopy(simpleName, start, simpleName = new char[nameLength], 0, nameLength);
- }
+ int lastDollar = CharOperation.lastIndexOf('$', superInterfaceName, start);
+ if (lastDollar != -1) start = lastDollar + 1;
+
+ // case of a parameterized type -> take the first part
+ int genericStart = CharOperation.indexOf(Signature.C_GENERIC_START, superInterfaceName, start);
+ if (genericStart != -1) end = genericStart;
+
+ char[] simpleName = CharOperation.subarray(superInterfaceName, start, end);
if (bindingIndex < bindingLength) {
- ReferenceBinding interfaceBinding = interfaceBindings[bindingIndex];
+ ReferenceBinding interfaceBinding = (ReferenceBinding) interfaceBindings[bindingIndex].erasure();
// ensure that the binding corresponds to the interface defined by the user
if (CharOperation.equals(simpleName, interfaceBinding.sourceName)) {
@@ -769,12 +775,14 @@ private boolean subTypeOfType(ReferenceBinding subType, ReferenceBinding typeBin
if (typeBinding == null || subType == null) return false;
if (subType == typeBinding) return true;
ReferenceBinding superclass = subType.superclass();
+ if (superclass != null) superclass = (ReferenceBinding) superclass.erasure();
// if (superclass != null && superclass.id == TypeIds.T_JavaLangObject && subType.isHierarchyInconsistent()) return false;
if (this.subTypeOfType(superclass, typeBinding)) return true;
ReferenceBinding[] superInterfaces = subType.superInterfaces();
if (superInterfaces != null) {
for (int i = 0, length = superInterfaces.length; i < length; i++) {
- if (this.subTypeOfType(superInterfaces[i], typeBinding)) return true;
+ ReferenceBinding superInterface = (ReferenceBinding) superInterfaces[i].erasure();
+ if (this.subTypeOfType(superInterface, typeBinding)) return true;
}
}
return false;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMBuilder.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMBuilder.java
index fdc627eb77..d7896a11f9 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMBuilder.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMBuilder.java
@@ -63,14 +63,14 @@ public DOMBuilder() {
* @see IDocumentElementRequestor#acceptImport(int declarationStart, int declarationEnd, int[] javaDocPositions, char[] name, int nameStartPosition, boolean onDemand)
*/
public void acceptImport(int declarationStart, int declarationEnd, int[] javaDocPositions, char[] name,
- int nameStart, boolean onDemand) {
+ int nameStart, boolean onDemand, int modifiers) {
int[] sourceRange = {declarationStart, declarationEnd};
int[] nameRange = {nameStart, declarationEnd - 1};
/* See 1FVII1P */
String importName = new String(CharOperation.subarray(fDocument, nameRange[0], nameRange[1] + 1));
- fNode= new DOMImport(fDocument, sourceRange, importName, nameRange, onDemand);
+ fNode= new DOMImport(fDocument, sourceRange, importName, nameRange, onDemand, modifiers);
addChild(fNode);
if (fBuildingSingleMember) {
fFinishedSingleMember= true;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMImport.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMImport.java
index a3e76ef14d..8250fe05e1 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMImport.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMImport.java
@@ -28,6 +28,7 @@ import org.eclipse.jdt.internal.core.util.CharArrayBuffer;
*/
// TODO (jerome) - add implementation support for 1.5 features
class DOMImport extends DOMNode implements IDOMImport {
+
/**
* Indicates if this import is an on demand type import
*/
@@ -64,9 +65,10 @@ DOMImport() {
* or -1's if this node does not have a name.
* @param onDemand - indicates if this import is an on demand style import
*/
-DOMImport(char[] document, int[] sourceRange, String name, int[] nameRange, boolean onDemand) {
+DOMImport(char[] document, int[] sourceRange, String name, int[] nameRange, boolean onDemand, int modifiers) {
super(document, sourceRange, name, nameRange);
fOnDemand = onDemand;
+ fFlags = modifiers;
setMask(MASK_DETAILED_SOURCE_INDEXES, true);
}
/**
@@ -83,8 +85,8 @@ DOMImport(char[] document, int[] sourceRange, String name, int[] nameRange, bool
* <code>null</code> if this node does not have a name
* @param onDemand - indicates if this import is an on demand style import
*/
-DOMImport(char[] document, int[] sourceRange, String name, boolean onDemand) {
- this(document, sourceRange, name, new int[] {-1, -1}, onDemand);
+DOMImport(char[] document, int[] sourceRange, String name, boolean onDemand, int modifiers) {
+ this(document, sourceRange, name, new int[] {-1, -1}, onDemand, modifiers);
fOnDemand = onDemand;
setMask(MASK_DETAILED_SOURCE_INDEXES, false);
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java
index dd8a0dfd39..524d0c2fa6 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java
@@ -43,7 +43,7 @@ public void acceptImport(int declarationStart, int declarationEnd, char[] name,
if (onDemand) {
importName+=".*"; //$NON-NLS-1$
}
- fNode= new DOMImport(fDocument, sourceRange, importName, onDemand);
+ fNode= new DOMImport(fDocument, sourceRange, importName, onDemand, modifiers);
addChild(fNode);
}
public void acceptPackage(int declarationStart, int declarationEnd, char[] name) {
@@ -95,13 +95,13 @@ protected void enterAbstractMethod(int declarationStart, int modifiers,
}
/**
*/
-public void enterClass(int declarationStart, int modifiers, char[] name, int nameStart, int nameEnd, char[] superclass, char[][] superinterfaces) {
+public void enterClass(int declarationStart, int modifiers, char[] name, int nameStart, int nameEnd, char[] superclass, char[][] superinterfaces, char[][] typeParameterNames, char[][][] typeParameterBounds) {
enterType(declarationStart, modifiers, name, nameStart, nameEnd, superclass,
superinterfaces, true);
}
/**
*/
-public void enterConstructor(int declarationStart, int modifiers, char[] name, int nameStart, int nameEnd, char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes) {
+public void enterConstructor(int declarationStart, int modifiers, char[] name, int nameStart, int nameEnd, char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes, char[][] typeParameterNames, char[][][] typeParameterBounds) {
/* see 1FVIIQZ */
String nameString = new String(fDocument, nameStart, nameEnd - nameStart);
int openParenPosition = nameString.indexOf('(');
@@ -138,13 +138,13 @@ public void enterInitializer(int declarationSourceStart, int modifiers) {
}
/**
*/
-public void enterInterface(int declarationStart, int modifiers, char[] name, int nameStart, int nameEnd, char[][] superinterfaces) {
+public void enterInterface(int declarationStart, int modifiers, char[] name, int nameStart, int nameEnd, char[][] superinterfaces, char[][] typeParameterNames, char[][][] typeParameterBounds) {
enterType(declarationStart, modifiers, name, nameStart, nameEnd, null,
superinterfaces, false);
}
/**
*/
-public void enterMethod(int declarationStart, int modifiers, char[] returnType, char[] name, int nameStart, int nameEnd, char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes) {
+public void enterMethod(int declarationStart, int modifiers, char[] returnType, char[] name, int nameStart, int nameEnd, char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes, char[][] typeParameterNames, char[][][] typeParameterBounds) {
enterAbstractMethod(declarationStart, modifiers,
returnType, name, nameStart, nameEnd, parameterTypes,
parameterNames, exceptionTypes,false);
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Annotation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Annotation.java
new file mode 100644
index 0000000000..5878194f5a
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Annotation.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.util;
+
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.core.util.IAnnotation;
+import org.eclipse.jdt.core.util.IAnnotationComponent;
+import org.eclipse.jdt.core.util.IConstantPool;
+
+/**
+ * Default implementation of IAnnotation
+ */
+public class Annotation extends ClassFileStruct implements IAnnotation {
+
+ private static final IAnnotationComponent[] NO_ENTRIES = new IAnnotationComponent[0];
+
+ private int typeIndex;
+ private int componentsNumber;
+ private IAnnotationComponent[] components;
+ private int readOffset;
+
+ /**
+ * Constructor for Annotation.
+ *
+ * @param classFileBytes
+ * @param constantPool
+ * @param offset
+ * @throws ClassFormatException
+ */
+ public Annotation(
+ byte[] classFileBytes,
+ IConstantPool constantPool,
+ int offset) throws ClassFormatException {
+
+ this.typeIndex = u2At(classFileBytes, 0, offset);
+ final int length = u2At(classFileBytes, 2, offset);
+ this.componentsNumber = length;
+ if (length != 0) {
+ this.readOffset = 4;
+ this.components = new IAnnotationComponent[length];
+ for (int i = 0; i < length; i++) {
+ AnnotationComponent component = new AnnotationComponent(classFileBytes, constantPool, offset + readOffset);
+ this.components[i++] = component;
+ this.readOffset += component.sizeInBytes();
+ }
+ } else {
+ this.components = NO_ENTRIES;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IAnnotation#getTypeIndex()
+ */
+ public int getTypeIndex() {
+ return this.typeIndex;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IAnnotation#getComponentsNumber()
+ */
+ public int getComponentsNumber() {
+ return this.componentsNumber;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IAnnotation#getComponents()
+ */
+ public IAnnotationComponent[] getComponents() {
+ return this.components;
+ }
+
+ int sizeInBytes() {
+ return this.readOffset;
+ }
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/AnnotationComponent.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/AnnotationComponent.java
new file mode 100644
index 0000000000..10a4710e02
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/AnnotationComponent.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.util;
+
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.core.util.IAnnotationComponent;
+import org.eclipse.jdt.core.util.IAnnotationComponentValue;
+import org.eclipse.jdt.core.util.IConstantPool;
+import org.eclipse.jdt.core.util.IConstantPoolConstant;
+import org.eclipse.jdt.core.util.IConstantPoolEntry;
+
+/**
+ * Default implementation of IAnnotationComponent
+ */
+public class AnnotationComponent extends ClassFileStruct implements IAnnotationComponent {
+
+ private int componentNameIndex;
+ private char[] componentName;
+ private IAnnotationComponentValue componentValue;
+ private int readOffset;
+
+ public AnnotationComponent(
+ byte[] classFileBytes,
+ IConstantPool constantPool,
+ int offset) throws ClassFormatException {
+ final int nameIndex = u2At(classFileBytes, 0, offset);
+ this.componentNameIndex = nameIndex;
+ if (nameIndex != 0) {
+ IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(nameIndex);
+ if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
+ throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
+ }
+ this.componentName = constantPoolEntry.getUtf8Value();
+ }
+ this.readOffset = 2;
+ AnnotationComponentValue value = new AnnotationComponentValue(classFileBytes, constantPool, offset + readOffset);
+ this.componentValue = value;
+ this.readOffset += value.sizeInBytes();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IAnnotationComponent#getComponentNameIndex()
+ */
+ public int getComponentNameIndex() {
+ return this.componentNameIndex;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IAnnotationComponent#getComponentName()
+ */
+ public char[] getComponentName() {
+ return this.componentName;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IAnnotationComponent#getComponentValue()
+ */
+ public IAnnotationComponentValue getComponentValue() {
+ return this.componentValue;
+ }
+
+ int sizeInBytes() {
+ return this.readOffset;
+ }
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/AnnotationComponentValue.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/AnnotationComponentValue.java
new file mode 100644
index 0000000000..b674db1eac
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/AnnotationComponentValue.java
@@ -0,0 +1,180 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.util;
+
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.core.util.IAnnotation;
+import org.eclipse.jdt.core.util.IAnnotationComponentValue;
+import org.eclipse.jdt.core.util.IConstantPool;
+import org.eclipse.jdt.core.util.IConstantPoolConstant;
+import org.eclipse.jdt.core.util.IConstantPoolEntry;
+
+/**
+ * Default implementation of IAnnotationComponent
+ */
+public class AnnotationComponentValue extends ClassFileStruct implements IAnnotationComponentValue {
+
+ private int readOffset;
+ private int constantValueIndex;
+ private IConstantPoolEntry constantValue;
+ private int classFileInfoIndex;
+ private IConstantPoolEntry classFileInfo;
+ private int enumConstantIndex;
+ private IConstantPoolEntry enumConstant;
+ private IAnnotation attributeValue;
+ private int valuesNumber;
+ private IAnnotationComponentValue[] annotationComponentValues;
+ private int tag;
+
+ public AnnotationComponentValue(
+ byte[] classFileBytes,
+ IConstantPool constantPool,
+ int offset) throws ClassFormatException {
+ final int t = u1At(classFileBytes, 0, offset);
+ this.tag = t;
+ this.readOffset = 1;
+ switch(t) {
+ case 'B' :
+ case 'C' :
+ case 'D' :
+ case 'F' :
+ case 'I' :
+ case 'J' :
+ case 'S' :
+ case 'Z' :
+ case 's' :
+ final int constantIndex = this.u2At(classFileBytes, this.readOffset, offset);
+ this.constantValueIndex = constantIndex;
+ if (constantIndex != 0) {
+ IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(constantIndex);
+ switch(constantPoolEntry.getKind()) {
+ case IConstantPoolConstant.CONSTANT_Long :
+ case IConstantPoolConstant.CONSTANT_Float :
+ case IConstantPoolConstant.CONSTANT_Double :
+ case IConstantPoolConstant.CONSTANT_Integer :
+ case IConstantPoolConstant.CONSTANT_Utf8 :
+ break;
+ default :
+ throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
+ }
+ this.constantValue = constantPoolEntry;
+ }
+ this.readOffset += 2;
+ break;
+ case 'e' :
+ final int enumIndex = this.u2At(classFileBytes, this.readOffset, offset);
+ this.enumConstantIndex = enumIndex;
+ if (enumIndex != 0) {
+ IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(enumIndex);
+ if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Fieldref) {
+ throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
+ }
+ this.enumConstant = constantPoolEntry;
+ }
+ this.readOffset += 2;
+ break;
+ case 'c' :
+ final int classFileIndex = this.u2At(classFileBytes, this.readOffset, offset);
+ this.classFileInfoIndex = classFileIndex;
+ if (classFileIndex != 0) {
+ IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(classFileIndex);
+ if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Class) {
+ throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
+ }
+ this.classFileInfo = constantPoolEntry;
+ }
+ this.readOffset += 2;
+ break;
+ case '@' :
+ Annotation annotation = new Annotation(classFileBytes, constantPool, this.readOffset + offset);
+ this.attributeValue = annotation;
+ this.readOffset += annotation.sizeInBytes();
+ break;
+ case '[' :
+ final int numberOfValues = this.u2At(classFileBytes, this.readOffset, offset);
+ this.valuesNumber = numberOfValues;
+ if (numberOfValues != 0) {
+ this.readOffset += 2;
+ this.annotationComponentValues = new IAnnotationComponentValue[numberOfValues];
+ for (int i = 0; i < numberOfValues; i++) {
+ AnnotationComponentValue value = new AnnotationComponentValue(classFileBytes, constantPool, offset + readOffset);
+ this.annotationComponentValues[i] = value;
+ this.readOffset += value.sizeInBytes();
+ }
+ }
+ break;
+ }
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IAnnotationComponentValue#getAnnotationComponentValues()
+ */
+ public IAnnotationComponentValue[] getAnnotationComponentValues() {
+ return this.annotationComponentValues;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IAnnotationComponentValue#getAttributeValue()
+ */
+ public IAnnotation getAttributeValue() {
+ return this.attributeValue;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IAnnotationComponentValue#getClassInfo()
+ */
+ public IConstantPoolEntry getClassInfo() {
+ return this.classFileInfo;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IAnnotationComponentValue#getClassInfoIndex()
+ */
+ public int getClassInfoIndex() {
+ return this.classFileInfoIndex;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IAnnotationComponentValue#getConstantValue()
+ */
+ public IConstantPoolEntry getConstantValue() {
+ return this.constantValue;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IAnnotationComponentValue#getConstantValueIndex()
+ */
+ public int getConstantValueIndex() {
+ return this.constantValueIndex;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IAnnotationComponentValue#getEnumConstant()
+ */
+ public IConstantPoolEntry getEnumConstant() {
+ return this.enumConstant;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IAnnotationComponentValue#getEnumConstantIndex()
+ */
+ public int getEnumConstantIndex() {
+ return this.enumConstantIndex;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IAnnotationComponentValue#getTag()
+ */
+ public int getTag() {
+ return this.tag;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IAnnotationComponentValue#getValuesNumber()
+ */
+ public int getValuesNumber() {
+ return this.valuesNumber;
+ }
+
+ int sizeInBytes() {
+ return this.readOffset;
+ }
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/AnnotationDefaultAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/AnnotationDefaultAttribute.java
new file mode 100644
index 0000000000..f8f5ac122a
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/AnnotationDefaultAttribute.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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.core.util;
+
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.core.util.IAnnotationComponentValue;
+import org.eclipse.jdt.core.util.IAnnotationDefaultAttribute;
+import org.eclipse.jdt.core.util.IConstantPool;
+
+/**
+ * Default implementation of AnnotationDefaultAttribute.
+ *
+ * @since 3.0
+ */
+public class AnnotationDefaultAttribute extends ClassFileAttribute
+ implements
+ IAnnotationDefaultAttribute {
+
+ private IAnnotationComponentValue memberValue;
+
+ /**
+ * Constructor for AnnotationDefaultAttribute.
+ * @param classFileBytes
+ * @param constantPool
+ * @param offset
+ * @throws ClassFormatException
+ */
+ public AnnotationDefaultAttribute(
+ byte[] classFileBytes,
+ IConstantPool constantPool,
+ int offset)
+ throws ClassFormatException {
+ super(classFileBytes, constantPool, offset);
+ this.memberValue = new AnnotationComponentValue(classFileBytes, constantPool, offset + 6);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IAnnotationDefaultAttribute#getMemberValue()
+ */
+ public IAnnotationComponentValue getMemberValue() {
+ return this.memberValue;
+ }
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java
index 27e104b816..5a4e660360 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java
@@ -28,30 +28,30 @@ import org.eclipse.jdt.core.util.ISourceAttribute;
public class ClassFileReader extends ClassFileStruct implements IClassFileReader {
private static final IFieldInfo[] NO_FIELD_INFOS = new IFieldInfo[0];
- private static final IMethodInfo[] NO_METHOD_INFOS = new IMethodInfo[0];
private static final int[] NO_INTERFACE_INDEXES = new int[0];
private static final char[][] NO_INTERFACES_NAMES = CharOperation.NO_CHAR_CHAR;
-
- private IConstantPool constantPool;
- private int magicNumber;
+ private static final IMethodInfo[] NO_METHOD_INFOS = new IMethodInfo[0];
private int accessFlags;
+ private IClassFileAttribute[] attributes;
+ private int attributesCount;
private char[] className;
- private char[] superclassName;
- private int interfacesCount;
- private char[][] interfaceNames;
- private int[] interfaceIndexes;
- private int fieldsCount;
+ private int classNameIndex;
+
+ private IConstantPool constantPool;
private IFieldInfo[] fields;
- private int methodsCount;
- private IMethodInfo[] methods;
+ private int fieldsCount;
private IInnerClassesAttribute innerClassesAttribute;
- private ISourceAttribute sourceFileAttribute;
- private int classNameIndex;
+ private int[] interfaceIndexes;
+ private char[][] interfaceNames;
+ private int interfacesCount;
+ private int magicNumber;
private int majorVersion;
+ private IMethodInfo[] methods;
+ private int methodsCount;
private int minorVersion;
+ private ISourceAttribute sourceFileAttribute;
+ private char[] superclassName;
private int superclassNameIndex;
- private int attributesCount;
- private IClassFileAttribute[] attributes;
/**
* Constructor for ClassFileReader.
@@ -74,6 +74,10 @@ public class ClassFileReader extends ClassFileStruct implements IClassFileReader
int[] constantPoolOffsets;
try {
this.magicNumber = (int) u4At(classFileBytes, 0, 0);
+ if (this.magicNumber != 0xCAFEBABE) {
+ throw new ClassFormatException(ClassFormatException.INVALID_MAGIC_NUMBER);
+ }
+
int readOffset = 10;
this.minorVersion = this.u2At(classFileBytes, 4, 0);
this.majorVersion = this.u2At(classFileBytes, 6, 0);
@@ -156,7 +160,7 @@ public class ClassFileReader extends ClassFileStruct implements IClassFileReader
if (superclassNameIndex != 0) {
this.superclassName = getConstantClassNameAt(classFileBytes, constantPoolOffsets, this.superclassNameIndex);
}
-
+
// Read the interfaces, use exception handlers to catch bad format
this.interfacesCount = u2At(classFileBytes, readOffset, 0);
readOffset += 2;
@@ -231,7 +235,7 @@ public class ClassFileReader extends ClassFileStruct implements IClassFileReader
// Read the attributes
this.attributesCount = u2At(classFileBytes, readOffset, 0);
readOffset += 2;
-
+
int attributesIndex = 0;
this.attributes = ClassFileAttribute.NO_ATTRIBUTES;
if (this.attributesCount != 0) {
@@ -240,16 +244,20 @@ public class ClassFileReader extends ClassFileStruct implements IClassFileReader
for (int i = 0; i < attributesCount; i++) {
int utf8Offset = constantPoolOffsets[u2At(classFileBytes, readOffset, 0)];
char[] attributeName = utf8At(classFileBytes, utf8Offset + 3, 0, u2At(classFileBytes, utf8Offset + 1, 0));
- if (equals(attributeName, IAttributeNamesConstants.DEPRECATED)) {
- this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, this.constantPool, readOffset);
- } else if (equals(attributeName, IAttributeNamesConstants.INNER_CLASSES)) {
+ if (equals(attributeName, IAttributeNamesConstants.INNER_CLASSES)) {
this.innerClassesAttribute = new InnerClassesAttribute(classFileBytes, this.constantPool, readOffset);
this.attributes[attributesIndex++] = this.innerClassesAttribute;
} else if (equals(attributeName, IAttributeNamesConstants.SOURCE)) {
- this.sourceFileAttribute = new SourceFileAttribute(classFileBytes, this.constantPool, readOffset);
- this.attributes[attributesIndex++] = this.sourceFileAttribute;
- } else if (equals(attributeName, IAttributeNamesConstants.SYNTHETIC)) {
- this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, this.constantPool, readOffset);
+ this.sourceFileAttribute = new SourceFileAttribute(classFileBytes, this.constantPool, readOffset);
+ this.attributes[attributesIndex++] = this.sourceFileAttribute;
+ } else if (equals(attributeName, IAttributeNamesConstants.ENCLOSING_METHOD)) {
+ this.attributes[attributesIndex++] = new EnclosingMethodAttribute(classFileBytes, this.constantPool, readOffset);
+ } else if (equals(attributeName, IAttributeNamesConstants.SIGNATURE)) {
+ this.attributes[attributesIndex++] = new SignatureAttribute(classFileBytes, this.constantPool, readOffset);
+ } else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS)) {
+ this.attributes[attributesIndex++] = new RuntimeVisibleAnnotationsAttribute(classFileBytes, this.constantPool, readOffset);
+ } else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS)) {
+ this.attributes[attributesIndex++] = new RuntimeInvisibleAnnotationsAttribute(classFileBytes, this.constantPool, readOffset);
} else {
this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, this.constantPool, readOffset);
}
@@ -277,74 +285,85 @@ public class ClassFileReader extends ClassFileStruct implements IClassFileReader
public int getAccessFlags() {
return this.accessFlags;
}
-
/**
- * @see IClassFileReader#getSourceFileAttribute()
+ * @see IClassFileReader#getAttributeCount()
*/
- public ISourceAttribute getSourceFileAttribute() {
- return this.sourceFileAttribute;
+ public int getAttributeCount() {
+ return this.attributesCount;
}
/**
- * @see IClassFileReader#getConstantPool()
+ * @see IClassFileReader#getAttributes()
*/
- public IConstantPool getConstantPool() {
- return this.constantPool;
+ public IClassFileAttribute[] getAttributes() {
+ return this.attributes;
}
/**
- * @see IClassFileReader#getFieldInfos()
+ * @see IClassFileReader#getClassIndex()
*/
- public IFieldInfo[] getFieldInfos() {
- return this.fields;
+ public int getClassIndex() {
+ return this.classNameIndex;
}
/**
- * @see IClassFileReader#getInnerClassesAttribute()
+ * @see IClassFileReader#getClassName()
*/
- public IInnerClassesAttribute getInnerClassesAttribute() {
- return this.innerClassesAttribute;
+ public char[] getClassName() {
+ return this.className;
+ }
+
+ private char[] getConstantClassNameAt(byte[] classFileBytes, int[] constantPoolOffsets, int constantPoolIndex) {
+ int utf8Offset = constantPoolOffsets[u2At(classFileBytes, constantPoolOffsets[constantPoolIndex] + 1, 0)];
+ return utf8At(classFileBytes, utf8Offset + 3, 0, u2At(classFileBytes, utf8Offset + 1, 0));
}
/**
- * @see IClassFileReader#getInterfaceNames()
+ * @see IClassFileReader#getConstantPool()
*/
- public char[][] getInterfaceNames() {
- return this.interfaceNames;
+ public IConstantPool getConstantPool() {
+ return this.constantPool;
+ }
+ /**
+ * @see IClassFileReader#getFieldInfos()
+ */
+ public IFieldInfo[] getFieldInfos() {
+ return this.fields;
}
/**
- * @see IClassFileReader#getMethodInfos()
+ * @see IClassFileReader#getFieldsCount()
*/
- public IMethodInfo[] getMethodInfos() {
- return this.methods;
+ public int getFieldsCount() {
+ return this.fieldsCount;
}
/**
- * @see IClassFileReader#getClassName()
+ * @see IClassFileReader#getInnerClassesAttribute()
*/
- public char[] getClassName() {
- return this.className;
+ public IInnerClassesAttribute getInnerClassesAttribute() {
+ return this.innerClassesAttribute;
}
/**
- * @see IClassFileReader#getSuperclassName()
+ * @see IClassFileReader#getInterfaceIndexes()
*/
- public char[] getSuperclassName() {
- return this.superclassName;
+ public int[] getInterfaceIndexes() {
+ return this.interfaceIndexes;
}
+
/**
- * @see IClassFileReader#isClass()
+ * @see IClassFileReader#getInterfaceNames()
*/
- public boolean isClass() {
- return !isInterface();
+ public char[][] getInterfaceNames() {
+ return this.interfaceNames;
}
/**
- * @see IClassFileReader#isInterface()
+ * @see IClassFileReader#getMagic()
*/
- public boolean isInterface() {
- return (getAccessFlags() & IModifierConstants.ACC_INTERFACE) != 0;
+ public int getMagic() {
+ return this.magicNumber;
}
/**
@@ -355,35 +374,31 @@ public class ClassFileReader extends ClassFileStruct implements IClassFileReader
}
/**
- * @see IClassFileReader#getMinorVersion()
+ * @see IClassFileReader#getMethodInfos()
*/
- public int getMinorVersion() {
- return this.minorVersion;
+ public IMethodInfo[] getMethodInfos() {
+ return this.methods;
}
- private char[] getConstantClassNameAt(byte[] classFileBytes, int[] constantPoolOffsets, int constantPoolIndex) {
- int utf8Offset = constantPoolOffsets[u2At(classFileBytes, constantPoolOffsets[constantPoolIndex] + 1, 0)];
- return utf8At(classFileBytes, utf8Offset + 3, 0, u2At(classFileBytes, utf8Offset + 1, 0));
- }
/**
- * @see IClassFileReader#getAttributeCount()
+ * @see IClassFileReader#getMethodsCount()
*/
- public int getAttributeCount() {
- return this.attributesCount;
+ public int getMethodsCount() {
+ return this.methodsCount;
}
/**
- * @see IClassFileReader#getClassIndex()
+ * @see IClassFileReader#getMinorVersion()
*/
- public int getClassIndex() {
- return this.classNameIndex;
+ public int getMinorVersion() {
+ return this.minorVersion;
}
/**
- * @see IClassFileReader#getInterfaceIndexes()
+ * @see IClassFileReader#getSourceFileAttribute()
*/
- public int[] getInterfaceIndexes() {
- return this.interfaceIndexes;
+ public ISourceAttribute getSourceFileAttribute() {
+ return this.sourceFileAttribute;
}
/**
@@ -394,31 +409,22 @@ public class ClassFileReader extends ClassFileStruct implements IClassFileReader
}
/**
- * @see IClassFileReader#getMagic()
- */
- public int getMagic() {
- return this.magicNumber;
- }
-
- /**
- * @see IClassFileReader#getFieldsCount()
+ * @see IClassFileReader#getSuperclassName()
*/
- public int getFieldsCount() {
- return this.fieldsCount;
+ public char[] getSuperclassName() {
+ return this.superclassName;
}
-
/**
- * @see IClassFileReader#getMethodsCount()
+ * @see IClassFileReader#isClass()
*/
- public int getMethodsCount() {
- return this.methodsCount;
+ public boolean isClass() {
+ return !isInterface();
}
/**
- * @see IClassFileReader#getAttributes()
+ * @see IClassFileReader#isInterface()
*/
- public IClassFileAttribute[] getAttributes() {
- return this.attributes;
+ public boolean isInterface() {
+ return (getAccessFlags() & IModifierConstants.ACC_INTERFACE) != 0;
}
-
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CodeAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CodeAttribute.java
index e712318092..549a1906f5 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CodeAttribute.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CodeAttribute.java
@@ -28,19 +28,19 @@ import org.eclipse.jdt.core.util.IOpcodeMnemonics;
*/
public class CodeAttribute extends ClassFileAttribute implements ICodeAttribute {
private static final IExceptionTableEntry[] NO_EXCEPTION_TABLE = new IExceptionTableEntry[0];
- private int maxLocals;
- private int maxStack;
- private ILineNumberAttribute lineNumberAttribute;
- private ILocalVariableAttribute localVariableAttribute;
- private IExceptionTableEntry[] exceptionTableEntries;
- private long codeLength;
+ private IClassFileAttribute[] attributes;
private int attributesCount;
- private int exceptionTableLength;
private byte[] bytecodes;
- private IConstantPool constantPool;
- private int codeOffset;
private byte[] classFileBytes;
- private IClassFileAttribute[] attributes;
+ private long codeLength;
+ private int codeOffset;
+ private IConstantPool constantPool;
+ private IExceptionTableEntry[] exceptionTableEntries;
+ private int exceptionTableLength;
+ private ILineNumberAttribute lineNumberAttribute;
+ private ILocalVariableAttribute localVariableAttribute;
+ private int maxLocals;
+ private int maxStack;
CodeAttribute(byte[] classFileBytes, IConstantPool constantPool, int offset) throws ClassFormatException {
super(classFileBytes, constantPool, offset);
@@ -80,6 +80,8 @@ public class CodeAttribute extends ClassFileAttribute implements ICodeAttribute
} else if (equals(attributeName, IAttributeNamesConstants.LOCAL_VARIABLE)) {
this.localVariableAttribute = new LocalVariableAttribute(classFileBytes, constantPool, offset + readOffset);
this.attributes[attributesIndex++] = this.localVariableAttribute;
+ } else if (equals(attributeName, IAttributeNamesConstants.LOCAL_VARIABLE_TYPE_TABLE)) {
+ this.attributes[attributesIndex++] = new LocalVariableTypeAttribute(classFileBytes, constantPool, offset + readOffset);
} else {
this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
}
@@ -87,19 +89,49 @@ public class CodeAttribute extends ClassFileAttribute implements ICodeAttribute
}
}
-
/**
- * @see ICodeAttribute#getMaxLocals()
+ * @see ICodeAttribute#getAttributes()
*/
- public int getMaxLocals() {
- return this.maxLocals;
+ public IClassFileAttribute[] getAttributes() {
+ return this.attributes;
}
/**
- * @see ICodeAttribute#getMaxStack()
+ * @see ICodeAttribute#getAttributesCount()
*/
- public int getMaxStack() {
- return this.maxStack;
+ public int getAttributesCount() {
+ return this.attributesCount;
+ }
+
+ /**
+ * @see ICodeAttribute#getBytecodes()
+ */
+ public byte[] getBytecodes() {
+ if (this.bytecodes == null) {
+ System.arraycopy(this.classFileBytes, this.codeOffset, (this.bytecodes = new byte[(int) this.codeLength]), 0, (int) this.codeLength);
+ }
+ return this.bytecodes;
+ }
+
+ /**
+ * @see ICodeAttribute#getCodeLength()
+ */
+ public long getCodeLength() {
+ return this.codeLength;
+ }
+
+ /**
+ * @see ICodeAttribute#getExceptionTable()
+ */
+ public IExceptionTableEntry[] getExceptionTable() {
+ return this.exceptionTableEntries;
+ }
+
+ /**
+ * @see ICodeAttribute#getExceptionTableLength()
+ */
+ public int getExceptionTableLength() {
+ return this.exceptionTableLength;
}
/**
@@ -115,18 +147,22 @@ public class CodeAttribute extends ClassFileAttribute implements ICodeAttribute
public ILocalVariableAttribute getLocalVariableAttribute() {
return this.localVariableAttribute;
}
-
+
/**
- * @see ICodeAttribute#getBytecodes()
+ * @see ICodeAttribute#getMaxLocals()
*/
- public byte[] getBytecodes() {
- if (this.bytecodes == null) {
- System.arraycopy(this.classFileBytes, this.codeOffset, (this.bytecodes = new byte[(int) this.codeLength]), 0, (int) this.codeLength);
- }
- return this.bytecodes;
+ public int getMaxLocals() {
+ return this.maxLocals;
}
/**
+ * @see ICodeAttribute#getMaxStack()
+ */
+ public int getMaxStack() {
+ return this.maxStack;
+ }
+
+ /**
* @see ICodeAttribute#traverse(IBytecodeVisitor visitor)
*/
public void traverse(IBytecodeVisitor visitor) throws ClassFormatException {
@@ -213,7 +249,8 @@ public class CodeAttribute extends ClassFileAttribute implements ICodeAttribute
constantPoolEntry = this.constantPool.decodeEntry(index);
if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Float
&& constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Integer
- && constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_String) {
+ && constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_String
+ && constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Class) {
throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
}
visitor._ldc(pc - this.codeOffset, index, constantPoolEntry);
@@ -1126,46 +1163,4 @@ public class CodeAttribute extends ClassFileAttribute implements ICodeAttribute
}
}
}
-
- /**
- * @see ICodeAttribute#getExceptionTable()
- */
- public IExceptionTableEntry[] getExceptionTable() {
- return this.exceptionTableEntries;
- }
-
- /**
- * @see ICodeAttribute#getAttributesCount()
- */
- public int getAttributesCount() {
- return this.attributesCount;
- }
-
- /**
- * @see ICodeAttribute#getCodeLength()
- */
- public long getCodeLength() {
- return this.codeLength;
- }
-
- /**
- * @see ICodeAttribute#getExceptionTableLength()
- */
- public int getExceptionTableLength() {
- return this.exceptionTableLength;
- }
-
- /**
- * @see IClassFileAttribute#getAttributeName()
- */
- public char[] getAttributeName() {
- return IAttributeNamesConstants.CODE;
- }
- /**
- * @see ICodeAttribute#getAttributes()
- */
- public IClassFileAttribute[] getAttributes() {
- return this.attributes;
- }
-
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantValueAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantValueAttribute.java
index d8688ef18a..15d1981e18 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantValueAttribute.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantValueAttribute.java
@@ -11,7 +11,6 @@
package org.eclipse.jdt.internal.core.util;
import org.eclipse.jdt.core.util.ClassFormatException;
-import org.eclipse.jdt.core.util.IAttributeNamesConstants;
import org.eclipse.jdt.core.util.IConstantPool;
import org.eclipse.jdt.core.util.IConstantPoolEntry;
import org.eclipse.jdt.core.util.IConstantValueAttribute;
@@ -30,7 +29,7 @@ public class ConstantValueAttribute
ConstantValueAttribute(byte[] classFileBytes, IConstantPool constantPool, int offset) throws ClassFormatException {
super(classFileBytes, constantPool, offset);
this.constantValueIndex = u2At(classFileBytes, 6, offset);
- this.constantPool = constantPool;
+ this.constantPool = constantPool;
}
/**
* @see IConstantValueAttribute#getConstantValue()
@@ -45,11 +44,4 @@ public class ConstantValueAttribute
public int getConstantValueIndex() {
return this.constantValueIndex;
}
-
- /**
- * @see org.eclipse.jdt.core.util.IClassFileAttribute#getAttributeName()
- */
- public char[] getAttributeName() {
- return IAttributeNamesConstants.CONSTANT_VALUE;
- }
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java
index a571781ece..bd0c4cfc71 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java
@@ -1129,11 +1129,8 @@ public class Disassembler extends ClassFileBytesDisassembler {
}
private char[] getSignatureForField(char[] fieldDescriptor) {
- final int length = fieldDescriptor.length;
- char[] newFieldDescriptor = new char[length];
- System.arraycopy(fieldDescriptor, 0, newFieldDescriptor, 0, length);
- CharOperation.replace(newFieldDescriptor, '/', '.');
- CharOperation.replace(newFieldDescriptor, '$', '~');
+ char[] newFieldDescriptor = CharOperation.replaceOnCopy(fieldDescriptor, '/', '.');
+ newFieldDescriptor = CharOperation.replaceOnCopy(newFieldDescriptor, '$', '~');
char[] fieldDescriptorSignature = Signature.toCharArray(newFieldDescriptor);
CharOperation.replace(fieldDescriptorSignature, '~', '$');
return fieldDescriptorSignature;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ElementInfoConverter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ElementInfoConverter.java
index 4578f6318c..960d42f351 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ElementInfoConverter.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ElementInfoConverter.java
@@ -209,7 +209,8 @@ public class ElementInfoConverter implements CompilerModifiers {
argumentNames[i],
position,
createTypeReference(argumentTypeNames[i], start, end),
- AccDefault);
+ AccDefault,
+ false);
// do not care whether was final or not
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/EnclosingMethodAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/EnclosingMethodAttribute.java
new file mode 100644
index 0000000000..8097a276b8
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/EnclosingMethodAttribute.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * 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.core.util;
+
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.core.util.IConstantPool;
+import org.eclipse.jdt.core.util.IConstantPoolConstant;
+import org.eclipse.jdt.core.util.IConstantPoolEntry;
+import org.eclipse.jdt.core.util.IEnclosingMethodAttribute;
+
+/**
+ * Default implementation of EnclosingMethodAttribute.
+ *
+ * @since 3.0
+ */
+public class EnclosingMethodAttribute extends ClassFileAttribute implements IEnclosingMethodAttribute {
+
+ private int enclosingClassIndex;
+ private char[] enclosingClassName;
+ private int methodDescriptorIndex;
+ private char[] methodDescriptor;
+ private int methodNameIndex;
+ private char[] methodName;
+ private int methodNameAndTypeIndex;
+
+ EnclosingMethodAttribute(byte[] classFileBytes, IConstantPool constantPool, int offset) throws ClassFormatException {
+ super(classFileBytes, constantPool, offset);
+ int index = u2At(classFileBytes, 6, offset);
+ this.enclosingClassIndex = index;
+ IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(index);
+ if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Class) {
+ throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
+ }
+ this.enclosingClassName = constantPoolEntry.getClassInfoName();
+ this.methodNameAndTypeIndex = u2At(classFileBytes, 8, offset);
+ constantPoolEntry = constantPool.decodeEntry(this.methodNameAndTypeIndex);
+ if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_NameAndType) {
+ throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
+ }
+ this.methodDescriptorIndex = constantPoolEntry.getNameAndTypeInfoDescriptorIndex();
+ this.methodNameIndex = constantPoolEntry.getNameAndTypeInfoNameIndex();
+ constantPoolEntry = constantPool.decodeEntry(this.methodDescriptorIndex);
+ if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
+ throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
+ }
+ this.methodDescriptor = constantPoolEntry.getUtf8Value();
+ constantPoolEntry = constantPool.decodeEntry(this.methodNameIndex);
+ if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
+ throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
+ }
+ this.methodName = constantPoolEntry.getUtf8Value();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IEnclosingMethodAttribute#getEnclosingClass()
+ */
+ public char[] getEnclosingClass() {
+ return this.enclosingClassName;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IEnclosingMethodAttribute#getMethodDeclaringClassDescriptorIndex()
+ */
+ public int getEnclosingClassIndex() {
+ return this.enclosingClassIndex;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IEnclosingMethodAttribute#getMethodDescriptor()
+ */
+ public char[] getMethodDescriptor() {
+ return this.methodDescriptor;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IEnclosingMethodAttribute#getMethodDescriptorIndex()
+ */
+ public int getMethodDescriptorIndex() {
+ return this.methodDescriptorIndex;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IEnclosingMethodAttribute#getMethodName()
+ */
+ public char[] getMethodName() {
+ return this.methodName;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IEnclosingMethodAttribute#getMethodNameIndex()
+ */
+ public int getMethodNameIndex() {
+ return this.methodNameIndex;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IEnclosingMethodAttribute#getMethodNameAndTypeIndex()
+ */
+ public int getMethodNameAndTypeIndex() {
+ return this.methodNameAndTypeIndex;
+ }
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ExceptionAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ExceptionAttribute.java
index e9b178fc03..451e3989d7 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ExceptionAttribute.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ExceptionAttribute.java
@@ -12,7 +12,6 @@ package org.eclipse.jdt.internal.core.util;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.core.util.ClassFormatException;
-import org.eclipse.jdt.core.util.IAttributeNamesConstants;
import org.eclipse.jdt.core.util.IConstantPool;
import org.eclipse.jdt.core.util.IConstantPoolConstant;
import org.eclipse.jdt.core.util.IConstantPoolEntry;
@@ -72,12 +71,4 @@ public class ExceptionAttribute extends ClassFileAttribute implements IException
public int getExceptionsNumber() {
return this.exceptionsNumber;
}
-
- /**
- * @see org.eclipse.jdt.core.util.IClassFileAttribute#getAttributeName()
- */
- public char[] getAttributeName() {
- return IAttributeNamesConstants.EXCEPTIONS;
- }
-
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/FieldInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/FieldInfo.java
index 56aed05b2c..7bd61a3119 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/FieldInfo.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/FieldInfo.java
@@ -18,22 +18,23 @@ import org.eclipse.jdt.core.util.IConstantPoolConstant;
import org.eclipse.jdt.core.util.IConstantPoolEntry;
import org.eclipse.jdt.core.util.IConstantValueAttribute;
import org.eclipse.jdt.core.util.IFieldInfo;
+import org.eclipse.jdt.core.util.IModifierConstants;
/**
* Default implementation of IFieldInfo.
*/
public class FieldInfo extends ClassFileStruct implements IFieldInfo {
+ private int accessFlags;
+ private int attributeBytes;
+ private IClassFileAttribute[] attributes;
+ private int attributesCount;
+ private IConstantValueAttribute constantValueAttribute;
+ private char[] descriptor;
+ private int descriptorIndex;
private boolean isDeprecated;
private boolean isSynthetic;
- private int accessFlags;
private char[] name;
- private char[] descriptor;
private int nameIndex;
- private int descriptorIndex;
- private int attributesCount;
- private int attributeBytes;
- private IConstantValueAttribute constantValueAttribute;
- private IClassFileAttribute[] attributes;
/**
* @param classFileBytes byte[]
@@ -42,22 +43,25 @@ public class FieldInfo extends ClassFileStruct implements IFieldInfo {
*/
public FieldInfo(byte classFileBytes[], IConstantPool constantPool, int offset)
throws ClassFormatException {
- this.accessFlags = u2At(classFileBytes, 0, offset);
-
+ final int flags = u2At(classFileBytes, 0, offset);
+ this.accessFlags = flags;
+ if ((flags & IModifierConstants.ACC_SYNTHETIC) != 0) {
+ this.isSynthetic = true;
+ }
this.nameIndex = u2At(classFileBytes, 2, offset);
IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(this.nameIndex);
if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
}
this.name = constantPoolEntry.getUtf8Value();
-
+
this.descriptorIndex = u2At(classFileBytes, 4, offset);
constantPoolEntry = constantPool.decodeEntry(this.descriptorIndex);
if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
}
this.descriptor = constantPoolEntry.getUtf8Value();
-
+
this.attributesCount = u2At(classFileBytes, 6, offset);
this.attributes = ClassFileAttribute.NO_ATTRIBUTES;
int readOffset = 8;
@@ -80,6 +84,12 @@ public class FieldInfo extends ClassFileStruct implements IFieldInfo {
} else if (equals(attributeName, IAttributeNamesConstants.CONSTANT_VALUE)) {
this.constantValueAttribute = new ConstantValueAttribute(classFileBytes, constantPool, offset + readOffset);
this.attributes[attributesIndex++] = this.constantValueAttribute;
+ } else if (equals(attributeName, IAttributeNamesConstants.SIGNATURE)) {
+ this.attributes[attributesIndex++] = new SignatureAttribute(classFileBytes, constantPool, offset + readOffset);
+ } else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS)) {
+ this.attributes[attributesIndex++] = new RuntimeVisibleAnnotationsAttribute(classFileBytes, constantPool, readOffset);
+ } else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS)) {
+ this.attributes[attributesIndex++] = new RuntimeInvisibleAnnotationsAttribute(classFileBytes, constantPool, readOffset);
} else {
this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
}
@@ -94,6 +104,19 @@ public class FieldInfo extends ClassFileStruct implements IFieldInfo {
public int getAccessFlags() {
return this.accessFlags;
}
+ /**
+ * @see IFieldInfo#getAttributeCount()
+ */
+ public int getAttributeCount() {
+ return this.attributesCount;
+ }
+
+ /**
+ * @see IFieldInfo#getAttributes()
+ */
+ public IClassFileAttribute[] getAttributes() {
+ return this.attributes;
+ }
/**
* @see IFieldInfo#getConstantValueAttribute()
@@ -110,6 +133,13 @@ public class FieldInfo extends ClassFileStruct implements IFieldInfo {
}
/**
+ * @see IFieldInfo#getDescriptorIndex()
+ */
+ public int getDescriptorIndex() {
+ return this.descriptorIndex;
+ }
+
+ /**
* @see IFieldInfo#getName()
*/
public char[] getName() {
@@ -117,6 +147,12 @@ public class FieldInfo extends ClassFileStruct implements IFieldInfo {
}
/**
+ * @see IFieldInfo#getNameIndex()
+ */
+ public int getNameIndex() {
+ return this.nameIndex;
+ }
+ /**
* @see IFieldInfo#hasConstantValueAttribute()
*/
public boolean hasConstantValueAttribute() {
@@ -140,32 +176,4 @@ public class FieldInfo extends ClassFileStruct implements IFieldInfo {
int sizeInBytes() {
return this.attributeBytes;
}
- /**
- * @see IFieldInfo#getAttributeCount()
- */
- public int getAttributeCount() {
- return this.attributesCount;
- }
-
- /**
- * @see IFieldInfo#getDescriptorIndex()
- */
- public int getDescriptorIndex() {
- return this.descriptorIndex;
- }
-
- /**
- * @see IFieldInfo#getNameIndex()
- */
- public int getNameIndex() {
- return this.nameIndex;
- }
-
- /**
- * @see IFieldInfo#getAttributes()
- */
- public IClassFileAttribute[] getAttributes() {
- return this.attributes;
- }
-
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/HandleFactory.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/HandleFactory.java
index fac7046502..b0767082b8 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/HandleFactory.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/HandleFactory.java
@@ -188,7 +188,7 @@ public class HandleFactory {
public void endVisit(ConstructorDeclaration node, ClassScope scope) {
pop(node);
}
-
+
public boolean visit(FieldDeclaration node, MethodScope scope) {
push(node);
if (node == toBeFound) throw new EndVisit();
@@ -246,7 +246,7 @@ public class HandleFactory {
public void endVisit(MethodDeclaration node, ClassScope scope) {
pop(node);
}
-
+
public boolean visit(TypeDeclaration node, CompilationUnitScope scope) {
push(node);
if (node == toBeFound) throw new EndVisit();
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/InnerClassesAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/InnerClassesAttribute.java
index 3ce5827df0..1b891e972b 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/InnerClassesAttribute.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/InnerClassesAttribute.java
@@ -37,8 +37,7 @@ public class InnerClassesAttribute extends ClassFileAttribute implements IInnerC
throws ClassFormatException {
super(classFileBytes, constantPool, offset);
this.numberOfClasses = u2At(classFileBytes, 6, offset);
- int length = this.numberOfClasses;
- this.entries = NO_ENTRIES;
+ final int length = this.numberOfClasses;
if (length != 0) {
int readOffset = 8;
this.entries = new IInnerClassesAttributeEntry[length];
@@ -46,6 +45,8 @@ public class InnerClassesAttribute extends ClassFileAttribute implements IInnerC
this.entries[i] = new InnerClassesAttributeEntry(classFileBytes, constantPool, offset + readOffset);
readOffset += 8;
}
+ } else {
+ this.entries = NO_ENTRIES;
}
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LineNumberAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LineNumberAttribute.java
index 3b6820e886..19a94f07cc 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LineNumberAttribute.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LineNumberAttribute.java
@@ -11,7 +11,6 @@
package org.eclipse.jdt.internal.core.util;
import org.eclipse.jdt.core.util.ClassFormatException;
-import org.eclipse.jdt.core.util.IAttributeNamesConstants;
import org.eclipse.jdt.core.util.IConstantPool;
import org.eclipse.jdt.core.util.ILineNumberAttribute;
@@ -40,26 +39,20 @@ public class LineNumberAttribute
throws ClassFormatException {
super(classFileBytes, constantPool, offset);
- this.lineNumberTableLength = u2At(classFileBytes, 6, offset);
- this.lineNumberTable = NO_ENTRIES;
- if (this.lineNumberTableLength != 0) {
- this.lineNumberTable = new int[this.lineNumberTableLength][2];
+ final int length = u2At(classFileBytes, 6, offset);
+ this.lineNumberTableLength = length;
+ if (length != 0) {
+ this.lineNumberTable = new int[length][2];
+ int readOffset = 8;
+ for (int i = 0; i < length; i++) {
+ this.lineNumberTable[i][0] = u2At(classFileBytes, readOffset, offset);
+ this.lineNumberTable[i][1] = u2At(classFileBytes, readOffset + 2, offset);
+ readOffset += 4;
+ }
+ } else {
+ this.lineNumberTable = NO_ENTRIES;
}
- int readOffset = 8;
- for (int i = 0, max = this.lineNumberTableLength; i < max; i++) {
- this.lineNumberTable[i][0] = u2At(classFileBytes, readOffset, offset);
- this.lineNumberTable[i][1] = u2At(classFileBytes, readOffset + 2, offset);
- readOffset += 4;
- }
- }
-
- /**
- * @see org.eclipse.jdt.core.util.IClassFileAttribute#getAttributeName()
- */
- public char[] getAttributeName() {
- return IAttributeNamesConstants.LINE_NUMBER;
}
-
/**
* @see ILineNumberAttribute#getLineNumberTable()
*/
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableAttribute.java
index 8ca2c27eed..d82413c7e6 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableAttribute.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableAttribute.java
@@ -11,7 +11,6 @@
package org.eclipse.jdt.internal.core.util;
import org.eclipse.jdt.core.util.ClassFormatException;
-import org.eclipse.jdt.core.util.IAttributeNamesConstants;
import org.eclipse.jdt.core.util.IConstantPool;
import org.eclipse.jdt.core.util.ILocalVariableAttribute;
import org.eclipse.jdt.core.util.ILocalVariableTableEntry;
@@ -40,26 +39,19 @@ public class LocalVariableAttribute
int offset)
throws ClassFormatException {
super(classFileBytes, constantPool, offset);
- this.localVariableTableLength = u2At(classFileBytes, 6, offset);
- int readOffset = 8;
- int length = this.localVariableTableLength;
- this.localVariableTable = NO_ENTRIES;
+ final int length = u2At(classFileBytes, 6, offset);
+ this.localVariableTableLength = length;
if (length != 0) {
- this.localVariableTable = new LocalVariableTableEntry[length];
+ int readOffset = 8;
+ this.localVariableTable = new ILocalVariableTableEntry[length];
+ for (int i = 0; i < length; i++) {
+ this.localVariableTable[i] = new LocalVariableTableEntry(classFileBytes, constantPool, offset + readOffset);
+ readOffset += 10;
+ }
+ } else {
+ this.localVariableTable = NO_ENTRIES;
}
- for (int i = 0; i < length; i++) {
- this.localVariableTable[i] = new LocalVariableTableEntry(classFileBytes, constantPool, offset + readOffset);
- readOffset += 10;
- }
- }
-
- /**
- * @see org.eclipse.jdt.core.util.IClassFileAttribute#getAttributeName()
- */
- public char[] getAttributeName() {
- return IAttributeNamesConstants.LOCAL_VARIABLE;
}
-
/**
* @see ILocalVariableAttribute#getLocalVariableTable()
*/
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableTypeAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableTypeAttribute.java
new file mode 100644
index 0000000000..7fceb5d5f9
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableTypeAttribute.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.util;
+
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.core.util.IConstantPool;
+import org.eclipse.jdt.core.util.ILocalVariableTypeTableAttribute;
+import org.eclipse.jdt.core.util.ILocalVariableTypeTableEntry;
+
+/**
+ * Default implementation of ILocalVariableTypeAttribute.
+ */
+public class LocalVariableTypeAttribute
+ extends ClassFileAttribute
+ implements ILocalVariableTypeTableAttribute {
+
+ private static final ILocalVariableTypeTableEntry[] NO_ENTRIES = new ILocalVariableTypeTableEntry[0];
+ private int localVariableTypeTableLength;
+ private ILocalVariableTypeTableEntry[] localVariableTypeTableEntries;
+
+ /**
+ * Constructor for LocalVariableTypeAttribute.
+ * @param classFileBytes
+ * @param constantPool
+ * @param offset
+ * @throws ClassFormatException
+ */
+ public LocalVariableTypeAttribute(
+ byte[] classFileBytes,
+ IConstantPool constantPool,
+ int offset)
+ throws ClassFormatException {
+ super(classFileBytes, constantPool, offset);
+ final int length = u2At(classFileBytes, 6, offset);
+ this.localVariableTypeTableLength = length;
+ if (length != 0) {
+ int readOffset = 8;
+ this.localVariableTypeTableEntries = new ILocalVariableTypeTableEntry[length];
+ for (int i = 0; i < length; i++) {
+ this.localVariableTypeTableEntries[i] = new LocalVariableTypeTableEntry(classFileBytes, constantPool, offset + readOffset);
+ readOffset += 10;
+ }
+ } else {
+ this.localVariableTypeTableEntries = NO_ENTRIES;
+ }
+ }
+ /**
+ * @see ILocalVariableTypeTableAttribute#getLocalVariableTable()
+ */
+ public ILocalVariableTypeTableEntry[] getLocalVariableTypeTable() {
+ return this.localVariableTypeTableEntries;
+ }
+
+ /**
+ * @see ILocalVariableTypeTableAttribute#getLocalVariableTableLength()
+ */
+ public int getLocalVariableTypeTableLength() {
+ return this.localVariableTypeTableLength;
+ }
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableTypeTableEntry.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableTypeTableEntry.java
new file mode 100644
index 0000000000..a2390c3e7a
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableTypeTableEntry.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * 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.core.util;
+
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.core.util.IConstantPool;
+import org.eclipse.jdt.core.util.IConstantPoolConstant;
+import org.eclipse.jdt.core.util.IConstantPoolEntry;
+import org.eclipse.jdt.core.util.ILocalVariableTypeTableEntry;
+
+/**
+ * Default implementation of ILocalVariableTypeTableEntry
+ */
+public class LocalVariableTypeTableEntry extends ClassFileStruct implements ILocalVariableTypeTableEntry {
+
+ private int startPC;
+ private int length;
+ private int nameIndex;
+ private int signatureIndex;
+ private char[] name;
+ private char[] signature;
+ private int index;
+
+ /**
+ * Constructor for LocalVariableTypeTableEntry.
+ *
+ * @param classFileBytes
+ * @param constantPool
+ * @param offset
+ * @throws ClassFormatException
+ */
+ public LocalVariableTypeTableEntry(
+ byte[] classFileBytes,
+ IConstantPool constantPool,
+ int offset) throws ClassFormatException {
+ this.startPC = u2At(classFileBytes, 0, offset);
+ this.length = u2At(classFileBytes, 2, offset);
+ this.nameIndex = u2At(classFileBytes, 4, offset);
+ this.signatureIndex = u2At(classFileBytes, 6, offset);
+ this.index = u2At(classFileBytes, 8, offset);
+ IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(this.nameIndex);
+ if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
+ throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
+ }
+ this.name = constantPoolEntry.getUtf8Value();
+ constantPoolEntry = constantPool.decodeEntry(this.signatureIndex);
+ if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
+ throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
+ }
+ this.signature = constantPoolEntry.getUtf8Value();
+ }
+
+ /**
+ * @see ILocalVariableTypeTableEntry#getStartPC()
+ */
+ public int getStartPC() {
+ return this.startPC;
+ }
+
+ /**
+ * @see ILocalVariableTypeTableEntry#getLength()
+ */
+ public int getLength() {
+ return this.length;
+ }
+
+ /**
+ * @see ILocalVariableTypeTableEntry#getNameIndex()
+ */
+ public int getNameIndex() {
+ return this.nameIndex;
+ }
+
+ /**
+ * @see ILocalVariableTypeTableEntry#getSignatureIndex()
+ */
+ public int getSignatureIndex() {
+ return this.signatureIndex;
+ }
+
+ /**
+ * @see ILocalVariableTypeTableEntry#getIndex()
+ */
+ public int getIndex() {
+ return this.index;
+ }
+
+ /**
+ * @see ILocalVariableTypeTableEntry#getName()
+ */
+ public char[] getName() {
+ return this.name;
+ }
+
+ /**
+ * @see ILocalVariableTypeTableEntry#getSignature()
+ */
+ public char[] getSignature() {
+ return this.signature;
+ }
+
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java
index 84186c0dc3..57d338f0ae 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java
@@ -26,18 +26,18 @@ import org.eclipse.jdt.core.util.IModifierConstants;
* Default implementation of IMethodInfo.
*/
public class MethodInfo extends ClassFileStruct implements IMethodInfo {
- private boolean isDeprecated;
- private boolean isSynthetic;
private int accessFlags;
- private char[] name;
- private char[] descriptor;
- private int nameIndex;
- private int descriptorIndex;
- private int attributesCount;
private int attributeBytes;
+ private IClassFileAttribute[] attributes;
+ private int attributesCount;
private ICodeAttribute codeAttribute;
+ private char[] descriptor;
+ private int descriptorIndex;
private IExceptionAttribute exceptionAttribute;
- private IClassFileAttribute[] attributes;
+ private boolean isDeprecated;
+ private boolean isSynthetic;
+ private char[] name;
+ private int nameIndex;
/**
* @param classFileBytes byte[]
@@ -49,7 +49,11 @@ public class MethodInfo extends ClassFileStruct implements IMethodInfo {
throws ClassFormatException {
boolean no_code_attribute = (decodingFlags & IClassFileReader.METHOD_BODIES) == 0;
- this.accessFlags = u2At(classFileBytes, 0, offset);
+ final int flags = u2At(classFileBytes, 0, offset);
+ this.accessFlags = flags;
+ if ((flags & IModifierConstants.ACC_SYNTHETIC) != 0) {
+ this.isSynthetic = true;
+ }
this.nameIndex = u2At(classFileBytes, 2, offset);
IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(this.nameIndex);
@@ -98,6 +102,18 @@ public class MethodInfo extends ClassFileStruct implements IMethodInfo {
} else if (equals(attributeName, IAttributeNamesConstants.EXCEPTIONS)) {
this.exceptionAttribute = new ExceptionAttribute(classFileBytes, constantPool, offset + readOffset);
this.attributes[attributesIndex++] = this.exceptionAttribute;
+ } else if (equals(attributeName, IAttributeNamesConstants.SIGNATURE)) {
+ this.attributes[attributesIndex++] = new SignatureAttribute(classFileBytes, constantPool, offset + readOffset);
+ } else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS)) {
+ this.attributes[attributesIndex++] = new RuntimeVisibleAnnotationsAttribute(classFileBytes, constantPool, readOffset);
+ } else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS)) {
+ this.attributes[attributesIndex++] = new RuntimeInvisibleAnnotationsAttribute(classFileBytes, constantPool, readOffset);
+ } else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS)) {
+ this.attributes[attributesIndex++] = new RuntimeVisibleParameterAnnotationsAttribute(classFileBytes, constantPool, readOffset);
+ } else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS)) {
+ this.attributes[attributesIndex++] = new RuntimeInvisibleParameterAnnotationsAttribute(classFileBytes, constantPool, readOffset);
+ } else if (equals(attributeName, IAttributeNamesConstants.ANNOTATION_DEFAULT)) {
+ this.attributes[attributesIndex++] = new AnnotationDefaultAttribute(classFileBytes, constantPool, readOffset);
} else {
this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, constantPool, offset + readOffset);
}
@@ -113,6 +129,19 @@ public class MethodInfo extends ClassFileStruct implements IMethodInfo {
}
/**
+ * @see IMethodInfo#getAttributeCount()
+ */
+ public int getAttributeCount() {
+ return this.attributesCount;
+ }
+ /**
+ * @see IMethodInfo#getAttributes()
+ */
+ public IClassFileAttribute[] getAttributes() {
+ return this.attributes;
+ }
+
+ /**
* @see IMethodInfo#getCodeAttribute()
*/
public ICodeAttribute getCodeAttribute() {
@@ -127,6 +156,20 @@ public class MethodInfo extends ClassFileStruct implements IMethodInfo {
}
/**
+ * @see IMethodInfo#getDescriptorIndex()
+ */
+ public int getDescriptorIndex() {
+ return this.descriptorIndex;
+ }
+
+ /**
+ * @see IMethodInfo#getExceptionAttribute()
+ */
+ public IExceptionAttribute getExceptionAttribute() {
+ return this.exceptionAttribute;
+ }
+
+ /**
* @see IMethodInfo#getName()
*/
public char[] getName() {
@@ -134,6 +177,17 @@ public class MethodInfo extends ClassFileStruct implements IMethodInfo {
}
/**
+ * @see IMethodInfo#getNameIndex()
+ */
+ public int getNameIndex() {
+ return this.nameIndex;
+ }
+
+ private boolean isAbstract() {
+ return (this.accessFlags & IModifierConstants.ACC_ABSTRACT) != 0;
+ }
+
+ /**
* @see IMethodInfo#isClinit()
*/
public boolean isClinit() {
@@ -153,6 +207,10 @@ public class MethodInfo extends ClassFileStruct implements IMethodInfo {
public boolean isDeprecated() {
return this.isDeprecated;
}
+
+ private boolean isNative() {
+ return (this.accessFlags & IModifierConstants.ACC_NATIVE) != 0;
+ }
/**
* @see IMethodInfo#isSynthetic()
@@ -161,49 +219,7 @@ public class MethodInfo extends ClassFileStruct implements IMethodInfo {
return this.isSynthetic;
}
- /**
- * @see IMethodInfo#getExceptionAttribute()
- */
- public IExceptionAttribute getExceptionAttribute() {
- return this.exceptionAttribute;
- }
-
- /**
- * @see IMethodInfo#getAttributeCount()
- */
- public int getAttributeCount() {
- return this.attributesCount;
- }
-
- /**
- * @see IMethodInfo#getDescriptorIndex()
- */
- public int getDescriptorIndex() {
- return this.descriptorIndex;
- }
-
- /**
- * @see IMethodInfo#getNameIndex()
- */
- public int getNameIndex() {
- return this.nameIndex;
- }
-
int sizeInBytes() {
return this.attributeBytes;
}
- /**
- * @see IMethodInfo#getAttributes()
- */
- public IClassFileAttribute[] getAttributes() {
- return this.attributes;
- }
-
- private boolean isAbstract() {
- return (this.accessFlags & IModifierConstants.ACC_ABSTRACT) != 0;
- }
-
- private boolean isNative() {
- return (this.accessFlags & IModifierConstants.ACC_NATIVE) != 0;
- }
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ParameterAnnotation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ParameterAnnotation.java
new file mode 100644
index 0000000000..bcc0a02348
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ParameterAnnotation.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.util;
+
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.core.util.IAnnotation;
+import org.eclipse.jdt.core.util.IConstantPool;
+import org.eclipse.jdt.core.util.IParameterAnnotation;
+
+/**
+ * Default implementation of IParameterAnnotation
+ */
+public class ParameterAnnotation extends ClassFileStruct implements IParameterAnnotation {
+
+ private static final IAnnotation[] NO_ENTRIES = new IAnnotation[0];
+
+ private int annotationsNumber;
+ private IAnnotation[] annotations;
+ private int readOffset;
+
+ /**
+ * Constructor for Annotation.
+ *
+ * @param classFileBytes
+ * @param constantPool
+ * @param offset
+ * @throws ClassFormatException
+ */
+ public ParameterAnnotation(
+ byte[] classFileBytes,
+ IConstantPool constantPool,
+ int offset) throws ClassFormatException {
+
+ final int length = u2At(classFileBytes, 0, offset);
+ this.annotationsNumber = length;
+ if (length != 0) {
+ this.readOffset = 2;
+ this.annotations = new IAnnotation[length];
+ for (int i = 0; i < length; i++) {
+ Annotation annotation = new Annotation(classFileBytes, constantPool, offset + readOffset);
+ this.annotations[i++] = annotation;
+ this.readOffset += annotation.sizeInBytes();
+ }
+ } else {
+ this.annotations = NO_ENTRIES;
+ }
+ }
+
+ int sizeInBytes() {
+ return this.readOffset;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IParameterAnnotation#getAnnotations()
+ */
+ public IAnnotation[] getAnnotations() {
+ return this.annotations;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IParameterAnnotation#getAnnotationsNumber()
+ */
+ public int getAnnotationsNumber() {
+ return this.annotationsNumber;
+ }
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleAnnotationsAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleAnnotationsAttribute.java
new file mode 100644
index 0000000000..3644b28c52
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleAnnotationsAttribute.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.util;
+
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.core.util.IAnnotation;
+import org.eclipse.jdt.core.util.IConstantPool;
+import org.eclipse.jdt.core.util.IRuntimeInvisibleAnnotationsAttribute;
+
+/**
+ * Default implementation of IRuntimeInvisibleAnnotations
+ */
+public class RuntimeInvisibleAnnotationsAttribute
+ extends ClassFileAttribute
+ implements IRuntimeInvisibleAnnotationsAttribute {
+
+ private static final IAnnotation[] NO_ENTRIES = new IAnnotation[0];
+ private int annotationsNumber;
+ private IAnnotation[] annotations;
+
+ /**
+ * Constructor for RuntimeInvisibleAnnotations.
+ * @param classFileBytes
+ * @param constantPool
+ * @param offset
+ * @throws ClassFormatException
+ */
+ public RuntimeInvisibleAnnotationsAttribute(
+ byte[] classFileBytes,
+ IConstantPool constantPool,
+ int offset)
+ throws ClassFormatException {
+ super(classFileBytes, constantPool, offset);
+ final int length = u2At(classFileBytes, 6, offset);
+ this.annotationsNumber = length;
+ if (length != 0) {
+ int readOffset = 8;
+ this.annotations = new IAnnotation[length];
+ for (int i = 0; i < length; i++) {
+ Annotation annotation = new Annotation(classFileBytes, constantPool, offset + readOffset);
+ this.annotations[i] = annotation;
+ readOffset += annotation.sizeInBytes();
+ }
+ } else {
+ this.annotations = NO_ENTRIES;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IRuntimeInvisibleAnnotations#getAnnotations()
+ */
+ public IAnnotation[] getAnnotations() {
+ return this.annotations;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IRuntimeInvisibleAnnotations#getAnnotationsNumber()
+ */
+ public int getAnnotationsNumber() {
+ return this.annotationsNumber;
+ }
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleParameterAnnotationsAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleParameterAnnotationsAttribute.java
new file mode 100644
index 0000000000..def1d596f8
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleParameterAnnotationsAttribute.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.util;
+
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.core.util.IConstantPool;
+import org.eclipse.jdt.core.util.IParameterAnnotation;
+import org.eclipse.jdt.core.util.IRuntimeInvisibleParameterAnnotationsAttribute;
+
+/**
+ * Default implementation of IRuntimeInvisibleParameterAnnotations
+ */
+public class RuntimeInvisibleParameterAnnotationsAttribute
+ extends ClassFileAttribute
+ implements IRuntimeInvisibleParameterAnnotationsAttribute {
+
+ private static final IParameterAnnotation[] NO_ENTRIES = new IParameterAnnotation[0];
+ private IParameterAnnotation[] parameterAnnotations;
+ private int parametersNumber;
+
+ /**
+ * Constructor for RuntimeVisibleParameterAnnotations.
+ * @param classFileBytes
+ * @param constantPool
+ * @param offset
+ * @throws ClassFormatException
+ */
+ public RuntimeInvisibleParameterAnnotationsAttribute(
+ byte[] classFileBytes,
+ IConstantPool constantPool,
+ int offset)
+ throws ClassFormatException {
+ super(classFileBytes, constantPool, offset);
+ final int length = u1At(classFileBytes, 6, offset);
+ this.parametersNumber = length;
+ if (length != 0) {
+ int readOffset = 7;
+ this.parameterAnnotations = new IParameterAnnotation[length];
+ for (int i = 0; i < length; i++) {
+ ParameterAnnotation parameterAnnotation = new ParameterAnnotation(classFileBytes, constantPool, offset + readOffset);
+ this.parameterAnnotations[i] = parameterAnnotation;
+ readOffset += parameterAnnotation.sizeInBytes();
+ }
+ } else {
+ this.parameterAnnotations = NO_ENTRIES;
+ }
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IRuntimeInvisibleParameterAnnotations#getAnnotations()
+ */
+ public IParameterAnnotation[] getParameterAnnotations() {
+ return this.parameterAnnotations;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IRuntimeInvisibleParameterAnnotations#getParametersNumber()
+ */
+ public int getParametersNumber() {
+ return this.parametersNumber;
+ }
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleAnnotationsAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleAnnotationsAttribute.java
new file mode 100644
index 0000000000..a56d40d5b4
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleAnnotationsAttribute.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.util;
+
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.core.util.IAnnotation;
+import org.eclipse.jdt.core.util.IConstantPool;
+import org.eclipse.jdt.core.util.IRuntimeVisibleAnnotationsAttribute;
+
+/**
+ * Default implementation of IRuntimeVisibleAnnotations
+ */
+public class RuntimeVisibleAnnotationsAttribute
+ extends ClassFileAttribute
+ implements IRuntimeVisibleAnnotationsAttribute {
+
+ private static final IAnnotation[] NO_ENTRIES = new IAnnotation[0];
+ private int annotationsNumber;
+ private IAnnotation[] annotations;
+
+ /**
+ * Constructor for RuntimeVisibleAnnotations.
+ * @param classFileBytes
+ * @param constantPool
+ * @param offset
+ * @throws ClassFormatException
+ */
+ public RuntimeVisibleAnnotationsAttribute(
+ byte[] classFileBytes,
+ IConstantPool constantPool,
+ int offset)
+ throws ClassFormatException {
+ super(classFileBytes, constantPool, offset);
+ final int length = u2At(classFileBytes, 6, offset);
+ this.annotationsNumber = length;
+ if (length != 0) {
+ int readOffset = 8;
+ this.annotations = new IAnnotation[length];
+ for (int i = 0; i < length; i++) {
+ Annotation annotation = new Annotation(classFileBytes, constantPool, offset + readOffset);
+ this.annotations[i] = annotation;
+ readOffset += annotation.sizeInBytes();
+ }
+ } else {
+ this.annotations = NO_ENTRIES;
+ }
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IRuntimeVisibleAnnotations#getAnnotations()
+ */
+ public IAnnotation[] getAnnotations() {
+ return this.annotations;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IRuntimeVisibleAnnotations#getAnnotationsNumber()
+ */
+ public int getAnnotationsNumber() {
+ return this.annotationsNumber;
+ }
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleParameterAnnotationsAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleParameterAnnotationsAttribute.java
new file mode 100644
index 0000000000..ec17be2570
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleParameterAnnotationsAttribute.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 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.core.util;
+
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.core.util.IConstantPool;
+import org.eclipse.jdt.core.util.IParameterAnnotation;
+import org.eclipse.jdt.core.util.IRuntimeVisibleParameterAnnotationsAttribute;
+
+/**
+ * Default implementation of IRuntimeVisibleAnnotations
+ */
+public class RuntimeVisibleParameterAnnotationsAttribute
+ extends ClassFileAttribute
+ implements IRuntimeVisibleParameterAnnotationsAttribute {
+
+ private static final IParameterAnnotation[] NO_ENTRIES = new IParameterAnnotation[0];
+ private int parametersNumber;
+ private IParameterAnnotation[] parameterAnnotations;
+
+ /**
+ * Constructor for RuntimeVisibleParameterAnnotations.
+ * @param classFileBytes
+ * @param constantPool
+ * @param offset
+ * @throws ClassFormatException
+ */
+ public RuntimeVisibleParameterAnnotationsAttribute(
+ byte[] classFileBytes,
+ IConstantPool constantPool,
+ int offset)
+ throws ClassFormatException {
+ super(classFileBytes, constantPool, offset);
+ final int length = u1At(classFileBytes, 6, offset);
+ this.parametersNumber = length;
+ if (length != 0) {
+ int readOffset = 7;
+ this.parameterAnnotations = new IParameterAnnotation[length];
+ for (int i = 0; i < length; i++) {
+ ParameterAnnotation parameterAnnotation = new ParameterAnnotation(classFileBytes, constantPool, offset + readOffset);
+ this.parameterAnnotations[i] = parameterAnnotation;
+ readOffset += parameterAnnotation.sizeInBytes();
+ }
+ } else {
+ this.parameterAnnotations = NO_ENTRIES;
+ }
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IRuntimeVisibleParameterAnnotations#getAnnotations()
+ */
+ public IParameterAnnotation[] getParameterAnnotations() {
+ return this.parameterAnnotations;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.IRuntimeVisibleParameterAnnotations#getParametersNumber()
+ */
+ public int getParametersNumber() {
+ return this.parametersNumber;
+ }
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SignatureAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SignatureAttribute.java
new file mode 100644
index 0000000000..b04b091efe
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SignatureAttribute.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * 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.core.util;
+
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.core.util.IConstantPool;
+import org.eclipse.jdt.core.util.IConstantPoolConstant;
+import org.eclipse.jdt.core.util.IConstantPoolEntry;
+import org.eclipse.jdt.core.util.ISignatureAttribute;
+
+/**
+ * @since 3.0
+ */
+public class SignatureAttribute extends ClassFileAttribute implements ISignatureAttribute {
+
+ private int signatureIndex;
+ private char[] signature;
+
+ SignatureAttribute(byte[] classFileBytes, IConstantPool constantPool, int offset) throws ClassFormatException {
+ super(classFileBytes, constantPool, offset);
+ final int index = u2At(classFileBytes, 6, offset);
+ this.signatureIndex = index;
+ IConstantPoolEntry constantPoolEntry = constantPool.decodeEntry(index);
+ if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_Utf8) {
+ throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
+ }
+ this.signature = constantPoolEntry.getUtf8Value();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.ISignatureAttribute#getSignatureIndex()
+ */
+ public int getSignatureIndex() {
+ return this.signatureIndex;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.core.util.ISignatureAttribute#getSignature()
+ */
+ public char[] getSignature() {
+ return this.signature;
+ }
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SourceFileAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SourceFileAttribute.java
index 43d151ca41..1aa89da90d 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SourceFileAttribute.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SourceFileAttribute.java
@@ -11,7 +11,6 @@
package org.eclipse.jdt.internal.core.util;
import org.eclipse.jdt.core.util.ClassFormatException;
-import org.eclipse.jdt.core.util.IAttributeNamesConstants;
import org.eclipse.jdt.core.util.IConstantPool;
import org.eclipse.jdt.core.util.IConstantPoolConstant;
import org.eclipse.jdt.core.util.IConstantPoolEntry;
@@ -47,14 +46,6 @@ public class SourceFileAttribute
}
this.sourceFileName = constantPoolEntry.getUtf8Value();
}
-
- /**
- * @see org.eclipse.jdt.core.util.IClassFileAttribute#getAttributeName()
- */
- public char[] getAttributeName() {
- return IAttributeNamesConstants.SOURCE;
- }
-
/**
* @see ISourceAttribute#getSourceFileIndex()
*/
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java
index 58f671310c..2f8ef53a60 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java
@@ -1675,7 +1675,7 @@ public class Util {
* e.g. "QString;", "[int", "[[Qjava.util.Vector;"
*/
public static String typeSignature(TypeReference type) {
- char[][] compoundName = type.getTypeName();
+ char[][] compoundName = type.getParameterizedTypeName();
char[] typeName =CharOperation.concatWith(compoundName, '.');
String signature = Signature.createTypeSignature(typeName, false/*don't resolve*/);
int dimensions = type.dimensions();
diff --git a/org.eclipse.jdt.core/notes/R30_buildnotes_jdt-core.html b/org.eclipse.jdt.core/notes/R30_buildnotes_jdt-core.html
new file mode 100644
index 0000000000..5c080830bf
--- /dev/null
+++ b/org.eclipse.jdt.core/notes/R30_buildnotes_jdt-core.html
@@ -0,0 +1,4492 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="Author" content="IBM">
+ <meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
+ <title>JDT/Core Release Notes</title>
+
+</head>
+<body>
+
+<body text="#000000" bgcolor="#FFFFFF">
+&nbsp;
+
+<table border=0 cellspacing=5 cellpadding=2 width="100%" >
+ <tr>
+ <td align=left width="72%">
+ <font face="Verdana, Arial, Helvetica" size="+3"><b>jdt core - build notes 3.0 stream</b></font>
+ <br><font face="Arial, Helvetica, sans-serif" size="-2" color="#8080ff">java development tooling core</font></td>
+ </tr>
+ <tr><td>&nbsp;</td></tr>
+ <tr>
+ <td>
+ <font face="Arial, Helvetica, sans-serif" size="-1">
+ Here are the build notes for the Eclipse JDT/Core plug-in project
+ <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/jdt-core-home/main.html"><b>org.eclipse.jdt.core</b></a>,
+ describing <a href="http://bugs.eclipse.org/bugs" target=new>bug</a> resolution and substantial changes in the <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core"><b>HEAD</b></a> branch.
+ This present document covers all changes since Release 2.1 (also see a summary of <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.jdt.core/notes/API_changes.html">API changes</a>).
+ Older changes which occurred up to Release 2.1 can be found in
+ <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.jdt.core/notes/R21_buildnotes_jdt-core.html">build notes R2.1</a>.
+ </font>
+ </td>
+ </tr>
+</table>
+
+<a name="v_449"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0RC4 Build - 24th June 2004 - 3.0 RELEASE CANDIDATE 4
+<br>Project org.eclipse.jdt.core v_449
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_449">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Fixed schema copyrights.</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44068">44068</a>
+[DOC] Need more project configuration tutorials
+
+<a name="v_448"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0RC4 Build - 24th June 2004
+<br>Project org.eclipse.jdt.core v_448
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_448">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Fixed mixed line delimiters.</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+
+<a name="v_447"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0RC4 Build - 23rd June 2004
+<br>Project org.eclipse.jdt.core v_447
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_447">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Copyright update to 2004.</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+
+<a name="v_446"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0RC4 Build - 22nd June 2004
+<br>Project org.eclipse.jdt.core v_446
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_446">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=67769">67769</a>
+Internal StackOverflowError occurred during project build
+
+<a name="v_445"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0RC3 Build - 18th June 2004 - 3.0 RELEASE CANDIDATE 3
+<br>Project org.eclipse.jdt.core v_445
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_445">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66898">66898</a>
+refactor-rename: encoding is not preserved
+
+<a name="v_444"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0RC3 Build - 18th June 2004
+<br>Project org.eclipse.jdt.core v_444
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_444">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=67297">67297</a>
+Renaming included package folder throws JME
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=67786">67786</a>
+OutOfMemoryError searching for reference to Object
+
+<a name="v_443"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0RC3 Build - 18th June 2004
+<br>Project org.eclipse.jdt.core v_443
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_443">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=67717">67717</a>
+NPE disassembling .class file
+
+<a name="v_442"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0RC3 Build - 17th June 2004
+<br>Project org.eclipse.jdt.core v_442
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_442">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=67600">67600</a>
+String Index out of bounds when searching for all types
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=67599">67599</a>
+NPE when cancelling search
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66271">66271</a>
+No need to resolve type names when selecting declaration
+
+<a name="v_441"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0RC3 Build - 16th June 2004
+<br>Project org.eclipse.jdt.core v_441
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_441">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=67324">67324</a>
+Package Explorer doesn't update included package after moving contents of source folder
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41434">41434</a>
+[msic] Slow Down using classes with many methods
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64646">64646</a>
+[Navigator] Navigator popup causes Eclipse to hang.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65186">65186</a>
+Can't attach source from project directory [build path]
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65831">65831</a>
+search for all types slow/memory intensive [search]
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66675">66675</a>
+Extra period in the doc in 200406110010
+
+<a name="v_440"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0RC2 Build - 10th June 2004 - 3.0 RELEASE CANDIDATE 2
+<br>Project org.eclipse.jdt.core v_440
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_440">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66551">66551</a>
+Error in org.eclipse.swt project on class PrinterData
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66573">66573</a>
+Shouldn't bind to local constructs
+
+<a name="v_439"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0RC2 Build - 10th June 2004
+<br>Project org.eclipse.jdt.core v_439
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_439">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66216">66216</a>
+Sort Members is broken.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66437">66437</a>
+Canceling search leads to broken workspace
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65266">65266</a>
+JarPackageFragmentInfo has unnecessary field
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66098">66098</a>
+MatchLocatorParser does not need advanced syntax diagnosis
+
+<a name="v_438"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0RC2 Build - 9th June 2004
+<br>Project org.eclipse.jdt.core v_438
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_438">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66026">66026</a>
+Large amount of garbage created by DefaultCommentMapper
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64646">64646</a>
+[Navigator] Navigator popup causes Eclipse to hang.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65288">65288</a>
+Javadoc: tag gets mangled when javadoc closing on same line without whitespace
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65253">65253</a>
+[Javadoc] @@tag is wrongly parsed as @tag
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65180">65180</a>
+Spurious "Javadoc: xxx cannot be resolved or is not a field" error with inner classes
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65174">65174</a>
+Spurious "Javadoc: Missing reference" error
+
+<a name="v_437"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0RC2 Build - 8th June 2004
+<br>Project org.eclipse.jdt.core v_437
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_437">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66142">66142</a>
+SearchParticipant#scheduleDocumentIndexing() fails silently if index doesn't exist
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65795">65795</a>
+source inclusion mechanism breaks type lookups
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=66099">66099</a>
+Persisted container/variable values are leaked throughout a session
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65250">65250</a>
+Problem selection does not choose first n errors
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65259">65259</a>
+CodeSelect should only find one match for dup methods
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65737">65737</a>
+Strange completion by code assist
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65871">65871</a>
+Missing SUPER_INTERFACE_TYPES_PROPERTY in EnumDeclaration
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53072">53072</a>
+[DOC] Search for fully qualified constructor name reports nothing
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65116">65116</a>
+IProjectDescription.getBuildSpec copies commands
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65234">65234</a>
+Inclusion filter not working
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64657">64657</a>
+better documentation for IType#resolveType behavior
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65693">65693</a>
+Package Explorer shows .class files instead of .java
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64750">64750</a>
+NPE in Java AST Creation - editing some random file
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65562">65562</a>
+Java AST creation failure
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65531">65531</a>
+out of the box formatter settings need to be improved
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65677">65677</a>
+Creating hierarchy failed. See log for details. 0
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=65090">65090</a>
+ASTParser with kind == K_STATEMENTS doesn't work unless source range specified
+
+<a name="v_436"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0RC1 Build - 28th May 2004 - 3.0 RELEASE CANDIDATE 1
+<br>Project org.eclipse.jdt.core v_436
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_436">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63534">63534</a>
+ConcurrentModificationException after "catching up"
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62131">62131</a>
+CodeStream should do bounds checks
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64470">64470</a>
+&lt;packages prefixes=..../&gt; should be removed
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64299">64299</a>
+NullPointerException when OverrideIndicatorLabelDecorator is decorating
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63550">63550</a>
+NPE "Java AST Creation"
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64421">64421</a>
+ArrayIndexOutOfBoundsException in PackageReferenceLocator.matchReportReference()
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62453">62453</a>
+Large File: Java builder not reacting on cancel
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64377">64377</a>
+CRASH: An internal error occurred during: "Java AST creation"
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64378">64378</a>
+Wording of error message
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64332">64332</a>
+Javadoc errors in non-API doc comments
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64329">64329</a>
+Missing Javadoc tags declaration in API methods
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=64170">64170</a>
+Classpath reentrance protection is not thread-safe
+
+<a name="v_435"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0RC1 Build - 27th May 2004
+<br>Project org.eclipse.jdt.core v_435
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_435">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>API polish on search matches (org.eclipse.jdt.core.search.SearchMatch hierarchy):
+<ul>
+<li>added setters for all match properties (not just length & offset)</li>
+<li>add insideDocComment argument to PackageReferenceMatch constructor (for
+being consistent with other reference matches)</li>
+</ul>
+See bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62697">62697</a> for more details.
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62854">62854</a>
+refactoring does not trigger reconcile
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62697">62697</a>
+Need to know if a package reference match is in Javadoc or in Code
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63756">63756</a>
+multiple builds early
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63077">63077</a>
+IllegalArgumentException in Openable.codeSelect
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62861">62861</a>
+ArrayIndexOutOfBoundsException in SearchableEnvironment
+
+
+<a name="v_434"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0RC1 Build - 26th May 2004
+<br>Project org.eclipse.jdt.core v_434
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_434">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=56870">56870</a>
+copied file not shown in package explorer / java browser [ccp]
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63748">63748</a>
+Type Hierarchy: null pointer when pressing F4 on ListCellRenderer
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38839">38839</a>
+org.eclipse.jdt.internal.compiler.parser.Scanner throws thousands of Exceptions
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62869">62869</a>
+[navigation] 'Go to Next Annotation' doesn't find next error
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63871">63871</a>
+Using M9, -warn: option crashes the batch compiler
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63434">63434</a>
+NPE during checkout/build
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62737">62737</a>
+Code formatter doesn't work on some files
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62639">62639</a>
+[1.5] Cheetah and extending Vector
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62769">62769</a>
+Javadoc errors in 200405180816
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62952">62952</a>
+Ant adapter behavior is a little strange
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62704">62704</a>
+Using 05180816, //toto is a task if //toto is a task tag.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51660">51660</a>
+[DOM/AST] AST.parse* should handle all legal doc tags
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51606">51606</a>
+Javadoc - {@inheritDoc} should be inefficient when not in first text element
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62713">62713</a>
+should not be able to nest output folders [build path]
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63245">63245</a>
+findPackageFragment won't return default package
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62698">62698</a>
+NPE while searching for declaration of binary package
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61017">61017</a>
+Refactoring - test case that results in uncompilable source
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=63044">63044</a>
+Reference to a constructor inside a javadoc should point to a type binding and not a constructor binding
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62812">62812</a>
+Some malformed javadoc tags are not reported as malformed
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62810">62810</a>
+Deadlock when closing editors and save
+
+
+<a name="v_433"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M9 Build - 21st May 2004 - 3.0 MILESTONE-9 / 3.0 RELEASE CANDIDATE 0
+<br>Project org.eclipse.jdt.core v_433
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_433">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>Put back test org.eclipse.jdt.core.tests.model.JavaElementDeltaTests.testBuildProjectUsedAsLib()
+after bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62927">62927</a> was fixed.
+</ul>
+
+<a name="v_432"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M9 Build - 20th May 2004
+<br>Project org.eclipse.jdt.core v_432
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_432">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>Excluded test org.eclipse.jdt.core.tests.model.JavaElementDeltaTests.testBuildProjectUsedAsLib()
+</ul>
+
+<a name="v_431"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M9 Build - 20th May 2004
+<br>Project org.eclipse.jdt.core v_431
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_431">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62881">62881</a>
+JDT/Core could be contributing a content type for JAR manifests
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58580">58580</a>
+VariableBinding.getVariableId() returns wrong IDs for nested types
+
+<a name="v_430"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M9 Build - 18th May 2004
+<br>Project org.eclipse.jdt.core v_430
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_430">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62608">62608</a>
+Include pattern ending with slash should include all subtree
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59933">59933</a>
+applying exclusion filter to opened java file makes it appear twice [build path]
+
+
+<a name="v_429"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M9 Build - 18th May 2004
+<br>Project org.eclipse.jdt.core v_429
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_429">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39499">39499</a>
+keyword completion does not work in anonymous inner classes
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59282">59282</a>
+Unable to include an external folder with class files to project classpath
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52422">52422</a>
+F3 can't find method def'n inside inner (anonymous) class
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62463">62463</a>
+Wrong length for ExpressionStatement after conversion
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61831">61831</a>
+Full build happens on every start of Eclipse
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62201">62201</a>
+NPE in MethodScope
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61872">61872</a>
+library looses content when setting source attachment
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54962">54962</a>
+plain reference to package not found in (@see) javadoc
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54424">54424</a>
+AST has structural problems with incomplete javadoc tags
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51951">51951</a>
+codeComplete finds no completion in method of local class inside static method
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50686">50686</a>
+NPE in MethodScope.createMethod
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61952">61952</a>
+Bad deprecation -- IJavaSearchConstants#CASE_SENSITIVE
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=62068">62068</a>
+Index manager should use client's index location
+
+<a name="v_428"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M9 Build - 13th May 2004
+<br>Project org.eclipse.jdt.core v_428
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_428">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li> Due to an implementation cleanup, the optional diagnosis for unnecessary empty statement or empty control-flow
+statement, will be reverted to ignore by default. If you did set it differently in the past, you will have to manually
+set it back. We now conform to the spec for this option (until JDT/UI converted, the old option ID was
+incorrectly used: "org.eclipse.jdt.core.compiler.problem.superfluousSemicolon"):
+<pre>
+* COMPILER / Reporting Empty Statements and Unnecessary Semicolons
+* When enabled, the compiler will issue an error or a warning if an empty statement or a
+* unnecessary semicolon is encountered.
+* - option id: "org.eclipse.jdt.core.compiler.problem.emptyStatement"
+* - possible values: { "error", "warning", "ignore" }
+* - default: "ignore"
+</pre>
+</li>
+<li>Improved error location when type indirectly referenced from required .class files.</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61959">61959</a>
+dangerous practice of catching Throwable
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61882">61882</a>
+Inconsistency between build errors and reconcile errors
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35356">35356</a>
+Convert local variable to field refactoring proposes weird name
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53555">53555</a>
+SourceType#get*QualifiedName() methods return unusable/invalid names for local types
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48752">48752</a>
+Completion: relevance could be improved for non static field
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61877">61877</a>
+ClassCastException in DefaultBindingResolver
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59769">59769</a>
+Javadoc of SearchMatch#getElement(): is *enclosing* element
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58440">58440</a>
+type hierarchy incomplete when implementing fully qualified interface
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61719">61719</a>
+Incorrect fine grain delta after method copy-rename
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61075">61075</a>
+[Compiler] implementation uses numerous ArrayIndexOutOfBoundsException
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=19898">19898</a>
+StackOverflowError in BinaryExpression
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61706">61706</a>
+Improve error message when unbound reference from binaries
+
+<a name="v_427"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M9 Build - 11th May 2004
+<br>Project org.eclipse.jdt.core v_427
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_427">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>A system job now reports progress when the indexer is running.</li>
+<li>The org.eclipse.jdt.core.jdom package has been deprecated. The JDOM was made obsolete by
+ the addition in 2.0 of the more powerful, fine-grained DOM/AST API found in the
+ org.eclipse.jdt.core.dom package.</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60689">60689</a>
+AST on reconcile: AST without Javadoc comments created
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60365">60365</a>
+hierarchy view shows some interfaces as classes [type hierarchy]
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53290">53290</a>
+[Javadoc] Compiler should complain when tag name is not correct
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53279">53279</a>
+[Javadoc] Compiler should complain when inline tag is not terminated
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51600">51600</a>
+Javadoc: tags with errors are not stored in DOM AST Javadoc hierarchy
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59751">59751</a>
+No Feedback/information from indexing
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42402">42402</a>
+OuterClass.this does not appear in code assist of the InnerClass
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61390">61390</a>
+Indexing thread grabbing resource lock
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61408">61408</a>
+Incorrect parsing
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58859">58859</a>
+[encoding] Editor does not detect BOM on .txt files
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61148">61148</a>
+deprecate JDOM API
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61270">61270</a>
+Wrong delta when copying a package that overrides another package
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61181">61181</a>
+Task tag starting with double-/ (//) causes compile error
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61040">61040</a>
+Should add protect for reentrance to #getResolvedClasspath
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61214">61214</a>
+The classpath computation inside the Java builder should get rid of duplicates entries
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60867">60867</a>
+LocalVariableReferenceMatch should offer isReadAccess(), etc.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59638">59638</a>
+ConcurrentModificationException in JavaModelManager.saving
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=61052">61052</a>
+Flatten cp container initialization
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60848">60848</a>
+[reconciling] Unclosed Comment in Java Texteditor
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60822">60822</a>
+Reacting to Project > Clean...
+
+<a name="v_426"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M9 Build - 4th May 2004
+<br>Project org.eclipse.jdt.core v_426
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_426">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Added new flag IJavaElementDelta.F_PRIMARY_RESOURCE that is set when the resource of a primary working copy
+ changes (or when it is added or removed).</li>
+<li>Removed dependency on org.eclipse.runtime.compatibility.</li>
+<li>Tuned the diagnosis for unnecessary else statements to tolerate else-if constructs.</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60687">60687</a>
+NPE in JavaCore.getEncoding
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60581">60581</a>
+"Java AST creation" error.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48502">48502</a>
+Exception during "Java AST creation"
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59750">59750</a>
+DCR: Code Assist: Hook to add getter and setters
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47227">47227</a>
+Syntax error diagnosis shouldn't expose internal goal tokens
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60595">60595</a>
+AST: AST from reconcile does not have 'ORIGINAL' bit set
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59500">59500</a>
+Java Model Notification needs notification that a java class was physically saved
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60459">60459</a>
+AST: 'malformed' flag overwrites other flags
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60367">60367</a>
+dynamic project references not maintained
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60257">60257</a>
+SearchPattern API: R_CASE_SENSITIVE vs. boolean isCaseSensitive
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58565">58565</a>
+code formatter doesn't format blocks with a return statement correctly
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58724">58724</a>
+Java code formatter should add space between imports and class definition
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60418">60418</a>
+remove warnings from core runtime deprecations
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57749">57749</a>
+Search in working copies doesn't find all matches
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60235">60235</a>
+WorkingCopyOwner needs clarification on
+
+
+<a name="v_425"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M9 Build - 28th April 2004
+<br>Project org.eclipse.jdt.core v_425
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_425">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Added API to register/deregister a pre-processing resource change listener:
+<pre>
+/**
+ * Adds the given listener for POST_CHANGE resource change events to the Java core.
+ * The listener is guarantied to be notified of the POST_CHANGE resource change event before
+ * the Java core starts processing the resource change event itself.
+ *
+ * Has no effect if an identical listener is already registered.
+ *
+ * @param listener the listener
+ * @see #removePreResourceChangeListener(IResourceChangeListener)
+ * @since 3.0
+ */
+public static void addPreProcessingResourceChangedListener(IResourceChangeListener listener);
+
+/**
+ * Removes the given pre-processing resource changed listener.
+ *
+ * Has no affect if an identical listener is not registered.
+ *
+ * @param listener the listener
+ * @since 3.0
+ */
+public static void removePreProcessingResourceChangedListener(IResourceChangeListener listener);
+</pre>
+</li>
+<li>When diagnostic for unnecessary semicolon is enabled, the compiler will also flag empty
+control-flow statement: e.g. if (bool);. Note that the naming of the option is going soon
+to be revised to better reflect this evolution.
+Empty control-flow statement problem ID is: <tt>IProblem.EmptyControlFlowStatement</tt>.
+</li>
+<li>Added compiler style option to report situation where a statement is unnecessarily nested
+in else clause, e.g.:
+<pre>
+ if (bool)
+ return;
+ else
+ System.out.println(); // no need to be inside else
+</pre>
+Associated problem ID is: <tt>IProblem.UnnecessaryElse</tt>.
+<pre>
+* COMPILER / Reporting Unnecessary Else
+* When enabled, the compiler will issue an error or a warning when a statement is unnecessarily
+* nested within an else clause (in situation where then clause is not completing normally).
+* - option id: "org.eclipse.jdt.core.compiler.problem.unnecessaryElse"
+* - possible values: { "error", "warning", "ignore" }
+* - default: "ignore"
+</pre>
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42493">42493</a>
+Error message when evaluating: Expressionopt?
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=32061">32061</a>
+No code assist in instance variable inner class
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49904">49904</a>
+[DCR] Quick Assist : unneeded else
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60081">60081</a>
+[Compiler] java.lang.VerifyError: Illegal target of jump or branch
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52805">52805</a>
+[DCR] Compiler should warn when using if (test);
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58652">58652</a>
+ImageBuilderInternalException during auto build
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60108">60108</a>
+SearchMatch should implement toString()
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=60078">60078</a>
+NPE in ASTConverter
+
+<a name="v_424"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M9 Build - 27th April 2004
+<br>Project org.eclipse.jdt.core v_424
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_424">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54108">54108</a>
+Weird piece of source code in SourceTypeConverter.java
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51500">51500</a>
+[DOM AST] Quick fix "Add unimplemented methods" fails on static variable initialized using anonymous constructor
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59843">59843</a>
+Eclipse 3.0M8 generates ambiguous keys from ITypeBindings for nested classes with the same name
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59937">59937</a>
+Should not process saved state delta during startup
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58069">58069</a>
+Compilation ERROR: Missing code implementation in the compiler
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51911">51911</a>
+@see method w/out ()
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49025">49025</a>
+Util.bind(String, String[]) can be optimized a little bit
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59743">59743</a>
+[Compiler] Incorrect diagnosis of ambiguous method when inheriting
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57871">57871</a>
+Override Indicator: blocks editor from opening when error occurs in java compiler
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59421">59421</a>
+Bad error message from Eclipse Java Compiler when file is missing
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58946">58946</a>
+Standalone compiler help text is incorrect on Unix
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59084">59084</a>
+[content type] ensure content types/file associations are contributed by the right plugins
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59716">59716</a>
+Using 200404201300, one more blank line is inserted in front of import declarations when no package is defined
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59575">59575</a>
+invalid formatting
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51213">51213</a>
+Unable to resolve conflict between type and package name in binaries
+
+<a name="v_423"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M9 Build - 22nd April 2004
+<br>Project org.eclipse.jdt.core v_423
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_423">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59363">59363</a>
+Should surface cancellation exceptions
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51075">51075</a>
+Compiler warning "is hiding a field" given for static inner class
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38658">38658</a>
+Search for existing type fails
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59291">59291</a>
+Deadlock between AllTypes cache and setClasspathContainer
+
+
+<a name="v_422"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M9 Build - 20th April 2004
+<br>Project org.eclipse.jdt.core v_422
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_422">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Added API for User Library Container support in JavaCore:
+<pre>
+
+/**
+ * Name of the User Library Container id.
+ */
+public static final String USER_LIBRARY_CONTAINER_ID= "org.eclipse.jdt.USER_LIBRARY"; //$NON-NLS-1$
+
+/**
+ * Returns the names of all defined user libraries. The corresponding classpath container path
+ * is the name appended to the USER_LIBRARY_CONTAINER_ID.
+ * @return Return an array containing the names of all known user defined.
+ */
+public static String[] getUserLibraryNames();
+</pre>
+</li>
+<li>Added API to get classpath container comparison ID in ClasspathContainerInitializer:
+<pre>
+/**
+ * Returns an object which identifies a container for comparison purpose. This allows
+ * to eliminate redundant containers when accumulating classpath entries (e.g.
+ * runtime classpath computation). When requesting a container comparison ID, one
+ * should ensure using its corresponding container initializer. Indeed, a random container
+ * initializer cannot be held responsible for determining comparison IDs for arbitrary
+ * containers.
+ * <p>
+ * @param containerPath the path of the container which is being checked
+ * @param project the project for which the container is to being checked
+ * @return returns an Object identifying the container for comparison
+ * @since 3.0
+ */
+public Object getComparisonID(IPath containerPath, IJavaProject project);
+</pre>
+By default, containers are identical if they have same container path first segment
+but this may be refined by other container initializer implementations.
+<br>
+For example, the User Library classpath container initializer added for User Library Container API
+implementation (UserLibraryClasspathContainerInitializer) refines the comparison ID to the entire container path.
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52747">52747</a>
+formatter - please special case empty array init
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=59000">59000</a>
+Code formatter struggles with end-of-line comments
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52679">52679</a>
+Code formatter formats braces in case and default statements, but no settings exist
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52940">52940</a>
+Formatter: Separate control of new lines in control statements by statement type
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47815">47815</a>
+Refactoring doesn't work with some project names [refactoring]
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37657">37657</a>
+[plan item] Improve code formatter
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50989">50989</a>
+Non-externalized strings wrap lines incorrectly
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57689">57689</a>
+ArrayIndexOutOfBoundsException when creating a new class
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55004">55004</a>
+[DCR] IVariableBinding should have a method returning the constant value
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=58606">58606</a>
+Inner class in child calling protected method in parent
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55979">55979</a>
+There are still deprecated formatter constants without new way
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57117">57117</a>
+Ant adapter preserves all deprecation when using compiler arg even if deprecation is set to off
+
+<a name="v_421"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M9 Build - 13th April 2004
+<br>Project org.eclipse.jdt.core v_421
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_421">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57829">57829</a>
+Should optimize assert true case
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57294">57294</a>
+Ignore serialVersionUID hiding another field
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41395">41395</a>
+StackOverflowError when pasting code
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57414">57414</a>
+Summary: GB18030: Can not open Java Search dialog.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57886">57886</a>
+Concurrency issue while initializing containers and variables
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57858">57858</a>
+[Compiler] Marking a field deprecated still report deprecated usage #46973
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57743">57743</a>
+[Compiler] invalid byte code produced when catching Throwable
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=57235">57235</a>
+DCR: AST Name.getQualifiedName()
+
+<a name="v_420"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M9 Build - 6th April 2004
+<br>Project org.eclipse.jdt.core v_420
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_420">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Added inclusion patterns support. See <code>JavaCore.newSourceEntry(IPath,IPath[],IPath[],IPath)</code>
+ and <code>IClasspathEntry.getInclusionPatterns()</code> for details.</li>
+<li>Added API on WorkingCopyOwner to set the primary buffer provider (for internal use by the jdt-related plug-ins only).
+<pre>
+/**
+ * Sets the buffer provider of the primary working copy owner. Note that even if the
+ * buffer provider is a working copy owner, only its createBuffer(ICompilationUnit)
+ * method is used by the primary working copy owner. It doesn't replace the internal primary
+ * working owner.
+ *
+ * This method is for internal use by the jdt-related plug-ins.
+ * Clients outside of the jdt should not reference this method.
+ *
+ * @param primaryBufferProvider the primary buffer provider
+ */
+public static void setPrimaryBufferProvider(WorkingCopyOwner primaryBufferProvider);
+</pre></li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54009">54009</a>
+jardesc should be known to Team/File Content
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51867">51867</a>
+An anonymous type is missing in type hierarchy when editor is modified
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54763">54763</a>
+[Compiler] Unnecessary cast not detected
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52347">52347</a>
+NPE in LaunchingPlugin.shutdown
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55992">55992</a>
+AssertionFailed during preference import
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=29964">29964</a>
+Add inclusion filter
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55088">55088</a>
+IAE when using ICU.reconcile(GET_AST_TRUE, ...)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=56462">56462</a>
+[formatter] java profile; array initializer before closing brace
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=56449">56449</a>
+Need to know if a reference match is in Javadoc or in Code
+
+<a name="v_419"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M9 Build - 30th March 2004
+<br>Project org.eclipse.jdt.core v_419
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_419">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Replaced "name" property of ParameterizedType node (DOM/AST)
+with "type" property. The old methods and fields (added earlier in 3.0 cycle)
+are deprecated and will be removed shortly.</li>
+<li>Added typeParameters property to ClassInstanceCreation node (DOM/AST).</li>
+<li>Package org.eclipse.jdt.core.internal.dom.rewrite renamed to org.eclipse.jdt.internal.core.dom.rewrite.</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=56316">56316</a>
+JavaProject exists should not populate
+
+<a name="v_418"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M8 Build - 25th March 2004 - 3.0 MILESTONE-8
+<br>Project org.eclipse.jdt.core v_418
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_418">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55930">55930</a>
+File encoding should be used on save
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55478">55478</a>
+Unused import not reported in IDE
+
+<a name="v_417"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M8 Build - 24th March 2004
+<br>Project org.eclipse.jdt.core v_417
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_417">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Removed failing tests re: encoding support.
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+
+<a name="v_416"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M8 Build - 23rd March 2004
+<br>Project org.eclipse.jdt.core v_416
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_416">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55504">55504</a>
+@<tasktag> should not be reported
+
+<a name="v_415"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M8 Build - 23rd March 2004
+<br>Project org.eclipse.jdt.core v_415
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_415">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li> Added rewriting support to DOM AST.
+There are two set of API to perform rewriting.
+<ul>
+<li>An AST-modifying rewrite API<br>
+To use the AST-modifying rewrite the client must create an AST from an existing
+compilation unit (ASTParser#createAST(...)).
+Then the client need to start the record process of the AST changes (CompilationUnit#recordModifications())
+and modify the AST after. When modifications are done, the client can call a method to
+compute a text edit tree containing all the text changes (CompilationUnit#rewrite()).
+
+<pre>
+CompilationUnit
+ public void recordModifications()
+ public TextEdit rewrite(IDocument document, Map options) throws RewriteException
+</pre>
+</li>
+<li>A describing rewrite API<br>
+To use the describing AST rewrite, the client starts with creating an instance of NewASTRewrite. Then the client
+must not modify the AST directly but use NewASTRewrite instead. When modifications are done, the client can call
+a method to compute a text edit tree containing all the text changes (NewASTRewrite#rewrite()).
+<pre>
+NewASTRewrite
+ public final void markAsRemoved(ASTNode node, TextEditGroup editGroup)
+ public final void markAsReplaced(ASTNode node, ASTNode replacingNode, TextEditGroup editGroup)
+ public ListRewriter getListRewrite(ASTNode parent, ChildListPropertyDescriptor childProperty)
+ public TextEdit rewriteAST(IDocument document, Map options) throws RewriteException
+ ...
+
+ListRewriter
+ remove(ASTNode, TextEditGroup)
+ public void replace(ASTNode, ASTNode, TextEditGroup)
+ public void insertAfter(ASTNode, ASTNode, TextEditGroup)
+ public void insertBefore(ASTNode, ASTNode, TextEditGroup)
+ public void insertFirst(ASTNode, TextEditGroup)
+ public void insertLast(ASTNode, TextEditGroup)
+ public void insertAt(ASTNode, int, TextEditGroup)
+ ...
+</pre>
+</li>
+</ul>
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39068">39068</a>
+Adopt new core API for encoding on a per file basis
+
+<a name="v_414"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M8 Build - 22nd March 2004
+<br>Project org.eclipse.jdt.core v_414
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_414">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46668">46668</a>
+Changes to class path containers should not change .project
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55421">55421</a>
+Cannot save a .java file in a non-java project anymore
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55223">55223</a>
+Bug in comment mapper: Same comment mapped to 2 statements
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54044">54044</a>
+Ant log does not use system newline character
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55372">55372</a>
+Should not assume that Preferences.defaultPropertyNames() returns default-default properties
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55221">55221</a>
+Bug in comment mapper: Grabs next node's Javadoc
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=55102">55102</a>
+NPE when using ICU.reconcile(GET_AST_TRUE, ...)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49986">49986</a>
+setRawClasspath(...) should fire a F_CLASSPATH_CHANGED delta
+
+<a name="v_413"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M8 Build - 15th March 2004
+<br>Project org.eclipse.jdt.core v_413
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_413">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li> Added compiler option JavaCore.COMPILER_TASK_CASE_SENSITIVE to control whether the task detection
+should be case sensitive or not. By default, it is.
+<pre>
+ * COMPILER / Determine whether task tags are case-sensitive
+ * When enabled, task tags are considered in a case-sensitive way.
+ * - option id: "org.eclipse.jdt.core.compiler.taskCaseSensitive"
+ * - possible values: { "enabled", "disabled" }
+ * - default: "enabled"
+</pre>
+</li>
+<li> Added 2 default task tags: "FIXME" and "XXX".
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54776">54776</a>
+DefaultCommentMapper: different behaviour
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54431">54431</a>
+ASTParser should honor set compiler options in all cases
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54043">54043</a>
+Problems with type hierarchy for binary types
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53095">53095</a>
+I20040225: Won't accept breakpoint on NoClassDefFoundError
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=54294">54294</a>
+No default for JavaCore.COMPILER_CODEGEN_INLINE_JSR_BYTECODE
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48435">48435</a>
+Java Search for OR-pattern finds too much in strange project setup
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40921">40921</a>
+Task tags should be case-insensitive
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49266">49266</a>
+FIXME task tag
+
+
+<a name="v_412"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M8 Build - 8th March 2004
+<br>Project org.eclipse.jdt.core v_412
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_412">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li> Added new global JavaCore.COMPILER_DOC_COMMENT_SUPPORT option for doc comment (Javadoc) support. By default, this option is enabled for backward compatibility.
+<pre>
+ * COMPILER / Javadoc Comment Support
+ * When this support is disabled, the compiler will ignore all javadoc problems options settings
+ * and will not report any javadoc problem. It will also not find any reference in javadoc comment and
+ * DOM AST Javadoc node will be only a flat text instead of having structured tag elements.
+ * - option id: "org.eclipse.jdt.core.compiler.doc.comment.support"
+ * - possible values: { "enabled", "disabled" }
+ * - default: "enabled"
+</pre>
+See bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52264">52264</a>.
+</li>
+<li> Added new JavaCore.COMPILER_CODEGEN_INLINE_JSR_BYTECODE option to allow user to inline subroutine code instead of generating JSR instructions. By default, this option is disabled.
+<pre>
+ * COMPILER / Inline JSR Bytecode Instruction
+ * When enabled, the compiler will no longer generate JSR instructions, but rather inline corresponding
+ * subroutine code sequences (mostly corresponding to try finally blocks). The generated code will thus
+ * get bigger, but will load faster on virtual machines since the verification process is then much simpler.
+ * This mode is anticipating support for the Java Specification Request 202.
+ * - option id: "org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode"
+ * - possible values: { "enabled", "disabled" }
+ * - default: "disabled"
+ *
+</pre>
+Corresponding command line compiler option <code>-noJSR</code> has been renamed to:
+<pre>
+ <code>-inlineJSR</code> : inline JSR bytecode
+</pre>
+which means that when specified, the compiler will no longer generate JSR bytecodes, but instead inlining the corresponding subroutine (e.g. finally block).
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53757">53757</a>
+Javadoc tag @transient ignored
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=530757">53075</a>
+https://bugs.eclipse.org/bugs/show_bug.cgi?id=53075
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53357">53357</a>
+Java AST creation error
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52264">52264</a>
+Need a global preference to enable Javadoc support
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51529">51529</a>
+"Organize imports" is confused by references inside Javadoc
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53477">53477</a>
+AnonymousClassDeclaration has wrong range
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53624">53624</a>
+StackOverFlow in Code assist
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50433">50433</a>
+Rationalize signatures of AST.parse* methods
+
+<a name="v_411"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M8 Build - 3rd March 2004
+<br>Project org.eclipse.jdt.core v_411
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_411">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Added new constant <code>IJavaElementDelta.F_CLASSPATH_CHANGED</code> that indicates that
+ the project's raw classpath has changed.
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49986">49986</a>
+setRawClasspath(...) should fire a F_CLASSPATH_CHANGED delta
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53242">53242</a>
+Consitent Out of Memory problems indexing (with multiple Java libraries)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52474">52474</a>
+UI Blocked when opening Java Perspective during CVS check out
+
+<a name="v_410"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M8 Build - 2nd March 2004
+<br>Project org.eclipse.jdt.core v_410
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_410">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Added following APIs to <code>org.eclipse.jdt.core.dom.CompilationUnit</code>:
+<ul>
+<li><code>getCommentList()</code>: Returns a list of the comments encountered while parsing the compilation unit.</li>
+<li><code>getExtendedStartPosition(ASTNode)</code>: Returns the extended start position of the given node.</li>
+<li><code>getExtendedLength(ASTNode)</code>: Returns the extended source length of the given node.</li>
+</li>
+</ul>
+Unlike <code>ASTNode#getStartPosition()</code> and <code>ASTNode#getLength()</code>, the extended source range may include
+comments and whitespace immediately before or after the normal source range for the node.
+<br>
+See bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53445">53445</a> for more details on heuristic to find leading and trailing comments.
+</li>
+<li>Added API <code>FieldReferenceMatch.isReadAccess()</code> and <code>isWriteAccess()</code>.
+<li>Added API <code>JavaCore.run(IWorkspaceRunnable action, ISchedulingRule rule, IProgressMonitor monitor)</code>
+ to control the scheduling rule during a Java batch operation.
+</li>
+<li>Added API <code>SearchEngine.createJavaSearchScope(IJavaElement[], int)</code> that allows to filter the
+ classpath entries added in the scope: SOURCES, APPLICATION_LIBRARIES, SYSTEM_LIBRARIES and REQUIRED_PROJECTS.
+</li>
+<li> New command line options for batch compiler:
+ <ul>
+ <li> <code>-maxProblems &lt;n&gt;</code> : max number of problems per compilation unit (100 by default) </li>
+ <li> <code>-noJSR</code> : do not use JSR bytecode </li>
+ </ul>
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53445">53445</a>
+[DCR] [DOM Comments] Provide extended ranges including leading/trailing comments for AST nodes
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=53276">53276</a>
+[DOM Comments] Wrong text element length when containing '\' character
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52908">52908</a>
+[DOM Comments] Wrong text element positions when starting/ending with { or }
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48337">48337</a>
+[Search] FieldReferenceMatch should report read/write access
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52691">52691</a>
+Add batch compiler option for maxProblemsPerUnit
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51045">51045</a>
+Offer to call JavaCore.run with scheduling rule
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52273">52273</a>
+Add option on predefined search scope to include/exclude system contain libraries
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49809">49809</a>
+NPE from MethodVerifier
+
+<a name="v_409"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M8 Build - 24th February 2004
+<br>Project org.eclipse.jdt.core v_409
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_409">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Added new API to create a DOM AST while reconciling
+ <code>ICompilationUnit.reconcile(boolean, boolean, WorkingCopyOwner, IProgressMonitor)</code>.
+</li>
+<li>Removed compiler support for deprecating jsr bytecode in 1.5 compliant mode (turned off until future release).
+</li>
+<li>The constant DefaultCodeFormatterConstants.FORMATTER_PRESERVE_USER_LINEBREAKS will be removed. It has been deprecated for now and
+has no effect in the UI anymore.
+</li>
+<li>The constant DefaultCodeFormatterConstants.FORMATTER_FILLING_SPACE will be removed. It has been deprecated for now and
+has no effect in the UI anymore.
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52916">52916</a>
+Strang error message when using jre1.5.0 libraries
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50586">50586</a>
+[Code Formatter] trim trailing blanks/whitespace
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52851">52851</a>
+Space before else should be removed in some cases
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52283">52283</a>
+do <single-statement> while(<condition>) is ill-formatted
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52479">52479</a>
+Code Format fails on not on-demand imports
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52246">52246</a>
+M7 Source formatter fails silently when assert present in source
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52429">52429</a>
+code formatter seems to ignore settings
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51623">51623</a>
+[formatter] Wrong formatting when "Preserve existing line breaks" switched on
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52305">52305</a>
+Code Formatter strips blank lines in methods and field definitions when I try to tell it not to
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52746">52746</a>
+Formatter - preserve line breaks conflicts with keep blank lines
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52804">52804</a>
+Deprecated formatter constant should indicate new way
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52619">52619</a>
+NPE running Java model tests
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36889">36889</a>
+[DCR] Keep AST created in reconcile for active editor
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52384">52384</a>
+OutOfMemoryError opening hierarchy on Object
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52355">52355</a>
+Not present exception trying to create a class in excluded package
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49809">49809</a>
+NPE from MethodVerifier
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=22104">22104</a>
+[infrastructure] NPE from IndexSummary.read(...)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=31013">31013</a>
+ [infrastructure] npe in index crash recovery
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=31014">31014</a>
+[infrastructure] exception in indexer
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51447">51447</a>
+[infrastructure] NPE running JDT Core tests
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52221">52221</a>
+[Compiler] should reject Local type usage when defined in other switch case block
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52216">52216</a>
+[regression in M7] javadoc: @see <a href> shows a warning
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51990">51990</a>
+'parameter' vs 'argument' in compiler errors/settings
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=52012">52012</a>
+Special 'serialPersistentFields' marked as 'never used locally'
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51353">51353</a>
+The type AbstractStringBuilder is not visible
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49259">49259</a>
+Task tags starting with TODO don't correctly display their priority in Tasks View
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49879">49879</a>
+java.lang.ClassCastException (SourceTypeBinding to a BinaryTypeBinding) in 30M6 within jdt.core.dom.TypeBinding.getKey(TypeBinding.java:411)
+
+<a name="v_408"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M7 Build - 12th February 2004 - 3.0 MILESTONE-7
+<br>Project org.eclipse.jdt.core v_408
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_408">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51603">51603</a>
+[preferences] Code formatter line wrapping preference inconsistent preview behaviour
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51476">51476</a>
+Javadoc: String or URL @see references are not stored in DOM AST Javadoc structure
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51478">51478</a>
+Javadoc: @deprecated/@inheritDoc tags are not stored in DOM AST Javadoc structure
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51508">51508</a>
+Javadoc: Package references DOM AST nodes binding is null
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51626">51626</a>
+Javadoc - DOM/AST is not correct after a @see tag
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51650">51650</a>
+Incorrected deprecation check
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51770">51770</a>
+Javadoc AST Node: wrong binding on qualified name part
+
+
+<a name="v_407"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M7 Build - 11th February 2004
+<br>Project org.eclipse.jdt.core v_407
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_407">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Fixed most of the API Java doc comments.
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51659">51659</a>
+New Code Formatter: minor problem with "White spaces/Array Initializers" option
+
+
+<a name="v_406"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M7 Build - 10th February 2004
+<br>Project org.eclipse.jdt.core v_406
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_406">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51035">51035</a>
+[Formatter] endline comment in case of simple if-then statement
+
+
+<a name="v_405"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M7 Build - 9th February 2004
+<br>Project org.eclipse.jdt.core v_405
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_405">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51363">51363</a>
+Wrong comment positions inside the Scanner.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51201">51201</a>
+Code formatter missing 'between empty brackets' option in Whitespace Array allocation configuration
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50695">50695</a>
+Javadoc: package reference in @see tags is wrongly warned
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49994">49994</a>
+Strange matches with start=0, end=1 in type reference search
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51300">51300</a>
+VerifyError when using a array reference assigned to null
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51128">51128</a>
+[Code Formatter] Indent statements within blocks and methods
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51241">51241</a>
+IllegalArgumentException while creating a DOM/AST
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51249">51249</a>
+Performance problems in PackageFragment.getPath
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50276">50276</a>
+Function call line wrapping fails on chained calls
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51190">51190</a>
+comment after else block goes to next line
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51226">51226</a>
+Javadoc inside DOM AST does not support starting characters in unicode
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51104">51104</a>
+Comments are not recorded when inside a method body
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50858">50858</a>
+Javadoc IProblem constant not defined
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50898">50898</a>
+Javadoc AST: Missing binding for reference to non-visible type
+
+<a name="v_404"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M7 Build - 3rd February 2004
+<br>Project org.eclipse.jdt.core v_404
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_404">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50938">50938</a>
+Javadoc AST: Still invalid range for embedded tag
+
+<a name="v_403"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M7 Build - 3rd February 2004
+<br>Project org.eclipse.jdt.core v_403
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_403">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Updated porting guide to introduce search participant story (see <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.jdt.core/notes/porting_guide.html">porting guide</a>)</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=51089">51089</a>
+Java AST creation failure
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50571">50571</a>
+search sender in hierarchy hangs
+
+<a name="v_402"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M7 Build - 30th January 2004
+<br>Project org.eclipse.jdt.core v_402
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_402">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50883">50883</a>
+Javadoc AST node: Range problem with embedded tags
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50884">50884</a>
+Compiler crashes without a trace in the log leaving workspace in unhappy state
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50831">50831</a>
+DCR Javadoc AST: Offer well known tag names as constants
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50880">50880</a>
+JavadocAST Nodes: Wrong ranges on link
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50877">50877</a>
+Javadoc AST Nodes: Wrong ranges
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47396">47396</a>
+JAVA AST Creation failure
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50844">50844</a>
+AbortCompilation thrown from Name#resolveBinding()
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50746">50746</a>
+Searching for variable references can cause an internal error
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50838">50838</a>
+Javadoc bindings: No bindings in constructor ref parameter
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50840">50840</a>
+Javadoc AST: wrong start position on MemberRef
+
+<a name="v_401"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M7 Build - 29th January 2004
+<br>Project org.eclipse.jdt.core v_401
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_401">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46126">46126</a>
+[DCR] IBinding should have a method to check @since javadoc tag
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50785">50785</a>
+Javadoc bindings: No bindings member refs
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50784">50784</a>
+Javadoc bindings: No binding in {@link } and link disturbs other bindings
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50781">50781</a>
+Javadoc bindings: No bindings for qualified names
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50736">50736</a>
+Out of bounds exception while formatting
+
+<a name="v_400"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M7 Build - 28th January 2004
+<br>Project org.eclipse.jdt.core v_400
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_400">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50694">50694</a>
+Javadoc: Cannot find DOM AST bindings for types in @see tags
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50692">50692</a>
+Javadoc: Cannot find DOM AST bindings for inline link tags references
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50719">50719</a>
+wrong formatting for java coding conventions
+
+<a name="v_399"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M7 Build - 27th January 2004
+<br>Project org.eclipse.jdt.core v_399
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_399">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Improve DOM/AST support for doc comments.
+<br>Following changes have been made to the DOM/AST API:
+<ul>
+<li>added Javadoc.tags() to represent structure of the doc comments</li>
+<li>deprecated Javadoc.get/setComment</li>
+<li>added 5 new node types that occur only within doc comments: TagElement, TextElement, MemberRef, MethodRef, MethodRefParameter</li>
+<li>tag elements like MemberRef, MethodRef, and Name can carry binding information (must be requested like elsewhere)</li>
+<li>added ASTVisitor(boolean) for controlling whether Javadoc.tags() are visited by default</li>
+<li>added ASTMatcher(boolean) for controlling whether Javadoc.tags() are compared vs. only Javadoc.getComment()</li>
+<li>AST.parse*(...) now returns structured doc comments (for compatibility, Javadoc.getComment() is also set as before)</li>
+</ul>
+See bugs <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50683">50683</a>.
+</li>
+<li>
+Improve DOM/AST support for locating all comments.
+<br>Following changes have been made to the DOM/AST API:
+<ul>
+<li>added CompilationUnit.getCommentTable() to record locations of all comments found in the source</li>
+<li>added 2 new node types, LineComment and BlockComment, to represent end-of-line and traditional comments respectively</li>
+<li>these new nodes are placeholders for comments</li>
+<li>these new node types only occur in the comment table (since they can occur anywhere (lexically), there is no way to properly parent them in the regular AST nodes that reflects their position)</li>
+<li>AST.parse*(...) now returns sets the comment table on the compilation unit to include all comments (including attached and free-floating doc comments)</li>
+</ul>
+See bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50697">50697</a>.
+</li>
+<li> Added option to control whether diagnosis for unused thrown exceptions should be enabled when overriding another
+method. By default, it is disabled.
+<pre>
+* COMPILER / Reporting Unused Declared Thrown Exception in Overridind Method
+* When disabled, the compiler will not include overriding methods in its diagnosis for unused declared
+* thrown exceptions.
+* The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException".
+* - option id: "org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding"
+* - possible values: { "enabled", "disabled" }
+* - default: "disabled"
+</pre>
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50644">50644</a>
+Deprecation check doesn't check that the @deprecated is at the beginning of the line
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=27134">27134</a>
+Add a ASTNode for non-Javadoc comments
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50683">50683</a>
+Improve DOM/AST support for doc comments
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50697">50697</a>
+Improve DOM/AST support for locating all comments
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50667">50667</a>
+Deadlock on Refactor -> Extract method
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47430">47430</a>
+the immutable bit is copied from the original resource to the ouput directory
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50601">50601</a>
+Blank lines before package declaration is one fewer than specified
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48292">48292</a>
+[DCR] Need AST.parsePartialClassFile(....)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50320">50320</a>
+Java model operations should use IResourceRuleFactory
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50207">50207</a>
+Compile errors fixed by 'refresh' do not reset problem list or package explorer error states
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49691">49691</a>
+JavaProject looses property listeners on preferences
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50265">50265</a>
+Emulate old formatter with the new formatter
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50225">50225</a>
+Calling the default formatter with an empty string returns an invalid Edit
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44876">44876</a>
+"Unnecessary declaration of thrown exception" problems
+
+
+<a name="v_398"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M7 Build - 20th January 2004
+<br>Project org.eclipse.jdt.core v_398
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_398">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Major renaming of constants in the code formatter. See <code>org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants</code>. See bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49908">49908</a>.
+The old constants have been deprecated and will be removed before M7. So we encourage you to save your code formatter preferences if
+you modified the default settings. The UI will provide an automatic conversion to the new options.
+</li>
+<li>Added API for alignment options in the code formatter. See <code>org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants</code>. See bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49968">49968</a>.
+</li>
+<li>Changed 3.0 APIs on <code>org.eclipse.jdt.core.dom.AST</code> to take an <code>IProgressMonitor</code>. This progress monitor is checked for the cancelation of the AST creation only.
+</li>
+<li>Added API on <code>org.eclipse.jdt.core.dom.AST</code> to parse an expression or statements or class body declarations without requiring the parsing
+of the whole compilation unit. This is still subject to change before 3.0.
+<pre>
+ /**
+ * Parses the given source between the bounds specified by the given offset (inclusive)
+ * and the given length and creates and returns a corresponding abstract syntax tree.
+ *
+ * The root node of the new AST depends on the given kind.
+ * - <code>org.eclipse.jdt.core.dom.AST.K_CLASS_BODY_DECLARATIONS</code>: The root node is an instance of
+ * <code>org.eclipse.jdt.core.dom.TypeDeclaration</code>. The type declaration itself doesn't contain any information.
+ * It is simply used to return all class body declarations inside the bodyDeclaratins() collection.
+ * - <code>org.eclipse.jdt.core.dom.AST.K_STATEMENTS</code>: The root node is an instance of
+ * <code>org.eclipse.jdt.core.dom.Block</code>. The block itself doesn't contain any information.
+ * It is simply used to return all the statements.
+ * - <code>org.eclipse.jdt.core.dom.AST.K_EXPRESSION</code>: The root node is an instance of a subclass of
+ * <code>org.eclipse.jdt.core.dom.Expression</code>.
+ *
+ * Each node in the subtree carries source range(s) information relating back
+ * to positions in the given source (the given source itself
+ * is not remembered with the AST).
+ * The source range usually begins at the first character of the first token
+ * corresponding to the node; leading whitespace and comments are <b>not</b>
+ * included. The source range usually extends through the last character of
+ * the last token corresponding to the node; trailing whitespace and
+ * comments are <b>not</b> included. There are a handful of exceptions
+ * (including compilation units and the various body declarations); the
+ * specification for these node type spells out the details.
+ * Source ranges nest properly: the source range for a child is always
+ * within the source range of its parent, and the source ranges of sibling
+ * nodes never overlap.
+ *
+ * This method does not compute binding information; all <code>resolveBinding</code>
+ * methods applied to nodes of the resulting AST return <code>null</code>.
+ *
+ * <code>null</code> is returned:
+ * 1. If a syntax error is detected while parsing,
+ * 2. If the given source doesn't correspond to the given kind.
+ *
+ * @param kind the given kind to parse
+ * @param source the string to be parsed
+ * @param offset the given offset
+ * @param length the given length
+ * @param options the given options. If null, <code>JavaCore.getOptions()</code> is used.
+ * @param monitor the progress monitor used to check if the AST creation needs to be canceled
+ *
+ * @return ASTNode
+ * @see ASTNode#getStartPosition()
+ * @see ASTNode#getLength()
+ * @see AST#K_CLASS_BODY_DECLARATIONS
+ * @see AST#K_EXPRESSION
+ * @see AST#K_STATEMENTS
+ * @see JavaCore#getOptions()
+ * @since 3.0
+ */
+ public static ASTNode parse(int kind, char[] source, int offset, int length, Map options, IProgressMonitor monitor);
+</pre>
+</li>
+<li>Added API on <code>org.eclipse.jdt.core.dom.AST</code> to parse a compilation unit and specify
+the set of options to use. This is still subject to change before 3.0. The previous API was directly
+using <code>JavaCore.getOptions()</code>. This could be problematic in case you want to parse assert
+statements.
+<pre>
+ /**
+ * Parses the given string as a Java compilation unit and creates and
+ * returns a corresponding abstract syntax tree.
+ *
+ * The given options are used to find out the compiler options to use while parsing.
+ * This could implies the settings for the assertion support. See the <code>JavaCore.getOptions()</code>
+ * methods for further details.
+ *
+ *
+ * The returned compilation unit node is the root node of a new AST.
+ * Each node in the subtree carries source range(s) information relating back
+ * to positions in the given source string (the given source string itself
+ * is not remembered with the AST).
+ * The source range usually begins at the first character of the first token
+ * corresponding to the node; leading whitespace and comments are <b>not</b>
+ * included. The source range usually extends through the last character of
+ * the last token corresponding to the node; trailing whitespace and
+ * comments are <b>not</b> included. There are a handful of exceptions
+ * (including compilation units and the various body declarations); the
+ * specification for these node type spells out the details.
+ * Source ranges nest properly: the source range for a child is always
+ * within the source range of its parent, and the source ranges of sibling
+ * nodes never overlap.
+ * If a syntax error is detected while parsing, the relevant node(s) of the
+ * tree will be flagged as <code>MALFORMED</code>.
+ *
+ *
+ * This method does not compute binding information; all <code>resolveBinding</code>
+ * methods applied to nodes of the resulting AST return <code>null</code>.
+ *
+ *
+ * @param source the string to be parsed as a Java compilation unit
+ * @param options options to use while parsing the file. If null, <code>JavaCore.getOptions()</code> is used.
+ * @param monitor the progress monitor used to check if the AST creation needs to be canceled
+ * @return CompilationUnit
+ * @see ASTNode#getFlags()
+ * @see ASTNode#MALFORMED
+ * @see ASTNode#getStartPosition()
+ * @see ASTNode#getLength()
+ * @see JavaCore#getOptions()
+ * @since 3.0
+ */
+ public static CompilationUnit parseCompilationUnit(char[] source, Map options, IProgressMonitor monitor);
+</pre>
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50258">50258</a>
+AST.parseCompilationUnit(... IWorkingCopyOwner..) should allow null
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49937">49937</a>
+JavaDoc of ITypeBinding#isLocal() talks about local interfaces
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49845">49845</a>
+DCR: Allow to cancel the AST creation
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48489">48489</a>
+[DCR] AST support for a single expression (vs. CU)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49327">49327</a>
+formatter can return null TextEdit when parsing valid java
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49908">49908</a>
+Renaming of DefaultCodeFormatterConstants.java
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49968">49968</a>
+[formatter] Alignment API
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49953">49953</a>
+[Code Formatter] Cannot customize the spaces around brackets in array allocation expression
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=50025">50025</a>
+uppercase ZIP and JAR classpath entries ignored
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45060">45060</a>
+Missing external jar prevents build, but jar still in Java model
+
+<a name="v_397"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M7 Build - 13th January 2004
+<br>Project org.eclipse.jdt.core v_397
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_397">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Added API to get the scheduling rule for a Java element:
+<pre>
+ /**
+ * Returns the scheduling rule associated with this Java element.
+ * This is a handle-only method.
+ *
+ * @return the scheduling rule associated with this Java element
+ * @since 3.0
+ */
+ ISchedulingRule getSchedulingRule();
+</pre>
+</li>
+<li>Code formatter: If you did change the value of the setting controlling the insertion of a white space between empty arguments of a method declaration,
+then you have to change it again. Indeed, a spelling mistake has been fixed in the constant name. See bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49530">49530</a>.</li>
+<li>Inline tags are now supported in Javadoc comments:
+<ul><li>{@link} and {@linkplain} tags are now parsed using same rules as for @see tag. See bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48385">48385</a>.
+<br>Because references declared in these tags should be now found during search operation, the index format had to be changed. Indexes will be automatically regenerated upon subsequent search queries (accounting for indexing notification in search progress dialogs).</li>
+<li>{@inheritDoc} tag is now parsed. When this tag is present in a method javadoc comment, all missing tags errors are ignored.
+See bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45782">45782</a>.</li>
+</ul>
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49843">49843</a>
+Not reporting error on constructor with no body
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49491">49491</a>
+Add option to toggle warning for Javadoc multiple same name @throws tags
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49260">49260</a>
+Malformed Javadoc Compiler option sensitive to line breaks
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45782">45782</a>
+[DCR] Compiler should take into account {@inheritDoc} tag
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48385">48385</a>
+[DCR] Need Javadoc warning for {@link }
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49760">49760</a>
+Splitting up FORMATTER_INSERT_SPACE_WITHIN_MESSAGE_SEND
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49763">49763</a>
+New formatter: Problem with empty statement in while
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48701">48701</a>
+NPE evaluating watch expression
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49290">49290</a>
+NullpointerException in TypeBinding.getInterfaces().
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49660">49660</a>
+Code formatter line wrapping indentation ignores whitespace settings
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48293">48293</a>
+[DCR] IJavaElement should implement ISchedulingRule
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48459">48459</a>
+NPE in Type hierarchy
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49653">49653</a>
+Unnecessary white space is added after last semicolon in for statement without increments
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49351">49351</a>
+New code formatter: left curly brace placement
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49530">49530</a>
+Spelling mistake in the FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_ARGUMENTS string constant
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49298">49298</a>
+Code formatter does not correctly space closing bracket on method calls
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48395">48395</a>
+Hierarchy on region misses local classes
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47743">47743</a>
+Open type hiearchy problems [type hierarchy]
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49571">49571</a>
+White space options for method and constructor declarations
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49577">49577</a>
+Add an option to specify the number of blank lines between two type declarations
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49551">49551</a>
+formatter fails on empty statement between package and imports
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39943">39943</a>
+[navigation] outliner auto-changes selection (multi-fields)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49490">49490</a>
+New Code Formatter; Java Coding Conventions; Blank Lines; Before first declaration
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49561">49561</a>
+Commit should only lock parent's folder
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47699">47699</a>
+Make org.eclipse.core.runtime.compatibility non optional
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41444">41444</a>
+[navigation] error dialog on opening class file
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48350">48350</a>
+IType#resolveType(String) fails on local types
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49120">49120</a>
+search doesn't find references to anonymous inner methods
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49482">49482</a>
+New Code Formatter; if/else without curly braces; guardian clause (2)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49481">49481</a>
+New Code Formatter; if/else without curly braces; guardian clause (1)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49361">49361</a>
+FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_ARRAY_INITIALIZER
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49243">49243</a>
+New code formatter: missing feature
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49429">49429</a>
+error during build
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48404">48404</a>
+formatter: no edit returned
+
+<a name="v_396"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M6 Build - 18th December 2003 - 3.0 MILESTONE-6
+<br>Project org.eclipse.jdt.core v_396
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_396">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=49081">49081</a>
+JDT is no more using the tab character by default for indentation
+
+<a name="v_395"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M6 Build - 17th December 2003
+<br>Project org.eclipse.jdt.core v_395
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_395">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48706">48706</a>
+NPE in move refactoring
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48965">48965</a>
+Javadoc problem preference settings: Use 'include' instead of 'ignore'
+
+<a name="v_394"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M6 Build - 16th December 2003
+<br>Project org.eclipse.jdt.core v_394
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_394">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47209">47209</a>
+Javadoc: Type references are not found in @see tag inside a method reference
+
+<a name="v_393"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M6 Build - 16th December 2003
+<br>Project org.eclipse.jdt.core v_393
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_393">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48818">48818</a>
+NPE in delta processor
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48711">48711</a>
+javadoc-warning if derived exception in @throws clause
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46040">46040</a>
+NPE in Eclipse console
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48725">48725</a>
+Cannot search for local vars in jars.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48749">48749</a>
+[Compiler] deprecation check in initializer fooled by trailing deprecated field decl
+
+
+<a name="v_392"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M6 Build - 15th December 2003
+<br>Project org.eclipse.jdt.core v_392
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_392">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li> Added option to avoid reporting a warning when overriding a deprecated method. By default, such
+warnings are no longer reported.
+<pre>
+ * COMPILER / Reporting Deprecation When Overriding Deprecated Method
+ * When enabled, the compiler will signal the declaration of a method overriding a deprecated one.
+ * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.deprecation".
+ * - option id: "org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod"
+ * - possible values: { "enabled", "disabled" }
+ * - default: "disabled"
+</pre>
+<li>Compiler options to signal problems with javadoc comments have been improved. User can now decide to report
+independently problems on invalid tags (syntax and references), missing tags and missing comments.
+Invalid references, missing tags or missing comments problem can be now ignored below a specific visibility level.
+Finally, user will also have the possibility to ignore missing tags and missing comments on overriding methods
+(assuming that complete Javadoc comments is done in superclass or interface declaration).
+<br>
+Here's the complete list of these options:
+<pre>
+ * COMPILER / Reporting Invalid Javadoc Comment
+ * This is the generic control for the severity of Javadoc problems.
+ * When enabled, the compiler will issue an error or a warning for a problem in Javadoc.
+ * - option id: "org.eclipse.jdt.core.compiler.problem.invalidJavadoc"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "ignore"
+ *
+ * COMPILER / Visibility Level For Invalid Javadoc Tags
+ * Set the minimum visibility level for Javadoc tag problems. Below this level problems will be ignored.
+ * - option id: "org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility"
+ * - possible values: { "public", "protected", "default", "private" }
+ * - default: "private"
+ *
+ * COMPILER / Reporting Invalid Javadoc Tags
+ * When enabled, the compiler will signal unbound or unexpected reference tags in Javadoc.
+ * A 'throws' tag referencing an undeclared exception would be considered as unexpected.
+ * <br>Note that this diagnosis can be enabled based on the visibility of the construct associated with the Javadoc;
+ * also see the setting "org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility".
+ * <br>
+ * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.invalidJavadoc".
+ * - option id: "org.eclipse.jdt.core.compiler.problem.invalidJavadocTags"
+ * - possible values: { "disabled", "enabled" }
+ * - default: "enabled"
+ *
+ * COMPILER / Reporting Missing Javadoc Tags
+ * This is the generic control for the severity of Javadoc missing tag problems.
+ * When enabled, the compiler will issue an error or a warning when tags are missing in Javadoc comments.
+ * <br>Note that this diagnosis can be enabled based on the visibility of the construct associated with the Javadoc;
+ * also see the setting "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility".
+ * <br>
+ * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocTags"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "ignore"
+ *
+ * COMPILER / Visibility Level For Missing Javadoc Tags
+ * Set the minimum visibility level for Javadoc missing tag problems. Below this level problems will be ignored.
+ * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility"
+ * - possible values: { "public", "protected", "default", "private" }
+ * - default: "private"
+ *
+ * COMPILER / Reporting Missing Javadoc Tags on Overriding Methods
+ * Specify whether the compiler will verify overriding methods in order to report Javadoc missing tag problems.
+ * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding"
+ * - possible values: { "enabled", "disabled" }
+ * - default: "enabled"
+ *
+ * COMPILER / Reporting Missing Javadoc Comments
+ * This is the generic control for the severity of missing Javadoc comment problems.
+ * When enabled, the compiler will issue an error or a warning when Javadoc comments are missing.
+ * <br>Note that this diagnosis can be enabled based on the visibility of the construct associated with the expected Javadoc;
+ * also see the setting "org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility".
+ * <br>
+ * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocComments"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "ignore"
+ *
+ * COMPILER / Visibility Level For Missing Javadoc Comments
+ * Set the minimum visibility level for missing Javadoc problems. Below this level problems will be ignored.
+ * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility"
+ * - possible values: { "public", "protected", "default", "private" }
+ * - default: "public"
+ *
+ * COMPILER / Reporting Missing Javadoc Comments on Overriding Methods
+ * Specify whether the compiler will verify overriding methods in order to report missing Javadoc comment problems.
+ * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding"
+ * - possible values: { "enabled", "disabled" }
+ * - default: "enabled"
+ *
+</pre>
+Note that backward compatibility with previous options IDs: <code>"org.eclipse.jdt.core.compiler.problem.missingJavadoc"</code>
+will be supported until 3.0M7 build and removed after.
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47214">47214</a>
+Cannot open declaration on a selected method of an anonymous class
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47795">47795</a>
+NPE selecting method in anonymous 2 level deep
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48335">48335</a>
+[Compiler] Need option to not report deprecation in override scenarii
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48523">48523</a>
+@throws reference incorrectly warned as not declared
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47940">47940</a>
+Unable to control level of JavaDoc errors
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47319">47319</a>
+Compiler warns on missing Javadoc tags for private methods.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46976">46976</a>
+Do not warn about 'Missing Javadoc' for overriding methods
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46854">46854</a>
+[DCR] Javadoc configuration setting needs more flexibility
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48617">48617</a>
+Error range for unresolved names in qualified references
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48333">48333</a>
+[Compiler] Implicit deprecation isn't propagated to anonymous type
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46084">46084</a>
+ArrayIndexOutOfBoundsException in compiler after feeding with non-real java code
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43354">43354</a>
+CodeAssist relevance should privilege package completion over type name
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48422">48422</a>
+Calling isStructureKnown() on ILocalVaraible throws JavaModelExceptions
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48261">48261</a>
+Search does not show results
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47213">47213</a>
+Inefficient recursion while initializing classpath container
+
+<a name="v_391"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M6 Build - 10th December 2003
+<br>Project org.eclipse.jdt.core v_391
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_391">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>We reverted back the behavior when using the class literal. See bugs <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=37565">37565</a> and
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48086">48086</a>. As long as javac doesn't clarify this case, we keep
+the old behavior.</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48086">48086</a>
+Compiler does not resolve references in static init blocks correctly
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48353">48353</a>
+Indexes deleted on shutdown
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42579">42579</a>
+Eclipse allows setting a source folder's parent as output folder, which wipes out source code
+
+<a name="v_390"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M6 Build - 9th December 2003
+<br>Project org.eclipse.jdt.core v_390
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_390">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>The classpath validation rules now allow an excluded directory to be used as an output location.
+Remember that a source folder can be associated with exclusion rules so as to eliminate portions of the
+source tree. Nested source/library entries were already allowed given proper exclusion rules were specified,
+now we also enable nesting an output folder as well under the same restrictions.
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47338">47338</a>
+CCE in CompletionParser
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45589">45589</a>
+Too many Util classes in JDTCore
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39539">39539</a>
+Cannot select excluded directory as output folder for class files
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48070">48070</a>
+[CodeAssist] ArrayIndexOutOfBoundsException in AssistParster
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48167">48167</a>
+Indentation/line wrapping problems with array initializers
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=32022">32022</a>
+Indirect static proposal: Wrong compiler positions
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48141">48141</a>
+Formatter: Java Conventions/WS/Expressions/Operators
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45157">45157</a>
+Source Formatter: Clear all Blank lines needs to have the ability to set a number of lines to keep.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44673">44673</a>
+Formatting
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38523">38523</a>
+so add "Insert new line after each parameter if line is too long" checkbox to Preferences > Java > Code Formatter > New Lines
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=34897">34897</a>
+Code Formatter feature request
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46937">46937</a>
+[Compiler] Marking a field deprecated still report deprecated usage
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47989">47989</a>
+Exception when searching for IPackageFragment "java.util.zip"
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47997">47997</a>
+No empty line after opening brace [formatter]
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48064">48064</a>
+Javadoc: NPE during build process
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44815">44815</a>
+Continuation indent for array initializer should be customizable
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44813">44813</a>
+Option "Insert new line before an open brace" should work also for array initializers
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43212">43212</a>
+catch variable not recognized by code-completion
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46060">46060</a>
+regression - content assist fails to present proposal
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47918">47918</a>
+New code Formatter
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47968">47968</a>
+Cannot find @see references in Class javadoc comment
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47909">47909</a>
+Javadoc: NPE while searching a constructor references in jdt-core
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47986">47986</a>
+Formatting of 'for' initializers
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47976">47976</a>
+Implementation of IField.getConstant() fails for some constants
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47886">47886</a>
+[Compiler] ACC_SUPER bit sets for interfaces
+
+<a name="v_389"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M6 Build - 2nd December 2003
+<br>Project org.eclipse.jdt.core v_389
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_389">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Spec and implementation for <code>ITypeBinding.getBinaryName()</code> was changed to be '.' separated:
+<pre>
+ /**
+ * Returns the binary name of this type binding.
+ * The binary name of a class is defined in the Java Language
+ * Specification 2nd edition, section 13.1.
+ *
+ * Note that in some cases, the binary name may be unavailable.
+ * This may happen, for example, for a local type declared in
+ * unreachable code.
+ *
+ * @return the binary name of this type, or null
+ * if the binary name is unknown
+ * @since 3.0
+ */
+public String getBinaryName();
+</pre>
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47881">47881</a>
+[Compiler] x && false evaluates to "true"
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47802">47802</a>
+New Code Formatter: NEXT_PER_LINE_SPLIT
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47811">47811</a>
+New Code Formatter: doesn't handle several classes per CU
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47801">47801</a>
+New Code Formatter: INSERT_SPACE_AFTER_PREFIX_OPERATOR
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47800">47800</a>
+New Code Formatter: BINARY_EXPRESSION_ALIGNMENT
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47799">47799</a>
+New Code Formatter: PUT_EMPTY_STATEMENT_ON_NEW_LINE
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47776">47776</a>
+java.lang.VerifyError / Illegal target of jump or branch compiling with 3.0 M5
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47341">47341</a>
+Javadoc problem for @see to protected method
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47339">47339</a>
+Javadoc problem while using @see tag
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47132">47132</a>
+Javadoc for method in anonymous type should not be mark as missing
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47215">47215</a>
+Javadoc: type reference in @see tag ignore the following text
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46761">46761</a>
+Search for references: misses match in Javadoc
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46675">46675</a>
+[Compiler] NullPointerException with ? operator
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35220">35220</a>
+CodeAssist - method of anonymous type should not be proposed
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47631">47631</a>
+PerThreadObject (JavaModelManager.deltaState) leaks Threads.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46470">46470</a>
+Wrong completion after a switch
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35232">35232</a>
+CodeAssist - wrong completion for static method in anonymous type
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47401">47401</a>
+Wrong code assist proposals in anonymous class
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47443">47443</a>
+All projects touched on startup
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44493">44493</a>
+Improve formatting of throws clauses
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44765">44765</a>
+New formatter not properly formatting long method invocation
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44653">44653</a>
+// $NON-NLS-1$ comments not kept on same line of the string while formatting
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46699">46699</a>
+IBinding.isSynthetic() returns false for compiler-generated constructor
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47415">47415</a>
+[Search] package references confused with multiple fragments
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38679">38679</a>
+Search for class ref shows local class containing a match on an import [search]
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47049">47049</a>
+[Builder] Build output folder not getting flushed because files are not marked as derived
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46613">46613</a>
+AST nodes and string buffers
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47396">47396</a>
+JAVA AST Creation failure
+
+<a name="v_388"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M6 Build - 25th November 2003
+<br>Project org.eclipse.jdt.core v_388
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_388">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47082">47082</a>
+[Compiler] Problem with final variable initialization
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47180">47180</a>
+Merge different type declarations into one class
+
+
+<a name="v_387"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M5 Build - 21st November 2003 - 3.0 MILESTONE-5
+<br>Project org.eclipse.jdt.core v_387
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_387">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44397">44397</a>
+Search doesn't find references to local types
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46571">46571</a>
+Searching for all occurrences for method declarated in local types doesn't wor
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46943">46943</a>
+refactoring: encapsulate field of local type: references from enclosing type are not replaced by setter
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47180">47180</a>
+NPE in Delta Processor
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46788">46788</a>
+Export scripts: shouldn't use variable name version
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47160">47160</a>
+ArrayIndexOutOfBoundsException from CodeSnippetParser
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47177">47177</a>
+ClassCastException during hover
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47079">47079</a>
+[Builder] suspicious side-effects during incremental compile
+
+<a name="v_386"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M5 Build - 20th November 2003
+<br>Project org.eclipse.jdt.core v_386
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_386">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Removed APIs that create an <code>ICompilationUnit</code> handle given a <code>WorkingCopyOwner</code>
+ as these can be replaced with <code>ICompilationUnit.findWorkingCopy(WorkingCopyOwner)</code>:
+ <ul>
+ <li><code>IPackageFragment.getCompilationUnit(String, WorkingCopyOwner)</code></li>
+ <li><code>JavaCore.create(IFile, WorkingCopyOwner)</code></li>
+ <li><code>JavaCore.create(IResource, WorkingCopyOwner)</code></li>
+ <li><code>JavaCore.createCompilationUnitFrom(IFile, WorkingCopyOwner)</code></li>
+ <li><code>IDOMCompilationUnit.getCompilationUnit(IPackageFragment, WorkingCopyOwner)</code></li>
+ </ul>
+ <br>
+</li>
+<li>Added API on <code>ICompilationUnit</code> to find an existing working copy given a working
+ copy owner (it replaces <code>IWorkingCopy.findSharedWorkingCopy(IBufferFactory)</code>):
+<pre>
+/**
+ * Finds the working copy for this compilation unit, given a <code>WorkingCopyOwner</code>.
+ * If no working copy has been created for this compilation unit associated with this
+ * working copy owner, returns <code>null</code>.
+ *
+ * Users of this method must not destroy the resulting working copy.
+ *
+ * @param owner the given <code>WorkingCopyOwner</code>
+ * @return the found working copy for this compilation unit, <code>null</code> if none
+ * @see WorkingCopyOwner
+ * @since 3.0
+ */
+ICompilationUnit findWorkingCopy(WorkingCopyOwner owner);
+</pre>
+</li>
+<li>Added API on <code>IClassFile</code> to create a working copy on a class file (it replaces
+ <code>IClassFile.getWorkingCopy(IProgressMonitor, IBufferFactory)</code>):
+<pre>
+/**
+ * Returns a working copy on the source associated with this class file using the given
+ * owner to create the buffer, or <code>null</code> if there is no source associated
+ * with the class file.
+ *
+ * The buffer will be automatically initialized with the source of the class file
+ * upon creation.
+ *
+ * The only valid operations on this working copy are <code>getBuffer()</code> or <code>getPrimary()</code>.
+ *
+ * @param owner the owner that creates a buffer that is used to get the content of the working copy
+ * or <code>null</code> if the primary owner should be used
+ * @param monitor a progress monitor used to report progress while opening this compilation unit
+ * or <code>null</code> if no progress should be reported
+ * @return a a working copy on the source associated with this class file
+ * @exception JavaModelException if the source of this class file can
+ * not be determined. Reasons include:
+ * - This class file does not exist (ELEMENT_DOES_NOT_EXIST)
+ * @since 3.0
+ */
+ICompilationUnit getWorkingCopy(WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException;
+</pre>
+</li>
+<li>Added API on <code>ITypeBinding</code> to get the binary name of a type binding:
+<pre>
+/**
+ * Returns the binary name (as defined in the Java Language
+ * Specification Chapter 13 Section 1) of this type binding.
+ * It is however slash ('/') separated instead of dot ('.') separated as said
+ * in the specification.
+ * Returns <code>null</code> if the type is defined in code that is unreachable.
+ *
+ * @return the binary name of this type or <code>null</code> if this type is unreachable
+ */
+String getBinaryName();
+</pre>
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46012">46012</a>
+IllegalArgumentException in StringLiteral
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46769">46769</a>
+NPE in PatternLocator.qualifiedSourceName
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=47074">47074</a>
+inability to detect invalid cast between interfaces
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057">46057</a>
+need mechanism for retrieving the name of anonymous and local classes
+
+<a name="v_385"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M5 Build - 19th November 2003
+<br>Project org.eclipse.jdt.core v_385
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_385">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46964">46964</a>
+Can not set Javadoc compiler setting
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46901">46901</a>
+Strange compile error in javadoc
+
+<a name="v_384"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M5 Build - 19th November 2003
+<br>Project org.eclipse.jdt.core v_384
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_384">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Added API on <code>ICompilationUnit</code> to query whether the working copy's resource has changed
+ (it replaces <code>IWorkingCopy.isBasedOn(IResource)</code>):
+<pre>
+/**
+ * Returns whether the resource of this working copy has changed since the
+ * inception of this working copy.
+ * Returns <code>false</code> if this compilation unit is not in working copy mode.
+ *
+ * @return whether the resource has changed
+ * @since 3.0
+ */
+public boolean hasResourceChanged();
+</pre>
+</li>
+<li>Added APIs on <code>IType</code> to create hierarchies using <code>ICompilationUnits</code> instead of
+ <code>IWorkingCopies</code>:
+<pre>
+/**
+ * Creates and returns a type hierarchy for this type containing
+ * this type and all of its supertypes, considering types in the given
+ * working copies. In other words, the list of working copies will take
+ * precedence over their original compilation units in the workspace.
+ *
+ * Note that passing an empty working copy will be as if the original compilation
+ * unit had been deleted.
+ *
+ * @param workingCopies the working copies that take precedence over their original compilation units
+ * @param monitor the given progress monitor
+ * @return a type hierarchy for this type containing this type and all of its supertypes
+ * @exception JavaModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ * @since 3.0
+ */
+ITypeHierarchy newSupertypeHierarchy(ICompilationUnit[] workingCopies, IProgressMonitor monitor) throws JavaModelException;
+
+/**
+ * Creates and returns a type hierarchy for this type containing
+ * this type, all of its supertypes, and all its subtypes in the workspace,
+ * considering types in the given working copies. In other words, the list of working
+ * copies that will take precedence over their original compilation units in the workspace.
+ *
+ * Note that passing an empty working copy will be as if the original compilation
+ * unit had been deleted.
+ *
+ * @param workingCopies the working copies that take precedence over their original compilation units
+ * @param monitor the given progress monitor
+ * @return a type hierarchy for this type containing
+ * this type, all of its supertypes, and all its subtypes in the workspace
+ * @exception JavaModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ * @since 3.0
+ */
+ITypeHierarchy newTypeHierarchy(ICompilationUnit[] workingCopies, IProgressMonitor monitor) throws JavaModelException;
+</pre>
+<li>Added API on <code>SearchEngine</code> to create a search engine using
+ <code>ICompilationUnits</code> instead of <code>IWorkingCopies</code>:
+<pre>
+/**
+ * Creates a new search engine with a list of working copies that will take precedence over
+ * their original compilation units in the subsequent search operations.
+ *
+ * Note that passing an empty working copy will be as if the original compilation
+ * unit had been deleted.
+ *
+ * Since 3.0 the given working copies take precedence over primary working copies (if any).
+ *
+ * @param workingCopies the working copies that take precedence over their original compilation units
+ * @since 3.0
+ */
+public SearchEngine(ICompilationUnit[] workingCopies) {...}
+</pre>
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+
+<a name="v_383"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M5 Build - 18th November 2003
+<br>Project org.eclipse.jdt.core v_383
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_383">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>To avoid confusion with annotations introduced in JDK 1.5 grammar, all internal references to "annotation" (added to handle Javadoc comments)
+got renamed into "Javadoc". As a consequence of this is that IDs for optional Javadoc problems have been updated accordingly:
+<pre>
+ * COMPILER / Reporting Invalid Javadoc Comment
+ * When enabled, the compiler will issue an error or a warning when a javadoc comment is inconsistent,
+ * misses a tag entry or contains invalid references.
+ * - option id: "org.eclipse.jdt.core.compiler.problem.invalidJavadoc"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "ignore"
+ * COMPILER / Reporting Missing Javadoc Comment
+ * When enabled, the compiler will signal cases where public class, interface, method, constructor or field
+ * (considered as part of the API) has no javadoc comment.
+ * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.invalidJavadoc".
+ * - option id: "org.eclipse.jdt.core.compiler.problem.missingJavadoc"
+ * - possible values: { "enabled", "disabled" }
+ * - default: "disabled"
+</pre>
+Note that backward compatibility with previous options IDs: <code>"org.eclipse.jdt.core.compiler.problem.invalidAnnotation"</code> and <code>"org.eclipse.jdt.core.compiler.problem.missingAnnotation"</code>
+will be supported until 3.0M6 build and removed after.
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46717">46717</a>
+The code formatter does not insert a new line before /** Javadoc
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45958">45958</a>
+Compiler wrongly complains against valid @see constructor reference
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45112">45112</a>
+Use Javadoc instead of Annotation for comment compiler parsing
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46052">46052</a>
+result of ITypeHierarchy.getAllSuperTypes() does not include Object
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46192">46192</a>
+ILocalVariable.exists() always returns false
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=14103">14103</a>
+[Builder] Too many dependents found when incrementally recompiling
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39601">39601</a>
+[DOM/AST] clarify documentation of source ranges
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39739">39739</a>
+[DOM/AST] VariableDeclarationStatements aren't full statements
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46690">46690</a>
+Code formatter always inserts space after comma in multiple locals or field declarations
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46689">46689</a>
+Code formatter always inserts a space in front of the '-' unary operator
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46686">46686</a>
+Code formatter doesn't indent properly statements following a switch statement
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46356">46356</a>
+[Builder] simple/qualified names list for indicting dependents should be hashed collections
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46612">46612</a>
+[DOM/AST] BodyDeclaration should provide a method getModifiers
+
+<a name="v_382"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M5 Build - 10th November 2003
+<br>Project org.eclipse.jdt.core v_382
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_382">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46276">46276</a>
+Search for package declarations incorrectly finds matches in clone project
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46099">46099</a>
+Batch compiler doesn't print stats if errors and not proceeding on errors
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40950">40950</a>
+[infrastructure] NPE from indexer
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46150">46150</a>
+formatter failed to format
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013">46013</a>
+IBinding.getKey() for local shouldn't return null
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46033">46033</a>
+New formatter not formatting nested constructor/methods properly
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=46093">46093</a>
+[Builder] Unoptimal pre-check for not writing class files
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45847">45847</a>
+[Builder] Reading build state is slow
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45982">45982</a>
+Array out of bounds error while editing Java file
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41611">41611</a>
+CreateCompilationUnitOperation.executeOperation() should probably force creation more agressively
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45113">45113</a>
+No hierarchy refresh when on region
+
+
+<a name="v_381"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M5 Build - 4th November 2003
+<br>Project org.eclipse.jdt.core v_381
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_381">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45968">45968</a>
+[new formatter] Formatter introduces empty lines inside line comments
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44450">44450</a>
+Strange name range for anonymous classes.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43139">43139</a>
+Delete member in Outliner not working
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45944">45944</a>
+Stack trace attempting to find markers on a closed project
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44884">44884</a>
+Wrong list displayed while code completion
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45661">45661</a>
+Search for references of default package fails
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45671">45671</a>
+Need source range and getTypeSignature() for local variables
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45575">45575</a>
+Failure in nightly build of formatter tests (test325)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45783">45783</a>
+NPE in MatchLocator
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=22073">22073</a>
+Each "format" adds one more level of indentation.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=23709">23709</a>
+for (/*comment*/; causes indentation to misbehave
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=27249">27249</a>
+incorrect formatting of empty array initialization blocks
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=29473">29473</a>
+wrong formatting of if...try... catch... else
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45786">45786</a>
+No selection on method declaration in field initializer
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45721">45721</a>
+Getting wrong deltas
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45674">45674</a>
+Compiler should allow compound assignment to final in unreachable code
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43984">43984</a>
+NPE in background search
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45707">45707</a>
+Autobuild does not kick in when using classpath containers
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45655">45655</a>
+exception while editing java file
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42287">42287</a>
+Should consider qualified name token positions
+
+<a name="v_380"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M5 Build - 28th October 2003
+<br>Project org.eclipse.jdt.core v_380
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_380">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Search is now able to find local variable references and declarations. In order to trigger such a search, the search engine must
+ be fed with an <code>ILocalVariable</code> element. Searching a local variable by its name is not supported.
+</li>
+<li>Search is now finding references in Javadoc comments. Found references are method parameters declared in <code>@param</code> tags,
+ types of exceptions declared in <code>@throws</code>/<code>@exception</code> tags and all instance variables, methods, types or
+ packages declared in <code>@see</code> tags.
+ <br>Note that only valid references in Javadoc comments will be reported during search. In order to ensure the integrity of your Javadoc comments,
+ you may want to enable the compiler check for Javadoc (Preferences>Java>Compiler>Style>Problem in Javadoc tags).
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45641">45641</a>
+CCE when using declarations view
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45596">45596</a>
+Wrongly complains about missing parameter javadoc entry in anonymous class
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45592">45592</a>
+NPE while searching a method references in jdt-core
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45520">45520</a>
+Potential NPE
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45518">45518</a>
+Search has to find references put in javadoc comments
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45436">45436</a>
+Javadoc warnings: wrong errors in AST
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45198">45198</a>
+NPE from AnnotationParser
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45459">45459</a>
+JDT compiler more restrictive than javac
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35899">35899</a>
+"hierarchy of type ... inconsistent" error message wrong
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43967">43967</a>
+Search for references on local variable finds all occurances of variables of that type not just that variable.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37509">37509</a>
+Open Declaration opens class declaration for local variables
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45433">45433</a>
+Bug7 (and counting ;-): hundretAssignmentsToFinalVariable()
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45357">45357</a>
+Compiler-Bug: "The local variable oResult may not have been initialized".txt
+
+<a name="v_379"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M5 Build - 21st October 2003
+<br>Project org.eclipse.jdt.core v_379
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_379">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li> Compiler options for controlling the severity of problems for invalid imports or unreachable code got discontinued. Indeed, allowing this kind of problems to be ignored
+or treated as a warning would violate the language spec. As a consequence, <code>JavaCore#COMPILER_PB_INVALID_IMPORT</code> and
+<code>JavaCore#COMPILER_PB_UNREACHABLE_CODE</code> got deprecated,
+further attempts to set these preferences are now ignored and import problems or unreachable code are always reported as errors.
+<li> The warning level of the batch compiler can now be configured more easily using <code>-warn:+...</code> or <code>-warn:-...</code> command line
+argument (as opposed to only existing <code>-warn:...</code> command line argument).
+<code>-warn:+...</code> will not override the default warning level, but simply enable
+a few more specific warnings. Similarily, <code>-warn:-...</code> will only disable specific warnings.
+<br>Note, by default the batch compiler is reporting the following warnings:
+ <ul>
+ <li>'assert' used as identifier</li>
+ <li>char[] in String concat</li>
+ <li>method with constructor name</li>
+ <li>deprecation outside deprecated code</li>
+ <li>finally block not completing normally</li>
+ <li>interface non-inherited method compatibility</li>
+ <li>hidden catch block</li>
+ <li>assignment without effect</li>
+ <li>attempt to override package-default method</li>
+ <li>unused import declaration</li>
+ <li>non-static reference to static member</li>
+ </ul>
+</li>
+<li>Code select (i.e. <code>ICodeAssit.codeSelect(...)</code>) now returns an <code>ILocalVariable</code>
+ element when a local variable or an argument is selected.
+ <br>Note that <code>ILocalVariable</code>s are pseudo-elements:
+ they are not part of the Java model (<code>exists()</code> always returns <code>false</code>),
+ they are not returned when asking for the children of a method, and there is no other way to create such
+ an element. One can only ask for the source range (<code>ISourceReference.getSourceRange()</code>) or
+ for the name range (<code>ILocalVariable.getNameRange()</code>) of the local variable.
+ <br>Searching a local variable is not yet implemented, but it is on the plan.
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35389">35389</a>
+Compiler settings can violate JLS [build path]
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44869">44869</a>
+Search: no refs found to overridden method in binary subclass
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45110">45110</a>
+No constant for '..compiler.problem.missingAnnotation'
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45100">45100</a>
+[formatter] test144 fails
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45036">45036</a>
+[formatter] New formatter fails formatting multiple field declarations using K_CLASSBODY_DECLARATION kind
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45037">45037</a>
+[formatter] New formatter doesn't insert a new line before the while in a do/while
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45014">45014</a>
+Formatter misplaces semicolon
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44757">44757</a>
+New code formatter does not format switch statements correctly
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44647">44647</a>
+NPE code completion
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43754">43754</a>
+How to position this comment?
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44839">44839</a>
+New formater fails with out of memory error
+
+<a name="v_378"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M5 Build - 15th October 2003
+<br>Project org.eclipse.jdt.core v_378
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_378">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li> Removed dependency on Xerces.
+</li>
+<li> Remove deprecated previously added API <code>IJavaProject#forceClasspathReload(IProgressMonitor)</code>
+(see comment of <a href="#v_368">v_368</a> drop below).
+</li>
+<li>Added optional compiler problem to signal problems with javadoc annotation.
+<pre>
+ * COMPILER / Reporting Invalid Javadoc Annotation
+ * When enabled, the compiler will issue an error or a warning when a javadoc annotation is inconsistent,
+ * misses a tag entry or contains invalid references.
+ * - option id: "org.eclipse.jdt.core.compiler.problem.invalidAnnotation"
+ * - possible values: { "error", "warning", "ignore" }
+ * - default: "ignore"
+ * COMPILER / Reporting Missing Javadoc Annotation
+ * When enabled, the compiler will signal cases where public class, interface, method, constructor or field
+ * (considered as part of the API) has no javadoc annotation.
+ * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.invalidAnnotation".
+ * - option id: "org.eclipse.jdt.core.compiler.problem.missingAnnotation"
+ * - possible values: { "enabled", "disabled" }
+ * - default: "disabled"
+ *
+</pre>
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44715">44715</a>
+NullPointerException compiling Java file
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44697">44697</a>
+Bug when i search reference of 'String' in 3.0M4
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38091">38091</a>
+DCR - Generate warnings for JavaDoc missing entries
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44637">44637</a>
+NPE in Initializer.getPrimaryElement()
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42762">42762</a>
+Compiler tests should run both in 1.3 and 1.4 mode
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44580">44580</a>
+No outline when unit name is not valid
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44651">44651</a>
+Wrong formatting of multiple local variables declarations
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44643">44643</a>
+Remove dependancy to xerces
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44662">44662</a>
+Should not validate unit/classfile handles upon creation
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44400">44400</a>
+Unnecessary cast not being picked up
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44143">44143</a>
+[JSR202] Remove usage of jsr bytecodes in 1.5 mode
+
+<a name="v_377"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M4 Build - 9th October 2003 - 3.0 MILESTONE-4
+<br>Project org.eclipse.jdt.core v_377
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_377">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44576">44576</a>
+Code formatter option "Insert a new line before an opening brace" has no effect for single else
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44570">44570</a>
+Code formatter option "Insert a new line inside an empty block" has no effect
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44503">44503</a>
+Unoptimal formatting for long constructor argument
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44546">44546</a>
+New formatter unable to format
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44506">44506</a>
+Type hierarchy is missing anonymous type
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44481">44481</a>
+"Insert new line between else and if" is not working as expected
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44480">44480</a>
+Formatting the formatted string should not produce edits
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44444">44444</a>
+jdt.core in trouble when project has no JRE
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44437">44437</a>
+Typo in plugin.properties
+
+<a name="v_376"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M4 Build - 8th October 2003
+<br>Project org.eclipse.jdt.core v_376
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_376">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Fix for bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44289">44289</a>
+ requires the index format to be changed. Indexes will be automatically regenerated upon
+ subsequent search queries (accounting for indexing notification in search progress dialogs).
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44308">44308</a>
+NullPointerException when searching jars
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44341">44341</a>
+NPE from delta processor
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44119">44119</a>
+NPE while searching for references to Action#run()
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44331">44331</a>
+Need indication that removal/add was targeted to a primary working copy
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=32639">32639</a>
+Missing empty fine-grain delta when reconciling
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44292">44292</a>
+IDOMType.setFlags(Flag.AccPublic) when applied to an interface having default visibility produces uncompilable code
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44293">44293</a>
+DOMFactory.createInitializer() always creates a static intializer
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44289">44289</a>
+Search broken
+
+<a name="v_374"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M4 Build - 7th October 2003
+<br>Project org.eclipse.jdt.core v_374
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_374">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>The new code formatter can be activated in the ui. See the work in progress section. This first release doesn't expose
+yet all the preferences of the new code formatter. This will be done after M4. However the old formatter options should be honored by
+the new code formatter. This is a work in progress and all problems should be reported against JDT/Core.
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44242">44242</a>
+Deadlock during jdt/debug test
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44066">44066</a>
+Package Explorer doesn't show new file
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44219">44219</a>
+NPE while creating TypeHierarchy for binary type "Group"
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44073">44073</a>
+Override methods action does not work for local types [code manipulation]
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=16231">16231</a>
+formatter creates ugly array initializer expressions
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=6284">6284</a>
+Java formatter enhancements
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=6268">6268</a>
+Code formatting
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44036">44036</a>
+Java code formatter wraps line too much.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43651">43651</a>
+Linewrapping of throws declarations (if many)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43545">43545</a>
+Code Formatter: Don't separate long "import" clause.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43272">43272</a>
+feature request : extend the code formatter to support blanks between method / class name and bracket.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43050">43050</a>
+Formatting long arguments not very readable
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40777">40777</a>
+Incorrect formatting for anonymous inner class with comment
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39607">39607</a>
+Incorrect formatting of anonymous inner class inside if statement
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39603">39603</a>
+for-Statement not correctly formatted by Codeformatter
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39357">39357</a>
+Better code formatting
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38151">38151</a>
+Code formatter adds an unwanted blank line after an abstract method with a "throws" clause.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37106">37106</a>
+Code Formatter: Option to double indent wrapped lines in if statments, etc.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37057">37057</a>
+Code Formatter: Reduce number of blank lines to 1
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36832">36832</a>
+wrong indent on Code Format of anonymous class
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36455">36455</a>
+[Formatting] Too long lines look ugly
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36108">36108</a>
+Code Formatter Clear Blank Lines Doesn't Work
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35799">35799</a>
+code formatter: missing space after last array initializer
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35433">35433</a>
+Simple Feature Request - Code Formatter Enhancement
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35173">35173</a>
+Code formatter incorrectly formats this case:
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=29110">29110</a>
+RFE: Disable line splitting in the code formatter
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=28098">28098</a>
+Code Formatter doesn't format JavaDoc indentation
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=27196">27196</a>
+Code Formatter Won't Indent Braces
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=25559">25559</a>
+more code formatter options
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=24200">24200</a>
+"Space inside parens & brackets" option in Code Formatter
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=23144">23144</a>
+formatter issues
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=22528">22528</a>
+Code formatter incorrectly indents lines
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=22313">22313</a>
+Formatter doesn't like some comment
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=21943">21943</a>
+Formatter should allow removing space after for/while/if
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=20721">20721</a>
+Code formatter bug
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=19999">19999</a>
+Code Formatter always clears blank lines to 1
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=19811">19811</a>
+Code formatter bugs
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=17349">17349</a>
+Code Formatter incorrectly formats static initializer
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=16233">16233</a>
+formatter problem with constructor, array and line-end comments
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=15286">15286</a>
+Code formatter: long param lists and line wrapping
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=14659">14659</a>
+Align method arguments on line break
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=12456">12456</a>
+Add formatter options for controlling spaces
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=12321">12321</a>
+Code formatter and comments
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=10052">10052</a>
+CodeFormatter - line splitting enhancement.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=7439">7439</a>
+incorrect formatting: empty inner class
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=7224">7224</a>
+Formatting splits package names in ugly ways
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=6747">6747</a>
+Code Formatter exchange several blank lines w/ one
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=5824">5824</a>
+Code Formatter needs to be more customizable to be useful
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=3327">3327</a>
+Formatter - should ensure one empty line before a method declaration (1GHOJWD)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=3276">3276</a>
+DCR: (LOW) Formatter option to not indent methods (1GE39ZO)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=3181">3181</a>
+Does not format nicely anonymous type (1FRLTO1)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44085">44085</a>
+becomeWorkingCopy() should add the working copy in the model
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44052">44052</a>
+Deadlock on startup
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44092">44092</a>
+Methods to generate parser files are not correct
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44084">44084</a>
+No refresh when deleting edited unit
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41643">41643</a>
+Code assist doesn't propose all valid types
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44065">44065</a>
+NPE during hot code replace
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43897">43897</a>
+No completion in cast expression
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44061">44061</a>
+CodeAssist - no completion after class literal access
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=44018">44018</a>
+Change superfluous semicolon error message
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43872">43872</a>
+Hierarchy does not update properly when local class eliminated [type hierarchy]
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43294">43294</a>
+Primary working copy: No updates when changed in working copy mode
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43907">43907</a>
+Too many warnings reported by the jdt compiler adapter
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43847">43847</a>
+IPackageFragment not updated after CUs have moved
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43879">43879</a>
+working copy commit outside classpath doesn't save buffer
+
+<a name="v_373"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M4 Build - 30th September 2003
+<br>Project org.eclipse.jdt.core v_373
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_373">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43728">43728</a>
+Optimize CompilerOptions(Map....)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43842">43842</a>
+JDTCompilerAdapter doesn't find bootclasspath
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40782">40782</a>
+Primary working copies: unnecessary deltas on save
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43300">43300</a>
+SearchEngine(IWorkingCopy[] workingCopies) not backward compatible
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43670">43670</a>
+No classpath refresh when replacing binary project with source form
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43600">43600</a>
+NPE from JDTCompilerAdapter
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43636">43636</a>
+Compiler complain that class cannot be resolved when it should be only not visible
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43208">43208</a>
+ICompilation.move not supported when in workingCopyMode
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40793">40793</a>
+Primary working copies: Type search does not find type in modified CU
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43587">43587</a>
+Searching for references to default constructors reports questionable results
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36143">36143</a>
+Type hierarchy doesn't include anonymous subclasses
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=8613">8613</a>
+Outline should show anonymous inner classes
+
+
+<a name="v_372"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M4 Build - 24th September 2003
+<br>Project org.eclipse.jdt.core v_372
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_372">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42692">42692</a>
+JavaCC files cause VerifyError when compiled with Eclipse
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43437">43437</a>
+Scanner does not like string literals
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43485">43485</a>
+NPE in SearchEngine
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37659">37659</a>
+[plan item] Improve shared working copies
+
+
+<a name="v_371"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M4 Build - 22nd September 2003
+<br>Project org.eclipse.jdt.core v_371
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_371">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li> As a consequence of migrating to background autobuild, the JavaModel will no longer broadcast deltas
+during PRE_AUTO_BUILD event notification. These were somewhat inconsistent in so far as the model wasn't
+totally up to date anyway. Now the model will only fire deltas during POST_CHANGE, or working copy reconcile
+operations.
+</li>
+<li>Part of the new support for local and anonymous types in the Java model has been released.
+ <p>
+ This includes:
+ <ul>
+ <li>local and anonymous types are shown in the Outline view and the Package Explorer view</li>
+ <li>Java element deltas for these types are notified</li>
+ <li>handles on these types can be created (see <code>IMember.getType(String, int)</code>)</li>
+ <li><code>getChildren()</code> on a method, a field or an initializer returns the local or anonymous types defined in this element</li>
+ <li>mementos for these handles are supported</li>
+ <li>open on selection (F3) in a Java editor goes to the local type definition</li>
+ <li>type hierarchies contain anonymous and local types</li>
+ </ul>
+ <p>
+ This doesn't yet include:
+ <ul>
+ <li>search on these types</li>
+ <li>anonymous/local binary types</li>
+ </ul>
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42832">42832</a>
+Cannot get rid of this error even if the compiler settings is ignore for incompatible required binaries
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41583">41583</a>
+[misc] Eclipse cannot save or compile files in non-Java project anymore
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43274">43274</a>
+Type hierarchy broken
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38931">38931</a>
+Migrate delta processor to comply to new notification scheme in 3.0
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42281">42281</a>
+"Resource *.java does not exist"
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38931">38931</a>
+org.eclipse.jdt.internal.corext.dom.NodeFinder needed in API
+
+
+<a name="v_370"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M4 Build - 16th September 2003
+<br>Project org.eclipse.jdt.core v_370
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_370">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43026">43026</a>
+Running jdt/core tests on Linux is failing
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43045">43045</a>
+Copy/move of package fragments with read-only subpackages fails on Linux
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43116">43116</a>
+NPE copy and pasting a method
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43089">43089</a>
+Search engine doesn't report all matches
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=43080">43080</a>
+NPE when searching in CU with incomplete method declaration
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42856">42856</a>
+CodeAssist - Does not work after an inner type reference
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839">42839</a>
+Incorrect position in org.eclipse.jdt.core.dom.ArrayType
+
+<a name="v_369"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M4 Build - 9th September 2003
+<br>Project org.eclipse.jdt.core v_369
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_369">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Default compiler compliance setting got raised to 1.4 level. Default source level is 1.3, and default target level is 1.2.
+To ease the 1.4 migration, the default severity for optional problem 'assert used as identifier' got raised to warning.
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42760">42760</a>
+NullPointerException in JobManager when searching
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42629">42629</a>
+javac error message with missing classpath entry when claims entry dropped from path
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42614">42614</a>
+1.3 compliant mode should select default enclosing instance
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42588">42588</a>
+Incorrect selection of current enclosing instance
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35567">35567</a>
+Classpath validation error messages should contain project name
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42443">42443</a>
+Error when inner class name has the same name than another class, but with not the same case sensitive
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42459">42459</a>
+DebugEvaluationTests don't run if target is 1.2
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39887">39887</a>
+Resource exception while indexing
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42366">42366</a>
+Classpath validation error message removed while rebuilding a project.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41680">41680</a>
+Unnecessary cast wrongly reported
+
+<a name="v_368"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M4 Build - 1st September 2003
+<br>Project org.eclipse.jdt.core v_368
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_368">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Added optional compiler problem to signal unqualified access to a non-static field. In order to improve
+code readability, qualifying field accesses is a simple way to syntactically distinguish a field access from
+a local variable access, and thus avoid resorting to a special naming convention for fields (such as "fField").
+<pre>
+* COMPILER / Reporting Unqualified Access to Field
+* When enabled, the compiler will issue an error or a warning when a field is access without any qualification.
+* In order to improve code readability, it should be qualified, e.g. 'x' should rather be written 'this.x'.
+* - option id: "org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess"
+* - possible values: { "error", "warning", "ignore" }
+* - default: "ignore"
+</pre>
+</li>
+<li>Added optional compiler problem to signal method/constructor declared thrown checked exception which
+aren't actually raised inside the method/constructor body.
+<pre>
+* COMPILER / Reporting Unused Declared Thrown Exception
+* When enabled, the compiler will issue an error or a warning when a method or a constructor is declaring a
+* thrown checked exception, but never actually raises it in its body.
+* - option id: "org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException"
+* - possible values: { "error", "warning", "ignore" }
+* - default: "ignore"
+</pre>
+</li>
+<li>Added optional compiler problem to flag situations where a finally block does not complete normally.
+<pre>
+* COMPILER / Reporting Finally Blocks Not Completing Normally
+* When enabled, the compiler will issue an error or a warning when a finally block does not complete normally.
+* - option id: "org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally"
+* - possible values: { "error", "warning", "ignore" }
+* - default: "warning"
+</pre>
+</li>
+<li>Improved problem description for unreachable catch block problems. Message will now mention the exception type
+name and better diagnose the cause of the problem. Also changed problem source range
+to rather highlight the caught exception type instead of entire catch block.
+<pre></pre>
+</li>
+<li>Added two new API methods <code>readRawClasspath()</code> and <code>readOutputLocation()</code> on <code>IJavaProject</code>
+interface so as to allow user to read classpath directly from disk (<code>.classpath</code> file contents). This is useful to configure
+a Java project before it is associated with the Java nature, or before the automatic classpath reconciliation mechanism has performed (within
+a resource modifying operation, and prior to the change notification). Note that these API additions are obsoleting the previously
+added API <code>IJavaProject#forceClasspathReload(IProgressMonitor)</code> (also see bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=20931">20931</a>)
+which has thus been deprecated. Forcing the classpath reload can simply be achieved by: <code>p.setRawClasspath(p.readRawClasspath(), p.readOutputLocation(), ...)</code>.
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40383">40383</a>
+Search - should only special treat unsaved working copies
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40658">40658</a>
+IJavaProject.getOutputLocation/getRawClasspath require Java nature
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42196">42196</a>
+Method popup extremely slow for JOGL code
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41534">41534</a>
+incorrect shadowing reported by rename [refactoring]
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40937">40937</a>
+ISourceReference.getSource throws ArrayIndexOutOfBoundsException
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41373">41373</a>
+SourceField.getConstant() returns null for final fields set in initializer
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41604">41604</a>
+Possible Compiler Bug
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=22976">22976</a>
+DCR - warning for unused declarations of thrown exceptions
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40736">40736</a>
+JDT compiler fails to compile legitimate Java code.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40020">40020</a>
+Exceptions in console
+
+<a name="v_367"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M3 Build - 22nd August 2003 - 3.0 MILESTONE-3
+<br>Project org.eclipse.jdt.core v_367
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_367">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40464">40464</a>
+Index states not saved
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41805">41805</a>
+ArrayIndexOutOfBoundsException while creating AST
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39831">39831</a>
+Search finds only "inexact" matches
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35980">35980</a>
+illegal code completion suggested (abstract methods)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40779">40779</a>
+Primary working copies: no deltas on destroy
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36271">36271</a>
+CodeAssist should treat array.clone() as visible
+<br<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40681">40681</a>
+no warnings for some externalized strings
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40584">40584</a>
+Test suite configuration should be more flexible
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41674">41674</a>
+ToolFactory.createDefaultClassFileReader does not close zipfile
+
+<a name="v_366"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M3 Build - 19th August 2003
+<br>Project org.eclipse.jdt.core v_366
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_366">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>In 1.4 mode, the compiler is now JCK 1.4a compliant (previously was passing JCK1.4).
+</li>
+<li>To reduce the memory consumption and improve performance, the following new APIs were added:
+<ul>
+<li>AST.parsePartialCompilationUnit(ICompilationUnit unit, int position, boolean resolveBindings)</li>
+<li>AST.parsePartialCompilationUnit(ICompilationUnit unit, int position, boolean resolveBindings, WorkingCopyOwner owner)</li>
+</ul>
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41602">41602</a>
+missing @exception in javadoc of IPackageFragment.getNonJavaResources
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38635">38635</a>
+Refactor / Rename Package doesn't allow rename to same name with different case [refactoring]
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40476">40476</a>
+refactor change method signature reports erroneous non-constant case statements
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40995">40995</a>
+NPE in ast.ExplicitConstructorCall.analyseCode
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40880">40880</a>
+Wrong error range for 'indirect static access'
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40174">40174</a>
+Performance issues with builder
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39108">39108</a>
+Numerous single type imports can slow compiler down significantly
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=41019">41019</a>
+org.eclipse.jdt.core.Signature cannot resolve complex type that has package name starting with letters as any primitive type
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38633">38633</a>
+Search should not open requested types with match locator parser
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40954">40954</a>
+ArrayIndexOutOfBoundsException during sort members
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40804">40804</a>
+NPE in MethodBinding.sourceMethod()
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40474">40474</a>
+DOM/AST: Add API to parse only part of a compilation
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40839">40839</a>
+Deprecation is reported even if there is an empty member declaration prior to the field declaration
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40606">40606</a>
+Unable to discard empty package if containing .class files
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39174">39174</a>
+NPE in type hierarchy when opening type
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40082">40082</a>
+NPE in TypeHierarchy.packageRegionContainsSamePackageFragment(TypeHierarchy.java:1314)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40090">40090</a>
+No need to close Java model on shutdown
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=42589">42589</a>
+jck1.4a failures
+
+<a name="v_365a"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M3 Build - 24th July 2003
+<br>Project org.eclipse.jdt.core v_365a
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_365a">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40752">40752</a>
+internal compiler error: java.lang.ClassCastException: org.eclipse.jdt.internal.compiler.lookup.ArrayBinding
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40594">40594</a>
+wrong location set for org.apache.ant when building jdt component with baseLocation
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40715">40715</a>
+getWorkingCopy(...) should always return a new working copy for primary cus
+
+<a name="v_365"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M3 Build - 22nd July 2003
+<br>Project org.eclipse.jdt.core v_365
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_365">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li> Added optional diagnosis for undocumented empty blocks
+<pre>
+* COMPILER / Reporting Undocumented Empty Block
+* When enabled, the compiler will issue an error or a warning when an empty block is detected and it is not
+* documented with any comment.
+* - option id: "org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock"
+* - possible values: { "error", "warning", "ignore" }
+* - default: "ignore"
+</pre>
+</li>
+<li> Removed optional diagnosis for boolean methods throwing exception, since it proved to be useless as is.
+</li>
+<li>Fix for bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40116">40116</a>
+ requires the index format to be changed. Indexes will be automatically regenerated upon
+ subsequent search queries (accounting for indexing notification in search progress dialogs).
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40382">40382</a>
+JavaModelException#printStackTrace should be improved
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40572">40572</a>
+Unnecessary cast warning for necessary cast
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40322">40322</a>
+Error creating new Java projects
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40421">40421</a>
+Unnecessary cast warning...true but...
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=32285">32285</a>
+DCR - extra java compiler markers
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40514">40514</a>
+ArrayIndexOutOfBoundsException during detection of unnecessary casts
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40442">40442</a>
+Abstract class fails to invoke interface-defined method in 1.4 compliance mode.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40116">40116</a>
+Search for references to nested class doesn't find anything
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40334">40334</a>
+Model should be more tolerant for possible compiler failures
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36479">36479</a>
+Rename operation during refactoring fails
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39865">39865</a>
+Misleading error diagnosis on broken method signatures
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=12800">12800</a>
+suboptimal error messages on mistyped 'throw/throws' keywords
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38568">38568</a>
+Search for method declarations fooled by array types
+
+<a name="v_364b"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M2 Build - 18th July 2003 - 3.0 MILESTONE-2
+<br>Project org.eclipse.jdt.core v_364b
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_364b">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40495">40495</a>
+VerifyError with return statements containing a cast expression
+
+<a name="v_364a"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M2 Build - 17th July 2003
+<br>Project org.eclipse.jdt.core v_364a
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_364a">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40423">40423</a>
+NPE Saving a file
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40288">40288</a>
+NPE while building
+
+<a name="v_364"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M2 Build - 16th July 2003
+<br>Project org.eclipse.jdt.core v_364
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_364">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40210">40210</a>
+ICompilationUnit#isWorkingCopy() misbehaving for discarded working copies
+
+<a name="v_363"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M2 Build - 15th July 2003
+<br>Project org.eclipse.jdt.core v_363
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_363">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Added flag <code>IJavaElementDelta.F_PRIMARY_WORKING_COPY</code> that signals that a compilation unit has become a
+ primary working copy, or that a primary working copy has reverted to a compilation unit (i.e. primary working copies are not notified
+ as being added/removed like other working copies, since the primary unit is only changing mode, also see bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40028">40028</a>).
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=40028">40028</a>
+Deltas and deleted working copies
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39823">39823</a>
+AST: Would like to have binding of Serializable and Clonable
+
+<a name="v_362"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M2 Build - 14th July 2003
+<br>Project org.eclipse.jdt.core v_362
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_362">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li> Added optional diagnosis for unnecessary cast or instanceof operations (matching problem IDs are
+<code>IProblem.UnnecessaryCast</code>, <code>IProblem.UnnecessaryArgumentCast</code>, <code>IProblem.UnnecessaryInstanceof</code>).
+<pre>
+* COMPILER / Reporting Unnecessary Type Check
+* When enabled, the compiler will issue an error or a warning when a cast or an instanceof operation
+* is unnecessary.
+* - option id: "org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck"
+* - possible values: { "error", "warning", "ignore" }
+* - default: "ignore"
+</pre>
+</li>
+<li> Changed Java element delta processing to be thread-safe.
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39926">39926</a>
+deleting default package (not in source folder) does nothing
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39877">39877</a>
+Rebuild All generates extra "Unable to read classpath" entry.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39925">39925</a>
+Unnecessary instanceof checking leads to a NullPointerException
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35442">35442</a>
+flag unnecessary casts
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39841">39841</a>
+Give better explanation of why abstract class can't be instantiated
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39467">39467</a>
+Classes not implementing abstract methods compile without error
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39763">39763</a>
+Non NLS string is reported and it should not
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39779">39779</a>
+End position of IType exceeds the size of CompilationUnit
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39766">39766</a>
+compilation unit cannot be saved
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39664">39664</a>
+setSuperInterfaces(String[] interfaceNames) API of org.eclipse.jdt.core.jdom.IDOMType interface does not work for an empty array parameter as Input
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39663">39663</a>
+setSuperclass(String superclassName) API of org.eclipse.jdt.core.jdom.IDOMType interface does not work for null as Input
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39736">39736</a>
+JavaModelException on copying read-only CompilationUnits
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39009">39009</a>
+NPE in Delta processor while executing JDT/UI tests
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35739">35739</a>
+Stack dump on console
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35632">35632</a>
+NPE in DeltaProcessor
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39281">39281</a>
+Unable Refacter (renaming) an inner class
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38450">38450</a>
+Delete: Removing default package removes source folder
+
+<a name="v_361"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M2 Build - 7th July 2003
+<br>Project org.eclipse.jdt.core v_361
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_361">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li> Added optional compiler diagnosis for boolean method declaring thrown exceptions
+(matching problem ID is <code>IProblem.BooleanMethodThrowingException</code>)
+<pre>
+* COMPILER / Reporting Boolean Method Declaring Thrown Exceptions
+* When enabled, the compiler will issue an error or a warning when a boolean method declaration
+* is specifying a clause for thrown exceptions. Some of them are predicates, and these should only
+* return a boolean value and not raise exceptions.
+* - option id: "org.eclipse.jdt.core.compiler.problem.booleanMethodThrowingException"
+* - possible values: { "error", "warning", "ignore" }
+* - default: "ignore"
+</pre>
+<li> Added optional compiler diagnosis for indirect references to static members (matching problem IDs are:
+<code>IProblem.IndirectAccessToStaticField</code>, <code>IProblem.IndirectAccessToStaticMethod</code>, <code>IProblem.IndirectAccessToStaticType</code>).
+<pre>
+* COMPILER / Reporting Indirect Reference to a Static Member
+* When enabled, the compiler will issue an error or a warning whenever a static field
+* or method is accessed in an indirect way. A reference to a static member should
+* preferably be qualified with its declaring type name.
+* - option id: "org.eclipse.jdt.core.compiler.problem.indirectStaticAccess"
+* - possible values: { "error", "warning", "ignore" }
+* - default: "ignore"
+</pre>
+</li>
+<li> Removed method <code>Parser#grammar()</code>, which was hosting the Java grammar as a massive comment.
+From now on, the grammar is defined in its own separate file: <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/grammar/java_1_4.g"><code>java_1_4.g</code></a>.
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39624">39624</a>
+Should warn about predicate throwing exceptions
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39168">39168</a>
+Could remove JavaElement.fLEType field
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36989">36989</a>
+Incorrect error for "super must be first statement in constructor"
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=3319">3319</a>
+wrong compile-time error message (1GG1LDK)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39268">39268</a>
+Optional warning for indirect static references
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39533">39533</a>
+Working copy with no corresponding file not considered by NameLookup
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39502">39502</a>
+No completion in message send
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39475">39475</a>
+Extra error diagnosis in editor from siblings
+
+<a name="v_360"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M2 Build - 1st July 2003
+<br>Project org.eclipse.jdt.core v_360
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_360">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li> Plugin version ID got incremented to 3.0.0.
+</li>
+<li> Removed tolerance for relative source attachments in <code>JavaCore.newLibraryEntry(...)</code>. Only
+allowing relative empty pathes so as to permit using classpath variables to denote the absence of a source attachment.
+<li>To finish closing the gap between compilation units and working copies
+(see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36888">bug 36888</a>), new APIs were added to generalize
+the usage of a working copy owner (entire JavaModel is now aware of owned working copies). These new APIs are copies of existing APIs augmented with
+a <code>WorkingCopyOwner</code> parameter, that defines the working copies to consider in the operation.
+When specifying an owner parameter, all working copies belonging to this owner will implicitly take precedence over primary ones
+(without requiring the owner to remember all its working copies, as in 2.1 era). Note that when no owned working copy is found, a primary
+unit will be considered instead, and since primary units have a built-in working copy (see <code>ICompilationUnit.becomeWorkingCopy(...)</code>),
+the primary unit may already be in working copy mode (very likely since an editor got opened on it). This means that an owner will already
+transparently see unsaved editor contents for all units for which it has no better working copy to contribute.
+The following new APIs were added:
+ <ul>
+ <li><code>AST.parseCompilationUnit(char[] source, String unitName, IJavaProject project, WorkingCopyOwner owner)</code></li>
+ <li><code>AST.parseCompilationUnit(IClassFile classFile, boolean resolveBindings, WorkingCopyOwner owner)</code></li>
+ <li><code>AST.parseCompilationUnit(ICompilationUnit unit, boolean resolveBindings, WorkingCopyOwner owner)</code></li>
+ <li><code>IEvaluationContext.codeComplete(String codeSnippet, int position, ICompletionRequestor requestor, WorkingCopyOwner owner)</code></li>
+ <li><code>IEvaluationContext.codeSelect(String codeSnippet, int offset, int length, WorkingCopyOwner owner)</code></li>
+ <li><code>IDOMCompilationUnit.getCompilationUnit(IPackageFragment parent, WorkingCopyOwner owner)</code></li>
+ <li><code>ICodeAssist.codeComplete(int offset, ICompletionRequestor requestor, WorkingCopyOwner owner)</code></li>
+ <li><code>ICodeAssist.codeSelect(int offset, int length, WorkingCopyOwner owner)</code></li>
+ <li><code>ICompilationUnit.reconcile(boolean forceProblemDetection, WorkingCopyOwner owner, IProgressMonitor monitor)</code></li>
+ <li><code>IJavaProject.findElement(IPath path, WorkingCopyOwner owner)</code></li>
+ <li><code>IJavaProject.findType(String packageName, String typeQualifiedName, WorkingCopyOwner owner)</code></li>
+ <li><code>IJavaProject.findType(String fullyQualifiedName, WorkingCopyOwner owner)</code></li>
+ <li><code>IJavaProject.newTypeHierarchy(IRegion region, WorkingCopyOwner owner, IProgressMonitor monitor)</code></li>
+ <li><code>IJavaProject.newTypeHierarchy(IType type, IRegion region, WorkingCopyOwner owner, IProgressMonitor monitor)</code></li>
+ <li><code>IPackageFragment.getCompilationUnit(String name, WorkingCopyOwner owner)</code></li>
+ <li><code>IPackageFragment.getCompilationUnits(WorkingCopyOwner owner)</code></li>
+ <li><code>IType.codeComplete(char[] snippet, int insertion, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic, ICompletionRequestor requestor, WorkingCopyOwner owner)</code></li>
+ <li><code>IType.newSupertypeHierarchy(WorkingCopyOwner owner, IProgressMonitor monitor)</code></li>
+ <li><code>IType.newTypeHierarchy(IJavaProject project, WorkingCopyOwner owner, IProgressMonitor monitor)</code></li>
+ <li><code>IType.newTypeHierarchy(WorkingCopyOwner owner, IProgressMonitor monitor)</code></li>
+ <li><code>IType.resolveType(String typeName, WorkingCopyOwner owner)</code></li>
+ <li><code>JavaCore.create(IFile file, WorkingCopyOwner owner)</code></li>
+ <li><code>JavaCore.create(IResource resource, WorkingCopyOwner owner)</code></li>
+ <li><code>JavaCore.create(String handleIdentifier, WorkingCopyOwner owner)</code></li>
+ <li><code>JavaCore.createCompilationUnitFrom(IFile file, WorkingCopyOwner owner)</code></li>
+ <li><code>JavaCore.getWorkingCopies(WorkingCopyOwner owner)</code></li>
+ <li><code>SearchEngine.SearchEngine(WorkingCopyOwner workingCopyOwner)</code></li>
+ <li><code>SearchEngine.createHierarchyScope(IType type, WorkingCopyOwner owner)</code></li>
+ </ul>
+</li>
+<li> Added optional problem to signal superfluous semicolons (matching problem ID is <code>IProblem.SuperfluousSemicolon</code>).
+<pre>
+* COMPILER / Reporting Superfluous Semicolon
+* When enabled, the compiler will issue an error or a warning if a superfluous semicolon is met.
+* - option id: "org.eclipse.jdt.core.compiler.problem.superfluousSemicolon"
+* - possible values: { "error", "warning", "ignore" }
+* - default: "ignore"</pre>
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=26281">26281</a>
+error hover text indicates wrong problem
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=23166">23166</a>
+Syntax error message from Java compiler is confusing.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=33213">33213</a>
+Same error reported more than once?
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36214">36214</a>
+TODOs reported twice when located at the end of the method declaration
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36232">36232</a>
+binding do not fully consider working copies
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36888">36888</a>
+Close the gap between original and working copies
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39311">39311</a>
+Outliner did not refresh after method rename (refactor)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39259">39259</a>
+While statement has wrong source position
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39007">39007</a>
+Infinite loop trying to index a non-existing external jar
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=39172">39172</a>
+Incorrect error reported if extra semi-colon exists on a return statement
+
+
+<a name="v_359"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M2 Build - 23rd June 2003
+<br>Project org.eclipse.jdt.core v_359
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_359">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Added API on <code>ICompilationUnit</code> to get the primary compilation unit of a working copy
+ (it replaces <code>IWorkingCopy.getOriginalElement()</code>):
+<pre>
+/**
+ * Returns the primary compilation unit (whose owner is the primary owner)
+ * this working copy was created from, or this compilation unit if this a primary
+ * compilation unit.
+ * Note that the returned primary compilation unit can be in working copy mode.
+ *
+ * @return the primary compilation unit this working copy was created from,
+ * or this compilation unit if it is primary
+ * @since 3.0
+ */
+ICompilationUnit getPrimary();
+</pre>
+</li>
+<li>Added API on <code>IJavaElement</code> to get the primary element of a working copy
+ element (it replaces <code>IWorkingCopy.getOriginalElement(IJavaElement)</code>):
+<pre>
+/**
+ * Returns the primary element (whose compilation unit is the primary compilation unit)
+ * this working copy element was created from, or this element if it is a descendant of a
+ * primary compilation unit or if it is not a descendant of a working copy (e.g. it is a
+ * binary member).
+ * The returned element may or may not exist.
+ *
+ * @return the primary element this working copy element was created from, or this
+ * element.
+ * @since 3.0
+ */
+IJavaElement getPrimaryElement();
+</pre>
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38678">38678</a>
+workspace did not shutdown
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37006">37006</a>
+2 tasks in the tasks view instead of one
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38759">38759</a>
+Task Tags: should not consider text in substrings/parts of text
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36066">36066</a>
+Outliner did not refresh after field rename
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38951">38951</a>
+NPE in editor while saving contents
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35877">35877</a>
+Stack overflow in code assist
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35409">35409</a>
+RC2 Compiler produces bogus error messages
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38838">38838</a>
+SyntaxError- unoptimal syntax error message
+
+
+<a name="v_357b"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M2 Build - 18th June 2003
+<br>Project org.eclipse.jdt.core v_357b
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_357b">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Backported index manager deadlock fix on top of v_357</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38901">38901</a>
+IndexManager hangs in end-less loop
+
+
+<a name="v_358"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M2 Build - 16th June 2003
+<br>Project org.eclipse.jdt.core v_358
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_358">cvs</a>).
+
+<p><b>NOTE:</b> This version got backed out due to severe regression
+(see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38951">38951</a> NPE in editor while saving contents).
+Until subsequent version is made available (see above), integration builds will revert to previous version (v_357).
+
+<h2>
+What's new in this drop</h2>
+<ul>
+<li><code>JavaCore.newLibraryEntry(...)</code> will now allow an empty source attachment (<code>new Path("")</code>) to
+be equivalent to no source attachment (i.e. <code>null</code>). This adjustment is made necessary for
+library entries generated from classpath variables which cannot be set to <code>null</code>. Also see
+bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38531">38531</a>.
+<pre>
+* @param sourceAttachmentPath the absolute path of the corresponding source archive or folder,
+* or <code>null</code> if none. Note, since 3.0, an empty path is allowed to denote no source attachment.
+* and will be automatically converted to <code>null</code>.
+</pre>
+</li>
+<li>Added API <code>IJavaProject#forceClasspathReload(IProgressMonitor)</code> to force reload of <code>.classpath</code> file
+before next automatic update occurs.
+<pre>
+/**
+ * Force the project to reload its <code>.classpath</code> file from disk and update the classpath accordingly.
+ * Usually, a change to the <code>.classpath</code> file is automatically noticed and reconciled at the next
+ * resource change notification event. If required to consider such a change prior to the next automatic
+ * refresh, then this functionnality should be used to trigger a refresh. In particular, if a change to the file is performed,
+ * during an operation where this change needs to be reflected before the operation ends, then an explicit refresh is
+ * necessary.
+ *
+ * @param monitor a progress monitor for reporting operation progress
+ * @exception JavaModelException if the classpath could not be updated. Reasons
+ * include:
+ * - This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
+ * - Two or more entries specify source roots with the same or overlapping paths (NAME_COLLISION)
+ * - A entry of kind <code>CPE_PROJECT</code> refers to this project (INVALID_PATH)
+ * - This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
+ * - The output location path refers to a location not contained in this project (<code>PATH_OUTSIDE_PROJECT</code>)
+ * - The output location path is not an absolute path (<code>RELATIVE_PATH</code>)
+ * - The output location path is nested inside a package fragment root of this project (<code>INVALID_PATH</code>)
+ * - The classpath is being modified during resource change event notification (CORE_EXCEPTION)
+ * @since 3.0
+ */
+</pre>
+</li>
+<li>In the process of closing the gap between compilation units and working copies
+(see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36888 ">bug 36888 </a>), the following new APIs
+are added to <code>ICompilationUnit</code>:
+ <ul>
+ <li><pre>
+/**
+ * Changes this compilation unit handle into a working copy. A new IBuffer is
+ * created using this compilation unit handle's owner. Uses the primary owner is none was
+ * specified when this compilation unit handle was created.
+ *
+ * When switching to working copy mode, problems are reported to given
+ * IProblemRequestor.
+ *
+ * Once in working copy mode, changes to this compilation unit or its children are done in memory.
+ * Only the new buffer is affected. Using commitWorkingCopy(boolean, IProgressMonitor)
+ * will bring the underlying resource in sync with this compilation unit.
+ *
+ * If this compilation unit was already in working copy mode, an internal counter is incremented and no
+ * other action is taken on this compilation unit. To bring this compilation unit back into the original mode
+ * (where it reflects the underlying resource), discardWorkingCopy must be call as many
+ * times as becomeWorkingCopy.
+ *
+ * @param problemRequestor a requestor which will get notified of problems detected during
+ * reconciling as they are discovered. The requestor can be set to null indicating
+ * that the client is not interested in problems.
+ * @param monitor a progress monitor used to report progress while opening this compilation unit
+ * or null if no progress should be reported
+ * @exception JavaModelException if this compilation unit could not become a working copy.
+ * @see discardWorkingCopy
+ * @since 3.0
+ */
+void becomeWorkingCopy(IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException;
+ </pre></li>
+ <li><pre>
+/**
+ * Commits the contents of this working copy to its underlying resource.
+ *
+ * It is possible that the contents of the original resource have changed
+ * since this working copy was created, in which case there is an update conflict.
+ * The value of the force parameter effects the resolution of
+ * such a conflict:
+ * - true - in this case the contents of this working copy are applied to
+ * the underlying resource even though this working copy was created
+ * before a subsequent change in the resource
+ * - false - in this case a JavaModelException is thrown
+ *
+ * Since 2.1, a working copy can be created on a not-yet existing compilation
+ * unit. In particular, such a working copy can then be committed in order to create
+ * the corresponding compilation unit.
+ *
+ * @param force a flag to handle the cases when the contents of the original resource have changed
+ * since this working copy was created
+ * @param monitor the given progress monitor
+ * @exception JavaModelException if this working copy could not commit. Reasons include:
+ * - A CoreException occurred while updating an underlying resource
+ * - This element is not a working copy (INVALID_ELEMENT_TYPES)
+ * - A update conflict (described above) (UPDATE_CONFLICT)
+ * @since 3.0
+ */
+void commitWorkingCopy(boolean force, IProgressMonitor monitor) throws JavaModelException;
+ </pre></li>
+ <li><pre>
+/**
+ * Changes this compilation unit in working copy mode back to its original mode.
+ *
+ * This has no effect if this compilation unit was not in working copy mode.
+ *
+ * If becomeWorkingCopy was called several times on this
+ * compilation unit, discardWorkingCopy must be called as
+ * many times before it switches back to the original mode.
+ *
+ * @see becomeWorkingCopy
+ * @exception JavaModelException if this working copy could not return in its original mode.
+ * @since 3.0
+ */
+void discardWorkingCopy() throws JavaModelException;
+ </pre></li>
+ <li><pre>
+/**
+ * Returns the working copy owner of this working copy.
+ * Returns null if it is not a working copy or if it has no owner.
+ *
+ * @return WorkingCopyOwner the owner of this working copy or null
+ * @since 3.0
+ */
+WorkingCopyOwner getOwner();
+ </pre></li>
+ <li><pre>
+/**
+ * Returns a new working copy of this element if this element is not
+ * a working copy, or this element if this element is already a working copy.
+ *
+ * Note: if intending to share a working copy amongst several clients, then
+ * getWorkingCopy(WorkingCopyOwner, IProblemRequestor, IProgressMonitor)
+ * should be used instead.
+ *
+ * When the working copy instance is created, an ADDED IJavaElementDelta is
+ * reported on this working copy.
+ *
+ * Since 2.1, a working copy can be created on a not-yet existing compilation
+ * unit. In particular, such a working copy can then be committed in order to create
+ * the corresponding compilation unit.
+ *
+* @param monitor a progress monitor used to report progress while opening this compilation unit
+ * or null if no progress should be reported
+ * @exception JavaModelException if the contents of this element can
+ * not be determined.
+ * @return a new working copy of this element if this element is not
+ * a working copy, or this element if this element is already a working copy
+ * @since 3.0
+ */
+ICompilationUnit getWorkingCopy(IProgressMonitor monitor) throws JavaModelException;
+ </pre></li>
+ <li><pre>
+/**
+ * Returns a shared working copy on this element using the given working copy owner to create
+ * the buffer, or this element if this element is already a working copy.
+ * This API can only answer an already existing working copy if it is based on the same
+ * original compilation unit AND was using the same working copy owner (that is, as defined by Object.equals).
+ *
+ * The life time of a shared working copy is as follows:
+ * - The first call to getWorkingCopy(WorkingCopyOwner, IProblemRequestor, IProgressMonitor)
+ * creates a new working copy for this element
+ * - Subsequent calls increment an internal counter.
+ * - A call to discardWorkingCopy() decrements the internal counter.
+ * - When this counter is 0, the working copy is discarded.
+ *
+ * So users of this method must discard exactly once the working copy.
+ *
+ * Note that the working copy owner will be used for the life time of this working copy, that is if the
+ * working copy is closed then reopened, this owner will be used.
+ * The buffer will be automatically initialized with the original's compilation unit content
+ * upon creation.
+ *
+ * When the shared working copy instance is created, an ADDED IJavaElementDelta is reported on this
+ * working copy.
+ *
+ * Since 2.1, a working copy can be created on a not-yet existing compilation
+ * unit. In particular, such a working copy can then be committed in order to create
+ * the corresponding compilation unit.
+ *
+ * @param owner the working copy owner that creates a buffer that is used to get the content
+ * of the working copy
+ * @param problemRequestor a requestor which will get notified of problems detected during
+ * reconciling as they are discovered. The requestor can be set to null indicating
+ * that the client is not interested in problems.
+ * @param monitor a progress monitor used to report progress while opening this compilation unit
+ * or null if no progress should be reported
+ * @exception JavaModelException if the contents of this element can
+ * not be determined.
+ * @return a new working copy of this element using the given factory to create
+ * the buffer, or this element if this element is already a working copy
+ * @since 3.0
+ */
+ICompilationUnit getWorkingCopy(WorkingCopyOwner owner, IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException;
+ </pre></li>
+ </ul>
+And the following abstract class replaces <code>IBufferFactory</code>:
+ <pre>
+/**
+ * The owner of an ICompilationUnit handle in working copy mode.
+ * An owner is used to identify a working copy and to create its buffer.
+ *
+ * @see ICompilationUnit#becomeWorkingCopy
+ * @see ICompilationUnit#discardWorkingCopy
+ * @since 3.0
+ */
+public abstract class WorkingCopyOwner {
+ /**
+ * Creates a buffer for the given working copy.
+ * The new buffer will be initialized with the contents of the underlying file
+ * if and only if it was not already initialized by the compilation owner (a buffer is
+ * uninitialized if its content is null).
+ *
+ * @param workingCopy the working copy of the buffer
+ * @return IBuffer the created buffer for the given working copy
+ * @see IBuffer
+ */
+ public IBuffer createBuffer(ICompilationUnit workingCopy) {
+ ...
+ }
+}
+ </pre>
+ The intent for the primary owner is to use a buffer factory that would be
+ provided by the org.eclipse.text infractructure. This infrastructure not being
+ ready yet, in the meantime one can change the primary owner's
+ <code>IBufferFactory</code> using the following internal API:
+ <pre>
+org.eclipse.jdt.internal.core.DefaultWorkingCopyOwner.PRIMARY.factory = ...;
+ </pre>
+
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38901">38901</a>
+IndexManager hangs in end-less loop
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38908">38908</a>
+Ant script reports that the bootclasspath cannot be infer
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38531">38531</a>
+IllegalArgumentException "Source attachment path should be absolute"
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38424">38424</a>
+Mistake on Web site
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38732">38732</a>
+organize imports does not work with assert in source code
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38447">38447</a>
+AST: Source ranges with missing bracket
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36854">36854</a>
+NPE opening type hierarchy
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=33530">33530</a>
+JavaModel synchronization model should be more optimistic
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=20931">20931</a>
+Need an API to reload the classpath from the file
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38393">38393</a>
+bytecode generated for evaluation with parentheses is wrong
+
+<a name="v_357"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M1 Build - 5th June 2003 - 3.0 MILESTONE-1
+<br>Project org.eclipse.jdt.core v_357
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_357">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37274">37274</a>
+Deadlock on plugin import
+
+
+<a name="v_356"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M1 Build - 4th June 2003
+<br>Project org.eclipse.jdt.core v_356
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_356">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38362">38362</a>
+Inconsistent output when using comparrisson operators
+
+
+<a name="v_355"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M1 Build - 3rd June 2003
+<br>Project org.eclipse.jdt.core v_355
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_355">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Fix for bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37111">37111</a> may issue some outgoing changes
+to .classpath file since the source attachment will be shortened into a project relative path when applicable. The .classpath file
+is still backward compatible, and will continue to accept non relative source attachments as well. </li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37111">37111</a>
+classpath file - java source attachment shouldn't hardcode project name
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38143">38143</a>
+this = null; should raise compile time error
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=38124">38124</a>
+Brackets around cast accepted by Eclipse but not javac
+
+
+<a name="v_354"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M1 Build - 26th May 2003
+<br>Project org.eclipse.jdt.core v_354
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_354">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Added <code>JavaCore</code> optional problem to detect incompatible required binaries, so as to flag situations where
+some prerequisite binaries are required a JRE level higher than the project target platform; i.e. compiling against 1.4 libraries
+when deploying for 1.1 platform is likely unwanted.
+<pre>
+* JAVACORE / Reporting Incompatible JDK Level for Required Binaries
+* Indicate the severity of the problem reported when a project prerequisites another project
+* or library with an incompatible target JDK level (e.g. project targeting 1.1 vm, but compiled against 1.4 libraries).
+* - option id: "org.eclipse.jdt.core.incompatibleJDKLevel"
+* - possible values: { "error", "warning", "ignore" }
+* - default: "ignore"
+</pre>
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37750">37750</a>
+incorrect handle identifier for IImportContainer
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36674">36674</a>
+compiler can generate Java 1.4-only bytecode regardless of compatibility settings
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37962">37962</a>
+Unexpected transient problem during reconcile
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37166">37166</a>
+NPE in SearchEngine when matching type against ProblemReferenceBinding
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37438">37438</a>
+searchenging NPE in searchDeclarationsOfReferencedTypes
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37779">37779</a>
+ExceptionInInitializerError when using JDTCompilerAdapter
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36307">36307</a>
+JDK1.4.2: Wrong declaring class for clone method on array class
+
+
+<a name="v_353"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M1 Build - 19th May 2003
+<br>Project org.eclipse.jdt.core v_353
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_353">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37621">37621</a>
+java compiler creates class with internal inconsistency
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37646">37646</a>
+Help for JDTCompilerAdapter is dated
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36894">36894</a>
+JobManager could wait when idle
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37541">37541</a>
+Unoptimal deprecation diagnosis
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37565">37565</a>
+JACKS: Class literal should not cause class initialization
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37503">37503</a>
+Compiler does not take care of exclusion filter
+
+
+<a name="v_352"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M1 Build - 13th May 2003
+<br>Project org.eclipse.jdt.core v_352
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_352">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Lowered default severity of field/local variable hiding optional diagnosis to <code>"ignore"</code>.
+</li>
+<li>Lowered default severity of accidental boolean assignment optional diagnosis to <code>"ignore"</code>.
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37501">37501</a>
+VerifyError with assert when optimizing out unused local variables
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37387">37387</a>
+Compiler generates unnecessary byte codes
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37381">37381</a>
+AST: Wrong source ranges on VariableDeclExpression
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37200">37200</a>
+"Source->Generate Delegate Methods..." fails
+
+<a name="v_351"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M1 Build - 29th April 2003
+<br>Project org.eclipse.jdt.core v_351
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_351">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37040">37040</a>
+VerifyError "Illegal target of jump or branch"
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36490">36490</a>
+Java compiler misses dependency on 'static final' class variables
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36814">36814</a>
+NaiveASTFlattener does not serialize try-finally statements correctly
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36772">36772</a>
+AST: CompilationUnit.findDeclaringNode: Spec/Impl not same
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36711">36711</a>
+Resource duplication message should list location of duplicate
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36718">36718</a>
+Compiler should not generate references to classes not on the classpath
+
+<a name="v_350"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0M1 Build - 22nd April 2003
+<br>Project org.eclipse.jdt.core v_350
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_350">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<li>Added new compiler optional problem to signal cases where a boolean variable is assigned
+in a condition expression. It is likely an accidental situation, where a comparison was actually meant.
+<pre>
+* COMPILER / Reporting Possible Accidental Boolean Assignment
+* When enabled, the compiler will issue an error or a warning if a boolean assignment is acting as the condition
+* of a control statement (where it probably was meant to be a boolean comparison).
+* - option id: "org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment"
+* - possible values: { "error", "warning", "ignore" }
+* - default: "warning"
+</pre>
+</li>
+<li>Added new compiler settings to control the diagnosis of variable hiding other ones.
+<pre>
+* COMPILER / Reporting Local Variable Declaration Hiding another Variable
+* When enabled, the compiler will issue an error or a warning whenever a local variable
+* declaration is hiding some field or local variable (either locally, inherited or defined in enclosing type).
+* - option id: "org.eclipse.jdt.core.compiler.problem.localVariableHiding"
+* - possible values: { "error", "warning", "ignore" }
+* - default: "warning"
+*
+* COMPILER / Reporting Field Declaration Hiding another Variable
+* When enabled, the compiler will issue an error or a warning whenever a field
+* declaration is hiding some field or local variable (either locally, inherited or defined in enclosing type).
+* - option id: "org.eclipse.jdt.core.compiler.problem.fieldHiding"
+* - possible values: { "error", "warning", "ignore" }
+* - default: "warning"
+*
+* COMPILER / Reporting Special Parameter Hiding another Field
+* When enabled, the compiler will signal cases where a constructor or setter method parameter declaration
+* is hiding some field (either locally, inherited or defined in enclosing type).
+* The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.localVariableHiding".
+* - option id: "org.eclipse.jdt.core.compiler.problem.specialParameterHidingField"
+* - possible values: { "enabled", "disabled" }
+* - default: "disabled"
+</pre>
+</li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36510">36510</a>
+Automatically attach source for source files located in a class folder
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36499">36499</a>
+exists() returns true for a source file inside a classfolder
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36438">36438</a>
+null == null causes java.lang.VerifyError
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35755">35755</a>
+Search in hierarchy misses dependent projects
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36465">36465</a>
+Unable to create multiple source folders when not using bin for output
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36339">36339</a>
+Try codegen issues slightly incorrect ANY exception handler
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35965">35965</a>
+Source not found in source attachment
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36447">36447</a>
+Unoptimal wide conditional branch bytecode sequence
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=19286">19286</a>
+Suspicious synchronized operations
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36213">36213</a>
+ArrayIndex out of bounds
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36244">36244</a>
+JDK1.4.2: Add -cp as a batch option
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35528">35528</a>
+When I check out a project from CVS, Updating takes a very long time
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36058">36058</a>
+Unknown NPE in log
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=21661">21661</a>
+Compile dependency problems
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=28937">28937</a>
+Compiler Problem Marker: Accidental Boolean Assignment
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=33831">33831</a>
+ast API: add FieldAccess.resolveFieldBinding
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35649">35649</a>
+The SourceMapper instances could share the fileNamefilter
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=34896">34896</a>
+compiler setting "unused private fields"
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=33751">33751</a>
+The numbering of anonymous could be optimized
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35849">35849</a>
+Incremental compilation ignores linked folders
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35926">35926</a>
+Batch compiler compile should return false when the command line is incorrect
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35421">35421</a>
+[nls] Inconsistencies between properties files and nls strings
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=34173">34173</a>
+Create a compiler warning when an instance variable is "re-declared" as a local variable.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=21140">21140</a>
+Warning/error on shadowing definition of data member?
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35490">35490</a>
+Search doesn't work for reference of 'cursorLocation'
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35338">35338</a>
+Cannot save file, "Save failed:null" error message received
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35438">35438</a>
+CastExpression resolution departs from JLS section 6.5.1
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=36165">36165</a>
+[DOM/AST] Incorrect grammar rule in TypeDeclaration
+
+
+<a name="v_312"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 2.1 Build (before 3.0/2.1.1 branching) - 31st March 2003
+<br>Project org.eclipse.jdt.core v_312
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_312">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=35831">35831</a>
+NPE navigating references using links
+
+<p><hr>
+For earlier build notes, also see <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.jdt.core/notes/R21_buildnotes_jdt-core.html">build notes up to Release 2.1</a>.
+
+<br>&nbsp;
+</body>
+</html>
diff --git a/org.eclipse.jdt.core/plugin.xml b/org.eclipse.jdt.core/plugin.xml
index 9b7c1b5ce2..f1a2a8dc62 100644
--- a/org.eclipse.jdt.core/plugin.xml
+++ b/org.eclipse.jdt.core/plugin.xml
@@ -6,7 +6,7 @@
<plugin
name = "%pluginName"
id = "org.eclipse.jdt.core"
- version = "3.0.0"
+ version = "3.0.0.cheetah07"
provider-name = "%providerName"
class="org.eclipse.jdt.core.JavaCore">
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchEngine.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchEngine.java
index 7426d74abd..204dced7f0 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchEngine.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchEngine.java
@@ -1048,21 +1048,26 @@ public class SearchEngine {
IResource resource = this.getResource(enclosingElement);
try {
if (resource instanceof IFile) {
- if (VERBOSE) {
- System.out.println("Searching for " + pattern + " in " + resource.getFullPath()); //$NON-NLS-1$//$NON-NLS-2$
+ try {
+ requestor.beginReporting();
+ if (VERBOSE) {
+ System.out.println("Searching for " + pattern + " in " + resource.getFullPath()); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ SearchParticipant participant = getDefaultSearchParticipant();
+ SearchDocument[] documents = MatchLocator.addWorkingCopies(
+ pattern,
+ new SearchDocument[] {new JavaSearchDocument(enclosingElement.getPath().toString(), participant)},
+ getWorkingCopies(enclosingElement),
+ participant);
+ participant.locateMatches(
+ documents,
+ pattern,
+ scope,
+ requestor,
+ monitor);
+ } finally {
+ requestor.endReporting();
}
- SearchParticipant participant = getDefaultSearchParticipant();
- SearchDocument[] documents = MatchLocator.addWorkingCopies(
- pattern,
- new SearchDocument[] {new JavaSearchDocument(enclosingElement.getPath().toString(), participant)},
- getWorkingCopies(enclosingElement),
- participant);
- participant.locateMatches(
- documents,
- pattern,
- scope,
- requestor,
- monitor);
} else {
search(
pattern,
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java
index a9f684e307..ca546427fa 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java
@@ -32,7 +32,7 @@ private int cacheUserCount;
private String[][] cachedChunks; // decompressed chunks of document names
private HashtableOfObject categoryTables; // category name -> HashtableOfObject(words -> int[] of document #'s) or offset if not read yet
-public static final String SIGNATURE= "INDEX VERSION 1.001"; //$NON-NLS-1$
+public static final String SIGNATURE= "INDEX VERSION 1.002"; //$NON-NLS-1$
public static boolean DEBUG = false;
private static final int RE_INDEXED = -1;
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AbstractIndexer.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AbstractIndexer.java
index b2bec599ee..bf4b86dbf5 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AbstractIndexer.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AbstractIndexer.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jdt.internal.core.search.indexing;
+import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.core.search.SearchDocument;
import org.eclipse.jdt.internal.core.search.matching.*;
@@ -24,15 +25,18 @@ public abstract class AbstractIndexer implements IIndexConstants {
public void addClassDeclaration(int modifiers, char[] packageName,char[] name, char[][] enclosingTypeNames, char[] superclass, char[][] superinterfaces) {
addIndexEntry(TYPE_DECL, TypeDeclarationPattern.createIndexKey(name, packageName, enclosingTypeNames, CLASS_SUFFIX));
- if (superclass != null)
+ if (superclass != null) {
+ superclass = erasure(superclass);
addTypeReference(superclass);
+ }
addIndexEntry(
SUPER_REF,
SuperTypeReferencePattern.createIndexKey(
modifiers, packageName, name, enclosingTypeNames, CLASS_SUFFIX, superclass, CLASS_SUFFIX));
if (superinterfaces != null) {
for (int i = 0, max = superinterfaces.length; i < max; i++) {
- addTypeReference(superinterfaces[i]);
+ char[] superinterface = erasure(superinterfaces[i]);
+ addTypeReference(superinterface);
addIndexEntry(
SUPER_REF,
SuperTypeReferencePattern.createIndexKey(
@@ -40,6 +44,12 @@ public abstract class AbstractIndexer implements IIndexConstants {
}
}
}
+ private char[] erasure(char[] typeName) {
+ int genericStart = CharOperation.indexOf(Signature.C_GENERIC_START, typeName);
+ if (genericStart > -1)
+ typeName = CharOperation.subarray(typeName, 0, genericStart);
+ return typeName;
+ }
public void addConstructorDeclaration(char[] typeName, char[][] parameterTypes, char[][] exceptionTypes) {
int argCount = parameterTypes == null ? 0 : parameterTypes.length;
addIndexEntry(CONSTRUCTOR_DECL, ConstructorPattern.createIndexKey(CharOperation.lastSegment(typeName,'.'), argCount));
@@ -70,7 +80,8 @@ public abstract class AbstractIndexer implements IIndexConstants {
if (superinterfaces != null) {
for (int i = 0, max = superinterfaces.length; i < max; i++) {
- addTypeReference(superinterfaces[i]);
+ char[] superinterface = erasure(superinterfaces[i]);
+ addTypeReference(superinterface);
addIndexEntry(
SUPER_REF,
SuperTypeReferencePattern.createIndexKey(
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java
index 114402c00c..63ffb3a77c 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java
@@ -54,11 +54,9 @@ public class BinaryIndexer extends AbstractIndexer implements SuffixConstants {
// consider that A$B is a member type: so replace '$' with '.'
// (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=40116)
- if (CharOperation.indexOf('$', typeName) > 0) {
- System.arraycopy(typeName, 0, typeName = new char[length], 0, length); // copy it so the original is not modified
- CharOperation.replace(typeName, '$', '.');
- }
- super.addTypeReference(typeName);
+ typeName = CharOperation.replaceOnCopy(typeName, '$', '.'); // copy it so the original is not modified
+
+ super.addTypeReference(typeName);
}
/**
* For example:
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java
index b6773b9e11..853105b795 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java
@@ -129,7 +129,7 @@ public char[][] enclosingTypeNames(){
/**
* @see ISourceElementRequestor#enterClass(int, int, char[], int, int, char[], char[][])
*/
-public void enterClass(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[] superclass, char[][] superinterfaces) {
+public void enterClass( int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[] superclass, char[][] superinterfaces, char[][] typeParameterNames, char[][][] typeParameterBounds) {
// eliminate possible qualifications, given they need to be fully resolved again
if (superclass != null){
@@ -161,7 +161,7 @@ public void enterCompilationUnit() {
/**
* @see ISourceElementRequestor#enterConstructor(int, int, char[], int, int, char[][], char[][], char[][])
*/
-public void enterConstructor(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes) {
+public void enterConstructor(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes, char[][] typeParameterNames, char[][][] typeParameterBounds) {
this.indexer.addConstructorDeclaration(name, parameterTypes, exceptionTypes);
this.methodDepth++;
}
@@ -181,7 +181,7 @@ public void enterInitializer(int declarationSourceStart, int modifiers) {
/**
* @see ISourceElementRequestor#enterInterface(int, int, char[], int, int, char[][])
*/
-public void enterInterface(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[][] superinterfaces) {
+public void enterInterface(int declarationStart, int modifiers, char[] name, int nameSourceStart, int nameSourceEnd, char[][] superinterfaces, char[][] typeParameterNames, char[][][] typeParameterBounds) {
// eliminate possible qualifications, given they need to be fully resolved again
if (superinterfaces != null){
for (int i = 0, length = superinterfaces.length; i < length; i++){
@@ -200,7 +200,7 @@ public void enterInterface(int declarationStart, int modifiers, char[] name, int
/**
* @see ISourceElementRequestor#enterMethod(int, int, char[], char[], int, int, char[][], char[][], char[][])
*/
-public void enterMethod(int declarationStart, int modifiers, char[] returnType, char[] name, int nameSourceStart, int nameSourceEnd, char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes) {
+public void enterMethod(int declarationStart, int modifiers, char[] returnType, char[] name, int nameSourceStart, int nameSourceEnd, char[][] parameterTypes, char[][] parameterNames, char[][] exceptionTypes, char[][] typeParameterNames, char[][][] typeParameterBounds) {
this.indexer.addMethodDeclaration(name, parameterTypes, returnType, exceptionTypes);
this.methodDepth++;
}
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java
index f837a92032..9a544ef570 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java
@@ -23,14 +23,7 @@ import org.eclipse.jdt.internal.core.search.indexing.IIndexConstants;
public class ClassFileMatchLocator implements IIndexConstants {
public static char[] convertClassFileFormat(char[] name) {
- for (int i = 0, l = name.length; i < l; i++) {
- if (name[i] == '/') {
- char[] newName = (char[]) name.clone();
- CharOperation.replace(newName, '/', '.');
- return newName;
- }
- }
- return name;
+ return CharOperation.replaceOnCopy(name, '/', '.');
}
boolean checkDeclaringType(IBinaryType enclosingBinaryType, char[] simpleName, char[] qualification, boolean isCaseSensitive) {
@@ -107,8 +100,18 @@ public void locateMatches(MatchLocator locator, ClassFile classFile, IBinaryType
for (int i = 0, l = methods.length; i < l; i++) {
IBinaryMethod method = methods[i];
if (matchBinary(pattern, method, info)) {
+ char[] name;
+ if (method.isConstructor()) {
+ name = info.getName();
+ int lastSlash = CharOperation.lastIndexOf('/', name);
+ if (lastSlash != -1) {
+ name = CharOperation.subarray(name, lastSlash+1, name.length);
+ }
+ } else {
+ name = method.getSelector();
+ }
IMethod methodHandle = binaryType.getMethod(
- new String(method.isConstructor() ? info.getName() : method.getSelector()),
+ new String(name),
CharOperation.toStrings(Signature.getParameterTypes(convertClassFileFormat(method.getMethodDescriptor()))));
locator.reportBinaryMemberDeclaration(null, methodHandle, info, accuracy);
}
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorLocator.java
index 96b266e77e..80a048d986 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorLocator.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorLocator.java
@@ -143,7 +143,7 @@ public int resolveLevel(Binding binding) {
if (binding == null) return INACCURATE_MATCH;
if (!(binding instanceof MethodBinding)) return IMPOSSIBLE_MATCH;
- MethodBinding method = (MethodBinding) binding;
+ MethodBinding method = ((MethodBinding) binding).original();
if (!method.isConstructor()) return IMPOSSIBLE_MATCH;
// declaring type, simple name has already been matched by matchIndexEntry()
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java
index ed74b1dfc6..9929fde922 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java
@@ -152,6 +152,10 @@ protected void consumeExplicitConstructorInvocation(int flag, int recFlag) {
super.consumeExplicitConstructorInvocation(flag, recFlag);
this.patternLocator.match(this.astStack[this.astPtr], this.nodeSet);
}
+protected void consumeExplicitConstructorInvocationWithTypeArguments(int flag, int recFlag) {
+ super.consumeExplicitConstructorInvocationWithTypeArguments(flag, recFlag);
+ this.patternLocator.match(this.astStack[this.astPtr], this.nodeSet);
+}
protected void consumeFieldAccess(boolean isSuperAccess) {
super.consumeFieldAccess(isSuperAccess);
@@ -170,24 +174,51 @@ protected void consumeMethodInvocationName() {
// this is always a MessageSend
this.patternLocator.match((MessageSend) this.expressionStack[this.expressionPtr], this.nodeSet);
}
+protected void consumeMethodInvocationNameWithTypeArguments() {
+ super.consumeMethodInvocationNameWithTypeArguments();
+
+ // this is always a MessageSend
+ this.patternLocator.match((MessageSend) this.expressionStack[this.expressionPtr], this.nodeSet);
+}
protected void consumeMethodInvocationPrimary() {
super.consumeMethodInvocationPrimary();
// this is always a MessageSend
this.patternLocator.match((MessageSend) this.expressionStack[this.expressionPtr], this.nodeSet);
}
+protected void consumeMethodInvocationPrimaryWithTypeArguments() {
+ super.consumeMethodInvocationPrimaryWithTypeArguments();
+
+ // this is always a MessageSend
+ this.patternLocator.match((MessageSend) this.expressionStack[this.expressionPtr], this.nodeSet);
+}
protected void consumeMethodInvocationSuper() {
super.consumeMethodInvocationSuper();
// this is always a MessageSend
this.patternLocator.match((MessageSend) this.expressionStack[this.expressionPtr], this.nodeSet);
}
+protected void consumeMethodInvocationSuperWithTypeArguments() {
+ super.consumeMethodInvocationSuperWithTypeArguments();
+
+ // this is always a MessageSend
+ this.patternLocator.match((MessageSend) this.expressionStack[this.expressionPtr], this.nodeSet);
+}
protected void consumePrimaryNoNewArray() {
// pop parenthesis positions (and don't update expression positions
// (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=23329)
intPtr--;
intPtr--;
}
+
+protected void consumePrimaryNoNewArrayWithName() {
+ // PrimaryNoNewArray ::= PushLPAREN Expression PushRPAREN
+ pushOnExpressionStack(getUnspecifiedReferenceOptimized());
+ // pop parenthesis positions (and don't update expression positions
+ // (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=23329)
+ intPtr--;
+ intPtr--;
+}
protected void consumeUnaryExpression(int op, boolean post) {
super.consumeUnaryExpression(op, post);
this.patternLocator.match(this.expressionStack[this.expressionPtr], this.nodeSet);
@@ -281,6 +312,10 @@ class ImportMatchLocatorParser extends MatchLocatorParser {
protected ImportMatchLocatorParser(ProblemReporter problemReporter, MatchLocator locator) {
super(problemReporter, locator);
}
+protected void consumeSingleStaticImportDeclarationName() {
+ super.consumeSingleStaticImportDeclarationName();
+ this.patternLocator.match(this.astStack[this.astPtr], this.nodeSet);
+}
protected void consumeSingleTypeImportDeclarationName() {
super.consumeSingleTypeImportDeclarationName();
this.patternLocator.match(this.astStack[this.astPtr], this.nodeSet);
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java
index 78952df843..2db96abbf9 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java
@@ -210,7 +210,7 @@ public int resolveLevel(Binding binding) {
if (binding == null) return INACCURATE_MATCH;
if (!(binding instanceof MethodBinding)) return IMPOSSIBLE_MATCH;
- MethodBinding method = (MethodBinding) binding;
+ MethodBinding method = ((MethodBinding) binding).original();
int methodLevel = matchMethod(method);
if (methodLevel == IMPOSSIBLE_MATCH) return IMPOSSIBLE_MATCH;
@@ -225,8 +225,9 @@ public int resolveLevel(Binding binding) {
}
protected int resolveLevel(MessageSend messageSend) {
MethodBinding method = messageSend.binding;
+ if (method != null) method = method.original();
if (method == null) return INACCURATE_MATCH;
-
+
int methodLevel = matchMethod(method);
if (methodLevel == IMPOSSIBLE_MATCH) return IMPOSSIBLE_MATCH;
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java
index de89e5ac84..f0fb8c76ae 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java
@@ -305,6 +305,7 @@ protected void reportDeclaration(ASTNode reference, IJavaElement element, MatchL
if (typeBinding == null || typeBinding instanceof BaseTypeBinding) return;
if (typeBinding instanceof ProblemReferenceBinding)
typeBinding = ((ProblemReferenceBinding) typeBinding).original;
+ typeBinding = typeBinding.erasure();
reportDeclaration((ReferenceBinding) typeBinding, maxType, locator, knownTypes);
}
protected void reportDeclaration(ReferenceBinding typeBinding, int maxType, MatchLocator locator, SimpleSet knownTypes) throws CoreException {

Back to the top