Skip to content

Commit b9233aa

Browse files
committed
Remove last Java 5 checks from UI
Having code to show errors if Java 5 JVM when Java UI migrates projects to Java 8 is pointless.
1 parent 83ea560 commit b9233aa

File tree

7 files changed

+1
-49
lines changed

7 files changed

+1
-49
lines changed

org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2471,8 +2471,6 @@ public final class RefactoringCoreMessages extends NLS {
24712471

24722472
public static String TypeContextChecker_invalid_type_syntax;
24732473

2474-
public static String TypeContextChecker_no_vararg_below_50;
2475-
24762474
public static String TypeContextChecker_not_unique;
24772475

24782476
public static String TypeContextChecker_parameter_type;

org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/TypeContextChecker.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2020 IBM Corporation and others.
2+
* Copyright (c) 2000, 2024 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -493,11 +493,6 @@ public static RefactoringStatus checkParameterTypeSyntax(String type, IJavaProje
493493
return RefactoringStatus.createFatalErrorStatus(msg);
494494
}
495495

496-
if (ParameterInfo.isVarargs(type) && ! JavaModelUtil.is50OrHigher(project)) {
497-
String msg= Messages.format(RefactoringCoreMessages.TypeContextChecker_no_vararg_below_50, typeLabel);
498-
return RefactoringStatus.createFatalErrorStatus(msg);
499-
}
500-
501496
List<String> problemsCollector= new ArrayList<>(0);
502497
Type parsedType= parseType(newTypeName, project, problemsCollector);
503498
boolean valid= parsedType != null;

org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,6 @@ TypeContextChecker_couldNotResolveType=Could not resolve type ''{0}''.
850850
TypeContextChecker_ambiguous=Parameter type name ''{0}'' is ambiguous. There are {1} types with that name.
851851
TypeContextChecker_not_unique=Parameter type name ''{0}'' cannot be uniquely resolved or is not a valid type name.
852852
TypeContextChecker_parameter_type=Enter the type for parameter ''{0}''.
853-
TypeContextChecker_no_vararg_below_50=''{0}'' is not a valid parameter type; variable arity parameters are only supported if the source level is 1.5.
854853
TypeContextChecker_invalid_type_name=''{0}'' is not a valid parameter type.
855854
TypeContextChecker_invalid_type_syntax=''{0}'' is not a valid parameter type: {1}.
856855
TypeContextChecker_return_type_not_empty=The return type cannot be empty.

org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/util/JavaModelUtil.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -787,11 +787,6 @@ public static boolean isVersionLessThan(String version1, String version2) {
787787
return JavaCore.compareJavaVersions(version1, version2) < 0;
788788
}
789789

790-
791-
public static boolean is50OrHigher(String compliance) {
792-
return !isVersionLessThan(compliance, JavaCore.VERSION_1_5);
793-
}
794-
795790
public static boolean is1d7OrHigher(String compliance) {
796791
return !isVersionLessThan(compliance, JavaCore.VERSION_1_7);
797792
}
@@ -860,16 +855,6 @@ public static boolean is23OrHigher(String compliance) {
860855
return !isVersionLessThan(compliance, JavaCore.VERSION_23);
861856
}
862857

863-
/**
864-
* Checks if the given project or workspace has source compliance 1.5 or greater.
865-
*
866-
* @param project the project to test or <code>null</code> to test the workspace settings
867-
* @return <code>true</code> if the given project or workspace has source compliance 1.5 or greater.
868-
*/
869-
public static boolean is50OrHigher(IJavaProject project) {
870-
return is50OrHigher(getSourceCompliance(project));
871-
}
872-
873858
/**
874859
* Checks if the given project or workspace has source compliance 1.7 or greater.
875860
*

org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ private NewWizardMessages() {
115115
public static String NewTypeWizardPage_error_PackageNameEmptyForModule;
116116
public static String NewTypeWizardPage_warning_DiscouragedPackageName;
117117
public static String NewTypeWizardPage_warning_DefaultPackageDiscouraged;
118-
public static String NewTypeWizardPage_warning_NotJDKCompliant;
119118
public static String NewTypeWizardPage_warning_NotJDKCompliant2;
120119
public static String NewTypeWizardPage_warning_EnumClassNotFound;
121120
public static String NewTypeWizardPage_warning_RecordClassNotFound;
@@ -158,13 +157,10 @@ private NewWizardMessages() {
158157
public static String NewTypeWizardPage_error_QualifiedName;
159158
public static String NewTypeWizardPage_info_FileExtensionNotRequired;
160159
public static String NewTypeWizardPage_warning_TypeNameDiscouraged;
161-
public static String NewTypeWizardPage_error_TypeParameters;
162160
public static String NewTypeWizardPage_error_InvalidSuperClassName;
163161
public static String NewTypeWizardPage_error_InvalidSuperClassRecord;
164162
public static String NewTypeWizardPage_error_InvalidFinalSuperClass;
165-
public static String NewTypeWizardPage_error_SuperClassNotParameterized;
166163
public static String NewTypeWizardPage_error_InvalidSuperInterfaceName;
167-
public static String NewTypeWizardPage_error_SuperInterfaceNotParameterized;
168164
public static String NewTypeWizardPage_error_ModifiersFinalAndAbstract;
169165
public static String NewTypeWizardPage_error_TypeNameFiltered;
170166
public static String NewTypeWizardPage_error_PackageNameFiltered;

org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/NewWizardMessages.properties

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ NewTypeWizardPage_error_PackageNameEmptyForModule=A package name must be specifi
9090
NewTypeWizardPage_error_uri_location_unkown=Cannot locate resource {0}
9191
NewTypeWizardPage_warning_DiscouragedPackageName=This package name is discouraged. {0}
9292
NewTypeWizardPage_warning_DefaultPackageDiscouraged=The use of the default package is discouraged.
93-
NewTypeWizardPage_warning_NotJDKCompliant=Project ''{0}'' is not a J2SE 5.0 compliant project.
9493
NewTypeWizardPage_warning_NotJDKCompliant2=Project ''{0}'' is not a Java {1} compliant project.
9594
NewTypeWizardPage_warning_EnumClassNotFound=Type 'java.lang.Enum' is not on the project's build path. Make sure you use a 1.5 JDK.
9695
NewTypeWizardPage_warning_RecordClassNotFound=Type 'java.lang.Record' is not on the project's build path. Make sure you use a 14 JDK.
@@ -140,12 +139,9 @@ NewTypeWizardPage_error_InvalidTypeName=Type name is not valid. {0}
140139
NewTypeWizardPage_error_QualifiedName=Type name must not be qualified.
141140
NewTypeWizardPage_info_FileExtensionNotRequired=The file extension '.java' will not be part of the type name.
142141
NewTypeWizardPage_warning_TypeNameDiscouraged=Type name is discouraged. {0}
143-
NewTypeWizardPage_error_TypeParameters=Type name is not valid. Type parameters are only available if source level is 1.5.
144142

145143
NewTypeWizardPage_error_InvalidSuperClassName=Superclass type is not valid.
146-
NewTypeWizardPage_error_SuperClassNotParameterized=Superclass cannot be parameterized unless source level is 1.5.
147144
NewTypeWizardPage_error_InvalidSuperInterfaceName=Extended interface ''{0}'' is not valid.
148-
NewTypeWizardPage_error_SuperInterfaceNotParameterized=Extended interface ''{0}'' cannot be parameterized unless source level is 1.5.
149145
NewTypeWizardPage_error_InvalidSuperClassRecord=Record ''{0}'' cannot be superclass. A record is final.
150146
NewTypeWizardPage_error_InvalidFinalSuperClass=Class ''{0}'' cannot be superclass as it is final.
151147

org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@
108108
import org.eclipse.jdt.core.dom.CompilationUnit;
109109
import org.eclipse.jdt.core.dom.ITypeBinding;
110110
import org.eclipse.jdt.core.dom.ImportDeclaration;
111-
import org.eclipse.jdt.core.dom.ParameterizedType;
112111
import org.eclipse.jdt.core.dom.Type;
113112
import org.eclipse.jdt.core.dom.TypeDeclaration;
114113
import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
@@ -1834,10 +1833,6 @@ protected IStatus containerChanged() {
18341833
IStatus status= super.containerChanged();
18351834
IPackageFragmentRoot root= getPackageFragmentRoot();
18361835
if ((fTypeKind == ANNOTATION_TYPE || fTypeKind == ENUM_TYPE) && !status.matches(IStatus.ERROR)) {
1837-
if (root != null && !JavaModelUtil.is50OrHigher(root.getJavaProject())) {
1838-
// error as createType will fail otherwise (bug 96928)
1839-
return new StatusInfo(IStatus.ERROR, Messages.format(NewWizardMessages.NewTypeWizardPage_warning_NotJDKCompliant, BasicElementLabels.getJavaElementName(root.getJavaProject().getElementName())));
1840-
}
18411836
if (root != null && fTypeKind == ENUM_TYPE) {
18421837
try {
18431838
// if findType(...) == null then Enum is unavailable
@@ -2150,10 +2145,6 @@ protected IStatus typeNameChanged() {
21502145
}
21512146

21522147
if (!typeNameWithParameters.equals(typeName) && project != null) {
2153-
if (!JavaModelUtil.is50OrHigher(project)) {
2154-
status.setError(NewWizardMessages.NewTypeWizardPage_error_TypeParameters);
2155-
return status;
2156-
}
21572148
String typeDeclaration= "class " + typeNameWithParameters + " {}"; //$NON-NLS-1$//$NON-NLS-2$
21582149
ASTParser parser= ASTParser.newParser(IASTSharedValues.SHARED_AST_LEVEL);
21592150
parser.setSource(typeDeclaration.toCharArray());
@@ -2212,10 +2203,6 @@ protected IStatus superClassChanged() {
22122203
status.setError(NewWizardMessages.NewTypeWizardPage_error_InvalidSuperClassName);
22132204
return status;
22142205
}
2215-
if (type instanceof ParameterizedType && ! JavaModelUtil.is50OrHigher(root.getJavaProject())) {
2216-
status.setError(NewWizardMessages.NewTypeWizardPage_error_SuperClassNotParameterized);
2217-
return status;
2218-
}
22192206
} else {
22202207
status.setError(""); //$NON-NLS-1$
22212208
}
@@ -2480,10 +2467,6 @@ protected IStatus superInterfacesChanged() {
24802467
status.setError(Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidSuperInterfaceName, BasicElementLabels.getJavaElementName(intfname)));
24812468
return status;
24822469
}
2483-
if (type instanceof ParameterizedType && ! JavaModelUtil.is50OrHigher(root.getJavaProject())) {
2484-
status.setError(Messages.format(NewWizardMessages.NewTypeWizardPage_error_SuperInterfaceNotParameterized, BasicElementLabels.getJavaElementName(intfname)));
2485-
return status;
2486-
}
24872470
}
24882471
}
24892472
fSealedSuperInterfacesStatus= validateSealedSuperInterfacesStatus();

0 commit comments

Comments
 (0)