diff --git a/java/openapi/resources/messages/JavaBundle.properties b/java/openapi/resources/messages/JavaBundle.properties index 65ba9ad2b270..18a7134d6aef 100644 --- a/java/openapi/resources/messages/JavaBundle.properties +++ b/java/openapi/resources/messages/JavaBundle.properties @@ -313,8 +313,8 @@ generate.tostring.exclude.constant.fields=Exclude constant fields generate.tostring.exclude.enum.fields=Exclude enum fields generate.tostring.exclude.logger=Exclude logger fields (Log4j, JDK Logging, Jakarta Commons Logging) generate.tostring.exclude.static.fields=Exclude static fields -generate.tostring.fully.qualified.class.name=Use fully qualified class name in code generation ($classname) -generate.tostring.getters.in.generated.code=Enable getters in code generation ($methods) +generate.tostring.fully.qualified.class.name=Use fully qualified class name in generated toString() ($classname) +generate.tostring.getters.in.generated.code=Use getters in generated toString() when available ($methods) generate.tostring.handle.exception.error.message=An unrecoverable exception was thrown while performing the action - see IDEA log for details (stacktrace should be in idea.log):\n{0} generate.tostring.handle.exception.plugin.warning.message=A PluginException was thrown while performing the action - see IDEA log for details (stacktrace should be in idea.log):\n{0} generate.tostring.handle.exception.velocity.error.message=Velocity error generating code - see IDEA log for more details (stacktrace should be in idea.log):\n{0} diff --git a/plugins/generate-tostring/src/org/jetbrains/java/generate/GenerateToStringWorker.java b/plugins/generate-tostring/src/org/jetbrains/java/generate/GenerateToStringWorker.java index d2747816898d..4a7ff099f537 100644 --- a/plugins/generate-tostring/src/org/jetbrains/java/generate/GenerateToStringWorker.java +++ b/plugins/generate-tostring/src/org/jetbrains/java/generate/GenerateToStringWorker.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. /* * @author max @@ -102,10 +88,15 @@ public class GenerateToStringWorker { } private PsiMethod getMethodPrototype(Collection selectedMembers, Map params, TemplateResource template) { - // generate code using velocity - String evaluatedText = GenerationUtil - .velocityGenerateCode(clazz, selectedMembers, params, template.getTemplate(), config.getSortElements(), config.isUseFullyQualifiedName()); - // create psi newMethod named toString() + String evaluatedText = GenerationUtil.velocityGenerateCode(clazz, + selectedMembers, + Set.of(), + params, + Map.of(), + template.getTemplate(), + config.getSortElements(), + config.isUseFullyQualifiedName(), + config.isEnableMethods()); final JVMElementFactory topLevelFactory = JVMElementFactories.getFactory(clazz.getLanguage(), clazz.getProject()); if (topLevelFactory == null) { return null;