From 126c301dae66cc2259f1446399ef743baae5f73f Mon Sep 17 00:00:00 2001 From: Eric Milles Date: Sun, 6 Aug 2023 11:28:53 -0500 Subject: [PATCH] refresh project --- .../eclipse/dsl/DSLDElementListener.java | 5 +- .../eclipse/dsl/DSLDResourceListener.java | 2 +- .../groovy/eclipse/dsl/DSLDStore.java | 4 +- .../groovy/eclipse/dsl/DSLDStoreManager.java | 2 +- .../groovy/eclipse/dsl/DSLPreferences.java | 33 ++-- .../dsl/DSLPreferencesInitializer.java | 4 +- .../eclipse/dsl/DisabledScriptsCache.java | 2 +- .../eclipse/dsl/GroovyDSLCoreActivator.java | 2 +- .../groovy/eclipse/dsl/RefreshDSLDJob.java | 2 +- .../dsl/checker/IStaticCheckerHandler.java | 4 +- .../dsl/checker/ResourceMarkerHandler.java | 6 +- .../dsl/checker/ResourceTypeChecker.java | 104 +++++----- .../dsl/checker/StaticCheckerApplication.java | 23 ++- .../checker/StaticTypeCheckerRequestor.java | 8 +- .../checker/SysoutStaticCheckerHandler.java | 8 +- .../classpath/AutoAddContainerSupport.java | 2 +- .../DSLDClasspathContainerDecorator.java | 4 +- .../classpath/DSLDContainerInitializer.java | 5 +- .../dsl/contributions/ContributionElems.java | 2 +- .../dsl/contributions/ContributionGroup.java | 17 +- .../contributions/DSLContributionGroup.java | 20 +- .../EmptyContributionElement.java | 2 +- .../contributions/IContributionElement.java | 2 +- .../dsl/contributions/IContributionGroup.java | 2 +- .../MethodContributionElement.java | 20 +- .../contributions/ParameterContribution.java | 4 +- .../PropertyContributionElement.java | 4 +- .../suggestions/AbstractCreateOperation.java | 2 +- .../AbstractJavaTypeVerifiedRule.java | 5 +- .../AbstractSuggestionOperation.java | 4 +- .../suggestions/AddSuggestionsOperation.java | 4 +- .../DeclaringTypeSuperTypeMatcher.java | 4 +- .../suggestions/DuplicateParameterRule.java | 7 +- .../suggestions/EditSuggestionOperation.java | 4 +- .../suggestions/GroovyMethodSuggestion.java | 4 +- .../suggestions/GroovyPropertySuggestion.java | 13 +- .../suggestions/GroovySuggestion.java | 4 +- .../GroovySuggestionDeclaringType.java | 14 +- .../suggestions/IBaseGroovySuggestion.java | 4 +- .../suggestions/IGroovySuggestion.java | 4 +- .../suggestions/ISuggestionsOperation.java | 4 +- .../suggestions/IValueCheckingRule.java | 4 +- .../InferencingSuggestionsManager.java | 14 +- .../suggestions/JavaValidIdentifierRule.java | 4 +- .../JavaValidParameterizedTypeRule.java | 6 +- .../suggestions/JavaValidTypeRule.java | 4 +- .../suggestions/MethodParameter.java | 4 +- .../suggestions/OperationManager.java | 4 +- .../RemoveSuggestionOperation.java | 4 +- .../suggestions/SuggestionDescriptor.java | 8 +- .../suggestions/SuggestionFactory.java | 18 +- .../SuggestionsContributionGroup.java | 2 +- .../suggestions/SuggestionsLoader.java | 5 +- .../suggestions/SuggestionsPointCut.java | 4 +- .../suggestions/SuggestionsRequestor.java | 4 +- .../suggestions/SuggestionsUIOperation.java | 6 +- .../inferencing/suggestions/ValueStatus.java | 2 +- .../AbstractSuggestionLabel.java | 4 +- .../GroovySuggestionsTable.java | 184 +++++++++--------- .../preferencepage/ISuggestionLabel.java | 2 +- .../preferencepage/ITreeViewerColumn.java | 2 +- .../InferencingPreferencesPage.java | 4 +- .../preferencepage/MethodSuggestionLabel.java | 4 +- .../PropertySuggestionLabel.java | 4 +- .../SuggestionLabelFactory.java | 5 +- .../preferencepage/SuggestionsViewer.java | 49 ++--- .../ui/AbstractControlManager.java | 2 +- .../ui/AbstractLabeledDialogueControl.java | 2 +- .../ui/AddInferencingSuggestionDialogue.java | 27 ++- .../suggestions/ui/ButtonDialogueControl.java | 2 +- .../suggestions/ui/ControlSelectionEvent.java | 4 +- .../ui/ControlSelectionListener.java | 5 +- .../suggestions/ui/ControlTypes.java | 2 +- .../suggestions/ui/DialogueDescriptor.java | 5 +- .../ui/DocumentDialogueControl.java | 4 +- .../ui/EditInferencingSuggestionDialogue.java | 4 +- .../ui/IControlSelectionListener.java | 2 +- .../ui/IDialogueControlDescriptor.java | 2 +- .../ui/IDialogueControlManager.java | 2 +- .../suggestions/ui/IProjectUIControl.java | 4 +- .../suggestions/ui/ISelectionHandler.java | 4 +- .../suggestions/ui/JavaTextControl.java | 5 +- .../ui/JavaTypeBrowsingControl.java | 4 +- .../ui/MethodParameterDialogue.java | 12 +- .../suggestions/ui/MethodParameterTable.java | 2 +- .../suggestions/ui/ProjectDisplayControl.java | 4 +- .../ui/ProjectDropDownControl.java | 8 +- .../ui/RadioSelectionDialogueControl.java | 4 +- .../writer/SuggestionElementStatics.java | 5 +- .../suggestions/writer/SuggestionsFile.java | 7 +- .../writer/SuggestionsFileProperties.java | 4 +- .../suggestions/writer/SuggestionsReader.java | 2 +- .../writer/SuggestionsTransform.java | 9 +- .../suggestions/writer/TransformElement.java | 4 +- .../writer/TransformElementFactory.java | 8 +- .../writer/TransformElementProperty.java | 4 +- .../eclipse/dsl/lookup/DSLDTypeLookup.java | 2 +- .../eclipse/dsl/lookup/ResolverCache.java | 4 +- .../dsl/pointcuts/AbstractPointcut.java | 82 +++----- .../dsl/pointcuts/GroovyDSLDContext.java | 2 +- .../eclipse/dsl/pointcuts/IPointcut.java | 7 +- .../PointcutVerificationException.java | 8 +- .../dsl/pointcuts/StringObjectVector.java | 2 +- .../impl/AbstractModifierPointcut.java | 4 +- .../dsl/pointcuts/impl/AndPointcut.java | 63 +++--- .../impl/AssignedVariablePointcut.java | 2 +- .../dsl/pointcuts/impl/BindPointcut.java | 4 +- .../impl/CurrentIdentifierPointcut.java | 4 +- .../CurrentTypeIsEnclosingTypePointcut.java | 4 +- .../pointcuts/impl/DeclaringTypePointcut.java | 4 +- .../impl/EnclosingClassPointcut.java | 9 +- .../impl/EnclosingClosurePointcut.java | 6 +- .../impl/EnclosingFieldPointcut.java | 4 +- .../impl/EnclosingMethodPointcut.java | 4 +- .../impl/EnclosingScriptPointcut.java | 6 +- .../pointcuts/impl/FileExtensionPointcut.java | 4 +- .../dsl/pointcuts/impl/FileNamePointcut.java | 4 +- .../dsl/pointcuts/impl/FilteringPointcut.java | 6 +- .../dsl/pointcuts/impl/FindASTPointcut.java | 4 +- .../impl/FindAnnotationPointcut.java | 4 +- .../dsl/pointcuts/impl/FindCtorPointcut.java | 4 +- .../dsl/pointcuts/impl/FindFieldPointcut.java | 4 +- .../pointcuts/impl/FindMethodPointcut.java | 4 +- .../pointcuts/impl/FindPropertyPointcut.java | 4 +- .../pointcuts/impl/HasArgumentsPointcut.java | 4 +- .../pointcuts/impl/HasAttributesPointcut.java | 4 +- .../dsl/pointcuts/impl/IsConfigScript.java | 4 +- .../pointcuts/impl/IsThisTypePointcut.java | 4 +- .../dsl/pointcuts/impl/NamePointcut.java | 2 +- .../dsl/pointcuts/impl/NotPointcut.java | 4 +- .../dsl/pointcuts/impl/OrPointcut.java | 6 +- .../pointcuts/impl/PackageFolderPointcut.java | 4 +- .../pointcuts/impl/ProjectNaturePointcut.java | 5 +- .../impl/SourceFolderOfFilePointcut.java | 5 +- .../impl/SourceFolderOfTypePointcut.java | 9 +- .../dsl/pointcuts/impl/SubTypePointcut.java | 2 +- .../dsl/pointcuts/impl/TypePointcut.java | 2 +- .../impl/UserExtensiblePointcut.java | 4 +- .../dsl/pointcuts/impl/ValuePointcut.java | 9 +- .../dsl/proposals/DSLDProposalFilter.java | 13 +- .../dsl/proposals/DSLDProposalProvider.java | 2 +- .../dsl/script/DSLDScriptExecutor.java | 12 +- .../eclipse/dsl/script/PointcutClosure.java | 4 +- .../eclipse/dsl/script/PointcutFactory.java | 27 +-- .../eclipse/dsl/ui/AbstractCheckerAction.java | 8 +- .../dsl/ui/DSLDClasspathContainerAction.java | 2 +- .../eclipse/dsl/ui/DSLPreferencesPage.java | 2 +- .../groovy/eclipse/dsl/ui/NewDSLDWizard.java | 2 +- .../ui/RefreshDSLDFilesActionDelegate.java | 4 +- .../eclipse/dsl/ui/RemoveCheckerWarnings.java | 4 +- .../eclipse/dsl/ui/StaticTypeCheckAction.java | 4 +- 151 files changed, 613 insertions(+), 672 deletions(-) diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLDElementListener.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLDElementListener.java index d2c16b454b..88693ba1ac 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLDElementListener.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLDElementListener.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -56,5 +56,4 @@ private boolean isResolvedClasspathChangeNotRawClasspath(IJavaElementDelta delta return (delta.getFlags() & IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED) != 0 && (delta.getFlags() & IJavaElementDelta.F_CLASSPATH_CHANGED) == 0; } - } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLDResourceListener.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLDResourceListener.java index 3ea7264370..5041d5e620 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLDResourceListener.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLDResourceListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLDStore.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLDStore.java index 7eedd215f2..6b02e414a5 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLDStore.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLDStore.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLDStoreManager.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLDStoreManager.java index 81d8e075b4..6ef00d72ef 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLDStoreManager.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLDStoreManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2020 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLPreferences.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLPreferences.java index 82a2dd27e0..8c78db8964 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLPreferences.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLPreferences.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ package org.codehaus.groovy.eclipse.dsl; +import java.util.Arrays; import java.util.HashSet; import java.util.Set; @@ -46,12 +47,7 @@ public static String[] getDisabledScripts() { } public static Set getDisabledScriptsAsSet() { - String[] disabled = getDisabledScripts(); - Set set = new HashSet<>(disabled.length*2); - for (String dis : disabled) { - set.add(dis); - } - return set; + return new HashSet<>(Arrays.asList(getDisabledScripts())); } /** @@ -71,7 +67,7 @@ private static String join(String[] filtered) { sb.append(s); sb.append(','); } - sb.replace(sb.length()-1, sb.length(), ""); + sb.replace(sb.length() - 1, sb.length(), ""); return sb.toString(); } else { return ""; @@ -79,16 +75,17 @@ private static String join(String[] filtered) { } private static String[] filter(String[] disabled) { - // not working now -// IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); -// List filtered = new ArrayList(disabled.length); -// for (String string : disabled) { -// IResource r = root.getFile(new Path(string)); -// if (r.getType() == IResource.FILE && r.isAccessible()) { -// filtered.add(string); -// } -// } -// return filtered.toArray(new String[filtered.size()]); + /* not working now + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + List filtered = new ArrayList(disabled.length); + for (String string : disabled) { + IResource r = root.getFile(new Path(string)); + if (r.getType() == IResource.FILE && r.isAccessible()) { + filtered.add(string); + } + } + return filtered.toArray(new String[filtered.size()]); + */ return disabled; } } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLPreferencesInitializer.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLPreferencesInitializer.java index 8c79b72998..cc8902d8f6 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLPreferencesInitializer.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DSLPreferencesInitializer.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DisabledScriptsCache.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DisabledScriptsCache.java index e3f563850d..23fc7d70da 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DisabledScriptsCache.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/DisabledScriptsCache.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/GroovyDSLCoreActivator.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/GroovyDSLCoreActivator.java index 30f2387119..b9f57a12fe 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/GroovyDSLCoreActivator.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/GroovyDSLCoreActivator.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2020 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/RefreshDSLDJob.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/RefreshDSLDJob.java index 284c6da490..ea8c715107 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/RefreshDSLDJob.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/RefreshDSLDJob.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2020 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/IStaticCheckerHandler.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/IStaticCheckerHandler.java index ac1fbf511e..bb03f38139 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/IStaticCheckerHandler.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/IStaticCheckerHandler.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/ResourceMarkerHandler.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/ResourceMarkerHandler.java index ca2f7dac67..b7ffadeab4 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/ResourceMarkerHandler.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/ResourceMarkerHandler.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -33,7 +33,7 @@ public class ResourceMarkerHandler implements IStaticCheckerHandler { private IFile resource; - private int numFound = 0; + private int numFound; @Override public void setResource(IFile resource) { diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/ResourceTypeChecker.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/ResourceTypeChecker.java index abffd6acd5..41403e42f4 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/ResourceTypeChecker.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/ResourceTypeChecker.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -44,6 +44,55 @@ */ public class ResourceTypeChecker { + private final IStaticCheckerHandler handler; + private final List resources; + + protected boolean onlyAssertions; + protected final char[][] includes; + protected final char[][] excludes; + + public ResourceTypeChecker(IStaticCheckerHandler handler, String projectName, char[][] includes, char[][] excludes, boolean onlyAssertions) { + this(handler, createProject(projectName), includes, excludes, onlyAssertions); + } + + public ResourceTypeChecker(IStaticCheckerHandler handler, List resources, char[][] includes, char[][] excludes, boolean onlyAssertions) { + this.handler = handler; + this.resources = resources; + this.includes = includes; + this.excludes = excludes; + this.onlyAssertions = onlyAssertions; + } + + private static List createProject(String projectName) { + IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); + if (!GroovyNature.hasGroovyNature(project)) { + throw new IllegalArgumentException("Invalid project: " + projectName); + } + return Collections.singletonList(project); + } + + /** + * Performs the tpe checking on the selected resources. + * @param monitor progress monitor, can be null + * @return true iff no type problems were found + * @throws CoreException + */ + public boolean doCheck(IProgressMonitor monitor) throws CoreException { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("Static type analysis", resources.size()); + for (IResource resource : resources) { + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + CheckerVisitor visitor = new CheckerVisitor(monitor); + resource.accept(visitor); + monitor.worked(1); + } + return handler.finish(null); + } + class CheckerVisitor implements IResourceVisitor { private IProgressMonitor monitor; @@ -105,7 +154,7 @@ private Map findComments(GroovyCompilationUnit unit) { String candidate; if (stok.hasMoreTokens() && (candidate = stok.nextToken()).startsWith("TYPE:")) { // may or may not have a space after the colon - if (candidate.equals("TYPE:")) { + if ("TYPE:".equals(candidate)) { if (stok.hasMoreTokens()) { type = stok.nextToken(); } @@ -121,53 +170,4 @@ private Map findComments(GroovyCompilationUnit unit) { return allComments; } } - - private final IStaticCheckerHandler handler; - private final List resources; - - protected boolean onlyAssertions; - protected final char[][] includes; - protected final char[][] excludes; - - public ResourceTypeChecker(IStaticCheckerHandler handler, String projectName, char[][] includes, char[][] excludes, boolean onlyAssertions) { - this(handler, createProject(projectName), includes, excludes, onlyAssertions); - } - - public ResourceTypeChecker(IStaticCheckerHandler handler, List resources, char[][] includes, char[][] excludes, boolean onlyAssertions) { - this.handler = handler; - this.resources = resources; - this.includes = includes; - this.excludes = excludes; - this.onlyAssertions = onlyAssertions; - } - - private static List createProject(String projectName) { - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - if (!GroovyNature.hasGroovyNature(project)) { - throw new IllegalArgumentException("Invalid project: " + projectName); - } - return Collections.singletonList(project); - } - - /** - * Performs the tpe checking on the selected resources. - * @param monitor progress monitor, can be null - * @return true iff no type problems were found - * @throws CoreException - */ - public boolean doCheck(IProgressMonitor monitor) throws CoreException { - if (monitor == null) { - monitor = new NullProgressMonitor(); - } - monitor.beginTask("Static type analysis", resources.size()); - for (IResource resource : resources) { - if (monitor.isCanceled()) { - throw new OperationCanceledException(); - } - CheckerVisitor visitor = new CheckerVisitor(monitor); - resource.accept(visitor); - monitor.worked(1); - } - return handler.finish(null); - } } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/StaticCheckerApplication.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/StaticCheckerApplication.java index f3a5104a0c..5f94fd5536 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/StaticCheckerApplication.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/StaticCheckerApplication.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -142,40 +142,40 @@ private void processCommandLine(String[] args) { for (int i = 0; i < args.length; i += 1) { String arg = args[i]; - if (arg.equals("-h") || arg.equals("--help")) { + if ("-h".equals(arg) || "--help".equals(arg)) { doHelp = true; break; - } else if (arg.equals("--assertions_only")) { + } else if ("--assertions_only".equals(arg)) { assertionsOnly = true; - } else if (arg.equals("--excludes")) { + } else if ("--excludes".equals(arg)) { if (i == args.length - 1) { System.err.println("Missing --excludes argument"); doHelp = true; break; } excludes = args[++i]; - } else if (arg.equals("--includes")) { + } else if ("--includes".equals(arg)) { if (i == args.length - 1) { System.err.println("Missing --includes argument"); doHelp = true; break; } includes = args[++i]; - } else if (arg.equals("--extra_dslds")) { + } else if ("--extra_dslds".equals(arg)) { if (i == args.length - 1) { System.err.println("Missing --extraDslds argument"); doHelp = true; break; } extraDslds = args[++i].split("\\|"); - } else if (arg.equals("--project_path")) { + } else if ("--project_path".equals(arg)) { if (i == args.length - 1) { System.err.println("Missing --project_path argument"); doHelp = true; break; } projectFolderPath = args[++i]; - } else if (arg.equals("--result_file")) { + } else if ("--result_file".equals(arg)) { if (i == args.length - 1) { System.err.println("Missing --result_file argument"); doHelp = true; @@ -212,7 +212,8 @@ private void printUsage(boolean isInvalid) { } System.out.println("Usage:"); - System.out.println("eclipse -application org.codehause.groovy.eclipse.staticCheck [--help] [-h] [--extra_dslds ] [--assertions_only] [--excludes ] [--includes ] [--project_path ] "); + System.out.println("eclipse -application org.codehause.groovy.eclipse.staticCheck" + + " [--help] [-h] [--extra_dslds ] [--assertions_only] [--excludes ] [--includes ] [--project_path ] "); System.out.println("where:"); System.out.println("\t--help OR -h Print this message and exit."); System.out.println("\t--extra_dslds list of extra dsld files to be included in this check. Use '|' as a file separator."); @@ -223,7 +224,9 @@ private void printUsage(boolean isInvalid) { System.out.println("\t--result_file File to send static checking results to. If not specified, then results sent to sysout."); System.out.println("\t Name of a project to type check. If not already in workspace, then must also use '--project_path'."); System.out.println(); - System.out.println("Ant style filters are allowed. Eg, src/org/codehaus/groovy/**/*.groovy means all files with groovy extensions in the org.codehaus.groovy package or below will be ex/included Filters can be concentenated using '|'."); + System.out.println("Ant style filters are allowed." + + " For example, src/org/codehaus/groovy/**/*.groovy means all files with groovy extensions in the org.codehaus.groovy tree will be ex/included." + + " Filters can be concentenated using '|'."); } private void removeExtraDslds() { diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/StaticTypeCheckerRequestor.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/StaticTypeCheckerRequestor.java index fbcfcc7f36..b0ed6a9b8c 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/StaticTypeCheckerRequestor.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/StaticTypeCheckerRequestor.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -102,10 +102,10 @@ private String printGenerics(ClassNode type) { } StringBuilder sb = new StringBuilder(); sb.append('<'); - for (int i = 0; i < type.getGenericsTypes().length; i++) { + for (int i = 0; i < type.getGenericsTypes().length; i += 1) { GenericsType gt = type.getGenericsTypes()[i]; sb.append(printTypeName(gt.getType())); - if (i < type.getGenericsTypes().length-1) { + if (i < type.getGenericsTypes().length - 1) { sb.append(','); } } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/SysoutStaticCheckerHandler.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/SysoutStaticCheckerHandler.java index 1c2292015d..710937f9e7 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/SysoutStaticCheckerHandler.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/checker/SysoutStaticCheckerHandler.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -29,7 +29,7 @@ */ public class SysoutStaticCheckerHandler implements IStaticCheckerHandler { - private int numProblems = 0; + private int numProblems; private final PrintStream out; @@ -92,4 +92,4 @@ private String createMessage() { return "FAILURE found " + numProblems + " type checking problems"; } } -} \ No newline at end of file +} diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/classpath/AutoAddContainerSupport.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/classpath/AutoAddContainerSupport.java index 3f4764f9a7..9f66ca7f86 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/classpath/AutoAddContainerSupport.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/classpath/AutoAddContainerSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2020 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/classpath/DSLDClasspathContainerDecorator.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/classpath/DSLDClasspathContainerDecorator.java index 51e483b164..a39030afe6 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/classpath/DSLDClasspathContainerDecorator.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/classpath/DSLDClasspathContainerDecorator.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/classpath/DSLDContainerInitializer.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/classpath/DSLDContainerInitializer.java index e09580a610..5a6212d0c6 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/classpath/DSLDContainerInitializer.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/classpath/DSLDContainerInitializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2020 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,7 +85,8 @@ public boolean canUpdateClasspathContainer(final IPath containerPath, final IJav } @Override - public void requestClasspathContainerUpdate(final IPath containerPath, final IJavaProject javaProject, final IClasspathContainer containerSuggestion) throws CoreException { + public void requestClasspathContainerUpdate(final IPath containerPath, final IJavaProject javaProject, final IClasspathContainer containerSuggestion) + throws CoreException { IClasspathContainer container = JavaCore.getClasspathContainer(containerPath, javaProject); if (container instanceof DSLDClasspathContainer) { ((DSLDClasspathContainer) container).reset(); diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/ContributionElems.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/ContributionElems.java index 2d3c11d38d..22ef31fa5c 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/ContributionElems.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/ContributionElems.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2022 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/ContributionGroup.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/ContributionGroup.java index 2121f0533a..371596797c 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/ContributionGroup.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/ContributionGroup.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2022 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package org.codehaus.groovy.eclipse.dsl.contributions; import static java.util.stream.Collectors.toList; + import static org.eclipse.jdt.core.Flags.AccStatic; import java.util.ArrayList; @@ -37,21 +38,23 @@ public class ContributionGroup extends GroovyObjectSupport implements IContribut /** * Alternative way to add a method contribution. */ - public void addMethodContribution(final String name, final ParameterContribution[] params, final String returnType, final String declaringType, final boolean isStatic, final boolean useNamedArgs) { - contributions.add(new MethodContributionElement(name, params, returnType, declaringType, isStatic, DEFAULT_PROVIDER, null, useNamedArgs, false, DEFAULT_RELEVANCE_MULTIPLIER)); + public void addMethodContribution(final String name, final ParameterContribution[] parameters, final String returnType, + final String declaringType, final boolean isStatic, final boolean namedArgs) { + int mult = DEFAULT_RELEVANCE_MULTIPLIER; + contributions.add(new MethodContributionElement(name, parameters, returnType, declaringType, isStatic, DEFAULT_PROVIDER, null, namedArgs, false, mult)); } /** * Alternative way to add a property contribution. */ public void addPropertyContribution(final String name, final String type, final String declaringType, final boolean isStatic) { - contributions.add(new PropertyContributionElement(name, type, declaringType, isStatic ? AccStatic : 0, DEFAULT_PROVIDER, null, false, DEFAULT_RELEVANCE_MULTIPLIER)); + int mods = isStatic ? AccStatic : 0, mult = DEFAULT_RELEVANCE_MULTIPLIER; + contributions.add(new PropertyContributionElement(name, type, declaringType, mods, DEFAULT_PROVIDER, null, false, mult)); } @Override public List getContributions(final GroovyDSLDContext pattern, final BindingSet matches) { - return contributions.stream().filter(element -> { - return pattern.matchesType(element.getDeclaringTypeName()); // only need to match on current type - }).collect(toList()); + return contributions.stream().filter(element -> pattern.matchesType(element.getDeclaringTypeName())).collect(toList()); + // only need to match on current type ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ } } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/DSLContributionGroup.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/DSLContributionGroup.java index 5cd004dd3f..8244093895 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/DSLContributionGroup.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/DSLContributionGroup.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2022 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -394,17 +394,17 @@ void property(final Map args) { String declaringType = asString(args.get("declaringType")); if (declaringType == null) declaringType = getTypeName(currentType); - int modifiers = 0; - if (isStatic) modifiers |= Flags.AccStatic; - if (isFinal(args)) modifiers |= Flags.AccFinal; + int mods = 0; + if (isStatic) mods |= Flags.AccStatic; + if (isFinal(args)) mods |= Flags.AccFinal; - String provider = asString(args.get("provider")); - if (provider == null) provider = this.provider; + String theProvider = asString(args.get("provider")); + if (theProvider == null) theProvider = this.provider; String doc = asString(args.get("doc")); boolean isDeprecated = isDeprecated(args); - contributions.add(new PropertyContributionElement(name, type, declaringType, modifiers, provider, doc, isDeprecated, DEFAULT_RELEVANCE_MULTIPLIER)); + contributions.add(new PropertyContributionElement(name, type, declaringType, mods, theProvider, doc, isDeprecated, DEFAULT_RELEVANCE_MULTIPLIER)); } } @@ -423,8 +423,8 @@ void method(final Map args) { String declaringType = asString(args.get("declaringType")); if (declaringType == null) declaringType = getTypeName(currentType); - String provider = asString(args.get("provider")); - if (provider == null) provider = this.provider; + String theProvider = asString(args.get("provider")); + if (theProvider == null) theProvider = this.provider; String doc = asString(args.get("doc")); boolean isDeprecated = isDeprecated(args); @@ -435,7 +435,7 @@ void method(final Map args) { ParameterContribution[] optionalParams = extractParams(args, "optionalParams"); contributions.add(new MethodContributionElement(name, params, namedParams, optionalParams, returnType, - declaringType, isStatic, provider, doc, useNamedArgs, noParens, isDeprecated, DEFAULT_RELEVANCE_MULTIPLIER)); + declaringType, isStatic, theProvider, doc, useNamedArgs, noParens, isDeprecated, DEFAULT_RELEVANCE_MULTIPLIER)); } } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/EmptyContributionElement.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/EmptyContributionElement.java index a817dd4c1e..f809acdc87 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/EmptyContributionElement.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/EmptyContributionElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2022 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/IContributionElement.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/IContributionElement.java index 6aadde32c7..97d2b8e703 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/IContributionElement.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/IContributionElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2022 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/IContributionGroup.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/IContributionGroup.java index e76177f982..7f06a07fbc 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/IContributionGroup.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/IContributionGroup.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2022 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/MethodContributionElement.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/MethodContributionElement.java index 691451a6f4..9ba1c31e43 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/MethodContributionElement.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/MethodContributionElement.java @@ -181,7 +181,8 @@ public List extraProposals(final ClassNode declaringType, final List extraProposals = new ArrayList<>(availableNamedParams.size()); for (Map.Entry available : availableNamedParams.entrySet()) { - extraProposals.add(new GroovyNamedArgumentProposal(available.getKey(), available.getValue(), toMethod(declaringType.redirect(), resolver), getContributionName())); + extraProposals.add(new GroovyNamedArgumentProposal(available.getKey(), available.getValue(), + toMethod(declaringType.redirect(), resolver), getContributionName())); } return extraProposals; } @@ -226,7 +227,7 @@ private void removeUsedParameters(final Map available, final } } - private MethodNode toMethod(ClassNode declaringType, ResolverCache resolver) { + private MethodNode toMethod(final ClassNode declaringType, final ResolverCache resolver) { if (cachedNamedParameters == null) { cachedNamedParameters = toParameters(namedParams, resolver); cachedOptionalParameters = toParameters(optionalParams, resolver); @@ -239,13 +240,14 @@ private MethodNode toMethod(ClassNode declaringType, ResolverCache resolver) { if (type == declaringType) type = returnType(resolver); method.setDeclaringClass(type); } else { - method = new MethodContribution(methodName, modifiers(), returnType(resolver), cachedNamedParameters, cachedOptionalParameters, cachedPositionalParameters); + method = new MethodContribution(methodName, modifiers(), returnType(resolver), + cachedNamedParameters, cachedOptionalParameters, cachedPositionalParameters); method.setDeclaringClass(declaringType(declaringType, resolver)); } return method; } - private static Parameter[] toParameters(ParameterContribution[] pcs, ResolverCache resolver) { + private static Parameter[] toParameters(final ParameterContribution[] pcs, final ResolverCache resolver) { Parameter[] ps; if (pcs == null) { ps = Parameter.EMPTY_ARRAY; @@ -259,14 +261,14 @@ private static Parameter[] toParameters(ParameterContribution[] pcs, ResolverCac return ps; } - private ClassNode declaringType(ClassNode lexicalDeclaringType, ResolverCache resolver) { + private ClassNode declaringType(final ClassNode lexicalDeclaringType, final ResolverCache resolver) { if (declaringType != null && cachedDeclaringType == null) { cachedDeclaringType = resolver.resolve(declaringType); } return cachedDeclaringType == null ? lexicalDeclaringType : cachedDeclaringType; } - private ClassNode returnType(ResolverCache resolver) { + private ClassNode returnType(final ResolverCache resolver) { if (cachedReturnType == null) { if (resolver != null) { cachedReturnType = resolver.resolve(returnType); @@ -326,7 +328,8 @@ public String toString() { public static class MethodContribution extends MethodNode implements MethodNodeWithNamedParams { - public MethodContribution(String name, int modifiers, ClassNode returnType, Parameter[] namedParams, Parameter[] optionalParams, Parameter[] positionalParams) { + public MethodContribution(final String name, final int modifiers, final ClassNode returnType, + final Parameter[] namedParams, final Parameter[] optionalParams, final Parameter[] positionalParams) { super(name, modifiers, returnType, MethodNodeWithNamedParams.concatParams(positionalParams, namedParams, optionalParams), null, null); this.namedParams = namedParams; @@ -354,7 +357,8 @@ public Parameter[] getPositionalParams() { public static class ConstructorContribution extends ConstructorNode implements MethodNodeWithNamedParams { - public ConstructorContribution(int modifiers, Parameter[] namedParams, Parameter[] optionalParams, Parameter[] positionalParams) { + public ConstructorContribution(final int modifiers, + final Parameter[] namedParams, final Parameter[] optionalParams, final Parameter[] positionalParams) { super(modifiers, MethodNodeWithNamedParams.concatParams(positionalParams, namedParams, optionalParams), null, null); this.namedParams = namedParams; diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/ParameterContribution.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/ParameterContribution.java index 79cf78bc8d..3ba773eed1 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/ParameterContribution.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/ParameterContribution.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2022 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -65,7 +65,7 @@ public Parameter toParameter(ResolverCache resolver) { } String i = "\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*"; - typeName = type.replaceAll("@(?:"+i+"\\.)*"+i+"(?:\\([^\\)]*\\))?\\s*", ""); + typeName = type.replaceAll("@(?:" + i + "\\.)*" + i + "(?:\\([^\\)]*\\))?\\s*", ""); } value = new Parameter(resolver != null ? resolver.resolve(typeName) : ClassHelper.dynamicType(), name); } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/PropertyContributionElement.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/PropertyContributionElement.java index d6725a0704..2e99a3adc3 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/PropertyContributionElement.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/contributions/PropertyContributionElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2022 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -94,7 +94,7 @@ protected ClassNode returnType(final ResolverCache resolver) { if (cachedType == null) { cachedType = resolver.resolve(propType); } - return cachedType == null ? ClassHelper.DYNAMIC_TYPE : cachedType; + return cachedType == null ? ClassHelper.dynamicType() : cachedType; } protected ClassNode declaringType(final ClassNode lexicalDeclaringType, final ResolverCache resolver) { diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/AbstractCreateOperation.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/AbstractCreateOperation.java index 11b945ec4c..ffed68b843 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/AbstractCreateOperation.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/AbstractCreateOperation.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/AbstractJavaTypeVerifiedRule.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/AbstractJavaTypeVerifiedRule.java index 2cad84b564..403c5b8f98 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/AbstractJavaTypeVerifiedRule.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/AbstractJavaTypeVerifiedRule.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -72,5 +72,4 @@ protected String composeErrorMessage(List allNonExistantTypes) { } return buffer.toString(); } - } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/AbstractSuggestionOperation.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/AbstractSuggestionOperation.java index 8c9efe6050..218942ec27 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/AbstractSuggestionOperation.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/AbstractSuggestionOperation.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/AddSuggestionsOperation.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/AddSuggestionsOperation.java index 546fc67681..231d8629b0 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/AddSuggestionsOperation.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/AddSuggestionsOperation.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/DeclaringTypeSuperTypeMatcher.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/DeclaringTypeSuperTypeMatcher.java index de8f168039..35447df529 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/DeclaringTypeSuperTypeMatcher.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/DeclaringTypeSuperTypeMatcher.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/DuplicateParameterRule.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/DuplicateParameterRule.java index b6141d012f..d1e23e5574 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/DuplicateParameterRule.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/DuplicateParameterRule.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -49,5 +49,4 @@ public ValueStatus checkValidity(Object value) { return status; } - -} \ No newline at end of file +} diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/EditSuggestionOperation.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/EditSuggestionOperation.java index 744cdac888..400d75f5cd 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/EditSuggestionOperation.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/EditSuggestionOperation.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/GroovyMethodSuggestion.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/GroovyMethodSuggestion.java index 0fcdbc744b..88776a8935 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/GroovyMethodSuggestion.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/GroovyMethodSuggestion.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/GroovyPropertySuggestion.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/GroovyPropertySuggestion.java index 9a53822236..5da75704dd 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/GroovyPropertySuggestion.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/GroovyPropertySuggestion.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -17,14 +17,7 @@ public class GroovyPropertySuggestion extends GroovySuggestion { - public GroovyPropertySuggestion( - GroovySuggestionDeclaringType declaringType, - String name, - String type, - boolean isStatic, - String javaDoc, - boolean isActive) { - + public GroovyPropertySuggestion(GroovySuggestionDeclaringType declaringType, String name, String type, boolean isStatic, String javaDoc, boolean isActive) { super(declaringType, name, type, isStatic, javaDoc, isActive); } } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/GroovySuggestion.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/GroovySuggestion.java index 6705489a0b..44f083bead 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/GroovySuggestion.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/GroovySuggestion.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/GroovySuggestionDeclaringType.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/GroovySuggestionDeclaringType.java index b315bc1a44..8ea0eb8358 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/GroovySuggestionDeclaringType.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/GroovySuggestionDeclaringType.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -54,18 +54,18 @@ public IGroovySuggestion createSuggestion(SuggestionDescriptor descriptor) { protected boolean containsSuggestion(IGroovySuggestion suggestion) { boolean isContained = false; if (suggestion instanceof GroovyPropertySuggestion) { - String name = suggestion.getName(); + String suggestionName = suggestion.getName(); for (IGroovySuggestion existingSugg : suggestions) { - if (existingSugg instanceof GroovyPropertySuggestion && existingSugg.getName().equals(name)) { + if (existingSugg instanceof GroovyPropertySuggestion && existingSugg.getName().equals(suggestionName)) { isContained = true; break; } } } else if (suggestion instanceof GroovyMethodSuggestion) { - String name = suggestion.getName(); + String suggestionName = suggestion.getName(); GroovyMethodSuggestion methodSuggestion = (GroovyMethodSuggestion) suggestion; for (IGroovySuggestion existingSugg : suggestions) { - if (existingSugg instanceof GroovyMethodSuggestion && existingSugg.getName().equals(name)) { + if (existingSugg instanceof GroovyMethodSuggestion && existingSugg.getName().equals(suggestionName)) { GroovyMethodSuggestion existingMethodSuggestion = (GroovyMethodSuggestion) existingSugg; List existingParameters = existingMethodSuggestion.getParameters(); @@ -112,7 +112,6 @@ public IGroovySuggestion replaceSuggestion(SuggestionDescriptor descriptor, IGro return nwSuggestion; } return null; - } public boolean removeSuggestion(IGroovySuggestion suggestion) { @@ -126,5 +125,4 @@ public List getSuggestions() { public boolean hasSuggestions() { return !suggestions.isEmpty(); } - } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/IBaseGroovySuggestion.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/IBaseGroovySuggestion.java index eb61bfe9bb..1c1cb86712 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/IBaseGroovySuggestion.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/IBaseGroovySuggestion.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/IGroovySuggestion.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/IGroovySuggestion.java index 661b32f3b3..90a99f72b5 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/IGroovySuggestion.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/IGroovySuggestion.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ISuggestionsOperation.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ISuggestionsOperation.java index 8a4016beb7..29346d74c6 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ISuggestionsOperation.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ISuggestionsOperation.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/IValueCheckingRule.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/IValueCheckingRule.java index 22d0f97651..12d65166ae 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/IValueCheckingRule.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/IValueCheckingRule.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/InferencingSuggestionsManager.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/InferencingSuggestionsManager.java index 1cf99a1e5a..a3c0c579e4 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/InferencingSuggestionsManager.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/InferencingSuggestionsManager.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -119,11 +119,10 @@ public boolean isValidProject(IProject project) { * including if the last modified project is no longer accessible. */ public IProject getlastModifiedProject() { - if (isValidProject(lastModifiedProject)) { - return lastModifiedProject; + if (!isValidProject(lastModifiedProject)) { + lastModifiedProject = null; } - // Otherwise, clear the last modified project - return lastModifiedProject = null; + return lastModifiedProject; } protected void writeToFile(IFile file, String value) { @@ -211,7 +210,6 @@ public IGroovySuggestion addSuggestion(SuggestionDescriptor descriptor) { GroovySuggestionDeclaringType declaringType = suggestions.get(declaringTypeName); if (declaringType == null) { declaringType = new GroovySuggestionDeclaringType(declaringTypeName); - } IGroovySuggestion createdSuggestion = declaringType.createSuggestion(descriptor); @@ -242,7 +240,5 @@ public void removeAll() { public Collection getDeclaringTypes() { return suggestions.values(); } - } - } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/JavaValidIdentifierRule.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/JavaValidIdentifierRule.java index edfc38d689..6295cb4135 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/JavaValidIdentifierRule.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/JavaValidIdentifierRule.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/JavaValidParameterizedTypeRule.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/JavaValidParameterizedTypeRule.java index 9a29741711..676ccb86cc 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/JavaValidParameterizedTypeRule.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/JavaValidParameterizedTypeRule.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -75,12 +75,10 @@ public ValueStatus checkValidity(Object value) { } else { return ValueStatus.getValidStatus(value); } - } catch (JavaModelException e) { GroovyDSLCoreActivator.logException(e); return ValueStatus.getErrorStatus(value, e.getLocalizedMessage()); } - } return ValueStatus.getErrorStatus(value, INVALID_JAVA); } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/JavaValidTypeRule.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/JavaValidTypeRule.java index a89ed3a239..954e1bddf7 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/JavaValidTypeRule.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/JavaValidTypeRule.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/MethodParameter.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/MethodParameter.java index 23b3b0b487..324d22c87d 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/MethodParameter.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/MethodParameter.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/OperationManager.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/OperationManager.java index aec5a31139..1a07a597bd 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/OperationManager.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/OperationManager.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/RemoveSuggestionOperation.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/RemoveSuggestionOperation.java index a8e4729b4c..4830dbf3f1 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/RemoveSuggestionOperation.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/RemoveSuggestionOperation.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionDescriptor.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionDescriptor.java index c1d979e5e3..72700d25a6 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionDescriptor.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionDescriptor.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -26,7 +26,7 @@ public class SuggestionDescriptor { private boolean isStatic; - private boolean isMethod = false; + private boolean isMethod; private String name; @@ -95,7 +95,6 @@ public SuggestionDescriptor(IGroovySuggestion suggestion, boolean isActive) { this.parameters = methodSuggestion.getParameters(); this.isMethod = true; } - } public boolean isStatic() { @@ -133,5 +132,4 @@ public boolean isUseArgumentNames() { public List getParameters() { return parameters; } - } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionFactory.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionFactory.java index b1a2b82181..b28996603a 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionFactory.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionFactory.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -21,22 +21,18 @@ public class SuggestionFactory { public SuggestionFactory(SuggestionDescriptor descriptor) { this.descriptor = descriptor; - } public IGroovySuggestion createSuggestion(GroovySuggestionDeclaringType declaringType) { - IGroovySuggestion suggestion = null; if (declaringType != null) { - suggestion = descriptor.isMethod() ? new GroovyMethodSuggestion(declaringType, descriptor.getParameters(), - descriptor.isUseArgumentNames(), descriptor.getName(), descriptor.getSuggestionType(), descriptor.isStatic(), - descriptor.getJavaDoc(), descriptor.isActive()) : - - new GroovyPropertySuggestion(declaringType, descriptor.getName(), descriptor.getSuggestionType(), - descriptor.isStatic(), descriptor.getJavaDoc(), descriptor.isActive()); + suggestion = descriptor.isMethod() + ? new GroovyMethodSuggestion(declaringType, descriptor.getParameters(), descriptor.isUseArgumentNames(), + descriptor.getName(), descriptor.getSuggestionType(), descriptor.isStatic(), descriptor.getJavaDoc(), descriptor.isActive()) + : new GroovyPropertySuggestion(declaringType, descriptor.getName(), + descriptor.getSuggestionType(), descriptor.isStatic(), descriptor.getJavaDoc(), descriptor.isActive()); } return suggestion; } - } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsContributionGroup.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsContributionGroup.java index c7c716651d..56e9d4bece 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsContributionGroup.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsContributionGroup.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2020 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsLoader.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsLoader.java index 5783565c2e..14bdc8df17 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsLoader.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsLoader.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -65,5 +65,4 @@ public void addSuggestionsContributionGroup() { store.addContributionGroup(new SuggestionsPointCut(file), new SuggestionsContributionGroup(file)); } - } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsPointCut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsPointCut.java index 4d39f3ed0d..317728b5f0 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsPointCut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsPointCut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsRequestor.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsRequestor.java index 8a81bbb206..dfc8f68fa6 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsRequestor.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsRequestor.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsUIOperation.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsUIOperation.java index 1ac46f871c..3679531930 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsUIOperation.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/SuggestionsUIOperation.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -81,10 +81,8 @@ public ValueStatus run() { SuggestionDescriptor descriptor = dialogue.getSuggestionChange(); operation.setSuggestionDescriptor(descriptor); return operation.run(); - } return ValueStatus.getErrorStatus(null, UNABLE_TO_OPEN_DIALOGUE); } - } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ValueStatus.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ValueStatus.java index 55a653dd7e..c085796b7a 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ValueStatus.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ValueStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/AbstractSuggestionLabel.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/AbstractSuggestionLabel.java index 95b7c6be31..6a939484aa 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/AbstractSuggestionLabel.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/AbstractSuggestionLabel.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/GroovySuggestionsTable.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/GroovySuggestionsTable.java index ae97ff8191..b4a53b30a4 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/GroovySuggestionsTable.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/GroovySuggestionsTable.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -117,6 +117,8 @@ public int getWidth() { } } + //-------------------------------------------------------------------------- + public GroovySuggestionsTable(List projects) { this.projects = projects != null ? projects : new ArrayList<>(); } @@ -448,58 +450,6 @@ protected boolean isViewerDisposed() { return false; } - protected static class ViewerContentProvider implements ITreePathContentProvider { - @Override - public Object[] getElements(Object inputElement) { - if (inputElement instanceof Collection) { - List suggestedTypes = new ArrayList<>(); - Collection topLevel = (Collection) inputElement; - for (Object possibleTypeSuggestion : topLevel) { - if (possibleTypeSuggestion instanceof GroovySuggestionDeclaringType) { - suggestedTypes.add(possibleTypeSuggestion); - } - } - return suggestedTypes.toArray(); - } - return null; - } - - @Override - public Object[] getChildren(TreePath path) { - Object lastElement = path.getLastSegment(); - if (lastElement instanceof GroovySuggestionDeclaringType) { - GroovySuggestionDeclaringType treeElement = (GroovySuggestionDeclaringType) lastElement; - - List properties = treeElement.getSuggestions(); - - if (properties != null) { - return properties.toArray(); - } - } - return null; - } - - @Override - public TreePath[] getParents(Object element) { - return new TreePath[] {}; - } - - @Override - public boolean hasChildren(TreePath path) { - return getChildren(path) != null; - } - - @Override - public void dispose() { - // nothing for now - } - - @Override - public void inputChanged(Viewer viewer, Object e1, Object e2) { - // nothing for now - } - } - /** * Always returns a non-null selection list. May be empty if no selections * are present. @@ -511,43 +461,6 @@ protected List getSelections() { return Collections.EMPTY_LIST; } - protected static class ViewerLabelProvider extends ColumnLabelProvider { - @Override - public void update(ViewerCell cell) { - Object element = cell.getElement(); - int index = cell.getColumnIndex(); - - cell.setText(getColumnText(element, index)); - cell.setImage(getColumnImage(element, index)); - cell.setFont(getFont(element)); - } - - public Image getColumnImage(Object element, int index) { - return null; - } - - @Override - public Font getFont(Object element) { - return super.getFont(element); - } - - public String getColumnText(Object element, int index) { - ColumnTypes[] values = ColumnTypes.values(); - if (index < values.length) { - ColumnTypes colType = values[index]; - - String text = null; - switch (colType) { - case SUGGESTIONS: - text = getDisplayString(element); - break; - } - return text; - } - return null; - } - } - protected static String getDisplayString(Object element) { String text = null; if (element instanceof GroovySuggestionDeclaringType) { @@ -611,6 +524,8 @@ public void widgetSelected(SelectionEvent e) { return button; } + //-------------------------------------------------------------------------- + public static class SuggestionViewerSorter extends TreeViewerSorter { @Override protected String getCompareString(TreeColumn column, Object rowItem) { @@ -698,4 +613,93 @@ public int compare(Viewer viewer, Object e1, Object e2) { protected abstract String getCompareString(TreeColumn column, Object rowItem); } + + protected static class ViewerLabelProvider extends ColumnLabelProvider { + @Override + public void update(ViewerCell cell) { + Object element = cell.getElement(); + int index = cell.getColumnIndex(); + + cell.setText(getColumnText(element, index)); + cell.setImage(getColumnImage(element, index)); + cell.setFont(getFont(element)); + } + + public Image getColumnImage(Object element, int index) { + return null; + } + + @Override + public Font getFont(Object element) { + return super.getFont(element); + } + + public String getColumnText(Object element, int index) { + ColumnTypes[] values = ColumnTypes.values(); + if (index < values.length) { + ColumnTypes colType = values[index]; + + String text = null; + switch (colType) { + case SUGGESTIONS: + text = getDisplayString(element); + break; + } + return text; + } + return null; + } + } + + protected static class ViewerContentProvider implements ITreePathContentProvider { + @Override + public Object[] getElements(Object inputElement) { + if (inputElement instanceof Collection) { + List suggestedTypes = new ArrayList<>(); + Collection topLevel = (Collection) inputElement; + for (Object possibleTypeSuggestion : topLevel) { + if (possibleTypeSuggestion instanceof GroovySuggestionDeclaringType) { + suggestedTypes.add(possibleTypeSuggestion); + } + } + return suggestedTypes.toArray(); + } + return null; + } + + @Override + public Object[] getChildren(TreePath path) { + Object lastElement = path.getLastSegment(); + if (lastElement instanceof GroovySuggestionDeclaringType) { + GroovySuggestionDeclaringType treeElement = (GroovySuggestionDeclaringType) lastElement; + + List properties = treeElement.getSuggestions(); + + if (properties != null) { + return properties.toArray(); + } + } + return null; + } + + @Override + public TreePath[] getParents(Object element) { + return new TreePath[] {}; + } + + @Override + public boolean hasChildren(TreePath path) { + return getChildren(path) != null; + } + + @Override + public void dispose() { + // nothing for now + } + + @Override + public void inputChanged(Viewer viewer, Object e1, Object e2) { + // nothing for now + } + } } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/ISuggestionLabel.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/ISuggestionLabel.java index ffbfb704e1..ddd15eadcf 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/ISuggestionLabel.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/ISuggestionLabel.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/ITreeViewerColumn.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/ITreeViewerColumn.java index 3fd7db2076..670aff6e46 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/ITreeViewerColumn.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/ITreeViewerColumn.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/InferencingPreferencesPage.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/InferencingPreferencesPage.java index 62321c4128..d9708fee74 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/InferencingPreferencesPage.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/InferencingPreferencesPage.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/MethodSuggestionLabel.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/MethodSuggestionLabel.java index 940f71c015..f579c3d7c4 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/MethodSuggestionLabel.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/MethodSuggestionLabel.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/PropertySuggestionLabel.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/PropertySuggestionLabel.java index 72b5887e86..127ea20e95 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/PropertySuggestionLabel.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/PropertySuggestionLabel.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/SuggestionLabelFactory.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/SuggestionLabelFactory.java index 79e5fc5b96..e96a135225 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/SuggestionLabelFactory.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/SuggestionLabelFactory.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -29,5 +29,4 @@ public ISuggestionLabel getSuggestionLabel(IGroovySuggestion suggestion) { } return null; } - } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/SuggestionsViewer.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/SuggestionsViewer.java index c3cb54cb4d..2e78fb10b1 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/SuggestionsViewer.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/preferencepage/SuggestionsViewer.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -81,18 +81,17 @@ public void createControls(Composite parent) { tree.setSortColumn(sortColumn); tree.setSortDirection(SWT.UP); } - TreeColumn[] columns = viewer.getTree().getColumns(); + TreeColumn[] treeColumns = viewer.getTree().getColumns(); if (columnListener != null) { removeListeners(); } columnListener = new ColumnSortListener(); - for (TreeColumn column : columns) { - column.addSelectionListener(columnListener); + for (TreeColumn treeColumn : treeColumns) { + treeColumn.addSelectionListener(columnListener); } tree.setHeaderVisible(true); tree.setLinesVisible(true); viewer.refresh(); - } public ContainerCheckedTreeViewer getTreeViewer() { @@ -104,25 +103,20 @@ protected int getHeightHint() { } protected TreeColumn getDefaultSortColumn() { - if (defaultSortColumn == null) { - return null; - } - - String sortColumnName = defaultSortColumn.getName(); - - if (sortColumnName != null) { - Tree tree = viewer.getTree(); - TreeColumn[] columns = tree.getColumns(); - if (columns != null) { - - for (TreeColumn column : columns) { - if (sortColumnName.equals(column.getText())) { - return column; + if (defaultSortColumn != null) { + String sortColumnName = defaultSortColumn.getName(); + if (sortColumnName != null) { + Tree tree = viewer.getTree(); + TreeColumn[] treeColumns = tree.getColumns(); + if (treeColumns != null) { + for (TreeColumn treeColumn : treeColumns) { + if (sortColumnName.equals(treeColumn.getText())) { + return treeColumn; + } } } } } - return null; } @@ -135,11 +129,8 @@ public void dispose() { } protected void removeListeners() { - if (columnListener != null) { - TreeColumn[] columns = viewer.getTree().getColumns(); - - for (TreeColumn column : columns) { + for (TreeColumn column : viewer.getTree().getColumns()) { column.removeSelectionListener(columnListener); } } @@ -149,18 +140,18 @@ protected class ColumnSortListener extends SelectionAdapter { @Override public void widgetSelected(SelectionEvent e) { if (e.widget instanceof TreeColumn) { - TreeColumn selected = (TreeColumn) e.widget; Tree tree = viewer.getTree(); - TreeColumn current = tree.getSortColumn(); + TreeColumn selected = (TreeColumn) e.widget; + TreeColumn sortColumn = tree.getSortColumn(); int newDirection = SWT.UP; - if (current == selected) { + if (sortColumn == selected) { newDirection = tree.getSortDirection() == SWT.UP ? SWT.DOWN : SWT.UP; - } else { tree.setSortColumn(selected); } tree.setSortDirection(newDirection); + viewer.refresh(); } } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/AbstractControlManager.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/AbstractControlManager.java index ad36abd371..7a936ee9e1 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/AbstractControlManager.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/AbstractControlManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/AbstractLabeledDialogueControl.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/AbstractLabeledDialogueControl.java index 28d31a34ee..81a47bd9e2 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/AbstractLabeledDialogueControl.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/AbstractLabeledDialogueControl.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/AddInferencingSuggestionDialogue.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/AddInferencingSuggestionDialogue.java index 13564c284c..cdb4240b30 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/AddInferencingSuggestionDialogue.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/AddInferencingSuggestionDialogue.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -51,7 +51,7 @@ public class AddInferencingSuggestionDialogue extends AbstractDialogue { private boolean isStatic; - private boolean isMethod = false; + private boolean isMethod; private String suggestionName; @@ -95,7 +95,8 @@ public AddInferencingSuggestionDialogue(Shell parentShell, IProject project) { this(parentShell, project, null, null, true); } - protected AddInferencingSuggestionDialogue(Shell parentShell, IProject project, IGroovySuggestion currentSuggestion, GroovySuggestionDeclaringType declaringType, boolean isActive) { + protected AddInferencingSuggestionDialogue(Shell parentShell, IProject project, + IGroovySuggestion currentSuggestion, GroovySuggestionDeclaringType declaringType, boolean isActive) { super(parentShell); this.project = project; this.currentSuggestion = currentSuggestion; @@ -185,7 +186,8 @@ protected void handleValidatedValue(ControlSelectionEvent event) { } }); - JavaTypeBrowsingControl declaringTypeControl = new JavaTypeBrowsingControl(ControlTypes.DECLARING_TYPE, getOffsetLabelLocation(), declaringTypeName, getJavaProject()) { + JavaTypeBrowsingControl declaringTypeControl = new JavaTypeBrowsingControl( + ControlTypes.DECLARING_TYPE, getOffsetLabelLocation(), declaringTypeName, getJavaProject()) { // Don't check for parameterized types as it not necessary for declaring types @Override protected IValueCheckingRule getCachedValidationRule() { @@ -205,7 +207,8 @@ protected void handleValidatedValue(ControlSelectionEvent event) { } }); - JavaTypeBrowsingControl suggestionTypeControl = new JavaTypeBrowsingControl(ControlTypes.TYPE, getOffsetLabelLocation(), suggestionType, getJavaProject()) { + JavaTypeBrowsingControl suggestionTypeControl = new JavaTypeBrowsingControl( + ControlTypes.TYPE, getOffsetLabelLocation(), suggestionType, getJavaProject()) { @Override protected ValueStatus isControlValueValid(String value) { if (value == null || value.length() == 0) { @@ -240,8 +243,8 @@ public void handleSelection(ControlSelectionEvent event) { // Set Property as the default selected button ControlTypes defaultSuggestionTypeButton = isMethod ? ControlTypes.METHOD : ControlTypes.PROPERTY; - RadioSelectionDialogueControl radioSelection = new RadioSelectionDialogueControl(new IDialogueControlDescriptor[] { - ControlTypes.PROPERTY, ControlTypes.METHOD }, defaultSuggestionTypeButton); + RadioSelectionDialogueControl radioSelection = new RadioSelectionDialogueControl( + new IDialogueControlDescriptor[] {ControlTypes.PROPERTY, ControlTypes.METHOD}, defaultSuggestionTypeButton); radioSelection.createControlArea(parent); @@ -277,15 +280,13 @@ public void handleSelection(ControlSelectionEvent event) { } } }); - } protected Point getOffsetLabelLocation() { if (labelControlOffset == null) { - IDialogueControlDescriptor[] descriptors = new IDialogueControlDescriptor[] { ControlTypes.DECLARING_TYPE, - ControlTypes.IS_STATIC, ControlTypes.TYPE, ControlTypes.NAME }; + IDialogueControlDescriptor[] descriptors = {ControlTypes.DECLARING_TYPE, ControlTypes.IS_STATIC, ControlTypes.TYPE, ControlTypes.NAME}; String[] labelNames = new String[descriptors.length]; - for (int i = 0; i < descriptors.length; ++i) { + for (int i = 0; i < descriptors.length; i += 1) { labelNames[i] = descriptors[i].getLabel(); } labelControlOffset = getOffsetLabelLocation(labelNames); @@ -305,7 +306,5 @@ public void handleSelection(ControlSelectionEvent event) { } } }); - } - } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ButtonDialogueControl.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ButtonDialogueControl.java index 89b35d0cd7..6c7161933d 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ButtonDialogueControl.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ButtonDialogueControl.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ControlSelectionEvent.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ControlSelectionEvent.java index 024a41801e..592abedec9 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ControlSelectionEvent.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ControlSelectionEvent.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ControlSelectionListener.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ControlSelectionListener.java index ff16fcfe65..711e0f71b4 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ControlSelectionListener.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ControlSelectionListener.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -16,6 +16,7 @@ package org.codehaus.groovy.eclipse.dsl.inferencing.suggestions.ui; public abstract class ControlSelectionListener implements IControlSelectionListener { + @Override public void handleInvalidSelection(ControlSelectionEvent event) { } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ControlTypes.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ControlTypes.java index 036fa58d3d..377917b665 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ControlTypes.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ControlTypes.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/DialogueDescriptor.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/DialogueDescriptor.java index 35d1e59fc1..8e0992e026 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/DialogueDescriptor.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/DialogueDescriptor.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -16,6 +16,7 @@ package org.codehaus.groovy.eclipse.dsl.inferencing.suggestions.ui; public class DialogueDescriptor { + private String message; private String title; diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/DocumentDialogueControl.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/DocumentDialogueControl.java index 3971924434..44c6c1e138 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/DocumentDialogueControl.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/DocumentDialogueControl.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/EditInferencingSuggestionDialogue.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/EditInferencingSuggestionDialogue.java index 59d50d607f..18252484d2 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/EditInferencingSuggestionDialogue.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/EditInferencingSuggestionDialogue.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/IControlSelectionListener.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/IControlSelectionListener.java index fa197cda65..2107f02bd3 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/IControlSelectionListener.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/IControlSelectionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/IDialogueControlDescriptor.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/IDialogueControlDescriptor.java index 0b66c64db6..d65487f797 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/IDialogueControlDescriptor.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/IDialogueControlDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/IDialogueControlManager.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/IDialogueControlManager.java index 3e73e738e7..99b40d5195 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/IDialogueControlManager.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/IDialogueControlManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/IProjectUIControl.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/IProjectUIControl.java index 1f20026c8c..1292efa8a7 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/IProjectUIControl.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/IProjectUIControl.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ISelectionHandler.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ISelectionHandler.java index aab6d2f379..4e2f191db6 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ISelectionHandler.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ISelectionHandler.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/JavaTextControl.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/JavaTextControl.java index 7b34769c55..3916dc65d2 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/JavaTextControl.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/JavaTextControl.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -63,7 +63,6 @@ protected ValueStatus isControlValueValid(Control control) { if (control == textControl) { String stringVal = textControl.getText(); return isControlValueValid(stringVal); - } return null; } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/JavaTypeBrowsingControl.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/JavaTypeBrowsingControl.java index af3923347c..31b646e78f 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/JavaTypeBrowsingControl.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/JavaTypeBrowsingControl.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/MethodParameterDialogue.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/MethodParameterDialogue.java index c00aae76bc..a836e87140 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/MethodParameterDialogue.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/MethodParameterDialogue.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -63,11 +63,9 @@ protected DialogueDescriptor getDialogueDescriptor() { protected Point getOffsetLabelLocation() { if (labelOffset == null) { - IDialogueControlDescriptor[] descriptors = new IDialogueControlDescriptor[] { ControlTypes.TYPE, ControlTypes.NAME - - }; + IDialogueControlDescriptor[] descriptors = {ControlTypes.TYPE, ControlTypes.NAME}; String[] labelNames = new String[descriptors.length]; - for (int i = 0; i < descriptors.length; ++i) { + for (int i = 0; i < descriptors.length; i += 1) { labelNames[i] = descriptors[i].getLabel(); } labelOffset = getOffsetLabelLocation(labelNames); @@ -88,7 +86,6 @@ protected ValueStatus isControlValueValid(Control control) { } return status; } - }; nameControl.createControlArea(parent); nameControl.addSelectionListener(new ValidatedValueSelectionListener(ControlTypes.NAME, name) { @@ -114,7 +111,6 @@ protected ValueStatus isControlValueValid(String value) { } return super.isControlValueValid(value); } - }; typeControl.createControlArea(parent); diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/MethodParameterTable.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/MethodParameterTable.java index ccc0201c09..c07039d3d7 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/MethodParameterTable.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/MethodParameterTable.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ProjectDisplayControl.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ProjectDisplayControl.java index 487a0e2560..2939ed7d70 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ProjectDisplayControl.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ProjectDisplayControl.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ProjectDropDownControl.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ProjectDropDownControl.java index c874f1ee13..f5a49abd8b 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ProjectDropDownControl.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/ProjectDropDownControl.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -65,7 +65,6 @@ public static IProjectUIControl getProjectSelectionControl(List projec if (projects.size() == 1) { control.setProject(projects.get(0)); } - } else { control = new ProjectDropDownControl(projects, shell, parent, handler); } @@ -98,7 +97,6 @@ public void widgetSelected(SelectionEvent e) { // Set the first project as the displayed selection setProject(projects.get(0)); - } /** @@ -147,7 +145,6 @@ public IProject setProject(IProject projectToSelect) { } else { return null; } - } protected void handleProjectChange(IProject selectedProject) { @@ -156,5 +153,4 @@ protected void handleProjectChange(IProject selectedProject) { handler.selectionChanged(selectedProject); } } - } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/RadioSelectionDialogueControl.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/RadioSelectionDialogueControl.java index fa246a9c3b..a616a582f8 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/RadioSelectionDialogueControl.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/ui/RadioSelectionDialogueControl.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionElementStatics.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionElementStatics.java index 9fdd9fada1..d87a334efd 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionElementStatics.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionElementStatics.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -44,5 +44,4 @@ public class SuggestionElementStatics { public static final String USE_NAMED_ARGUMENTS_ATT = "useNamedArguments"; public static final String IS_ACTIVE = "isActive"; - } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionsFile.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionsFile.java index 540ccb9afb..caeccb9fc7 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionsFile.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionsFile.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -38,8 +38,7 @@ public class SuggestionsFile { public SuggestionsFile(IProject project) { this.project = project; - location = new SuggestionsFileProperties(); - + this.location = new SuggestionsFileProperties(); } public IProject getProject() { diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionsFileProperties.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionsFileProperties.java index a99a65c647..43a5c4fdf6 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionsFileProperties.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionsFileProperties.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionsReader.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionsReader.java index 6958e8051e..08fc5eea6a 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionsReader.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionsReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionsTransform.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionsTransform.java index f016cd2164..abea58e8ff 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionsTransform.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/SuggestionsTransform.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -82,7 +82,6 @@ public String transform() { StreamResult result = new StreamResult(bufferWriter); transformer.transform(source, result); return buffer.toString(); - } catch (TransformerConfigurationException e) { GroovyDSLCoreActivator.logException(e); } catch (IllegalArgumentException e) { @@ -94,9 +93,7 @@ public String transform() { } catch (TransformerException e) { GroovyDSLCoreActivator.logException(e); } - return null; - } protected void transform(TransformElement element, Node parent, Document document) { @@ -129,6 +126,4 @@ protected void transform(TransformElement element, Node parent, Document documen } } } - - } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/TransformElement.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/TransformElement.java index d66e1534e4..b8d7a8de44 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/TransformElement.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/TransformElement.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/TransformElementFactory.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/TransformElementFactory.java index 40c87e9b40..8215fb2030 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/TransformElementFactory.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/TransformElementFactory.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -45,8 +45,7 @@ public TransformElement getSuggestionsElement(IGroovySuggestion suggestion) { TransformElement argumentsElement = new TransformElement(SuggestionElementStatics.PARAMETERS, null); suggestionsElement.addChild(argumentsElement); - argumentsElement.addProperty(SuggestionElementStatics.USE_NAMED_ARGUMENTS_ATT, methodSuggestion.useNamedArguments() - + ""); + argumentsElement.addProperty(SuggestionElementStatics.USE_NAMED_ARGUMENTS_ATT, methodSuggestion.useNamedArguments() + ""); List parameters = methodSuggestion.getParameters(); if (parameters != null) { @@ -88,6 +87,5 @@ public TransformElement getDeclaringTypeWriterElement(GroovySuggestionDeclaringT } return declaringTypeElement; - } } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/TransformElementProperty.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/TransformElementProperty.java index 9098150a76..4f991cc2d4 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/TransformElementProperty.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/inferencing/suggestions/writer/TransformElementProperty.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/lookup/DSLDTypeLookup.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/lookup/DSLDTypeLookup.java index 76da7a859c..8161f938a7 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/lookup/DSLDTypeLookup.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/lookup/DSLDTypeLookup.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2022 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/lookup/ResolverCache.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/lookup/ResolverCache.java index d2e89cda77..8a5359042d 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/lookup/ResolverCache.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/lookup/ResolverCache.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,7 @@ public ResolverCache(JDTResolver resolver, ModuleNode module) { */ public ClassNode resolve(String name) { if (name == null || (name = name.trim()).isEmpty()) { - return ClassHelper.DYNAMIC_TYPE; + return ClassHelper.dynamicType(); } if ("void".equals(name) || "java.lang.Void".equals(name)) { return VariableScope.VOID_CLASS_NODE; diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/AbstractPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/AbstractPointcut.java index 57c18777d4..149a15b824 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/AbstractPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/AbstractPointcut.java @@ -277,13 +277,28 @@ public void accept(Closure contributionGroupClosure) { */ protected final String allArgsArePointcuts() throws PointcutVerificationException { for (Object arg : elements.getElements()) { - if (arg == null) { - continue; - } - if (!(arg instanceof IPointcut)) { - return "All arguments should be pointcuts"; - } else { + if (arg instanceof IPointcut) { ((IPointcut) arg).verify(); + } else if (arg != null) { + return "All arguments should be pointcuts"; + } + } + return null; + } + + protected final String allArgsAreClasses() { + for (Object arg : elements.getElements()) { + if (arg != null && !(arg instanceof Class)) { + return "All arguments should be classes"; + } + } + return null; + } + + protected final String allArgsAreStrings() { + for (Object arg : elements.getElements()) { + if (arg != null && !(arg instanceof String)) { + return "All arguments should be strings"; } } return null; @@ -334,77 +349,42 @@ protected final String hasNoArgs() { } } - protected final String allArgsAreStrings() { - for (Object arg : elements.getElements()) { - if (arg == null) { - continue; - } - if (!(arg instanceof String)) { - return "All arguments should be strings"; - } - } - return null; - } - protected final String oneStringOrOnePointcutArg() throws PointcutVerificationException { - String maybeStatus = allArgsAreStrings(); - String maybeStatus2 = allArgsArePointcuts(); - if (maybeStatus != null && maybeStatus2 != null) { + if (allArgsArePointcuts() != null && allArgsAreStrings() != null) { return "This pointcut supports exactly one argument of type Pointcut or String. Consider using '&' or '|' to connect arguments."; } - maybeStatus = hasOneArg(); - if (maybeStatus != null) { - return maybeStatus; - } - return null; + String message = hasOneArg(); + return message != null ? message : null; } protected final String oneStringOrOnePointcutOrOneClassArg() throws PointcutVerificationException { - String maybeStatus = allArgsAreStrings(); - String maybeStatus2 = allArgsArePointcuts(); - String maybeStatus3 = allArgsAreClasses(); - if (maybeStatus != null && maybeStatus2 != null && maybeStatus3 != null) { + if (allArgsArePointcuts() != null && allArgsAreStrings() != null && allArgsAreClasses() != null) { return "This pointcut supports exactly one argument of type Pointcut or String or Class. Consider using '&' or '|' to connect arguments."; } - maybeStatus = hasOneArg(); - if (maybeStatus != null) { - return maybeStatus; - } - return null; - } - - protected final String allArgsAreClasses() { - for (Object arg : elements.getElements()) { - if (arg == null) { - continue; - } - if (!(arg instanceof Class)) { - return "All arguments should be classes"; - } - } - return null; + String message = hasOneArg(); + return message != null ? message : null; } protected IPointcut and(IPointcut other) { AbstractPointcut andPointcut = new AndPointcut(containerIdentifier, "and"); - andPointcut.setProject(project); andPointcut.addArgument(this); andPointcut.addArgument(other); + andPointcut.setProject(project); return andPointcut; } protected IPointcut or(IPointcut other) { AbstractPointcut orPointcut = new OrPointcut(containerIdentifier, "or"); - orPointcut.setProject(project); orPointcut.addArgument(this); orPointcut.addArgument(other); + orPointcut.setProject(project); return orPointcut; } protected IPointcut bitwiseNegate() { AbstractPointcut notPointcut = new NotPointcut(containerIdentifier, "not"); - notPointcut.setProject(project); notPointcut.addArgument(this); + notPointcut.setProject(project); return notPointcut; } @@ -424,7 +404,7 @@ protected void formatedString(StringBuilder sb, int indent) { static String spaces(int indent) { StringBuilder sb = new StringBuilder(indent + 2); - for (int i = 0; i < indent; i++) { + for (int i = 0; i < indent; i += 1) { sb.append(' '); } return sb.toString(); diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/GroovyDSLDContext.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/GroovyDSLDContext.java index 6eb17731cd..f808c2e88c 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/GroovyDSLDContext.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/GroovyDSLDContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2020 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/IPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/IPointcut.java index 67f1c7387f..694410c33c 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/IPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/IPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2018 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -115,7 +115,8 @@ public interface IPointcut { * The pointcut and the contribution group are registered in the {@link DSLDStore} * @param contributionGroupClosure the closure that will be used by an {@link IContributionGroup} */ - void accept(@DelegatesTo(value = IContributionGroup.class, strategy = Closure.DELEGATE_FIRST) @SuppressWarnings("rawtypes") Closure contributionGroupClosure); + @SuppressWarnings("rawtypes") + void accept(@DelegatesTo(value = IContributionGroup.class, strategy = Closure.DELEGATE_FIRST) Closure contributionGroupClosure); /** * User-readable name of the pointcut diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/PointcutVerificationException.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/PointcutVerificationException.java index 5480ab138b..3fa4c38088 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/PointcutVerificationException.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/PointcutVerificationException.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -41,7 +41,7 @@ public IPointcut getPointcut() { */ public String getPointcutMessage() { return "Invalid Pointcut: " + pointcut.getPointcutDebugName() + - "\nin: " + pointcut.getContainerIdentifier() + - "\nreason: " + getMessage(); + "\nin: " + pointcut.getContainerIdentifier() + + "\nreason: " + getMessage(); } } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/StringObjectVector.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/StringObjectVector.java index ffa6070b65..29653a00f6 100755 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/StringObjectVector.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/StringObjectVector.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/AbstractModifierPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/AbstractModifierPointcut.java index 0553060738..9d6426d44e 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/AbstractModifierPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/AbstractModifierPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2018 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/AndPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/AndPointcut.java index e57f7bb384..385fa0bd58 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/AndPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/AndPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -44,7 +44,7 @@ public Collection matches(GroovyDSLDContext pattern, Object toMatch) { } result.addAll(intermediate); } - return result.size() > 0 ? result : null; + return !result.isEmpty() ? result : null; } /** @@ -53,29 +53,28 @@ public Collection matches(GroovyDSLDContext pattern, Object toMatch) { @Override public IPointcut normalize() { IPointcut newPointcut = super.normalize(); - if (newPointcut instanceof AndPointcut) { - AndPointcut newAnd = (AndPointcut) newPointcut; - AndPointcut newNewAnd = new AndPointcut(getContainerIdentifier(), "and"); - // flatten the ands - for (int i = 0; i < newAnd.getArgumentValues().length; i++) { + AndPointcut newAnd = (AndPointcut) newPointcut; + AndPointcut newNewAnd = new AndPointcut(getContainerIdentifier(), "and"); + // flatten the ands + for (int i = 0; i < newAnd.getArgumentValues().length; i++) { String name = newAnd.getArgumentNames()[i]; Object argument = newAnd.getArgumentValues()[i]; if (argument instanceof AndPointcut && name == null) { - AndPointcut other = (AndPointcut) argument; - Object[] argumentValues = other.getArgumentValues(); - String[] argumentNames = other.getArgumentNames(); - int argCount = argumentNames.length; - for (int j = 0; j < argCount; j++) { - newNewAnd.addArgument(argumentNames[j], argumentValues[j]); - } + AndPointcut other = (AndPointcut) argument; + Object[] argumentValues = other.getArgumentValues(); + String[] argumentNames = other.getArgumentNames(); + int argCount = argumentNames.length; + for (int j = 0; j < argCount; j++) { + newNewAnd.addArgument(argumentNames[j], argumentValues[j]); + } } else { - newNewAnd.addArgument(name, argument); + newNewAnd.addArgument(name, argument); } } - return newNewAnd; + return newNewAnd; } else { - return newPointcut; + return newPointcut; } } @@ -88,18 +87,18 @@ public void verify() throws PointcutVerificationException { } } -// @Override -// protected IPointcut and(IPointcut other) { -// if (other instanceof AndPointcut) { -// Object[] argumentValues = other.getArgumentValues(); -// String[] argumentNames = other.getArgumentNames(); -// int argCount = argumentNames.length; -// for (int i = 0; i < argCount; i++) { -// this.addArgument(argumentNames[i], argumentValues[i]); -// } -// } else { -// addArgument(other); -// } -// return this; -// } + /*@Override + protected IPointcut and(IPointcut other) { + if (other instanceof AndPointcut) { + Object[] argumentValues = other.getArgumentValues(); + String[] argumentNames = other.getArgumentNames(); + int argCount = argumentNames.length; + for (int i = 0; i < argCount; i++) { + this.addArgument(argumentNames[i], argumentValues[i]); + } + } else { + addArgument(other); + } + return this; + }*/ } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/AssignedVariablePointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/AssignedVariablePointcut.java index f10d08516e..886deed9ad 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/AssignedVariablePointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/AssignedVariablePointcut.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2020 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/BindPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/BindPointcut.java index d31c8d0be6..6afe2d69f9 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/BindPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/BindPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/CurrentIdentifierPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/CurrentIdentifierPointcut.java index a130ec61e3..75e55a7f45 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/CurrentIdentifierPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/CurrentIdentifierPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2018 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/CurrentTypeIsEnclosingTypePointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/CurrentTypeIsEnclosingTypePointcut.java index f129e19b18..55debcb517 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/CurrentTypeIsEnclosingTypePointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/CurrentTypeIsEnclosingTypePointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/DeclaringTypePointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/DeclaringTypePointcut.java index bc98bedcc7..1390ecaad5 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/DeclaringTypePointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/DeclaringTypePointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingClassPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingClassPointcut.java index ae3cec19cd..05e57d2e89 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingClassPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingClassPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2018 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -52,7 +52,10 @@ public void verify() throws PointcutVerificationException { @Override public Collection matches(GroovyDSLDContext pattern, Object toMatch) { ClassNode enclosingType = pattern.getCurrentScope().getEnclosingTypeDeclaration(); - if (enclosingType == null || enclosingType.isScript() || enclosingType.isAnnotationDefinition() || (enclosingType.isInterface() && !isTrait(enclosingType))) { + if (enclosingType == null || + enclosingType.isScript() || + enclosingType.isAnnotationDefinition() || + (enclosingType.isInterface() && !isTrait(enclosingType))) { return null; } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingClosurePointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingClosurePointcut.java index f9de84dae4..fc46f2851d 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingClosurePointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingClosurePointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -53,4 +53,4 @@ public void verify() throws PointcutVerificationException { } super.verify(); } -} \ No newline at end of file +} diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingFieldPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingFieldPointcut.java index c00dbd7ff2..4a584f0f40 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingFieldPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingFieldPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingMethodPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingMethodPointcut.java index 9e38b32402..80b21ef72d 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingMethodPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingMethodPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingScriptPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingScriptPointcut.java index 0f01d95139..da04526607 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingScriptPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/EnclosingScriptPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -77,4 +77,4 @@ public void verify() throws PointcutVerificationException { } super.verify(); } -} \ No newline at end of file +} diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FileExtensionPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FileExtensionPointcut.java index 6dfa84b7ad..f88e2fdf62 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FileExtensionPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FileExtensionPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FileNamePointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FileNamePointcut.java index 532df539df..90f4dd2c5a 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FileNamePointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FileNamePointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FilteringPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FilteringPointcut.java index af9b7b58f6..615c005f56 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FilteringPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FilteringPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -88,7 +88,7 @@ protected String asString(Object o) { } protected Collection reduce(Collection filtered) { - if (filtered == null || filtered.size() == 0) { + if (filtered == null || filtered.isEmpty()) { return null; } else { return filtered; diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindASTPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindASTPointcut.java index 76b1b9d39a..d9d635b908 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindASTPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindASTPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindAnnotationPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindAnnotationPointcut.java index 9ba68f4e11..e49c0939b3 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindAnnotationPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindAnnotationPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2018 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindCtorPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindCtorPointcut.java index a1eca39e45..c801564cfd 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindCtorPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindCtorPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindFieldPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindFieldPointcut.java index 52f34b995e..812a80259d 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindFieldPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindFieldPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindMethodPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindMethodPointcut.java index 64159ee972..a16789abea 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindMethodPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindMethodPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindPropertyPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindPropertyPointcut.java index a03fa62677..57fc5e8056 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindPropertyPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/FindPropertyPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/HasArgumentsPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/HasArgumentsPointcut.java index e6c7da6ebc..32a1783bb9 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/HasArgumentsPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/HasArgumentsPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2018 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/HasAttributesPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/HasAttributesPointcut.java index 38be488623..d54beed77e 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/HasAttributesPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/HasAttributesPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/IsConfigScript.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/IsConfigScript.java index a4c1efb159..d92a5aea0e 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/IsConfigScript.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/IsConfigScript.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2018 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/IsThisTypePointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/IsThisTypePointcut.java index d871493f28..a0b6a83dc8 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/IsThisTypePointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/IsThisTypePointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/NamePointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/NamePointcut.java index 0556537d97..1a25fbc4cb 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/NamePointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/NamePointcut.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/NotPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/NotPointcut.java index ca14ba0b62..16c507c69f 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/NotPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/NotPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/OrPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/OrPointcut.java index f4b4c73d7b..74f8050230 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/OrPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/OrPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -44,7 +44,7 @@ public Collection matches(GroovyDSLDContext pattern, Object toMatch) { result.addAll(intermediate); } } - return result.size() > 0 ? result : null; + return !result.isEmpty() ? result : null; } /** diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/PackageFolderPointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/PackageFolderPointcut.java index 4470c676eb..be8cc33265 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/PackageFolderPointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/PackageFolderPointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/ProjectNaturePointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/ProjectNaturePointcut.java index 75978fa7ae..4f472688f7 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/ProjectNaturePointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/ProjectNaturePointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -34,7 +34,6 @@ */ public class ProjectNaturePointcut extends AbstractPointcut { - public ProjectNaturePointcut(IStorage containerIdentifier, String pointcutName) { super(containerIdentifier, pointcutName); } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/SourceFolderOfFilePointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/SourceFolderOfFilePointcut.java index 16189babf7..aa2150a953 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/SourceFolderOfFilePointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/SourceFolderOfFilePointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -45,7 +45,6 @@ public Collection matches(GroovyDSLDContext pattern, Object toMatch) { } } - @Override public boolean fastMatch(GroovyDSLDContext pattern) { return matches(pattern, null) != null; diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/SourceFolderOfTypePointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/SourceFolderOfTypePointcut.java index 50619531a7..bd8499e378 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/SourceFolderOfTypePointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/SourceFolderOfTypePointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -51,7 +51,6 @@ public Collection matches(GroovyDSLDContext pattern, Object toMatch) { } } - private ClassNode toType(Object toMatch) { if (toMatch instanceof ClassNode) { return (ClassNode) toMatch; @@ -75,10 +74,10 @@ private String extractFileName(ClassNode type, GroovyDSLDContext pattern) { int slashIndex = CharOperation.indexOf('/', fileName); if (slashIndex >= 0) { // need the second slash - slashIndex = CharOperation.indexOf('/', fileName, slashIndex+1); + slashIndex = CharOperation.indexOf('/', fileName, slashIndex + 1); } if (slashIndex > 0) { - return String.valueOf(CharOperation.subarray(fileName, slashIndex+1, fileName.length)); + return String.valueOf(CharOperation.subarray(fileName, slashIndex + 1, fileName.length)); } } } else { diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/SubTypePointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/SubTypePointcut.java index 4f86d6bbe6..ad087f2bc9 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/SubTypePointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/SubTypePointcut.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2020 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/TypePointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/TypePointcut.java index f84118098f..38b7cfb5b9 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/TypePointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/TypePointcut.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/UserExtensiblePointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/UserExtensiblePointcut.java index 1d2df78ae9..af09b02226 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/UserExtensiblePointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/UserExtensiblePointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2018 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/ValuePointcut.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/ValuePointcut.java index 8da5a7c91d..1d247a3287 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/ValuePointcut.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/pointcuts/impl/ValuePointcut.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -57,11 +57,8 @@ protected Object filterObject(Object result, GroovyDSLDContext context, String f return toCompare.equals(firstArgAsString) ? reify(result) : null; } - /** - * Attempt to convert this object (presumably an AST Node into a value in this compiler world - * @param result - * @return + * Attempts to convert this object (presumably an AST Node into a value in this compiler world. */ private Object reify(Object result) { if (result instanceof MapEntryExpression) { diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/proposals/DSLDProposalFilter.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/proposals/DSLDProposalFilter.java index 64c91945c4..104efd4c8c 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/proposals/DSLDProposalFilter.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/proposals/DSLDProposalFilter.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -32,12 +32,14 @@ public class DSLDProposalFilter implements IProposalFilterExtension { @Override - public List filterProposals(List proposals, ContentAssistContext context, JavaContentAssistInvocationContext javaContext) { + public List filterProposals(List proposals, + ContentAssistContext context, JavaContentAssistInvocationContext javaContext) { return null; } @Override - public List filterExtendedProposals(List proposals, ContentAssistContext context, JavaContentAssistInvocationContext javaContext) { + public List filterExtendedProposals(List proposals, + ContentAssistContext context, JavaContentAssistInvocationContext javaContext) { Map map = new LinkedHashMap<>(); for (ICompletionProposal proposal : proposals) { @@ -80,5 +82,6 @@ private static String getKeyString(ICompletionProposal proposal) { return key; } - private static final Pattern BASE_DESC = Pattern.compile("^.* - (\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*\\.)*\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*"); + private static final Pattern BASE_DESC = Pattern.compile("^.* - " + + "(\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*\\.)*\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*"); } diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/proposals/DSLDProposalProvider.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/proposals/DSLDProposalProvider.java index 8632bff3c1..afc755ba5a 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/proposals/DSLDProposalProvider.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/proposals/DSLDProposalProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/script/DSLDScriptExecutor.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/script/DSLDScriptExecutor.java index f4361c4ee1..6084309fca 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/script/DSLDScriptExecutor.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/script/DSLDScriptExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2021 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -95,7 +95,6 @@ public Object executeScript(IStorage scriptFile) { dsldScript.setBinding(new DSLDScriptBinding(dsldScript)); return dsldScript.run(); - } catch (UnsupportedDSLVersion e) { if (GroovyLogManager.manager.hasLoggers()) { GroovyLogManager.manager.log(TraceCategory.DSL, e.getMessage()); @@ -317,6 +316,7 @@ private final class DSLDScriptBinding extends Binding { DSLDScriptBinding(Script dsldScript) { this.dsldScript = dsldScript; } + private final Script dsldScript; @Override @@ -367,7 +367,7 @@ public Object getVariable(String name) { return new RegisterClosure(this); case "supportsVersion": - return new Closure(this) { + return new Closure<>(this) { private static final long serialVersionUID = 1L; @Override @@ -378,7 +378,7 @@ public Object call(Object... args) { }; case "assertVersion": - return new Closure(this) { + return new Closure<>(this) { private static final long serialVersionUID = 1L; @Override @@ -392,7 +392,7 @@ public Object call(Object... args) { }; case "contribute": - return new Closure(this) { + return new Closure<>(this) { private static final long serialVersionUID = 1L; @Override public Object call(Object... args) { @@ -405,7 +405,7 @@ public Object call(Object... args) { }; case "log": - return new Closure(this) { + return new Closure<>(this) { private static final long serialVersionUID = 1L; @Override public Object call(Object... args) { diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/script/PointcutClosure.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/script/PointcutClosure.java index 96bca078f9..249bb5a332 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/script/PointcutClosure.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/script/PointcutClosure.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/script/PointcutFactory.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/script/PointcutFactory.java index b239c0fec4..e6c7ef0d6e 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/script/PointcutFactory.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/script/PointcutFactory.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -80,6 +80,7 @@ public class PointcutFactory { private static final Set deprecatedRegistry = new HashSet<>(); static { // combinatorial pointcuts + registerGlobalPointcut("and", AndPointcut.class, createDoc(// "The exclusive combination of two or more pointcuts. The 'and' pointcut matches when all containing pointcuts match. Also, the bindings of all containing pointcuts are combined. This pointcut is implicitly created when using the '&' operator to combine two or more pointcuts.", "This pointcut expects one or more pointcuts as arguments. These pointcuts can be of any kind.", @@ -95,14 +96,15 @@ public class PointcutFactory { "any pointcut", "If the contained pointcut is not matched, then the return value is a singleton set consisting of new Object(), or else it is null")); - // binding pointcuts + registerGlobalPointcut("bind", BindPointcut.class, createDoc(// "Adds a named binding for the contained pointcut. This pointcut is implicitly used when a named argument is applied to any other pointcut", "any pointcut", "the return value of the contained pointcut")); // semantic pointcuts + registerGlobalPointcut("currentType", CurrentTypePointcut.class, createDoc(// "Attempts to match on the declared type of the current expression.", "A String, Class, or ClassNode to match against. Alternatively, another pointcut can be passed in to match against", @@ -113,8 +115,8 @@ public class PointcutFactory { "This pointcut does not take any arguments", "The singleton set of the current type as a ClassNode.")); - // filtering pointcuts + registerGlobalPointcut("subType", SubTypePointcut.class, createDoc(// "Matches when the containing pointcut passes in a type (or a field or method declaration whose type) is a sub-type of the argument.", "A String, Class, or ClassNode specifying a type. The type passed in must be a sub-type of this argument.", @@ -154,11 +156,12 @@ public class PointcutFactory { registerGlobalPointcut("sourceFolderOfCurrentType", SourceFolderOfTypePointcut.class, createDoc(// "Matches on the source folder of the current type.", - "the name of the source folder to match on. Do not include the project name or a slash at the beginning of the name. For example, the following will match the controller folder:
SourceFolderOfTypePointcut('grails-app/controllers')
", + "The name of the source folder to match on. Do not include the project name or a slash at the beginning of the name." + + " For example, the following will match the controller folder:
SourceFolderOfTypePointcut('grails-app/controllers')
", "If there is a match, then the source folder name is returned as a singleton set, otherwise null.")); - // inside of method calls, declarations, and annotations + registerGlobalPointcut("hasAttribute", HasAttributesPointcut.class, createDoc(// "Matches if the enclosing annotatedBy pointcut has attributes specified by the pointcut argument.", "If the enclosing argument is a String, then the match will be on the attribute name. Otherwise, the name and value pointcuts can be used instead.", @@ -186,8 +189,8 @@ public class PointcutFactory { "A String, Class object, or ClassNode corresponding to the type to match.", "A singleton set of the type as a Groovy ClassNode.")); - // lexical pointcuts + registerGlobalPointcut("enclosingClass", EnclosingClassPointcut.class, createDoc(// "Matches if the current inferencing location is inside of a class or enum declaration. A synonym for isClass", "A string, Class, ClassNode, or Pointcut further constraining what to match on. If there are no arguments, then a simple check on the enclosing type is performed.", @@ -258,8 +261,8 @@ public class PointcutFactory { "The identifier name on which to match", "The matched ConstantExpression or VariableExpression as a singleton set.")); - // structural pointcuts + registerGlobalPointcut("fileExtension", FileExtensionPointcut.class, createDoc(// "Matches on the file extension of the file being inferred.", "The file extension without the '.'", @@ -288,8 +291,8 @@ public class PointcutFactory { "The name of the source folder to match", "The full name of the source folder, or null if there was no match.")); - // deprecated + registerGlobalPointcut("currentTypeIsEnclosingType", CurrentTypeIsEnclosingTypePointcut.class, createDoc(// "Deprecated: use isThisType instead.

" + "Matches when the current type being inferred is the same as the enclosing type declaration. " + @@ -312,9 +315,9 @@ private static String createDoc(String description, String expects, String retur private static String createFind(String kind, String kinds) { return createDoc( "Matches when the containing pointcut passes in a type or a list of " + kinds + " that has at least one " + kind + " specified by the argument of this pointcut.", - "A String corresponding to a " + kind + ". Alternatively, a pointcut, such as annotatedBy, which " + "would match all " + kinds + " annotated by the inner pointcut.", - "The " + kind + " or " + kinds + " matched by the argument. " + "Eg- If the surrounding pointcut passes in a type, then the value returned will be the set of all " + kinds + " in that " + - "type that match the contained pointcut or have the specified signature." + " If the surrounding pointcut passes in a set of " + kinds + ", then the result will be a subset of those " + kinds + " that satisfy the contained pointcut or have the specified signature."); + "A String corresponding to a " + kind + ". Alternatively, a pointcut, such as annotatedBy, which would match all " + kinds + " annotated by the inner pointcut.", + "The " + kind + " or " + kinds + " matched by the argument. Eg- If the surrounding pointcut passes in a type, then the value returned will be the set of all " + kinds + " in that " + + "type that match the contained pointcut or have the specified signature. If the surrounding pointcut passes in a set of " + kinds + ", then the result will be a subset of those " + kinds + " that satisfy the contained pointcut or have the specified signature."); } private static String createModifier(String modifier) { diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/AbstractCheckerAction.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/AbstractCheckerAction.java index 7ce6827b7d..e92b83ca98 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/AbstractCheckerAction.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/AbstractCheckerAction.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -36,7 +36,7 @@ public class AbstractCheckerAction { protected List findSelection() { List currentSelection; - if (! (selection instanceof IStructuredSelection)) { + if (!(selection instanceof IStructuredSelection)) { currentSelection = null; } List elts = ((IStructuredSelection) selection).toList(); @@ -53,7 +53,7 @@ protected List findSelection() { currentSelection.add(candidate); } } - if (currentSelection.size() == 0) { + if (currentSelection.isEmpty()) { currentSelection = null; } return currentSelection; diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/DSLDClasspathContainerAction.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/DSLDClasspathContainerAction.java index 86207d3242..7aa42fe02f 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/DSLDClasspathContainerAction.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/DSLDClasspathContainerAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2020 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/DSLPreferencesPage.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/DSLPreferencesPage.java index a4a472e5c8..3728dd6bc1 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/DSLPreferencesPage.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/DSLPreferencesPage.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/NewDSLDWizard.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/NewDSLDWizard.java index a9182e8e94..cd7a7acd48 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/NewDSLDWizard.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/NewDSLDWizard.java @@ -1,5 +1,5 @@ /* - * Copyright 2009-2019 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/RefreshDSLDFilesActionDelegate.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/RefreshDSLDFilesActionDelegate.java index e39dd27a20..b01e6f52e5 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/RefreshDSLDFilesActionDelegate.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/RefreshDSLDFilesActionDelegate.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/RemoveCheckerWarnings.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/RemoveCheckerWarnings.java index 50ec79f463..cf200baa3f 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/RemoveCheckerWarnings.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/RemoveCheckerWarnings.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/StaticTypeCheckAction.java b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/StaticTypeCheckAction.java index 50f45afe9d..024e3580f9 100644 --- a/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/StaticTypeCheckAction.java +++ b/ide/org.codehaus.groovy.eclipse.dsl/src/org/codehaus/groovy/eclipse/dsl/ui/StaticTypeCheckAction.java @@ -1,11 +1,11 @@ /* - * Copyright 2009-2017 the original author or authors. + * Copyright 2009-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS,