Bug 578794 - [18] Merge from master to BETA_JAVA18 Periodically
diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/util/JavaModelUtil.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/util/JavaModelUtil.java
index 47a983e..df27e53 100644
--- a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/util/JavaModelUtil.java
+++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/util/JavaModelUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2021 IBM Corporation and others.
+ * Copyright (c) 2000, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -8,6 +8,10 @@
*
* SPDX-License-Identifier: EPL-2.0
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Matt Chapman, mpchapman@gmail.com - 89977 Make JDT .java agnostic
@@ -80,7 +84,7 @@
*/
public static final String VERSION_LATEST;
static {
- VERSION_LATEST= JavaCore.VERSION_17; // make sure it is not inlined
+ VERSION_LATEST= JavaCore.VERSION_18; // make sure it is not inlined
}
public static final int VALIDATE_EDIT_CHANGED_CONTENT= 10003;
@@ -849,6 +853,10 @@
return !isVersionLessThan(compliance, JavaCore.VERSION_17);
}
+ public static boolean is18OrHigher(String compliance) {
+ return !isVersionLessThan(compliance, JavaCore.VERSION_18);
+ }
+
/**
* Checks if the given project or workspace has source compliance 1.2 or greater.
*
@@ -989,6 +997,17 @@
return is17OrHigher(getSourceCompliance(project));
}
+ /**
+ * Checks if the given project or workspace has source compliance 18 or greater.
+ *
+ * @param project the project to test or <code>null</code> to test the workspace settings
+ * @return <code>true</code> if the given project or workspace has source compliance 17 or
+ * greater.
+ */
+ public static boolean is18OrHigher(IJavaProject project) {
+ return is18OrHigher(getSourceCompliance(project));
+ }
+
public static String getSourceCompliance(IJavaProject project) {
return project != null ? project.getOption(JavaCore.COMPILER_SOURCE, true) : JavaCore.getOption(JavaCore.COMPILER_SOURCE);
}
@@ -1039,6 +1058,8 @@
String version= vMInstall.getJavaVersion();
if (version == null) {
return defaultCompliance;
+ } else if (version.startsWith(JavaCore.VERSION_18)) {
+ return JavaCore.VERSION_18;
} else if (version.startsWith(JavaCore.VERSION_17)) {
return JavaCore.VERSION_17;
} else if (version.startsWith(JavaCore.VERSION_16)) {
@@ -1085,7 +1106,9 @@
// fallback:
String desc= executionEnvironment.getId();
- if (desc.indexOf(JavaCore.VERSION_17) != -1) {
+ if (desc.indexOf(JavaCore.VERSION_18) != -1) {
+ return JavaCore.VERSION_18;
+ } else if (desc.indexOf(JavaCore.VERSION_17) != -1) {
return JavaCore.VERSION_17;
} else if (desc.indexOf(JavaCore.VERSION_16) != -1) {
return JavaCore.VERSION_16;
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/ComplianceConfigurationBlock.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/ComplianceConfigurationBlock.java
index 57b433e..e75076b 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/ComplianceConfigurationBlock.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/ComplianceConfigurationBlock.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2021 IBM Corporation and others.
+ * Copyright (c) 2000, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -8,6 +8,10 @@
*
* SPDX-License-Identifier: EPL-2.0
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Jesper S Møller - Bug 529432 - Allow JDT UI to target Java 10
@@ -145,6 +149,7 @@
private static final String VERSION_15 = JavaCore.VERSION_15;
private static final String VERSION_16 = JavaCore.VERSION_16;
private static final String VERSION_17 = JavaCore.VERSION_17;
+ private static final String VERSION_18 = JavaCore.VERSION_18;
private static final String VERSION_LATEST = JavaCore.latestSupportedJavaVersion();
private static final String VERSION_JSR14= "jsr14"; //$NON-NLS-1$
@@ -302,7 +307,7 @@
private Composite createComplianceTabContent(Composite folder) {
final String[] complianceVersions= new String[] { VERSION_1_3, VERSION_1_4,
- VERSION_1_5, VERSION_1_6, VERSION_1_7, VERSION_1_8, VERSION_9, VERSION_10, VERSION_11, VERSION_12, VERSION_13, VERSION_14, VERSION_15, VERSION_16, VERSION_17 };
+ VERSION_1_5, VERSION_1_6, VERSION_1_7, VERSION_1_8, VERSION_9, VERSION_10, VERSION_11, VERSION_12, VERSION_13, VERSION_14, VERSION_15, VERSION_16, VERSION_17, VERSION_18 };
final String[] complianceLabels= new String[] {
PreferencesMessages.ComplianceConfigurationBlock_version13,
PreferencesMessages.ComplianceConfigurationBlock_version14,
@@ -319,10 +324,11 @@
PreferencesMessages.ComplianceConfigurationBlock_version_15,
PreferencesMessages.ComplianceConfigurationBlock_version_16,
PreferencesMessages.ComplianceConfigurationBlock_version_17,
+ PreferencesMessages.ComplianceConfigurationBlock_version_18
};
String[] targetVersions= new String[] { VERSION_CLDC_1_1, VERSION_1_1, VERSION_1_2, VERSION_1_3, VERSION_1_4,
- VERSION_1_5, VERSION_1_6, VERSION_1_7, VERSION_1_8, VERSION_9, VERSION_10, VERSION_11, VERSION_12, VERSION_13, VERSION_14, VERSION_15, VERSION_16, VERSION_17 };
+ VERSION_1_5, VERSION_1_6, VERSION_1_7, VERSION_1_8, VERSION_9, VERSION_10, VERSION_11, VERSION_12, VERSION_13, VERSION_14, VERSION_15, VERSION_16, VERSION_17, VERSION_18 };
String[] targetLabels= new String[] {
PreferencesMessages.ComplianceConfigurationBlock_versionCLDC11,
PreferencesMessages.ComplianceConfigurationBlock_version11,
@@ -342,6 +348,7 @@
PreferencesMessages.ComplianceConfigurationBlock_version_15,
PreferencesMessages.ComplianceConfigurationBlock_version_16,
PreferencesMessages.ComplianceConfigurationBlock_version_17,
+ PreferencesMessages.ComplianceConfigurationBlock_version_18
};
if (ComplianceConfigurationBlock.VERSION_JSR14.equals(getValue(PREF_CODEGEN_TARGET_PLATFORM))) {
targetVersions= append(targetVersions, ComplianceConfigurationBlock.VERSION_JSR14);
@@ -349,7 +356,7 @@
}
String[] sourceVersions= new String[] { VERSION_1_3, VERSION_1_4,
- VERSION_1_5, VERSION_1_6, VERSION_1_7, VERSION_1_8, VERSION_9, VERSION_10, VERSION_11, VERSION_12, VERSION_13, VERSION_14, VERSION_15, VERSION_16, VERSION_17 };
+ VERSION_1_5, VERSION_1_6, VERSION_1_7, VERSION_1_8, VERSION_9, VERSION_10, VERSION_11, VERSION_12, VERSION_13, VERSION_14, VERSION_15, VERSION_16, VERSION_17, VERSION_18 };
String[] sourceLabels= new String[] {
PreferencesMessages.ComplianceConfigurationBlock_version13,
PreferencesMessages.ComplianceConfigurationBlock_version14,
@@ -366,6 +373,7 @@
PreferencesMessages.ComplianceConfigurationBlock_version_15,
PreferencesMessages.ComplianceConfigurationBlock_version_16,
PreferencesMessages.ComplianceConfigurationBlock_version_17,
+ PreferencesMessages.ComplianceConfigurationBlock_version_18
};
final ScrolledPageContent sc1 = new ScrolledPageContent(folder);
@@ -815,13 +823,13 @@
}
}
- //TODO: Comment once Java SE 17 has been shipped:
-// String selectedCompliance= getValue(PREF_COMPLIANCE);
-// if (VERSION_17.equals(selectedCompliance)) {
-// fJRE50InfoText.setText(
-// "This is an implementation of an early-draft specification developed under the Java Community Process (JCP) and is made available for testing and evaluation purposes only. The code is not compatible with any specification of the JCP."); //$NON-NLS-1$
-// isVisible= true;
-// }
+ //TODO: Comment once Java SE 18 has been shipped:
+ String selectedCompliance= getValue(PREF_COMPLIANCE);
+ if (VERSION_18.equals(selectedCompliance)) {
+ fJRE50InfoText.setText(
+ "This is an implementation of an early-draft specification developed under the Java Community Process (JCP) and is made available for testing and evaluation purposes only. The code is not compatible with any specification of the JCP."); //$NON-NLS-1$
+ isVisible= true;
+ }
fJRE50InfoText.setVisible(isVisible);
fJRE50InfoImage.setImage(isVisible ? image : null);
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.java
index 79d2911..b8f3639 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2021 IBM Corporation and others.
+ * Copyright (c) 2000, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -8,6 +8,10 @@
*
* SPDX-License-Identifier: EPL-2.0
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* John Kaplan, johnkaplantech@gmail.com - 108071 [code templates] template for body of newly created class
@@ -843,6 +847,7 @@
public static String ComplianceConfigurationBlock_version_15;
public static String ComplianceConfigurationBlock_version_16;
public static String ComplianceConfigurationBlock_version_17;
+ public static String ComplianceConfigurationBlock_version_18;
public static String ComplianceConfigurationBlock_versionCLDC11;
public static String ComplianceConfigurationBlock_src_greater_compliance;
public static String ComplianceConfigurationBlock_classfile_greater_compliance;
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties
index 22ddce9..fffda58 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2021 IBM Corporation and others.
+# Copyright (c) 2000, 2022 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
@@ -7,6 +7,10 @@
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
+#
+# This is an implementation of an early-draft specification developed under the Java
+# Community Process (JCP) and is made available for testing and evaluation purposes
+# only. The code is not compatible with any specification of the JCP.
#
# Contributors:
# IBM Corporation - initial API and implementation
@@ -597,6 +601,7 @@
ComplianceConfigurationBlock_version_15=15
ComplianceConfigurationBlock_version_16=16
ComplianceConfigurationBlock_version_17=17
+ComplianceConfigurationBlock_version_18=18 (BETA)
ComplianceConfigurationBlock_versionCLDC11=CLDC 1.1
ComplianceConfigurationBlock_needsbuild_title=Compiler Settings Changed
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/javadoc/JavadocContentAccess2.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/javadoc/JavadocContentAccess2.java
index caff588..bfb8554 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/javadoc/JavadocContentAccess2.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/javadoc/JavadocContentAccess2.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2020 IBM Corporation and others.
+ * Copyright (c) 2008, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -8,6 +8,10 @@
*
* SPDX-License-Identifier: EPL-2.0
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Tom Hofmann, Google <eclipse@tom.eicher.name> - [hovering] NPE when hovering over @value reference within a type's javadoc - https://bugs.eclipse.org/bugs/show_bug.cgi?id=320084
@@ -30,6 +34,9 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -92,6 +99,7 @@
import org.eclipse.jdt.core.dom.PackageDeclaration;
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.TagElement;
+import org.eclipse.jdt.core.dom.TagProperty;
import org.eclipse.jdt.core.dom.TextElement;
import org.eclipse.jdt.core.manipulation.SharedASTProviderCore;
@@ -1483,6 +1491,7 @@
boolean isLiteral= TagElement.TAG_LITERAL.equals(name);
boolean isSummary = TagElement.TAG_SUMMARY.equals(name);
boolean isIndex = TagElement.TAG_INDEX.equals(name);
+ boolean isSnippet = TagElement.TAG_SNIPPET.equals(name);
if (isLiteral || isCode || isSummary || isIndex)
fLiteralContent++;
@@ -1497,6 +1506,9 @@
handleIndex(node.fragments());
else if (isCode || isLiteral)
handleContentElements(node.fragments(), true);
+ else if (isSnippet) {
+ handleSnippet(node.fragments());
+ }
else if (handleInheritDoc(node) || handleDocRoot(node)) {
// Handled
} else {
@@ -1508,6 +1520,8 @@
if (isLink || isCode)
fBuf.append("</code>"); //$NON-NLS-1$
+ if (isSnippet)
+ fBuf.append("</code></pre>"); //$NON-NLS-1$
if (isLiteral || isCode)
fLiteralContent--;
@@ -1907,6 +1921,219 @@
}
}
+ private void handleSnippet(List<? extends ASTNode> fragments) {
+ int fs= fragments.size();
+ if (fs > 0) {
+ fBuf.append("<pre><code>"); //$NON-NLS-1$
+ fBuf.append(BlOCK_TAG_ENTRY_START);
+ for(ASTNode fragment : fragments) {
+ if (fragment instanceof TextElement) {
+ TextElement memberRef= (TextElement) fragment;
+ fBuf.append(memberRef.getText());
+ } else if (fragment instanceof TagElement) {
+ TagElement tagElem= (TagElement) fragment;
+ String name= tagElem.getTagName();
+ if (TagElement.TAG_HIGHLIGHT.equals(name)) {
+ handleSnippetHighlight(tagElem.fragments(), tagElem.tagProperties());
+ } else if (TagElement.TAG_REPLACE.equals(name)) {
+ handleSnippetReplace(tagElem.fragments(), tagElem.tagProperties());
+ }
+ }
+ }
+ fBuf.append(BlOCK_TAG_ENTRY_END);
+ }
+ }
+
+ private void handleSnippetReplace(List<? extends ASTNode> fragments, List<? extends ASTNode> tagProperties) {
+ try {
+ int fs= fragments.size();
+ boolean process = arePropertyValuesStringLiterals(tagProperties) ? true : false;
+ String regExValue = getPropertyValue("regex", tagProperties); //$NON-NLS-1$
+ String subStringValue = getPropertyValue("substring", tagProperties); //$NON-NLS-1$
+ String substitution = getPropertyValue("replacement", tagProperties); //$NON-NLS-1$
+ Pattern regexPattern = null;
+ if (regExValue != null) {
+ regexPattern = Pattern.compile(regExValue);
+ }
+ if (fs > 0) {
+ for(ASTNode fragment : fragments) {
+ if (fragment instanceof TextElement) {
+ TextElement memberRef= (TextElement) fragment;
+ String modifiedText = memberRef.getText();
+ if (process) {
+ if (regexPattern != null && process) {
+ Matcher matcher = regexPattern.matcher(modifiedText);
+ StringBuilder strBuild= new StringBuilder();
+ int finalMatchIndex = 0;
+ while (matcher.find()) {
+ finalMatchIndex = matcher.end();
+ matcher.appendReplacement(strBuild, substitution);
+ }
+ modifiedText = strBuild.toString() + modifiedText.substring(finalMatchIndex);
+ } else if (subStringValue != null) {
+ int startIndex = 0;
+ while (true) {
+ startIndex = modifiedText.indexOf(subStringValue, startIndex);
+ if (startIndex == -1) {
+ break;
+ } else {
+ modifiedText = modifiedText.substring(0, startIndex) + substitution + modifiedText.substring(startIndex + subStringValue.length());
+ startIndex = startIndex + substitution.length() ;
+ }
+ }
+ } else {
+ modifiedText = substitution;
+ }
+ }
+ fBuf.append(modifiedText);
+ }
+ }
+ }
+ } catch (PatternSyntaxException e) {
+ // do nothing
+ }
+ }
+
+ private void handleSnippetHighlight(List<? extends ASTNode> fragments, List<? extends ASTNode> tagProperties) {
+ try {
+ int fs= fragments.size();
+ String defHighlight= getHighlightHtmlTag(tagProperties);
+ String startDefHighlight = '<' + defHighlight + '>';
+ String endDefHighlight = "</" + defHighlight + '>'; //$NON-NLS-1$
+ boolean process = true;
+ if (defHighlight.length() == 0 || !arePropertyValuesStringLiterals(tagProperties)) {
+ process = false;
+ }
+ String regExValue = getPropertyValue("regex", tagProperties); //$NON-NLS-1$
+ String subStringValue = getPropertyValue("substring", tagProperties); //$NON-NLS-1$
+ int additionalLength = startDefHighlight.length() + endDefHighlight.length();
+ Pattern regexPattern = null;
+ if (regExValue != null) {
+ regexPattern = Pattern.compile(regExValue);
+ }
+ if (fs > 0) {
+ for(ASTNode fragment : fragments) {
+ if (fragment instanceof TextElement) {
+ TextElement memberRef= (TextElement) fragment;
+ String modifiedText = memberRef.getText();
+ if (process) {
+ if (regexPattern != null && process) {
+ Matcher matcher = regexPattern.matcher(modifiedText);
+ StringBuilder strBuild= new StringBuilder();
+ int finalMatchIndex = 0;
+ while (matcher.find()) {
+ finalMatchIndex = matcher.end();
+ String replacementStr= startDefHighlight + modifiedText.substring(matcher.start(), matcher.end()) + endDefHighlight;
+ matcher.appendReplacement(strBuild, replacementStr);
+ }
+ modifiedText = strBuild.toString() + modifiedText.substring(finalMatchIndex);
+ } else if (subStringValue != null) {
+ int startIndex = 0;
+ while (true) {
+ startIndex = modifiedText.indexOf(subStringValue, startIndex);
+ if (startIndex == -1) {
+ break;
+ } else {
+ modifiedText = modifiedText.substring(0, startIndex) + startDefHighlight + subStringValue + endDefHighlight + modifiedText.substring(startIndex + subStringValue.length());
+ startIndex = startIndex + subStringValue.length() + additionalLength;
+ }
+ }
+ } else {
+ modifiedText = startDefHighlight + modifiedText + endDefHighlight;
+ }
+ }
+ fBuf.append(modifiedText);
+ }
+ }
+ }
+ } catch (PatternSyntaxException e) {
+ // do nothing
+ }
+ }
+
+ private String getHighlightHtmlTag(List<? extends ASTNode> tagProperties) {
+ String defaultTag= "b"; //$NON-NLS-1$
+ if (tagProperties != null) {
+ for (ASTNode node : tagProperties) {
+ if (node instanceof TagProperty) {
+ TagProperty tagProp = (TagProperty) node;
+ if ("type".equals(tagProp.getName())) { //$NON-NLS-1$
+ String tagValue = stripQuotes(tagProp.getValue());
+ switch (tagValue) {
+ case "bold" : //$NON-NLS-1$
+ defaultTag= "b"; //$NON-NLS-1$
+ break;
+ case "italic" : //$NON-NLS-1$
+ defaultTag= "i"; //$NON-NLS-1$
+ break;
+ case "highlighted" : //$NON-NLS-1$
+ defaultTag= "mark"; //$NON-NLS-1$
+ break;
+ default :
+ defaultTag= ""; //$NON-NLS-1$
+ break;
+ }
+ break;
+ }
+ }
+ }
+ }
+ return defaultTag;
+ }
+
+ private boolean arePropertyValuesStringLiterals(List<? extends ASTNode> tagProperties) {
+ boolean val= true;
+ if (tagProperties != null) {
+ final String SUBSTRING = "substring"; //$NON-NLS-1$
+ final String REGEX = "regex"; //$NON-NLS-1$
+ final String TYPE = "type"; //$NON-NLS-1$
+ for (ASTNode node : tagProperties) {
+ if (node instanceof TagProperty) {
+ TagProperty tagProp = (TagProperty) node;
+ String propName = tagProp.getName();
+ if (SUBSTRING.equals(propName)
+ || REGEX.equals(propName)
+ || TYPE.equals(propName)) {
+ String value= tagProp.getValue();
+ String changed= stripQuotes(value);
+ if (changed.equals(value)) {
+ val= false;
+ break;
+ }
+ }
+ }
+ }
+ }
+ return val;
+ }
+ private String getPropertyValue(String property, List<? extends ASTNode> tagProperties) {
+ String defaultTag= null;
+ if (tagProperties != null && property!= null) {
+ for (ASTNode node : tagProperties) {
+ if (node instanceof TagProperty) {
+ TagProperty tagProp = (TagProperty) node;
+ if (property.equals(tagProp.getName())) {
+ defaultTag= stripQuotes(tagProp.getValue());
+ break;
+ }
+ }
+ }
+ }
+ return defaultTag;
+ }
+
+ private String stripQuotes (String str) {
+ String newStr = str;
+ if (str != null && str.length() >= 2) {
+ int length = str.length();
+ if ((str.charAt(0) == '"' && str.charAt(length-1) == '"')
+ || (str.charAt(0) == '\'' && str.charAt(length-1) == '\'')) {
+ newStr = str.substring(1, length-1);
+ }
+ }
+ return newStr;
+ }
+
private void handleIndex(List<? extends ASTNode> fragments) {
int fs= fragments.size();
if (fs > 0) {