diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/GenerateToStringHandler.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/GenerateToStringHandler.java index 9191f457b9..aadddc1d9a 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/GenerateToStringHandler.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/GenerateToStringHandler.java @@ -201,7 +201,6 @@ public static TextEdit generateToString(IType type, LspVariableBinding[] fields, settings.customBuilderSettings = new CustomBuilderSettings(); if (type.getCompilationUnit().getJavaProject() != null) { String version = type.getCompilationUnit().getJavaProject().getOption(JavaCore.COMPILER_SOURCE, true); - settings.is50orHigher = !JavaModelUtil.isVersionLessThan(version, JavaCore.VERSION_1_5); settings.is60orHigher = !JavaModelUtil.isVersionLessThan(version, JavaCore.VERSION_1_6); } diff --git a/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/GenerateToStringHandlerTest.java b/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/GenerateToStringHandlerTest.java index 2394c3ad97..bbff2a49a1 100644 --- a/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/GenerateToStringHandlerTest.java +++ b/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/GenerateToStringHandlerTest.java @@ -130,7 +130,7 @@ public void testGenerateToString() throws ValidateEditException, CoreException, + " String[] arrays;\r\n" + " @Override\r\n" + " public String toString() {\r\n" - + " return \"B [name=\" + name + \", id=\" + id + \", aList=\" + aList + \", arrays=\" + (arrays != null ? Arrays.asList(arrays) : null) + \", getClass()=\" + getClass() + \", hashCode()=\" + hashCode() + \", toString()=\" + super.toString() + \"]\";\r\n" + + " return \"B [name=\" + name + \", id=\" + id + \", aList=\" + aList + \", arrays=\" + Arrays.toString(arrays) + \", getClass()=\" + getClass() + \", hashCode()=\" + hashCode() + \", toString()=\" + super.toString() + \"]\";\r\n" + " }\r\n" + "}"; /* @formatter:on */ @@ -218,7 +218,6 @@ public void testGenerateToString_customizedSettings() throws ValidateEditExcepti settings.limitElements = true; settings.limitValue = 10; settings.customBuilderSettings = new CustomBuilderSettings(); - settings.is50orHigher = true; settings.is60orHigher = true; generateToString(unit.findPrimaryType(), settings); @@ -309,7 +308,7 @@ public void testGenerateToStringAfterCursorPosition() throws ValidateEditExcepti + " List aList;/*|*/\r\n" + " @Override\r\n" + " public String toString() {\r\n" - + " return \"B [name=\" + name + \", id=\" + id + \", aList=\" + aList + \", arrays=\" + (arrays != null ? Arrays.asList(arrays) : null) + \", getClass()=\" + getClass() + \", hashCode()=\" + hashCode() + \", toString()=\" + super.toString() + \"]\";\r\n" + + " return \"B [name=\" + name + \", id=\" + id + \", aList=\" + aList + \", arrays=\" + Arrays.toString(arrays) + \", getClass()=\" + getClass() + \", hashCode()=\" + hashCode() + \", toString()=\" + super.toString() + \"]\";\r\n" + " }\r\n" + " String[] arrays;\r\n" + "}"; @@ -365,7 +364,7 @@ public void testGenerateToStringBeforeCursorPosition() throws ValidateEditExcept + " int id;\r\n" + " @Override\r\n" + " public String toString() {\r\n" - + " return \"B [name=\" + name + \", id=\" + id + \", aList=\" + aList + \", arrays=\" + (arrays != null ? Arrays.asList(arrays) : null) + \", getClass()=\" + getClass() + \", hashCode()=\" + hashCode() + \", toString()=\" + super.toString() + \"]\";\r\n" + + " return \"B [name=\" + name + \", id=\" + id + \", aList=\" + aList + \", arrays=\" + Arrays.toString(arrays) + \", getClass()=\" + getClass() + \", hashCode()=\" + hashCode() + \", toString()=\" + super.toString() + \"]\";\r\n" + " }\r\n" + " List aList;/*|*/\r\n" + " String[] arrays;\r\n"