Skip to content

Commit

Permalink
Merge pull request #1898 from eclipse-jdt/master
Browse files Browse the repository at this point in the history
Merge master to BETA_JAVA24
  • Loading branch information
noopur2507 authored Jan 6, 2025
2 parents fa8511d + 2213f68 commit ff7d32a
Show file tree
Hide file tree
Showing 251 changed files with 6,367 additions and 5,269 deletions.
2 changes: 1 addition & 1 deletion .mvn/extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<extension>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-build</artifactId>
<version>4.0.8</version>
<version>4.0.10</version>
</extension>
</extensions>
8 changes: 0 additions & 8 deletions org.eclipse.jdt.core.manipulation/.settings/.api_filters
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,4 @@
</message_arguments>
</filter>
</resource>
<resource path="proposals/org/eclipse/jdt/ui/text/IJavaPartitions.java" type="org.eclipse.jdt.ui.text.IJavaPartitions">
<filter id="403767336">
<message_arguments>
<message_argument value="org.eclipse.jdt.ui.text.IJavaPartitions"/>
<message_argument value="JAVA_MARKDOWN_COMMENT"/>
</message_arguments>
</filter>
</resource>
</component>
2 changes: 1 addition & 1 deletion org.eclipse.jdt.core.manipulation/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.jdt.core.manipulation
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.core.manipulation; singleton:=true
Bundle-Version: 1.21.300.qualifier
Bundle-Version: 1.21.400.qualifier
Bundle-Vendor: %providerName
Bundle-Activator: org.eclipse.jdt.internal.core.manipulation.JavaManipulationPlugin
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2020 IBM Corporation and others.
* Copyright (c) 2000, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -114,7 +114,7 @@ private ImportReferencesCollector(IJavaProject project, CompilationUnit astRoot,
fTypeImports= resultingTypeImports;
fStaticImports= resultingStaticImports;
fSubRange= rangeLimit;
if (project == null || !JavaModelUtil.is50OrHigher(project)) {
if (project == null) {
fStaticImports= null; // do not collect
}
fASTRoot= astRoot; // can be null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2023 IBM Corporation and others.
* Copyright (c) 2000, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -42,7 +42,6 @@
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.core.SourceRange;
Expand Down Expand Up @@ -74,9 +73,9 @@
import org.eclipse.jdt.internal.corext.dom.ASTNodes;
import org.eclipse.jdt.internal.corext.dom.Bindings;
import org.eclipse.jdt.internal.corext.dom.ScopeAnalyzer;
import org.eclipse.jdt.internal.corext.util.StaticImportFavoritesCompletionInvoker;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.corext.util.JdtFlags;
import org.eclipse.jdt.internal.corext.util.StaticImportFavoritesCompletionInvoker;



Expand Down Expand Up @@ -204,7 +203,7 @@ private static class UnresolvedTypeData {

public UnresolvedTypeData(SimpleName ref) {
this.ref= ref;
this.typeKinds= ASTResolving.getPossibleTypeKinds(ref, true);
this.typeKinds= ASTResolving.getPossibleTypeKinds(ref);
this.foundInfos= new ArrayList<>(3);
}

Expand Down Expand Up @@ -233,7 +232,6 @@ public void addInfo(TypeNameMatch info) {
private IPackageFragment fCurrPackage;

private ScopeAnalyzer fAnalyzer;
private boolean fAllowDefaultPackageImports;

private Map<String, UnresolvedTypeData> fUnresolvedTypes;
private Set<String> fImportsAdded;
Expand All @@ -259,8 +257,6 @@ public TypeReferenceProcessor(Set<String> oldSingleImports, Set<String> oldDeman

fCurrPackage= (IPackageFragment) cu.getParent();

fAllowDefaultPackageImports= JavaCore.VERSION_1_3.equals(cu.getJavaProject().getOption(JavaCore.COMPILER_SOURCE, true));

fImportsAdded= new HashSet<>();
fUnresolvedTypes= new HashMap<>();
}
Expand Down Expand Up @@ -364,12 +360,10 @@ public boolean process(IProgressMonitor monitor) throws JavaModelException {
TypeNameMatchCollector collector= new TypeNameMatchCollector(typesFound);
new SearchEngine().searchAllTypeNames(null, allTypes, scope, collector, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, monitor);

boolean is50OrHigher= JavaModelUtil.is50OrHigher(project);

for (TypeNameMatch curr : typesFound) {
UnresolvedTypeData data= fUnresolvedTypes.get(curr.getSimpleTypeName());
if (data != null && isVisible(curr) && isOfKind(curr, data.typeKinds, is50OrHigher)) {
if (fAllowDefaultPackageImports || curr.getPackageName().length() > 0) {
if (data != null && isVisible(curr) && isOfKind(curr, data.typeKinds)) {
if (curr.getPackageName().length() > 0) {
data.addInfo(curr);
}
}
Expand Down Expand Up @@ -447,13 +441,13 @@ private TypeNameMatch[] processTypeInfo(List<TypeNameMatch> typeRefsFound) {
}
}

private boolean isOfKind(TypeNameMatch curr, int typeKinds, boolean is50OrHigher) {
private boolean isOfKind(TypeNameMatch curr, int typeKinds) {
int flags= curr.getModifiers();
if (Flags.isAnnotation(flags)) {
return is50OrHigher && (typeKinds & TypeKinds.ANNOTATIONS) != 0;
return (typeKinds & TypeKinds.ANNOTATIONS) != 0;
}
if (Flags.isEnum(flags)) {
return is50OrHigher && (typeKinds & TypeKinds.ENUMS) != 0;
return (typeKinds & TypeKinds.ENUMS) != 0;
}
if (Flags.isInterface(flags)) {
return (typeKinds & TypeKinds.INTERFACES) != 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020, 2024 Fabrice TIERCELIN and others.
* Copyright (c) 2020, 2025 Fabrice TIERCELIN and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -57,7 +57,6 @@
import org.eclipse.jdt.internal.corext.fix.CompilationUnitRewriteOperationsFixCore.CompilationUnitRewriteOperation;
import org.eclipse.jdt.internal.corext.fix.LinkedProposalModelCore;
import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;

import org.eclipse.jdt.ui.cleanup.CleanUpRequirements;
import org.eclipse.jdt.ui.cleanup.ICleanUpFix;
Expand Down Expand Up @@ -122,7 +121,7 @@ public String getPreview() {

@Override
protected ICleanUpFix createFix(final CompilationUnit unit) throws CoreException {
if (!isEnabled(CleanUpConstants.MULTI_CATCH) || !JavaModelUtil.is1d7OrHigher(unit.getJavaElement().getJavaProject())) {
if (!isEnabled(CleanUpConstants.MULTI_CATCH)) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019 Red Hat Inc. and others.
* Copyright (c) 2019, 2024 Red Hat Inc. and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -26,7 +26,6 @@
import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
import org.eclipse.jdt.internal.corext.fix.CompilationUnitRewriteOperationsFixCore;
import org.eclipse.jdt.internal.corext.fix.UnnecessaryArrayCreationFixCore;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;

import org.eclipse.jdt.ui.cleanup.CleanUpRequirements;
import org.eclipse.jdt.ui.cleanup.ICleanUpFix;
Expand Down Expand Up @@ -71,7 +70,7 @@ public String getPreview() {

@Override
protected ICleanUpFix createFix(CompilationUnit unit) throws CoreException {
if (!isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_ARRAY_CREATION) || !JavaModelUtil.is50OrHigher(unit.getJavaElement().getJavaProject())) {
if (!isEnabled(CleanUpConstants.REMOVE_UNNECESSARY_ARRAY_CREATION)) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ private CorrectionMessages() {
public static String LocalCorrectionsSubProcessor_surroundwith_trymulticatch_var_description;
public static String LocalCorrectionsSubProcessor_add_default_case_description;
public static String LocalCorrectionsSubProcessor_add_default_case_label_description;
public static String LocalCorrectionsSubProcessor_add_permitted_types_description;
public static String LocalCorrectionsSubProcessor_remove_default_case_description;
public static String LocalCorrectionsSubProcessor_add_missing_cases_description;
public static String LocalCorrectionsSubProcessor_addthrows_description;
Expand Down Expand Up @@ -350,6 +351,7 @@ private CorrectionMessages() {
public static String QuickAssistProcessor_invertequals_description;
public static String QuickAssistProcessor_typetoarrayInitializer_description;
public static String QuickAssistProcessor_createmethodinsuper_description;
public static String QuickAssistProcessor_create_permitted_switch_cases_desc;
public static String LinkedNamesAssistProposal_proposalinfo;
public static String LinkedNamesAssistProposal_description;
public static String QuickTemplateProcessor_surround_label;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ LocalCorrectionsSubProcessor_surroundwith_trymulticatch_description=Surround wit
LocalCorrectionsSubProcessor_surroundwith_trymulticatch_var_description=Change type of ''{0}'' to ''{1}'' and surround with try/multi-catch
LocalCorrectionsSubProcessor_add_default_case_description=Add 'default' case
LocalCorrectionsSubProcessor_add_default_case_label_description=Add 'default' case label
LocalCorrectionsSubProcessor_add_permitted_types_description=Add permitted type cases
LocalCorrectionsSubProcessor_remove_default_case_description=Remove 'default' case
LocalCorrectionsSubProcessor_add_missing_cases_description=Add missing case statements
LocalCorrectionsSubProcessor_addthrows_description=Add throws declaration
Expand Down Expand Up @@ -452,6 +453,7 @@ QuickAssistProcessor_create_new_impl=Create new implementation of ''{0}''
QuickAssistProcessor_create_new_impl_desc=Open the New > Class wizard.
QuickAssistProcessor_create_new_interface_impl=Create new interface, extending ''{0}''
QuickAssistProcessor_create_new_interface_impl_desc=Open the New > Interface wizard.
QuickAssistProcessor_create_permitted_switch_cases_desc=Add permitted type case stubs.

LinkedNamesAssistProposal_proposalinfo=Link all references for a local rename (does not change references in other files)
LinkedNamesAssistProposal_description=Rename in file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.compiler.IProblem;
import org.eclipse.jdt.core.dom.AST;
Expand Down Expand Up @@ -59,7 +58,6 @@
import org.eclipse.jdt.internal.corext.dom.Bindings;
import org.eclipse.jdt.internal.corext.refactoring.RefactoringAvailabilityTesterCore;
import org.eclipse.jdt.internal.corext.refactoring.sef.SelfEncapsulateFieldRefactoring;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.corext.util.Messages;

import org.eclipse.jdt.ui.text.java.IInvocationContext;
Expand Down Expand Up @@ -339,15 +337,13 @@ private static boolean isBoolean(ProposalParameter context) {
private static Expression getAssignedValue(ProposalParameter context) {
ASTNode parent= context.accessNode.getParent();
ASTRewrite astRewrite= context.astRewrite;
IJavaProject javaProject= context.compilationUnit.getJavaProject();
IMethodBinding getter= findGetter(context);
Expression getterExpression= null;
if (getter != null) {
getterExpression= astRewrite.getAST().newSimpleName("placeholder"); //$NON-NLS-1$
}
ITypeBinding type= context.variableBinding.getType();
boolean is50OrHigher= JavaModelUtil.is50OrHigher(javaProject);
Expression result= GetterSetterUtil.getAssignedValue(parent, astRewrite, getterExpression, type, is50OrHigher);
Expression result= GetterSetterUtil.getAssignedValue(parent, astRewrite, getterExpression, type);
if (result != null && getterExpression != null && getterExpression.getParent() != null) {
getterExpression.getParent().setStructuralProperty(getterExpression.getLocationInParent(), createMethodInvocation(context, getter, null));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2012, 2023 IBM Corporation and others.
* Copyright (c) 2012, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -30,6 +30,7 @@ public interface IProposalRelevance {
int CREATE_NON_STATIC_ACCESS_USING_DECLARING_TYPE= 12;
int CREATE_INDIRECT_ACCESS_TO_STATIC= 12;
int CREATE_NON_STATIC_ACCESS_USING_INSTANCE_TYPE= 11;
int ADD_PERMITTED_TYPES= 11;

int REMOVE_UNUSED_CAST= 10;
int ADD_UNIMPLEMENTED_METHODS= 10;
Expand Down
Loading

0 comments on commit ff7d32a

Please sign in to comment.