diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/JavaUISourceLocator.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/JavaUISourceLocator.java index e33bc5da02..819d7ae513 100644 --- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/JavaUISourceLocator.java +++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/JavaUISourceLocator.java @@ -322,10 +322,10 @@ public void initializeFromMemento(String memento) throws CoreException { index = memento.indexOf("", start); //$NON-NLS-1$ if (index > 0) { String findAll = memento.substring(start, index); - Boolean all = Boolean.valueOf(findAll); + boolean all = Boolean.parseBoolean(findAll); String rest = memento.substring(index + 10); fJavaProject = (IJavaProject) JavaCore.create(handle); - fIsFindAllSourceElements = all.booleanValue(); + fIsFindAllSourceElements = all; fSourceLocator.initializeFromMemento(rest); } } diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDebugOptionsManager.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDebugOptionsManager.java index 1bc32cc1be..1cd8603a5d 100644 --- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDebugOptionsManager.java +++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDebugOptionsManager.java @@ -641,7 +641,7 @@ private AskRecurrenceDialog(Shell parentShell) { MessageDialog.QUESTION, 0, // DebugUIMessages.JavaDebugOptionsManager_skip_buttonLabel, // DebugUIMessages.JavaDebugOptionsManager_suspend_buttonLabel); - parentShell.getDisplay().syncExec(() -> open()); + parentShell.getDisplay().syncExec(this::open); } @Override diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDetailFormattersManager.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDetailFormattersManager.java index bcf3387e4a..e25c3d7640 100644 --- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDetailFormattersManager.java +++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDetailFormattersManager.java @@ -546,28 +546,28 @@ private Expression getCompiledExpression(IJavaPrimitiveValue javaPM, IJavaDebugT private String primitiveSnippets(String snippet, String typeName, IJavaPrimitiveValue primitiveValue) { String modified = null; if (typeName.equals("float")) { - String thisValue = Float.valueOf(primitiveValue.getFloatValue()).toString(); + String thisValue = Float.toString(primitiveValue.getFloatValue()); modified = snippet.replace("this", thisValue); } else if (typeName.equals("int")) { - String thisValue = Integer.valueOf(primitiveValue.getIntValue()).toString(); + String thisValue = Integer.toString(primitiveValue.getIntValue()); modified = snippet.replace("this", thisValue); } else if (typeName.equals("byte")) { - String thisValue = Byte.valueOf(primitiveValue.getByteValue()).toString(); + String thisValue = Byte.toString(primitiveValue.getByteValue()); modified = snippet.replace("this", thisValue); } else if (typeName.equals("long")) { - String thisValue = Long.valueOf(primitiveValue.getLongValue()).toString(); + String thisValue = Long.toString(primitiveValue.getLongValue()); modified = snippet.replace("this", thisValue); } else if (typeName.equals("short")) { - String thisValue = Short.valueOf(primitiveValue.getShortValue()).toString(); + String thisValue = Short.toString(primitiveValue.getShortValue()); modified = snippet.replace("this", thisValue); } else if (typeName.equals("double")) { - String thisValue = Double.valueOf(primitiveValue.getDoubleValue()).toString(); + String thisValue = Double.toString(primitiveValue.getDoubleValue()); modified = snippet.replace("this", thisValue); } else if (typeName.equals("boolean")) { - String thisValue = Boolean.valueOf(primitiveValue.getBooleanValue()).toString(); + String thisValue = Boolean.toString(primitiveValue.getBooleanValue()); modified = snippet.replace("this", thisValue); } else if (typeName.equals("char")) { - String thisValue = Character.valueOf(primitiveValue.getCharValue()).toString(); + String thisValue = Character.toString(primitiveValue.getCharValue()); modified = snippet.replace("this", thisValue); } else { modified = snippet; diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/LambdaUtils.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/LambdaUtils.java index e430c70517..9aadc2369b 100644 --- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/LambdaUtils.java +++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/LambdaUtils.java @@ -110,12 +110,12 @@ private static List getArgumentTypeNames(IJavaElement parent) throws Cor String[] ptypes = method.getParameterTypes(); for (String ps : ptypes) { @SuppressWarnings("restriction") - String resolvedName = org.eclipse.jdt.internal.corext.util.JavaModelUtil.getResolvedTypeName(ps, type); + StringBuilder resolvedName = new StringBuilder().append(org.eclipse.jdt.internal.corext.util.JavaModelUtil.getResolvedTypeName(ps, type)); int arrayCount = Signature.getArrayCount(ps); for (int i = 0; i < arrayCount; i++) { - resolvedName += "[]"; //$NON-NLS-1$ + resolvedName.append("[]"); //$NON-NLS-1$ } - psig.add(resolvedName); + psig.add(resolvedName.toString()); } return psig; } diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/ObjectComparison.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/ObjectComparison.java index a9f9bd0a23..6c2c0ccdde 100644 --- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/ObjectComparison.java +++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/ObjectComparison.java @@ -806,7 +806,7 @@ public static List getInterfaces(String className) { if (interfaces.isEmpty()) { interfaces = List.of(Class.forName(className).getSuperclass().getInterfaces()); } - names = new ArrayList<>(interfaces.stream().map(e -> e.getCanonicalName()).toList()); + names = new ArrayList<>(interfaces.stream().map(Class::getCanonicalName).toList()); names.add(Class.forName(className).getSuperclass().getSimpleName()); } catch (Exception e) { names = new ArrayList<>(); diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/CompareObjectsAction.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/CompareObjectsAction.java index 4c05e9457a..82fb21b6a9 100644 --- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/CompareObjectsAction.java +++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/CompareObjectsAction.java @@ -462,7 +462,7 @@ private void displayMapResultsInDialogBox(Map result) thr */ @SuppressWarnings("nls") private String printListContents(String Selection, List list, int displayLimit) { - StringBuffer content = new StringBuffer(); + StringBuilder content = new StringBuilder(); content.append("["); content.append(list.stream().limit(displayLimit).collect(Collectors.joining(","))); content.append("......]"); diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java index 895611c4b5..29b5a53a44 100644 --- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java +++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java @@ -1596,11 +1596,11 @@ private void toggleFieldOrMethodBreakpoints(IWorkbenchPart part, ISelection sele * Additional diagnosis info for bug 528321 */ private static void logBadAnnotation(SimpleMarkerAnnotation annotation, CoreException e) { - String message = "Editor annotation with non existing marker found: "; //$NON-NLS-1$ - message += "text: " + annotation.getText(); //$NON-NLS-1$ - message += ", type: " + annotation.getType(); //$NON-NLS-1$ - message += ", " + annotation.getMarker(); //$NON-NLS-1$ - JDIDebugUIPlugin.log(message, e); + StringBuilder message = new StringBuilder("Editor annotation with non existing marker found: "); //$NON-NLS-1$ + message.append("text: ").append(annotation.getText()); //$NON-NLS-1$ + message.append(", type: ").append(annotation.getType()); //$NON-NLS-1$ + message.append(", ").append(annotation.getMarker()); //$NON-NLS-1$ + JDIDebugUIPlugin.log(message.toString(), e); } /** diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaDebugStackTraceConsoleTracker.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaDebugStackTraceConsoleTracker.java index 064bd7997c..b346d5e0fa 100644 --- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaDebugStackTraceConsoleTracker.java +++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaDebugStackTraceConsoleTracker.java @@ -30,9 +30,9 @@ public class JavaDebugStackTraceConsoleTracker extends JavaConsoleTracker { public void matchFound(PatternMatchEvent event) { try { // add a hyperlink at "line: 123" - addHyperlinkAtContent(event, line -> JavaDebugStackTraceHyperlink.extractLineText(line)); + addHyperlinkAtContent(event, JavaDebugStackTraceHyperlink::extractLineText); // add a hyperlink at the type - addHyperlinkAtContent(event, line -> JavaDebugStackTraceHyperlink.extractTypeName(line)); + addHyperlinkAtContent(event, JavaDebugStackTraceHyperlink::extractTypeName); } catch (BadLocationException e) { } } diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaStackTraceHyperlink.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaStackTraceHyperlink.java index 09294fb8dc..0a65a485eb 100644 --- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaStackTraceHyperlink.java +++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaStackTraceHyperlink.java @@ -226,7 +226,7 @@ public IStatus runInUIThread(IProgressMonitor monitor) { try { return processAmbiguousResults(matches, typeName, lineNumber, link); } catch(Exception e) { - StringBuffer temp = new StringBuffer(); + StringBuilder temp = new StringBuilder(); temp.append("Unable to parse \"" + link + "\" \n "); //$NON-NLS-1$ //$NON-NLS-2$ temp.append(e.getClass().getSimpleName()); exceptionHandler(temp.toString(), e); @@ -281,7 +281,7 @@ public IStatus processAmbiguousResults(List matches, String typeName, in if (methodSignature == null) { return openClipboard(matches, line, typeName); } - methodSignature = methodSignature.replaceAll(" ", ""); //$NON-NLS-1$//$NON-NLS-2$ ; + methodSignature = methodSignature.replace(" ", ""); //$NON-NLS-1$//$NON-NLS-2$ ; String methodNameExtracted = methodSignature.substring(0, methodSignature.indexOf('(')); for (Object obj : matches) { if (filterClasses(obj, methodSignature, methodNameExtracted, link)) { @@ -439,7 +439,7 @@ private boolean extractFromResults(IType type, String methodSignature, String me return false; } String methodName = matcher.group(); - methodName = methodName.replaceAll(" ", ""); //$NON-NLS-1$//$NON-NLS-2$ + methodName = methodName.replace(" ", ""); //$NON-NLS-1$//$NON-NLS-2$ pattern = Pattern.compile(METHOD_ARGUMENTS_REGEX); matcher = pattern.matcher(methodSignature); if (!matcher.find()) { diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/jres/InstalledJREsBlock.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/jres/InstalledJREsBlock.java index ce6d1b1bf3..4306581829 100644 --- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/jres/InstalledJREsBlock.java +++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/jres/InstalledJREsBlock.java @@ -925,7 +925,7 @@ public void run(IProgressMonitor monitor) { } if (locations.isEmpty()) { - String messagePath = path.replaceAll("&", "&&"); // @see bug 29855 //$NON-NLS-1$//$NON-NLS-2$ + String messagePath = path.replace("&", "&&"); // @see bug 29855 //$NON-NLS-1$//$NON-NLS-2$ MessageDialog.openInformation(getShell(), JREMessages.InstalledJREsBlock_12, NLS.bind(JREMessages.InstalledJREsBlock_13, new String[]{messagePath})); // } else { Iterator iter2 = types.iterator(); @@ -1055,7 +1055,7 @@ protected void search(File directory, List found, List typ } File file = name == null ? directory : new File(directory, name); monitor.subTask(NLS.bind(JREMessages.InstalledJREsBlock_14, new String[] { Integer.toString(found.size()), - file.toPath().normalize().toAbsolutePath().toString().replaceAll("&", "&&") })); // @see bug 29855 //$NON-NLS-1$ //$NON-NLS-2$ + file.toPath().normalize().toAbsolutePath().toString().replace("&", "&&") })); // @see bug 29855 //$NON-NLS-1$ //$NON-NLS-2$ IVMInstallType[] vmTypes = JavaRuntime.getVMInstallTypes(); if (file.isDirectory()) { if (ignore.add(file)) { diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/DebugTypeSelectionDialog.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/DebugTypeSelectionDialog.java index dc1cf1a935..a1e979989c 100644 --- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/DebugTypeSelectionDialog.java +++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/DebugTypeSelectionDialog.java @@ -81,14 +81,13 @@ public Image getImage(Object element) { } @Override public String getText(Object element) { - if(element instanceof IType) { - IType type = (IType) element; - String label = type.getTypeQualifiedName(); + if (element instanceof IType type) { + StringBuilder label = new StringBuilder().append(type.getTypeQualifiedName()); String container = getDeclaringContainerName(type); if(container != null && !"".equals(container)) { //$NON-NLS-1$ - label += " - "+container; //$NON-NLS-1$ + label.append(" - ").append(container); //$NON-NLS-1$ } - return label; + return label.toString(); } return null; } diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/MainMethodSearchEngine.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/MainMethodSearchEngine.java index 99c3854ad5..2a61263d52 100644 --- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/MainMethodSearchEngine.java +++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/MainMethodSearchEngine.java @@ -42,7 +42,7 @@ public class MainMethodSearchEngine{ - private class MethodCollector extends SearchRequestor { + private static class MethodCollector extends SearchRequestor { private final List fResult; public MethodCollector() {