Commit 9b9fd466 authored by Emmanuel Bourg's avatar Emmanuel Bourg

New upstream version 4.12

parent 2191f450
......@@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.jdt.ui</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.11.0-SNAPSHOT</version>
<version>4.12.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt.feature</groupId>
<artifactId>org.eclipse.jdt.astview.feature</artifactId>
......
......@@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.jdt.astview
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.astview; singleton:=true
Bundle-Version: 1.3.300.qualifier
Bundle-Version: 1.4.0.qualifier
Eclipse-SourceReferences: scm:git:git://git.eclipse.org/gitroot/jdt/eclipse.jdt.ui.git;path="org.eclipse.jdt.astview";tag=R4_4
Bundle-Activator: org.eclipse.jdt.astview.ASTViewPlugin
Bundle-Vendor: %providerName
......@@ -11,8 +11,8 @@ Bundle-Localization: plugin
Export-Package: org.eclipse.jdt.astview;x-internal:=true,
org.eclipse.jdt.astview.views;x-internal:=true
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.jdt.core;bundle-version="[3.15.0,4.0.0)",
org.eclipse.jdt.ui;bundle-version="[3.14.0,4.0.0)",
org.eclipse.jdt.core;bundle-version="[3.18.0,4.0.0)",
org.eclipse.jdt.ui;bundle-version="[3.17.0,4.0.0)",
org.eclipse.ui.ide,
org.eclipse.ui.views,
org.eclipse.jface.text,
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2012, 2018 Eclipse Foundation and others.
Copyright (c) 2012, 2019 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
......@@ -14,10 +14,10 @@
<parent>
<artifactId>eclipse.jdt.ui</artifactId>
<groupId>eclipse.jdt.ui</groupId>
<version>4.11.0-SNAPSHOT</version>
<version>4.12.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.astview</artifactId>
<version>1.3.300-SNAPSHOT</version>
<version>1.4.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
/*******************************************************************************
* Copyright (c) 2000, 2018 IBM Corporation and others.
* Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
......@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
......@@ -119,17 +119,31 @@ import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.ASTRequestor;
import org.eclipse.jdt.core.dom.ASTVisitor;
import org.eclipse.jdt.core.dom.Block;
import org.eclipse.jdt.core.dom.BreakStatement;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.Expression;
import org.eclipse.jdt.core.dom.ExpressionStatement;
import org.eclipse.jdt.core.dom.IBinding;
import org.eclipse.jdt.core.dom.NodeFinder;
import org.eclipse.jdt.core.dom.Statement;
import org.eclipse.jdt.core.dom.SwitchExpression;
import org.eclipse.jdt.core.dom.SwitchStatement;
import org.eclipse.jdt.core.manipulation.SharedASTProviderCore;
import org.eclipse.jdt.ui.JavaUI;
public class ASTView extends ViewPart implements IShowInSource, IShowInTargetList {
static final int JLS_LATEST= AST.JLS11;
static final int JLS_LATEST= AST.JLS12;
private static final int JLS12= AST.JLS12;
/**
* @deprecated to get rid of deprecation warnings in code
*/
@Deprecated
private static final int JLS11= AST.JLS11;
/**
......@@ -383,7 +397,60 @@ public class ASTView extends ViewPart implements IShowInSource, IShowInTargetLis
// not interesting
}
}
private static final class BreakStatementChecker extends ASTVisitor {
@Override
public boolean visit(BreakStatement node) {
try {
if (node != null && node.isImplicit() && isInSwitchExpressionOrStatement(node)) {
ASTNode parent= node.getParent();
List<Statement> statements= null;
if (parent instanceof Block) {
statements= ((Block) parent).statements();
} else if (parent instanceof SwitchExpression) {
statements= ((SwitchExpression) parent).statements();
} else if (parent instanceof SwitchStatement) {
statements= ((SwitchStatement) parent).statements();
}
if (statements == null) {
return true;
}
Expression exp= node.getExpression();
if (exp == null) {
statements.remove(node);
return false;
} else {
int index= statements.indexOf(node);
statements.remove(node);
node.setExpression(null);
ExpressionStatement exprStmt= node.getAST().newExpressionStatement(exp);
exprStmt.setSourceRange(node.getStartPosition(), node.getLength());
statements.add(index, exprStmt);
exprStmt.accept(this);
return false;
}
}
} catch (UnsupportedOperationException e) {
// do nothing
}
return true;
}
private boolean isInSwitchExpressionOrStatement(BreakStatement node) {
boolean result= false;
ASTNode parent= node;
while (parent != null) {
if (parent instanceof SwitchStatement || parent instanceof SwitchExpression) {
result= true;
break;
}
parent= parent.getParent();
}
return result;
}
}
private final static String SETTINGS_LINK_WITH_EDITOR= "link_with_editor"; //$NON-NLS-1$
private final static String SETTINGS_INPUT_KIND= "input_kind"; //$NON-NLS-1$
private final static String SETTINGS_NO_BINDINGS= "create_bindings"; //$NON-NLS-1$
......@@ -469,6 +536,7 @@ public class ASTView extends ViewPart implements IShowInSource, IShowInTargetLis
case JLS9:
case JLS10:
case JLS11:
case JLS12:
fCurrentASTLevel= level;
}
} catch (NumberFormatException e) {
......@@ -650,7 +718,8 @@ public class ASTView extends ViewPart implements IShowInSource, IShowInTargetLis
endTime= System.currentTimeMillis();
}
if (root != null) {
updateContentDescription(input, root, endTime - startTime);
root.accept(new BreakStatementChecker());
updateContentDescription(input, root, endTime - startTime);
}
return root;
}
......@@ -1098,6 +1167,7 @@ public class ASTView extends ViewPart implements IShowInSource, IShowInTargetLis
new ASTLevelToggle("AST Level &9 (9)", JLS9), //$NON-NLS-1$
new ASTLevelToggle("AST Level 1&0 (10)", JLS10), //$NON-NLS-1$
new ASTLevelToggle("AST Level 1&1 (11)", JLS11), //$NON-NLS-1$
new ASTLevelToggle("AST Level 1&2 (12)", JLS12), //$NON-NLS-1$
};
fAddToTrayAction= new Action() {
......
ANNOTATION_ELEMENT_TYPE_ADDED_FIELD=Error
ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
API_USE_SCAN_FIELD_SEVERITY=Error
API_USE_SCAN_METHOD_SEVERITY=Error
API_USE_SCAN_TYPE_SEVERITY=Error
CLASS_ELEMENT_TYPE_ADDED_FIELD=Error
CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
ILLEGAL_EXTEND=Warning
ILLEGAL_IMPLEMENT=Warning
ILLEGAL_INSTANTIATE=Warning
ILLEGAL_OVERRIDE=Warning
ILLEGAL_REFERENCE=Warning
INTERFACE_ELEMENT_TYPE_ADDED_DEFAULT_METHOD=Error
INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
INVALID_ANNOTATION=Ignore
INVALID_JAVADOC_TAG=Ignore
INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Ignore
LEAK_EXTEND=Warning
LEAK_FIELD_DECL=Warning
LEAK_IMPLEMENT=Warning
LEAK_METHOD_PARAM=Warning
LEAK_METHOD_RETURN_TYPE=Warning
METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
MISSING_EE_DESCRIPTIONS=Warning
TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
UNUSED_PROBLEM_FILTERS=Warning
automatically_removed_unused_problem_filters=false
changed_execution_env=Error
eclipse.preferences.version=1
incompatible_api_component_version=Error
incompatible_api_component_version_report_major_without_breaking_change=Error
incompatible_api_component_version_report_minor_without_api_change=Error
invalid_since_tag_version=Error
malformed_since_tag=Error
missing_since_tag=Error
report_api_breakage_when_major_version_incremented=Disabled
report_resolution_errors_api_component=Warning
......@@ -3,14 +3,14 @@ Automatic-Module-Name: org.eclipse.jdt.core.manipulation
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.core.manipulation; singleton:=true
Bundle-Version: 1.11.100.qualifier
Bundle-Version: 1.11.200.qualifier
Bundle-Vendor: %providerName
Bundle-Activator: org.eclipse.jdt.internal.core.manipulation.JavaManipulationPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.11.0,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)",
org.eclipse.ltk.core.refactoring;bundle-version="[3.6.0,4.0.0)",
org.eclipse.jdt.core;bundle-version="[3.8.0,4.0.0)",
org.eclipse.jdt.core;bundle-version="[3.18.0,4.0.0)",
org.eclipse.core.expressions;bundle-version="[3.4.100,4.0.0)",
org.eclipse.text;bundle-version="[3.5.0,4.0.0)",
org.eclipse.jdt.launching;bundle-version="3.9.0",
......@@ -27,6 +27,7 @@ Export-Package: org.eclipse.jdt.core.manipulation,
org.eclipse.jdt.internal.core.manipulation.util;x-friends:="org.eclipse.jdt.junit,org.eclipse.jdt.text.tests,org.eclipse.jdt.ui",
org.eclipse.jdt.internal.core.refactoring.descriptors;x-friends:="org.eclipse.jdt.ui",
org.eclipse.jdt.internal.corext;x-friends:="org.eclipse.jdt.ui",
org.eclipse.jdt.internal.corext.callhierarchy;x-friends:="org.eclipse.jdt.ui",
org.eclipse.jdt.internal.corext.codemanipulation;x-friends:="org.eclipse.jdt.ui",
org.eclipse.jdt.internal.corext.codemanipulation.tostringgeneration;x-friends:="org.eclipse.jdt.ui",
org.eclipse.jdt.internal.corext.dom;manipulation=split;mandatory:=manipulation;x-friends:="org.eclipse.jdt.ui,org.eclipse.jdt.junit",
......@@ -48,6 +49,7 @@ Export-Package: org.eclipse.jdt.core.manipulation,
org.eclipse.jdt.internal.ui.preferences;x-friends:="org.eclipse.jdt.ui",
org.eclipse.jdt.internal.ui.text;x-friends:="org.eclipse.jdt.ui",
org.eclipse.jdt.internal.ui.text.correction;x-friends:="org.eclipse.jdt.ui",
org.eclipse.jdt.internal.ui.text.correction.proposals;x-friends:="org.eclipse.jdt.ui"
org.eclipse.jdt.internal.ui.text.correction.proposals;x-friends:="org.eclipse.jdt.ui",
org.eclipse.jdt.internal.ui.util;x-friends:="org.eclipse.jdt.ui"
Import-Package: com.ibm.icu.text
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
/*******************************************************************************
* Copyright (c) 2000, 2018 IBM Corporation and others.
* Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
......@@ -305,6 +305,10 @@ public class ImportReferencesCollector extends GenericVisitor {
@Override
public boolean visit(BreakStatement node) {
int apiLevel= node.getAST().apiLevel();
if (apiLevel >= AST.JLS12) {
evalQualifyingExpression(node.getExpression(), null);
}
return false;
}
......
/*******************************************************************************
* Copyright (c) 2007, 2018 IBM Corporation and others.
* Copyright (c) 2007, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
......@@ -30,15 +30,16 @@ import org.eclipse.jdt.core.manipulation.CoreASTProvider;
* <p>For performance reasons, not more than one AST should be kept in memory at a time. Therefore, clients must
* not keep any references to the shared AST or its nodes or bindings.
* </p>
* <p>Clients can make the following assumptions about the AST:
* <dl>
* <p>Clients can make the following assumptions about the AST:</p>
* <ul>
* <li>the AST has a {@link ITypeRoot} as source: {@link CompilationUnit#getTypeRoot()} is not null.</li>
* <li>the {@link AST#apiLevel() AST API level} is {@link AST#JLS11 API level 11} or higher</li>
* <li>the {@link AST#apiLevel() AST API level} is {@link AST#JLS12 API level 12} or higher</li>
* <li>the AST has bindings resolved ({@link AST#hasResolvedBindings()})</li>
* <li>{@link AST#hasStatementsRecovery() statement} and {@link AST#hasBindingsRecovery() bindings}
* recovery are enabled
* </li>
* </dl>
* </ul>
* <p>
* It is possible that in the future a higher API level is used, or that future options will be enabled.
* </p>
* <p>
......@@ -116,7 +117,7 @@ public class SharedASTProviderCore {
* @param waitFlag {@link #WAIT_YES}, {@link #WAIT_NO} or {@link #WAIT_ACTIVE_ONLY}
* @param progressMonitor the progress monitor or <code>null</code>
* @return the AST or <code>null</code>.
* <dl>
* <ul>
* <li>If {@link #WAIT_NO} has been specified <code>null</code> is returned if the
* element is not input of the current Java editor or no AST is available</li>
* <li>If {@link #WAIT_ACTIVE_ONLY} has been specified <code>null</code> is returned if
......@@ -124,7 +125,7 @@ public class SharedASTProviderCore {
* <li>If {@link #WAIT_YES} has been specified either the shared AST is returned or a
* new AST is created.</li>
* <li><code>null</code> will be returned if the operation gets canceled.</li>
* </dl>
* </ul>
*/
public static CompilationUnit getAST(ITypeRoot element, WAIT_FLAG waitFlag, IProgressMonitor progressMonitor) {
CoreASTProvider.WAIT_FLAG finalWaitFlag = null;
......
......@@ -36,6 +36,7 @@ import org.eclipse.jdt.core.ILocalVariable;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMemberValuePair;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IModuleDescription;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.ISourceRange;
......@@ -197,6 +198,9 @@ public class JavaElementLabelComposerCore {
case IJavaElement.PACKAGE_FRAGMENT_ROOT:
appendPackageFragmentRootLabel((IPackageFragmentRoot) element, flags);
break;
case IJavaElement.JAVA_MODULE:
appendModuleLabel((IModuleDescription) element, flags);
break;
case IJavaElement.IMPORT_CONTAINER:
case IJavaElement.IMPORT_DECLARATION:
case IJavaElement.PACKAGE_DECLARATION:
......@@ -1197,6 +1201,18 @@ public class JavaElementLabelComposerCore {
}
}
protected void appendModuleLabel(IModuleDescription module, long flags) {
fBuffer.append(module.getElementName());
// category
if (getFlag(flags, JavaElementLabelsCore.MOD_CATEGORY) && module.exists()) {
try {
appendCategoryLabel(module, flags);
} catch (JavaModelException e) {
// ignore
}
}
}
private void appendArchiveLabel(IPackageFragmentRoot root, long flags) {
boolean external= root.isExternal();
if (external) {
......
......@@ -302,11 +302,15 @@ public final class JavaElementLabelsCore {
* Prepend first category (if any) to type.
*/
public final static long T_CATEGORY= 1L << 51;
/**
* Prepend first category (if any) to module.
*/
public final static long MOD_CATEGORY= 1L << 52;
/**
* Show category for all elements.
*/
public final static long ALL_CATEGORY= Long.valueOf(F_CATEGORY | M_CATEGORY | T_CATEGORY).longValue();
public final static long ALL_CATEGORY= Long.valueOf(F_CATEGORY | M_CATEGORY | T_CATEGORY | MOD_CATEGORY).longValue();
/**
* Qualify all elements
......
/*******************************************************************************
* Copyright (c) 2000, 2018 IBM Corporation and others.
* Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
......@@ -48,6 +48,7 @@ public class JavaManipulationMessages extends NLS {
public static String StatementAnalyzer_for_expression_updater;
public static String StatementAnalyzer_for_updater_body;
public static String StatementAnalyzer_switch_statement;
public static String StatementAnalyzer_switch_expression;
public static String StatementAnalyzer_synchronized_statement;
public static String StatementAnalyzer_try_statement;
public static String StatementAnalyzer_catch_argument;
......
###############################################################################
# Copyright (c) 2000, 2018 IBM Corporation and others.
# Copyright (c) 2000, 2019 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
......@@ -35,6 +35,7 @@ StatementAnalyzer_catch_argument=Operation is not applicable to a catch block's
StatementAnalyzer_while_expression_body=Operation not applicable to a while statement's expression and body.
StatementAnalyzer_try_statement=Selection must either cover whole try statement or parts of try, catch, or finally block.
StatementAnalyzer_switch_statement=Selection must either cover whole switch statement or parts of a single case block.
StatementAnalyzer_switch_expression=Selection must either cover whole switch expression or parts of a single case block.
StatementAnalyzer_synchronized_statement=Selection must either cover whole synchronized statement or parts of the synchronized block.
SurroundWithTryCatchAnalyzer_doesNotCover=Selection does not cover a set of statements. Extend selection to a valid range using the \'Expand Selection To\' actions from the \'Edit\' menu.
......
/**
* Copyright (c) 2011 Stefan Henss.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Stefan Henß - initial API and implementation.
*/
package org.eclipse.jdt.internal.ui.text;
import java.util.List;
public class Chain {
private final List<ChainElement> elements;
private final int expectedDimensions;
public Chain(final List<ChainElement> elements, final int expectedDimensions) {
this.elements= elements;
this.expectedDimensions= expectedDimensions;
}
public List<ChainElement> getElements() {
return elements;
}
public int getExpectedDimensions() {
return expectedDimensions;
}
}
/**
* Copyright (c) 2010, 2019 Darmstadt University of Technology and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marcel Bruch - initial API and implementation.
*/
package org.eclipse.jdt.internal.ui.text;
import org.eclipse.osgi.util.NLS;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.ILocalVariable;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.IBinding;
import org.eclipse.jdt.core.dom.IMethodBinding;
import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.IVariableBinding;
import org.eclipse.jdt.internal.core.manipulation.JavaManipulationPlugin;
/**
* Represents a transition from Type A to Type B by some chain element ( {@link IField} access,
* {@link IMethod} call, or {@link ILocalVariable} (as entrypoints only)).
*
* @see ChainFinder
*/
public class ChainElement {
public enum ElementType {
METHOD, FIELD, LOCAL_VARIABLE
}
private final IBinding element;
private ITypeBinding returnType;
private int dimension;
private ElementType elementType;
private final boolean requireThis;
public ChainElement(final IBinding binding, final boolean requireThis) {
if (binding == null) {
throw new IllegalArgumentException("???"); //$NON-NLS-1$
}