diff options
author | Sarika Sinha | 2020-11-17 06:39:36 +0000 |
---|---|---|
committer | Sarika Sinha | 2020-11-17 07:25:36 +0000 |
commit | 9f927b9e38723b26d0271e94450e88393bdffb74 (patch) | |
tree | 9358591e8d7b5e9675f13b4da15fa42fdf8e1d45 | |
parent | ff42384a9b6e38e3443e93bac5f94b450d1c6f20 (diff) | |
download | eclipse.jdt.core-9f927b9e38723b26d0271e94450e88393bdffb74.tar.gz eclipse.jdt.core-9f927b9e38723b26d0271e94450e88393bdffb74.tar.xz eclipse.jdt.core-9f927b9e38723b26d0271e94450e88393bdffb74.zip |
InstanceOfExpression as final non-sealed
Change-Id: I9d9faf99de50b3ee0c0770dca773727ffe1e0598
-rw-r--r-- | org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java | 15 |
1 files changed, 13 insertions, 2 deletions
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 76adab19a6..d4cc8ef850 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 @@ -2225,8 +2225,7 @@ class ASTConverter { int startPosition = leftExpression.getStartPosition(); int sourceEnd = convertType.getStartPosition() + convertType.getLength() - 1; if (DOMASTUtil.isInstanceofExpressionPatternSupported(this.ast) && expression.elementVariable != null) { - SingleVariableDeclaration patternVariable = convertToSingleVariableDeclaration(expression.elementVariable); - instanceOfExpression.setPatternVariable(((SimpleName)patternVariable.getName().clone(this.ast))); + instanceOfExpression.setPatternVariable(convertToSimpleName(expression.elementVariable)); sourceEnd= expression.elementVariable.sourceEnd; } instanceOfExpression.setSourceRange(startPosition, sourceEnd - startPosition + 1); @@ -3820,6 +3819,18 @@ class ASTConverter { return variableDecl; } + protected SimpleName convertToSimpleName(LocalDeclaration localDeclaration) { + final SimpleName name = new SimpleName(this.ast); + name.internalSetIdentifier(new String(localDeclaration.name)); + int start = localDeclaration.sourceStart; + int nameEnd = localDeclaration.sourceEnd; + name.setSourceRange(start, nameEnd - start + 1); + if (this.resolveBindings) { + recordNodes(name, localDeclaration); + } + return name; + } + private Dimension convertToDimensions(int start, int end, org.eclipse.jdt.internal.compiler.ast.Annotation[] annotation) { int length = annotation == null ? 0 : annotation.length; Dimension dimension = this.ast.newDimension(); |